idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
52,600 | public function getOptions ( ) { $ options = [ 'trace' => $ this -> getTrace ( ) , 'cache_wsdl' => $ this -> getCache ( ) , 'classmap' => $ this -> getClassmap ( ) , ] ; if ( $ this -> certificate ) { $ options [ 'local_cert' ] = $ this -> certificate ; } $ this -> options = array_merge ( $ options , $ this -> options ... | Get the extra options |
52,601 | public function header ( $ namespace , $ name , $ data = null , $ mustUnderstand = false , $ actor = null ) { if ( $ actor ) { $ this -> headers [ ] = new SoapHeader ( $ namespace , $ name , $ data , $ mustUnderstand , $ actor ) ; } else { $ this -> headers [ ] = new SoapHeader ( $ namespace , $ name , $ data , $ mustU... | Create a new SoapHeader |
52,602 | public function getResponse ( $ template , $ filename ) { switch ( strtolower ( $ template ) ) { case 'original' : return $ this -> getOriginal ( $ filename ) ; case 'download' : return $ this -> getDownload ( $ filename ) ; default : return $ this -> getImage ( $ template , $ filename ) ; } } | Get HTTP response of either original image file or template applied file . |
52,603 | public function getImage ( $ template , $ filename ) { $ template = $ this -> getTemplate ( $ template ) ; $ path = $ this -> getImagePath ( $ filename ) ; $ manager = new ImageManager ( Config :: get ( 'image' ) ) ; $ content = $ manager -> cache ( function ( $ image ) use ( $ template , $ path ) { if ( $ template ins... | Get HTTP response of template applied image file |
52,604 | public function getOriginal ( $ filename ) { $ path = $ this -> getImagePath ( $ filename ) ; return $ this -> buildResponse ( file_get_contents ( $ path ) ) ; } | Get HTTP response of original image file |
52,605 | protected function getTemplate ( $ template ) { $ template = config ( "imagecache.templates.{$template}" ) ; switch ( true ) { case is_callable ( $ template ) : return $ template ; case class_exists ( $ template ) : return new $ template ; default : abort ( 404 ) ; break ; } } | Returns corresponding template object from given template name |
52,606 | protected function getImagePath ( $ filename ) { foreach ( config ( 'imagecache.paths' ) as $ path ) { $ image_path = $ path . '/' . str_replace ( '..' , '' , $ filename ) ; if ( file_exists ( $ image_path ) && is_file ( $ image_path ) ) { return $ image_path ; } } abort ( 404 ) ; } | Returns full image path from given filename |
52,607 | protected function isFile ( $ value ) { $ value = strval ( str_replace ( "\0" , "" , $ value ) ) ; return strlen ( $ value ) <= PHP_MAXPATHLEN && is_file ( $ value ) ; } | Checks if given data is file handles mixed input |
52,608 | protected function buildSerializableClosure ( \ Closure $ closure ) { switch ( true ) { case class_exists ( 'SuperClosure\\SerializableClosure' ) : return new \ SuperClosure \ SerializableClosure ( $ closure ) ; default : return new \ Jeremeamia \ SuperClosure \ SerializableClosure ( $ closure ) ; } } | Build SerializableClosure from Closure |
52,609 | public function process ( ) { $ this -> image = $ this -> manager ; foreach ( $ this -> getCalls ( ) as $ call ) { $ this -> processCall ( $ call ) ; } $ this -> image -> cachekey = $ this -> checksum ( ) ; $ this -> clearCalls ( ) ; $ this -> clearProperties ( ) ; return $ this -> image ; } | Process all saved image calls on Image object |
52,610 | private function hasSufficientPermissions ( AclInterface $ acl , array $ aces , array $ masks , array $ sids , $ administrativeMode ) { $ firstRejectedAce = null ; foreach ( $ masks as $ requiredMask ) { foreach ( $ sids as $ sid ) { foreach ( $ aces as $ ace ) { if ( $ sid -> equals ( $ ace -> getSecurityIdentity ( ) ... | Makes an authorization decision . |
52,611 | public function propertyChanged ( $ sender , $ propertyName , $ oldValue , $ newValue ) { if ( ! $ sender instanceof MutableAclInterface && ! $ sender instanceof EntryInterface ) { throw new \ InvalidArgumentException ( '$sender must be an instance of MutableAclInterface, or EntryInterface.' ) ; } if ( $ sender instanc... | Implementation of PropertyChangedListener . |
52,612 | public function updateUserSecurityIdentity ( UserSecurityIdentity $ usid , $ oldUsername ) { $ this -> connection -> executeQuery ( $ this -> getUpdateUserSecurityIdentitySql ( $ usid , $ oldUsername ) ) ; } | Updates a user security identity when the user s username changes . |
52,613 | protected function getInsertAccessControlEntrySql ( $ classId , $ objectIdentityId , $ field , $ aceOrder , $ securityIdentityId , $ strategy , $ mask , $ granting , $ auditSuccess , $ auditFailure ) { $ query = <<<QUERY INSERT INTO %s ( class_id, object_identity_id, ... | Constructs the SQL for inserting an ACE . |
52,614 | protected function getInsertObjectIdentitySql ( $ identifier , $ classId , $ entriesInheriting ) { $ query = <<<QUERY INSERT INTO %s (class_id, object_identifier, entries_inheriting) VALUES (%d, %s, %s)QUERY ; return sprintf ( $ query , $ this -> options [ 'oid_table_name' ] , $ classId , $ t... | Constructs the SQL for inserting an object identity . |
52,615 | protected function getInsertSecurityIdentitySql ( SecurityIdentityInterface $ sid ) { if ( $ sid instanceof UserSecurityIdentity ) { $ identifier = $ sid -> getClass ( ) . '-' . $ sid -> getUsername ( ) ; $ username = true ; } elseif ( $ sid instanceof RoleSecurityIdentity ) { $ identifier = $ sid -> getRole ( ) ; $ us... | Constructs the SQL for inserting a security identity . |
52,616 | protected function getSelectAccessControlEntryIdSql ( $ classId , $ oid , $ field , $ order ) { return sprintf ( 'SELECT id FROM %s WHERE class_id = %d AND %s AND %s AND ace_order = %d' , $ this -> options [ 'entry_table_name' ] , $ classId , null === $ oid ? $ this -> connection -> getDatabasePlatform ( ) -> getIsNull... | Constructs the SQL for selecting an ACE . |
52,617 | protected function getDeleteSecurityIdentityIdSql ( SecurityIdentityInterface $ sid ) { $ select = $ this -> getSelectSecurityIdentityIdSql ( $ sid ) ; $ delete = preg_replace ( '/^SELECT id FROM/' , 'DELETE FROM' , $ select ) ; return $ delete ; } | Constructs the SQL to delete a security identity . |
52,618 | protected function getUpdateObjectIdentitySql ( $ pk , array $ changes ) { if ( 0 === count ( $ changes ) ) { throw new \ InvalidArgumentException ( 'There are no changes.' ) ; } return sprintf ( 'UPDATE %s SET %s WHERE id = %d' , $ this -> options [ 'oid_table_name' ] , implode ( ', ' , $ changes ) , $ pk ) ; } | Constructs the SQL for updating an object identity . |
52,619 | protected function getUpdateUserSecurityIdentitySql ( UserSecurityIdentity $ usid , $ oldUsername ) { if ( $ usid -> getUsername ( ) == $ oldUsername ) { throw new \ InvalidArgumentException ( 'There are no changes.' ) ; } $ oldIdentifier = $ usid -> getClass ( ) . '-' . $ oldUsername ; $ newIdentifier = $ usid -> getC... | Constructs the SQL for updating a user security identity . |
52,620 | protected function getUpdateAccessControlEntrySql ( $ pk , array $ sets ) { if ( 0 === count ( $ sets ) ) { throw new \ InvalidArgumentException ( 'There are no changes.' ) ; } return sprintf ( 'UPDATE %s SET %s WHERE id = %d' , $ this -> options [ 'entry_table_name' ] , implode ( ', ' , $ sets ) , $ pk ) ; } | Constructs the SQL for updating an ACE . |
52,621 | private function createObjectIdentity ( ObjectIdentityInterface $ oid ) { $ classId = $ this -> createOrRetrieveClassId ( $ oid -> getType ( ) ) ; $ this -> connection -> executeQuery ( $ this -> getInsertObjectIdentitySql ( $ oid -> getIdentifier ( ) , $ classId , true ) ) ; } | Creates the ACL for the passed object identity . |
52,622 | private function createOrRetrieveClassId ( $ classType ) { if ( false !== $ id = $ this -> connection -> executeQuery ( $ this -> getSelectClassIdSql ( $ classType ) ) -> fetchColumn ( ) ) { return $ id ; } $ this -> connection -> executeQuery ( $ this -> getInsertClassSql ( $ classType ) ) ; return $ this -> connectio... | Returns the primary key for the passed class type . |
52,623 | private function createOrRetrieveSecurityIdentityId ( SecurityIdentityInterface $ sid ) { if ( false !== $ id = $ this -> connection -> executeQuery ( $ this -> getSelectSecurityIdentityIdSql ( $ sid ) ) -> fetchColumn ( ) ) { return $ id ; } $ this -> connection -> executeQuery ( $ this -> getInsertSecurityIdentitySql... | Returns the primary key for the passed security identity . |
52,624 | private function regenerateAncestorRelations ( AclInterface $ acl ) { $ pk = $ acl -> getId ( ) ; $ this -> connection -> executeQuery ( $ this -> getDeleteObjectIdentityRelationsSql ( $ pk ) ) ; $ this -> connection -> executeQuery ( $ this -> getInsertObjectIdentityRelationSql ( $ pk , $ pk ) ) ; $ parentAcl = $ acl ... | This regenerates the ancestor table which is used for fast read access . |
52,625 | private function updateAces ( \ SplObjectStorage $ aces ) { foreach ( $ aces as $ ace ) { $ this -> updateAce ( $ aces , $ ace ) ; } } | Persists the changes which were made to ACEs to the database . |
52,626 | private function getDataKeyByIdentity ( ObjectIdentityInterface $ oid ) { return $ this -> prefix . md5 ( $ oid -> getType ( ) ) . sha1 ( $ oid -> getType ( ) ) . '_' . md5 ( $ oid -> getIdentifier ( ) ) . sha1 ( $ oid -> getIdentifier ( ) ) ; } | Returns the key for the object identity . |
52,627 | private function deleteAce ( $ property , $ index ) { $ aces = & $ this -> $ property ; if ( ! isset ( $ aces [ $ index ] ) ) { throw new \ OutOfBoundsException ( sprintf ( 'The index "%d" does not exist.' , $ index ) ) ; } $ oldValue = $ this -> $ property ; unset ( $ aces [ $ index ] ) ; $ this -> $ property = array_... | Deletes an ACE . |
52,628 | private function deleteFieldAce ( $ property , $ index , $ field ) { $ aces = & $ this -> $ property ; if ( ! isset ( $ aces [ $ field ] [ $ index ] ) ) { throw new \ OutOfBoundsException ( sprintf ( 'The index "%d" does not exist.' , $ index ) ) ; } $ oldValue = $ this -> $ property ; unset ( $ aces [ $ field ] [ $ in... | Deletes a field - based ACE . |
52,629 | private function insertAce ( $ property , $ index , $ mask , SecurityIdentityInterface $ sid , $ granting , $ strategy = null ) { if ( $ index < 0 || $ index > count ( $ this -> $ property ) ) { throw new \ OutOfBoundsException ( sprintf ( 'The index must be in the interval [0, %d].' , count ( $ this -> $ property ) ) ... | Inserts an ACE . |
52,630 | private function insertFieldAce ( $ property , $ index , $ field , $ mask , SecurityIdentityInterface $ sid , $ granting , $ strategy = null ) { if ( 0 === strlen ( $ field ) ) { throw new \ InvalidArgumentException ( '$field cannot be empty.' ) ; } if ( ! is_int ( $ mask ) ) { throw new \ InvalidArgumentException ( '$... | Inserts a field - based ACE . |
52,631 | private function updateAce ( $ property , $ index , $ mask , $ strategy = null ) { $ aces = & $ this -> $ property ; if ( ! isset ( $ aces [ $ index ] ) ) { throw new \ OutOfBoundsException ( sprintf ( 'The index "%d" does not exist.' , $ index ) ) ; } $ ace = $ aces [ $ index ] ; if ( $ mask !== $ oldMask = $ ace -> g... | Updates an ACE . |
52,632 | private function updateAuditing ( array & $ aces , $ index , $ auditSuccess , $ auditFailure ) { if ( ! isset ( $ aces [ $ index ] ) ) { throw new \ OutOfBoundsException ( sprintf ( 'The index "%d" does not exist.' , $ index ) ) ; } if ( $ auditSuccess !== $ aces [ $ index ] -> isAuditSuccess ( ) ) { $ this -> onEntryP... | Updates auditing for an ACE . |
52,633 | private function updateFieldAce ( $ property , $ index , $ field , $ mask , $ strategy = null ) { if ( 0 === strlen ( $ field ) ) { throw new \ InvalidArgumentException ( '$field cannot be empty.' ) ; } $ aces = & $ this -> $ property ; if ( ! isset ( $ aces [ $ field ] [ $ index ] ) ) { throw new \ OutOfBoundsExceptio... | Updates a field - based ACE . |
52,634 | private function onPropertyChanged ( $ name , $ oldValue , $ newValue ) { foreach ( $ this -> listeners as $ listener ) { $ listener -> propertyChanged ( $ this , $ name , $ oldValue , $ newValue ) ; } } | Called when a property of the ACL changes . |
52,635 | private function onEntryPropertyChanged ( EntryInterface $ entry , $ name , $ oldValue , $ newValue ) { foreach ( $ this -> listeners as $ listener ) { $ listener -> propertyChanged ( $ entry , $ name , $ oldValue , $ newValue ) ; } } | Called when a property of an ACE associated with this ACL changes . |
52,636 | protected function getFindChildrenSql ( ObjectIdentityInterface $ oid , $ directChildrenOnly ) { if ( false === $ directChildrenOnly ) { $ query = <<<FINDCHILDREN SELECT o.object_identifier, c.class_type FROM {$this->options['oid_table_name']} o INNER JOI... | Constructs the SQL for retrieving child object identities for the given object identities . |
52,637 | protected function getSelectObjectIdentityIdSql ( ObjectIdentityInterface $ oid ) { $ query = <<<QUERY SELECT o.id FROM %s o INNER JOIN %s c ON c.id = o.class_id WHERE o.object_identifier = %s AND c.class_type = %sQUERY ; return sprintf ( $ query , $ this -> options [ 'oid_t... | Constructs the SQL for retrieving the primary key of the given object identity . |
52,638 | final protected function retrieveObjectIdentityPrimaryKey ( ObjectIdentityInterface $ oid ) { return $ this -> connection -> executeQuery ( $ this -> getSelectObjectIdentityIdSql ( $ oid ) ) -> fetchColumn ( ) ; } | Returns the primary key of the passed object identity . |
52,639 | private function updateAceIdentityMap ( AclInterface $ acl ) { foreach ( array ( 'classAces' , 'classFieldAces' , 'objectAces' , 'objectFieldAces' ) as $ property ) { $ reflection = new \ ReflectionProperty ( $ acl , $ property ) ; $ reflection -> setAccessible ( true ) ; $ value = $ reflection -> getValue ( $ acl ) ; ... | This method is called when an ACL instance is retrieved from the cache . |
52,640 | private function getAncestorIds ( array $ batch ) { $ sql = $ this -> getAncestorLookupSql ( $ batch ) ; $ ancestorIds = array ( ) ; foreach ( $ this -> connection -> executeQuery ( $ sql ) -> fetchAll ( ) as $ data ) { $ ancestorIds [ ] = reset ( $ data ) ; } return $ ancestorIds ; } | Retrieves all the ids which need to be queried from the database including the ids of parent ACLs . |
52,641 | private function doUpdateAceIdentityMap ( array & $ aces ) { foreach ( $ aces as $ index => $ ace ) { if ( isset ( $ this -> loadedAces [ $ ace -> getId ( ) ] ) ) { $ aces [ $ index ] = $ this -> loadedAces [ $ ace -> getId ( ) ] ; } else { $ this -> loadedAces [ $ ace -> getId ( ) ] = $ ace ; } } } | Does either overwrite the passed ACE or saves it in the global identity map to ensure every ACE only gets instantiated once . |
52,642 | private function lookupObjectIdentities ( array $ batch , array $ sids , array $ oidLookup ) { $ ancestorIds = $ this -> getAncestorIds ( $ batch ) ; if ( ! $ ancestorIds ) { throw new AclNotFoundException ( 'There is no ACL for the given object identity.' ) ; } $ sql = $ this -> getLookupSql ( $ ancestorIds ) ; $ stmt... | This method is called for object identities which could not be retrieved from the cache and for which thus a database query is required . |
52,643 | public function logIfNeeded ( $ granted , EntryInterface $ ace ) { if ( ! $ ace instanceof AuditableEntryInterface ) { return ; } if ( $ granted && $ ace -> isAuditSuccess ( ) ) { $ this -> doLog ( $ granted , $ ace ) ; } elseif ( ! $ granted && $ ace -> isAuditFailure ( ) ) { $ this -> doLog ( $ granted , $ ace ) ; } ... | Performs some checks if logging was requested . |
52,644 | public function cache ( $ collection , array $ tokens = array ( ) ) { $ sids = array ( ) ; foreach ( $ tokens as $ token ) { $ sids = array_merge ( $ sids , $ this -> securityIdentityRetrievalStrategy -> getSecurityIdentities ( $ token ) ) ; } $ oids = array ( ) ; foreach ( $ collection as $ domainObject ) { $ oids [ ]... | Batch loads ACLs for an entire collection ; thus it reduces the number of required queries considerably . |
52,645 | public function addToSchema ( BaseSchema $ schema ) { foreach ( $ this -> getTables ( ) as $ table ) { $ schema -> _addTable ( $ table ) ; } foreach ( $ this -> getSequences ( ) as $ sequence ) { $ schema -> _addSequence ( $ sequence ) ; } } | Merges ACL schema with the given schema . |
52,646 | protected function addClassTable ( ) { $ table = $ this -> createTable ( $ this -> options [ 'class_table_name' ] ) ; $ table -> addColumn ( 'id' , 'integer' , array ( 'unsigned' => true , 'autoincrement' => true ) ) ; $ table -> addColumn ( 'class_type' , 'string' , array ( 'length' => 200 ) ) ; $ table -> setPrimaryK... | Adds the class table to the schema . |
52,647 | protected function addEntryTable ( ) { $ table = $ this -> createTable ( $ this -> options [ 'entry_table_name' ] ) ; $ table -> addColumn ( 'id' , 'integer' , array ( 'unsigned' => true , 'autoincrement' => true ) ) ; $ table -> addColumn ( 'class_id' , 'integer' , array ( 'unsigned' => true ) ) ; $ table -> addColumn... | Adds the entry table to the schema . |
52,648 | protected function addObjectIdentitiesTable ( ) { $ table = $ this -> createTable ( $ this -> options [ 'oid_table_name' ] ) ; $ table -> addColumn ( 'id' , 'integer' , array ( 'unsigned' => true , 'autoincrement' => true ) ) ; $ table -> addColumn ( 'class_id' , 'integer' , array ( 'unsigned' => true ) ) ; $ table -> ... | Adds the object identity table to the schema . |
52,649 | protected function addObjectIdentityAncestorsTable ( ) { $ table = $ this -> createTable ( $ this -> options [ 'oid_ancestors_table_name' ] ) ; $ table -> addColumn ( 'object_identity_id' , 'integer' , array ( 'unsigned' => true ) ) ; $ table -> addColumn ( 'ancestor_id' , 'integer' , array ( 'unsigned' => true ) ) ; $... | Adds the object identity relation table to the schema . |
52,650 | public static function fromInvalidCallable ( array $ inProgressMakes , $ callableOrMethodStr , \ Exception $ previous = null ) { $ callableString = null ; if ( is_string ( $ callableOrMethodStr ) ) { $ callableString .= $ callableOrMethodStr ; } else if ( is_array ( $ callableOrMethodStr ) && array_key_exists ( 0 , $ c... | Add a human readable version of the invalid callable to the standard invalid invokable message . |
52,651 | public function define ( $ name , array $ args ) { list ( , $ normalizedName ) = $ this -> resolveAlias ( $ name ) ; $ this -> classDefinitions [ $ normalizedName ] = $ args ; return $ this ; } | Define instantiation directives for the specified class |
52,652 | public function storeContents ( $ directory , array $ contents , $ recursive = false ) { $ directories = [ $ directory ] ; foreach ( $ contents as $ object ) { $ this -> updateObject ( $ object [ 'path' ] , $ object ) ; $ object = $ this -> cache [ $ object [ 'path' ] ] ; if ( $ recursive && $ this -> pathIsInDirectory... | Store the contents listing . |
52,653 | public function updateObject ( $ path , array $ object , $ autosave = false ) { if ( ! $ this -> has ( $ path ) ) { $ this -> cache [ $ path ] = Util :: pathinfo ( $ path ) ; } $ this -> cache [ $ path ] = array_merge ( $ this -> cache [ $ path ] , $ object ) ; if ( $ autosave ) { $ this -> autosave ( ) ; } $ this -> e... | Update the metadata for an object . |
52,654 | public function listContents ( $ dirname = '' , $ recursive = false ) { $ result = [ ] ; foreach ( $ this -> cache as $ object ) { if ( $ object === false ) { continue ; } if ( $ object [ 'dirname' ] === $ dirname ) { $ result [ ] = $ object ; } elseif ( $ recursive && $ this -> pathIsInDirectory ( $ dirname , $ object... | Get the contents listing . |
52,655 | public function cleanContents ( array $ contents ) { $ cachedProperties = array_flip ( [ 'path' , 'dirname' , 'basename' , 'extension' , 'filename' , 'size' , 'mimetype' , 'visibility' , 'timestamp' , 'type' , ] ) ; foreach ( $ contents as $ path => $ object ) { if ( is_array ( $ object ) ) { $ contents [ $ path ] = ar... | Filter the contents from a listing . |
52,656 | public function setFromStorage ( $ json ) { list ( $ cache , $ complete ) = json_decode ( $ json , true ) ; if ( json_last_error ( ) === JSON_ERROR_NONE && is_array ( $ cache ) && is_array ( $ complete ) ) { $ this -> cache = $ cache ; $ this -> complete = $ complete ; } } | Load from serialized cache data . |
52,657 | public function ensureParentDirectories ( $ path ) { $ object = $ this -> cache [ $ path ] ; while ( $ object [ 'dirname' ] !== '' && ! isset ( $ this -> cache [ $ object [ 'dirname' ] ] ) ) { $ object = Util :: pathinfo ( $ object [ 'dirname' ] ) ; $ object [ 'type' ] = 'dir' ; $ this -> cache [ $ object [ 'path' ] ] ... | Ensure parent directories of an object . |
52,658 | protected function executeCommand ( $ name , array $ arguments ) { $ command = $ this -> client -> createCommand ( $ name , $ arguments ) ; return $ this -> client -> executeCommand ( $ command ) ; } | Execute a Predis command . |
52,659 | protected function callWithFallback ( $ property , $ path , $ method ) { $ result = $ this -> cache -> { $ method } ( $ path ) ; if ( $ result !== false && ( $ property === null || array_key_exists ( $ property , $ result ) ) ) { return $ result ; } $ result = $ this -> adapter -> { $ method } ( $ path ) ; if ( $ resul... | Call a method and cache the response . |
52,660 | public function getModelAttributes ( ) { $ attributes = $ this -> getModel ( ) -> getAttributes ( ) ; foreach ( $ attributes as $ key => $ value ) { if ( in_array ( $ key , $ this -> getDates ( ) ) || $ this -> isDateCastable ( $ key ) ) { $ attributes [ $ key ] = $ value ; continue ; } $ attributes [ $ key ] = $ this ... | Get the casted model attributes . |
52,661 | public function forceSave ( array $ options = [ ] ) { $ currentValidatingSetting = $ this -> getValidating ( ) ; $ this -> setValidating ( false ) ; $ result = $ this -> getModel ( ) -> save ( $ options ) ; $ this -> setValidating ( $ currentValidatingSetting ) ; return $ result ; } | Force the model to be saved without undergoing validation . |
52,662 | protected function makeValidator ( $ rules = [ ] ) { $ attributes = $ this -> getModelAttributes ( ) ; if ( $ this -> getInjectUniqueIdentifier ( ) ) { $ rules = $ this -> injectUniqueIdentifierToRules ( $ rules ) ; } $ messages = $ this -> getValidationMessages ( ) ; $ validator = $ this -> getValidator ( ) -> make ( ... | Make a Validator instance for a given ruleset . |
52,663 | protected function performValidation ( $ rules = [ ] ) { $ validation = $ this -> makeValidator ( $ rules ) ; $ result = $ validation -> passes ( ) ; $ this -> setErrors ( $ validation -> messages ( ) ) ; return $ result ; } | Validate the model against it s rules returning whether or not it passes and setting the error messages on the model if required . |
52,664 | protected function injectUniqueIdentifierToRules ( array $ rules ) { foreach ( $ rules as $ field => & $ ruleset ) { $ ruleset = is_string ( $ ruleset ) ? explode ( '|' , $ ruleset ) : $ ruleset ; foreach ( $ ruleset as & $ rule ) { if ( is_string ( $ rule ) ) { $ parameters = explode ( ':' , $ rule ) ; $ validationRul... | If the model already exists and it has unique validations it is going to fail validation unless we also pass it s primary key to the rule so that it may be ignored . |
52,665 | protected function getUniqueIdentifierInjectorMethod ( $ validationRule ) { $ method = 'prepare' . studly_case ( $ validationRule ) . 'Rule' ; return method_exists ( $ this , $ method ) ? $ method : false ; } | Get the dynamic method name for a unique identifier injector rule if it exists otherwise return false . |
52,666 | protected function prepareUniqueWithRule ( $ parameters , $ field ) { if ( $ this -> exists ) { if ( count ( $ parameters ) < 3 || ! preg_match ( '/^\d+(\s?=\s?\w*)?$/' , last ( $ parameters ) ) ) { $ parameters [ ] = $ this -> getModel ( ) -> getKey ( ) ; } } return 'unique_with:' . implode ( ',' , $ parameters ) ; } | Prepare a unique_with rule adding the model identifier if required . |
52,667 | protected function performValidation ( Model $ model , $ event ) { if ( $ model -> getValidating ( ) ) { if ( $ this -> fireValidatingEvent ( $ model , $ event ) !== null ) { return ; } if ( $ model -> isValid ( ) === false ) { $ this -> fireValidatedEvent ( $ model , 'failed' ) ; if ( $ model -> getThrowValidationExce... | Perform validation with the specified ruleset . |
52,668 | protected function prepareUniqueRule ( $ parameters , $ field ) { if ( empty ( $ parameters [ 0 ] ) ) { $ parameters [ 0 ] = $ this -> getModel ( ) -> getTable ( ) ; } if ( ( strpos ( $ parameters [ 0 ] , '.' ) === false ) && ( ( $ connectionName = $ this -> getModel ( ) -> getConnectionName ( ) ) !== null ) ) { $ para... | Prepare a unique rule adding the table name column and model identifier if required . |
52,669 | public function get_language ( ) { if ( $ return = $ this -> get_channel_tags ( SIMPLEPIE_NAMESPACE_RSS_20 , 'language' ) ) { return $ this -> sanitize ( $ return [ 0 ] [ 'data' ] , SIMPLEPIE_CONSTRUCT_TEXT ) ; } elseif ( $ return = $ this -> get_channel_tags ( SIMPLEPIE_NAMESPACE_DC_11 , 'language' ) ) { return $ this... | Get the language for the feed |
52,670 | public function get_image_title ( ) { if ( $ return = $ this -> get_image_tags ( SIMPLEPIE_NAMESPACE_RSS_10 , 'title' ) ) { return $ this -> sanitize ( $ return [ 0 ] [ 'data' ] , SIMPLEPIE_CONSTRUCT_TEXT ) ; } elseif ( $ return = $ this -> get_image_tags ( SIMPLEPIE_NAMESPACE_RSS_090 , 'title' ) ) { return $ this -> s... | Get the feed logo s title |
52,671 | public function get_image_height ( ) { if ( $ return = $ this -> get_image_tags ( SIMPLEPIE_NAMESPACE_RSS_20 , 'height' ) ) { return round ( $ return [ 0 ] [ 'data' ] ) ; } elseif ( $ this -> get_type ( ) & SIMPLEPIE_TYPE_RSS_SYNDICATION && $ this -> get_image_tags ( SIMPLEPIE_NAMESPACE_RSS_20 , 'url' ) ) { return 31.0... | Get the feed logo s height |
52,672 | public function get_item_quantity ( $ max = 0 ) { $ max = ( int ) $ max ; $ qty = count ( $ this -> get_items ( ) ) ; if ( $ max === 0 ) { return $ qty ; } return ( $ qty > $ max ) ? $ max : $ qty ; } | Get the number of items in the feed |
52,673 | public function get_item ( $ key = 0 ) { $ items = $ this -> get_items ( ) ; if ( isset ( $ items [ $ key ] ) ) { return $ items [ $ key ] ; } return null ; } | Get a single item from the feed |
52,674 | public function unlink ( ) { if ( $ this -> mysql === null ) { return false ; } $ query = $ this -> mysql -> prepare ( 'DELETE FROM `' . $ this -> options [ 'extras' ] [ 'prefix' ] . 'cache_data` WHERE `id` = :id' ) ; $ query -> bindValue ( ':id' , $ this -> id ) ; $ query2 = $ this -> mysql -> prepare ( 'DELETE FROM `... | Remove the cache |
52,675 | public function get_hash ( $ key = 0 ) { $ hashes = $ this -> get_hashes ( ) ; if ( isset ( $ hashes [ $ key ] ) ) { return $ hashes [ $ key ] ; } return null ; } | Get a single hash |
52,676 | public function get_keyword ( $ key = 0 ) { $ keywords = $ this -> get_keywords ( ) ; if ( isset ( $ keywords [ $ key ] ) ) { return $ keywords [ $ key ] ; } return null ; } | Get a single keyword |
52,677 | public function get_rating ( $ key = 0 ) { $ ratings = $ this -> get_ratings ( ) ; if ( isset ( $ ratings [ $ key ] ) ) { return $ ratings [ $ key ] ; } return null ; } | Get a single rating |
52,678 | public function get_restriction ( $ key = 0 ) { $ restrictions = $ this -> get_restrictions ( ) ; if ( isset ( $ restrictions [ $ key ] ) ) { return $ restrictions [ $ key ] ; } return null ; } | Get a single restriction |
52,679 | public function get_thumbnail ( $ key = 0 ) { $ thumbnails = $ this -> get_thumbnails ( ) ; if ( isset ( $ thumbnails [ $ key ] ) ) { return $ thumbnails [ $ key ] ; } return null ; } | Get a single thumbnail |
52,680 | function encode ( $ decoded , $ one_time_encoding = false ) { switch ( $ one_time_encoding ? $ one_time_encoding : $ this -> _api_encoding ) { case 'utf8' : $ decoded = $ this -> _utf8_to_ucs4 ( $ decoded ) ; break ; case 'ucs4_string' : $ decoded = $ this -> _ucs4_string_to_ucs4 ( $ decoded ) ; case 'ucs4_array' : bre... | Encode a given UTF - 8 domain name |
52,681 | function _ucs4_to_ucs4_string ( $ input ) { $ output = '' ; foreach ( $ input as $ v ) { $ output .= chr ( ( $ v >> 24 ) & 255 ) . chr ( ( $ v >> 16 ) & 255 ) . chr ( ( $ v >> 8 ) & 255 ) . chr ( $ v & 255 ) ; } return $ output ; } | Convert UCS - 4 array into UCS - 4 string |
52,682 | public function get_copyright ( ) { if ( $ return = $ this -> get_item_tags ( SIMPLEPIE_NAMESPACE_ATOM_10 , 'rights' ) ) { return $ this -> sanitize ( $ return [ 0 ] [ 'data' ] , $ this -> registry -> call ( 'Misc' , 'atom_10_construct_type' , array ( $ return [ 0 ] [ 'attribs' ] ) ) , $ this -> get_base ( $ return [ 0... | Get the copyright info for the item |
52,683 | public function get_permalink ( ) { $ link = $ this -> get_link ( ) ; $ enclosure = $ this -> get_enclosure ( 0 ) ; if ( $ link !== null ) { return $ link ; } elseif ( $ enclosure !== null ) { return $ enclosure -> get_link ( ) ; } return null ; } | Get the permalink for the item |
52,684 | public static function get_build ( ) { $ root = dirname ( dirname ( __FILE__ ) ) ; if ( file_exists ( $ root . '/.git/index' ) ) { return filemtime ( $ root . '/.git/index' ) ; } elseif ( file_exists ( $ root . '/SimplePie' ) ) { $ time = 0 ; foreach ( glob ( $ root . '/SimplePie/*.php' ) as $ file ) { if ( ( $ mtime =... | Get the SimplePie build timestamp |
52,685 | public static function compress ( $ ip ) { $ ip = self :: uncompress ( $ ip ) ; $ ip_parts = self :: split_v6_v4 ( $ ip ) ; $ ip_parts [ 0 ] = preg_replace ( '/(^|:)0+([0-9])/' , '\1\2' , $ ip_parts [ 0 ] ) ; if ( preg_match_all ( '/(?:^|:)(?:0(?::|$))+/' , $ ip_parts [ 0 ] , $ matches , PREG_OFFSET_CAPTURE ) ) { $ max... | Compresses an IPv6 address |
52,686 | public static function absolutize ( $ base , $ relative ) { if ( ! ( $ relative instanceof SimplePie_IRI ) ) { $ relative = new SimplePie_IRI ( $ relative ) ; } if ( ! $ relative -> is_valid ( ) ) { return false ; } elseif ( $ relative -> scheme !== null ) { return clone $ relative ; } else { if ( ! ( $ base instanceof... | Create a new IRI object by resolving a relative IRI |
52,687 | protected function get_authority ( ) { $ iauthority = $ this -> get_iauthority ( ) ; if ( is_string ( $ iauthority ) ) return $ this -> to_uri ( $ iauthority ) ; return $ iauthority ; } | Get the complete authority |
52,688 | private function encryptBlock ( $ input , $ key ) { if ( ! $ input && ! $ key ) { return '' ; } $ this -> prepareCipher ( $ key ) ; $ result = mcrypt_generic ( $ this -> mcrypt , $ input ) ; mcrypt_generic_deinit ( $ this -> mcrypt ) ; return $ result ; } | Encrypts a block using the suppied key |
52,689 | private function decryptBlock ( $ input , $ key ) { if ( ! $ input && ! $ key ) { return '' ; } $ this -> prepareCipher ( $ key ) ; $ result = mdecrypt_generic ( $ this -> mcrypt , $ input ) ; mcrypt_generic_deinit ( $ this -> mcrypt ) ; return $ result ; } | Derypts a block using the suppied key |
52,690 | public function mix ( array $ parts ) { if ( empty ( $ parts ) ) { return '' ; } $ len = Util :: safeStrlen ( $ parts [ 0 ] ) ; $ parts = $ this -> normalizeParts ( $ parts ) ; $ stringSize = count ( $ parts [ 0 ] ) ; $ partsSize = count ( $ parts ) ; $ result = '' ; $ offset = 0 ; for ( $ i = 0 ; $ i < $ stringSize ; ... | Mix the provided array of strings into a single output of the same size |
52,691 | protected function normalizeParts ( array $ parts ) { $ blockSize = $ this -> getPartSize ( ) ; $ callback = function ( $ value ) { return Util :: safeStrlen ( $ value ) ; } ; $ maxSize = max ( array_map ( $ callback , $ parts ) ) ; if ( $ maxSize % $ blockSize != 0 ) { $ maxSize += $ blockSize - ( $ maxSize % $ blockS... | Normalize the part array and split it block part size . |
52,692 | public function generateInt ( $ min = 0 , $ max = PHP_INT_MAX ) { $ tmp = ( int ) max ( $ max , $ min ) ; $ min = ( int ) min ( $ max , $ min ) ; $ max = $ tmp ; $ range = $ max - $ min ; if ( $ range == 0 ) { return $ max ; } elseif ( $ range > PHP_INT_MAX || is_float ( $ range ) || $ range < 0 ) { throw new \ RangeEx... | Generate a random integer with the given range |
52,693 | public function generateString ( $ length , $ characters = '' ) { if ( is_int ( $ characters ) ) { $ characters = $ this -> expandCharacterSets ( $ characters ) ; } if ( $ length == 0 || strlen ( $ characters ) == 1 ) { return '' ; } elseif ( empty ( $ characters ) ) { $ characters = $ this -> expandCharacterSets ( sel... | Generate a random string of specified length . |
52,694 | protected function expandCharacterSets ( $ spec ) { $ combined = '' ; if ( $ spec == self :: EASY_TO_READ ) { $ spec |= self :: CHAR_ALNUM ; } foreach ( $ this -> charArrays as $ flag => $ chars ) { if ( $ flag == self :: EASY_TO_READ ) { continue ; } if ( ( $ spec & $ flag ) === $ flag ) { $ combined .= $ chars ; } } ... | Expand a character set bitwise spec into a string character set |
52,695 | public function getGenerator ( \ SecurityLib \ Strength $ strength ) { $ sources = $ this -> findSources ( $ strength ) ; $ mixer = $ this -> findMixer ( $ strength ) ; return new Generator ( $ sources , $ mixer ) ; } | Get a generator for the requested strength |
52,696 | protected function findSources ( \ SecurityLib \ Strength $ strength ) { $ sources = array ( ) ; foreach ( $ this -> getSources ( ) as $ source ) { if ( $ strength -> compare ( $ source :: getStrength ( ) ) <= 0 && $ source :: isSupported ( ) ) { $ sources [ ] = new $ source ( ) ; } } if ( 0 === count ( $ sources ) ) {... | Find a sources based upon the requested strength |
52,697 | protected function findMixer ( \ SecurityLib \ Strength $ strength ) { $ newMixer = null ; $ fallback = null ; foreach ( $ this -> getMixers ( ) as $ mixer ) { if ( ! $ mixer :: test ( ) ) { continue ; } if ( $ strength -> compare ( $ mixer :: getStrength ( ) ) == 0 ) { $ newMixer = new $ mixer ( ) ; } elseif ( $ stren... | Find a mixer based upon the requested strength |
52,698 | public static function getStrength ( ) { if ( PHP_VERSION_ID >= 50612 ) { return new Strength ( Strength :: HIGH ) ; } if ( PHP_VERSION_ID >= 50528 && PHP_VERSION_ID < 50600 ) { return new Strength ( Strength :: HIGH ) ; } if ( PHP_VERSION_ID >= 50444 && PHP_VERSION_ID < 50500 ) { return new Strength ( Strength :: HIGH... | Return an instance of Strength indicating the strength of the source |
52,699 | private function getPointcut ( ) : Pointcut { if ( ! $ this -> pointcut ) { $ this -> pointcut = $ this -> container -> getPointcut ( $ this -> pointcutId ) ; } return $ this -> pointcut ; } | Returns a real pointcut from the container |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.