idx
int64 0
60.3k
| question
stringlengths 64
4.24k
| target
stringlengths 5
618
|
|---|---|---|
59,500
|
protected static function aliasMapParse ( string $ name ) : string { $ config = ServiceFactory :: getInstance ( AnnotationConfigServiceImpl :: class ) ; $ aliasArr = $ config -> getConfig ( ) [ 'alias' ] ?? [ ] ; return array_key_exists ( $ name , $ aliasArr ) ? $ aliasArr [ $ name ] : $ name ; }
|
alias map parse
|
59,501
|
public function delTree ( $ dir , $ must_be_empty = true ) { $ this -> debug -> groupCollapsed ( __CLASS__ . '->' . __FUNCTION__ , $ dir ) ; $ cfg = $ this -> cfg ; $ dir = str_replace ( $ cfg [ 'ds_replace' ] , $ cfg [ 'ds' ] , $ dir ) ; if ( substr ( $ dir , - 1 ) != $ cfg [ 'ds' ] ) { $ dir .= $ cfg [ 'ds' ] ; } if ( ! file_exists ( $ dir ) ) { $ this -> debug -> log ( 'does not exist' ) ; $ return = 1 ; } elseif ( is_dir ( $ dir ) ) { $ files = glob ( $ dir . '*' ) ; $ children = false ; foreach ( $ files as $ file ) { $ return = - 1 ; if ( is_dir ( $ file ) ) { $ return = call_user_func ( array ( $ this , __FUNCTION__ ) , $ file , $ must_be_empty ) ; } elseif ( ! $ must_be_empty ) { $ return = unlink ( $ file ) ; } if ( $ return < 1 ) { $ children = true ; } } $ return = - 1 ; if ( ! $ children ) { $ this -> debug -> log ( 'no children...remove the dir' ) ; $ return = rmdir ( $ dir ) ; } } else { $ this -> debug -> log ( 'exists, but not a dir' ) ; $ return = 0 ; } $ this -> debug -> groupEnd ( ) ; return $ return ; }
|
returns - 1 on not deleted 0 on error 1 on deleted
|
59,502
|
protected function findCheckCriteria ( $ filepath , $ criteria ) { $ match = true ; $ filename = basename ( $ filepath ) ; if ( $ match && isset ( $ criteria [ 'regexs' ] ) ) { if ( ! is_array ( $ criteria [ 'regexs' ] ) ) { $ criteria [ 'regexs' ] = array ( $ criteria [ 'regexs' ] ) ; } $ match = false ; foreach ( $ criteria [ 'regexs' ] as $ regex ) { if ( preg_match ( $ regex , $ filename ) ) { $ match = true ; break ; } } } if ( $ match && isset ( $ criteria [ 'mod_since' ] ) ) { $ match = $ criteria [ 'mod_since' ] < @ filemtime ( $ filepath ) ; } if ( $ match && isset ( $ criteria [ 'mod_before' ] ) ) { $ match = $ criteria [ 'mod_before' ] > @ filemtime ( $ filepath ) ; } if ( $ match && isset ( $ criteria [ 'contains' ] ) ) { $ match = false ; if ( preg_match ( '/\.(.*?)$/' , $ filename , $ matches ) ) { $ extension = strtolower ( $ matches [ 1 ] ) ; if ( in_array ( $ extension , $ criteria [ 'search_extensions' ] ) ) { if ( $ contents = file_get_contents ( $ filepath ) ) { $ match = preg_match ( $ criteria [ 'contains' ] , $ contents ) ; unset ( $ contents ) ; } } } } return $ match ; }
|
find check criteria
|
59,503
|
public function relPath ( $ fp_a , $ fp_b ) { $ this -> debug -> groupCollapsed ( __CLASS__ . '->' . __FUNCTION__ ) ; $ cfg = $ this -> cfg ; $ return = $ fp_b ; $ commonDir = $ this -> commonDir ( array ( $ fp_a , $ fp_b ) ) ; if ( $ commonDir ) { $ a_remain = strlen ( $ commonDir ) < strlen ( $ fp_a ) ? substr ( $ fp_a , strlen ( $ commonDir ) ) : '' ; $ b_remain = strlen ( $ commonDir ) < strlen ( $ fp_b ) ? substr ( $ fp_b , strlen ( $ commonDir ) ) : '' ; $ down_path = '.' ; if ( $ a_remain ) { $ a_is_file = preg_match ( '|\.\w{3,4}$|' , $ a_remain ) ; $ a_dir_count = preg_match_all ( '#[\\\/]#' , $ a_remain ) - 1 ; if ( ! $ a_is_file ) { $ a_dir_count ++ ; } $ down_path = '.' . str_repeat ( $ cfg [ 'ds' ] . '..' , $ a_dir_count ) ; } $ return = $ down_path . $ b_remain ; } $ return = str_replace ( $ cfg [ 'ds_other' ] , $ cfg [ 'ds' ] , $ return ) ; $ this -> debug -> log ( 'return' , $ return ) ; $ this -> debug -> groupEnd ( ) ; return $ return ; }
|
get relative path
|
59,504
|
public function updateSettingsFields ( FieldList $ fields ) { $ fields -> removeByName ( 'ClassName' ) ; $ PageTypes = array ( ) ; foreach ( $ this -> owner -> ClassDropdown as $ classKey => $ classValue ) { if ( $ classKey == 'PlaceablePage' ) { foreach ( PlaceablePageType :: get ( ) -> map ( 'ID' , 'Title' ) as $ placeableKey => $ placeableValue ) { $ PageTypes [ "$classKey-$placeableKey" ] = $ placeableValue ; } } else { $ PageTypes [ "$classKey-0" ] = $ classValue ; } } $ fields -> addFieldsToTab ( 'Root.Settings' , array ( DropdownField :: create ( 'PageTypeFake' , _t ( 'PlaceablePage.PAGETYPE' , 'Page type' ) , $ PageTypes ) , HiddenField :: create ( 'ClassName' ) , HiddenField :: create ( 'PageTypeID' ) , ) , 'ParentType' ) ; return $ fields ; }
|
Update Settings Tab Fields
|
59,505
|
public function getPresets ( ) { $ owner = $ this -> owner ; if ( $ owner -> storedpresets ) { return $ owner -> storedpresets ; } return $ owner -> PageType ( ) -> Regions ( ) -> sort ( 'Sort ASC' ) ; }
|
Gets preset regions from page type
|
59,506
|
public function shiftFrame ( ) { $ this -> loadFrames ( ) ; if ( empty ( $ this -> frames ) ) { throw new \ RuntimeException ( 'No more IdFrames?' ) ; } return array_shift ( $ this -> frames ) ; }
|
Get the top frame off the queue for use .
|
59,507
|
public function addFrame ( $ frameName , IdFrame $ frame ) { $ this -> loadFrames ( ) ; $ this -> frames [ $ frameName ] = $ frame ; return $ this ; }
|
Queue up another set of ids to use .
|
59,508
|
public function clear ( ) { if ( ! isset ( $ this -> frames ) ) { return $ this ; } $ this -> loadFrames ( ) ; $ this -> frames = array ( ) ; return $ this ; }
|
Remove all frames .
|
59,509
|
public function afterPrepare ( Event $ event ) { $ command = $ event [ 'command' ] ; $ operation = $ command -> getOperation ( ) ; if ( $ command -> offsetExists ( '_kmd' ) ) $ command -> offsetUnset ( '_kmd' ) ; if ( $ command -> offsetExists ( '_acl' ) ) $ command -> offsetUnset ( '_acl' ) ; if ( $ operation -> getName ( ) !== 'createEntity' && $ command -> offsetGet ( 'collection' ) === 'user' ) { if ( $ command -> offsetExists ( 'username' ) ) $ command -> offsetUnset ( 'username' ) ; if ( $ command -> offsetExists ( 'password' ) ) $ command -> offsetUnset ( 'password' ) ; if ( $ command -> offsetExists ( 'salt' ) ) $ command -> offsetUnset ( 'salt' ) ; } }
|
Remove internal Kinvey metadata from requests .
|
59,510
|
private function getOperatingSystemsCountFromSessions ( Carbon $ start , Carbon $ end ) { return $ this -> getVisitorsFilteredByDateRange ( $ start , $ end ) -> filter ( function ( Visitor $ visitor ) { return $ visitor -> hasDevice ( ) ; } ) -> transform ( function ( Visitor $ visitor ) { return $ visitor -> device ; } ) -> groupBy ( 'platform' ) -> transform ( function ( Collection $ items , $ platform ) { return [ 'platform' => $ platform , 'count' => $ items -> count ( ) , ] ; } ) -> sortByDesc ( 'count' ) ; }
|
Get the operating systems count from sessions .
|
59,511
|
function applyLimit ( & $ sql , $ offset , $ limit ) { $ max = $ offset + $ limit ; $ sql = <<<EOFSELECT A.*, rownum AS PROPEL\$ROWNUMFROM ( $sql) AWHERE rownum <= $maxEOF ; if ( $ offset > 0 ) { $ sql = <<<EOFSELECT B.*FROM ( $sql) BWHERE B.PROPEL\$ROWNUM > $offsetEOF ; } }
|
Returns SQL which limits the result set .
|
59,512
|
private function _throwDispatchException ( $ message , $ exception_code = 0 ) { $ exception = new \ Exception ( $ message , $ exception_code ) ; if ( is_object ( $ this -> _events_manager ) ) { if ( $ this -> _events_manager -> fire ( "dispatch:beforeException" , $ this , array ( "exception" => $ exception ) ) == false ) { return false ; } } throw $ exception ; }
|
Handles the exceptions thrown in the Dispatcher . The exception can be handled by the beforeException listener . If the listener returns false _throwDispatchException also returns false . The header status code is always set to 404 .
|
59,513
|
public function forward ( $ params ) { $ controller_name = $ params [ "controller" ] ; $ action_name = $ params [ "action" ] ; $ params = isset ( $ params [ "params" ] ) ? $ params [ "params" ] : array ( ) ; $ this -> _route -> setControllerName ( $ controller_name ) ; $ this -> _route -> setActionName ( $ action_name ) ; $ this -> _route -> setParams ( $ params ) ; $ this -> _was_forwarded = true ; }
|
Tells the dispatcher to forward to another controller and action
|
59,514
|
private function addRecipient ( $ recipientType , $ recipientAddress , $ recipientName = '' ) { if ( filter_var ( $ recipientAddress , FILTER_VALIDATE_EMAIL ) ) { $ this -> recipientList [ $ recipientType ] [ ] = array ( $ recipientAddress , $ recipientName ) ; } }
|
Add a recipient of mail
|
59,515
|
private function setBoundary ( ) { $ this -> boundary = uniqid ( 'Pabana' ) . '-' . md5 ( rand ( ) ) ; $ this -> boundaryAlt = uniqid ( 'Pabana-alt' ) . '-' . md5 ( rand ( ) ) ; }
|
Generate boundary of mail
|
59,516
|
public function getSender ( ) { if ( ! empty ( $ this -> sender ) ) { $ sender = '' ; if ( ! empty ( $ this -> sender [ 1 ] ) ) { $ sender .= $ this -> addEncodeTag ( '"' . $ this -> sender [ 1 ] . '"' ) . ' ' ; } $ sender .= '<' . $ this -> sender [ 0 ] . '>' ; return $ sender ; } else { return false ; } }
|
Get sender of mail
|
59,517
|
public function getReply ( ) { if ( ! empty ( $ this -> reply ) ) { $ reply = '' ; if ( ! empty ( $ this -> reply [ 1 ] ) ) { $ reply .= $ this -> addEncodeTag ( '"' . $ this -> reply [ 1 ] . '"' ) . ' ' ; } $ reply .= '<' . $ this -> reply [ 0 ] . '>' ; return $ reply ; } else { return false ; } }
|
Get reply of mail
|
59,518
|
private function getRecipient ( $ recipientType ) { $ returnList = array ( ) ; if ( ! empty ( $ this -> recipientList [ $ recipientType ] ) ) { foreach ( $ this -> recipientList [ $ recipientType ] as $ recipientItem ) { $ recipient = '' ; if ( ! empty ( $ recipientItem [ 1 ] ) ) { $ recipient .= $ this -> addEncodeTag ( '"' . $ this -> recipientItem [ 1 ] . '"' ) . ' ' ; } $ recipient .= '<' . $ recipientItem [ 0 ] . '>' ; $ returnList [ ] = $ recipient ; } } return implode ( ', ' , $ returnList ) ; }
|
Get recipident of mail
|
59,519
|
public function getHeaderContent ( ) { $ headerContent = '' ; $ sender = $ this -> getSender ( ) ; if ( ! empty ( $ sender ) ) { $ headerContent .= 'From: ' . $ sender . PHP_EOL ; } $ reply = $ this -> getReply ( ) ; if ( ! empty ( $ reply ) ) { $ headerContent .= 'Reply-to: ' . $ reply . PHP_EOL ; } $ recipientCc = $ this -> getRecipientCc ( ) ; if ( ! empty ( $ recipientCc ) ) { $ headerContent .= 'Cc: ' . $ recipientCc . PHP_EOL ; } $ recipientBcc = $ this -> getRecipientBcc ( ) ; if ( ! empty ( $ recipientBcc ) ) { $ headerContent .= 'Bcc: ' . $ recipientBcc . PHP_EOL ; } if ( ! empty ( $ this -> mailer ) ) { $ headerContent .= 'X-Mailer: ' . $ this -> mailer . PHP_EOL ; } $ headerContent .= 'MIME-Version: 1.0' . PHP_EOL ; if ( ! empty ( $ this -> attachmentList ) ) { $ contentType = 'multipart/mixed' ; } else { $ contentType = 'multipart/alternative' ; } $ headerContent .= 'Content-Type: ' . $ contentType . '; boundary="' . $ this -> boundary . '"' ; $ headerContent .= PHP_EOL . PHP_EOL ; return $ headerContent ; }
|
Generate header content
|
59,520
|
public function getEmailContent ( ) { $ mailContent = '' ; if ( ! empty ( $ this -> textContent ) ) { $ mailContent .= '--' . $ this -> boundary . PHP_EOL ; $ mailContent .= 'Content-Type: text/plain; charset="' . $ this -> charset . '"' . PHP_EOL ; $ mailContent .= 'Content-Transfer-Encoding: 8bit' . PHP_EOL . PHP_EOL ; $ mailContent .= $ this -> textContent . PHP_EOL . PHP_EOL ; } if ( ! empty ( $ this -> htmlContent ) ) { $ mailContent .= '--' . $ this -> boundary . PHP_EOL ; $ mailContent .= 'Content-Type: text/html; charset="' . $ this -> charset . '"' . PHP_EOL ; $ mailContent .= 'Content-Transfer-Encoding: 8bit' . PHP_EOL . PHP_EOL ; $ mailContent .= $ this -> htmlContent . PHP_EOL . PHP_EOL ; } $ mailContent .= '--' . $ this -> boundary . '--' ; return $ mailContent ; }
|
Generate email content
|
59,521
|
public function getNormalized ( \ Exception $ exception ) { $ stack = $ exception -> getTrace ( ) ; $ trace = [ ] ; foreach ( $ stack as $ item ) { $ trace [ ] = [ 'invocation' => $ this -> getInvocation ( $ item ) , 'origin' => $ this -> getOrigin ( $ item ) ] ; } return $ trace ; }
|
Get normalized array trace .
|
59,522
|
protected function getInvocation ( array $ item ) { $ invocation = '' ; if ( isset ( $ item [ 'class' ] ) && isset ( $ item [ 'type' ] ) ) { $ invocation .= $ item [ 'class' ] . $ item [ 'type' ] ; } $ invocation .= $ item [ 'function' ] ; $ invocation .= '(' ; if ( isset ( $ item [ 'args' ] ) ) { $ args = [ ] ; foreach ( $ item [ 'args' ] as $ arg ) { $ args [ ] = $ this -> varToString ( $ arg ) ; } $ invocation .= implode ( ', ' , $ args ) ; } $ invocation .= ')' ; return $ invocation ; }
|
Get invocation of function .
|
59,523
|
private static function getInstance ( ) { $ accessor = static :: getContainerAccessor ( ) ; if ( ! isset ( static :: $ instances [ $ accessor ] ) ) { $ container = static :: getContainer ( ) ; static :: $ instances [ $ accessor ] = $ container [ $ accessor ] ; } return static :: $ instances [ $ accessor ] ; }
|
Gets instance of facade from container by using accessor
|
59,524
|
public static function guessType ( $ file ) { $ ext = strtolower ( pathinfo ( $ file , PATHINFO_EXTENSION ) ) ; switch ( true ) { case $ ext === 'json' : case basename ( $ file ) === 'composer.lock' : return self :: JSON ; case $ ext === 'yml' : case $ ext === 'yaml' : return self :: YAML ; case $ ext === 'ini' : case basename ( $ file ) === '.my.cnf' : return self :: INI ; } return null ; }
|
Try to guess a file type based on its name
|
59,525
|
public static function createLoader ( $ type ) { switch ( $ type ) { case self :: JSON : return new Impl \ Json ( ) ; case self :: YAML : case 'yml' : return new Impl \ Yaml ( ) ; case self :: INI : return new Impl \ Ini ( ) ; } throw new UnknownLoaderTypeException ( "Sorry, loader type `{$type}` is unsupported" ) ; }
|
Create a loader for the specified type
|
59,526
|
public function Index ( $ CurrentFormName = 'discussion' ) { $ this -> AddJsFile ( 'jquery.autogrow.js' ) ; $ this -> AddJsFile ( 'post.js' ) ; $ this -> AddJsFile ( 'autosave.js' ) ; $ this -> SetData ( 'CurrentFormName' , $ CurrentFormName ) ; $ Forms = array ( ) ; $ Forms [ ] = array ( 'Name' => 'Discussion' , 'Label' => Sprite ( 'SpNewDiscussion' ) . T ( 'New Discussion' ) , 'Url' => 'vanilla/post/discussion' ) ; $ this -> SetData ( 'Forms' , $ Forms ) ; $ this -> FireEvent ( 'AfterForms' ) ; $ this -> SetData ( 'Breadcrumbs' , array ( array ( 'Name' => T ( 'Post' ) , 'Url' => '/post' ) ) ) ; $ this -> Render ( ) ; }
|
General post form allows posting of any kind of form . Attach to PostController_AfterFormCollection_Handler .
|
59,527
|
public function Comment2 ( $ CommentID , $ Inserted = FALSE ) { $ this -> CommentModel -> Save2 ( $ CommentID , $ Inserted ) ; $ this -> Render ( 'Blank' , 'Utility' , 'Dashboard' ) ; }
|
Triggers saving the extra info about a comment like notifications and unread totals .
|
59,528
|
protected function PopulateForm ( $ Form ) { $ Get = $ this -> Request -> Get ( ) ; $ Get = array_change_key_case ( $ Get ) ; $ Values = ArrayTranslate ( $ Get , array ( 'name' => 'Name' , 'tags' => 'Tags' , 'body' => 'Body' ) ) ; foreach ( $ Values as $ Key => $ Value ) { $ Form -> SetValue ( $ Key , $ Value ) ; } if ( isset ( $ Get [ 'category' ] ) ) { $ Category = CategoryModel :: Categories ( $ Get [ 'category' ] ) ; if ( $ Category && $ Category [ 'PermsDiscussionsAdd' ] ) $ Form -> SetValue ( 'CategoryID' , $ Category [ 'CategoryID' ] ) ; } }
|
Pre - populate the form with values from the query string .
|
59,529
|
public static function createFromResponse ( ResponseInterface $ response , ApiProviderInterface $ api , ApiResourceInterface $ owner = null ) { $ json = json_decode ( ( string ) $ response -> getBody ( ) , true ) ; $ resourceType = static :: resourceType ( ) ; if ( empty ( $ json [ $ resourceType ] ) ) { static :: throwNotFoundException ( ) ; } return new static ( $ api , $ json [ $ resourceType ] , $ owner ) ; }
|
Create new Resource instance from HTTP response .
|
59,530
|
public function apiUrl ( string $ path = '' , bool $ withPropagation = true ) : string { $ path = ( $ path ? '/' . ltrim ( $ path , '/' ) : '' ) ; $ resourcePath = rtrim ( $ this -> resourcePath ( ) , '/' ) . '/' . $ this -> id ( ) . $ path ; if ( ! $ this -> hasResourceOwner ( ) || ! $ withPropagation ) { return $ resourcePath ; } return $ this -> resourceOwner ( ) -> apiUrl ( $ resourcePath ) ; }
|
Resource API URL .
|
59,531
|
public function update ( array $ payload ) : bool { $ resourceType = static :: resourceType ( ) ; $ response = null ; try { $ response = $ this -> getHttpClient ( ) -> request ( 'PUT' , $ this -> apiUrl ( ) , [ 'json' => $ payload , ] ) ; } catch ( RequestException $ e ) { $ this -> throwResourceException ( $ e -> getResponse ( ) , 'update' , UpdateResourceException :: class ) ; } $ json = json_decode ( ( string ) $ response -> getBody ( ) , true ) ; if ( empty ( $ json [ $ resourceType ] ) ) { return false ; } $ this -> data = $ json [ $ resourceType ] ; return true ; }
|
Update resource data .
|
59,532
|
public function delete ( ) { try { $ this -> getHttpClient ( ) -> request ( 'DELETE' , $ this -> apiUrl ( ) ) ; } catch ( RequestException $ e ) { $ this -> throwResourceException ( $ e -> getResponse ( ) , 'delete' , DeleteResourceException :: class ) ; } return true ; }
|
Delete current resource .
|
59,533
|
protected function throwResourceException ( ResponseInterface $ response , string $ action , string $ exceptionClass ) { $ message = 'Unable to ' . $ action . ' resource (type: ' . static :: resourceType ( ) . ', ID: ' . $ this -> id ( ) . ').' ; if ( is_null ( $ response ) ) { throw new \ InvalidArgumentException ( $ message ) ; } $ message .= ' Server response: "' . ( ( string ) $ response -> getBody ( ) ) . '".' ; throw new $ exceptionClass ( $ message , $ response -> getStatusCode ( ) ) ; }
|
Throw resource exception .
|
59,534
|
protected function magicGet ( $ key ) { if ( ! $ this -> magicInited ) { $ this -> magicInit ( ) ; } $ fields = & $ this -> magicFields [ 'fields' ] ; if ( ! array_key_exists ( $ key , $ fields ) ) { if ( isset ( $ this -> magicFields [ 'loaders' ] [ $ key ] ) ) { $ loader = $ this -> magicFields [ 'loaders' ] [ $ key ] ; if ( ( is_string ( $ loader ) ) && ( substr ( $ loader , 0 , 2 ) == '::' ) ) { $ loader = substr ( $ loader , 2 ) ; $ fields [ $ key ] = $ this -> $ loader ( $ key ) ; } else { $ fields [ $ key ] = Callback :: call ( $ loader , [ $ key ] ) ; } } else { $ fields [ $ key ] = $ this -> magicCreateField ( $ key ) ; } } return $ fields [ $ key ] ; }
|
Returns a magic property
|
59,535
|
protected function magicIsset ( $ key ) { if ( ! $ this -> magicInited ) { $ this -> magicInit ( ) ; } $ exists = & $ this -> magicFields [ 'exists' ] ; if ( ! array_key_exists ( $ key , $ exists ) ) { if ( array_key_exists ( $ key , $ this -> magicFields [ 'fields' ] ) ) { $ exists [ $ key ] = true ; } elseif ( isset ( $ this -> magicFields [ 'loaders' ] [ $ key ] ) ) { $ exists [ $ key ] = true ; } else { $ exists [ $ key ] = $ this -> magicExistsField ( $ key ) ; } } return $ exists [ $ key ] ; }
|
Checks if a magic property is exists
|
59,536
|
protected function magicInit ( ) { if ( ! $ this -> magicInited ) { $ this -> magicFields = array_replace ( $ this -> magicFields , $ this -> magicGetDefaults ( ) ) ; $ this -> magicInited = true ; } }
|
Initializations of magic fields
|
59,537
|
protected function trackObjectVisits ( $ object ) { $ hash = spl_object_hash ( $ object ) ; $ check = array_search ( $ hash , $ this -> visited ) ; if ( $ check !== false ) { $ output = new \ stdClass ( ) ; $ rel = '$rel' ; $ output -> $ rel = $ check ; return $ output ; } else { $ this -> visited [ ] = $ hash ; return count ( $ this -> visited ) ; } }
|
Method used to check if an object has already been visited . This implementation assigns every object in a representation a unique hash . In the event of duplicate objects a key value pair is returned that points to a unique hash . This reduces the size of messages while still including all of the relational meaning behind the data and avoids circular references . Not marked final because this behavior could be changed .
|
59,538
|
final protected function checkArrayCollection ( $ object ) { return $ object instanceof \ Doctrine \ Common \ Collections \ ArrayCollection || $ object instanceof \ Doctrine \ ORM \ PersistentCollection ; }
|
This method is used to detect doctrine collections .
|
59,539
|
final public function buildRepresentation ( $ object , $ view = null ) { switch ( true ) : case $ this -> checkArrayCollection ( $ object ) : $ object = $ object -> toArray ( ) ; case is_array ( $ object ) : $ output = $ this -> handleArray ( $ object , $ view ) ; break ; case is_object ( $ object ) : $ output = $ this -> handleObject ( $ object , $ view ) ; break ; case is_null ( $ object ) : $ output = null ; break ; case is_string ( $ object ) : $ output = $ object ; break ; case is_integer ( $ object ) : $ output = $ object ; break ; case is_bool ( $ object ) : $ output = $ object ; break ; default : throw new \ Exception ( 'Can not determine how to build representation' ) ; endswitch ; return $ output ; }
|
Entry point to build a generic representation . Will handle parse an object and return only stdClass and arrays with keys and values . All implementations will use this method as everything will interact with builders through this implementation . The behavior of an implementing class can be altered via the abstract methods . You should not need to alter this .
|
59,540
|
public function toPhinxAdapterName ( Driver $ driver ) { if ( $ driver instanceof \ Samurai \ Onikiri \ Driver \ MySqlDriver ) { return 'mysql' ; } elseif ( $ driver instanceof \ Samurai \ Onikiri \ Driver \ PgsqlDriver ) { return 'pgsql' ; } elseif ( $ driver instanceof \ Samurai \ Onikiri \ Driver \ SqliteDriver ) { return 'sqlite' ; } }
|
convert to phinx database adapter name .
|
59,541
|
public function toPhinxSqliteMemory ( Driver $ driver , $ database ) { $ is_memory = $ driver instanceof \ Samurai \ Onikiri \ Driver \ SqliteDriver && $ database === ':memory:' ; return $ is_memory ? true : null ; }
|
convert to phinx sqlite memory flag .
|
59,542
|
function assign_block_vars ( $ blockname , $ vararray ) { if ( strstr ( $ blockname , '.' ) ) { $ blocks = explode ( '.' , $ blockname ) ; $ blockcount = sizeof ( $ blocks ) - 1 ; $ str = '$this->_tpldata' ; for ( $ i = 0 ; $ i < $ blockcount ; $ i ++ ) { $ str .= '[\'' . $ blocks [ $ i ] . '.\']' ; eval ( '$lastiteration = sizeof(' . $ str . ') - 1;' ) ; $ str .= '[' . $ lastiteration . ']' ; } $ str .= '[\'' . $ blocks [ $ blockcount ] . '.\'][] = $vararray;' ; eval ( $ str ) ; } else { $ this -> _tpldata [ $ blockname . '.' ] [ ] = $ vararray ; } return true ; }
|
Block - level variable assignment . Adds a new block iteration with the given variable assignments . Note that this should only be called once per block iteration .
|
59,543
|
function assign_vars ( $ vararray ) { reset ( $ vararray ) ; while ( list ( $ key , $ val ) = each ( $ vararray ) ) { $ this -> _tpldata [ '.' ] [ 0 ] [ $ key ] = $ val ; } return true ; }
|
Root - level variable assignment . Adds to current assignments overriding any existing variable assignment with the same name .
|
59,544
|
function make_filename ( $ filename ) { if ( pia_substr ( $ filename , 0 , 1 ) != '/' ) { $ filename = $ this -> root . '/' . $ filename ; } if ( ! file_exists ( $ filename ) ) { die ( "Template->make_filename(): Erreur - Le fichier $filename est inexistant" ) ; } return $ filename ; }
|
Generates a full path + filename for the given filename which can either be an absolute name or a name relative to the rootdir for this Template object .
|
59,545
|
function translate ( $ code ) { if ( preg_match_all ( "/<\?_\(\"(.*)\"\)\?>/siU" , $ code , $ matches , PREG_SET_ORDER ) ) { foreach ( $ matches as $ match ) { if ( isset ( $ match [ 1 ] ) ) { $ code = str_replace ( $ match [ 0 ] , gettext ( stripslashes ( $ match [ 1 ] ) ) , $ code ) ; } } } return $ code ; }
|
Cherche les chaines traduisibles
|
59,546
|
public function toArray ( ) { $ rowData = array ( ) ; foreach ( $ this -> cells as $ cell ) { $ rowData [ ] = $ cell -> getValue ( ) ; } return $ rowData ; }
|
Returns an array for the row
|
59,547
|
public static function acl ( $ requester , $ controlled ) { $ self = static :: _object ( ) ; $ aro = $ self -> _classes [ 'aro' ] ; $ aco = $ self -> _classes [ 'aco' ] ; if ( ! ( ( $ aroNode = $ aro :: node ( $ requester ) ) && ( $ acoNode = $ aco :: node ( $ controlled ) ) ) ) { return false ; } $ acl = static :: find ( 'first' , [ 'conditions' => [ key ( static :: relations ( 'Aro' ) -> key ( ) ) => $ aroNode [ 0 ] [ 'id' ] , key ( static :: relations ( 'Aco' ) -> key ( ) ) => $ acoNode [ 0 ] [ 'id' ] ] , 'return' => 'array' ] ) ; if ( isset ( $ acl [ 'privileges' ] ) ) { $ acl [ 'privileges' ] = json_decode ( $ acl [ 'privileges' ] , true ) ; } return [ 'aro' => $ aroNode [ 0 ] [ 'id' ] , 'aco' => $ acoNode [ 0 ] [ 'id' ] , 'acl' => isset ( $ acl ) ? $ acl : [ ] ] ; }
|
Get the acl array between an Aro and an Aco
|
59,548
|
public static function check ( $ requester , $ controlled , $ privileges ) { $ self = static :: _object ( ) ; $ aro = $ self -> _classes [ 'aro' ] ; $ aco = $ self -> _classes [ 'aco' ] ; if ( ! ( ( $ aroNodes = $ aro :: node ( $ requester , false ) ) && ( $ acoNodes = $ aco :: node ( $ controlled , false ) ) ) ) { return false ; } $ inherited = [ ] ; $ required = ( array ) $ privileges ; $ count = count ( $ required ) ; $ aro_id = key ( static :: relations ( 'Aro' ) -> key ( ) ) ; $ aco_id = key ( static :: relations ( 'Aco' ) -> key ( ) ) ; $ ids = Set :: extract ( $ acoNodes , '/' . $ aco :: meta ( 'key' ) ) ; $ left = $ aco :: actsAs ( 'Tree' , true , 'left' ) ; foreach ( $ aroNodes as $ node ) { $ id = $ node [ $ aro :: meta ( 'key' ) ] ; if ( $ datas = static :: _permQuery ( $ id , $ ids , $ aro_id , $ aco_id , $ left ) ) { foreach ( $ datas as $ data ) { if ( ! $ privileges = json_decode ( $ data [ 'privileges' ] , true ) ) { break ; } foreach ( $ required as $ key ) { if ( isset ( $ privileges [ $ key ] ) ) { if ( ! $ privileges [ $ key ] ) { $ self -> _error = [ 'message' => $ self -> _forbid ] ; return false ; } else { $ inherited [ $ key ] = 1 ; } } } if ( count ( $ inherited ) === $ count ) { $ self -> _error = [ ] ; return true ; } } } } $ self -> _error = [ 'message' => $ self -> _forbid ] ; return false ; }
|
Checks permission access
|
59,549
|
protected static function _permQuery ( $ id , $ ids , $ aro_id , $ aco_id , $ left ) { return static :: find ( 'all' , [ 'alias' => 'Permission' , 'fields' => 'Permission' , 'conditions' => [ 'Permission.' . $ aro_id => $ id , 'Permission.' . $ aco_id => $ ids ] , 'order' => "Aco.{$left} DESC" , 'with' => [ 'Aco' => [ 'alias' => 'Aco' ] ] , 'return' => 'array' ] ) ; }
|
Load permissions query
|
59,550
|
protected static function set ( $ name ) { $ txt = "<?php\n\n" ; $ txt .= "namespace App\Mails;\n\n" ; $ txt .= "use Vinala\Kernel\Mailing\Mailable;\n\n" ; $ txt .= self :: docs ( "$name Mailable" ) ; $ txt .= "class $name extends Mailable\n{\n\n" ; $ txt .= "\t/**\n\t * Create new mail instance\n" ; $ txt .= "\t *\n" ; $ txt .= "\t * @return void\n\t */\n" ; $ txt .= "\tpublic function __construct()\n\t{" ; $ txt .= "\n\t\t// " ; $ txt .= "\n\t}\n\n" ; $ txt .= "\t/**\n\t * Build the mail\n" ; $ txt .= "\t *\n" ; $ txt .= "\t * @return \$this\n\t */\n" ; $ txt .= "\tpublic function build()\n\t{" ; $ txt .= "\n\t\t// do something" ; $ txt .= "\n\t}\n\n}" ; return $ txt ; }
|
Build the middleware script .
|
59,551
|
protected function folder ( $ root ) { $ path = $ root . 'app/mails' ; if ( ! File :: isDirectory ( $ path ) ) { File :: makeDirectory ( $ path ) ; } return $ path ; }
|
The Instante creation for mail folder .
|
59,552
|
private static function getVariable ( string $ input , string $ key = null ) { if ( $ key === null ) { if ( ! isset ( self :: $ arrays [ $ input ] ) ) { self :: $ arrays [ $ input ] = filter_input_array ( $ input ) ; } $ return = self :: $ arrays [ $ input ] ; } else { $ return = filter_input ( $ input , $ key ) ; } if ( $ return === null && $ key === null ) { $ return = array ( ) ; } return $ return ; }
|
Does the actual work of calling either the filter_input of filter_input_array . Calls the filter_input when a data key is provided and callse the filte_input_array when a data key is absent .
|
59,553
|
public static function exists ( string $ input , string $ key ) : bool { return isset ( self :: getVariable ( $ input , null ) [ $ key ] ) ; }
|
Checks if a particular key exists in a given request query .
|
59,554
|
public static function files ( string $ key = null ) { if ( ! isset ( $ _FILES [ $ key ] ) ) { return null ; } if ( is_array ( $ _FILES [ $ key ] [ 'name' ] ) ) { return self :: getFileObjects ( $ key ) ; } else { return new filesystem \ UploadedFile ( $ _FILES ) ; } }
|
Retrieves uploaded files as instances of UploadedFile or an array of UploadedFile if multiples exist .
|
59,555
|
protected static function getListenersSortByPriority ( String $ eventName ) : Array { if ( ! isset ( Properties :: $ listeners [ $ eventName ] ) ) { return [ ] ; } array_multisort ( Properties :: $ listeners [ $ eventName ] [ 0 ] , SORT_NUMERIC , Properties :: $ listeners [ $ eventName ] [ 1 ] ) ; return Properties :: $ listeners [ $ eventName ] [ 1 ] ; }
|
Protected get listeners sort by priority
|
59,556
|
protected static function controllerCallback ( $ callback ) { $ datas = Structure :: data ( $ callback ) ; $ function = $ datas [ 'function' ] ; $ parameters = $ datas [ 'parameters' ] ; $ class = $ datas [ 'namespace' ] . $ datas [ 'page' ] ; return function ( ) use ( $ class , $ function , $ parameters ) { ( new $ class ) -> $ function ( ... $ parameters ) ; } ; }
|
Protected controller callback
|
59,557
|
protected function setAppDirectoryNamespace ( ) { $ files = Finder :: create ( ) -> in ( $ this -> laravel [ 'path' ] ) -> name ( '*.php' ) ; foreach ( $ files as $ file ) { $ this -> replaceNamespace ( $ file -> getRealPath ( ) ) ; } }
|
Set the namespace on the files in the app directory .
|
59,558
|
protected function setPhpSpecNamespace ( ) { if ( $ this -> files -> exists ( $ path = $ this -> getPhpSpecConfigPath ( ) ) ) { $ this -> replaceIn ( $ path , $ this -> currentRoot , $ this -> argument ( 'name' ) ) ; } }
|
Set the PHPSpec configuration namespace .
|
59,559
|
public static function fromXml ( \ DOMNodeList $ xml ) { $ value = 0 ; if ( $ xml -> length > 0 ) { $ value = ( float ) $ xml -> item ( 0 ) -> textContent ; } return new static ( $ value ) ; }
|
Builds a FloatLiteral object from XML .
|
59,560
|
private function isAggregateColumn ( string $ source , array $ aggregates ) : bool { $ regex = '/(' . implode ( '|' , $ aggregates ) . ')/i' ; return ( bool ) ( preg_match ( $ regex , $ source ) ) ; }
|
Checks whether column source uses MySQL aggregate function
|
59,561
|
public function setReferences ( $ references ) { $ this -> _references = [ ] ; foreach ( $ references as $ name => $ ref ) { if ( ! array_key_exists ( 'key' , $ ref ) ) { $ ref [ 'key' ] = 'id' ; } $ this -> _references [ $ name ] = $ ref ; } return $ this ; }
|
Register foreign model references .
|
59,562
|
public function getReference ( $ name ) { if ( ! isset ( $ this -> _manager ) ) { throw new RepositoryException ( 'Model is not handled by a managed repository' ) ; } if ( array_key_exists ( $ name , $ this -> _references ) ) { $ ref = $ this -> _references [ $ name ] ; $ repo = $ this -> _manager -> getByClass ( $ ref [ 'model' ] ) ; if ( ! $ repo ) { throw new RepositoryException ( 'Referenced model is not handled by a managed repository' ) ; } return ( $ repo -> find ( $ ref [ 'key' ] , $ this -> { $ ref [ 'attribute' ] } ) ? : null ) ; } return null ; }
|
Retrieve a reference by name .
|
59,563
|
public function executeAction ( ) { $ request = $ this -> request -> getAll ( ) ; $ task = $ this -> pickTaskName ( $ request ) ; $ options = $ this -> pickTaskOptions ( $ request ) ; try { if ( $ this -> isUsage ( ) ) { $ task = $ this -> taskProcessor -> get ( $ task ) ; $ this -> send ( $ task -> getOption ( ) -> usage ( ) ) ; } else { $ this -> task ( $ task , $ options ) ; } } catch ( NotFoundException $ e ) { return [ self :: FORWARD_ACTION , 'task.notfound' ] ; } catch ( OptionRequiredException $ e ) { $ task = $ this -> taskProcessor -> get ( $ task ) ; $ this -> send ( '%s is required.' , $ e -> define -> getName ( ) ) ; $ this -> send ( '' ) ; $ this -> send ( $ task -> getOption ( ) -> usage ( ) ) ; } catch ( \ Exception $ e ) { $ this -> send ( $ e -> getMessage ( ) ) ; } }
|
execute action .
|
59,564
|
public function listAction ( ) { $ arg = $ this -> request -> get ( 'args' ) ; $ tasks = $ this -> taskProcessor -> find ( $ arg ) ; $ length = 0 ; foreach ( $ tasks as $ t ) $ length = $ length < strlen ( $ t -> getName ( ) ) ? strlen ( $ t -> getName ( ) ) : $ length ; foreach ( $ tasks as $ task ) { $ this -> send ( '%s %s' , str_pad ( $ task -> getName ( ) , $ length ) , $ task -> getShortDescription ( ) ) ; } }
|
list action .
|
59,565
|
private function pickTaskOptions ( array $ options ) { if ( isset ( $ options [ 'args' ] ) ) { array_shift ( $ options [ 'args' ] ) ; } foreach ( $ options as $ key => $ value ) { if ( $ key === 'args' ) continue ; if ( $ key === 'option' ) { foreach ( $ value as $ k => $ v ) { $ options [ $ k ] = $ v ; } unset ( $ options [ $ key ] ) ; } else { $ options [ $ key ] = array_pop ( $ value ) ; } } return $ options ; }
|
pick task options from array .
|
59,566
|
public function notfoundAction ( ) { $ request = $ this -> request -> getAll ( ) ; $ task = $ this -> pickTaskName ( $ request ) ; $ this -> send ( 'task "%s" is not found.' , $ task ) ; }
|
not found action
|
59,567
|
public function getAlias ( ) { $ className = get_class ( $ this ) ; if ( substr ( $ className , - 9 ) != 'Extension' ) { throw new BadMethodCallException ( 'This extension does not follow the naming convention; you must overwrite the getAlias() method.' ) ; } $ classBaseName = substr ( strrchr ( $ className , '\\' ) , 1 , - 9 ) ; return Container :: underscore ( $ classBaseName ) ; }
|
Returns the recommended alias to use in XML .
|
59,568
|
public static function getSspPath ( $ sspPath ) { if ( $ sspPath === Null ) { $ sspPath = getenv ( self :: SSP_PATH_ENV ) ; } if ( ! $ sspPath ) { throw new InvalidSspPathException ( 'Invalid path for simplesamlphp.' . PHP_EOL . 'Cannot be null or evaluate to false.' , 1476967000 ) ; } return $ sspPath ; }
|
If the parameter is Null tries to get the SSP_PATH environment variable .
|
59,569
|
public static function isIdpValidForSp ( $ idpEntityId , $ idpMdEntry , $ spEntityId , $ idps4Sp ) { $ forSpsList = Null ; if ( isset ( $ idpMdEntry [ self :: SP_LIST_KEY ] ) ) { $ forSpsList = $ idpMdEntry [ self :: SP_LIST_KEY ] ; } if ( $ forSpsList !== Null && ! in_array ( $ spEntityId , $ forSpsList ) ) { return False ; } $ excludeByDefault = False ; if ( isset ( $ idpMdEntry [ self :: EXCLUDE_KEY ] ) && $ idpMdEntry [ self :: EXCLUDE_KEY ] === True ) { $ excludeByDefault = True ; } if ( ! $ idps4Sp && $ excludeByDefault === True ) { return False ; } if ( $ idps4Sp ) { if ( ! in_array ( $ idpEntityId , $ idps4Sp ) ) { return False ; } } return True ; }
|
Determins whether an IdP should be usable by a certain SP
|
59,570
|
public static function setForcedPort ( $ port = null ) { if ( is_null ( $ port ) ) { static :: $ forcedPort = null ; return ; } if ( ! is_numeric ( $ port ) || $ port < 1 || $ port > 65535 ) { throw new InvalidArgumentException ( sprintf ( 'Invalid port provided; must be a null or a numeric between ' . '1 and 65534; "%s" received.' , is_numeric ( $ port ) ? $ port : gettype ( $ port ) ) ) ; } static :: $ forcedPort = ( int ) $ port ; }
|
Sets the port for forced usage .
|
59,571
|
public static function retrieve ( array $ server = null ) { if ( empty ( $ server ) ) { $ server = $ _SERVER ; } $ port = '80' ; if ( isset ( $ server [ 'SERVER_PORT' ] ) ) { $ port = $ server [ 'SERVER_PORT' ] ; } return ( int ) $ port ; }
|
Retrieves the Uri port using incoming data ignores a forced port . If unable to retrieve port returns 80 by default .
|
59,572
|
public static function createFromString ( $ uri ) { $ parts = parse_url ( $ uri ) ; $ scheme = ( isset ( $ parts [ 'scheme' ] ) ? $ parts [ 'scheme' ] : '' ) ; $ user = new User ( ( isset ( $ parts [ 'user' ] ) ? $ parts [ 'user' ] : null ) , ( isset ( $ parts [ 'pass' ] ) ? $ parts [ 'pass' ] : null ) ) ; $ host = new Host ( isset ( $ parts [ 'host' ] ) ? $ parts [ 'host' ] : '' ) ; $ port = intval ( isset ( $ parts [ 'port' ] ) ? $ parts [ 'port' ] : null ) ; $ path = new Path ( isset ( $ parts [ 'path' ] ) ? $ parts [ 'path' ] : '' ) ; if ( ! empty ( $ parts [ 'query' ] ) ) { $ query = Query :: createFromString ( $ parts [ 'query' ] ) ; } else { $ query = new Query ( array ( ) ) ; } $ fragment = ( isset ( $ parts [ 'fragment' ] ) ? $ parts [ 'fragment' ] : '' ) ; return new self ( $ scheme , $ user , $ host , $ port , $ path , $ query , $ fragment ) ; }
|
Instanciate the Uri object from a string
|
59,573
|
public function format ( $ money = null ) { if ( ! $ money ) { return null ; } else { return $ this -> numberFormatter -> formatCurrency ( $ money -> amount , $ money -> currency -> code ) ; } }
|
Formats a Money object using PHP s built - in NumberFormatter .
|
59,574
|
protected function getNodeValue ( $ xquery ) { $ nodeList = $ this -> document -> getXPath ( ) -> query ( $ xquery , $ this -> node ) ; if ( $ nodeList -> length == 0 ) throw new Exception ( __METHOD__ . '; ' . $ xquery . ' node is missing' ) ; return $ this -> getValue ( $ nodeList -> item ( 0 ) ) ; }
|
Get node as value
|
59,575
|
protected function appendNodeBefore ( DOMNode $ node , $ xquery = null , $ nodeNameList = array ( ) ) { if ( ! is_array ( $ nodeNameList ) ) throw new InvalidArgumentException ( __METHOD__ . '; Nodes should be an array' ) ; if ( ! is_null ( $ xquery ) ) $ parentNode = $ this -> getNode ( $ xquery ) ; else if ( ! is_null ( $ this -> node ) ) $ parentNode = $ this -> node ; else $ parentNode = $ this -> document ; $ childNode = null ; if ( $ parentNode -> hasChildNodes ( ) ) { $ childNodes = $ this -> convertNodeListToArray ( $ parentNode -> childNodes ) ; reset ( $ childNodes ) ; while ( current ( $ childNodes ) != null && is_null ( $ childNode ) ) { if ( in_array ( current ( $ childNodes ) -> nodeName , $ nodeNameList ) || in_array ( current ( $ childNodes ) -> localName , $ nodeNameList ) ) $ childNode = current ( $ childNodes ) ; next ( $ childNodes ) ; } } if ( ! is_null ( $ childNode ) ) $ parentNode -> insertBefore ( $ node , $ childNode ) ; else $ parentNode -> appendChild ( $ node ) ; }
|
Append node before
|
59,576
|
private function convertNodeListToArray ( DOMNodeList $ nodeList ) { $ array = array ( ) ; if ( ! is_null ( $ nodeList ) && $ nodeList -> length > 0 ) { foreach ( $ nodeList as $ node ) array_push ( $ array , $ node ) ; } return $ array ; }
|
Convert a DOMNodeList to an array
|
59,577
|
protected function setNodeValue ( $ xquery , $ value ) { $ nodeList = $ this -> document -> getXPath ( ) -> query ( $ xquery , $ this -> node ) ; if ( $ nodeList -> length == 0 ) throw new Exception ( __METHOD__ . '; ' . $ xquery . ' node is missing' ) ; if ( is_int ( $ value ) ) $ nodeList -> item ( 0 ) -> nodeValue = $ value ; elseif ( is_string ( $ value ) ) $ nodeList -> item ( 0 ) -> nodeValue = utf8_encode ( $ value ) ; elseif ( is_bool ( $ value ) ) $ nodeList -> item ( 0 ) -> nodeValue = ( $ value ? 'true' : 'false' ) ; }
|
Set node as value
|
59,578
|
protected function getNodeValueAsObject ( $ xquery , $ className ) { $ nodeList = $ this -> document -> getXPath ( ) -> query ( $ xquery , $ this -> node ) ; if ( $ nodeList -> length == 0 ) throw new Exception ( __METHOD__ . '; ' . $ xquery . ' node is missing' ) ; return new $ className ( utf8_decode ( $ nodeList -> item ( 0 ) -> nodeValue ) ) ; }
|
Get node value as object
|
59,579
|
protected function getNodeAsObject ( $ xquery , $ className ) { $ nodeList = $ this -> document -> getXPath ( ) -> query ( $ xquery , $ this -> node ) ; if ( $ nodeList -> length == 0 ) throw new Exception ( __METHOD__ . '; ' . $ xquery . ' node is missing' ) ; return new $ className ( $ this -> document , $ nodeList -> item ( 0 ) ) ; }
|
Get node as object
|
59,580
|
protected function hasNode ( $ xquery ) { $ nodeList = $ this -> document -> getXPath ( ) -> query ( $ xquery , $ this -> node ) ; return ( $ nodeList -> length > 0 ) ; }
|
Check if node is present
|
59,581
|
protected function updateEnabled ( $ new , $ old ) { $ result = array ( ) ; $ service = $ this -> getServiceLocator ( ) -> get ( 'Locale' ) ; foreach ( $ service -> getAvailableFlags ( ) as $ locale => $ enabled ) { $ result [ $ locale ] = ( string ) ( ! empty ( $ new [ $ locale ] ) || in_array ( $ locale , $ new ) ) ; } return $ result ; }
|
Update enabled setting
|
59,582
|
public function findOneBySectionGroupAndValueName ( $ sectionName , $ groupName , $ valueName ) { $ query = $ this -> createQueryBuilder ( 'v' ) -> select ( 'v' , 'g' , 's' ) -> innerJoin ( 'v.configGroup' , 'g' ) -> innerJoin ( 'g.configSection' , 's' ) -> where ( 's.name = :sname' ) -> andWhere ( 'g.name = :gname' ) -> andWhere ( 'v.name = :vname' ) -> setParameter ( 'sname' , $ sectionName ) -> setParameter ( 'gname' , $ groupName ) -> setParameter ( 'vname' , $ valueName ) -> setMaxResults ( '1' ) -> getQuery ( ) ; $ result = $ query -> getResult ( ) ; $ res = null ; if ( isset ( $ result [ 0 ] ) ) { $ res = $ result [ 0 ] ; } return $ res ; }
|
Find a ConfigGroup by the section and group name
|
59,583
|
public function findByConfigGroupId ( $ id ) { $ query = $ this -> createQueryBuilder ( 'v' ) -> innerJoin ( 'v.configType' , 't' ) -> where ( 'v.configGroup = :gid' ) -> setParameter ( 'gid' , $ id ) -> orderBy ( 'v.position' , 'ASC' ) -> getQuery ( ) ; $ result = $ query -> getResult ( ) ; return $ result ; }
|
Find ConfigValue by the config group id
|
59,584
|
public function publish ( $ component ) { with ( new SeedPublisher ( new Seeder ( $ component ) ) ) -> setRepository ( $ this -> laravel [ 'components' ] ) -> setConsole ( $ this ) -> publish ( ) ; }
|
Publish migration for the specified component .
|
59,585
|
public function getDebugInfo ( ) { if ( Director :: isLive ( ) ) { return false ; } $ Debug = array ( 'ID' => $ this -> ID , 'Preset' => $ this -> Preset ( ) -> Title , 'ClassName' => $ this -> ClassName , 'Style' => ( $ this -> Style ) ? $ this -> Style : 'Default' ) ; $ this -> extend ( 'updateDebugInfo' , $ Debug ) ; $ Debug = implode ( ";\n" , array_map ( function ( $ value , $ key ) { return "$key: $value" ; } , $ Debug , array_keys ( $ Debug ) ) ) ; return "\n<!--\n{$Debug}\n ; }
|
Renders HTML comment used to help debug issues during development and testing
|
59,586
|
public function getAnchor ( ) { if ( $ this -> UrlSegment ) { return Convert :: raw2url ( $ this -> UrlSegment ) ; } if ( $ this -> Title ) { return Convert :: raw2url ( $ this -> Title ) ; } return false ; }
|
Generates an anchor segment
|
59,587
|
protected function renderContent ( ) { if ( ! is_null ( $ this -> module ) ) { $ categories = Categories :: getOptions ( $ this -> module ) ; foreach ( $ categories as $ key => $ value ) { echo Html :: a ( strtoupper ( Html :: encode ( $ value ) ) , array ( $ this -> target , 'category' => $ key , 'reference' => Html :: encode ( $ value ) ) , array ( 'class' => $ this -> linkclass ) ) . " // \n" ; } } else { echo " " ; } }
|
renders the content for the widget
|
59,588
|
public function addEndpoint ( $ publicUrl , $ adminUrl ) { $ endpoint = new Endpoint ( ) ; $ endpoint -> setPublicUrl ( $ publicUrl ) ; $ endpoint -> setAdminUrl ( $ adminUrl ) ; $ endpoint -> setService ( $ this ) ; $ this -> endpoints [ ] = $ endpoint ; return $ this ; }
|
Add endpoint .
|
59,589
|
public function startsWith ( $ string ) { $ string = static :: _convertString ( $ string , $ this -> encoding ) ; return $ string === $ this -> substring ( 0 , mb_strlen ( $ string , $ this -> encoding ) - 1 ) -> __toString ( ) ; }
|
Check if this sequence starts with a given string .
|
59,590
|
public function substring ( $ start , $ end = null ) { $ start = ( int ) $ start ; $ end = $ end !== null ? ( int ) $ end : null ; if ( $ start < 0 || $ start >= $ this -> length ( ) || $ end !== null && ( $ end < 0 || $ end >= $ this -> length ( ) ) ) { throw new OutOfBoundsException ( ) ; } $ string = mb_substr ( $ this -> string , $ start , $ end !== null ? $ end + 1 : $ this -> length ( ) , $ this -> encoding ) ; $ stringBuilder = new StringBuilder ( $ string ) ; $ stringBuilder -> setEncoding ( $ this -> encoding ) ; return $ stringBuilder ; }
|
Return a substring of this sequence .
|
59,591
|
public function append ( $ string ) { $ string = static :: _convertString ( $ string , $ this -> encoding ) ; $ this -> string .= $ string ; return $ this ; }
|
Append a string to the sequence .
|
59,592
|
public function replace ( $ start , $ end , $ string ) { $ start = ( int ) $ start ; $ end = ( int ) $ end ; $ string = static :: _convertString ( $ string , $ this -> encoding ) ; if ( $ start < 0 || $ start >= $ this -> length ( ) || $ end < 0 || $ end >= $ this -> length ( ) ) { throw new OutOfBoundsException ( ) ; } $ this -> string = mb_substr ( $ this -> string , 0 , $ start , $ this -> encoding ) . $ string . mb_substr ( $ this -> string , $ end + 1 , $ this -> length ( ) , $ this -> encoding ) ; return $ this ; }
|
Replace a substring by another string in this sequence .
|
59,593
|
public function delete ( $ start , $ end ) { $ start = ( int ) $ start ; $ end = ( int ) $ end ; if ( $ start < 0 || $ start >= $ this -> length ( ) || $ end < 0 || $ end >= $ this -> length ( ) ) { throw new OutOfBoundsException ( ) ; } $ this -> string = mb_substr ( $ this -> string , 0 , $ start , $ this -> encoding ) . mb_substr ( $ this -> string , $ end + 1 , $ this -> length ( ) , $ this -> encoding ) ; return $ this ; }
|
Remove the characters in a substring of this sequence .
|
59,594
|
public function deleteCharAt ( $ index ) { $ index = ( int ) $ index ; if ( $ index < 0 || $ index >= $ this -> length ( ) ) { throw new OutOfBoundsException ( ) ; } $ this -> string = mb_substr ( $ this -> string , 0 , $ index , $ this -> encoding ) . mb_substr ( $ this -> string , $ index + 1 , $ this -> length ( ) , $ this -> encoding ) ; return $ this ; }
|
Delete the character at the index the sequence will be shorten by one .
|
59,595
|
public function indexAction ( ) { $ volumes = $ this -> get ( 'phlexible_media_manager.volume_manager' ) -> all ( ) ; $ out = '<pre>' ; foreach ( $ volumes as $ volumeKey => $ volume ) { $ sizeCalculator = new SizeCalculator ( ) ; $ calculatedSize = $ sizeCalculator -> calculate ( $ volume , $ volume -> findRootFolder ( ) ) ; $ out .= 'Volume: ' . $ volumeKey . PHP_EOL ; $ out .= ' ID: ' . $ volume -> getId ( ) . PHP_EOL ; $ out .= ' Quota: ' . $ volume -> getQuota ( ) . PHP_EOL ; $ out .= ' Size: ' . $ calculatedSize -> getSize ( ) . PHP_EOL ; $ out .= ' Folders: ' . $ calculatedSize -> getNumFolders ( ) . PHP_EOL ; $ out .= ' Files: ' . $ calculatedSize -> getNumFiles ( ) . PHP_EOL ; $ out .= ' RootDir: ' . $ volume -> getRootDir ( ) . PHP_EOL ; $ out .= ' exists: ' . ( file_exists ( $ volume -> getRootDir ( ) ) ? 'OK' : 'Not OK' ) . PHP_EOL ; $ out .= ' readable: ' . ( is_readable ( $ volume -> getRootDir ( ) ) ? 'OK' : 'Not OK' ) . PHP_EOL ; $ out .= ' writable: ' . ( is_writable ( $ volume -> getRootDir ( ) ) ? 'OK' : 'Not OK' ) . PHP_EOL ; $ out .= PHP_EOL ; } return new Response ( $ out ) ; }
|
Show site status .
|
59,596
|
public function getPathByClass ( $ class , $ with_app_namespace = true ) { $ class_path = str_replace ( '\\' , DS , $ class ) ; $ class_path = str_replace ( '_' , DS , $ class_path ) . '.php' ; foreach ( $ this -> app -> config ( 'directory.apps' ) as $ app ) { $ file = ( $ with_app_namespace ? $ app [ 'root' ] : $ app [ 'dir' ] ) . DS . $ class_path ; $ file = new FileSystem \ File ( $ file ) ; if ( $ file -> isExists ( ) ) return $ file ; } return null ; }
|
get path by class .
|
59,597
|
public function find ( $ glob , $ not_exists = false ) { $ files = new FileSystem \ Iterator \ SimpleListIterator ( ) ; if ( $ glob [ 0 ] === '/' ) { $ matches = glob ( $ glob ) ; foreach ( $ matches as $ path ) { $ file = $ this -> pathToEntity ( $ path ) ; $ files -> add ( $ file ) ; } if ( ! $ files -> size ( ) && $ not_exists ) { $ files -> add ( new FileSystem \ File ( $ glob ) ) ; } return $ files ; } $ first = null ; foreach ( $ this -> app -> config ( 'directory.apps' ) as $ app ) { if ( ! $ first ) $ first = $ app [ 'dir' ] . DS . $ glob ; $ matches = glob ( $ app [ 'dir' ] . DS . $ glob ) ; foreach ( $ matches as $ path ) { $ file = $ this -> pathToEntity ( $ path ) ; $ files -> add ( $ file ) ; } } if ( ! $ files -> size ( ) && $ not_exists ) { $ files -> add ( new FileSystem \ File ( $ first ) ) ; } return $ files ; }
|
file finder over application dirs .
|
59,598
|
public function findFirst ( $ glob , $ not_exists = false ) { $ files = $ this -> find ( $ glob , $ not_exists ) ; return $ files -> first ( ) ; }
|
find and get first element .
|
59,599
|
public function pathToEntity ( $ path ) { return is_dir ( $ path ) ? new FileSystem \ Directory ( $ path ) : new FileSystem \ File ( $ path ) ; }
|
path convert to file entity .
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.