idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
232,400
protected function determineHeaderTypeName ( callable $ callback ) { if ( is_array ( $ callback ) ) { $ ref = new \ ReflectionMethod ( is_object ( $ callback [ 0 ] ) ? get_class ( $ callback [ 0 ] ) : $ callback [ 0 ] , $ callback [ 1 ] ) ; } elseif ( is_object ( $ callback ) && ! $ callback instanceof \ Closure ) { $ ...
Extract meta info of the first argument to the given callback and determine an HTTP header implementation to be used .
232,401
public function setEntity ( $ entity , $ prepare = true ) { if ( $ entity instanceof EntityInterface ) { $ this -> entity = $ entity ; } elseif ( is_resource ( $ entity ) || $ entity instanceof StreamInterface ) { $ this -> entity = new StreamEntity ( $ entity ) ; } elseif ( ( is_array ( $ entity ) || is_object ( $ ent...
Convert the given argument into an HTTP entity and put it in the nessage .
232,402
private function resolveClass ( $ object ) { if ( ! $ object instanceof Proxy ) { return get_class ( $ object ) ; } return $ this -> em -> getClassMetadata ( get_class ( $ object ) ) -> getReflectionClass ( ) -> getName ( ) ; }
Figure out the real class for this object .
232,403
public function cmdUninstallModule ( ) { $ result = $ this -> module_model -> uninstall ( $ this -> getParam ( 0 ) ) ; if ( $ result !== true ) { $ this -> errorAndExit ( $ result ) ; } $ this -> output ( ) ; }
Callback for module - uninstall command
232,404
public function cmdInstallModule ( ) { $ result = $ this -> module_model -> install ( $ this -> getParam ( 0 ) ) ; if ( $ result !== true ) { $ this -> errorAndExit ( $ result ) ; } $ this -> output ( ) ; }
Callback for module - install command
232,405
public function cmdOffModule ( ) { $ id = $ this -> getParam ( 0 ) ; if ( empty ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ result = $ this -> module_model -> disable ( $ id ) ; if ( $ result !== true ) { $ this -> errorAndExit ( $ result ) ; } $ this -> output ( ) ; }
Callback for module - off command
232,406
public function cmdOnModule ( ) { $ id = $ this -> getParam ( 0 ) ; if ( empty ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ result = $ this -> module_model -> enable ( $ id ) ; if ( $ result !== true ) { $ this -> errorAndExit ( $ result ) ; } $ this -> output ( ) ; }
Callback for module - on command
232,407
public function cmdGetModule ( ) { $ result = $ this -> getListModule ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableModule ( $ result ) ; $ this -> output ( ) ; }
Callback for module - get command
232,408
public function dispatch ( $ ignoreErrors = true , $ timeout = null ) { if ( ! isset ( $ this -> headers ) ) { $ this -> headers = array ( ) ; } if ( ! isset ( $ this -> headers [ "Content-Type" ] ) ) $ this -> headers [ "Content-Type" ] = "application/json" ; if ( $ this -> authUsername && $ this -> authPassword ) { $...
Dispatch the request and collect the result .
232,409
public function getNamespaceMappings ( ) { $ dom = ( new XmlDocumentBuilder ( ) ) -> buildDocument ( $ this ) ; $ xpath = new \ DOMXPath ( $ dom ) ; $ namespaces = [ ] ; foreach ( $ xpath -> query ( 'namespace::*' , $ dom -> documentElement ) as $ result ) { $ namespaces [ ( string ) $ result -> prefix ] = ( string ) $...
Get a map of namespaces prefix - URI mappings of the current node prefixes are keys .
232,410
protected function _make ( $ config = null ) { $ productClassname = $ this -> _normalizeString ( $ this -> _getProductClassname ( ) ) ; if ( ! $ this -> _classExists ( $ productClassname ) ) { throw $ this -> _createOutOfRangeException ( $ this -> __ ( 'Class "%1$s" does not exist' , [ $ productClassname ] ) , null , n...
Creates a new instance of a placeholder template .
232,411
public function apply ( ImageInterface $ image ) { switch ( $ this -> orientation ) { case 2 : $ image -> flipHorizontally ( ) ; break ; case 3 : $ image -> rotate ( 180 ) ; break ; case 4 : $ image -> flipVertically ( ) ; break ; case 5 : $ image -> rotate ( 90 ) -> flipHorizontally ( ) ; break ; case 6 : $ image -> r...
Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance
232,412
private function getFieldOutputNumeric ( $ tblSrc , $ value , $ iar = [ ] ) { if ( $ value [ 'EXTRA' ] == 'auto_increment' ) { return $ this -> getFieldOutputNumericAI ( $ value , $ iar ) ; } $ fkArray = $ this -> getForeignKeysToArray ( $ this -> advCache [ 'workingDatabase' ] , $ tblSrc , $ value [ 'COLUMN_NAME' ] ) ...
Returns a Numeric field 2 use in a form
232,413
private function getFieldOutputNumericAI ( $ value , $ iar = [ ] ) { if ( $ this -> getFieldValue ( $ value ) == '' ) { $ spF = [ 'id' => $ value [ 'COLUMN_NAME' ] , 'style' => 'font-style:italic;' ] ; return $ this -> setStringIntoTag ( 'auto-numar' , 'span' , $ spF ) ; } $ inAdtnl = [ 'type' => 'hidden' , 'name' => $...
Handles creation of Auto Increment numeric field type output
232,414
private function getFieldOutputNumericNonFK ( $ fkArray , $ value , $ iar = [ ] ) { $ query = $ this -> sQueryGenericSelectKeyValue ( [ '`' . $ value [ 'COLUMN_NAME' ] . '`' , $ fkArray [ $ value [ 'COLUMN_NAME' ] ] [ 2 ] , $ fkArray [ $ value [ 'COLUMN_NAME' ] ] [ 0 ] , ] ) ; $ selectOptions = $ this -> setMySQLquery2...
Builds field output type for numeric types if not FK
232,415
private function getFieldOutputTextPrerequisites ( $ tbl , $ value ) { $ foreignKeysArray = [ ] ; if ( ( $ tbl != 'user_rights' ) && ( $ value [ 'COLUMN_NAME' ] != 'eid' ) ) { $ database = $ this -> advCache [ 'workingDatabase' ] ; if ( strpos ( $ tbl , '`.`' ) ) { $ database = substr ( $ tbl , 0 , strpos ( $ tbl , '`....
Prepares the text output fields
232,416
private function getForeignKeysToArray ( $ database , $ tblName , $ oCol = '' ) { if ( ! isset ( $ this -> advCache [ 'tableFKs' ] [ $ database ] [ $ tblName ] ) ) { $ this -> setTableForeignKeyCache ( $ database , $ this -> fixTableSource ( $ tblName ) ) ; } $ aRt = [ ] ; if ( isset ( $ this -> advCache [ 'tableFKs' ]...
Returns an array with fields referenced by a Foreign key
232,417
protected function setTableCache ( $ tblSrc ) { $ dat = $ this -> establishDatabaseAndTable ( $ tblSrc ) ; if ( ! isset ( $ this -> advCache [ 'tableStructureCache' ] [ $ dat [ 0 ] ] [ $ dat [ 1 ] ] ) ) { $ this -> advCache [ 'workingDatabase' ] = $ dat [ 0 ] ; $ this -> advCache [ 'tableStructureCache' ] [ $ dat [ 0 ]...
create a Cache for given table to use it in many places
232,418
private function content ( ) { $ handle = fopen ( $ this -> _config , 'r' ) ; $ content = @ json_decode ( stream_get_contents ( $ handle ) ) ; return $ content ; }
Gets the file session s content .
232,419
private function write ( $ content ) { $ handle = fopen ( $ this -> _config , 'w+' ) ; fwrite ( $ handle , @ json_encode ( $ content ) ) ; fclose ( $ handle ) ; }
Writes session info to file session .
232,420
public static function factory ( array $ subfield ) { if ( ! array_key_exists ( 'code' , $ subfield ) ) { throw new InvalidArgumentException ( "Missing 'code' index in subfield array" ) ; } if ( ! array_key_exists ( 'value' , $ subfield ) ) { throw new InvalidArgumentException ( "Missing 'value' index in subfield array...
Return a new subfield based on its array representation .
232,421
public function registerAlias ( $ alias , $ className ) { $ this -> _aliases [ $ alias ] = $ this -> resolveClassName ( $ className ) ; return $ this ; }
Registers a new alias with a specific FQCN
232,422
public function registerAliases ( array $ aliases ) { foreach ( $ aliases as $ alias => $ className ) $ this -> registerAlias ( $ alias , $ className ) ; return $ this ; }
Registers an array of aliases . The aliases should be the keys the FQCNs the values of the associative array
232,423
public function resolveClassName ( $ className ) { if ( isset ( $ this -> _aliases [ $ className ] ) ) $ className = $ this -> _aliases [ $ className ] ; return $ className ; }
Resolves a a class - name or an alias to a FQCN
232,424
public function createInstance ( $ className , array $ args = null ) { $ args = $ args ? $ args : [ ] ; $ className = $ this -> resolveClassName ( $ className ) ; if ( ! class_exists ( $ className ) || ( $ this -> _baseClassName && ! is_subclass_of ( $ className , $ this -> _baseClassName ) ) ) throw new FactoryExcepti...
Creates a new instance of a class based on a class name or alias given .
232,425
public function tagsByName ( $ name ) { $ tags = array ( ) ; foreach ( $ this -> tags ( ) as $ tag ) { if ( $ name === $ tag -> name ( ) ) { $ tags [ ] = $ tag ; } } return $ tags ; }
Get all the tags of this block with a specific tag name .
232,426
public static function bytesTo ( $ size , $ precision = 0 ) { $ sizes = array ( 'YB' , 'ZB' , 'EB' , 'PB' , 'TB' , 'GB' , 'MB' , 'KB' , 'B' ) ; $ total = count ( $ sizes ) ; while ( $ total -- && $ size >= 1024 ) { $ size /= 1024 ; } return static :: precision ( $ size , $ precision ) . $ sizes [ $ total ] ; }
Convert a numerical value to the readable string notated equivalent .
232,427
public static function convert ( $ no , $ fromBase , $ toBase ) { if ( $ fromBase == $ toBase ) { return $ no ; } return base_convert ( $ no , $ fromBase , $ toBase ) ; }
Convert a number from one base to another .
232,428
public static function currency ( $ number , array $ options = array ( ) ) { $ defaults = array ( 'thousands' => ',' , 'decimals' => '.' , 'places' => 2 , 'code' => 'USD #' , 'dollar' => '$#' , 'cents' => '#¢' , 'use' => 'dollar' , 'negative' => '(#)' ) ; $ options = $ options + $ defaults ; $ amount = number_form...
Convert a number to it s currency equivalent respecting locale . Allow for overrides through an options array .
232,429
public static function percentage ( $ number , $ options = array ( ) ) { if ( ! is_array ( $ options ) ) { $ options = array ( 'places' => $ options ) ; } $ options = $ options + array ( 'thousands' => ',' , 'decimals' => '.' , 'places' => 2 ) ; return number_format ( static :: precision ( $ number , $ options [ 'place...
Convert a number to a percentage string with decimal and comma separations .
232,430
protected function getLocaleCurrency ( Request $ request ) { $ currentLocale = $ request -> getLocale ( ) ; $ locale = $ this -> container -> get ( 'locale.repository' ) -> findOneBy ( [ 'code' => $ currentLocale ] ) ; if ( null !== $ locale && $ locale -> getCurrency ( ) instanceof Currency ) { return $ locale -> getC...
Returns the currency code for active locale
232,431
public function asString ( ) { $ display = function ( $ lines , $ length , $ loop = 0 ) use ( & $ display ) { $ output = '' ; foreach ( $ lines as $ line ) { $ line = is_a ( $ line , 'Deflection\Element\AbstractElement' ) ? $ line -> getElement ( ) : $ line ; if ( is_array ( $ line ) ) { $ output .= $ display ( $ line ...
Returns class definition as a string
232,432
private function streamView ( $ response ) { if ( Response :: isError ( $ response ) && ! $ response -> getBody ( ) instanceof ViewStream ) { $ response = $ this -> setErrorView ( $ response ) ; return $ response ; } return $ response ; }
fill up contents for VIEW and ERROR responses .
232,433
private function setErrorView ( $ response ) { if ( Response :: isServerError ( $ response ) && $ this -> logger ) { $ this -> logger -> error ( 'received a server error response: ' . $ response -> getStatusCode ( ) ) ; } $ stream = $ this -> error -> getStream ( $ response -> getStatusCode ( ) , $ response -> getData ...
render error pages .
232,434
public function call ( $ resource , $ params = array ( ) , $ method = 'GET' ) { if ( ! empty ( $ params ) && is_array ( $ params ) ) { $ queryString = http_build_query ( $ params ) ; } else { $ queryString = '' ; } $ requestUrl = self :: API_URL . $ resource . ( ( strtolower ( $ method ) == 'get' ) ? '?' . $ queryStrin...
Make an api request
232,435
public function webform ( $ action , $ params , $ friends = array ( ) ) { $ url = self :: WEBFORM_URL . $ action ; $ header = sprintf ( "Authorization: Basic %s\r\n" , base64_encode ( $ this -> getAuthenticationString ( ) ) ) ; $ header .= "Content-type: application/x-www-form-urlencoded\r\n" ; $ params = http_build_qu...
Make a request to the Web Form API .
232,436
public function addClass ( string $ class ) : Tag { if ( ! isset ( $ this -> attributes [ 'class' ] ) ) { $ this -> attributes [ 'class' ] = $ class ; } else { $ this -> attributes [ 'class' ] .= " $class" ; } return $ this ; }
Convenience method to add a class to a tag .
232,437
static public function start ( $ name ) { if ( ! ObjectManager :: getInstance ( ) -> get ( Config :: class ) -> getValue ( 'profile' ) ) { return ; } if ( ! isset ( self :: $ profileNames [ $ name ] ) ) { self :: $ profileNames [ $ name ] = 0 ; } $ realName = $ name . '_' . self :: $ profileNames [ $ name ] ++ ; array_...
Set start point for a new profile
232,438
static public function end ( $ name ) { if ( ! ObjectManager :: getInstance ( ) -> get ( Config :: class ) -> getValue ( 'profile' ) ) { return ; } if ( $ name != self :: getName ( self :: $ currentProfileNames [ count ( self :: $ currentProfileNames ) - 1 ] ) ) { throw new \ Exception ( sprintf ( 'Not an expected end ...
Set end point for an exist profile
232,439
public function buildMenu ( ItemInterface $ node , ItemEntity $ item ) { if ( $ item -> getPath ( ) && $ this -> fs -> exists ( $ item -> getPath ( ) ) ) { $ node -> addChild ( 'Fill folder' , [ 'route' => 'item_folder_filler_fill' , 'routeParameters' => [ 'id' => $ item -> getId ( ) , 'name' => $ item -> getUrlName ( ...
Build menu for plugin
232,440
protected function getCover ( ItemEntity $ item ) { $ from = $ this -> root . $ item -> getDownloadPath ( ) . '/' . $ item -> getCover ( ) ; if ( ! $ this -> fs -> exists ( $ from ) ) { return '' ; } $ target = $ item -> getPath ( ) . '/' ; $ filename = self :: COVER_FILENAME . '.' . pathinfo ( $ item -> getCover ( ) ,...
Get cover filename
232,441
protected function getInfo ( ItemEntity $ item ) { $ filename = self :: INFO_FILENAME . '.html' ; if ( is_file ( $ item -> getPath ( ) ) ) { return dirname ( $ item -> getPath ( ) ) . pathinfo ( $ item -> getPath ( ) , PATHINFO_FILENAME ) . '-' . $ filename ; } else { return $ item -> getPath ( ) . '/' . $ filename ; }...
Get info filename
232,442
private function isEventSupported ( Event $ event ) : bool { $ supported = false ; foreach ( $ this -> getSupportedEventTypes ( ) as $ supportedEventType ) { if ( \ is_a ( $ event , $ supportedEventType ) ) { $ supported = true ; break ; } } return $ supported ; }
Is event supported .
232,443
public function dateTime ( $ value , $ type = NULL ) { $ apend = "" ; switch ( $ type ) { case 'time' : $ apend = 'time' ; break ; case 'timestamp' : $ apend = 'timestamp' ; break ; case 'date' : $ apend = 'date' ; break ; case 'datetime' : $ apend = 'datetime' ; break ; case 'year' : $ apend = 'year(4)' ; break ; defa...
dateTime description ]
232,444
public function value ( $ value = null ) { if ( null !== $ value && false === is_string ( $ value ) && false === is_numeric ( $ value ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string or number, "%s" given' , __METHOD__ , gettype ( $ value ) ) , E_USER_ERROR ) ; } $ this -> va...
Set a new value for input
232,445
public function name ( $ name = null ) { if ( null !== $ name && false === is_string ( $ name ) && false === is_numeric ( $ name ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string or number, "%s" given' , __METHOD__ , gettype ( $ name ) ) , E_USER_ERROR ) ; } $ this -> name = $...
Set a new name for input
232,446
public function attributes ( $ attributes ) { if ( false === is_array ( $ attributes ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type array, "%s" given' , __METHOD__ , gettype ( $ attributes ) ) , E_USER_ERROR ) ; } $ this -> attributes = array_merge ( $ this -> attributes , $ attri...
Set new attributes for input
232,447
public function filled ( $ filled ) { if ( false === is_bool ( $ filled ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type boolean, "%s" given' , __METHOD__ , gettype ( $ filled ) ) , E_USER_ERROR ) ; } $ this -> filled = $ filled ; return $ this ; }
Set if input should be automaticly filled or not
232,448
public function onerror ( $ attributes ) { if ( false === is_array ( $ attributes ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type array, "%s" given' , __METHOD__ , gettype ( $ attributes ) ) , E_USER_ERROR ) ; } if ( true === isset ( $ this -> attributes [ 'name' ] ) ) { $ helper =...
Merges the given attributes with the already existing attributes on error
232,449
private function fill ( ) { if ( true === $ this -> filled ) { if ( true === isset ( $ this -> attributes [ 'name' ] ) ) { if ( true === Request :: isPost ( ) ) { $ this -> attributes [ 'value' ] = Request :: fromPost ( $ this -> attributes [ 'name' ] ) ; } } } }
Sets the value if allowed
232,450
public function set ( $ key , $ value , $ params = array ( ) ) { $ expire = 0 ; $ path = null ; $ domain = null ; $ secure = false ; $ httponly = false ; if ( isset ( $ params [ 'expire' ] ) ) { $ expire = $ params [ 'expire' ] ; } if ( isset ( $ params [ 'path' ] ) ) { $ path = $ params [ 'path' ] ; } if ( isset ( $ p...
Set variable to storage
232,451
public function delete ( $ key ) { if ( isset ( $ _COOKIE [ $ key ] ) ) { unset ( $ _COOKIE [ $ key ] ) ; setcookie ( $ key , '' , time ( ) - 3600 ) ; } }
Remove variable from storage
232,452
public function getDataSource ( string $ source ) : Source { switch ( $ source ) { case 'form' : case 'forms' : return $ this -> getDataSources ( ) -> getFormsDataSource ( ) ; break ; case 'entry' : case 'entries' : return $ this -> getDataSources ( ) -> getEntryDataSource ( ) ; break ; case 'entryValue' : case 'entryV...
Get a form form entry or form entry value data source .
232,453
public static function instantiate ( $ className , array $ namedArguments ) { $ reflectionClass = new ReflectionClass ( $ className ) ; $ parameters = $ reflectionClass -> getConstructor ( ) -> getParameters ( ) ; $ positionalDefaultFilledArguments = array ( ) ; foreach ( $ parameters as $ parameter ) { if ( isset ( $ ...
Instantiate a class with named arguments .
232,454
public function create ( $ name , $ callback ) { $ this -> _name = $ name ; $ this -> _class = $ callback ( ) ; $ GLOBALS [ 'providers' ] [ $ this -> _name ] = $ this -> _class ; }
Creates the provider and registers the provider to the global area .
232,455
public function set ( $ id , $ data , $ lifeTime = 0 ) { if ( ! function_exists ( 'apc_store' ) ) { throw new ApcCacheException ( 'function [apc_store] not found !' ) ; } return apc_store ( $ id , $ data , $ lifeTime ) ; }
Set and store cache key with data content in cache key
232,456
protected function validateFilename ( $ filename , $ path ) { $ fileParts = explode ( '.' , $ filename ) ; if ( count ( $ fileParts ) > 1 ) { $ extension = end ( $ fileParts ) ; array_pop ( $ fileParts ) ; $ fileNameWithoutExtension = implode ( '-' , $ fileParts ) ; $ fileNameWithoutExtension = StringUtil :: slugify ( ...
Converts filename to lowercase remove non - ascii chars And adds - copy if the file already exists
232,457
public function pushData ( EntityInterface $ entity ) { if ( $ this -> isMany ( ) ) { $ this -> data [ ] = $ entity ; return $ this ; } $ this -> data = $ entity ; return $ this ; }
Applys the relationship data .
232,458
public function render ( ) { $ parse = true ; if ( $ this -> getFile ( ) -> exists ( ) ) { if ( $ this -> getFile ( ) -> entity ( ) -> getModificationTime ( ) >= @ filemtime ( $ this -> viewmodel -> getFile ( ) ) ) { $ parse = false ; } } if ( true === $ parse ) { $ this -> parse ( ) ; $ this -> write ( ) ; } return $ ...
Renders the view model
232,459
public function getFileName ( ) { if ( null === $ this -> filename && null !== $ this -> viewmodel ) { $ this -> filename = md5 ( $ this -> viewmodel -> getFile ( ) ) ; } return $ this -> filename ; }
Generates filename and returns it
232,460
public function getFile ( ) { if ( null === $ this -> file ) { $ file = $ this -> getFileName ( ) ; $ this -> file = new File ( $ this -> directory . $ file ) ; } return $ this -> file ; }
Create file object from current directory and file and returns it
232,461
private function parse ( ) { $ lines = file ( $ this -> viewmodel -> getFile ( ) ) ; $ this -> code = '' ; $ classes = [ 'MatchEcho' , 'MatchForeach' , 'MatchEndForeach' , 'MatchFor' , 'MatchEndFor' , 'MatchIf' , 'MatchIsset' , 'MatchNotIsset' , 'MatchEmpty' , 'MatchNotEmpty' , 'MatchElseIf' , 'MatchElse' , 'MatchEndIf...
Convert template file to string
232,462
public static function partial ( $ template , array $ vars = array ( ) ) { $ template = new Template ( $ template , null , $ vars ) ; return trim ( $ template -> render ( ) ) ; }
Include partial .
232,463
public static function setPathCompiled ( $ pathCompiled = '/tmp/Eureka/tpl' ) { $ pathCompiled = rtrim ( $ pathCompiled , '/' ) . '/' ; if ( ! file_exists ( $ pathCompiled ) || ! is_dir ( $ pathCompiled ) ) { if ( ! mkdir ( $ pathCompiled , 0755 , true ) ) { throw new \ Exception ( 'Cannot create directory for template...
Set path for compiled templates .
232,464
protected function __update ( ) { parent :: __update ( ) ; if ( $ this -> count ( ) && $ this -> attribute instanceof DOMAttr ) { $ this -> attribute -> value = ( string ) $ this ; } }
Updates the HTML attribute that DOMTokenList represents
232,465
public function __toAttribute ( ) { if ( $ this -> count ( ) ) { $ attr = null ; if ( is_string ( $ this -> attribute ) ) { $ attr = $ this -> attribute ; } elseif ( $ this -> attribute instanceof DOMAttr ) { $ attr = $ this -> attribute -> name ; } if ( $ attr ) { $ values = htmlspecialchars ( ( string ) $ this , ENT_...
Retrieves the HTML attribute and concatenated list of the tokens .
232,466
public function toSQL ( Parameters $ params , bool $ inner_clause ) { $ drv = $ params -> getDriver ( ) ; $ source = array ( ) ; if ( $ table = $ this -> getTable ( ) ) $ source [ ] = "FROM " . $ drv -> toSQL ( $ params , $ table ) ; foreach ( $ this -> getJoins ( ) as $ join ) $ source [ ] = $ drv -> toSQL ( $ params ...
Write a select query as SQL query syntax
232,467
protected function hasBasicAuth ( $ request ) : bool { if ( $ request -> headers -> has ( 'Authorization' ) && starts_with ( $ request -> header ( 'Authorization' ) , 'Basic ' ) ) { return true ; } return false ; }
Check if request has Basic Authentication header
232,468
public function generate ( GeneratorInterface $ generator ) { $ callback = function ( ) use ( $ generator ) { $ handler = Handler :: create ( $ generator ) ; $ handler -> generate ( ) ; } ; return $ callback ( ) ; }
Generates a document from given configuration using given generator .
232,469
public function parseYamlStaging ( $ yamlFile ) { $ container = ! ( property_exists ( get_called_class ( ) , 'container' ) ) ? $ this -> getContainer ( ) : $ this -> container ; $ capitalizer = $ container -> get ( 'rch_capistrano.capitalizer' ) ; $ params = Yaml :: parse ( file_get_contents ( $ yamlFile ) ) ; return $...
Read staging parameters from YAML staging file .
232,470
public function execute ( IDS_Report $ data ) { if ( ! isset ( $ _SERVER [ 'REQUEST_URI' ] ) ) { $ _SERVER [ 'REQUEST_URI' ] = substr ( $ _SERVER [ 'PHP_SELF' ] , 1 ) ; if ( isset ( $ _SERVER [ 'QUERY_STRING' ] ) && $ _SERVER [ 'QUERY_STRING' ] ) { $ _SERVER [ 'REQUEST_URI' ] .= '?' . $ _SERVER [ 'QUERY_STRING' ] ; } }...
Stores given data into the database
232,471
public function isWithin ( \ Coast \ Path $ parent ) { $ path = $ this -> _name ; $ parts = \ explode ( PATH_SEPARATOR , ( string ) $ parent ) ; foreach ( $ parts as $ part ) { if ( \ preg_match ( '/^' . \ preg_quote ( $ part , '/' ) . '/' , $ path ) ) { return true ; } } return false ; }
Check if path is within another
232,472
public function toAbsolute ( \ Coast \ Path $ base ) { if ( ! $ this -> isRelative ( ) || ! $ base -> isAbsolute ( ) ) { throw new \ Exception ( "Path '{$this}' is not relative or base path '{$base}' is not absolute" ) ; } $ source = explode ( '/' , ( string ) $ base ) ; $ target = explode ( '/' , $ this -> _name ) ; $...
Get absolute path from relative path .
232,473
public function toRelative ( \ Coast \ Path $ base ) { if ( ! $ this -> isAbsolute ( ) || ! $ base -> isAbsolute ( ) ) { throw new \ Exception ( "Source path '{$this}' is not absolute or base path '{$base}' is not absolute" ) ; } $ source = explode ( '/' , ( string ) $ base ) ; $ target = explode ( '/' , $ this -> _nam...
Get relative path from absolute path .
232,474
public function toReal ( ) { if ( ! $ this -> isAbsolute ( ) ) { throw new \ Exception ( "Path '{$this}' is not absolute" ) ; } $ target = explode ( '/' , $ this -> _name ) ; $ name = [ ] ; foreach ( $ target as $ part ) { if ( $ part == '..' ) { array_pop ( $ name ) ; } else if ( $ part != '.' ) { $ name [ ] = $ part ...
Reduce absolute path with relative parts to real path .
232,475
public function init ( ) { if ( $ this -> dataProvider === null ) { throw new InvalidConfigException ( 'The "dataProvider" property must be set.' ) ; } if ( $ this -> emptyText === null ) { $ this -> emptyText = Yii :: t ( 'yii' , 'No results found.' ) ; } if ( ! isset ( $ this -> options [ 'id' ] ) ) { $ this -> optio...
Initializes the view .
232,476
protected function buildConnectString ( $ driver , array $ arguments ) { $ options = array_map ( function ( $ key ) use ( $ arguments ) { return sprintf ( '%s=%s' , $ key , $ arguments [ $ key ] ) ; } , array_keys ( $ arguments ) ) ; return $ driver . ':' . implode ( ';' , $ options ) ; }
Build a connection string from the given arguments .
232,477
public function getAllElements ( $ elementType ) { $ iterator = new \ DirectoryIterator ( $ this -> getUserSubDirectory ( "{$elementType}s" ) ) ; $ allElements = [ ] ; foreach ( $ iterator as $ file ) { if ( $ file -> isDir ( ) || ( "twig" !== $ file -> getExtension ( ) ) ) { continue ; } $ reference = "@{$elementType}...
Returns a list of all elements
232,478
public function getListedElements ( $ elementType ) { $ allElements = $ this -> getAllElements ( $ elementType ) ; usort ( $ allElements , function ( Element $ element1 , Element $ element2 ) { return strnatcasecmp ( $ element1 -> getKey ( ) , $ element2 -> getKey ( ) ) ; } ) ; return array_filter ( $ allElements , fun...
Returns the listed elements
232,479
public function getElement ( $ key , $ elementType ) { $ elements = $ this -> getAllElements ( $ elementType ) ; return array_key_exists ( $ key , $ elements ) ? $ elements [ $ key ] : null ; }
Returns the preview by key
232,480
public function isFullPageElementType ( $ key ) { return array_key_exists ( $ key , $ this -> elementTypes ) ? $ this -> elementTypes [ $ key ] [ "isFullPage" ] : null ; }
Returns whether the given element type is full page
232,481
public static function __callstatic ( $ method , $ arguments ) { $ route = new Route ( ) ; if ( false === is_callable ( [ $ route , $ method ] ) ) { return trigger_error ( sprintf ( 'Call to undefined method %s::%s' , __CLASS__ , $ method ) , E_USER_ERROR ) ; } $ route = call_user_func_array ( [ $ route , $ method ] , ...
Creates a new route and calls the dynamic given method if exists
232,482
public static function setUrl ( $ url ) { if ( false === is_string ( $ url ) && false === $ url instanceof URLParser ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string or instance of sFire\\Utils\\URLParser, "%s" given' , __METHOD__ , gettype ( $ url ) ) , E_USER_ERROR ) ; } if (...
Set the current URL
232,483
public static function routeExists ( $ identifier , $ domain = null ) { if ( false === is_string ( $ identifier ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ identifier ) ) , E_USER_ERROR ) ; } if ( null !== $ domain && false === is_...
Check if a Route exists by identifier with optional domain
232,484
public static function domainExists ( $ domain ) { if ( false === is_string ( $ domain ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ domain ) ) , E_USER_ERROR ) ; } $ routes = static :: getRoutes ( ) ; foreach ( $ routes as $ route )...
Checks if a given domain exists
232,485
public static function getRoute ( $ identifier = null ) { if ( null !== $ identifier && false === is_string ( $ identifier ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ identifier ) ) , E_USER_ERROR ) ; } if ( null !== $ identifier )...
Gets the current route or a route based on identifier
232,486
public static function addGroup ( $ group ) { if ( false === is_array ( $ group ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type array, "%s" given' , __METHOD__ , gettype ( $ group ) ) , E_USER_ERROR ) ; } static :: $ group [ ] = $ group ; }
Add a new group element to the stack
232,487
public static function getGroup ( ) { $ attr = [ ] ; foreach ( static :: $ group as $ group ) { $ attr = static :: arrayRecursiveMerge ( $ attr , $ group ) ; } return $ attr ; }
Return all the groups as one merged array
232,488
public static function getErrorRoute ( $ type , $ index = 0 ) { if ( false === ( '-' . intval ( $ type ) == '-' . $ type ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type integer, "%s" given' , __METHOD__ , gettype ( $ type ) ) , E_USER_ERROR ) ; } if ( false === ( '-' . intval ( $ i...
Retrieve a route from the error route stack . Default the first on the stack or route with optional index
232,489
public static function addErrorRoute ( $ type , Route $ route , $ default = false ) { if ( false === ( '-' . intval ( $ type ) == '-' . $ type ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type integer, "%s" given' , __METHOD__ , gettype ( $ type ) ) , E_USER_ERROR ) ; } static :: $ e...
Adds a new error route to the error routes stack
232,490
public static function setRedirect ( $ bool ) { if ( null !== $ bool && false === is_bool ( $ bool ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type boolean, "%s" given' , __METHOD__ , gettype ( $ bool ) ) , E_USER_ERROR ) ; } static :: $ isRedirect = $ bool ; }
Set the redirect
232,491
private static function arrayRecursiveMerge ( $ array1 , $ array2 ) { if ( false === is_array ( $ array1 ) || false === is_array ( $ array2 ) ) { return $ array2 ; } foreach ( $ array2 as $ key => $ value ) { $ array1 [ $ key ] = static :: arrayRecursiveMerge ( @ $ array1 [ $ key ] , $ value ) ; } return $ array1 ; }
Recursive merge arrays
232,492
private static function request ( ) { if ( $ uri = Request :: getUri ( ) ) { $ url = '' ; $ host = null ; if ( ! ( $ scheme = Request :: getScheme ( ) ) ) { $ scheme = 'php' ; $ host = '127.0.0.1' ; Request :: setScheme ( $ scheme ) ; } $ url .= $ scheme . '://' ; if ( $ hostname = Request :: getHost ( ) ) { $ url .= $...
Try to add the request uri
232,493
private static function format ( ) { $ routes = static :: getRoutes ( ) ; foreach ( $ routes as $ identifier => $ route ) { $ url = preg_quote ( $ route -> getUrl ( ) , '/' ) ; if ( $ prefix = $ route -> getPrefix ( ) ) { $ url = $ prefix [ 'url' ] . $ url ; } if ( preg_match_all ( '#(\\\/)*\\\{([a-zA-Z0-9_.]+)(\\\\\?)...
Formats all the routes urls to a regex pattern that sFire understands to match the current url to the route url
232,494
public function getOutput ( String $ file = null ) : Array { $ file = ( $ file ) ? $ file : $ this -> _logFile ; if ( file_exists ( $ file ) ) { return file ( $ file ) ; } throw new \ RunTimeException ( "file not found!" ) ; }
end kill method
232,495
protected function setProperty ( string $ key , array $ data , & $ property , $ default = null ) : void { if ( isset ( $ data [ $ key ] ) ) { $ property = $ data [ $ key ] ; return ; } if ( $ default !== null ) { $ property = $ default ; } }
Checks the given key is set in the data array if so the given property is set with the value .
232,496
private function addCSRFTokenField ( ) { $ this -> nonceValue = $ this -> createNonce ( ) ; $ nonce = new FormField ( FormField :: TYPE_HIDDEN ) ; $ nonce -> setName ( 'nonce' ) -> setValue ( $ this -> createNonce ( ) ) -> setValidationCallback ( function ( $ value ) { if ( function_exists ( 'wp_verify_nonce' ) ) { if ...
Add CSRF token hidden input field
232,497
public function populateFields ( ) { if ( count ( $ this -> submittedData ) < 1 ) { return ; } array_map ( function ( FormField & $ field ) { if ( isset ( $ this -> submittedData [ $ field -> getName ( ) ] ) ) { $ raw = $ this -> submittedData [ $ field -> getName ( ) ] ; $ sanitized = $ field -> sanitize ( $ raw ) ; $...
populates form from POST after submission
232,498
public function addFields ( array $ fields ) { array_walk ( $ fields , function ( $ field , $ key ) { $ this -> addField ( $ key , $ field ) ; } ) ; }
Add fields to the form
232,499
public static function generateSalt ( $ length = 32 ) { $ salt = '' ; for ( $ i = 0 ; $ i < $ length ; ++ $ i ) $ salt .= chr ( rand ( 0 , 127 ) ) ; return $ salt ; }
Generates a random string which can be used to salt the password