idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
57,600
public function prepareValue ( $ value , $ datatype ) { if ( $ value === null ) { return 'NULL' ; } switch ( $ datatype ) { case Column :: TYPE_INTEGER : $ filtered = filter_var ( $ value , FILTER_VALIDATE_INT ) ; if ( $ filtered === false ) { throw new \ InvalidArgumentException ( 'Not an integer: ' . $ value ) ; } re...
Prepare a literal value for insertion into an SQL statement
57,601
public function getName ( ) { if ( ! $ this -> _name ) { $ result = $ this -> query ( 'select catalog_name from information_schema.information_schema_catalog_name' ) ; $ this -> _name = $ result [ 0 ] [ 'catalog_name' ] ; } return $ this -> _name ; }
Return name of the database that the current connection points to
57,602
public function getTable ( $ name ) { if ( $ name != strtolower ( $ name ) ) { throw new \ DomainException ( 'Table name must be lowercase: ' . $ name ) ; } if ( ! isset ( $ this -> _tables [ $ name ] ) ) { $ class = 'Nada\Table\\' . $ this -> getDbmsSuffix ( ) ; $ this -> _tables [ $ name ] = new $ class ( $ this , $ ...
Get access to a specific table
57,603
public function getTables ( ) { if ( ! $ this -> _allTablesFetched ) { $ tables = $ this -> getTableNames ( ) ; foreach ( $ tables as $ table ) { $ this -> getTable ( $ table ) ; } ksort ( $ this -> _tables ) ; $ this -> _allTablesFetched = true ; } return $ this -> _tables ; }
Return all tables
57,604
public function getViewNames ( ) { $ names = $ this -> query ( 'SELECT table_name FROM information_schema.tables WHERE table_schema=? AND table_type=?' , array ( $ this -> getTableSchema ( ) , 'VIEW' ) ) ; foreach ( $ names as & $ name ) { $ name = $ name [ 'table_name' ] ; } return $ names ; }
Return list of all view names
57,605
public function getNativeDatatype ( $ type , $ length = null , $ cast = false ) { switch ( $ type ) { case Column :: TYPE_INTEGER : if ( $ length === null ) { $ length = Column :: DEFAULT_LENGTH_INTEGER ; } switch ( $ length ) { case 16 : return 'SMALLINT' ; case 32 : return 'INTEGER' ; case 64 : return 'BIGINT' ; defa...
Get DBMS - specific datatype for abstract NADA datatype
57,606
public function createColumn ( $ name , $ type , $ length = null , $ notnull = false , $ default = null , $ autoIncrement = false , $ comment = null ) { $ column = $ this -> createColumnObject ( ) ; $ column -> constructNew ( $ this , $ name , $ type , $ length , $ notnull , $ default , $ autoIncrement , $ comment ) ; ...
Construct a new column
57,607
public function createColumnFromArray ( array $ data ) { return $ this -> createColumn ( $ data [ 'name' ] , $ data [ 'type' ] , $ data [ 'length' ] , ! empty ( $ data [ 'notnull' ] ) , @ $ data [ 'default' ] , ! empty ( $ data [ 'autoincrement' ] ) , @ $ data [ 'comment' ] ) ; }
Construct a new column with data from an array
57,608
public function createTable ( $ name , array $ columns , $ primaryKey = null ) { $ name = strtolower ( $ name ) ; if ( strpos ( $ name , 'sqlite_' ) === 0 ) { throw new \ InvalidArgumentException ( 'Created table name must not begin with sqlite_' ) ; } if ( empty ( $ columns ) ) { throw new \ InvalidArgumentException (...
Create a table
57,609
protected function _getTablePkDeclaration ( array $ primaryKey , $ autoIncrement ) { foreach ( $ primaryKey as & $ column ) { $ column = $ this -> prepareIdentifier ( $ column ) ; } return ",\nPRIMARY KEY (" . implode ( ', ' , $ primaryKey ) . ')' ; }
Get the declaration for a table s primary key
57,610
protected function indexAnnotationsByType ( array $ annotations ) { $ indexed = array ( ) ; if ( $ annotations && is_numeric ( key ( $ annotations ) ) ) { foreach ( $ annotations as $ annotation ) { $ annotationType = get_class ( $ annotation ) ; if ( isset ( $ indexed [ $ annotationType ] ) && ! is_array ( $ indexed [...
Indexes a numerically - indexed array of annotation instances by their class names .
57,611
public function build ( array $ filterConfigurations ) { $ resolver = new OptionsResolver ( ) ; $ filters = [ ] ; foreach ( $ filterConfigurations as $ filterName => $ filterConfiguration ) { $ resolver -> clear ( ) ; if ( $ filterConfiguration === null ) { $ filterConfiguration = [ ] ; } $ configuration = $ this -> ge...
Build the filter with the given configuration .
57,612
protected function getFilterConfiguration ( $ filter ) { if ( ! array_key_exists ( $ filter , $ this -> mapping ) ) { throw new Exception ( $ filter . ' filter not found in assets mapping. Check your configuration' ) ; } $ class = $ this -> mapping [ $ filter ] . 'Configuration' ; if ( ! class_exists ( $ class ) ) { th...
Return filter configuration instance using the configured mapping .
57,613
public function getDecodedJson ( ) : array { if ( ! ( $ array = json_decode ( $ this -> json , true ) ) ) { throw new \ RuntimeException ( "Unable to decode the response's JSON" ) ; } return json_decode ( $ this -> json , true ) ; }
Returns the decoded JSON string .
57,614
public static function fromString ( $ string ) { if ( is_null ( $ string ) || empty ( $ string ) || ! is_string ( $ string ) ) { throw new \ InvalidArgumentException ( 'The given ReCaptcha response data is invalid.' , 1452283305 ) ; } $ value = ( string ) $ string ; $ value = filter_var ( $ value , FILTER_SANITIZE_STRI...
Creates the ReCaptchaResponse data object
57,615
public function toArray ( ) { $ aReturn = array ( ) ; foreach ( get_object_vars ( $ this ) as $ sKey => $ mValue ) { if ( is_object ( $ mValue ) and true === method_exists ( $ mValue , 'toArray' ) ) { $ aReturn [ $ sKey ] = $ mValue -> toArray ( ) ; } else { $ aReturn [ $ sKey ] = $ mValue ; } } return $ aReturn ; }
return this entity as array
57,616
public static function create ( $ type , $ name , $ value = null , array $ attributes = [ ] , array $ options = [ ] , $ required = false , array $ modifiers = [ ] , array $ validators = [ ] , $ validationErrorMessage = null ) { $ type = strtolower ( $ type ) ; if ( is_array ( $ value ) && $ type !== 'multipleselect' ) ...
create either single FormElement or array of FormElements
57,617
private static function createSingleElement ( $ type , $ name , $ value , $ attributes , $ options , $ required , $ modifiers , $ validators , $ validationErrorMessage ) { switch ( $ type ) { case 'input' : $ elem = new InputElement ( $ name ) ; break ; case 'file' : $ elem = new FileInputElement ( $ name ) ; break ; c...
generate a single form element
57,618
protected function filter ( array $ list ) { $ tmp = [ ] ; foreach ( $ list as $ item ) { if ( $ item [ 'anime' ] ) { $ tmp [ ] = $ item ; } } return $ tmp ; }
Filter a list items
57,619
public function deleteAction ( $ entity , $ id ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ entity = $ em -> getRepository ( $ entity ) -> find ( $ id ) ; if ( ! $ entity ) { throw $ this -> createNotFoundException ( "Unable to find $entity entity." ) ; } $ em -> remove ( $ entity ) ; $ em -> flush ( ) ; ...
Delete any entity .
57,620
public static function FromFloat ( $ value , $ detail = true ) { if ( $ value instanceof XPath2Item ) { $ value = $ value -> getTypedValue ( ) ; } if ( $ value instanceof DecimalValue ) return $ value ; if ( ( ! is_numeric ( $ value ) ) || is_infinite ( $ value ) || is_nan ( $ value ) ) { throw XPath2Exception :: withE...
Creates an instance from a Float value
57,621
public function Compare ( $ number , $ scale = false ) { if ( ! is_numeric ( $ number ) ) { if ( ! $ number instanceof DecimalValue && ! $ number instanceof Integer ) { return false ; } $ number = $ number -> getValue ( ) ; } if ( $ scale === false ) { $ scale = max ( $ this -> getScale ( ) , $ this -> scale ( $ number...
Compares this number with another number
57,622
private function normalize ( $ number = null ) { if ( is_null ( $ number ) ) $ number = & $ this -> _value ; if ( $ this -> _value == "-0" ) $ this -> _value = "0" ; if ( strpos ( $ this -> _value , '.' ) === false ) return ; $ number = trim ( $ number ) ; $ number = rtrim ( $ number , '0' ) ; $ number = rtrim ( $ numb...
Remove spaces and any trailing zeros
57,623
public function getIsDecimal ( $ number = false ) { return strpos ( $ number === false ? $ this -> _value : $ number , "." ) !== false && trim ( substr ( $ number === false ? $ this -> _value : $ number , strpos ( $ number === false ? $ this -> _value : $ number , "." ) + 1 ) , "0" ) ; }
True if the number has a fractional part and it is not zero
57,624
public function getCeil ( ) { if ( $ this -> getIsDecimal ( ) === false ) { return $ this ; } if ( $ this -> getIsNegative ( ) === true ) { return new DecimalValue ( bcadd ( $ this -> _value , '0' , 0 ) ) ; } return new DecimalValue ( bcadd ( $ this -> _value , '1' , 0 ) ) ; }
Get the ceiling value of the decimal number
57,625
public function getFloor ( $ scale = false ) { if ( $ this -> getIsDecimal ( ) === false ) { return $ this ; } if ( $ this -> getIsNegative ( ) === true ) { return new DecimalValue ( bcadd ( $ this -> _value , '-1' , 0 ) ) ; } return new DecimalValue ( bcadd ( $ this -> _value , '0' , 0 ) ) ; }
Get the number that is one
57,626
private function roundDigit ( $ scale , $ mode = PHP_ROUND_HALF_UP ) { if ( $ this -> getIsCloserToNext ( $ scale , $ mode ) ) { return bcadd ( $ this -> _value , $ this -> getIsNegative ( ) ? - 1 : 1 , 0 ) ; } return bcadd ( $ this -> _value , '0' , 0 ) ; }
Round the value to the required precision and using the required mode
57,627
public function getIntegerPart ( ) { if ( ! $ this -> getIsDecimal ( ) ) return $ this -> _value ; return substr ( $ this -> _value , 0 , strpos ( $ this -> _value , "." ) ) ; }
Return the part of the number before the decimal point Does not taken into account the size of any fraction .
57,628
public function getDecimalIsHalf ( $ scale = false ) { if ( ! $ this -> getIsDecimal ( ) ) { return false ; } if ( $ scale === false ) $ scale = $ this -> scale ( $ this -> _value ) ; if ( $ scale < 0 ) $ scale = $ scale = 0 ; $ decimalPart = $ this -> getDecimalPart ( ) ; if ( $ scale >= strlen ( $ decimalPart ) ) ret...
Test to see if the digit at scale + 1 is a 5
57,629
public function getIsDecimalEven ( $ precision = false ) { if ( ! $ this -> getIsDecimal ( ) ) { return false ; } if ( $ precision === false ) $ precision = $ this -> scale ( $ this -> _value ) ; if ( $ precision < 0 ) $ precision = $ precision = 0 ; $ decimalPart = $ this -> getDecimalPart ( ) ; if ( $ precision >= st...
Returns true if the digit at the required level of precision is even
57,630
public function getIsCloserToNext ( $ precision = false , $ mode = PHP_ROUND_HALF_UP ) { if ( ! $ this -> getIsDecimal ( ) ) { return false ; } if ( $ precision === false ) $ precision = $ this -> scale ( $ this -> _value ) ; if ( $ precision < 0 ) $ precision = $ precision = 0 ; $ decimalPart = $ this -> getDecimalPar...
Returns true if the number at the scale position in the decimal part of the number is closer to the next power .
57,631
private function dec2bin ( $ decimal ) { bcscale ( 0 ) ; $ binary = '' ; do { $ binary = bcmod ( $ decimal , '2' ) . $ binary ; $ decimal = bcdiv ( $ decimal , '2' ) ; } while ( bccomp ( $ decimal , '0' ) ) ; return ( $ binary ) ; }
Create a binary representation of the current value
57,632
public function getIterator ( ) { if ( is_null ( $ this -> _iterator ) ) { $ this -> _iterator = new Iterator ( $ this -> _items ) ; } return $ this -> _iterator ; }
return a iterator
57,633
public function remove ( $ element ) { $ index = $ this -> indexOf ( $ element ) ; if ( $ index !== false ) { unset ( $ this -> _items [ $ index ] ) ; $ this -> _items = array_values ( $ this -> _items ) ; $ this -> _iterator = null ; return true ; } return false ; }
remove a specified element from the collection
57,634
public function clean ( $ input ) { if ( is_bool ( $ input ) or is_int ( $ input ) or is_float ( $ input ) or $ this -> parent -> isCleaned ( $ input ) ) { return $ input ; } if ( is_string ( $ input ) ) { $ input = $ this -> cleanString ( $ input ) ; } elseif ( is_array ( $ input ) or ( $ input instanceof \ Iterator a...
Cleans string object or array
57,635
protected function cleanArray ( $ input ) { if ( is_object ( $ input ) ) { $ this -> parent -> isClean ( $ input ) ; } foreach ( $ input as $ k => $ v ) { $ input [ $ k ] = $ this -> clean ( $ v ) ; } return $ input ; }
cleanArray base method
57,636
protected function cleanObject ( $ input ) { $ this -> parent -> isClean ( $ input ) ; foreach ( $ value as $ k => $ v ) { $ value -> { $ k } = $ this -> clean ( $ v ) ; } return $ input ; }
cleanObject base method . Not defined as abstract become some filters might not implement cleaning objects
57,637
public function complete ( ) { $ chain = $ this -> chain ; $ this -> chaining = false ; $ this -> chain = null ; return $ chain ; }
Complete a chain and return it s result .
57,638
public function update ( $ value ) { $ this -> validate ( $ value ) ; if ( $ this -> chaining ) { $ this -> chain = $ value ; } else { $ this -> current = $ value ; } return $ this ; }
Update a value .
57,639
public function reset ( ) { $ this -> current = $ this -> original ; $ this -> chaining = false ; $ this -> chain = null ; return $ this ; }
Reset the variable back to it s original value .
57,640
public function validate ( $ value ) { if ( ! in_array ( gettype ( $ value ) , $ this -> types ) ) { throw new Exception ( 'Type of value "' . gettype ( $ value ) . "' is not compatible with " . get_class ( $ this ) ) ; } }
Validate a variables type to make sure our class can use it .
57,641
public function getLoaMap ( ) { $ loaMap = [ ] ; foreach ( $ this -> config as $ key => $ config ) { if ( array_key_exists ( 'loa' , $ config ) ) { $ loaMap [ $ key ] = $ config [ 'loa' ] ; } } return $ loaMap ; }
Flattens the config and returns key value pairs where the key is the SF type and the value is the LOA level
57,642
public function create ( $ name , $ path ) { $ path = $ this -> getPath ( $ name , $ path ) ; $ stub = $ this -> getStub ( 'model' ) ; $ this -> files -> put ( $ path , $ this -> parseStub ( $ stub , [ 'table' => $ this -> tableize ( $ name ) , 'class' => $ this -> classify ( $ name ) ] ) ) ; return $ path ; }
Create a new model at the given path .
57,643
public function get ( $ key ) { $ res = $ this -> _errors [ $ key ] ; if ( ! is_array ( $ res ) ) { return [ $ res ] ; } return $ res ; }
Gets a specific error .
57,644
public function first ( $ key ) { if ( $ this -> has ( $ key ) ) { $ err = $ this -> _errors [ $ key ] ; if ( is_array ( $ err ) ) { for ( $ i = 0 ; $ i < count ( $ err ) ; $ i ++ ) { if ( ! empty ( $ err [ $ i ] ) ) { return $ err [ $ i ] ; } } } else { return $ err ; } } return '' ; }
Gets the first message for a specific error .
57,645
public function add ( $ data ) { $ ea = ( array ) $ data ; foreach ( $ ea as $ key => $ value ) { if ( is_array ( $ value ) ) { foreach ( $ value as $ k => $ v ) { if ( is_null ( $ v ) ) { unset ( $ value [ $ k ] ) ; } } $ value = array_values ( $ value ) ; $ ea [ $ key ] = $ value ; } } $ this -> _errors = $ ea ; }
Adds all error data . Also clears out any null values .
57,646
private function resolveControllerAction ( BoxControllerInterface $ controller ) { $ currentAction = $ this -> routerHelper -> getCurrentAction ( ) ; if ( $ this -> routerHelper -> hasControllerAction ( $ controller , $ currentAction ) ) { return $ currentAction ; } return 'indexAction' ; }
Resolves action which can be used in controller method call
57,647
public function findPublishedItems ( array $ where , $ orderBy = null , $ limit = null ) { return $ this -> repository -> findBy ( array_merge ( $ where , [ 'published' => true ] ) , $ orderBy , $ limit ) ; }
Method which finds published items in the repository according to the where clause
57,648
public function TemplateFile ( ) { if ( ! $ this -> AllowCustomTemplates ( ) || ! $ this -> content || ! $ this -> content -> GetTemplate ( ) ) { return $ this -> BuiltInTemplateFile ( ) ; } $ file = Path :: Combine ( PathUtil :: ModuleCustomTemplatesFolder ( $ this ) , $ this -> content -> GetTemplate ( ) ) ; return P...
The template file
57,649
public function SetTreeItem ( IContentTreeProvider $ tree , $ item ) { $ this -> tree = $ tree ; $ this -> item = $ item ; $ this -> content = $ this -> tree -> ContentByItem ( $ item ) ; }
Sets tree and tree item
57,650
public function BackendName ( ) { if ( $ this -> ContentForm ( ) ) { $ this -> ContentForm ( ) -> ReadTranslations ( ) ; } return Trans ( $ this -> MyBundle ( ) . '.' . $ this -> MyName ( ) . '.BackendName' ) ; }
Gets a display name for backend issues can be overridden
57,651
protected function BeforeInit ( ) { $ cacheFile = PathUtil :: ContentCacheFile ( $ this ) ; $ this -> fileCacher = new FileCacher ( $ cacheFile , $ this -> content -> GetCacheLifetime ( ) ) ; if ( $ this -> fileCacher -> MustUseCache ( ) ) { $ this -> output = $ this -> fileCacher -> GetFromCache ( ) ; return true ; } ...
Gets cache content if necessary
57,652
protected function AfterGather ( ) { if ( $ this -> fileCacher -> MustStoreToCache ( ) ) { $ this -> fileCacher -> StoreToCache ( $ this -> output ) ; } parent :: AfterGather ( ) ; }
Stores to cache if necessary
57,653
public function addAttribute ( Attribute $ attribute ) : Attributes { $ this -> getItems ( ) ; $ this -> attributes [ $ attribute -> getName ( ) ] = $ attribute ; return $ this ; }
Add attribute to collection
57,654
public static function log ( $ level , $ message , array $ context = [ ] ) { return static :: __do ( __FUNCTION__ , args_with_keys ( func_get_args ( ) , __CLASS__ , __FUNCTION__ ) ) ; }
Logging a message to the logs .
57,655
protected function createAlexaRequest ( $ request ) { $ this -> voiceInterface = 'Alexa' ; $ this -> alexaRequest = new AlexaRequest ( $ request -> getBody ( ) -> getContents ( ) , $ this -> askApplicationIds , $ request -> getHeaderLine ( 'Signaturecertchainurl' ) , $ request -> getHeaderLine ( 'Signature' ) , $ this ...
Create Alexa Request from Slim Request
57,656
public function dump ( array $ options = array ( ) ) { foreach ( array ( 'graph' , 'node' , 'edge' , 'node.instance' , 'node.definition' , 'node.missing' ) as $ key ) { if ( isset ( $ options [ $ key ] ) ) { $ this -> options [ $ key ] = array_merge ( $ this -> options [ $ key ] , $ options [ $ key ] ) ; } } $ this -> ...
Dumps the service container as a graphviz graph .
57,657
private function startDot ( ) { return sprintf ( "digraph sc {\n %s\n node [%s];\n edge [%s];\n\n" , $ this -> addOptions ( $ this -> options [ 'graph' ] ) , $ this -> addOptions ( $ this -> options [ 'node' ] ) , $ this -> addOptions ( $ this -> options [ 'edge' ] ) ) ; }
Returns the start dot .
57,658
public function cmdStatusStatus ( ) { $ result = $ this -> report -> getStatus ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableStatus ( $ result ) ; $ this -> output ( ) ; }
Callback for status command
57,659
public function find ( $ id ) { return $ this -> getQueryBuilder ( ) -> andWhere ( $ this -> getAlias ( ) . '.id = ' . intval ( $ id ) ) -> getQuery ( ) -> getOneOrNullResult ( ) ; }
Finds the resource by his ID .
57,660
public function findBy ( array $ criteria , array $ sorting = null , $ limit = null , $ offset = null ) { $ queryBuilder = $ this -> getCollectionQueryBuilder ( ) ; $ this -> applyCriteria ( $ queryBuilder , $ criteria ) ; $ this -> applySorting ( $ queryBuilder , ( array ) $ sorting ) ; if ( null !== $ limit ) { $ que...
Finds resources by criteria sorting limit and offset .
57,661
public function findRandomOneBy ( array $ criteria ) { $ queryBuilder = $ this -> getQueryBuilder ( ) ; $ this -> applyCriteria ( $ queryBuilder , $ criteria ) ; return $ queryBuilder -> addSelect ( 'RAND() as HIDDEN rand' ) -> orderBy ( 'rand' ) -> setMaxResults ( 1 ) -> getQuery ( ) -> getOneOrNullResult ( ) ; }
Finds a random resource by criteria .
57,662
public function findRandomBy ( array $ criteria , $ limit ) { $ limit = intval ( $ limit ) ; if ( $ limit <= 1 ) { throw new \ InvalidArgumentException ( 'Please use `findRandomOneBy()` for single result.' ) ; } $ queryBuilder = $ this -> getCollectionQueryBuilder ( ) ; $ this -> applyCriteria ( $ queryBuilder , $ crit...
Finds random resource by criteria and limit .
57,663
public function createPager ( array $ criteria = [ ] , array $ sorting = [ ] ) { $ queryBuilder = $ this -> getCollectionQueryBuilder ( ) ; $ this -> applyCriteria ( $ queryBuilder , $ criteria ) ; $ this -> applySorting ( $ queryBuilder , $ sorting ) ; return $ this -> getPager ( $ queryBuilder ) ; }
Creates a pager .
57,664
protected function applyCriteria ( QueryBuilder $ queryBuilder , array $ criteria = [ ] ) { foreach ( $ criteria as $ property => $ value ) { $ name = $ this -> getPropertyName ( $ property ) ; if ( null === $ value ) { $ queryBuilder -> andWhere ( $ queryBuilder -> expr ( ) -> isNull ( $ name ) ) ; } elseif ( is_array...
Applies the criteria to the query builder .
57,665
public function getCachePrefix ( ) { if ( $ this -> cachePrefix ) { return $ this -> cachePrefix ; } $ class = $ this -> getClassName ( ) ; if ( ! in_array ( TaggedEntityInterface :: class , class_implements ( $ class ) ) ) { throw new \ RuntimeException ( sprintf ( 'The entity %s does not implements %s, query should n...
Returns the cache prefix .
57,666
public function create ( $ adapterType , array $ config ) { if ( ! array_key_exists ( $ adapterType , $ this -> adapters ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Cache Adapter\'s key %s does not exist' , $ adapterType ) ) ; } if ( ! isset ( $ config [ $ adapterType ] ) ) { throw new InvalidConfigurationE...
Create an adapter
57,667
protected function _quoteRegex ( $ string , $ delimiter = null ) { $ string = $ this -> _normalizeString ( $ string ) ; $ delimiter = is_null ( $ delimiter ) ? null : $ this -> _normalizeString ( $ delimiter ) ; return preg_quote ( $ string , $ delimiter ) ; }
Escapes special characters in a string such that it is interpreted literally by a PCRE parser .
57,668
protected function getValueFromDefinition ( $ key ) { return ( isset ( $ this -> definition ) && ! empty ( $ this -> definition [ $ key ] ) ) ? $ this -> definition [ $ key ] : false ; }
This function returns the value of the key from the column definitions .
57,669
public function serialize ( ) { return serialize ( [ 'key' => $ this -> key , 'value' => $ this -> value , 'expires' => $ this -> expires , 'hit' => $ this -> hit ] ) ; }
Serialize the item . Required for storing in the containing cache
57,670
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
57,671
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 .
57,672
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 .
57,673
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 .
57,674
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 .
57,675
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
57,676
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
57,677
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 .
57,678
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
57,679
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
57,680
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
57,681
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
57,682
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
57,683
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 .
57,684
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
57,685
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
57,686
public function setText ( $ content , $ charset = 'utf-8' ) { $ this -> text = $ content ; $ this -> textCharset = $ charset ; return $ this ; }
Set text content
57,687
public function addBcc ( $ bcc ) { $ this -> bcc = ( ! empty ( $ this -> bcc ) ) ? $ this -> bcc . ',' . $ bcc : $ bcc ; return $ this ; }
Adds a best carbon copy
57,688
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 .
57,689
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 .
57,690
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 .
57,691
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 .
57,692
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 .
57,693
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
57,694
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
57,695
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
57,696
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
57,697
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
57,698
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
57,699
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