idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
238,600
public function unserialize ( $ data ) { $ data = unserialize ( $ data ) ; $ this -> key = $ data [ 'key' ] ; $ this -> value = $ data [ 'value' ] ; $ this -> expires = $ data [ 'expires' ] ; $ this -> hit = $ data [ 'hit' ] ; }
Unserialize the item . Required for storing in the containing cache
238,601
public function buildSortClosure ( $ propertyPath , $ direction ) { $ value = function ( $ data ) use ( $ propertyPath ) { return $ this -> propertyAccessor -> getValue ( $ data , $ propertyPath ) ; } ; if ( $ direction === Util \ ColumnSort :: ASC ) { return function ( $ rowA , $ rowB ) use ( $ value ) { $ a = $ value...
Builds the sort closure .
238,602
private function applyClosures ( $ data ) { if ( ! empty ( $ this -> filterClosures ) ) { $ data = array_filter ( $ data , function ( $ datum ) { foreach ( $ this -> filterClosures as $ closure ) { if ( ! $ closure ( $ datum ) ) { return false ; } } return true ; } ) ; } if ( ! empty ( $ this -> sortClosures ) ) { uaso...
Applies the filters and sort closures .
238,603
public static function rewriteUris ( $ css , $ options = array ( ) ) { $ symlinks = array ( ) ; if ( is_link ( $ _SERVER [ 'DOCUMENT_ROOT' ] ) ) { $ symlinks = array ( '/' . $ options [ 'baseUrl' ] => readlink ( $ _SERVER [ 'DOCUMENT_ROOT' ] ) ) ; } return \ Minify_CSS_UriRewriter :: rewrite ( $ css , $ options [ 'curr...
Rewrite CSS URIs .
238,604
protected function getBaseUrl ( ) { $ baseUrl = $ this -> container -> get ( 'router' ) -> getContext ( ) -> getBaseUrl ( ) ; if ( $ baseUrl === '/' ) { return '' ; } return rtrim ( str_replace ( 'app_dev.php' , '' , $ this -> container -> get ( 'router' ) -> getContext ( ) -> getBaseUrl ( ) ) , '/' ) . '/' ; }
Returns the normalized base URL .
238,605
protected function determineClientUserAgent ( $ request ) { $ userAgent = null ; $ serverParams = $ request -> getServerParams ( ) ; $ userAgent = $ serverParams [ 'HTTP_USER_AGENT' ] ; $ checkProxyHeaders = $ this -> checkProxyHeaders ; if ( $ checkProxyHeaders && ! empty ( $ this -> trustedProxies ) ) { if ( ! in_arr...
Find out the client s UserAgent from the headers available to us
238,606
public function intercept ( ResponseInterface $ response ) { $ this -> stopPropagation ( ) ; $ this -> getTransaction ( ) -> setResponse ( $ response ) ; $ this -> exception -> setThrowImmediately ( false ) ; RequestEvents :: emitComplete ( $ this -> getTransaction ( ) ) ; }
Intercept the exception and inject a response
238,607
protected function getPageRule ( ) { $ existsRule = Rule :: exists ( $ this -> getTablePrefix ( ) . 'pages' , 'id' ) -> using ( function ( $ query ) { if ( $ this -> has ( 'locale' ) ) $ query -> where ( 'locale' , $ this -> get ( 'locale' , config ( 'app.locale' ) ) ) ; } ) ; return [ 'required' , 'integer' , $ exists...
Get the page validation rule .
238,608
public function updateLinkInfo ( $ results , $ query ) { $ results = array_map ( function ( $ result ) { $ post_type = get_post_type ( $ result [ 'ID' ] ) ; $ obj = get_post_type_object ( $ post_type ) ; $ result [ 'info' ] = '<strong>' . $ obj -> labels -> singular_name . '</strong>' ; $ ancestors = get_post_ancestors...
Get the post type and its parents
238,609
public function limitLinkSearch ( $ search , $ wp_query ) { global $ wpdb ; if ( empty ( $ search ) ) { return $ search ; } $ query_vars = $ wp_query -> query_vars ; $ search = '' ; $ and = '' ; foreach ( ( array ) $ query_vars [ 'search_terms' ] as $ term ) { $ search .= "{$searchand}(($wpdb->posts.post_title LIKE '%{...
Limits internal link search to post title field
238,610
protected function getTranslation ( array $ translationData , $ default = '' ) { if ( empty ( $ translationData ) ) { return $ default ; } if ( $ this -> locale && isset ( $ translationData [ $ this -> locale ] ) ) { return $ translationData [ $ this -> locale ] ; } return $ this -> defaultLocale && isset ( $ translati...
return translation matching current locale from given translation data
238,611
public function parse ( $ data ) { $ this -> table ( ) ; $ this -> images ( ) ; $ this -> text ( ) ; $ this -> html ( ) ; foreach ( $ this -> matches as $ key => $ val ) { $ data = preg_replace_callback ( $ key , $ val , $ data ) ; } return preg_replace_callback ( "/\n\r?/" , function ( ) { return '<br />' ; } , $ data...
Parse a text and replace the BBCodes
238,612
private static function _encodeConstants ( \ ReflectionClass $ cls ) { $ result = "constants : {" ; $ constants = $ cls -> getConstants ( ) ; $ tmpArray = array ( ) ; if ( ! empty ( $ constants ) ) { foreach ( $ constants as $ key => $ value ) { $ tmpArray [ ] = "$key: " . self :: encode ( $ value ) ; } $ result .= imp...
Encode the constants associated with the \ ReflectionClass parameter . The encoding format is based on the class2 format
238,613
public function merge ( ClassMetadata $ object ) { $ createdAt = $ this -> createdAt ; if ( ( $ otherCreatedAt = $ object -> getCreatedAt ( ) ) > $ createdAt ) { $ createdAt = $ otherCreatedAt ; } return new self ( $ this -> className , $ createdAt ) ; }
Returns a new NullClassMetadata with the highest createdAt .
238,614
public function addAttachment ( $ filePath ) { if ( ! $ file = fopen ( $ filePath , 'r' ) ) { throw new Exception ( 'Cannot open file "' . $ filePath . '"' ) ; } $ this -> attachments [ $ filePath ] = chunk_split ( base64_encode ( fread ( $ file , filesize ( $ filePath ) ) ) ) ; return $ this ; }
Attach a file to the email
238,615
public function setHTML ( $ content , array $ options = array ( ) ) { $ this -> html = $ content ; $ this -> htmlCharset = ( isset ( $ options [ 'charset' ] ) ) ? $ options [ 'charset' ] : 'utf-8' ; if ( @ $ options [ 'autoSetText' ] ) { $ this -> setText ( strip_tags ( $ this -> html ) , $ this -> htmlCharset ) ; } re...
Set html content
238,616
public function setText ( $ content , $ charset = 'utf-8' ) { $ this -> text = $ content ; $ this -> textCharset = $ charset ; return $ this ; }
Set text content
238,617
public function addBcc ( $ bcc ) { $ this -> bcc = ( ! empty ( $ this -> bcc ) ) ? $ this -> bcc . ',' . $ bcc : $ bcc ; return $ this ; }
Adds a best carbon copy
238,618
public static function get_post_field ( $ post_id = 0 , $ include_wp_fields = true , $ field = '' ) { if ( $ include_wp_fields && ! $ field ) { $ wp_fields = [ 'post_id' => $ post_id , 'permalink' => get_permalink ( $ post_id ) , 'title' => get_the_title ( $ post_id ) , 'content' => apply_filters ( 'the_content' , get_...
Get the field value for a post .
238,619
public static function get_taxonomy_field ( $ taxonomy_term , $ field = '' ) { if ( is_a ( $ taxonomy_term , 'WP_Term' ) ) { return self :: get_field ( $ taxonomy_term , $ field ) ; } elseif ( is_array ( $ taxonomy_term ) && count ( $ taxonomy_term ) >= 2 ) { return self :: get_field ( "{$taxonomy_term[0]}_{$taxonomy_t...
Get the fields for a taxonomy term .
238,620
private static function get_field ( $ target_id = 0 , $ field = '' ) { if ( self :: is_active ( ) ) { if ( $ field ) { return self :: get_single_field ( $ target_id , $ field ) ; } else { return self :: get_all_fields ( $ target_id ) ; } } return $ field ? null : [ ] ; }
Get all field values .
238,621
private static function get_all_fields ( $ target_id = 0 ) { $ data = [ ] ; $ field_objs = get_field_objects ( $ target_id ) ; if ( $ field_objs ) { foreach ( $ field_objs as $ field_name => $ field_obj ) { $ value = self :: get_single_field ( $ target_id , $ field_obj ) ; $ group_slug = self :: get_group_slug ( $ fiel...
Get all the fields for the target object .
238,622
private static function get_single_field ( $ target_id = 0 , $ field = '' ) { $ field_obj = is_array ( $ field ) ? $ field : get_field_object ( $ field , $ target_id ) ; $ field_key = isset ( $ field_obj [ 'key' ] ) ? $ field_obj [ 'key' ] : '' ; $ filter_name = Filter :: create_name ( Filter :: DEFAULT_TRANSFORMS , $ ...
Gat a single field value for a target object .
238,623
private static function get_group_slug ( $ group_id ) { global $ acf_local ; if ( isset ( $ acf_local -> groups [ $ group_id ] ) ) { $ title = $ acf_local -> groups [ $ group_id ] [ 'title' ] ; } else { $ title = '' ; if ( is_numeric ( $ group_id ) ) { $ args = [ 'post_type' => 'acf-field-group' , 'no_found_rows' => tr...
Get an ACF group slug
238,624
public function getValue ( ) { $ file = $ this -> getFile ( ) ; if ( $ file instanceof UploadedFile ) { return $ file -> getOriginalName ( ) ; } if ( is_array ( $ file ) && $ file [ 0 ] instanceof UploadedFile ) { return $ file [ 0 ] -> getOriginalName ( ) ; } return null ; }
get original name of an uploaded file associated with this element if attribute multiple is set the name of the first file is returned
238,625
protected function nonce ( ) { $ action = ( $ this -> getParameter ( 'action' ) == null ) ? $ this -> RequestContext -> getControls ( ) -> getControl ( 'action' ) : $ this -> getParameter ( 'action' ) ; return $ this -> Nonces -> create ( $ action ) ; }
Creates a nonce for the current or specified action
238,626
public function findCacheByString ( string $ string , int $ siteId = null ) { if ( $ this -> isCachedByString ( $ string , $ siteId ) ) { return $ this -> cacheByString [ $ siteId ] [ $ string ] ; } return null ; }
Find an existing cache by Handle
238,627
protected function isCachedByString ( $ string , int $ siteId = null ) { $ siteId = SiteHelper :: resolveSiteId ( $ siteId ) ; if ( ! isset ( $ this -> cacheByString [ $ siteId ] ) ) { $ this -> cacheByString [ $ siteId ] = [ ] ; } return array_key_exists ( $ string , $ this -> cacheByString [ $ siteId ] ) ; }
Identify whether in cached by string
238,628
protected static function parseDateValue ( $ value , $ format , $ timeZone ) { $ date = DateTime :: createFromFormat ( $ format , $ value , new DateTimeZone ( $ timeZone ) ) ; $ errors = DateTime :: getLastErrors ( ) ; if ( $ date === false || $ errors [ 'error_count' ] || $ errors [ 'warning_count' ] ) { return false ...
Parses date string into DateTime object
238,629
public function remove ( ) { $ args = func_get_args ( ) ; if ( count ( $ args ) == 0 ) { return $ this ; } $ last = array_pop ( $ args ) ; $ pointer = & $ this -> data ; foreach ( $ args as $ i => $ step ) { if ( ! isset ( $ pointer [ $ step ] ) || ! is_array ( $ pointer [ $ step ] ) ) { return $ this ; } $ pointer = &...
Removes a key and everything associated with it
238,630
public static function findOrDefault ( $ param , array $ attributes ) { $ model = self :: findOrNew ( $ param ) ; if ( $ model -> isNewRecord ) { $ model -> set ( $ attributes ) ; } return $ model ; }
Set not found default data
238,631
public static function findWithReplace ( $ param , array $ attributes ) { $ model = self :: findOrNew ( $ param ) ; $ model -> set ( $ attributes ) ; return $ model ; }
Set new attr
238,632
public function setTimeout ( int $ seconds , int $ microseconds = 0 ) : self { $ this -> timeout = ( float ) ( $ seconds . '.' . $ microseconds ) ; stream_set_timeout ( $ this -> resource , $ seconds , $ microseconds ) ; return $ this ; }
set timeout for connections
238,633
public function read ( int $ length = null ) : string { $ data = null === $ length ? fgets ( $ this -> resource ) : fgets ( $ this -> resource , $ length ) ; if ( false === $ data ) { if ( $ this -> eof ( ) ) { return '' ; } if ( stream_get_meta_data ( $ this -> resource ) [ 'timed_out' ] ) { throw new Timeout ( 'Readi...
read from socket
238,634
public function readBinary ( int $ length = 1024 ) : string { $ data = fread ( $ this -> resource , $ length ) ; if ( false === $ data ) { if ( stream_get_meta_data ( $ this -> resource ) [ 'timed_out' ] ) { throw new Timeout ( 'Reading of ' . $ length . ' bytes failed: timeout of ' . $ this -> timeout . ' seconds exce...
read binary data from socket
238,635
public function write ( string $ data ) : int { $ length = fputs ( $ this -> resource , $ data , strlen ( $ data ) ) ; if ( false === $ length ) { if ( stream_get_meta_data ( $ this -> resource ) [ 'timed_out' ] ) { throw new Timeout ( 'Writing of ' . strlen ( $ data ) . ' bytes failed:' . ' timeout of ' . $ this -> ti...
write data to socket
238,636
public function strainAction ( ) { $ id = $ this -> getRequest ( ) -> get ( $ this -> admin -> getIdParameter ( ) ) ; $ object = $ this -> admin -> getObject ( $ id ) ; $ strain = clone $ object ; $ strain -> setIsStrain ( true ) ; $ strain -> setParent ( $ object ) ; $ fieldSets = [ 'Professional' , 'Amateur' , 'Produ...
Creates a strain from a variety and passes it to create action .
238,637
public function getFilterWidgetAction ( Request $ request ) { $ translator = $ this -> get ( 'translator' ) ; $ fieldSet = $ request -> get ( 'fieldset' ) ; $ field = $ request -> get ( 'field' ) ; $ config = $ this -> admin -> getConfigurationPool ( ) -> getContainer ( ) -> getParameter ( 'librinfo_varieties' ) ; $ fi...
Get field widget for filter form .
238,638
public function handleErrors ( $ severity , $ message , $ filepath , $ line ) { if ( error_reporting ( ) == 0 || $ severity == E_STRICT ) return ; if ( false !== strpos ( $ filepath , '/' ) ) { $ x = explode ( '/' , $ filepath ) ; $ filepath = $ x [ count ( $ x ) - 3 ] . '/' . $ x [ count ( $ x ) - 2 ] . '/' . end ( $ ...
Defines the error handler that will be used when this class is created .
238,639
public function handleExceptions ( $ exception ) { $ this -> displayError ( $ exception ) ; $ this -> sendErrorNotification ( $ exception ) ; if ( isset ( $ this -> ApplicationContext ) && ( $ this -> ApplicationContext -> isOneOffRedeploy ( ) || $ this -> redeployOnError ) ) $ this -> ApplicationContext -> clearContex...
Defines the exception handler to use .
238,640
public static function matchLanguage ( $ a , $ b ) { $ a = explode ( '-' , $ a ) ; $ b = explode ( '-' , $ b ) ; for ( $ i = 0 , $ n = min ( count ( $ a ) , count ( $ b ) ) ; $ i < $ n ; $ i ++ ) { if ( $ a [ $ i ] !== $ b [ $ i ] ) break ; } return $ i === 0 ? 0 : ( float ) $ i / count ( $ a ) ; }
compare two language tags and distinguish the degree of matching
238,641
protected function paramHasContent ( array $ params , string $ method = 'getStream' ) : bool { if ( ! array_key_exists ( self :: ARRAY_KEY , $ params ) ) { throw new \ RuntimeException ( sprintf ( 'The "%s::%s" expect a file array key to build an instance of FileInfoStreamAdapter' , static :: class , $ method ) ) ; } r...
Param has content
238,642
protected function contentIsFileInfo ( $ file , string $ method = 'getStream' ) : bool { if ( ! $ file instanceof \ SplFileInfo ) { $ message = 'The "%s::%s" expect the file array key to be an instance of "%s". "%s" given' ; $ givenType = ( is_object ( $ file ) ? get_class ( $ file ) : gettype ( $ file ) ) ; throw new ...
Content is FileInfo
238,643
protected function _filterTag ( $ tag ) { $ isMatch = preg_match ( '~(</?)(\w*)((/(?!>)|[^/>])*)(/?>)~' , $ tag , $ matches ) ; if ( ! $ isMatch ) { return '' ; } $ tagStart = $ matches [ 1 ] ; $ tagName = strtolower ( $ matches [ 2 ] ) ; $ tagAttributes = $ matches [ 3 ] ; $ tagEnd = $ matches [ 5 ] ; if ( ! isset ( $...
Filters a single tag against the current option settings
238,644
public function initialize ( Listener $ listener ) { $ this -> listener = $ listener ; $ this -> topDirs = array_merge ( $ this -> topDirs , $ listener -> getPaths ( ) ) ; $ this -> tracker -> initialize ( $ listener ) ; }
Initialize a listener
238,645
private function doCleanup ( $ unchecked ) { $ tracker = $ this -> tracker ; foreach ( $ unchecked as $ id => $ tracked ) { $ origin = $ tracked -> getResource ( ) ; if ( ! $ origin -> isExists ( ) ) { $ tracker -> addChangeSet ( $ tracked , FilesystemEvent :: DELETE ) ; $ tracker -> remove ( $ tracked ) ; } unset ( $ ...
Track any undetected changes such as recursive directory delete
238,646
final public function authenticateBasic ( $ realm = null ) { if ( ! ( array_key_exists ( 'PHP_AUTH_USER' , $ _SERVER ) and array_key_exists ( 'PHP_AUTH_PW' , $ _SERVER ) ) and ! empty ( $ _SERVER [ 'PHP_AUTH_USER' ] ) and ! empty ( $ _SERER [ 'PHP_AUTH_PW' ] ) ) { $ this -> HTTPAuthenticate ( 'Basic' , array ( 'realm' ...
Checks for credentials in HTTP headers for Basic authentication
238,647
public function hasAnnotation ( $ name ) { $ result = false ; if ( ! string_ends_with ( $ name , 'Annotation' ) ) $ name .= 'Annotation' ; foreach ( $ this -> annotations as $ annotation ) { $ class = get_class ( $ annotation ) ; if ( string_starts_with ( $ class , "\\" ) && ! string_starts_with ( $ name , "\\" ) ) $ n...
Tells if the reflection object has the given annotation or not .
238,648
public function getAnnotation ( $ name ) { $ result = null ; if ( $ this -> hasAnnotationAndReturn ( $ name ) ) { if ( ! string_ends_with ( $ name , 'Annotation' ) ) $ name .= 'Annotation' ; $ result = isset ( $ this -> annotations [ $ name ] ) ? $ this -> annotations [ $ name ] : null ; if ( $ result == null ) { if ( ...
Returns the requested annotation .
238,649
public function isActiveSession ( ) { $ sessionConfig = $ GLOBALS [ 'app' ] -> getConfiguration ( ) -> getRawConfiguration ( 'session' ) ; if ( ! empty ( $ sessionConfig ) && isset ( $ sessionConfig [ 'timeout' ] ) && ! empty ( $ sessionConfig [ 'timeout' ] ) ) { $ sessionTimeout = $ sessionConfig [ 'timeout' ] ; } els...
Checks if session is currently active .
238,650
public static function resetActiveSession ( ) { $ appContext = rtrim ( $ GLOBALS [ 'app' ] -> getConfiguration ( ) -> getApplicationContext ( ) , '.' ) ; if ( empty ( $ appContext ) ) { $ appContext = "/" ; } else { $ appContext = "/" . $ appContext . "/" ; } $ category = $ _SESSION [ self :: GLOBAL_PREFIX . 'category'...
Resets currently active session .
238,651
public function sqlCheckIntegrity ( $ check = true , $ schema = '' , $ table = '' ) { if ( empty ( $ schema ) && empty ( $ table ) ) { return 'SET CONSTRAINTS ALL ' . ( $ check ? 'IMMEDIATE' : 'DEFERRED' ) ; } return sprintf ( 'ALTER TABLE %s.%s %s TRIGGER ALL' , $ this -> getQuotedName ( $ table ) , $ this -> getQuote...
Builds a SQL statement for enabling or disabling integrity check .
238,652
public function addCookie ( $ name , $ value , $ expire = 0 , $ path = '/' , $ domain = '' , $ secure = false , $ httpOnly = true ) { return ( new CookieInjector ) -> build ( ) -> set ( $ name , $ value , $ expire , $ path , $ domain , $ secure , $ httpOnly ) ; }
Add data into cookie
238,653
public function generateDescription ( $ paragraph = true ) { if ( ! isset ( $ this -> args [ 'desc' ] ) || ! $ this -> args [ 'desc' ] ) return ; $ tag = ( ! ! $ paragraph || $ paragraph == 'p' ) ? 'p' : 'span' ; return sprintf ( '<%1$s class="description">%2$s</%1$s>' , $ tag , $ this -> args [ 'desc' ] ) ; }
Generate the field description
238,654
protected function implodeOptions ( $ method = 'select_option' , $ default = null ) { $ this -> args [ 'default' ] ? : $ this -> args [ 'default' ] = $ default ; $ method = $ this -> camelCase ( $ method ) ; $ method = method_exists ( $ this , $ method ) ? $ method : 'selectOption' ; $ i = 0 ; if ( $ method === 'single...
Implode multi - field items
238,655
protected function normalize ( array $ defaults = [ ] , $ implode = false ) { $ args = $ this -> mergeAttributesWith ( $ defaults ) ; $ normalize = new Normalizer ; return ( $ this -> element && method_exists ( $ normalize , $ this -> element ) ) ? $ normalize -> { $ this -> element } ( $ args , $ implode ) : ( ! ! $ i...
Normalize attributes for this specific field type
238,656
protected function multiInput ( $ optionKey , $ number , $ type = 'radio' ) { $ args = $ this -> multiInputArgs ( $ type , $ optionKey , $ number ) ; if ( ! $ args ) return ; $ attributes = '' ; foreach ( $ args [ 'attributes' ] as $ key => $ val ) { $ attributes .= sprintf ( '%s="%s" ' , $ key , $ val ) ; } return spr...
Generate checkboxes and radios
238,657
protected function selectOption ( $ optionKey ) { return sprintf ( '<option value="%s"%s>%s</option>' , $ optionKey , selected ( $ this -> args [ 'value' ] , $ optionKey , false ) , $ this -> args [ 'options' ] [ $ optionKey ] ) ; }
Generate select options
238,658
protected function singleInput ( $ type = 'checkbox' ) { $ optionKey = key ( $ this -> args [ 'options' ] ) ; $ args = $ this -> multiInputArgs ( $ type , $ optionKey , 1 ) ; if ( ! $ args ) return ; $ atts = $ this -> normalize ( ) ; $ atts = wp_parse_args ( $ args [ 'attributes' ] , $ atts ) ; $ attributes = '' ; for...
Generate a single checkbox
238,659
public function setColumns ( array $ columns ) { foreach ( $ columns [ 'add' ] as $ key => $ value ) { $ this -> dataTables -> addColumn ( $ key , $ value ) ; } foreach ( $ columns [ 'edit' ] as $ key => $ value ) { $ this -> dataTables -> editColumn ( $ key , $ value ) ; } foreach ( $ columns [ 'remove' ] as $ value )...
set data table columns
238,660
private function getDefaultUrls ( $ model ) { $ slug = getModelSlug ( $ model ) ; return [ 'details' => lmbRoute ( "api.{$slug}.detail" , [ 'id' => $ model -> id ] ) , 'fast_edit' => lmbRoute ( "api.{$slug}.fastEdit" , [ 'id' => $ model -> id ] ) , 'edit' => lmbRoute ( "api.{$slug}.update" , [ 'id' => $ model -> id ] )...
get default urls for Datatables
238,661
public function setShow ( $ show ) { Argument :: i ( ) -> test ( 1 , 'int' ) ; if ( $ show < 1 ) { $ show = 1 ; } $ this -> show = $ show ; return $ this ; }
Sets pages to show left and right of the current page
238,662
public function toSQL ( Parameters $ params , bool $ inner_clause ) { if ( $ key = $ this -> getKey ( ) ) { try { $ params -> get ( $ key ) ; } catch ( \ OutOfRangeException $ e ) { $ key = null ; } } if ( ! $ key ) $ key = $ params -> assign ( null ) ; $ this -> bind ( $ params , $ key , array ( $ params -> getDriver ...
Write a constant array clause as SQL query syntax
238,663
public function getName ( array $ keys = [ ] , string $ delimiter = "." ) : string { if ( empty ( $ keys ) ) { return $ this -> name ; } $ keys [ ] = $ this -> name ; return implode ( $ delimiter , $ keys ) ; }
Get the name of the field
238,664
public function getNestedName ( string $ delimiter = "." , string $ name = "" ) : string { $ keys = array_filter ( [ $ this -> name , $ name ] , "strlen" ) ; $ parent = $ this ; while ( $ parent = $ parent -> getParent ( ) ) { $ name = $ parent -> getName ( ) ; if ( $ name ) { array_unshift ( $ keys , $ parent -> getNa...
Get a field s nested name
238,665
public function getTransport ( $ transportName ) { if ( empty ( $ this -> transport [ $ transportName ] ) ) { throw new InvalidArgumentException ( sprintf ( 'Transport %s not found' , $ transportName ) ) ; } return $ this -> transport [ $ transportName ] ; }
Get transport by name
238,666
public function add ( $ path , $ handler ) { $ route = new Route ( $ path , $ handler ) ; $ this -> routes [ ] = $ route ; $ this -> nameCache = [ ] ; $ this -> routeParser = new RouteParser ; return $ route ; }
Adds a route to the map and resets the name cache .
238,667
private function buildNameCache ( ) { if ( ! empty ( $ this -> nameCache ) ) { return ; } foreach ( $ this as $ route ) { if ( ! $ route -> name ( ) ) { continue ; } $ this -> nameCache [ $ route -> name ( ) ] = $ route ; } }
Iterates through routes and builds a name cache .
238,668
public function setJsonOptions ( $ options ) { $ this -> encodingOptions = ( int ) $ options ; return $ this -> setData ( $ this -> getData ( ) ) ; }
Set the JSON encoding options .
238,669
public static function initiate ( $ settings ) { $ taskStatus = new BackgroundTaskStatus ( ) ; $ taskStatus -> TaskClass = get_called_class ( ) ; $ taskStatus -> TaskSettings = $ settings ; $ taskStatus -> save ( ) ; $ task = new static ( ) ; $ additionalArguments = $ task -> getShellArguments ( ) ; $ additionalArgumen...
Initiates execution of the background task .
238,670
public function add ( \ SplFileInfo $ file ) { $ content = new \ Org_Heigl \ FileFinder \ Service \ Tokenlist ( file_get_contents ( $ file -> getPathname ( ) ) ) ; $ classname = $ content -> getClassName ( ) ; if ( ! $ classname ) { return ; } $ class = $ content -> getNamespace ( ) ; $ class [ ] = $ classname ; $ key ...
Add an SPL - File - Info to the filelist
238,671
public function call ( ) { $ params = $ this -> app -> router ( ) -> getCurrentRoute ( ) -> getParams ( ) ; $ options = $ this -> model -> getOptionsList ( ) ; if ( isset ( $ params [ 'id' ] ) ) { $ options = $ this -> model -> getOptions ( ) ; } if ( in_array ( $ this -> app -> request ( ) -> getMethod ( ) , $ options...
Check if the current HTTP method is allowed for the resource being accesed
238,672
public function getMD ( $ content ) { $ funcArr = [ "yamlfrontmatter" , "shortcode" , "markdown" , "titlefromheader" ] ; $ textFilter = new textFilter ( ) ; return $ textFilter -> parse ( $ content , $ funcArr ) -> text ; }
Return markdown based on string
238,673
protected function getFeed ( $ query , $ options ) { $ options = array_merge ( [ 'query' => $ query ] , $ options ) ; $ nyaa = $ this -> getNyaa ( ) ; $ feed = $ nyaa -> getFeed ( $ options ) ; $ matcher = $ this -> getMatcher ( ) ; return array_filter ( $ feed , function ( $ item ) use ( $ matcher , $ query ) { $ titl...
Gets the torrent feed for given query and options
238,674
public function filterDuplicates ( $ torrents ) { $ arr = [ ] ; foreach ( $ torrents as $ torrent ) { $ arr [ $ torrent -> getTorrentId ( ) ] = $ torrent ; } return array_values ( $ arr ) ; }
Return list with unique torrents from given array
238,675
public function mapByHash ( $ feed ) { $ torrents = [ ] ; foreach ( $ feed as $ torrent ) { $ hash = $ torrent -> getSeriesHash ( ) ; if ( ! isset ( $ torrents [ $ hash ] ) ) { $ torrents [ $ hash ] = new NyaaSet ( $ hash ) ; } $ torrents [ $ hash ] -> add ( $ torrent ) ; } return $ torrents ; }
Maps the torrents by series hash and collects them in a NyaaSet
238,676
public function collectForUser ( $ query , $ users , $ options = [ ] ) { $ bigFeed = [ ] ; foreach ( $ users as $ userId ) { $ userOptions = array_merge ( $ options , [ 'user' => $ userId ] ) ; $ userFeed = $ this -> getFeed ( $ query , $ userOptions ) ; $ bigFeed = array_merge ( $ bigFeed , $ userFeed ) ; } $ bigFeed ...
Searches for torrents per user
238,677
public function collectRecursive ( $ query , $ options = [ ] ) { $ feed = $ this -> getFeed ( $ query , $ options ) ; $ userIds = [ ] ; foreach ( $ feed as $ torrent ) { if ( ! isset ( $ userIds [ $ torrent -> getSeriesHash ( ) ] ) ) { $ userIds [ $ torrent -> getSeriesHash ( ) ] = $ torrent -> getUserId ( ) ; } } $ us...
Searches for torrent and searches for each found torrent in their user for more torrents to create complete sets
238,678
public function collect ( $ query , $ options = [ ] ) { if ( ! $ this -> getNyaa ( ) -> canProvideAllData ( ) ) { return $ this -> collectRecursive ( $ query , $ options ) ; } return $ this -> collectSingleFeed ( $ query , $ options ) ; }
Searches for torrents by query and returns sets created from it Collects recursively if backend doesn t provide all data
238,679
public function collectSingleFeed ( $ query , $ options = [ ] ) { $ feed = $ this -> getFeed ( $ query , $ options ) ; return $ this -> mapByHash ( $ feed ) ; }
Searches for torrents by query and returns sets created from it only fetches one feed .
238,680
private function getDwnlCustomer ( ) { if ( is_null ( $ this -> cacheDwnlCust ) ) { $ custId = $ this -> session -> getCustomerId ( ) ; $ this -> cacheDwnlCust = $ this -> daoDwnlCust -> getById ( $ custId ) ; } return $ this -> cacheDwnlCust ; }
Cached data for current downline customer .
238,681
public function actionTranslation ( $ options ) { if ( ! is_array ( $ options ) ) { return $ this -> translator -> trans ( $ options , [ ] , 'CmsKernelAdminBridge' ) ; } $ resultOptions = [ ] ; foreach ( $ options as $ optionKey => $ option ) { $ option = null === json_decode ( $ option , true ) ? $ option : json_decod...
Callback of action translation Twig filter that returns resultant array .
238,682
public function reverseTransform ( $ boolean ) { if ( ! $ boolean ) { return null ; } $ rClass = new \ ReflectionClass ( $ this -> specificationClass ) ; if ( $ rClass -> getConstructor ( ) && $ rClass -> getConstructor ( ) -> getNumberOfParameters ( ) > 0 ) { return $ rClass -> newInstanceArgs ( $ this -> constructorA...
Transforms a value into a specification .
238,683
public static function detectEnv ( array $ environments , $ uri ) { foreach ( $ environments as $ environment => $ patterns ) { foreach ( $ patterns as $ pattern ) { if ( Inflector :: is ( $ pattern , $ uri ) or $ pattern == gethostname ( ) ) { return $ environment ; } } } }
Detect the current environment from an environment configuration .
238,684
public function setEntry ( $ var = null , $ val = null , $ section = false ) { if ( ! empty ( $ var ) ) { if ( $ section ) { if ( ! isset ( $ this -> registry [ $ section ] ) ) { $ this -> registry [ $ section ] = array ( ) ; } $ this -> registry [ $ section ] [ $ var ] = $ val ; } else { $ this -> registry [ $ var ] =...
Set an entry in the instance registry
238,685
public function getEntry ( $ var = null , $ section = false , $ default = null ) { if ( ! empty ( $ var ) ) { if ( ! empty ( $ section ) && isset ( $ this -> registry [ $ section ] ) && isset ( $ this -> registry [ $ section ] [ $ var ] ) ) { return $ this -> registry [ $ section ] [ $ var ] ; } elseif ( isset ( $ this...
Get an entry from the instance registry
238,686
public function isEntry ( $ var = null , $ section = false ) { return ( ! empty ( $ var ) and ( ( ! empty ( $ section ) && isset ( $ this -> registry [ $ section ] ) && isset ( $ this -> registry [ $ section ] [ $ var ] ) ) or isset ( $ this -> registry [ $ var ] ) ) ) ; }
Check if an entry exists in registry
238,687
public function getKey ( $ val = null , $ var = null , $ section = false ) { if ( ! empty ( $ val ) ) { if ( ! empty ( $ var ) ) { foreach ( $ this -> registry as $ _sct => $ _data ) { if ( $ ok = array_search ( $ val , $ _data ) && $ ok == $ var ) { return $ _sct ; } } } elseif ( ! empty ( $ section ) && isset ( $ thi...
Search a key in registry
238,688
public function dumpStack ( $ index = null , $ default = null ) { if ( array_key_exists ( $ index , $ this -> registry_stacks ) ) { return $ this -> registry_stacks [ $ index ] ; } return $ default ; }
Get a full stack from registry stacks
238,689
public function saveStack ( $ index = null , $ and_clean = false ) { $ this -> registry_stacks [ $ index ] = $ this -> registry ; if ( $ and_clean === true ) { $ this -> registry = array ( ) ; } return $ this ; }
Save a stack of entries in registry
238,690
public function getStackEntry ( $ var = null , $ section = false , $ stack = null , $ default = null ) { if ( ! empty ( $ var ) ) { if ( ! empty ( $ stack ) && $ this -> isStack ( $ stack ) ) { $ tmp_stack = $ this -> registry ; $ this -> loadStack ( $ stack ) ; $ val = $ this -> getEntry ( $ var , $ section , $ defaul...
Get a stack entry of the registry stacks
238,691
public function getStackKey ( $ val = null , $ section = false , $ stack = null , $ default = null ) { if ( ! empty ( $ val ) ) { if ( ! empty ( $ stack ) && $ this -> isStack ( $ stack ) ) { $ tmp_stack = $ this -> registry ; $ this -> loadStack ( $ stack ) ; $ var = $ this -> getKey ( $ val , $ section , $ default ) ...
Get the key of a stack entry of the registry stacks
238,692
public function create ( Description $ description ) { return new Tip ( new Identifier ( $ description -> getMandatoryProperty ( 'id' ) ) , $ description -> getMandatoryProperty ( 'text' ) , $ description -> getMandatoryProperty ( 'type' ) , $ description -> getMandatoryProperty ( 'agreeCount' ) , $ description -> getM...
Create a tip from a description .
238,693
public static function getMimeType ( $ filePath ) { $ fInfo = finfo_open ( FILEINFO_MIME_TYPE ) ; $ mime = finfo_file ( $ fInfo , $ filePath ) ; finfo_close ( $ fInfo ) ; return $ mime ; }
Get mime - type og the file .
238,694
private static function createInstance ( $ classname , array $ arguments = array ( ) ) { $ reflection_obj = new ReflectionClass ( $ classname ) ; if ( $ reflection_obj -> getMethod ( '__construct' ) -> isPublic ( ) ) { self :: $ _instances [ $ classname ] = call_user_func_array ( array ( $ reflection_obj , 'newInstance...
Real object instances creation
238,695
public function linkModels ( Models $ models , Models $ foreign , Closure $ yield ) { foreach ( $ models as $ model ) { $ linked = [ ] ; foreach ( $ foreign as $ foreignModel ) { if ( $ this -> areLinked ( $ model , $ foreignModel ) ) { $ linked [ ] = $ foreignModel ; } } $ link = $ this -> newLinkFrom ( $ model , $ li...
Iterate models and foreign models one by one and and assign links based on the areLinked method Yeild the resulted links one by one for further processing .
238,696
public function getEnabledLinks ( ) { switch ( $ this -> LinkMode ) { case self :: MODE_PAGES : $ links = ArrayList :: create ( ) ; foreach ( $ this -> LinkedPages ( ) as $ page ) { $ link = $ page -> toLink ( ) ; $ link -> setParent ( $ this ) ; $ links -> push ( $ link ) ; } break ; default : $ links = $ this -> getL...
Answers a list of the enabled links within the receiver .
238,697
public function addIfExists ( $ file_path , $ media = 'screen' , $ condition = null ) { $ _fp = $ this -> __template -> findAsset ( $ file_path ) ; if ( $ _fp || \ AssetsManager \ Loader :: isUrl ( $ file_path ) ) { return $ this -> add ( $ file_path , $ media , $ condition ) ; } return $ this ; }
Add a CSS file in CSS stack if it exists
238,698
public function add ( $ file_path , $ media = 'screen' , $ condition = null ) { $ _fp = $ this -> __template -> findAsset ( $ file_path ) ; if ( $ _fp || \ AssetsManager \ Loader :: isUrl ( $ file_path ) ) { $ this -> registry -> addEntry ( array ( 'file' => $ _fp , 'media' => $ media , 'condition' => $ condition ) , '...
Add a CSS file in CSS stack
238,699
public function set ( array $ files ) { if ( ! empty ( $ files ) ) { foreach ( $ files as $ _file ) { if ( is_array ( $ _file ) && isset ( $ _file [ 'file' ] ) ) { $ this -> add ( $ _file [ 'file' ] , isset ( $ _file [ 'media' ] ) ? $ _file [ 'media' ] : '' , isset ( $ _file [ 'condition' ] ) ? $ _file [ 'condition' ] ...
Set a full CSS stack