idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
14,900 | public function downgrade ( ) { $ template = $ this -> getTemplate ( $ this -> getTemplateName ( ) ) ; $ fieldgroup = $ template -> fieldgroup ; $ fg = $ this -> wire ( 'fieldgroups' ) -> get ( $ template -> name ) ; $ minNumberToError = $ fg -> id == $ fieldgroup -> id ? 2 : 1 ; if ( $ fg -> numTemplates ( ) >= $ minN... | Delete the template Does delete all pages of that template and does even delete system templates |
14,901 | public function loadDescendantProductGroupIDListInto ( & $ idList ) { if ( $ children = $ this -> AllChildren ( ) ) { foreach ( $ children as $ child ) { if ( in_array ( $ child -> ID , $ idList ) ) { continue ; } if ( $ child instanceof self ) { $ idList [ ] = $ child -> ID ; $ child -> loadDescendantProductGroupIDLis... | loadDescendantProductGroupIDListInto function . |
14,902 | public function modify ( $ customerId , $ username , $ name , $ company , $ address , $ city , $ state , $ country , $ zipCode , $ phoneCC , $ phone , $ lang ) { return $ this -> post ( 'modify' , [ 'customer-id' => $ customerId , 'username' => $ username , 'name' => $ name , 'company' => $ company , 'address-line-1' =... | Modifies the Account details of the specified Customer . |
14,903 | public function signup ( $ username , $ passwd , $ name , $ company , $ address , $ city , $ state , $ country , $ zipCode , $ phoneCC , $ phone , $ lang ) { return $ this -> post ( 'signup' , [ 'username' => $ username , 'passwd' => $ passwd , 'name' => $ name , 'company' => $ company , 'address-line-1' => $ address ,... | Creates a Customer Account using the details provided . |
14,904 | public function setConfig ( $ config_location = NULL ) { static $ CAPTCHA_CONFIG = array ( ) ; $ path = ( NULL === $ config_location ) ? __DIR__ . DIRECTORY_SEPARATOR . 'captcha_config.php' : realpath ( $ config_location ) ; if ( false === $ path ) { throw new CaptchaException ( sprintf ( "Config File not found in: %s ... | Set global reCAPTCHA options by loading an external config file these options can be set for all instances of reCAPTCHA in your app this avoid to set options private and public Keys all the time individualy within your forms that has a Captcha widget . |
14,905 | public function displayHTML ( $ theme_name = NULL , $ options = array ( ) ) { if ( strlen ( $ this -> _publicKey == 0 ) ) { throw new CaptchaException ( 'To use reCAPTCHA you must get a Public API key from https://www.google.com/recaptcha/admin' ) ; } $ captcha_snippet = $ this -> _theme ( $ theme_name , $ options ) ; ... | Create embedded widget script HTML called within a form |
14,906 | public function isValid ( ) { if ( strtoupper ( $ _SERVER [ 'REQUEST_METHOD' ] ) !== 'POST' ) { return FALSE ; } else { $ captchaChallenge = isset ( $ _POST [ 'recaptcha_challenge_field' ] ) ? $ this -> _sanitizeField ( $ _POST [ 'recaptcha_challenge_field' ] ) : NULL ; $ captchaResponse = isset ( $ _POST [ 'recaptcha_... | Verifying reCAPTCHA User s Answer resolves response challenge return TRUE if the answer matches |
14,907 | protected function _postHttpChallenge ( array $ data ) { if ( strlen ( $ this -> _privateKey ) == 0 ) { throw new CaptchaException ( 'To use reCAPTCHA you must get a Private API key from https://www.google.com/recaptcha/admin' ) ; } $ responseHeader = '' ; $ result = array ( 'isvalid' => 'false' , 'error' => '' ) ; $ r... | reCAPTCHA API Request |
14,908 | private function _buildServerURI ( $ path = 'challenge' ) { $ uri = ( TRUE === $ this -> _ssl ) ? 'https://' : 'http://' ; $ uri .= self :: RECAPTCHA_API_SERVER ; $ uri .= ( $ path !== 'challenge' ) ? 'noscript' : $ path ; $ uri .= '?k=' . $ this -> _publicKey ; $ uri .= ( $ this -> _error ) ? '&error=' . $ this -> _er... | Build API server URI |
14,909 | public function getNodes ( $ content ) { $ items = array ( ) ; $ document = $ this -> createDocumentFromXML ( $ content ) ; $ nodes = $ document -> getElementsByTagName ( 'item' ) ; if ( $ nodes -> length ) { foreach ( $ nodes as $ node ) { try { $ item = $ this -> create ( $ node ) ; $ items [ ] = $ item ; } catch ( \... | Retrieve a Items s array |
14,910 | protected static function _defineRelationships ( ) { $ className = get_called_class ( ) ; $ classes = class_parents ( $ className ) ; array_unshift ( $ classes , $ className ) ; static :: $ _classRelationships [ $ className ] = [ ] ; while ( $ class = array_pop ( $ classes ) ) { if ( ! empty ( $ class :: $ relationship... | Called when anything relationships related is used for the first time to define relationships before _initRelationships |
14,911 | protected static function _initRelationships ( ) { $ className = get_called_class ( ) ; if ( ! empty ( static :: $ _classRelationships [ $ className ] ) ) { $ relationships = [ ] ; foreach ( static :: $ _classRelationships [ $ className ] as $ relationship => $ options ) { if ( is_array ( $ options ) ) { $ relationship... | Called after _defineRelationships to initialize and apply defaults to the relationships property Must be idempotent as it may be applied multiple times up the inheritence chain |
14,912 | protected function resolveValue ( $ field ) { $ cur = & $ this -> _record ; if ( array_key_exists ( $ field , $ cur ) ) { $ cur = & $ cur [ $ field ] ; } else { return null ; } return $ cur ; } | protected instance methods |
14,913 | public function getComments ( $ newestFirst = true , $ limit = null , $ offset = null ) { $ query = Comment :: find ( ) -> subject ( $ this -> owner ) ; $ query -> orderNewestFirst ( $ newestFirst ) ; if ( $ limit !== null ) $ query -> limit ( $ limit ) ; if ( $ offset !== null ) $ query -> offset ( $ offset ) ; return... | Fetches comments related to the owner of this behavior |
14,914 | protected function getImageSizeList ( ) { $ arrSizes = \ System :: getContainer ( ) -> get ( 'contao.image.image_sizes' ) -> getAllOptions ( ) ; if ( is_array ( $ arrList = \ StringUtil :: deserialize ( $ this -> sizeList ) ) ) { $ arrSizes [ 'image_sizes' ] = array_intersect_key ( $ arrSizes [ 'image_sizes' ] , array_... | Get a list of image sizes |
14,915 | protected function eachPageUncache ( $ selector , callable $ callback ) { $ num = 0 ; $ id = 0 ; while ( true ) { $ p = $ this -> pages -> get ( "{$selector}, id>$id" ) ; if ( ! $ id = $ p -> id ) break ; $ callback ( $ p ) ; $ this -> pages -> uncacheAll ( $ p ) ; $ num ++ ; } return $ num ; } | Cycle over a group of pages without running into memory exhaustion |
14,916 | protected function insertIntoTemplate ( $ template , $ field , $ reference = null , $ after = true ) { $ template = $ this -> getTemplate ( $ template ) ; $ fieldgroup = $ template -> fieldgroup ; $ method = $ after ? 'insertAfter' : 'insertBefore' ; $ field = $ this -> getField ( $ field ) ; if ( $ reference instanceo... | Insert a field into a template optionally at a specific position . |
14,917 | protected function removeFromTemplate ( $ template , $ field ) { $ t = $ this -> getTemplate ( $ template ) ; $ f = $ this -> getField ( $ field ) ; $ success = $ t -> fieldgroup -> remove ( $ f ) ; $ t -> fieldgroup -> save ( ) ; return $ success ; } | Removes a field from a template . Also removes all data for that field from pages using the template . |
14,918 | protected function editInTemplateContext ( $ template , $ field , callable $ callback ) { $ template = $ this -> getTemplate ( $ template ) ; $ fieldgroup = $ template -> fieldgroup ; $ field = $ this -> getField ( $ field ) ; $ context = $ fieldgroup -> getField ( $ field -> name , true ) ; $ callback ( $ context , $ ... | Edit a field in template context |
14,919 | public function setPickerOptions ( $ value , $ dc ) { $ db = Database :: getInstance ( ) ; switch ( $ value ) { case 'datetime' : if ( ! in_array ( $ dc -> activeRecord -> rgxp , array ( 'date' , 'time' , 'datim' ) ) ) { $ db -> prepare ( "UPDATE " . $ this -> table . " SET rgxp=? WHERE id=?" ) -> execute ( 'date' , $ ... | Adjust maxlength and multiple settings according to the rgxp settings |
14,920 | public function setMultipleOption ( $ value , $ dc ) { $ db = Database :: getInstance ( ) ; if ( $ value > 3 && $ dc -> activeRecord -> maxLength > 200 ) { $ db -> prepare ( "UPDATE " . $ this -> table . " SET maxLength=? WHERE id=?" ) -> execute ( 200 , $ dc -> activeRecord -> id ) ; } return $ value ; } | Reduce the maxLength for 4 input fields |
14,921 | public function setSourceOptions ( $ value , $ dc ) { $ db = Database :: getInstance ( ) ; if ( $ value == 'video' || $ value == 'audio' ) { if ( ! $ dc -> activeRecord -> multiSource ) { $ db -> prepare ( "UPDATE " . $ this -> table . " SET multiSource=? WHERE id=?" ) -> execute ( 1 , $ dc -> activeRecord -> id ) ; } ... | Adjust multiSource and sortBy according to the source type |
14,922 | public function getPattern ( $ dc ) { $ pattern = array ( ) ; foreach ( $ GLOBALS [ 'TL_CTP' ] as $ k => $ v ) { foreach ( $ v as $ kk => $ vv ) { if ( ! $ vv [ 'unique' ] ) { $ pattern [ $ k ] [ ] = $ kk ; } elseif ( \ PatternModel :: countByPidAndType ( $ dc -> activeRecord -> pid , $ kk ) < 1 || $ dc -> activeRecord... | Return content pattern as array |
14,923 | public function saveGroups ( $ dc ) { $ db = Database :: getInstance ( ) ; if ( $ dc -> activeRecord -> type == 'protection' && ! $ dc -> activeRecord -> canChangeGroups ) { $ groups = is_array ( $ dc -> activeRecord -> groups ) ? serialize ( $ dc -> activeRecord -> groups ) : $ dc -> activeRecord -> groups ; $ db -> p... | Save group settings from the pattern to the content element |
14,924 | public function getForms ( ) { $ arrForms = array ( ) ; $ objForms = $ this -> Database -> execute ( "SELECT id, title FROM tl_form ORDER BY title" ) ; while ( $ objForms -> next ( ) ) { $ arrForms [ $ objForms -> id ] = $ objForms -> title . ' (ID ' . $ objForms -> id . ')' ; } return $ arrForms ; } | Get forms and return them as array |
14,925 | public function exportTables ( $ xml , $ objArchive , $ objThemeId ) { $ tables = $ xml -> getElementsByTagName ( 'tables' ) [ 0 ] ; $ table = $ xml -> createElement ( 'table' ) ; $ table -> setAttribute ( 'name' , 'tl_elements' ) ; $ table = $ tables -> appendChild ( $ table ) ; $ this -> loadDataContainer ( 'tl_eleme... | Export content blocks tables with template export |
14,926 | protected function addPatternData ( $ xml , $ table , $ arrOrder , $ intParentID ) { $ objContentPattern = $ this -> Database -> prepare ( "SELECT * FROM tl_pattern WHERE pid=?" ) -> execute ( $ intParentID ) ; while ( $ objContentPattern -> next ( ) ) { $ this -> addDataRow ( $ xml , $ table , $ objContentPattern -> r... | Add pattern recursively |
14,927 | public function getCombinations ( array $ sourceDataSet , $ subsetSize = null ) { if ( isset ( $ subsetSize ) ) { return $ this -> _getCombinationSubset ( $ sourceDataSet , $ subsetSize ) ; } $ masterCombinationSet = [ ] ; $ sourceDataSetLength = count ( $ sourceDataSet ) ; for ( $ i = 1 ; $ i <= $ sourceDataSetLength ... | Creates all the possible combinations for the source data set . |
14,928 | protected function _getCombinationSubset ( array $ sourceDataSet , $ subsetSize ) { if ( ! isset ( $ subsetSize ) || $ subsetSize < 0 ) { throw new \ InvalidArgumentException ( 'Subset size cannot be empty or less than 0' ) ; } $ sourceSetSize = count ( $ sourceDataSet ) ; if ( $ subsetSize >= $ sourceSetSize ) { retur... | Calculates all the combinations of a given subset size . |
14,929 | private function _getCombination ( $ sourceDataSet , $ setKeyList , Pointer $ pointer ) { $ combination = array ( ) ; $ indexPointerList = $ pointer -> getPointerList ( ) ; foreach ( $ indexPointerList as $ indexPointer ) { $ namedKey = $ setKeyList [ $ indexPointer ] ; $ combination [ $ namedKey ] = $ sourceDataSet [ ... | Get the combination for the current pointer positions . |
14,930 | public function generateDCA ( $ strFieldName , $ arrFieldDCA = array ( ) , $ bolVisble = true , $ bolCallbacks = true ) { $ strVirtualField = $ this -> virtualFieldName ( $ strFieldName ) ; if ( $ bolVisble ) { $ GLOBALS [ 'TL_DCA' ] [ 'tl_content' ] [ 'palettes' ] [ $ this -> element ] .= ',' . $ strVirtualField ; } i... | Generate the DCA for a virtual input field |
14,931 | protected function virtualFieldName ( $ strFieldName ) { $ strVirtualField = $ this -> pattern . '-' . $ strFieldName ; if ( $ this -> data !== null ) { $ strVirtualField .= '-' . $ this -> data -> id ; } return $ strVirtualField ; } | Generate a field alias with the right syntax |
14,932 | public function writeToTemplate ( $ value ) { if ( is_array ( $ this -> arrMapper ) ) { $ arrValue [ $ this -> arrMapper [ 0 ] ] = $ this -> Template -> { $ this -> arrMapper [ 0 ] } ; $ map = & $ arrValue ; foreach ( $ this -> arrMapper as $ key ) { if ( ! is_array ( $ map [ $ key ] ) ) { $ map [ $ key ] = array ( ) ;... | Write a value to the template |
14,933 | public static function hasData ( $ strName ) { foreach ( $ GLOBALS [ 'TL_CTP' ] as $ v ) { foreach ( $ v as $ kk => $ vv ) { if ( $ kk == $ strName ) { return ( $ vv [ 'data' ] ) ? : false ; } } } return null ; } | Check if a pattern saves data to the database |
14,934 | static function encrypt ( $ pwd , $ data , $ ispwdHex = 0 ) { if ( $ ispwdHex ) $ pwd = @ pack ( 'H*' , $ pwd ) ; $ key [ ] = '' ; $ box [ ] = '' ; $ cipher = '' ; $ pwd_length = strlen ( $ pwd ) ; $ data_length = strlen ( $ data ) ; for ( $ i = 0 ; $ i < 256 ; $ i ++ ) { $ key [ $ i ] = ord ( $ pwd [ $ i % $ pwd_lengt... | The symmetric encryption function |
14,935 | public function getOrders ( $ limit = 10 ) { if ( $ Member = Security :: getCurrentUser ( ) ) { $ Orders = $ Member -> Orders ( ) -> sort ( 'TransactionDate' , 'DESC' ) ; $ list = new PaginatedList ( $ Orders , Controller :: curr ( ) -> getRequest ( ) ) ; $ list -> setPageLength ( $ limit ) ; return $ list ; } return f... | return all current Member s Orders . |
14,936 | public function subject ( $ model ) { Comment :: validateSubject ( $ model , true ) ; $ this -> modelClass ( $ model :: className ( ) ) ; $ this -> andWhere ( [ 'foreign_pk' => $ this -> createPrimaryKeyJson ( $ model ) ] ) ; return $ this ; } | Named scope to get entries for a certain model |
14,937 | public function addCteType ( $ arrRow ) { $ return = \ tl_content :: addCteType ( $ arrRow ) ; if ( ( $ objElement = $ objElement = \ ElementsModel :: findOneByAlias ( $ arrRow [ 'type' ] ) ) === null && ! array_key_exists ( $ arrRow [ 'type' ] , $ GLOBALS [ 'TL_DCA' ] [ 'tl_content' ] [ 'palettes' ] ) ) { $ tag = '<sp... | Wrap the content block elements into an div block and mark content element if content block is invisible |
14,938 | public function addTypeHelpWizard ( $ dc ) { return ' <a href="contao/help.php?table=' . $ dc -> table . '&field=' . $ dc -> field . '&ptable=' . $ dc -> parentTable . '&pid=' . $ dc -> activeRecord -> pid . '" title="' . \ StringUtil :: specialchars ( $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'helpWizard' ] ) . ... | Add a custom help wirzard to the type field |
14,939 | public function getElements ( $ dc ) { if ( $ dc -> activeRecord !== null ) { $ ptable = $ dc -> activeRecord -> ptable ; $ pid = $ dc -> activeRecord -> pid ; } else { $ ptable = \ Input :: get ( 'ptable' ) ; $ pid = \ Input :: get ( 'pid' ) ; } $ objLayout = \ LayoutModel :: findById ( \ Agoat \ CustomContentElements... | Generate a content element list array |
14,940 | public function setDefaultType ( $ value , $ dc ) { if ( ! $ value ) { if ( $ dc -> activeRecord !== null ) { $ ptable = $ dc -> activeRecord -> ptable ; $ pid = $ dc -> activeRecord -> pid ; } else { return $ value ; } $ objLayout = \ LayoutModel :: findById ( \ Agoat \ CustomContentElementsBundle \ Contao \ Controlle... | Set default value for new records |
14,941 | public function buildPaletteAndFields ( $ dc ) { if ( \ Input :: get ( 'act' ) != 'edit' && \ Input :: get ( 'act' ) != 'show' && ! isset ( $ _GET [ 'target' ] ) ) { return ; } $ intId = ( isset ( $ _GET [ 'target' ] ) ) ? explode ( '.' , \ Input :: get ( 'target' ) ) [ 2 ] : $ dc -> id ; $ objContent = \ ContentModel ... | Build the palette and field DCA for the virtual input fields |
14,942 | public function loadFieldValue ( $ value , $ dc ) { if ( ! empty ( $ value ) ) { return $ value ; } if ( ! empty ( $ GLOBALS [ 'TL_DCA' ] [ 'tl_content' ] [ 'fields' ] [ $ dc -> field ] [ 'data' ] ) ) { return $ GLOBALS [ 'TL_DCA' ] [ 'tl_content' ] [ 'fields' ] [ $ dc -> field ] [ 'data' ] ; } return null ; } | Load the virtual field value from the DCA |
14,943 | public function saveData ( & $ dc ) { foreach ( $ this -> arrModifiedData as $ field => $ value ) { $ id = $ GLOBALS [ 'TL_DCA' ] [ 'tl_content' ] [ 'fields' ] [ $ field ] [ 'id' ] ; $ pattern = $ GLOBALS [ 'TL_DCA' ] [ 'tl_content' ] [ 'fields' ] [ $ field ] [ 'pattern' ] ; $ parent = $ GLOBALS [ 'TL_DCA' ] [ 'tl_cont... | Save the virtual field values into the tl_data table |
14,944 | public function prepareOrderValue ( $ value , $ dc ) { $ orderField = $ GLOBALS [ 'TL_DCA' ] [ 'tl_content' ] [ 'fields' ] [ $ dc -> field ] [ 'eval' ] [ 'orderField' ] ; $ orderData = \ StringUtil :: deserialize ( $ GLOBALS [ 'TL_DCA' ] [ 'tl_content' ] [ 'fields' ] [ $ orderField ] [ 'data' ] ) ; $ GLOBALS [ 'TL_DCA'... | Prepare the virtual order field |
14,945 | public function saveOrderValue ( $ value , $ dc ) { $ orderField = $ GLOBALS [ 'TL_DCA' ] [ 'tl_content' ] [ 'fields' ] [ $ dc -> field ] [ 'eval' ] [ 'orderField' ] ; $ orderData = \ Input :: post ( $ orderField ) ; if ( $ orderData ) { if ( $ GLOBALS [ 'TL_DCA' ] [ 'tl_content' ] [ 'fields' ] [ $ dc -> field ] [ 'inp... | Save the virtual order field |
14,946 | public function setAceCodeHighlighting ( $ value , $ dc ) { $ pattern = $ GLOBALS [ 'TL_DCA' ] [ 'tl_content' ] [ 'fields' ] [ $ dc -> field ] [ 'pattern' ] ; $ highlight = $ GLOBALS [ 'TL_DCA' ] [ 'tl_content' ] [ 'fields' ] [ $ pattern . '-highlight' ] [ 'data' ] ; if ( ! empty ( $ highlight ) ) { $ GLOBALS [ 'TL_DCA... | Dynamically set the ace highlight syntax |
14,947 | public function createDataVersion ( $ strTable , $ intPid , $ intVersion ) { $ db = Database :: getInstance ( ) ; $ objData = $ db -> prepare ( "SELECT * FROM tl_data WHERE pid=?" ) -> execute ( $ intPid ) ; if ( $ objData === null ) { return ; } $ db -> prepare ( "INSERT INTO tl_version (pid, tstamp, version, fromTabl... | Save tl_data versions |
14,948 | public function restoreDataVersion ( $ strTable , $ intPid , $ intVersion ) { $ db = Database :: getInstance ( ) ; $ objData = $ db -> prepare ( "SELECT * FROM tl_version WHERE fromTable=? AND pid=? AND version=?" ) -> execute ( 'tl_data' , $ intPid , $ intVersion ) ; if ( $ objData -> numRows < 1 ) { return ; } $ data... | Restore tl_data versions |
14,949 | public function convertAvatar ( $ projectId , $ cropperWidth , $ cropperOffsetX , $ cropperOffsetY , $ needsCropping ) { return $ this -> apiClient -> callEndpoint ( sprintf ( '%s/%s/avatar' , self :: ENDPOINT , $ projectId ) , array ( "cropperWidth" => $ cropperWidth , "cropperOffsetX" => $ cropperOffsetX , "cropperOf... | Converts temporary avatar into a real avatar |
14,950 | public function findProperty ( $ projectId , $ propertyKey ) { return $ this -> apiClient -> callEndpoint ( sprintf ( '%s/%s/properties/%s' , self :: ENDPOINT , $ projectId , $ propertyKey ) ) ; } | Returns the value of the property with a given key from the project identified by the key or by the id . The user who retrieves the property is required to have permissions to read the project . |
14,951 | public function findRole ( $ projectId , $ roleId ) { return $ this -> apiClient -> callEndpoint ( sprintf ( '%s/%s/role/%s' , self :: ENDPOINT , $ projectId , $ roleId ) ) ; } | Details on a given project role . |
14,952 | public function updateRole ( $ projectId , $ roleId , $ user = null , $ group = null ) { $ parameters = [ ] ; if ( ( is_null ( $ user ) && is_null ( $ group ) ) || ( ! is_null ( $ user ) && ! is_null ( $ group ) ) ) { throw new EndpointParameterException ( 'User or group should be given' ) ; } elseif ( ! is_null ( $ us... | Updates a project role to contain the sent actors . |
14,953 | public function addRole ( $ projectId , $ roleId , $ user = null , $ group = null ) { $ parameters = [ ] ; if ( ( is_null ( $ user ) && is_null ( $ group ) ) || ( ! is_null ( $ user ) && ! is_null ( $ group ) ) ) { throw new EndpointParameterException ( 'User or group should be given' ) ; } elseif ( ! is_null ( $ user ... | Add an actor to a project role . |
14,954 | public function deleteRole ( $ projectId , $ roleId ) { return $ this -> apiClient -> callEndpoint ( sprintf ( '%s/%s/role/%s' , self :: ENDPOINT , $ projectId , $ roleId ) , array ( ) , null , HttpMethod :: REQUEST_DELETE ) ; } | Remove actors from a project role . |
14,955 | public function dontSeeTimeIsInSecs ( $ time , $ seconds ) { \ PHPUnit_Framework_Assert :: assertNotEquals ( $ seconds , $ this -> _GetNow ( ) -> diffInSeconds ( $ this -> _ParseDate ( $ time ) , false ) ) ; } | See time is not in a given number of seconds . |
14,956 | public function seeTimeWasInSecs ( $ time , $ seconds ) { \ PHPUnit_Framework_Assert :: assertEquals ( $ seconds , $ this -> _ParseDate ( $ time ) -> diffInSeconds ( $ this -> _GetNow ( ) , false ) ) ; } | See time was in a given number of seconds . |
14,957 | public function seeTimeIsInMins ( $ time , $ minutes ) { \ PHPUnit_Framework_Assert :: assertEquals ( $ minutes , $ this -> _GetNow ( ) -> diffInMinutes ( $ this -> _ParseDate ( $ time ) , false ) ) ; } | See time is in a given number of minutes . |
14,958 | public function dontSeeTimeIsInMins ( $ time , $ minutes ) { \ PHPUnit_Framework_Assert :: assertNotEquals ( $ minutes , $ this -> _GetNow ( ) -> diffInMinutes ( $ this -> _ParseDate ( $ time ) , false ) ) ; } | See time is not in a given number of minutes . |
14,959 | public function dontSeeTimeIsInHours ( $ time , $ hours ) { \ PHPUnit_Framework_Assert :: assertNotEquals ( $ hours , $ this -> _GetNow ( ) -> diffInHours ( $ this -> _ParseDate ( $ time ) , false ) ) ; } | See time is not in a given number of hours . |
14,960 | public function seeTimeWasInHours ( $ time , $ hours ) { \ PHPUnit_Framework_Assert :: assertEquals ( $ hours , $ this -> _ParseDate ( $ time ) -> diffInHours ( $ this -> _GetNow ( ) , false ) ) ; } | See time was in a given number of hours . |
14,961 | public function seeTimeMatches ( $ t1 , $ t2 ) { \ PHPUnit_Framework_Assert :: assertTrue ( $ this -> _ParseDate ( $ t1 ) -> eq ( $ this -> _ParseDate ( $ t2 ) ) ) ; } | See that two times match . |
14,962 | public function dontSeeTimeMatches ( $ t1 , $ t2 ) { \ PHPUnit_Framework_Assert :: assertTrue ( $ this -> _ParseDate ( $ t1 ) -> ne ( $ this -> _ParseDate ( $ t2 ) ) ) ; } | See that two times don t match . |
14,963 | private function getBotId ( ) { if ( is_null ( $ this -> botId ) ) { $ response = $ this -> http -> get ( self :: API_ENDPOINT . 'people/me' , [ ] , $ this -> getHeaders ( ) ) ; $ bot = json_decode ( $ response -> getContent ( ) ) ; $ this -> botId = $ bot -> id ; } return $ this -> botId ; } | Returns the chatbot ID . |
14,964 | public function parse ( ) { $ strBuffer = parent :: parse ( ) ; if ( TL_MODE == 'BE' ) { $ strBuffer = '<div class="tl_ce ' . $ this -> strTemplate . '">' . $ strBuffer . '</div>' ; } return $ strBuffer ; } | Add a wrapper in the backend |
14,965 | public function addImage ( $ image , $ size , $ width = 0 , $ height = 0 ) { if ( ! is_array ( $ image ) ) { return ; } if ( @ unserialize ( $ size ) === false ) { $ size = serialize ( array ( ( string ) $ width , ( string ) $ height , $ size ) ) ; } $ image [ 'size' ] = $ size ; $ image [ 'singleSRC' ] = $ image [ 'pa... | Add an image to template |
14,966 | public function addCSS ( $ strCSS , $ strType = 'scss' , $ bolStatic = true ) { if ( $ strCSS == '' ) { return ; } $ strType = strtoupper ( $ strType ) ; if ( ! in_array ( $ strType , array ( 'CSS' , 'SCSS' , 'LESS' ) ) ) { return ; } if ( ! $ bolStatic && $ strType == 'css' ) { $ strKey = substr ( md5 ( $ strType . $ ... | Add CSS to the page |
14,967 | public function addJS ( $ strJS , $ bolStatic = true ) { if ( $ strJS == '' ) { return ; } if ( ! $ bolStatic ) { $ strKey = substr ( md5 ( 'js' . $ strJS ) , 0 , 12 ) ; $ strPath = 'assets/js/' . $ strKey . '.js' ; if ( ! file_exists ( $ strPath ) ) { $ objFile = new File ( $ strPath , true ) ; $ objFile -> write ( $ ... | Add Javascript to the page |
14,968 | public function prevElement ( ) { if ( ( $ arrTypes = $ GLOBALS [ 'templateTypes' ] [ $ this -> ptable . '.' . $ this -> pid ] ) === null ) { $ objCte = \ ContentModel :: findPublishedByPidAndTable ( $ this -> pid , $ this -> ptable ) ; if ( $ objCte === null ) { return ; } $ arrTypes = $ GLOBALS [ 'templateTypes' ] [ ... | Get the alias of the previous content element |
14,969 | public function insert ( $ name , array $ data = null ) { if ( ! array_key_exists ( $ name , TemplateLoader :: getFiles ( ) ) ) { $ objTheme = \ LayoutModel :: findById ( Controller :: getLayoutId ( $ this -> ptable , $ this -> pid ) ) -> getRelated ( 'pid' ) ; TemplateLoader :: addFile ( $ name , $ objTheme -> templat... | Insert a template |
14,970 | public function onMessage ( Server $ server , Frame $ frame ) { $ fd = $ frame -> fd ; WebSocketContext :: setFdToCoId ( $ fd ) ; App :: trigger ( WsEvent :: ON_MESSAGE , null , $ server , $ frame ) ; $ this -> log ( "received message: {$frame->data} from fd #{$fd}, co ID #" . Coroutine :: tid ( ) , [ ] , 'debug' ) ; \... | When you receive the message |
14,971 | public function getTotal ( ) { return ( float ) ( $ this -> valorDocumento + $ this -> taxa + $ this -> outrosAcrescimos ) - ( $ this -> desconto + $ this -> outrasDeducoes ) ; } | Retorna a valor total do boleto . |
14,972 | public function index ( ArticlesDataTable $ dataTable ) { $ categories = [ ] ; $ allYesNo = [ ] ; $ statuses = [ ] ; if ( ! request ( ) -> wantsJson ( ) ) { $ categories = Category :: root ( ) -> getDescendants ( ) -> map ( function ( Category $ category ) { $ category -> title = $ category -> present ( ) -> name ; ret... | Display list of articles . |
14,973 | public function create ( Article $ article ) { $ article -> published = true ; $ article -> setHighestOrderNumber ( ) ; $ tags = Article :: existingTags ( ) -> pluck ( 'name' ) ; return view ( 'administrator.articles.create' , compact ( 'article' , 'tags' ) ) ; } | Show articles form . |
14,974 | public function store ( ArticlesFormRequest $ request ) { $ article = new Article ; $ article -> fill ( $ request -> all ( ) ) ; $ article -> published = $ request -> get ( 'published' , false ) ; $ article -> featured = $ request -> get ( 'featured' , false ) ; $ article -> authenticated = $ request -> get ( 'authenti... | Store a newly created article . |
14,975 | public function edit ( Article $ article ) { $ tags = Article :: existingTags ( ) -> pluck ( 'name' ) ; $ selectedTags = implode ( ',' , $ article -> tagNames ( ) ) ; return view ( 'administrator.articles.edit' , compact ( 'article' , 'tags' , 'selectedTags' ) ) ; } | Show and edit selected article . |
14,976 | public function update ( Article $ article , ArticlesFormRequest $ request ) { $ article -> fill ( $ request -> all ( ) ) ; $ article -> published = $ request -> get ( 'published' , false ) ; $ article -> featured = $ request -> get ( 'featured' , false ) ; $ article -> authenticated = $ request -> get ( 'authenticated... | Update selected article . |
14,977 | public function listCommand ( $ host = null , $ match = null ) { $ outputByHost = function ( $ host = null ) use ( $ match ) { $ redirects = $ this -> redirectStorage -> getAll ( $ host ) ; $ this -> outputLine ( ) ; if ( $ host !== null ) { $ this -> outputLine ( '<info>==</info> <b>Redirect for %s</b>' , [ $ host ] )... | List all redirects |
14,978 | public function exportCommand ( $ filename = null , $ host = null ) { if ( ! class_exists ( Writer :: class ) ) { $ this -> outputWarningForLeagueCsvPackage ( ) ; } $ writer = Writer :: createFromFileObject ( new \ SplTempFileObject ( ) ) ; if ( $ host !== null ) { $ redirects = $ this -> redirectStorage -> getAll ( $ ... | Export redirects to CSV |
14,979 | public function removeCommand ( $ source , $ host = null ) { $ redirect = $ this -> redirectStorage -> getOneBySourceUriPathAndHost ( $ source , $ host ) ; if ( $ redirect === null ) { $ this -> outputLine ( 'There is no redirect with the source URI path "%s", maybe you forgot the --host argument ?' , [ $ source ] ) ; ... | Remove a single redirect |
14,980 | public function removeByHostCommand ( $ host ) { if ( $ host === 'all' ) { $ this -> redirectStorage -> removeByHost ( null ) ; $ this -> outputLine ( 'Removed redirects matching all hosts' ) ; } else { $ this -> redirectStorage -> removeByHost ( $ host ) ; $ this -> outputLine ( 'Removed all redirects for host "%s"' ,... | Remove all redirects by host |
14,981 | public function render ( ) { $ block = $ this -> config ( 'viewBlockName' ) ; foreach ( ( array ) $ this -> config ( 'tags' ) as $ namespace => $ values ) { foreach ( $ values as $ tag => $ content ) { $ property = "$namespace:$tag" ; if ( ! is_array ( $ content ) ) { $ this -> Html -> meta ( null , null , compact ( 'p... | Render view block . |
14,982 | protected function uploadFileToCloudinary ( $ file , $ publicId ) { $ result = $ this -> uploader -> upload ( $ file -> getRealPath ( ) , [ 'public_id' => $ publicId , ] ) ; return $ result ; } | Upload a picture to Cloudinary . |
14,983 | public function memory ( ) { $ usedInBytes = $ this -> data [ 'memory_usage' ] [ 'used_memory' ] ; $ wastedInBytes = $ this -> data [ 'memory_usage' ] [ 'wasted_memory' ] ; $ sizeInBytes = $ usedInBytes + $ wastedInBytes + $ this -> data [ 'memory_usage' ] [ 'free_memory' ] ; return new Memory ( $ this -> bytesToMb ( $... | Provides information about the memory usage . |
14,984 | public function scripts ( ) { $ scripts = array_map ( function ( $ scriptData ) { return new Script ( $ scriptData [ 'full_path' ] , $ this -> bytesToMb ( $ scriptData [ 'memory_consumption' ] ) , $ scriptData [ 'hits' ] , new \ DateTimeImmutable ( '@' . $ scriptData [ 'last_used_timestamp' ] ) ) ; } , $ this -> data [... | Returns data about cached scripts . |
14,985 | public function internedStrings ( ) : InternedStrings { $ usageInMb = $ this -> bytesToMb ( $ this -> data [ 'interned_strings_usage' ] [ 'used_memory' ] ?? 0 ) ; $ sizeInMb = $ this -> bytesToMb ( $ this -> data [ 'interned_strings_usage' ] [ 'buffer_size' ] ?? 0 ) ; $ freeInMb = $ this -> bytesToMb ( $ this -> data [... | Returns data about interned strings . |
14,986 | protected function calculateCacheSlots ( ) { $ cachedScripts = $ this -> data [ 'opcache_statistics' ] [ 'num_cached_scripts' ] ; $ wasted = $ this -> data [ 'opcache_statistics' ] [ 'num_cached_keys' ] - $ cachedScripts ; return new ScriptSlots ( $ cachedScripts , $ this -> data [ 'opcache_statistics' ] [ 'max_cached_... | Calculates cache slot statistics . |
14,987 | protected function discernIdentifier ( $ cve , $ title ) { $ identifier = $ cve ; if ( ! $ identifier || $ identifier === '~' ) { $ identifier = explode ( ':' , $ title ) ; $ identifier = array_shift ( $ identifier ) ; } $ this -> extend ( 'updateIdentifier' , $ identifier , $ cve , $ title ) ; return $ identifier ; } | Most SilverStripe issued alerts are _not_ assiged CVEs . However they have their own identifier in the form of a prefix to the title - we can use this instead of a CVE ID . |
14,988 | public function published ( ) { $ class = $ this -> entity -> published ? 'fa fa-check-circle-o' : 'fa fa-circle-o' ; $ state = $ this -> entity -> published ? 'Published' : 'Unpublished' ; return html ( ) -> tag ( 'i' , '' , [ "class" => $ class , "data-toggle" => "tooltip" , "data-title" => $ state ] ) ; } | Publication state . |
14,989 | public function author ( ) { $ author = ! empty ( $ this -> entity -> author_alias ) ? $ this -> entity -> author_alias : $ this -> entity -> createdByName ; return $ author ?? config ( 'site.author' ) ; } | Get article s author name . |
14,990 | public function title ( ) { $ heading = null ; if ( session ( ) -> has ( 'active_menu' ) ) { $ heading = session ( 'active_menu' ) -> param ( 'page_heading' ) ; } return $ heading ? $ heading : $ this -> entity -> title ; } | Get the article s title . |
14,991 | public function introText ( ) { $ body = explode ( '<hr id="system-readmore" />' , $ this -> entity -> body ) ; if ( $ body [ 0 ] === $ this -> entity -> body ) { return '' ; } return $ body [ 0 ] ; } | Get intro text . |
14,992 | public function image ( ) { if ( $ image = $ this -> articleImage ( ) ) { return $ image ; } if ( $ image = $ this -> introImage ( ) ) { return $ image ; } return config ( 'article.image' ) ; } | Get article intro image . |
14,993 | public static function setFdToCoId ( int $ fd ) { $ cid = self :: getCoroutineId ( ) ; self :: $ map [ $ cid ] = $ fd ; } | init coId to fd mapping |
14,994 | public static function delFdByCoId ( int $ cid = null ) : bool { $ cid = $ cid > - 1 ? $ cid : self :: getCoroutineId ( ) ; if ( isset ( self :: $ map [ $ cid ] ) ) { unset ( self :: $ map [ $ cid ] ) ; return true ; } return false ; } | delete coId to fd mapping |
14,995 | public function findOrFail ( $ id ) { return $ this -> cache -> rememberForever ( 'extension.' . $ id , function ( ) use ( $ id ) { return $ this -> repository -> findOrFail ( $ id ) ; } ) ; } | Find or fail an extension . |
14,996 | protected function bootAdministratorViewComposer ( ) { view ( ) -> composer ( 'administrator.widgets.*' , function ( View $ view ) { $ themes = $ this -> app [ 'themes' ] ; $ theme = $ themes -> current ( ) ; $ positions = $ theme -> positions ; $ data = [ ] ; foreach ( $ positions as $ position ) { $ data [ $ position... | Register administrator view composers . |
14,997 | public function replaceCssPaths ( array $ links ) { foreach ( $ links as $ key => $ link ) { if ( ! $ this -> isExternalStylesheet ( $ link ) ) { $ links [ $ key ] = $ this -> getUrl ( ) . $ link ; } } return $ links ; } | Replace a given set of links with the proper url if it is an external css file . |
14,998 | public function backup ( $ task = 'run' ) { if ( ! in_array ( $ task , [ 'run' , 'clean' ] ) ) { $ message = trans ( 'cms::utilities.backup.not_allowed' , [ 'task' => $ task ] ) . trans ( 'cms::utilities.field.executed_by' , [ 'name' => $ this -> getCurrentUserName ( ) ] ) ; $ this -> log -> info ( $ message ) ; return... | Execute back up manually . |
14,999 | public function cache ( ) { Artisan :: call ( 'cache:clear' ) ; $ this -> log -> info ( trans ( 'cms::utilities.cache.success' ) . trans ( 'cms::utilities.field.executed_by' , [ 'name' => $ this -> getCurrentUserName ( ) ] ) ) ; return $ this -> notifySuccess ( trans ( 'cms::utilities.cache.success' ) ) ; } | Clear cache manually . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.