idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
55,100
protected function _createProduct ( $ config , $ data ) { $ className = static :: PRODUCT_CLASS_NAME ; $ referenceContainer = $ this -> _getReferenceContainer ( $ config ) ; return new $ className ( $ data , $ referenceContainer ) ; }
Creates a new factory product .
55,101
protected function _getReferenceContainer ( $ config ) { try { $ container = $ this -> _containerHas ( $ config , static :: K_REFERENCE_CONTAINER ) ? $ this -> _containerGet ( $ config , static :: K_REFERENCE_CONTAINER ) : $ this -> _getContainer ( ) ; } catch ( RootException $ e ) { throw $ this -> _createRuntimeExcep...
Retrieves the reference container to create the child with .
55,102
public function insert ( $ model , $ onDuplicate = false ) { $ query = $ this -> insertQuery ( $ model , $ onDuplicate ) ; $ query -> execute ( ) ; return $ this -> getDB ( ) -> lastInsertID ( ) ; }
Inserts a Record into the database
55,103
public function update ( Record $ model ) { $ query = $ this -> updateQuery ( $ model ) ; if ( $ query ) { return $ query -> execute ( ) ; } return false ; }
Updates a Record s database entry
55,104
public function save ( Record $ model ) { $ pk = $ this -> getPrimaryKey ( ) ; if ( isset ( $ model -> { $ pk } ) ) { $ model -> update ( ) ; return $ model -> { $ pk } ; } else { $ previous = $ model -> exists ( ) ; if ( $ previous ) { $ data = $ model -> toArray ( ) ; if ( $ data ) { $ previous -> writeData ( $ model...
Saves a Record s database entry
55,105
public function addSeedBatch ( $ seedBatch ) { $ this -> seedBatches [ ] = $ seedBatch ; if ( method_exists ( get_class ( $ this ) , 'setProducer' ) ) { $ seedBatch -> setProducer ( $ this ) ; } return $ this ; }
Add seed batch .
55,106
public function fetchEntityFromCache ( EntityLoadEvent $ event ) { $ entity = $ event -> getEntity ( ) ; if ( false !== $ data = $ this -> cache -> get ( $ entity ) ) { $ entity -> setDataFromCache ( $ data ) ; $ entity -> setIsLoaded ( true ) ; $ this -> dispatcher -> dispatch ( 'cache.load' , new CacheEvent ( $ entit...
Load data from cache
55,107
public function decode ( $ fromjson ) { $ textfilter = $ this -> di -> get ( "textfilter" ) ; $ toparse = json_decode ( $ fromjson ) ; $ comt = $ textfilter -> parse ( $ toparse -> text , [ "yamlfrontmatter" , "shortcode" , "markdown" , "titlefromheader" ] ) ; $ comt = strip_tags ( $ comt -> text ) ; return $ comt ; }
Converts json - string back to variables
55,108
public function isSubmitted ( Request $ request ) { $ arguments = $ this -> method === "GET" ? $ request -> get : $ request -> post ; return $ this -> method === $ request -> method && $ arguments [ '_form_name' ] === $ this -> name ; }
Check if the form has been submitted
55,109
public function isValid ( Request $ request ) { $ arguments = $ this -> method === "GET" ? $ request -> get : $ request -> post ; $ files = $ request -> files ; if ( ! $ this -> validate ( $ arguments , $ files ) ) return false ; $ params = [ 'form' => $ this , 'request' => $ request , 'valid' => true , 'arguments' => ...
Check if the form submission is valid
55,110
public function validate ( Dictionary $ arguments , Dictionary $ files ) { $ complete = true ; $ this -> errors = [ ] ; $ this -> value = [ ] ; foreach ( $ this -> form_elements as $ name => $ element ) { if ( $ element instanceof Form ) { if ( ! $ element -> validateAsSubForm ( $ arguments , $ files ) ) { $ this -> er...
Make sure the form was submitted correctly . When errors occur these can be obtained using getErrors .
55,111
public function validateAsSubForm ( Dictionary $ arguments , Dictionary $ files ) { $ name = $ this -> name ; if ( ! $ arguments -> has ( $ name , Type :: ARRAY ) ) { $ this -> errors = [ ] ; if ( $ this -> isRequired ( ) ) { $ this -> errors = [ '' => [ 'msg' => "{name} is required" , 'context' => [ 'name' => $ name ]...
Validate the form as a sub form
55,112
public function prepare ( Session $ session = null , bool $ is_root_form = true ) { foreach ( $ this -> form_elements as $ field ) { if ( $ field instanceof Form ) $ field -> prepare ( null , false ) ; } $ params = [ 'form' => $ this , 'session' => $ session , 'is_root_form' => $ is_root_form ] ; $ params = TypedDictio...
Prepare the form for rendering . This will generate the nonce and add the form name
55,113
public function offsetSet ( $ offset , $ value ) { if ( ! ( $ value instanceof FormField ) ) throw new InvalidArgumentException ( "Value must be a FormField" ) ; $ this -> form_elements [ $ offset ] = $ value ; }
Add or replace a form element
55,114
protected function verifyClassMap ( array $ classMap ) { foreach ( $ classMap as $ type => $ class ) { if ( ! class_exists ( $ class ) ) { throw new Exception ( "Class '$class' that has been registered for type '$type' does not exist" ) ; } if ( ! in_array ( PropertyInterface :: class , class_implements ( $ class ) ) )...
Ensures that the given class map contains valid values .
55,115
protected function setRelation ( $ request ) { $ this -> changeRelationModel ( ) ; $ relation = [ ] ; if ( $ request -> has ( 'group-thumbnail' ) ) { $ this -> relations [ 'thumbnails' ] [ 'datas' ] = collect ( $ request -> get ( 'group-thumbnail' ) ) -> reject ( function ( $ item ) { return ! $ item [ 'thumbnail_slug'...
set the relations
55,116
protected function setRelationDefine ( $ parent ) { $ this -> changeRelationModel ( ) ; $ this -> setDefineValues ( $ this -> defineValues ) ; $ this -> relations [ 'thumbnails' ] [ 'datas' ] = $ parent -> thumbnails ( ) -> get ( [ 'slug' , 'photo_width' , 'photo_height' ] ) -> toArray ( ) ; $ this -> relations [ 'extr...
set relation define datas
55,117
protected function changeRelationModel ( ) { $ module = getModule ( get_called_class ( ) ) ; $ module = explode ( '-' , $ module ) ; $ module = ucfirst_tr ( $ module [ 1 ] ) ; $ this -> relations [ 'thumbnails' ] [ 'relation_model' ] = "\\App\\{$module}Thumbnail" ; $ this -> relations [ 'extras' ] [ 'relation_model' ] ...
change relation model
55,118
public function updateFields ( Guard $ auth , $ ip = null ) : bool { $ ip = $ this -> setIpValue ( $ ip ) ; $ user = $ auth -> user ( ) ; if ( ! $ user instanceof Model ) { return false ; } $ user -> last_login_ip = $ ip ; $ lastLoginDate = config ( 'iptraceable.fields.last_login_date' ) ; if ( ! is_null ( $ lastLoginD...
Update the fields for the user .
55,119
public function contains ( DateTime $ datetime ) { $ lower = $ this -> lower -> toUnixTimestamp ( ) ; $ upper = $ this -> upper -> toUnixTimestamp ( ) ; $ working = $ datetime -> toUnixTimestamp ( ) ; $ lowerCompare = bccomp ( $ lower , $ working ) ; $ upperCompare = bccomp ( $ upper , $ working ) ; if ( $ lowerCompare...
Does this interval contain our time
55,120
private function getFieldOutputEnumSet ( $ tblSrc , $ fldType , $ val , $ iar = [ ] ) { $ adnlThings = $ this -> establishDefaultEnumSet ( $ fldType ) ; if ( array_key_exists ( 'readonly' , $ val ) ) { return $ this -> getFieldOutputEnumSetReadOnly ( $ val , $ adnlThings ) ; } $ inAdtnl = $ adnlThings [ 'additional' ] ...
Returns a Enum or Set field to use in form
55,121
private function getFieldOutputText ( $ tbl , $ fieldType , $ value , $ iar = [ ] ) { if ( ! in_array ( $ fieldType , [ 'char' , 'tinytext' , 'varchar' ] ) ) { return '' ; } $ foreignKeysArray = $ this -> getFieldOutputTextPrerequisites ( $ tbl , $ value ) ; if ( $ foreignKeysArray !== [ ] ) { return $ this -> getField...
Returns a Char field 2 use in a form
55,122
protected function getFieldOutputTextLarge ( $ fieldType , $ value , $ iar = [ ] ) { if ( ! in_array ( $ fieldType , [ 'blob' , 'text' ] ) ) { return '' ; } $ inAdtnl = [ 'name' => $ value [ 'COLUMN_NAME' ] , 'id' => $ value [ 'COLUMN_NAME' ] , 'rows' => 4 , 'cols' => 55 , ] ; if ( $ iar !== [ ] ) { $ inAdtnl = array_m...
Returns a Text field 2 use in a form
55,123
private function getFieldOutputTimestamp ( $ dtl , $ iar = [ ] ) { if ( ( $ dtl [ 'COLUMN_DEFAULT' ] == 'CURRENT_TIMESTAMP' ) || ( $ dtl [ 'EXTRA' ] == 'on update CURRENT_TIMESTAMP' ) ) { return $ this -> getTimestamping ( $ dtl ) [ 'input' ] ; } $ input = $ this -> getFieldOutputTT ( $ dtl , 19 , $ iar ) ; if ( ! arra...
Returns a Timestamp field 2 use in a form
55,124
private function getFieldOutputYear ( $ tblName , $ details , $ iar ) { $ listOfValues = [ ] ; for ( $ cntr = 1901 ; $ cntr <= 2155 ; $ cntr ++ ) { $ listOfValues [ $ cntr ] = $ cntr ; } if ( $ iar == [ ] ) { $ slDflt = $ this -> getFieldValue ( $ details ) ; return $ this -> setArrayToSelect ( $ listOfValues , $ slDfl...
Returns a Year field 2 use in a form
55,125
protected function getSetOrEnum2Array ( $ refTbl , $ refCol ) { $ dat = $ this -> establishDatabaseAndTable ( $ refTbl ) ; foreach ( $ this -> advCache [ 'tableStructureCache' ] [ $ dat [ 0 ] ] [ $ dat [ 1 ] ] as $ vle ) { if ( $ vle [ 'COLUMN_NAME' ] == $ refCol ) { $ kVl = explode ( '\',\'' , substr ( $ vle [ 'COLUMN...
Returns an array with possible values of a SET or ENUM column
55,126
private function getTimestamping ( $ dtl ) { $ fieldValue = $ this -> getFieldValue ( $ dtl ) ; $ inM = $ this -> setStringIntoTag ( $ fieldValue , 'span' ) ; if ( in_array ( $ fieldValue , [ '' , 'CURRENT_TIMESTAMP' , 'NULL' ] ) ) { $ mCN = [ 'InsertDateTime' => 'data/timpul ad. informatiei' , 'ModificationDateTime' =...
Returns a timestamp field value
55,127
public function indexAction ( Request $ request ) { $ response = $ this -> getCacheTimeKeeper ( ) -> getResponse ( 'AnimeDbAppBundle:Notice' ) ; if ( $ response -> isNotModified ( $ request ) ) { return $ response ; } $ rep = $ this -> getRepository ( ) ; $ change_form = $ this -> createForm ( new ChangeNotice ( ) ) ->...
Edit list notices .
55,128
public function listAction ( Request $ request ) { $ current_page = $ request -> get ( 'page' , 1 ) ; $ current_page = $ current_page > 1 ? $ current_page : 1 ; $ rep = $ this -> getRepository ( ) ; $ filter = $ this -> createForm ( 'notices_filter' ) -> handleRequest ( $ request ) ; if ( $ filter -> isValid ( ) ) { $ ...
Get notice list .
55,129
public function getAllPublished ( $ orderBy = null , $ limit = null ) { return $ this -> repository -> findAllPublished ( $ orderBy , $ limit ) ; }
Method which finds all published items in the repository
55,130
public function getById ( $ id = null ) { if ( $ id === null ) { throw new ItemNotSelectedException ; } $ entity = $ this -> repository -> findById ( $ id ) ; if ( ! $ entity ) { throw new NonexistingItemException ; } return $ entity ; }
Method which finds one item in the repository
55,131
public static function parseHeader ( MessageInterface $ message , $ header ) { static $ trimmed = "\"' \n\t\r" ; $ params = $ matches = [ ] ; foreach ( self :: normalizeHeader ( $ message , $ header ) as $ val ) { $ part = [ ] ; foreach ( preg_split ( '/;(?=([^"]*"[^"]*")*[^"]*$)/' , $ val ) as $ kvp ) { if ( preg_mat...
Parse an array of header values containing ; separated data into an array of associative arrays representing the header key value pair data of the header . When a parameter does not contain a value but just contains a key this function will inject a key with a string value .
55,132
public static function getHeadersAsString ( MessageInterface $ message ) { $ result = '' ; foreach ( $ message -> getHeaders ( ) as $ name => $ values ) { $ result .= "\r\n{$name}: " . implode ( ', ' , $ values ) ; } return $ result ; }
Gets the headers of a message as a string
55,133
public static function getStartLine ( MessageInterface $ message ) { if ( $ message instanceof RequestInterface ) { return trim ( $ message -> getMethod ( ) . ' ' . $ message -> getResource ( ) ) . ' HTTP/' . $ message -> getProtocolVersion ( ) ; } elseif ( $ message instanceof ResponseInterface ) { return 'HTTP/' . $ ...
Gets the start line of a message
55,134
public function url ( $ withParams = false ) { $ url = $ this -> scheme ( ) . '://' ; $ url .= $ this -> domain ( ) ; return $ url . $ this -> urlPath ( $ withParams ) ; }
Gets request URL
55,135
public function urlPath ( $ withParams = false ) { $ path = $ this -> server ( 'request_uri' ) ; if ( ! $ withParams ) { $ position = mb_strpos ( $ path , '?' ) ; if ( $ position !== false ) { $ path = mb_substr ( $ path , 0 , $ position ) ; } } return $ path ; }
without host & schema
55,136
public function addColumn ( $ type , $ column , array $ parameters = array ( ) ) { if ( ! $ this -> builder -> hasColumn ( $ this -> table , $ column ) ) return parent :: addColumn ( $ type , $ column , $ parameters ) ; }
Add column only if there isn t one . So it will not throw if there already exists .
55,137
private function configLaravelAuthPackage ( ) { $ config = $ this -> config ( ) ; $ config -> set ( 'laravel-auth' , Arr :: only ( $ config -> get ( 'arcanesoft.auth' ) , [ 'database' , 'users' , 'roles' , 'role-user' , 'permissions-groups' , 'permissions' , 'permission-role' , 'password-resets' , 'events' , 'user-conf...
Config the Laravel Auth package .
55,138
private function rebindModels ( ) { $ config = $ this -> config ( ) ; $ bindings = [ [ 'abstract' => \ Arcanesoft \ Contracts \ Auth \ Models \ User :: class , 'concrete' => $ config -> get ( 'arcanesoft.auth.users.model' ) , ] , [ 'abstract' => \ Arcanesoft \ Contracts \ Auth \ Models \ Role :: class , 'concrete' => $...
Rebind the auth models .
55,139
public function actionGenfake ( $ file ) { $ path = $ this -> buildFakePath ( $ file ) ; if ( ! $ this -> force && file_exists ( $ path ) ) { Yii :: warning ( "already exists: $path" ) ; return 1 ; } return $ this -> genFake ( $ file , $ path ) ; }
Generates skeleton class for fake .
55,140
public function toSQL ( Parameters $ params , bool $ inner_clause ) { $ alias = $ this -> alias ; $ drv = $ params -> getDriver ( ) ; $ sql = $ drv -> toSQL ( $ params , $ this -> expression , true ) ; if ( empty ( $ this -> alias ) ) $ this -> alias = $ params -> generateAlias ( $ this -> expression ) ; if ( ! empty (...
Write a select return clause as SQL query syntax
55,141
public function parseXMLString ( $ xmlString , $ simpleXMLClass = 'SimpleXMLExtended' ) { libxml_use_internal_errors ( true ) ; $ doc = simplexml_load_string ( $ xmlString , $ simpleXMLClass ) ; if ( false === $ doc ) { $ xml = explode ( "\n" , $ xmlString ) ; $ errors = libxml_get_errors ( ) ; $ errorString = '' ; for...
Converts an XML string into a SimpleXMLElement object
55,142
protected function loadIncludes ( $ xmlPath , $ xmlString ) { $ m = null ; if ( preg_match_all ( "/\<include\s*href\=\"([^\"]+)\".*?\/\>/si" , $ xmlString , $ m , PREG_SET_ORDER ) !== false ) { foreach ( $ m as $ match ) { $ includeFile = rtrim ( $ xmlPath , '/' ) . '/' . $ match [ 1 ] ; if ( file_exists ( $ includeFil...
Loads all the includes into the xml string .
55,143
public function attachSubject ( $ event , \ SplSubject $ subject ) { $ key = $ this -> getUniqueKey ( $ event ) ; if ( ! array_key_exists ( $ event , $ this -> subjects ) ) { $ this -> subjects [ $ event ] = array ( ) ; } $ this -> subjects [ $ event ] [ $ key ] = $ subject ; return $ key ; }
Registers a subject to be called an a specific event .
55,144
public function detachSubject ( $ event , $ key ) { Assertion :: notEmptyKey ( $ this -> subjects , $ event , 'Provided event does not exist.' ) ; Assertion :: notEmptyKey ( $ this -> subjects [ $ event ] , $ key , 'Subject to be detached does not exist.' ) ; unset ( $ this -> subjects [ $ event ] [ $ key ] ) ; }
Unregisters a subject from a specific event .
55,145
public function emit ( $ event ) { if ( ! empty ( $ this -> subjects [ $ event ] ) ) { foreach ( $ this -> subjects [ $ event ] as $ subject ) { $ subject -> notify ( ) ; } } }
Triggers every subject attached to an event .
55,146
protected static function handleError ( ) { if ( self :: $ errorHandler === NULL ) { self :: $ errorHandler = function ( $ type , $ message , $ file , $ line ) { throw new \ RuntimeException ( $ message ) ; } ; } return self :: $ errorHandler ; }
Initialize and return the error handler callback .
55,147
public function isAllowCountry ( array $ codes = [ '*' ] ) { try { return in_array ( '*' , $ codes , true ) || in_array ( Utility :: isoCode ( $ this -> ip ( ) ) , $ codes , true ) ; } catch ( \ Exception $ e ) { return true ; } }
Determine the request ip address is in allow countries .
55,148
public function ban ( $ ip = null , $ type = 'regular' ) { $ this -> validateType ( $ type ) ; if ( ! is_null ( $ ip ) ) { if ( 'segment' === $ type ) { $ ip = Utility :: cidr ( $ ip ) ; } } else { $ ip = $ this -> ip ( ) ; session ( [ 'isBan' => $ type ] ) ; } return $ this -> model -> firstOrCreate ( compact ( 'ip' )...
Ban ip address .
55,149
public function unban ( $ ip = null ) { if ( is_null ( $ ip ) ) { $ ip = $ this -> ip ( ) ; session ( ) -> forget ( 'isBan' ) ; } return $ this -> model -> destroy ( $ ip ) ; }
Unban ip address .
55,150
public function fileExists ( StorageFacilityParams $ params , $ fileid ) { $ this -> validateFileID ( $ fileid ) ; return file_exists ( $ this -> generateStoragePath ( $ params , $ fileid ) ) ; }
Returns true if the file exists in the storage facility or false if it doesn t exist . Throws an exception is the operation failed .
55,151
public function deleteFile ( StorageFacilityParams $ params , $ fileid ) { $ this -> validateFileID ( $ fileid ) ; $ storagePath = $ this -> generateStoragePath ( $ params , $ fileid ) ; if ( is_file ( $ storagePath ) ) { if ( ! @ unlink ( $ storagePath ) ) { throw new StorageFacilityException ( "Cannot delete file '" ...
Deletes a file in the storage facility .
55,152
public function renameFile ( StorageFacilityParams $ params , StorageFacilityFile & $ file , $ newfileid ) { $ this -> validateFileID ( $ newfileid ) ; if ( $ file -> getId ( ) == null ) throw new StorageFacilityException ( "Invalid fileid '" . $ file -> getId ( ) . "'" ) ; if ( $ this -> fileExists ( $ params , $ newf...
Renames a StorageFacilityFile in the storage facility .
55,153
public function cmdGetCountry ( ) { $ result = $ this -> getListCountry ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableCountry ( $ result ) ; $ this -> output ( ) ; }
Callback for country - get command
55,154
public function cmdUpdateCountry ( ) { $ params = $ this -> getParam ( ) ; if ( empty ( $ params [ 0 ] ) || count ( $ params ) < 2 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } $ this -> setSubmitted ( null , $ params ) ; $ this -> setSubmitted ( 'update' , $ params [ 0 ] ) ; $ this -> setSubm...
Callback for country - update command
55,155
public function cmdDeleteCountry ( ) { $ code = $ this -> getParam ( 0 ) ; $ all = $ this -> getParam ( 'all' ) ; if ( empty ( $ code ) && empty ( $ all ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } $ result = null ; if ( ! empty ( $ code ) ) { $ result = $ this -> country -> delete ( $ code...
Callback for country - delete command
55,156
protected function addCountry ( ) { if ( ! $ this -> isError ( ) && ! $ this -> country -> add ( $ this -> getSubmitted ( ) ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } }
Add a new country
55,157
protected function updateCountry ( $ code ) { if ( ! $ this -> isError ( ) && ! $ this -> country -> update ( $ code , $ this -> getSubmitted ( ) ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } }
Updates an country
55,158
protected function submitAddCountry ( ) { $ this -> setSubmitted ( null , $ this -> getParam ( ) ) ; $ this -> setSubmittedJson ( 'format' ) ; $ this -> validateComponent ( 'country' ) ; $ this -> addCountry ( ) ; }
Add a new country at once
55,159
protected function wizardAddCountry ( ) { $ this -> validatePrompt ( 'code' , $ this -> text ( 'Code' ) , 'country' ) ; $ this -> validatePrompt ( 'name' , $ this -> text ( 'Name' ) , 'country' , '' ) ; $ this -> validatePrompt ( 'native_name' , $ this -> text ( 'Native name' ) , 'country' , '' ) ; $ this -> validatePr...
Add a new country step by step
55,160
public function get ( $ pattern , $ callback , array $ middleware = null , $ name = null ) { $ this -> addRoute ( 'get' , $ pattern , $ callback , $ middleware , $ name ) ; return $ this ; }
Defines a route which will respond to GET and HEAD requests
55,161
protected function addRoute ( $ method , $ pattern , $ callback , array $ middleware = null , $ name = null ) { $ concatenatedPattern = ( ! is_null ( $ this -> prefix ) ? '/' . $ this -> prefix : '' ) . $ pattern ; $ this -> collector -> addRoute ( strtoupper ( $ method ) , $ concatenatedPattern , new Route ( $ callbac...
Proxies the route definition with the backend routing library
55,162
public function post ( $ pattern , $ callback , array $ middleware = null , $ name = null ) { $ this -> addRoute ( 'post' , $ pattern , $ callback , $ middleware , $ name ) ; return $ this ; }
Defines a route which will respond to POST requests
55,163
public function put ( $ pattern , $ callback , array $ middleware = null , $ name = null ) { $ this -> addRoute ( 'put' , $ pattern , $ callback , $ middleware , $ name ) ; return $ this ; }
Defines a route which will respond to PUT requests
55,164
public function patch ( $ pattern , $ callback , array $ middleware = null , $ name = null ) { $ this -> addRoute ( 'patch' , $ pattern , $ callback , $ middleware , $ name ) ; return $ this ; }
Defines a route which will respond to PATCH requests
55,165
public function delete ( $ pattern , $ callback , array $ middleware = null , $ name = null ) { $ this -> addRoute ( 'delete' , $ pattern , $ callback , $ middleware , $ name ) ; return $ this ; }
Defines a route which will respond to DELETE requests
55,166
public function options ( $ pattern , $ callback , array $ middleware = null , $ name = null ) { $ this -> addRoute ( 'options' , $ pattern , $ callback , $ middleware , $ name ) ; return $ this ; }
Defines a route which will respond to OPTIONS requests
55,167
public function dispatch ( ServerRequestInterface $ request , ResponseInterface $ response ) { $ method = $ request -> getMethod ( ) ; $ uri = $ request -> getUri ( ) -> getPath ( ) ; $ d = new \ FastRoute \ Dispatcher \ GroupCountBased ( $ this -> collector -> getData ( ) ) ; $ r = $ d -> dispatch ( ( $ method === 'HE...
Performs the route matching and invokes the handler for the route if there is an error it throws exception .
55,168
public static function prettyPrint ( $ xmlString , $ htmlDisplay = false ) { $ doc = new \ DOMDocument ( ) ; $ doc -> loadXML ( $ xmlString ) ; $ doc -> preserveWhiteSpace = false ; $ doc -> formatOutput = true ; $ prettyXML = $ doc -> saveXML ( ) ; if ( $ htmlDisplay ) $ prettyXML = str_replace ( array ( "<" , ">" , "...
Pretty print an XML string - if the HTML Display flag is passed it will be formatted for display on a web page with special characters escaped .
55,169
public function cmdUpdateLanguage ( ) { $ params = $ this -> getParam ( ) ; if ( empty ( $ params [ 0 ] ) || count ( $ params ) < 2 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } $ this -> setSubmitted ( null , $ params ) ; $ this -> setSubmitted ( 'update' , $ params [ 0 ] ) ; $ this -> valida...
Callback for language - update
55,170
public function cmdGetLanguage ( ) { $ list = $ this -> getListLanguage ( ) ; $ this -> outputFormat ( $ list ) ; $ this -> outputFormatTableLanguage ( $ list ) ; $ this -> output ( ) ; }
Callback for language - get command
55,171
public function cmdDeleteLanguage ( ) { $ id = $ this -> getParam ( 0 ) ; $ all = $ this -> getParam ( 'all' ) ; if ( ! isset ( $ id ) && empty ( $ all ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } $ result = false ; if ( isset ( $ id ) ) { $ result = $ this -> language -> delete ( $ id ) ; ...
Callback for language - delete command
55,172
protected function submitAddLanguage ( ) { $ this -> setSubmitted ( null , $ this -> getParam ( ) ) ; $ this -> validateComponent ( 'language' ) ; $ this -> addLanguage ( ) ; }
Add a language at once
55,173
protected function wizardAddLanguage ( ) { $ this -> validatePrompt ( 'code' , $ this -> text ( 'Code' ) , 'language' ) ; $ this -> validatePrompt ( 'name' , $ this -> text ( 'Name' ) , 'language' , '' ) ; $ this -> validatePrompt ( 'native_name' , $ this -> text ( 'Native name' ) , 'language' , '' ) ; $ this -> valida...
Adds a language step by step
55,174
protected function oneOf ( $ name , $ conditions ) { $ method = 'get' . ucfirst ( $ name ) ; if ( method_exists ( $ this , $ method ) ) { $ q = call_user_func ( [ $ this , $ method ] ) ; $ q -> andOnCondition ( $ conditions ) ; return $ q -> one ( ) ; } throw new InvalidArgumentException ( Yii :: t ( 'error' , 'Method ...
One of functionality
55,175
public function set ( $ key , $ value ) { header ( '' . $ key . ': ' . $ value . '' , true ) ; $ this -> vars [ $ key ] = $ value ; }
Alias of add But if key exists it will be replaced
55,176
public function getEphemeral ( $ name ) { $ ephemeral = $ this -> get ( self :: EPHEMERAL ) ; if ( isset ( $ ephemeral [ $ name ] [ self :: VARIABLE ] ) ) { return $ ephemeral [ $ name ] [ self :: VARIABLE ] ; } else { return null ; } }
Get Session ephemeral variable specified .
55,177
public function hasEphemeral ( $ name ) { $ ephemeral = $ this -> get ( self :: EPHEMERAL ) ; return isset ( $ ephemeral [ $ name ] ) ; }
Check if have specified ephemeral var in Session .
55,178
public function clearEphemeral ( ) { if ( $ this -> has ( self :: EPHEMERAL ) ) { $ ephemeral = $ this -> get ( self :: EPHEMERAL ) ; foreach ( $ ephemeral as $ name => & $ var ) { if ( true === $ var [ self :: ACTIVE ] ) { $ var [ self :: ACTIVE ] = false ; } else { unset ( $ ephemeral [ $ name ] ) ; } } } else { $ ep...
Initialize Session . Remove old ephemeral var in Session .
55,179
public function setEphemeral ( $ name , $ value ) { $ ephemeral = $ this -> get ( self :: EPHEMERAL ) ; $ ephemeral [ $ name ] [ self :: ACTIVE ] = true ; $ ephemeral [ $ name ] [ self :: VARIABLE ] = $ value ; $ this -> set ( self :: EPHEMERAL , $ ephemeral ) ; return $ this ; }
Set ephemeral variable in Session .
55,180
protected function CanCreateAfter ( ) { $ parent = $ this -> tree -> ParentOf ( $ this -> page ) ; if ( $ parent ) { return BackendModule :: Guard ( ) -> Allow ( BackendAction :: Create ( ) , $ parent ) ; } return BackendModule :: Guard ( ) -> GrantAddPageToSite ( $ this -> page -> GetSite ( ) ) -> ToBool ( ) ; }
True if page can be appended
55,181
protected function AreaUrl ( Area $ area ) { $ params = array ( ) ; $ params [ 'page' ] = $ this -> page -> GetID ( ) ; $ params [ 'area' ] = $ area -> GetID ( ) ; return BackendRouter :: ModuleUrl ( new PageContentTree ( ) , $ params ) ; }
Gets the content tree url
55,182
final public static function parseAttributes ( $ attributes , $ ignore = array ( ) ) { if ( ! is_array ( $ attributes ) ) { return $ attributes ; } $ return = "" ; foreach ( $ attributes as $ attr => $ value ) { if ( in_array ( $ attr , $ ignore ) ) continue ; $ return .= $ attr . '="' . $ value . '" ' ; } return $ ret...
Parses the attributes for use
55,183
public static function carousel ( array $ items , array $ attributes = array ( ) ) { self :: $ carousels ++ ; $ id = ( isset ( $ attributes [ 'id' ] ) ) ? $ attributes [ 'id' ] : 'myCarousel' . self :: $ carousels ; $ class = ( isset ( $ attributes [ 'class' ] ) ) ? $ attributes [ 'class' ] . ' carousel slide' : 'carou...
Creates a carousel
55,184
public static function accordion ( array $ groups , array $ attributes = array ( ) ) { self :: $ accordions ++ ; $ collapse = 1 ; ob_start ( ) ; ?> <div data-close=" <?= @ $ attributes [ 'close' ] ?> " class="accordion <?= @ $ attributes [ 'class' ] ?> " id="accordion <?= self :: $ accordions ?> " <?= self :: parseAt...
Creates an accordion
55,185
public static function groupIntoRows ( array $ items , $ itemsPerRow , array $ options = array ( ) ) { ob_start ( ) ; ?> <div class="row-fluid <?= @ $ options [ 'rows' ] [ 'class' ] ?> " <?= self :: parseAttributes ( @ $ options [ 'rows' ] , array ( 'class' ) ) ?> > <?php foreach ( $ item...
Groups given items into rows with class row - fluid
55,186
public static function progress ( $ message = 'Loading. Please wait ...' , $ percentage = 100 , $ style = 'info' , $ striped = true , $ active = true ) { ob_start ( ) ; ?> <div class="progress <?= ( $ striped ) ? 'progress-striped' : '' ?> progress- <?= $ style ?> <?= ( $ striped ) ? 'active' : '' ?> "> <di...
Creates a progress bar
55,187
public static function popover ( $ content , $ label , $ placement = 'top' , $ title = null , $ class = null ) { ob_start ( ) ; ?> <a href="#" class=" <?= $ class ?> " rel="popover" data-placement=" <?= $ placement ?> " data-content=' <?= $ content ?> ' <?= $ title ? ' data-original-title="' . $ title . '"' ...
Create a popover and it s link
55,188
protected function controllerMiddleware ( ) { list ( $ class , $ method ) = explode ( '@' , $ this -> action [ 'uses' ] ) ; $ controller = UniversalBuilder :: resolve ( $ class ) ; return ( new ControllerDispatcher ( $ this -> router ) ) -> getMiddleware ( $ controller , $ method ) ; }
Get the controller middleware for the route .
55,189
static function lock ( $ string , $ key = null ) { return openssl_encrypt ( $ string , self :: _getSecMethod ( ) , Utils :: spare ( $ key , self :: _geteSecKey ( ) ) , false , self :: _getSecIv ( ) ) ; }
Encrypts values passed
55,190
static function unlock ( $ cipher , $ key = null ) { return openssl_decrypt ( $ cipher , self :: _getSecMethod ( ) , Utils :: spare ( $ key , self :: _geteSecKey ( ) ) , false , self :: _getSecIv ( ) ) ; }
Decrypts values passed
55,191
public function runApplicationComponents ( $ applicationComponents ) { foreach ( $ applicationComponents as $ key => $ applicationComponent ) { $ class = $ applicationComponent -> component ; $ parameters = $ applicationComponent -> parameters ; $ applicationComponents [ $ key ] -> { 'object' } = $ this -> getComponent...
Loop through all application components and run them
55,192
protected function newField ( $ name , array $ options ) : FieldConfig { if ( OrderField :: isOrder ( $ name ) ) { return new OrderField ( $ name , $ this , $ options ) ; } return new SearchField ( $ name , $ this , $ options ) ; }
Creates a new SearchField instance .
55,193
protected function compileSelectPart ( Query $ query , array & $ bindings ) : string { $ columns = [ ] ; foreach ( ( $ query -> select ? : [ '*' ] ) as $ alias => $ column ) { if ( $ column instanceof Aggregate ) { $ column = $ this -> compileAggregate ( $ column , $ bindings ) ; } else { $ column = $ this -> compileId...
Compiles a SELECT part of an SQL query .
55,194
protected function compileFromPart ( Query $ query , array & $ bindings ) : string { if ( $ query -> table === null ) { throw new InvalidQueryException ( 'The FROM table is not set' ) ; } return 'FROM ' . $ this -> compileIdentifierWithAlias ( $ query -> table , $ query -> tableAlias , $ bindings ) ; }
Compiles a FROM part of an SQL query .
55,195
protected function compileJoinPart ( Query $ query , array & $ bindings ) : string { $ joinsSQL = [ ] ; foreach ( $ query -> join as $ join ) { $ joinsSQL [ ] = $ this -> compileOneJoin ( $ join , $ bindings ) ; } return $ this -> implodeSQL ( $ joinsSQL ) ; }
Compiles a JOIN parts of an SQL query .
55,196
protected function compileWherePart ( Query $ query , array & $ bindings ) : string { $ sql = $ this -> compileCriteria ( $ query -> where , $ bindings ) ; if ( $ sql !== '' ) { $ sql = 'WHERE ' . $ sql ; } return $ sql ; }
Compiles a WHERE part of an SQL query .
55,197
protected function compileOrderPart ( Query $ query , array & $ bindings ) : string { $ ordersSQL = [ ] ; foreach ( $ query -> order as $ order ) { $ orderSQL = $ this -> compileOneOrder ( $ order , $ bindings ) ; if ( $ orderSQL !== '' ) { $ ordersSQL [ ] = $ orderSQL ; } } return $ ordersSQL ? 'ORDER BY ' . implode (...
Compiles a ORDER part of an SQL query .
55,198
protected function compileUpdateValues ( array $ values , array & $ bindings ) : string { $ parts = [ ] ; foreach ( $ values as $ column => $ value ) { $ parts [ ] = $ this -> quoteCompositeIdentifier ( $ column ) . ' = ' . $ this -> compileValue ( $ value , $ bindings ) ; } return implode ( ', ' , $ parts ) ; }
Compiles a values list for the SET part of a update SQL query .
55,199
protected function compileValue ( $ value , array & $ bindings ) : string { if ( $ value instanceof Query || $ value instanceof StatementInterface ) { return $ this -> compileSubQuery ( $ value , $ bindings ) ; } $ this -> mergeBindings ( $ bindings , [ $ value ] ) ; return '?' ; }
Converts a value to a part of an SQL query text . Actually it sends all the values to the bindings .