idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
2,400 | public function enumerateImages ( $ aifrom = null , $ aito = null , $ aiprefix = null , $ aiminsize = null , $ aimaxsize = null , $ ailimit = null , $ aidir = null , $ aisha1 = null , $ aisha1base36 = null , array $ aiprop = null , $ aimime = null ) { $ path = '?action=query&list=allimages' ; if ( isset ( $ aifrom ) ) ... | Method to enumerate all images . |
2,401 | protected function order ( ) { foreach ( $ this -> orderBy as $ orderBy ) { if ( count ( $ orderBy ) == 1 ) { $ this -> model = $ this -> model -> orderBy ( $ orderBy ) ; } if ( count ( $ orderBy ) == 2 ) { $ this -> model = $ this -> model -> orderBy ( $ orderBy [ 0 ] , $ orderBy [ 1 ] ) ; } } } | Apply order by property to query . |
2,402 | protected function get ( $ id = null ) { $ this -> filter ( ) ; if ( $ this -> eagerLoad ) { $ this -> model = $ this -> model -> with ( $ this -> eagerLoad ) ; } if ( $ id ) { return $ this -> model -> where ( 'id' , $ id ) -> firstOrFail ( ) ; } return $ this -> model -> get ( ) ; } | Run query including eager load . |
2,403 | public function store ( $ input ) { $ this -> model = $ this -> model -> fill ( $ input ) ; $ filteredInput = $ this -> runChecks ( 'store' , $ this -> model -> toArray ( ) ) ; if ( $ filteredInput ) { $ this -> model -> fill ( $ filteredInput ) ; } return $ this -> model -> save ( ) ; } | Store a new resource item . |
2,404 | public function update ( $ id , $ input ) { $ this -> model = $ this -> model -> query ( ) -> findOrFail ( $ id ) ; $ this -> model = $ this -> model -> fill ( $ input ) ; $ filteredInput = $ this -> runChecks ( 'update' , $ this -> model -> toArray ( ) , $ this -> model -> getOriginal ( ) ) ; if ( $ filteredInput ) { ... | Update an existing resource item by ID . |
2,405 | public function destroy ( $ id ) { $ this -> model = $ this -> model -> findOrFail ( $ id ) ; $ this -> runChecks ( 'destroy' , $ this -> model -> toArray ( ) ) ; return $ this -> model -> delete ( ) ; } | Destroy an existing resource item by ID . |
2,406 | function parse ( $ content ) { global $ shortcode_tags ; if ( empty ( $ shortcode_tags ) || ! is_array ( $ shortcode_tags ) ) return $ content ; $ pattern = $ this -> get_shortcode_regex ( ) ; return preg_replace_callback ( '/' . $ pattern . '/s' , array ( $ this , 'do_shortcode_tag' ) , $ content ) ; } | Search content for shortcodes and filter shortcodes through their hooks . |
2,407 | function get_shortcode_regex ( ) { global $ shortcode_tags ; $ tagnames = array_keys ( $ shortcode_tags ) ; $ tagregexp = join ( '|' , array_map ( 'preg_quote' , $ tagnames ) ) ; return '(.?)\[(' . $ tagregexp . ')\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)' ; } | Retrieve the shortcode regular expression for searching . |
2,408 | function shortcode_atts ( $ pairs , $ atts ) { $ atts = ( array ) $ atts ; $ out = array ( ) ; foreach ( $ pairs as $ name => $ default ) { if ( array_key_exists ( $ name , $ atts ) ) $ out [ $ name ] = $ atts [ $ name ] ; else $ out [ $ name ] = $ default ; } return $ out ; } | Combine user attributes with known attributes and fill in defaults when needed . |
2,409 | public function getExtendedName ( ) { $ type = $ this -> getType ( ) ; if ( $ type ) { $ extendedName = $ type -> getName ( ) ; } else { $ extendedName = '' ; } $ catTitle = $ this -> getCategoryTitle ( ) ; if ( $ catTitle !== null ) { $ extendedName .= '-' . $ this -> getCategoryTitle ( ) ; } $ extendedName .= '-' . $... | Returns the extended name |
2,410 | public function updatePageOptions ( FieldList $ fields ) { $ pageTypeField = $ fields -> fieldByName ( 'PageType' ) ; foreach ( $ pageTypeField -> getSource ( ) as $ classKey => $ classValue ) { if ( $ classKey == 'PlaceablePage' ) { foreach ( PlaceablePageType :: get ( ) as $ type ) { $ html = sprintf ( '%s<strong cla... | Update add page fields |
2,411 | public function getAggregateHistoryFor ( Identity $ id , $ offset = 0 , $ max = null ) { return new CommittedEvents ( $ id , array_filter ( array_slice ( $ this -> events [ ( string ) $ id ] , $ offset , $ max , true ) , function ( DomainEvent $ event ) use ( $ id ) { return $ event -> getAggregateIdentity ( ) -> equal... | Gets the events stored as memory and wraps it in \ CommittedEvents |
2,412 | public function member ( $ key ) { foreach ( $ this -> value as $ innerKey => $ value ) { if ( $ key === $ innerKey ) { return true ; } } return false ; } | Return whether or not the map contains the specified key . |
2,413 | public function EscapeSql ( $ String , $ FirstWordOnly = FALSE ) { if ( is_array ( $ String ) ) { $ EscapedArray = array ( ) ; foreach ( $ String as $ k => $ v ) { $ EscapedArray [ $ this -> EscapeSql ( $ k ) ] = $ this -> EscapeSql ( $ v , $ FirstWordOnly ) ; } return $ EscapedArray ; } if ( ctype_alnum ( $ String ) =... | Takes a string of SQL and adds backticks if necessary . |
2,414 | public function FetchTableSql ( $ LimitToPrefix = FALSE ) { $ Sql = "show tables" ; if ( is_bool ( $ LimitToPrefix ) && $ LimitToPrefix && $ this -> Database -> DatabasePrefix != '' ) $ Sql .= " like " . $ this -> Database -> Connection ( ) -> quote ( $ this -> Database -> DatabasePrefix . '%' ) ; elseif ( is_string ( ... | Returns a platform - specific query to fetch table names . |
2,415 | public function FormatTableName ( $ Table ) { if ( strpos ( $ Table , '.' ) !== FALSE ) { if ( preg_match ( '/^([^\s]+)\s+(?:as\s+)?`?([^`]+)`?$/' , $ Table , $ Matches ) ) { $ DatabaseTable = '`' . str_replace ( '.' , '`.`' , $ Matches [ 1 ] ) . '`' ; $ Table = str_replace ( $ Matches [ 1 ] , $ DatabaseTable , $ Table... | Takes a table name and makes sure it is formatted for this database engine . |
2,416 | public function GetDelete ( $ TableName , $ Wheres = array ( ) ) { $ Conditions = '' ; $ Joins = '' ; $ DeleteFrom = '' ; if ( count ( $ this -> _Joins ) > 0 ) { $ Joins .= "\n" ; $ Joins .= implode ( "\n" , $ this -> _Joins ) ; $ DeleteFroms = array ( ) ; foreach ( $ this -> _Froms as $ From ) { $ Parts = preg_split (... | Returns a delete statement for the specified table and the supplied conditions . |
2,417 | public function GetLimit ( $ Query , $ Limit , $ Offset ) { $ Offset = $ Offset == 0 ? '' : $ Offset . ', ' ; return $ Query . "limit " . $ Offset . $ Limit ; } | Adds a limit clause to the provided query for this database engine . |
2,418 | public function SetEncoding ( $ Encoding ) { if ( $ Encoding != '' && $ Encoding !== FALSE ) { $ SavedNamedParameters = $ this -> _NamedParameters ; $ this -> _NamedParameters = array ( ) ; $ this -> _NamedParameters [ ':encoding' ] = $ Encoding ; $ this -> Query ( 'set names :encoding' ) ; $ this -> _NamedParameters =... | Sets the character encoding for this database engine . |
2,419 | protected function openSink ( ) { if ( ! $ this -> uri ) { throw new \ LogicException ( 'Missing stream uri, the stream can not be opened.' ) ; } $ this -> error = null ; set_error_handler ( array ( $ this , 'errorTrap' ) ) ; if ( substr ( $ this -> uri , 0 , 4 ) === 'udp:' ) { $ parsed = parse_url ( $ this -> uri ) ; ... | Open the log sink described by our stream URI . |
2,420 | public function setOptions ( $ options ) { foreach ( $ this -> options as $ key => $ option ) { if ( isset ( $ options [ $ key ] ) ) { $ this -> options [ $ key ] = $ options [ $ key ] ; } } } | Set any options if the inputted over write the defaults . |
2,421 | private function _processQueue ( ) { $ results = [ ] ; foreach ( $ this -> fifo as $ command ) { $ results [ ] = $ this -> _run ( $ command ) ; } return isset ( $ results [ 0 ] ) && $ results [ 0 ] === 0 && count ( array_unique ( $ results ) ) === 1 ; } | Process the queue stepping through each item in the queue and running each independently . |
2,422 | private function _run ( $ command ) { if ( $ this -> options [ 'type' ] === self :: TYPE_PHP ) { $ this -> savedFiles [ ] = $ this -> options [ 'tmp-dir' ] . 'async-tmp-' . time ( ) . '.php' ; $ result = file_put_contents ( end ( $ this -> savedFiles ) , $ this -> _generateCode ( $ command ) , LOCK_EX ) ; if ( $ result... | Actually run the command by detecting the async type and using exec to run it . Will echo data depending of whether the debug flag is on . |
2,423 | private function _generateCode ( $ command ) { $ code = "<?php" . PHP_EOL . $ command . PHP_EOL ; if ( $ this -> options [ 'cleanup' ] ) { $ code .= "unlink('" . end ( $ this -> savedFiles ) . "');" ; } return $ code ; } | Generate the content to save to the temporary file . This adds the necessary php tags and will optionally clean up the temp file afterwards . |
2,424 | protected function deleteFile ( $ fileName ) { if ( null !== $ fileName && $ this -> mediaStorageManager -> exists ( $ fileName ) ) { $ this -> mediaStorageManager -> deleteContent ( $ fileName ) ; } } | Remove a media file if it is stored |
2,425 | public function getNewBuilds ( ) { $ lastBuildFilename = $ this -> getLatestBuildName ( ) ; $ iterator = $ this -> getBuilds ( ) ; $ files = array ( ) ; foreach ( $ iterator as $ fileInfo ) { if ( $ fileInfo -> getFilename ( ) > $ lastBuildFilename ) { array_push ( $ files , $ fileInfo -> getPathname ( ) ) ; } } sort (... | Returns an array of new build file names |
2,426 | private function createOperation ( $ accIdDebit , $ accIdCredit , $ amount , $ note ) { $ tran = new ETrans ( ) ; $ tran -> setDebitAccId ( $ accIdDebit ) ; $ tran -> setCreditAccId ( $ accIdCredit ) ; $ tran -> setValue ( $ amount ) ; $ tran -> setNote ( $ note ) ; $ req = new \ Praxigento \ Accounting \ Api \ Service... | Create refund operation . |
2,427 | private function refundByTransaction ( $ tranId , \ Magento \ Sales \ Model \ Order $ sale ) { $ saleId = $ sale -> getId ( ) ; $ saleIncId = $ sale -> getIncrementId ( ) ; $ transaction = $ this -> daoTrans -> getById ( $ tranId ) ; $ accIdCust = $ transaction -> getDebitAccId ( ) ; $ accIdSys = $ transaction -> getCr... | Load transaction for direct payment and create refund payment . |
2,428 | public function isEmailAvailable ( $ email , $ fields = array ( ) ) { $ fields = ( object ) $ fields ; return $ this -> getMapper ( ) -> isEmailExists ( $ email , empty ( $ fields -> id ) ? null : $ fields -> id ) ? 'user.action.register.email.taken' : true ; } | Is an email name available |
2,429 | public function isEmailNotTaken ( $ email , $ fields = array ( ) ) { $ fields = ( object ) $ fields ; return $ this -> getMapper ( ) -> isEmailTaken ( $ email , empty ( $ fields -> id ) ? null : $ fields -> id ) ? 'user.action.register.email.taken' : true ; } | Is an email not taken |
2,430 | public function isDisplayNameAvailable ( $ displayName , $ fields = array ( ) ) { $ fields = ( object ) $ fields ; $ displayName = Structure :: trimDisplayName ( $ displayName ) ; if ( 3 > mb_strlen ( $ displayName ) ) { return 'user.action.register.displayName.tooShort' ; } return $ this -> getMapper ( ) -> isDisplayN... | Is a display name available |
2,431 | public function status ( ) { $ auth = $ this -> getAuthenticationService ( ) ; $ loggedIn = $ auth -> hasIdentity ( ) ; $ identity = $ loggedIn ? $ auth -> getIdentity ( ) : null ; return ( object ) array ( 'loggedIn' => $ loggedIn , 'id' => $ loggedIn ? $ identity -> id : null , 'email' => $ loggedIn ? $ identity -> e... | Get user status |
2,432 | public static function connect ( ConnectionParameters $ config ) { $ con = new self ( ) ; switch ( \ strtolower ( \ trim ( $ config -> getDriver ( ) ) ) ) { case 'sqlite' : $ con -> Connection = new \ PDO ( \ sprintf ( 'sqlite:%s' , $ config -> getHost ( ) ) , $ config -> getUsername ( ) , $ config -> getPassword ( ) ,... | Attempt to connect to the database . Does nothing if already connected . |
2,433 | public static function addIdpLogoUrls ( & $ sources , $ authSourcesConfig , $ metadataPath ) { $ idpMetadata = Metadata :: getIdpMetadataEntries ( $ metadataPath ) ; $ idpEntries = self :: getIdpsFromAuthSources ( $ authSourcesConfig ) ; foreach ( $ sources as & $ source ) { $ idpLabel = $ source [ 'source' ] ; $ idpEn... | Gets the logoURL entries from the IDP s metadata and adds them to the sources array that is available to the multiauth page . Doesn t add an entry at all if it is missing or invalid . |
2,434 | protected function initTrace ( int $ index , string $ trace ) : void { $ lines = explode ( ':' , $ trace , 2 ) ; $ headerKey = sprintf ( 'h%s' , $ index ) ; $ callKey = sprintf ( 'c%s' , $ index ) ; $ this -> templates [ ] = sprintf ( '<exception_trace:%s>' , $ headerKey ) ; $ this -> templates [ ] = sprintf ( "<except... | Inicializa los elementos deducidos de una linea de traza |
2,435 | public static function scan ( $ xml , DOMDocument $ dom = null ) { if ( self :: isPhpFpm ( ) ) { self :: heuristicScan ( $ xml ) ; } if ( null === $ dom ) { $ simpleXml = true ; $ dom = new DOMDocument ( ) ; } if ( ! self :: isPhpFpm ( ) ) { $ loadEntities = libxml_disable_entity_loader ( true ) ; $ useInternalXmlError... | Scan XML string for potential XXE and XEE attacks |
2,436 | protected function _getArgsStack ( array & $ args = array ( ) , $ scope = null , $ default = array ( ) , $ unset = true ) { $ found_args = $ default ; if ( isset ( $ args [ $ scope ] ) ) { $ found_args = $ args [ $ scope ] ; if ( true === $ unset ) { unset ( $ args [ $ scope ] ) ; } } return $ found_args ; } | Find a specific entry in arguments and unset it |
2,437 | protected function _doList ( & $ content , array & $ args = array ( ) , $ tag_type = 'unordered_list' ) { $ items_content = '' ; $ items_args = $ this -> _getArgsStack ( $ args , 'items' ) ; $ i = 0 ; foreach ( $ content as $ i => $ item_str ) { $ item_args = array_merge_recursive ( $ items_args , $ this -> _getArgsSta... | Process a list content |
2,438 | protected function _doDefinitions ( & $ content , array & $ args = array ( ) ) { $ items_content = '' ; $ terms_args = $ this -> _getArgsStack ( $ args , 'term' ) ; $ descriptions_args = $ this -> _getArgsStack ( $ args , 'description' ) ; $ i = 0 ; foreach ( $ content as $ term => $ def ) { $ term_args = array_merge_r... | Process a definitions list content |
2,439 | protected function _doTable ( & $ content , array & $ args = array ( ) ) { $ table = new TableTool ( isset ( $ content [ 'body' ] ) && is_array ( $ content [ 'body' ] ) ? $ content [ 'body' ] : array ( $ content ) , isset ( $ content [ 'head' ] ) && is_array ( $ content [ 'head' ] ) ? $ content [ 'head' ] : array ( ) ,... | Process a table content |
2,440 | protected function _doTableLine ( & $ content , array & $ args = array ( ) , $ scope = 'body' ) { $ my_line = '' ; $ cell_args = $ this -> _getArgsStackForTable ( $ args , 'cell' , $ scope ) ; $ cell_tag = 'table_' . $ scope . '_cell' ; foreach ( $ content as $ cell ) { $ my_line .= $ this -> _tagComposer ( $ cell , $ ... | Process a table line |
2,441 | protected function _getArgsStackForTable ( array & $ args , $ entry , $ scope ) { $ found_args = array ( ) ; $ global_args = $ this -> _getArgsStack ( $ args , $ entry , array ( ) , false ) ; if ( ! empty ( $ global_args ) ) { if ( array_key_exists ( $ scope , $ global_args ) ) { $ found_args = $ this -> _getArgsStack ... | Fallback system to find a specific entry in arguments for table scopes |
2,442 | public function importCookies ( ) { foreach ( $ this -> cookies as $ cookie ) { if ( ! empty ( $ cookie -> getValue ( ) ) ) { setcookie ( $ cookie -> getName ( ) , $ cookie -> getValue ( ) , $ cookie -> getExpires ( ) , $ cookie -> getPath ( ) , $ cookie -> getDomain ( ) , $ cookie -> getSecure ( ) ?? false , $ cookie ... | Imports the cookies from the HTTP response . If the cookie already exists it is replaced by the value in the HTTP response . |
2,443 | public static function getPrimaryModel ( $ models ) { if ( empty ( $ models ) ) { return false ; } \ d ( $ models ) ; exit ; foreach ( $ models as $ tabKey => $ model ) { if ( $ tabKey === static :: getPrimaryTabularId ( static :: baseClassName ( ) ) ) { return $ model ; } } return false ; } | Get primary model . |
2,444 | public function getCacheSize ( ) { $ n = 0 ; foreach ( static :: $ _cache as $ model => $ cache ) { $ n += count ( $ cache ) ; } return $ n ; } | Get cache size . |
2,445 | public function getSortOptions ( ) { $ options = [ ] ; $ descriptorSort = [ ] ; $ modelDescriptorFields = $ this -> descriptorField ; if ( ! is_array ( $ modelDescriptorFields ) ) { $ modelDescriptorFields = [ $ modelDescriptorFields ] ; } foreach ( $ modelDescriptorFields as $ field ) { if ( $ this -> hasAttribute ( $... | Get sort options . |
2,446 | public function getDescriptorDefaultOrder ( $ alias = '{alias}' , $ order = SORT_ASC ) { $ descriptorField = $ this -> descriptorField ; if ( ! is_array ( $ descriptorField ) ) { $ descriptorField = [ $ descriptorField ] ; } $ descriptorField = array_reverse ( $ descriptorField ) ; $ sortBy = [ ] ; foreach ( $ descript... | Get descriptor default order . |
2,447 | public function getDefaultOrder ( $ alias = 't' ) { if ( is_null ( $ this -> _defaultOrder ) ) { $ this -> _defaultOrder = $ this -> getDescriptorDefaultOrder ( '{alias}' ) ; } $ sortBy = [ ] ; foreach ( $ this -> _defaultOrder as $ key => $ value ) { $ sortBy [ strtr ( $ key , [ '{alias}' => $ alias ] ) ] = $ value ; ... | Get default order . |
2,448 | public function getPrimarySubdescriptor ( $ context = null ) { $ subdescriptor = [ ] ; foreach ( $ this -> getSubdescriptor ( $ context ) as $ subValue ) { if ( ! empty ( $ subValue ) ) { if ( is_array ( $ subValue ) && isset ( $ subValue [ 'plain' ] ) ) { $ subdescriptor [ ] = $ subValue [ 'plain' ] ; } elseif ( is_ar... | Get primary subdescriptor . |
2,449 | public function getLocalFieldValue ( $ field , $ options = [ ] , $ context = null , $ formatted = true ) { if ( isset ( $ this -> { $ field } ) ) { return $ this -> { $ field } ; } return ; } | Get local field value . |
2,450 | public function getPackage ( $ urlAction = 'view' ) { $ p = [ ] ; $ p [ 'id' ] = $ this -> primaryKey ; $ p [ 'descriptor' ] = $ this -> descriptor ; $ p [ 'url' ] = false ; if ( method_exists ( $ this , 'getUrl' ) ) { $ p [ 'url' ] = Url :: to ( $ this -> getUrl ( $ urlAction ) ) ; } return $ p ; } | Get package . |
2,451 | public function createRedirect ( $ from , $ to , $ permanent = false ) { $ route = new Route ( $ from , function ( Request $ request , Response $ response ) use ( $ from , $ to , $ permanent ) { $ urlVariables = VariableUrl :: extractUrlVariables ( $ request -> getRequestUri ( ) , $ to ) ; if ( ! empty ( $ urlVariables... | Creates and registers a new redirection route . |
2,452 | public function setSubdirectory ( $ subdirectory ) { $ this -> subdirectory = $ subdirectory ; foreach ( $ this -> routes as $ route ) { $ route -> setSubdirectory ( $ subdirectory ) ; } return $ this ; } | Sets the base subdirectory for all requests processed by this router . |
2,453 | public function getOptions ( Request $ request ) { $ routes = [ ] ; foreach ( $ this -> routes as $ route ) { if ( $ route -> matchesPattern ( $ request ) ) { $ routes [ ] = $ route ; } } return $ routes ; } | Gets all routing options for a given request . |
2,454 | public function dispatch ( Route $ route , Request $ request = null ) { $ context = $ this -> context ; if ( empty ( $ this -> context ) && ! empty ( $ request ) ) { $ context = new Context ( ) ; $ context -> registerInstance ( $ request ) ; } if ( ! empty ( $ context ) ) { $ context -> registerInstance ( $ route ) ; i... | Dispatches a Route executing its action . |
2,455 | protected function getParameterValueForCommand ( $ command , ArrayAccess $ source , ReflectionParameter $ parameter , array $ extras = array ( ) ) { if ( array_key_exists ( $ parameter -> name , $ extras ) ) { return $ extras [ $ parameter -> name ] ; } if ( isset ( $ source [ $ parameter -> name ] ) ) { return $ sourc... | Get a parameter value for a marshaled command . |
2,456 | public function hydrateObject ( $ targetObject , $ payload ) { if ( ! $ payload ) { return $ targetObject ; } if ( is_object ( $ payload ) || is_array ( $ payload ) ) { foreach ( $ payload as $ param => $ value ) { if ( is_int ( $ param ) ) { foreach ( $ value as $ par => $ val ) { $ setter = $ this -> prefixer ( self ... | Hydrate Object . |
2,457 | protected function hydrateCollection ( $ object , $ valueArray ) { if ( ! method_exists ( $ object , 'getValueClass' ) || ! method_exists ( $ object , 'setCollection' ) ) { return $ object ; } $ collection = [ ] ; $ class = $ object -> getValueClass ( ) ; if ( class_exists ( $ class ) ) { foreach ( $ valueArray as $ ke... | Hydrate Collection . |
2,458 | protected function hydrateMethod ( $ targetObject , $ method , $ value ) { if ( method_exists ( $ targetObject , $ method ) ) { $ dryObject = $ this -> getParameterClassObject ( $ targetObject , $ method ) ; if ( $ dryObject && is_object ( $ dryObject ) ) { $ hydratedObject = null ; if ( method_exists ( $ dryObject , '... | Hydrate Method . |
2,459 | public function getParameterClassObject ( $ object , $ method ) { $ reflectionClass = new \ ReflectionClass ( get_class ( $ object ) ) ; $ parameters = $ reflectionClass -> getMethod ( $ method ) -> getParameters ( ) ; if ( $ parameters && isset ( $ parameters [ 0 ] ) ) { $ refClass = $ parameters [ 0 ] -> getClass ( )... | Get Parameter Class Object . |
2,460 | public function uploadString ( $ name , $ content , $ contentType = 'text/plain' ) { $ fileName = $ this -> path . '/' . $ this -> getFilePathAndUniquePrefix ( ) . $ name ; if ( $ contentType === 'application/json' ) { $ content = Json :: prettyPrint ( $ content ) ; } ( new Filesystem ) -> dumpFile ( $ fileName , $ con... | Writes log message to file |
2,461 | public function css ( $ file = false , $ theme = null ) { $ this -> secondaryTheme ( $ theme ) ; $ css = $ this -> enqueueFiles ( $ file , $ this -> container -> getCSS ( ) , 'css' ) ; if ( is_string ( $ css ) ) return $ css ; foreach ( $ css as $ value ) { $ value = $ this -> buildPublicTmp ( $ value ) ; print '<link ... | Include all files . css |
2,462 | public function js ( $ file = false , $ theme = null ) { $ this -> secondaryTheme ( $ theme ) ; $ js = $ this -> enqueueFiles ( $ file , $ this -> container -> getJS ( ) , 'js' ) ; if ( is_string ( $ js ) ) return $ js ; foreach ( $ js as $ value ) { $ value = $ this -> buildPublicTmp ( $ value ) ; print '<script type=... | Include all files . js |
2,463 | public function img ( $ file , $ ext = null , $ theme = null ) { $ this -> secondaryTheme ( $ theme ) ; $ img = $ this -> enqueueFiles ( $ file , $ this -> container -> getIMG ( ) , $ ext ) ; return $ img ; } | Include files of images |
2,464 | public function assets ( $ file , $ lib = null , $ theme = null ) { $ this -> secondaryTheme ( $ theme ) ; $ assets = $ this -> enqueueFiles ( $ file , $ this -> container -> getFolderAssets ( $ lib ) ) ; return $ assets ; } | Include files of folder assets |
2,465 | public function enqueue ( $ file , $ theme = null ) { $ this -> secondaryTheme ( $ theme ) ; $ stack = $ this -> enqueueFiles ( $ file , $ this -> container -> getMainFolder ( ) . "/" . $ this -> container -> getThemeActivated ( ) ) ; return $ stack ; } | Include any file |
2,466 | protected function secondaryTheme ( $ theme = null ) { if ( $ theme ) { $ this -> origin = $ this -> container -> getThemeActivated ( ) ; $ this -> container -> setThemeActivated ( $ theme ) ; } } | Configuration of theme secondary |
2,467 | protected function destroySecondaryTheme ( ) { if ( $ this -> origin ) $ this -> container -> setThemeActivated ( $ this -> origin ) ; $ this -> origin = null ; } | Destroy theme secondary |
2,468 | public function buildPublicTmp ( $ path ) { $ repository = $ this -> themeRepository ( ) ; $ repository = Filter :: realPath ( $ repository ) ; $ repository_tmp = $ this -> getFolderTmpTheme ( ) ; $ pos = strpos ( $ path , $ repository ) ; if ( $ pos === 0 ) return $ repository_tmp . substr ( $ path , strlen ( $ reposi... | Generate folder to files temporary of themes |
2,469 | private static function getFromSession ( ) { if ( empty ( $ _SESSION [ 'current_user' ] ) ) { $ entityClassName = static :: ENTITIES_CLASS_NAME ; $ user = new $ entityClassName ( array ( 'source' => 'cookie' , ) ) ; self :: setCurrent ( $ user ) ; } else { Logger :: get ( ) -> debug ( 'Found user in session.' ) ; if ( ... | Obtains a user reference from a cookie . |
2,470 | public static function getFromIdentityProvider ( Provider $ identityProvider ) { $ identityProvider -> authenticate ( ) ; $ userId = $ identityProvider -> getUserId ( ) ; try { Logger :: get ( ) -> debug ( sprintf ( 'Checking OpenID user %s...' , $ userId ) ) ; $ user = Users :: getInstance ( ) -> findEntity ( $ userId... | Use the specified identity provider to establish an authenticated user . |
2,471 | private function _load ( $ pClassName ) { if ( array_key_exists ( $ pClassName , self :: $ _aliases ) ) { return class_alias ( self :: $ _aliases [ $ pClassName ] , $ pClassName ) ; } if ( strpos ( $ pClassName , self :: AGL_POOL ) === 0 ) { $ path = self :: _loadFromAgl ( $ pClassName ) ; $ realPath = AGL_PATH . $ pat... | Load class file if exists . |
2,472 | private static function _loadFromApp ( $ pClassName ) { $ classNameArr = explode ( '_' , StringData :: fromCamelCase ( $ pClassName ) ) ; $ pool = array_pop ( $ classNameArr ) ; return APP_PATH . Agl :: APP_PHP_DIR . $ pool . DS . implode ( DS , $ classNameArr ) . Agl :: PHP_EXT ; } | Retrieve the class path in the application pool . |
2,473 | public function hasChildren ( ) { $ item = $ this -> data [ $ this -> keys [ $ this -> position ] ] ; return ( is_object ( $ item ) && $ item instanceof \ Octris \ Db \ Type \ SubObject ) ; } | Returns if an iterator can be created fot the current item . |
2,474 | protected function loadRules ( ) { $ old_cwd = getcwd ( ) ; chdir ( __DIR__ ) ; $ path = 'Validate' . DIRECTORY_SEPARATOR . 'Rules' ; if ( ! is_dir ( $ path ) ) { throw new ValidateException ( "Rules Directory " . $ path . " isn't a directory..." ) ; } $ files = new \ RecursiveIteratorIterator ( new \ RecursiveDirector... | Adds all the custom rules |
2,475 | public function val ( array $ data ) { $ this -> _fields = $ data ; $ labels = array ( ) ; foreach ( $ data as $ key => $ value ) { $ labels [ $ key ] = ucwords ( str_replace ( '_' , ' ' , $ key ) ) ; } $ this -> labels ( $ labels ) ; return parent :: validate ( ) ; } | Processes the validation group |
2,476 | public static function thumb ( $ path , array $ params , Template $ template ) { if ( empty ( $ path ) ) { if ( empty ( $ params [ 'dummy' ] ) ) { return '' ; } $ path = $ params [ 'dummy' ] ; } $ const = Helper :: getValue ( $ params [ 'const' ] , 1 , true ) ; $ imageProvider = Instance :: ensure ( isset ( $ params [ ... | Get thumb . |
2,477 | private function _prepareCondition ( ConditionInterface $ condition = null ) { $ this -> condition = $ this -> expressionBuilderFactory -> create ( $ condition ) -> build ( ) ; } | Fill the property condition in a well format for the process method . |
2,478 | private function _prepareOrderBy ( array $ orderByArray ) { if ( count ( $ orderByArray ) === 1 ) { foreach ( $ orderByArray as $ orderMode => $ column ) { $ this -> orderBy = 'ORDER BY ' . $ column -> getColumnName ( ) . ' ' . $ orderMode . ' ' ; } } } | Fill the property orderBy in a well format for the process method . |
2,479 | public static function registerNamespace ( $ namespace , $ directory , $ extension = '.php' , $ prioritize = false ) { if ( self :: $ _namespaces === null ) { self :: $ _namespaces = array ( ) ; } $ directory = str_replace ( '\\' , '/' , realpath ( $ directory ) ) . '/' ; if ( $ prioritize ) { array_unshift ( self :: $... | Registers a namespace for auto loading . |
2,480 | public static function onAutoLoad ( $ class ) { if ( isset ( self :: $ customMappings [ $ class ] ) ) { require_once ( self :: $ customMappings [ $ class ] ) ; return true ; } if ( self :: $ _namespaces !== null ) { foreach ( self :: $ _namespaces as $ data ) { $ ns = $ data [ 0 ] ; $ nsl = $ data [ 2 ] ; if ( substr (... | Will be called by PHP to invoke the auto loader . |
2,481 | protected function findOS ( ) { if ( isset ( $ this -> os ) ) return $ this -> os ; switch ( true ) { case stristr ( PHP_OS , 'DAR' ) : return $ this -> os = static :: OS_OSX ; case stristr ( PHP_OS , 'WIN' ) : return $ this -> os = static :: OS_WIN ; case stristr ( PHP_OS , 'LINUX' ) : return $ this -> os = static :: ... | Figure out which operating system we re running on |
2,482 | public function get ( $ key = null , $ default = null ) { if ( is_null ( $ key ) ) { return $ this -> config ; } if ( isset ( $ this -> config [ $ key ] ) ) { return $ this -> config [ $ key ] ; } $ tmp = $ this -> config ; foreach ( explode ( '.' , $ key ) as $ segment ) { if ( ! is_array ( $ tmp ) || ! array_key_exis... | Get the value for the key using dot expansion . |
2,483 | protected function parse ( ) { $ sectionName = static :: GLOBAL_SECTION ; $ values = [ ] ; try { while ( $ line = fgets ( $ this -> handle ) ) { $ this -> linenumber ++ ; $ line = trim ( $ line ) ; if ( empty ( $ line ) || substr ( $ line , 0 , 1 ) === ';' ) { continue ; } if ( $ this -> isSectionHeader ( $ line ) ) { ... | Parse the ini file . |
2,484 | protected function parseValue ( $ value ) { if ( $ this -> isQuoted ( $ value ) ) { return trim ( preg_replace ( static :: ESCAPED_QUOTE_PATTERN , '\1' , $ value ) , static :: QUOTE_CHARS ) ; } elseif ( $ this -> opensQuote ( $ value ) ) { $ value = $ this -> parseMultilineValue ( ltrim ( $ value , static :: QUOTE_CHAR... | Parse the value for a key . |
2,485 | protected function parseMultilineValue ( $ seed = '' ) { $ closed = false ; $ lines = empty ( $ seed ) ? [ ] : [ $ seed ] ; while ( $ line = fgets ( $ this -> handle ) ) { $ line = trim ( $ line ) ; $ this -> linenumber ++ ; if ( $ this -> closesQuote ( $ line ) ) { $ closed = true ; $ lines [ ] = rtrim ( $ line , stat... | Parse a multiline string value . |
2,486 | protected function parseArrayKey ( $ key ) { preg_match ( static :: ARRAY_KEY_PATTERN , $ key , $ matches ) ; return ( isset ( $ matches [ 'array_key' ] ) ? $ matches [ 'array_key' ] : null ) ; } | Parse associative array key from ini array key value . |
2,487 | protected function subdivide ( $ sections , $ value ) { if ( empty ( $ sections ) ) { return $ value ; } $ section = array_shift ( $ sections ) ; return [ $ section => $ this -> subdivide ( $ sections , $ value ) , ] ; } | Expand delimited section headers into nested arrays . |
2,488 | protected function getContentType ( ResponseInterface $ response ) { if ( $ response -> hasHeader ( 'Content-Type' ) ) { $ header = $ response -> getHeaderLine ( 'Content-Type' ) ; $ parts = explode ( ';' , $ header ) ; return trim ( $ parts [ 0 ] ) ; } return null ; } | Check if the request has an attribute set with a mime type that should be used . This is typically a result of content negotiation . If no attribute exists check for an accept header instead . |
2,489 | private function rearrangeHostHeaderKey ( ) { if ( ! isset ( $ this -> headers [ 'Host' ] ) ) { return ; } $ tmp = $ this -> headers [ 'Host' ] ; $ keys = array_keys ( $ this -> headers ) ; $ hostIndex = array_search ( 'Host' , $ keys , true ) ; if ( false === $ hostIndex ) { return ; } array_splice ( $ this -> headers... | Rearrange Host value of current HTTP header into first entry . |
2,490 | private function changeHostFromUri ( ) { $ host = $ this -> uri -> getHost ( ) ; if ( $ host === '' ) { return ; } if ( ( $ port = $ this -> uri -> getPort ( ) ) !== null ) { $ host .= ':' . $ port ; } $ this -> headers [ 'Host' ] = [ $ host ] ; $ this -> rearrangeHostHeaderKey ( ) ; } | If this object is considered immutable and original host is not preserved better change it to the new one . |
2,491 | protected function clean ( $ values , $ reverse = true ) { $ clean = array_diff_key ( $ this -> config , array_flip ( self :: $ options ) ) ; return $ reverse ? array_merge ( $ values , $ clean ) : array_merge ( $ clean , $ values ) ; } | Removes additional configuration keys from a list of values |
2,492 | protected function getListMappingExpression ( ) { $ group = $ this -> hasOption ( 'query.group' ) ? $ this -> getOption ( 'query.group' ) : null ; $ index = $ this -> hasOption ( 'query.index' ) ? $ this -> getOption ( 'query.index' ) : null ; return $ this -> buildListExpression ( $ this -> entityProfile , $ index , $... | Obtains a list mapping expression for the current configuration |
2,493 | protected function getSelectColumns ( ) { if ( $ this -> hasOption ( 'query.attrs' ) ) { $ columns = [ ] ; foreach ( $ this -> getOption ( 'query.attrs' ) as $ attr ) { if ( $ attr instanceof Attr ) $ name = $ attr -> getName ( ) ; elseif ( is_string ( $ attr ) ) $ name = $ attr ; else throw new \ InvalidArgumentExcept... | Obtains a list of Column instances with the list of columns to fetch |
2,494 | protected function getFilter ( ) { $ filter = $ this -> getOption ( 'query.filter' ) ; $ negate = false ; if ( $ this -> hasOption ( 'query.negate' ) ) $ negate = ( bool ) $ this -> getOption ( 'query.negate' ) ; if ( is_array ( $ filter ) ) return new Filter ( $ filter , $ negate ) ; return new Filter ( [ $ filter ] ,... | Obtains configured filter |
2,495 | protected function getOrderBy ( ) { $ order = [ ] ; foreach ( $ this -> getOption ( 'query.orderBy' ) as $ attr ) { $ type = null ; if ( $ attr instanceof Attr ) { $ name = $ attr -> getName ( ) ; $ type = $ attr -> getType ( ) ; } elseif ( is_string ( $ attr ) ) { $ expr = explode ( ' ' , $ attr ) ; $ name = $ expr [ ... | Obtains the list of ordering columns |
2,496 | public function index ( $ index = null ) { if ( is_null ( $ index ) ) return $ this -> discard ( 'query.index' ) ; if ( $ index instanceof Column ) { $ map = $ this -> entityProfile -> getPropertyMap ( ) ; if ( ! in_array ( $ index -> getName ( ) , $ map ) ) throw new \ InvalidArgumentException ( sprintf ( "Column '%s'... | Sets index attribute |
2,497 | public function group ( $ group = null ) { if ( is_null ( $ group ) ) return $ this -> discard ( 'query.group' ) ; if ( $ group instanceof Column ) { $ map = $ this -> entityProfile -> getPropertyMap ( ) ; if ( ! in_array ( $ group -> getName ( ) , $ map ) ) throw new \ InvalidArgumentException ( sprintf ( "Column '%s'... | Sets group attribute |
2,498 | public function orderBy ( $ order = null ) { if ( is_null ( $ order ) ) return $ this -> discard ( 'query.orderBy' ) ; return $ this -> merge ( [ 'query.orderBy' => func_get_args ( ) ] ) ; } | Sets order attributes |
2,499 | public function limit ( $ limit = null ) { if ( is_null ( $ limit ) ) return $ this -> discard ( 'query.limit' ) ; return $ this -> merge ( [ 'query.limit' => intval ( $ limit ) ] ) ; } | Sets rows limit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.