idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
10,300
private function _get_value ( $ args ) { if ( $ this -> id ) { $ var = & $ this -> data ; foreach ( $ args as $ a ) { if ( ! isset ( $ var [ $ a ] ) ) { return null ; } $ var = & $ var [ $ a ] ; } return $ var ; } }
Gets a reference to the part of the data corresponding to an array of indexes
10,301
protected function compileBody ( Buffer $ buffer ) { $ buffer -> write ( 'return ' ) ; $ this -> expr -> compile ( $ buffer ) ; $ buffer -> raw ( ';' ) ; }
Compiles the definition body
10,302
public function useEncryption ( $ key ) { $ this -> encryptor = new \ sb \ Encryption \ ForTransmission ( $ key ) ; $ this -> encryption_key = $ key ; foreach ( \ sb \ Gateway :: $ cookie as $ k => $ v ) { \ sb \ Gateway :: $ cookie [ $ k ] = $ this -> encryptor -> decrypt ( $ v ) ; } }
Sets the key that data is encrypted with and turns on encryption the client must use the same key
10,303
public function getMethods ( $ html = true ) { $ arr = Array ( ) ; foreach ( $ this -> served_classes as $ class ) { foreach ( \ get_class_methods ( $ class ) as $ method ) { $ reflect = new \ ReflectionMethod ( $ class , $ method ) ; if ( $ reflect ) { if ( $ class == $ this ) { $ docs = $ reflect -> getDocComment ( )...
Get the methods available for this \ sb \ JSON \ RPC2_Server instance
10,304
protected function getPhpdoc ( $ method ) { $ reflect = false ; foreach ( $ this -> served_classes as $ class ) { if ( \ method_exists ( $ class , $ method ) ) { $ reflect = new \ ReflectionMethod ( $ class , $ method ) ; break ; } } $ response = new \ stdClass ( ) ; if ( ! $ reflect ) { $ response -> error = new \ sb ...
Get php doc and return_type for method by name
10,305
protected function methodsToHtml ( $ methods ) { $ html = '<style type="text/css"> li{background-color:#c8c8d4;} h1{ font-size:1.0em; padding:3px 0 3px 10px; color:white; background-color:#8181bd; } pre{ color:#1d1d4d...
Coverts the methods served into an HTML string
10,306
public function getAcceptedTypes ( ) { return $ this -> getCachedProperty ( 'accept' , function ( ) { $ result = [ ] ; $ nodes = $ this -> query ( 'app:accept' ) ; foreach ( $ nodes as $ value ) { $ result [ ] = trim ( $ value -> textContent ) ; } return $ result ; } ) ; }
Return types of representations accepted by the Collection .
10,307
public function setAcceptedTypes ( array $ types ) { $ nodes = $ this -> query ( 'app:accept' ) ; foreach ( $ nodes as $ node ) { $ this -> getDomElement ( ) -> removeChild ( $ node ) ; } foreach ( $ types as $ type ) { $ element = $ this -> getDomElement ( ) -> ownerDocument -> createElementNS ( $ this -> ns ( ) , 'ac...
Set types of representations accepted by the Collection .
10,308
public function removeTrailingSlashAction ( Request $ request ) { $ pathInfo = $ request -> getPathInfo ( ) ; $ requestUri = $ request -> getRequestUri ( ) ; $ url = str_replace ( $ pathInfo , rtrim ( $ pathInfo , ' /' ) , $ requestUri ) ; return $ this -> redirect ( $ url , 301 ) ; }
Action used to remove trailing slash in url
10,309
public function edit ( $ eloquent , $ locale ) { $ this -> breadcrumb -> onEdit ( $ eloquent ) ; $ form = $ this -> getForm ( $ eloquent ) ; return $ this -> view ( 'edit' , compact ( 'form' ) ) ; }
shows form edit job
10,310
public function getForm ( $ eloquent , $ type = null ) { $ classname = $ eloquent -> classname ; $ model = $ eloquent -> contents -> first ( ) ; $ configuration = [ 'content' => $ model !== null ? $ model -> content : null , 'title' => $ model !== null ? $ model -> title : '' , 'type' => $ eloquent -> exists ? $ eloque...
gets form instance
10,311
protected function form ( Fluent $ fluent , $ notification = null ) { publish ( 'notifications' , 'scripts.resources-default' ) ; Event :: fire ( 'antares.forms' , 'notification.' . $ fluent -> form_name ) ; $ fluent -> type = $ fluent -> type === '' ? 'email' : $ fluent -> type ; return new Form ( $ notification , $ f...
gets instance of command form
10,312
public function create ( Model $ model , $ type = null ) { $ this -> breadcrumb -> onCreate ( $ type ) ; $ form = $ this -> getForm ( $ model , $ type ) -> onCreate ( ) ; return $ this -> view ( 'create' , [ 'form' => $ form ] ) ; }
create new notification notification
10,313
public function edit ( $ id , $ locale , IndexListener $ listener ) { app ( 'antares.asset' ) -> container ( 'antares/foundation::application' ) -> add ( 'ckeditor' , '/packages/ckeditor/ckeditor.js' , [ 'webpack_forms_basic' ] ) ; $ model = $ this -> repository -> findByLocale ( $ id , $ locale ) ; if ( is_null ( $ mo...
shows edit form
10,314
public function update ( IndexListener $ listener ) { $ id = Input :: get ( 'id' ) ; $ model = $ this -> repository -> find ( $ id ) ; $ form = $ this -> presenter -> getForm ( $ model ) ; if ( ! $ form -> isValid ( ) ) { return $ listener -> updateValidationFailed ( $ id , $ form -> getMessageBag ( ) ) ; } try { $ thi...
updates notification notification
10,315
public function preview ( ) { $ inputs = Input :: all ( ) ; $ content = str_replace ( "&#39;" , '"' , $ inputs [ 'content' ] ) ; $ content = $ this -> variablesAdapter -> get ( $ content ) ; if ( isset ( $ inputs [ 'subject' ] ) ) { $ subject = str_replace ( "&#39;" , '"' , $ inputs [ 'subject' ] ) ; $ subject = $ this...
preview notification notification
10,316
public function changeStatus ( IndexListener $ listener , $ id ) { $ model = $ this -> repository -> find ( $ id ) ; if ( is_null ( $ model ) ) { return $ listener -> changeStatusFailed ( ) ; } $ model -> active = $ model -> active ? 0 : 1 ; $ model -> save ( ) ; return $ listener -> changeStatusSuccess ( ) ; }
change notification notification status
10,317
public function create ( $ type = null ) { app ( 'antares.asset' ) -> container ( 'antares/foundation::application' ) -> add ( 'ckeditor' , '/packages/ckeditor/ckeditor.js' , [ 'webpack_forms_basic' ] ) ; return $ this -> presenter -> create ( $ this -> repository -> makeModel ( ) -> getModel ( ) , $ type ) ; }
Create notification notification form
10,318
public function store ( IndexListener $ listener ) { $ model = $ this -> repository -> makeModel ( ) -> getModel ( ) ; $ form = $ this -> presenter -> getForm ( $ model ) -> onCreate ( ) ; if ( ! $ form -> isValid ( ) ) { return $ listener -> storeValidationFailed ( $ form -> getMessageBag ( ) ) ; } try { $ this -> rep...
store new notification notification
10,319
public function delete ( $ id , IndexListener $ listener ) { try { $ model = $ this -> repository -> makeModel ( ) -> findOrFail ( $ id ) ; $ model -> delete ( ) ; return $ listener -> deleteSuccess ( ) ; } catch ( Exception $ ex ) { return $ listener -> deleteFailed ( ) ; } }
deletes custom notification
10,320
public function getExportFields ( ) { $ export_fields = Config :: inst ( ) -> get ( $ this -> modelClass , self :: EXPORT_FIELDS ) ; if ( isset ( $ export_fields ) && is_array ( $ export_fields ) ) { $ fields = $ export_fields ; } else { $ fields = parent :: getExportFields ( ) ; } $ this -> extend ( "updateExportField...
Get the default export fields for the current model .
10,321
public function getSearchSessionName ( ) { $ curr = $ this -> sanitiseClassName ( self :: class ) ; $ model = $ this -> sanitiseClassName ( $ this -> modelClass ) ; return $ curr . "." . $ model ; }
Get the name of the session to be useed by this model admin s search form .
10,322
public function getEditForm ( $ id = null , $ fields = null ) { $ form = parent :: getEditForm ( $ id , $ fields ) ; $ grid_field = $ form -> Fields ( ) -> fieldByName ( $ this -> sanitiseClassName ( $ this -> modelClass ) ) ; $ manager = new BulkManager ( ) ; $ manager -> removeBulkAction ( UnlinkHandler :: class ) ; ...
Add bulk editor to Edit Form
10,323
public function store ( $ key , $ data , $ lifetime = 0 ) { if ( $ lifetime != 0 ) { $ lifetime = \ time ( ) + $ lifetime ; } $ data = array ( $ lifetime , $ data ) ; $ this -> hash [ $ key ] = $ data ; if ( $ key != $ this -> catalog_key ) { $ this -> catalogKeyAdd ( $ key , $ lifetime ) ; } return true ; }
Store the cache data in memcache
10,324
public function fetch ( $ key ) { if ( ! \ array_key_exists ( $ key , $ this -> hash ) ) { return false ; } $ data = $ this -> hash [ $ key ] ; if ( $ data && ( $ data [ 0 ] == 0 || \ time ( ) <= $ data [ 0 ] ) ) { return $ data [ 1 ] ; } else { $ this -> delete ( $ key ) ; return false ; } }
Fetches the cache from memcache
10,325
public function delete ( $ key ) { $ deleted = false ; $ catalog = \ array_keys ( $ this -> getKeys ( ) ) ; foreach ( $ catalog as $ k ) { if ( $ k == $ key ) { unset ( $ this -> hash [ $ key ] ) ; if ( $ delete ) { $ this -> catalogKeyDelete ( $ k ) ; $ deleted = true ; } } } return $ deleted ; }
Deletes cache data
10,326
public function renderValue ( $ object , array $ options = [ ] ) : string { $ options = array_merge ( [ 'column' => $ this , 'object' => $ object ] , $ this -> getFormattingOptions ( ) , $ options ) ; $ accessor = PropertyAccess :: createPropertyAccessor ( ) ; try { $ value = $ accessor -> getValue ( $ object , $ this ...
Render column for a given result
10,327
protected function getLogPath ( $ log ) { $ dir = $ this -> log_root . '/' . $ log . '/' ; if ( ! is_dir ( $ dir ) ) { mkdir ( $ dir , 0777 , true ) ; } return $ dir ; }
Grabs the log path based on the type of log
10,328
protected function write ( $ data , $ log_type ) { return file_put_contents ( $ this -> getLogPath ( $ log_type ) . date ( 'Y_m_d' ) . '.log' , "\n\n" . \ date ( 'Y/m/d H:i:s' ) . "\t" . $ this -> agent_str . "\n" . $ data , \ FILE_APPEND ) ; }
Writes the data to file
10,329
function remove ( $ header ) { $ normalizer = new HeaderCaseNormalizer ( ) ; $ name = $ normalizer -> normalize ( $ header ) ; foreach ( $ this -> _headers as $ idx => $ header ) { if ( $ header -> getName ( ) == $ name ) unset ( $ this -> _headers [ $ idx ] ) ; } return $ this ; }
Remove a header by name
10,330
function value ( $ name , $ default = false ) { $ values = $ this -> values ( $ name ) ; return count ( $ values ) ? $ values [ 0 ] : $ default ; }
Gets a single header value
10,331
function values ( $ name ) { $ normalizer = new HeaderCaseNormalizer ( ) ; $ name = $ normalizer -> normalize ( $ name ) ; $ values = array ( ) ; foreach ( $ this -> _headers as $ header ) { if ( $ header -> getName ( ) == $ name ) { $ values [ ] = $ header -> getValue ( ) ; } } return $ values ; }
Gets an array of the values for a header
10,332
function toArray ( $ crlf = true ) { $ headers = array ( ) ; foreach ( $ this -> _headers as $ header ) { $ string = $ header -> __toString ( ) ; $ headers [ ] = $ crlf ? $ string : rtrim ( $ string ) ; } return $ headers ; }
Returns an array of the string versions of headers
10,333
public function has ( string $ key ) : bool { if ( isset ( $ this -> items [ $ key ] ) ) { return true ; } try { $ class = new \ ReflectionClass ( $ key ) ; } catch ( \ ReflectionException $ e ) { return false ; } $ classes = $ this -> reflectionTools -> getClassHierarchy ( $ class ) ; foreach ( $ classes as $ class ) ...
Returns whether the container has the given key .
10,334
public function set ( string $ key , $ value ) : Container { $ this -> items [ $ key ] = $ value ; return $ this ; }
Sets a single value .
10,335
public function bind ( string $ key , $ target = null ) : BindingDefinition { return $ this -> items [ $ key ] = new BindingDefinition ( $ target ?? $ key ) ; }
Binds a key to a class name to be instantiated or to a closure to be invoked .
10,336
public function alias ( string $ key , string $ targetKey ) : AliasDefinition { return $ this -> items [ $ key ] = new AliasDefinition ( $ targetKey ) ; }
Creates an alias from one key to another .
10,337
private function addStoreToBuildQueue ( $ storeName , $ builderName , array $ options ) { if ( ! $ this -> factory -> getRegistry ( ) -> has ( $ builderName ) ) { throw new \ DomainException ( sprintf ( "Unknown builder: %s" , $ builderName ) ) ; } $ this -> buildQueue [ $ storeName ] = array ( $ builderName , $ option...
Queues a store to be built
10,338
private function getProjectProperties ( ) { $ r = '' ; $ projectOptions = ( array ) $ this -> xml -> xpath ( '/draggy/project' ) ; $ projectOptions = ( array ) $ projectOptions [ 0 ] ; $ this -> checkMandatoryAttributes ( 'Project' , $ projectOptions , [ 'language' , 'description' , 'orm' , 'framework' ] ) ; $ r .= 'Dr...
Get the project properties from the saved file
10,339
private function getAutocodeProperties ( ) { $ r = '' ; $ autocode = ( array ) $ this -> xml -> xpath ( '/draggy/autocode' ) ; $ autocode = ( array ) $ autocode [ 0 ] ; $ autocodeProperties = ( array ) $ autocode [ 'properties' ] ; $ autocodeConfigurations = ( array ) $ autocode [ 'configurations' ] ; $ autocodeTemplat...
Get the project autocode properties from the saved file
10,340
private function getModules ( ) { $ modules = ( array ) $ this -> xml -> xpath ( '/draggy/module' ) ; $ r = '' ; foreach ( $ modules as $ module ) { $ moduleAttributes = ( array ) $ module ; $ moduleAttributes = ( array ) $ moduleAttributes [ '@attributes' ] ; $ this -> checkMandatoryAttributes ( 'Modules' , $ moduleAt...
Get the project modules
10,341
private function getInterfaces ( ) { $ r = '' ; foreach ( $ this -> modules as $ module ) { $ interfaces = ( array ) $ this -> xml -> xpath ( '/draggy/module[@name=\'' . $ module . '\']/interface' ) ; foreach ( $ interfaces as $ interface ) { $ interfaceAttributes = ( array ) $ interface ; $ interfaceAttributes = $ int...
Get the project interfaces
10,342
public function getLoaderJS ( ) { if ( $ this -> newFile ) { return '' ; } $ r = '' ; $ r .= $ this -> getProjectProperties ( ) ; $ r .= $ this -> getModules ( ) ; $ r .= $ this -> getClasses ( ) ; $ r .= $ this -> getAbstracts ( ) ; $ r .= $ this -> getInterfaces ( ) ; $ r .= $ this -> getAttributes ( ) ; $ r .= $ thi...
Returns all the JS code to load the project
10,343
public function toArray ( $ sheet = 0 ) { $ arr = array ( ) ; for ( $ row = 1 ; $ row <= $ this -> rowcount ( $ sheet ) ; $ row ++ ) { for ( $ col = 1 ; $ col <= $ this -> colcount ( $ sheet ) ; $ col ++ ) { $ arr [ $ row ] [ $ col ] = $ this -> val ( $ row , $ col , $ sheet ) ; } } return $ arr ; }
export to multi dimensional array
10,344
public function info ( $ row , $ col , $ type = '' , $ sheet = 0 ) { $ col = $ this -> getCol ( $ col ) ; if ( array_key_exists ( 'cellsInfo' , $ this -> sheets [ $ sheet ] ) && array_key_exists ( $ row , $ this -> sheets [ $ sheet ] [ 'cellsInfo' ] ) && array_key_exists ( $ col , $ this -> sheets [ $ sheet ] [ 'cellsI...
Gets info for a specifc cell of a specific sheet
10,345
public function mesasAbiertas ( $ mozo_id = null , $ lastAccess = null ) { $ conditions = array ( ) ; if ( ! empty ( $ mozo_id ) ) { $ conditions [ 'Mozo.id' ] = $ mozo_id ; } else { $ conditions [ 'Mozo.activo' ] = 1 ; } if ( Configure :: read ( 'Site.type' ) == SITE_TYPE_HOTEL ) { $ conditionsMesa = array ( 'Mesa.del...
Para todos los mozos activos me trae sus mesas abiertas
10,346
public function mesasBorradas ( $ mozo_id = null , $ lastAccess = null ) { if ( empty ( $ lastAccess ) ) { return array ( ) ; } $ conditions = array ( ) ; if ( ! empty ( $ mozo_id ) ) { $ conditions [ 'Mozo.id' ] = $ mozo_id ; } else { $ conditions [ 'Mozo.activo' ] = 1 ; } $ conditionsMesa = array ( 'OR' => array ( ar...
Para todos los mozos activos me trae sus mesas eliminadas entre cada actualizacion de datos
10,347
protected function addInheritedFromTag ( \ DOMElement $ docBlock , $ descriptor ) { $ parentElement = $ descriptor -> getInheritedElement ( ) ; if ( ! $ parentElement instanceof $ descriptor ) { return ; } $ child = new \ DOMElement ( 'tag' ) ; $ docBlock -> appendChild ( $ child ) ; $ rule = $ this -> router -> match ...
Adds the inherited_from tag when a Descriptor inherits from another Descriptor .
10,348
protected function _isuuidversion ( $ in , $ strict = true ) { if ( false !== $ strict ) { $ in = strtolower ( $ in ) ; $ alphanums = "a-f" ; } else { $ alphanums = "a-z" ; } if ( ! preg_match ( "/^[0-9$alphanums]{8}-[0-9$alphanums]{4}-(?<version>[0-9$alphanums]{1})[0-9$alphanums]{3}-[0-9$alphanums]{4}-[0-9$alphanums]{...
returns UUID version or FALSE if no UUID format
10,349
protected function _ip2long ( $ ip , $ getVersion = TRUE ) { $ version = $ this -> _isip ( $ ip ) ; if ( $ getVersion === FALSE && $ version === FALSE ) return FALSE ; if ( $ getVersion === FALSE && $ version === 'ipv4' ) return $ this -> _ip2long_v4 ( $ ip ) ; if ( $ getVersion === FALSE && $ version === 'ipv6' ) retu...
IP Addresses ... - php . net
10,350
public static function save ( $ url , $ post_ID , $ featured = false ) { $ url = filter_var ( $ url , FILTER_VALIDATE_URL ) ; if ( false === $ url || false === get_post_status ( $ post_ID ) ) { return false ; } $ filename = basename ( $ url ) ; $ filepath = self :: upload ( $ url , $ filename ) ; $ attachment = [ 'post...
Save image and associate it with a specific post .
10,351
public static function upload ( $ url , $ filename ) { $ dir = wp_upload_dir ( ) ; if ( ! isset ( $ dir [ 'path' ] , $ dir [ 'basedir' ] ) ) { return false ; } $ path = wp_mkdir_p ( $ dir [ 'path' ] ) ? $ dir [ 'path' ] : $ dir [ 'basedir' ] ; $ path = rtrim ( $ path , '/' ) . '/' ; $ image_data = @ file_get_contents (...
Upload image to WordPress upload directory .
10,352
public static function delete_all_attachment ( $ post_ID , $ force = false ) { if ( get_post_status ( $ post_ID ) === false ) { return false ; } $ counter = 0 ; $ attachments = get_posts ( [ 'post_type' => 'attachment' , 'posts_per_page' => 100 , 'post_status' => 'any' , 'post_mime_type' => 'image/jpeg, image/png, imag...
Deletes an attachment and all of its derivatives .
10,353
public function delete ( $ id ) { $ this -> fireEvent ( 'deleting' , [ $ id ] ) ; $ deleted = $ this -> model -> destroy ( $ id ) ; $ this -> fireEvent ( 'deleted' , [ $ id , $ deleted ] ) ; return $ deleted ; }
Find and delete a resource by ID .
10,354
public function store ( $ request ) { $ this -> fireEvent ( 'creating' , [ $ request ] ) ; $ created = $ this -> model -> create ( $ request ) ; $ this -> fireEvent ( 'created' , [ $ created ] ) ; return $ created ; }
Store a new resource .
10,355
public function with ( $ relationships ) { if ( ! is_array ( $ relationships ) ) { $ relationships = explode ( ', ' , $ relationships ) ; } if ( ! in_array ( $ relationships , $ this -> withRelationships ) ) { foreach ( $ relationships as $ with ) { $ this -> withRelationships [ ] = $ with ; } } return $ this ; }
Assign eager loading relationships .
10,356
protected function newQuery ( ) { $ query = $ this -> model -> newQuery ( ) ; foreach ( $ this -> withRelationships as $ relationship ) { $ query -> with ( $ relationship ) ; } return $ query ; }
Create a new newQuery instance with eager loaded relationships .
10,357
protected function fireEvent ( $ event , $ data ) { $ fireableEvent = isset ( $ this -> fireEvents [ $ event ] ) ? $ this -> fireEvents [ $ event ] : null ; if ( ! is_null ( $ fireableEvent ) ) { return $ this -> event -> fire ( $ fireableEvent , $ data ) ; } return null ; }
Fire off an event if one is defined .
10,358
private function wait ( ) { do { if ( empty ( $ this -> queries ) ) { break ; } $ links = $ errors = $ reject = [ ] ; foreach ( $ this -> queries as $ link ) { $ links [ ] = $ errors [ ] = $ reject [ ] = $ link [ 'l' ] ; } if ( ! mysqli_poll ( $ links , $ errors , $ reject , self :: $ sleep , self :: $ usleep ) ) { con...
Wait for pending queries to complete .
10,359
public function makeRoot ( $ runValidation = true , $ attributes = null ) { $ this -> operation = self :: OPERATION_MAKE_ROOT ; return $ this -> owner -> save ( $ runValidation , $ attributes ) ; }
Creates the root node if the active record is new or moves it as the root node .
10,360
public function prependTo ( $ node , $ runValidation = true , $ attributes = null ) { $ this -> operation = self :: OPERATION_PREPEND_TO ; $ this -> node = $ node ; return $ this -> owner -> save ( $ runValidation , $ attributes ) ; }
Creates a node as the first child of the target node if the active record is new or moves it as the first child of the target node .
10,361
public function appendTo ( $ node , $ runValidation = true , $ attributes = null ) { $ this -> operation = self :: OPERATION_APPEND_TO ; $ this -> node = $ node ; return $ this -> owner -> save ( $ runValidation , $ attributes ) ; }
Creates a node as the last child of the target node if the active record is new or moves it as the last child of the target node .
10,362
public function insertBefore ( $ node , $ runValidation = true , $ attributes = null ) { $ this -> operation = self :: OPERATION_INSERT_BEFORE ; $ this -> node = $ node ; return $ this -> owner -> save ( $ runValidation , $ attributes ) ; }
Creates a node as the previous sibling of the target node if the active record is new or moves it as the previous sibling of the target node .
10,363
public function insertAfter ( $ node , $ runValidation = true , $ attributes = null ) { $ this -> operation = self :: OPERATION_INSERT_AFTER ; $ this -> node = $ node ; return $ this -> owner -> save ( $ runValidation , $ attributes ) ; }
Creates a node as the next sibling of the target node if the active record is new or moves it as the next sibling of the target node .
10,364
public function parents ( $ depth = null ) { $ condition = [ 'and' , [ $ this -> leftAttribute => [ '$lt' => $ this -> owner -> getAttribute ( $ this -> leftAttribute ) ] ] , [ $ this -> rightAttribute => [ '$gt' => $ this -> owner -> getAttribute ( $ this -> rightAttribute ) ] ] , ] ; if ( $ depth !== null ) { $ condi...
Gets the parents of the node .
10,365
public function leaves ( ) { $ condition = [ 'and' , [ $ this -> leftAttribute => [ '$gt' => $ this -> owner -> getAttribute ( $ this -> leftAttribute ) ] ] , [ $ this -> rightAttribute => [ '$lt' => $ this -> owner -> getAttribute ( $ this -> rightAttribute ) ] ] , [ '$where' => "this.{$this->rightAttribute} = this.{$...
Gets the leaves of the node .
10,366
public function prev ( ) { $ condition = [ $ this -> rightAttribute => $ this -> owner -> getAttribute ( $ this -> leftAttribute ) - 1 ] ; $ this -> applyTreeAttributeCondition ( $ condition ) ; return $ this -> owner -> find ( ) -> andWhere ( $ condition ) ; }
Gets the previous sibling of the node .
10,367
public function isChildOf ( $ node ) { $ result = $ this -> owner -> getAttribute ( $ this -> leftAttribute ) > $ node -> getAttribute ( $ this -> leftAttribute ) && $ this -> owner -> getAttribute ( $ this -> rightAttribute ) < $ node -> getAttribute ( $ this -> rightAttribute ) ; if ( $ result && $ this -> treeAttrib...
Determines whether the node is child of the parent node .
10,368
protected function fetchObject ( $ filename ) { $ data = $ this -> backend -> fetch ( $ filename ) ; return ( is_object ( $ data ) ) ? $ data : false ; }
Fetches the object from the cache .
10,369
public function store ( $ id , $ data , $ attributes = array ( ) ) { $ filename = $ this -> properties [ 'location' ] . $ this -> generateIdentifier ( $ id , $ attributes ) ; if ( isset ( $ this -> registry [ $ filename ] ) ) { unset ( $ this -> registry [ $ filename ] ) ; } if ( file_exists ( $ filename ) ) { if ( unl...
Stores data to the cache storage .
10,370
protected function handleBasePath ( InputInterface $ input , OutputInterface $ output ) { $ path = realpath ( $ input -> getOption ( 'basepath' ) ) ; $ this -> writeln ( $ output , 'Joomla! installation expected in ' . $ path , OutputInterface :: VERBOSITY_DEBUG ) ; return $ path ; }
Read the base path from the options
10,371
private function ffprobe ( $ binary = null ) { if ( is_null ( $ binary ) ) { $ binary = static :: $ ffprobe ; } if ( ! isset ( $ this -> metadata ) ) { $ cmd = "{$binary} -v quiet -print_format json -show_format -show_streams {$this->file}" ; exec ( $ cmd , $ output , $ returnvalue ) ; $ json = json_decode ( implode ( ...
Runs an ffprobe on the file or returns cached information .
10,372
private function ffprobeFormat ( $ format ) { $ this -> ffprobe ( ) ; if ( count ( $ this -> formats ) > 0 ) { $ args = func_get_args ( ) ; foreach ( $ args as $ arg ) { if ( in_array ( $ arg , $ this -> formats ) ) { return true ; } } return null ; } return false ; }
Checks requested format against what formats ffprobe returned .
10,373
private function ffprobeHasVideo ( ) { if ( isset ( $ this -> metadata [ 'streams' ] ) ) { foreach ( $ this -> metadata [ 'streams' ] as $ streamIndex => $ stream ) { if ( isset ( $ stream [ 'codec_type' ] ) && $ stream [ 'codec_type' ] === "video" && $ stream [ 'disposition' ] [ 'attached_pic' ] !== 1 ) { return $ str...
Check our metadata for a video stream .
10,374
private function ffprobeHasAudio ( ) { if ( isset ( $ this -> metadata [ 'streams' ] ) ) { foreach ( $ this -> metadata [ 'streams' ] as $ streamIndex => $ stream ) { if ( isset ( $ stream [ 'codec_type' ] ) && $ stream [ 'codec_type' ] === "audio" ) { return $ streamIndex ; } } } return false ; }
Check our metadata for an audio stream .
10,375
protected function lead3GP ( ) { $ lead = $ this -> ffprobeFormat ( "3gp" ) ; if ( $ lead === true ) { return $ this -> closeCase ( "3gp" , "video/3gp" , $ this -> metadata ) ; } return null ; }
Checks if the file is a 3GP .
10,376
protected function leadAAC ( ) { $ lead = $ this -> ffprobeFormat ( "aac" ) ; if ( $ lead === true ) { return $ this -> closeCase ( "aac" , "audio/aac" , $ this -> metadata ) ; } return null ; }
Checks if the file is a AAC
10,377
protected function leadFLV ( ) { $ lead = $ this -> ffprobeFormat ( "flv" ) ; if ( $ lead === true ) { return $ this -> closeCase ( "flv" , "video/x-flv" , $ this -> metadata ) ; } return null ; }
Checks if the file is a FLV .
10,378
protected function leadMP3 ( ) { $ lead = $ this -> ffprobeFormat ( "mp1" , "mp2" , "mp3" , "mpg" , "mpeg" ) ; if ( $ lead === true ) { return $ this -> closeCase ( "mp3" , "audio/mpeg" , $ this -> metadata ) ; } return null ; }
Checks if the file is a MP3
10,379
protected function leadMP4 ( ) { $ lead = $ this -> ffprobeFormat ( "mp4" , "m4a" ) ; if ( $ lead === true ) { if ( $ this -> ffprobeHasVideo ( ) !== false ) { return $ this -> closeCase ( "mp4" , "video/mp4" , $ this -> metadata ) ; } else if ( $ this -> ffprobeHasAudio ( ) !== false ) { return $ this -> closeCase ( "...
Checks if the file is a MP4 .
10,380
protected function leadMKA ( ) { $ lead = $ this -> ffprobeFormat ( "matroska" , "webm" ) ; if ( $ lead === true ) { if ( $ this -> ffprobeHasAudio ( ) !== false ) { return $ this -> closeCase ( "mka" , "audio/x-matroska" , $ this -> metadata ) ; } else { return false ; } } return null ; }
Checks if the file is a MKA .
10,381
protected function leadMKV ( ) { $ lead = $ this -> ffprobeFormat ( "matroska" , "webm" ) ; if ( $ lead === true ) { if ( $ this -> ffprobeHasVideo ( ) !== false ) { return $ this -> closeCase ( "mkv" , "video/x-matroska" , $ this -> metadata ) ; } else { return false ; } } return null ; }
Checks if the file is a MKV .
10,382
protected function leadWAV ( ) { $ lead = $ this -> ffprobeFormat ( "wav" ) ; if ( $ lead === true ) { return $ this -> closeCase ( "wav" , "audio/wave" , $ this -> metadata ) ; } return null ; }
Checks if the file is a WAV
10,383
public static function on ( ) { static :: fetchBinaries ( ) ; return ( empty ( static :: $ ffmpeg ) ? false : true ) && ( empty ( static :: $ ffprobe ) ? false : true ) ; }
Can the system run this Detective?
10,384
public function addMessage ( $ message , $ type ) { if ( ! is_string ( $ message ) ) { throw new \ InvalidArgumentException ( 'Message must be a string' ) ; } if ( ! $ message ) { throw new \ InvalidArgumentException ( 'Message can\'t be empty' ) ; } if ( ! is_string ( $ type ) ) { throw new \ InvalidArgumentException ...
Add a message to this message bag .
10,385
public static function write ( $ message , $ nl = true , $ quit = false ) { if ( \ is_array ( $ message ) ) { $ message = implode ( $ nl ? PHP_EOL : '' , $ message ) ; } self :: stdout ( self :: renderColor ( $ message ) , $ nl , $ quit ) ; }
write message to console
10,386
public function invalidate ( $ namespaceId ) { $ namespace = $ this -> fetch ( $ namespaceId ) ; if ( false === $ namespace ) { return false ; } $ newNamespace = rand ( 0 , 10000 ) ; while ( $ namespace === $ newNamespace ) { $ newNamespace = rand ( 0 , 10000 ) ; } return $ this -> save ( $ namespaceId , $ namespaceId ...
Invalidate a namespace .
10,387
public function findOrMakeAssetsFolder ( $ url , $ doWrite = true ) { $ owner = $ this -> owner ; $ dir = Folder :: find_or_make ( $ url ) ; $ owner -> AssetsFolderID = $ dir -> ID ; if ( $ doWrite ) { $ owner -> write ( ) ; } if ( $ owner -> ClassName == 'Subsite' ) { $ dir -> SubsiteID = $ owner -> ID ; $ dir -> writ...
Find or make assets folder called from onBeforeWrite .
10,388
public function getAssetsFolderDirName ( ) { if ( $ this -> owner -> getField ( 'AssetsFolderID' ) != 0 ) { $ dirObj = $ this -> owner -> AssetsFolder ( ) ; $ dirName = str_replace ( 'assets/' , '' , $ dirObj -> Filename ) ; return $ dirName ; } }
Name of the associated assets folder .
10,389
protected function assignDefaultValues ( ) { foreach ( $ this -> defaultValues as $ key => $ value ) { $ this -> model [ $ key ] = $ value ; } return true ; }
Assign default values to model .
10,390
protected function getPackageVersions ( $ id ) { $ localPackage = $ this -> get ( 'package.repository' ) -> findOneById ( $ id ) ; $ remotePackage = $ this -> get ( 'package.helper' ) -> getPackage ( $ localPackage -> getFullName ( ) ) ; $ versions = $ remotePackage -> getVersions ( ) ; $ result = [ ] ; foreach ( $ ver...
Returns version information for package
10,391
protected function getPackageInfo ( Version $ version , & $ result ) { $ date = new \ DateTime ( $ version -> getTime ( ) ) ; $ packageVersion = $ version -> getVersion ( ) ; if ( $ packageVersion === PackageHelperInterface :: DEFAULT_BRANCH_VERSION ) { $ result [ $ packageVersion ] = [ 'version' => $ packageVersion , ...
Adds information about single version to result array
10,392
public static function create ( $ password ) { if ( function_exists ( 'random_bytes' ) ) { $ salt = random_bytes ( self :: $ salt_byte_size ) ; } else if ( function_exists ( 'openssl_random_pseudo_bytes' ) ) { $ salt = openssl_random_pseudo_bytes ( self :: $ salt_byte_size ) ; } else if ( function_exists ( 'mcrypt_crea...
Creates the password hash that you would store for comparison . Make sure to check the size of the output when creating database tables to store this hash . The defaults produce a 94 char string . Changing the public static properties may affect the size of the hash returned .
10,393
public static function validate ( $ password , $ hash ) { $ params = explode ( ":" , $ hash ) ; if ( count ( $ params ) < 4 ) return false ; $ pbkdf2 = base64_decode ( $ params [ self :: $ hash_pbkdf2_index ] ) ; return self :: slowEquals ( $ pbkdf2 , self :: calculate ( $ params [ self :: $ hash_alogrithm_index ] , $ ...
Validates a password against its precalculated hash
10,394
public static function get ( $ name = null , $ default = null ) { $ queryParams = app ( ) -> request -> getQueryParams ( ) ; if ( is_null ( $ name ) ) { return $ queryParams ; } elseif ( isset ( $ queryParams [ $ name ] ) ) { return $ queryParams [ $ name ] ; } return $ default ; }
Retrieves GET parameter .
10,395
public static function delete ( $ name = null , $ default = null ) { $ parsedBody = app ( ) -> request -> getParsedBody ( ) ; if ( is_null ( $ name ) ) { return $ parsedBody ; } if ( isset ( $ parsedBody [ $ name ] ) ) { return $ parsedBody [ $ name ] ; } return $ default ; }
Retrieves DELETE parameter .
10,396
public static function files ( $ name = null ) { $ files = app ( ) -> request -> getUploadedFiles ( ) ; if ( is_null ( $ name ) ) { return $ files ; } if ( isset ( $ files [ $ name ] ) ) { return $ files [ $ name ] ; } return null ; }
Retrieves Uploaded Files .
10,397
protected function getStatsd ( InputInterface $ input ) { if ( null === $ this -> statsd ) { $ this -> statsdConnection = new UdpSocket ( $ input -> getOption ( 'statsd-host' ) , $ input -> getOption ( 'statsd-port' ) ) ; $ this -> statsd = new Client ( $ this -> statsdConnection , $ input -> getOption ( 'statsd-namesp...
Statically cache statsd client and return a statsd client
10,398
protected function getGauges ( $ config ) { if ( null === $ this -> gauges ) { $ this -> gauges = array ( ) ; foreach ( $ config as $ path => $ details ) { $ className = $ details [ 'class' ] ; if ( class_exists ( $ className ) ) { $ reflection = new \ ReflectionClass ( $ className ) ; if ( $ reflection -> getConstruct...
Instantiate selected gauges
10,399
public function actionCheckname ( ) { $ request = \ Yii :: $ app -> request ; if ( $ request -> getIsOptions ( ) ) { return $ this -> ResponseOptions ( $ this -> verbs ( ) [ 'checkname' ] ) ; } $ model = new BizRule ( null ) ; $ mo = $ model -> find ( Yii :: $ app -> request -> post ( ) [ 'BizRule' ] [ 'name' ] ) ; if ...
check is a new item