idx
int64 0
60.3k
| question
stringlengths 64
4.24k
| target
stringlengths 5
618
|
|---|---|---|
60,000
|
public function isAccessible ( ) { $ root = $ this -> getRootParagraph ( ) ; if ( ! empty ( $ root -> allAccess ) ) { return true ; } $ user = $ this -> getAuthenticatedUser ( ) ; if ( empty ( $ user ) ) { return ! empty ( $ root -> accessUsers ) && in_array ( '' , $ root -> accessUsers ) || ! empty ( $ root -> accessGroups ) && in_array ( '' , $ root -> accessGroups ) ; } return ! empty ( $ root -> accessUsers ) && in_array ( $ user -> id , $ root -> accessUsers ) || ! empty ( $ root -> accessGroups ) && in_array ( $ user -> groupId , $ root -> accessGroups ) || $ this -> getServiceLocator ( ) -> get ( 'Grid\User\Model\Permissions\Model' ) -> isAllowed ( $ root , 'view' ) ; }
|
Is accessible for the logged - in user
|
60,001
|
public function isDeletable ( ) { $ user = $ this -> getAuthenticatedUser ( ) ; if ( empty ( $ user ) ) { return false ; } $ root = $ this -> getRootParagraph ( ) ; return ! empty ( $ root -> editUsers ) && in_array ( $ user -> id , $ root -> editUsers ) || ! empty ( $ root -> editGroups ) && in_array ( $ user -> groupId , $ root -> editGroups ) || $ this -> getServiceLocator ( ) -> get ( 'Grid\User\Model\Permissions\Model' ) -> isAllowed ( $ root , $ this -> id == $ this -> rootId ? 'delete' : 'edit' ) ; }
|
Is editable for the logged - in user
|
60,002
|
public static function camelize ( $ name ) { if ( ! isset ( self :: $ camelizeCache [ $ name ] ) ) { $ camelizedName = ucwords ( str_replace ( '_' , ' ' , $ name ) ) ; $ camelizedName = str_replace ( ' ' , '' , $ camelizedName ) ; self :: $ camelizeCache [ $ name ] = $ camelizedName ; if ( ! isset ( self :: $ underscoreCache [ $ camelizedName ] ) ) { self :: $ underscoreCache [ $ camelizedName ] = $ name ; } } return self :: $ camelizeCache [ $ name ] ; }
|
Camelize the given name
|
60,003
|
public static function underscore ( $ name ) { if ( ! isset ( self :: $ underscoreCache [ $ name ] ) ) { $ underscoreName = strtolower ( preg_replace ( '/(\B)([A-Z])/' , '$1_$2' , $ name ) ) ; self :: $ underscoreCache [ $ name ] = $ underscoreName ; if ( ! isset ( self :: $ camelizeCache [ $ underscoreName ] ) ) { self :: $ camelizeCache [ $ underscoreName ] = $ name ; } } return self :: $ underscoreCache [ $ name ] ; }
|
Convert a camelized name to underscored name
|
60,004
|
public static function realpath ( $ path ) { if ( preg_match ( '~^[a-z0-9-_.]+://~' , $ path ) ) { $ stats = ( file_exists ( $ path ) ) ? stat ( $ path ) : false ; if ( $ stats && isset ( $ stats [ 'realpath' ] ) ) { return $ stats [ 'realpath' ] ; } return ( $ stats !== false ) ? $ path : false ; } return realpath ( $ path ) ; }
|
Resolve realpath from streams
|
60,005
|
public static function setOptions ( $ object , $ options ) { if ( ! is_array ( $ options ) || ( $ options instanceof \ Traversable ) ) { throw new exception \ InvalidArgumentException ( '$options must be an array or implement the Traversable interface.' ) ; } foreach ( $ options as $ key => $ value ) { $ method = 'set' . static :: camelize ( $ key ) ; if ( ! is_callable ( array ( $ object , $ method ) ) ) { continue ; } $ object -> $ method ( $ value ) ; } }
|
Set toptions to object
|
60,006
|
public function getBaseHash ( ) { $ hashids = new Hashids \ Hashids ( Yii :: app ( ) -> params [ 'encryptionKey' ] , 8 ) ; $ id = $ hashids -> encode ( $ this -> base62toDec ( Yii :: app ( ) -> params [ 'encryptionKey' ] ) ) ; return $ id ; }
|
Converts the encryption key into an integer via base64todec then transforms that into a unique ID via HashIds
|
60,007
|
public static function registerSettings ( ) { if ( ! Gate :: allows ( 'settings_read' ) ) { return ; } Agencms :: appendRoute ( Route :: load ( 'settings' ) -> addGroup ( Group :: full ( 'Site' ) -> key ( 'site' ) -> addField ( Field :: string ( 'title' , 'Website Title' ) , Field :: string ( 'title_prefix' , 'Title Prefix' ) , Field :: string ( 'title_suffix' , 'Title Suffix' ) ) ) -> addGroup ( Group :: full ( 'Analytics' ) -> key ( 'analytics' ) -> addField ( Field :: string ( 'ga_code' , 'Google Analytics Id' ) ) ) ) ; }
|
Append the general settings with additional settings for the Pages plugin
|
60,008
|
public function getLastName ( ) : ? string { if ( ! $ this -> hasLastName ( ) ) { $ this -> setLastName ( $ this -> getDefaultLastName ( ) ) ; } return $ this -> lastName ; }
|
Get last name
|
60,009
|
protected function buildParameterPattern ( string $ key ) : string { return '(' . str_replace ( '~' , '\\~' , $ this -> parameterPattern [ $ key ] ?? self :: ALLOWED_CHARS ) . ')' ; }
|
Returns the pattern a variable in the URI path must match .
|
60,010
|
public function buildRoutePattern ( ) { $ path = $ this -> prefix ? rtrim ( $ this -> prefix . '/' . $ this -> route , '/' ) : $ this -> route ; return '~^' . preg_replace_callback ( self :: VAR_PATTERN , function ( $ matches ) { $ this -> parameter [ ] = $ key = $ matches [ 1 ] ; if ( isset ( $ matches [ 2 ] ) && ! isset ( $ this -> parameterPattern [ $ key ] ) ) { $ this -> parameterPattern [ $ key ] = $ matches [ 2 ] ; } return $ this -> buildParameterPattern ( $ key ) ; } , $ path ) . ( $ this -> terminated ? '$' : '' ) . '~i' ; }
|
Returns the pattern an URI path must match to be handled by this route .
|
60,011
|
public function parse ( Uri $ uri ) : ? array { $ path = $ uri -> getPath ( ) ; $ pattern = $ this -> buildRoutePattern ( ) ; if ( preg_match ( $ pattern , $ path , $ matches ) === 1 ) { $ variables = [ ] ; $ length = sizeof ( $ matches ) ; for ( $ i = 1 ; $ i < $ length ; $ i ++ ) { $ variables [ $ this -> parameter [ $ i - 1 ] ] = $ matches [ $ i ] ; } return $ variables ; } return null ; }
|
Trys to extract all route variables of a given Uri path . When the route doesen match the Uri null will be returned .
|
60,012
|
public static function set ( string $ key , $ value ) { return self :: getViewHelper ( ) -> getView ( ) -> addValue ( $ key , $ value ) ; }
|
Set value to attached vue
|
60,013
|
public static function has ( string $ key ) : bool { return self :: getViewHelper ( ) -> getView ( ) -> getValue ( $ key ) !== null ; }
|
Test if a key exists
|
60,014
|
public function buildProxyOrNot ( ) { if ( ! Util :: existsDirWritable ( INITIALLY_RPC_ROOT_PATH ) ) { throw new InitiallyRpcException ( "rpc framework root dir not to be write" ) ; } if ( $ this -> compareConfigFile ( ) ) { $ services = $ this -> config -> getServices ( ) ; foreach ( $ services as $ service ) { $ this -> builder -> create ( $ service -> getInterface ( ) ) ; } } }
|
Build proxy or not
|
60,015
|
private function mapScalarValues ( Payload $ payload , array $ parsedData ) { if ( array_key_exists ( 'after' , $ parsedData ) ) { $ payload -> setAfter ( trim ( $ parsedData [ 'after' ] ) ) ; } if ( array_key_exists ( 'before' , $ parsedData ) ) { $ payload -> setBefore ( trim ( $ parsedData [ 'before' ] ) ) ; } if ( array_key_exists ( 'compare' , $ parsedData ) ) { $ payload -> setCompare ( trim ( $ parsedData [ 'compare' ] ) ) ; } if ( array_key_exists ( 'created' , $ parsedData ) ) { $ created = $ parsedData [ 'created' ] == 'true' ? true : false ; $ payload -> setCreated ( $ created ) ; } if ( array_key_exists ( 'deleted' , $ parsedData ) ) { $ created = $ parsedData [ 'deleted' ] == 'true' ? true : false ; $ payload -> setDeleted ( $ created ) ; } if ( array_key_exists ( 'forced' , $ parsedData ) ) { $ created = $ parsedData [ 'forced' ] == 'true' ? true : false ; $ payload -> setForced ( $ created ) ; } if ( array_key_exists ( 'pusher' , $ parsedData ) ) { $ personMapper = new PersonMapper ( ) ; $ pusher = $ personMapper -> mapFromDataArray ( $ parsedData [ 'pusher' ] ) ; $ payload -> setPusher ( $ pusher ) ; } if ( array_key_exists ( 'ref' , $ parsedData ) ) { $ payload -> setRef ( $ parsedData [ 'ref' ] ) ; } return $ payload ; }
|
Map all scalar values into the payload object
|
60,016
|
public function defineCallbacks ( array $ callbacks ) { $ defaultOptions = [ 'scope' => [ 'kind' ] , 'terminator' => null , 'skipAfterCallbacksIfTerminated' => false , ] ; foreach ( $ callbacks as $ name => $ options ) { if ( is_int ( $ name ) ) { $ name = $ options ; $ options = [ ] ; } if ( isset ( $ this -> chains [ $ name ] ) ) { throw new Exception \ RuntimeException ( "Callback '%s' already defined" , $ name ) ; } $ options = array_merge ( $ defaultOptions , $ options ) ; $ this -> chains [ $ name ] = $ options ; } return $ this ; }
|
Defines callbacks chains .
|
60,017
|
protected function isTerminated ( $ name , $ resp , $ invoker ) { if ( $ this -> chains [ $ name ] [ 'terminator' ] ) { if ( $ this -> chains [ $ name ] [ 'terminator' ] === true ) { return $ resp == true ; } elseif ( $ this -> chains [ $ name ] [ 'terminator' ] === false ) { return $ resp == false ; } $ callable = $ this -> chains [ $ name ] [ 'terminator' ] ; if ( is_string ( $ callable ) ) { return ( bool ) $ invoker ( $ callable , $ resp ) ; } else { return ( bool ) $ callable ( $ resp ) ; } } return false ; }
|
If this method returns true the callback chain is terminated .
|
60,018
|
protected function canRun ( array $ options , $ chainName = null , $ kind = null , $ callbackName = null , $ invoker = null ) { if ( $ chainName && isset ( $ this -> skips [ $ chainName ] [ $ kind ] [ $ callbackName ] ) ) { if ( ! isset ( $ this -> skips [ $ chainName ] [ $ kind ] [ $ callbackName ] [ 'if' ] ) ) { return false ; } $ conditions = $ this -> skips [ $ chainName ] [ $ kind ] [ $ callbackName ] [ 'if' ] ; foreach ( $ conditions as $ condition ) { if ( is_string ( $ condition ) ) { if ( ! ( ! $ invoker ( $ condition ) ) ) { return false ; } } else { if ( ! ( call_user_func ( $ condition ) ) ) { return false ; } } } } elseif ( isset ( $ options [ 'if' ] ) ) { foreach ( $ options [ 'if' ] as $ condition ) { if ( is_string ( $ condition ) ) { if ( ! $ invoker ( $ condition ) ) { return false ; } } else { if ( ! call_user_func ( $ condition ) ) { return false ; } } } } return true ; }
|
if conditions passed to options in skipCallbacks must be callables that must return boolean .
|
60,019
|
public function add ( $ tag , $ callback , $ priority = 10 ) { $ this -> hooks [ $ tag ] [ $ priority ] [ ] = $ callback ; unset ( $ this -> merged [ $ tag ] ) ; return $ this ; }
|
Hook a function or method to a specific hook .
|
60,020
|
public function has ( $ tag , $ callback = false ) { $ has = ! empty ( $ this -> hooks [ $ tag ] ) ; if ( false === $ callback || false === $ has ) return $ has ; foreach ( ( array ) array_keys ( $ this -> hooks [ $ tag ] ) as $ priority ) if ( in_array ( $ callback , $ this -> hooks [ $ tag ] [ $ priority ] ) ) return $ priority ; return false ; }
|
Check if any function has been registered for a hook .
|
60,021
|
public function run ( $ tag , $ value = null ) { if ( ! isset ( $ this -> triggered [ $ tag ] ) ) $ this -> triggered [ $ tag ] = 1 ; else ++ $ this -> triggered [ $ tag ] ; if ( ! isset ( $ this -> hooks [ $ tag ] ) ) return $ value ; $ this -> current [ ] = $ tag ; if ( ! isset ( $ this -> merged [ $ tag ] ) ) { ksort ( $ this -> hooks [ $ tag ] ) ; $ this -> merged [ $ tag ] = true ; } reset ( $ this -> hooks [ $ tag ] ) ; $ args = func_get_args ( ) ; do { foreach ( ( array ) current ( $ this -> hooks [ $ tag ] ) as $ callback ) if ( ! is_null ( $ callback ) ) $ value = call_user_func_array ( $ callback , array_merge ( array ( $ value ) , array_slice ( $ args , 2 ) ) ) ; } while ( next ( $ this -> hooks [ $ tag ] ) !== false ) ; array_pop ( $ this -> current ) ; return $ value ; }
|
Call functions added to a hook .
|
60,022
|
public function remove ( $ tag , $ callback , $ priority = 10 ) { if ( ! array_key_exists ( $ tag , $ this -> hooks ) || ! array_key_exists ( $ priority , $ this -> hooks [ $ tag ] ) ) return false ; $ position = array_search ( $ callback , $ this -> hooks [ $ tag ] [ $ priority ] ) ; if ( false === $ position ) return false ; unset ( $ this -> hooks [ $ tag ] [ $ priority ] [ $ position ] ) ; if ( empty ( $ this -> hooks [ $ tag ] [ $ priority ] ) ) unset ( $ this -> hooks [ $ tag ] [ $ priority ] ) ; unset ( $ this -> merged [ $ tag ] ) ; return true ; }
|
Remove a function from a specified hook .
|
60,023
|
public function removeAll ( $ tag , $ priority = false ) { if ( isset ( $ this -> hooks [ $ tag ] ) ) { if ( false !== $ priority && isset ( $ this -> hooks [ $ tag ] [ $ priority ] ) ) unset ( $ this -> hooks [ $ tag ] [ $ priority ] ) ; else unset ( $ this -> hooks [ $ tag ] ) ; } if ( isset ( $ this -> merged [ $ tag ] ) ) unset ( $ this -> merged [ $ tag ] ) ; return true ; }
|
Remove all functions from a hook .
|
60,024
|
public function doing ( $ tag = null ) { if ( null === $ tag ) return ! empty ( $ this -> current ) ; return in_array ( $ tag , $ this -> current ) ; }
|
Whether a hook is currently being processed .
|
60,025
|
public function setDefaults ( array $ defaults ) { $ this -> defaults = array_merge ( $ this -> _global_defaults , $ defaults , $ this -> defaults ) ; return $ this ; }
|
Sets the default settings values
|
60,026
|
public function update ( array $ data ) { foreach ( $ this -> getCustomOptions ( ) as $ key => $ value ) { if ( isset ( $ data [ $ value ] ) && $ data [ $ value ] == 'custom' && $ data [ $ value . '_custom' ] != '' ) { $ data [ '_form_' . $ value ] = $ data [ $ value ] ; $ data [ $ value ] = $ data [ $ value . '_custom' ] ; } } foreach ( $ data as $ key => $ value ) { if ( in_array ( $ key , $ this -> getSerialized ( ) ) ) { $ value = ( is_array ( $ value ) ? serialize ( $ value ) : serialize ( array ( $ value ) ) ) ; } if ( in_array ( $ key , $ this -> getEncrypted ( ) ) && $ value != '' ) { $ value = $ this -> getEncrypt ( ) -> encode ( $ value ) ; } $ this -> updateSetting ( $ key , $ value ) ; } return true ; }
|
Saves the settings to the database
|
60,027
|
private function checkSetting ( $ setting ) { if ( array_key_exists ( $ setting , $ this -> getDefaults ( ) ) ) { if ( ! $ this -> getSetting ( $ setting ) ) { $ this -> addSetting ( $ setting ) ; } return true ; } }
|
Verifies that a submitted setting is valid and exists . If it s valid but doesn t exist it is created .
|
60,028
|
public function getSetting ( $ setting ) { return $ this -> db -> select ( ) -> from ( $ this -> getTable ( ) ) -> where ( array ( 'setting_key' => $ setting ) ) -> get ( ) ; }
|
Checks the database for a setting key
|
60,029
|
public function addSetting ( $ setting ) { $ data = array ( 'setting_key' => $ setting ) ; if ( in_array ( $ setting , $ this -> getSerialized ( ) ) ) { $ data [ 'serialized' ] = '1' ; } return $ this -> db -> insert ( $ this -> getTable ( ) , $ data ) ; }
|
Adds a setting to the databse
|
60,030
|
public function search ( $ query , $ offset = NULL , $ docs = NULL , $ list = NULL , $ ordering = NULL , $ returnType = DOC_TYPE_SIMPLEXML , $ stemLang = NULL ) { $ request = new CPS_SearchRequest ( $ query , $ offset , $ docs , $ list ) ; if ( ! is_null ( $ ordering ) ) $ request -> setOrdering ( $ ordering ) ; if ( ! is_null ( $ stemLang ) ) $ request -> setStemLang ( $ stemLang ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return $ this -> _lastResponse -> getDocuments ( $ returnType ) ; }
|
Performs a search command . Returns the documents found in an associative array with document IDs as keys and document contents as values
|
60,031
|
public function sql_search ( $ sql_query , $ returnType = DOC_TYPE_SIMPLEXML ) { $ request = new CPS_SQLSearchRequest ( $ sql_query ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return $ this -> _lastResponse -> getDocuments ( $ returnType ) ; }
|
Performs a search command with an SQL query . Returns the documents found in an associative array with document IDs as keys and document contents as values
|
60,032
|
public function insertSingle ( $ id , $ document ) { $ request = new CPS_InsertRequest ( $ id , $ document ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return count ( $ this -> _lastResponse -> getModifiedIds ( ) ) ; }
|
Performs an insert command . Returns the number of modified documents
|
60,033
|
public function insertMultiple ( $ docs ) { $ request = new CPS_InsertRequest ( $ docs ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return count ( $ this -> _lastResponse -> getModifiedIds ( ) ) ; }
|
Performs an insert command for multiple documents . Returns the number of modified documents
|
60,034
|
public function updateSingle ( $ id , $ document ) { $ request = new CPS_UpdateRequest ( $ id , $ document ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return count ( $ this -> _lastResponse -> getModifiedIds ( ) ) ; }
|
Performs an update command . Returns the number of modified documents
|
60,035
|
public function updateMultiple ( $ docs ) { $ request = new CPS_UpdateRequest ( $ docs ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return count ( $ this -> _lastResponse -> getModifiedIds ( ) ) ; }
|
Performs an update command for multiple documents . Returns the number of modified documents
|
60,036
|
public function replaceSingle ( $ id , $ document ) { $ request = new CPS_ReplaceRequest ( $ id , $ document ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return count ( $ this -> _lastResponse -> getModifiedIds ( ) ) ; }
|
Performs a replace command . Returns the number of modified documents
|
60,037
|
public function replaceMultiple ( $ docs ) { $ request = new CPS_ReplaceRequest ( $ docs ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return count ( $ this -> _lastResponse -> getModifiedIds ( ) ) ; }
|
Performs a replace command for multiple documents . Returns the number of modified documents
|
60,038
|
public function partialReplaceSingle ( $ id , $ document ) { $ request = new CPS_PartialReplaceRequest ( $ id , $ document ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return count ( $ this -> _lastResponse -> getModifiedIds ( ) ) ; }
|
Performs a partial - replace command . Returns the number of modified documents
|
60,039
|
public function partialReplaceMultiple ( $ docs ) { $ request = new CPS_PartialReplaceRequest ( $ docs ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return count ( $ this -> _lastResponse -> getModifiedIds ( ) ) ; }
|
Performs a partial - replace command for multiple documents . Returns the number of modified documents
|
60,040
|
public function partialXReplace ( $ ids , $ operations ) { $ request = new CPS_PartialXRequest ( $ ids , $ operations ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return count ( $ this -> _lastResponse -> getModifiedIds ( ) ) ; }
|
Performs a partial - xreplace command . Returns the number of modified documents
|
60,041
|
public function delete ( $ id ) { $ request = new CPS_DeleteRequest ( $ id ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return count ( $ this -> _lastResponse -> getModifiedIds ( ) ) ; }
|
Performs a delete command . Returns the number of deleted documents
|
60,042
|
public function listLast ( $ list = NULL , $ offset = '' , $ docs = '' , $ returnType = DOC_TYPE_SIMPLEXML ) { $ request = new CPS_ListLastRequest ( $ list , $ offset , $ docs ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return $ this -> _lastResponse -> getDocuments ( $ returnType ) ; }
|
Performs a list - last command . Returns an associative array with document IDs as keys and document contents as values
|
60,043
|
public function listFirst ( $ list = NULL , $ offset = '' , $ docs = '' , $ returnType = DOC_TYPE_SIMPLEXML ) { $ request = new CPS_ListFirstRequest ( $ list , $ offset , $ docs ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return $ this -> _lastResponse -> getDocuments ( $ returnType ) ; }
|
Performs a list - first command . Returns an associative array with document IDs as keys and document contents as values
|
60,044
|
public function retrieveLast ( $ offset = '' , $ docs = '' , $ returnType = DOC_TYPE_SIMPLEXML ) { $ request = new CPS_RetrieveLastRequest ( $ offset , $ docs ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return $ this -> _lastResponse -> getDocuments ( $ returnType ) ; }
|
Performs a retrieve - last command . Returns an associative array with document IDs as keys and document contents as values
|
60,045
|
public function retrieveFirst ( $ offset = '' , $ docs = '' , $ returnType = DOC_TYPE_SIMPLEXML ) { $ request = new CPS_RetrieveFirstRequest ( $ offset , $ docs ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return $ this -> _lastResponse -> getDocuments ( $ returnType ) ; }
|
Performs a retrieve - first command . Returns an associative array with document IDs as keys and document contents as values
|
60,046
|
public function retrieveSingle ( $ id , $ returnType = DOC_TYPE_SIMPLEXML ) { $ request = new CPS_RetrieveRequest ( $ id ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; foreach ( $ this -> _lastResponse -> getDocuments ( $ returnType ) as $ document ) { return $ document ; } return NULL ; }
|
Performs a retrieve command for a single document . Returns the document contents
|
60,047
|
public function retrieveMultiple ( $ ids , $ returnType = DOC_TYPE_SIMPLEXML ) { $ request = new CPS_RetrieveRequest ( $ ids ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return $ this -> _lastResponse -> getDocuments ( $ returnType ) ; }
|
Performs a retrieve command for multiple documents . Returns an associative array with document IDs as keys and document contents as values
|
60,048
|
public function lookupSingle ( $ id , $ list = NULL , $ returnType = DOC_TYPE_SIMPLEXML ) { $ request = new CPS_LookupRequest ( $ id , $ list ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; foreach ( $ this -> _lastResponse -> getDocuments ( $ returnType ) as $ document ) { return $ document ; } return NULL ; }
|
Performs a lookup command for a single document . Returns the document contents
|
60,049
|
public function lookupMultiple ( $ ids , $ list = NULL , $ returnType = DOC_TYPE_SIMPLEXML ) { $ request = new CPS_LookupRequest ( $ ids , $ list ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return $ this -> _lastResponse -> getDocuments ( $ returnType ) ; }
|
Performs a lookup command for multiple documents . Returns an associative array with document IDs as keys and document contents as values
|
60,050
|
public function listWords ( $ wildcard ) { $ request = new CPS_ListWordsRequest ( $ wildcard ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return $ this -> _lastResponse -> getWords ( ) ; }
|
Performs a list - words command for one or multiple patterns with wildcards
|
60,051
|
public function status ( ) { $ request = new CPS_StatusRequest ( ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return $ this -> _lastResponse -> getStatus ( ) ; }
|
Performs the status command . Returns an array with status data
|
60,052
|
public function searchDelete ( $ query ) { $ request = new CPS_SearchDeleteRequest ( $ query ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return $ this -> _lastResponse -> getHits ( ) ; }
|
Performs a search - delete command . Returns the number of the documents erased
|
60,053
|
public function listPaths ( ) { $ request = new CPS_ListPathsRequest ( ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return $ this -> _lastResponse -> getPaths ( ) ; }
|
Performs a list - paths command . Returns all available paths in an array
|
60,054
|
public function listFacets ( $ paths ) { $ request = new CPS_ListFacetsRequest ( $ paths ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return $ this -> _lastResponse -> getFacets ( ) ; }
|
Performs a list - facets command . Returns an associative array where keys are facet paths and values are arrays of terms
|
60,055
|
public function similarDocument ( $ docid , $ len , $ quota , $ offset = NULL , $ docs = NULL , $ query = NULL ) { $ request = new CPS_SimilarDocumentRequest ( $ docid , $ len , $ quota , $ offset , $ docs , $ query ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return $ this -> _lastResponse -> getDocuments ( ) ; }
|
Finds documents similar to the document with a given ID . Returns an associative array with similar document IDs as keys and document contents as values
|
60,056
|
public function similarText ( $ text , $ len , $ quota , $ offset = NULL , $ docs = NULL , $ query = NULL ) { $ request = new CPS_SimilarTextRequest ( $ text , $ len , $ quota , $ offset , $ docs , $ query ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return $ this -> _lastResponse -> getDocuments ( ) ; }
|
Finds documents similar to the given text . Returns an associative array with similar document IDs as keys and document contents as values
|
60,057
|
public function beginTransaction ( ) { $ request = new CPS_BeginTransactionRequest ( ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return true ; }
|
Begins new transaction
|
60,058
|
public function commitTransaction ( ) { $ request = new CPS_CommitTransactionRequest ( ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return true ; }
|
Commits last transaction
|
60,059
|
public function rollbackTransaction ( ) { $ request = new CPS_RollbackTransactionRequest ( ) ; $ this -> _lastResponse = $ this -> _connection -> sendRequest ( $ request ) ; return true ; }
|
Rollbacks last transaction
|
60,060
|
private function ensureProviders ( ) { if ( ! empty ( $ this -> lazyProviders ) ) { $ this -> registerProviders ( $ this -> lazyProviders ) ; $ this -> lazyProviders = null ; } }
|
Ensures any lazily set providers are registered
|
60,061
|
public function registerProvider ( $ id , $ provider ) { if ( is_array ( $ provider ) ) { $ provider [ 'id' ] = $ id ; $ provider = Yii :: createObject ( $ provider ) ; } if ( ! ( $ provider instanceof ProviderInterface ) ) { throw new InvalidConfigException ( "Invalid provider provided to key provider component" ) ; } $ this -> providers [ $ id ] = $ provider ; }
|
Register a provider with the component
|
60,062
|
public function getProvider ( $ id ) { $ this -> ensureProviders ( ) ; if ( isset ( $ this -> providers [ $ id ] ) ) { return $ this -> providers [ $ id ] ; } return false ; }
|
Retrieves a provider by ID
|
60,063
|
public static function descriptor ( $ path ) { static $ descriptor = [ ] ; if ( empty ( $ descriptor ) ) { $ descriptor = json_decode ( file_get_contents ( $ path ) , true ) ; } if ( null === $ descriptor ) { throw new InvalidDescriptor ( sprintf ( 'Descriptor at %s is invalid' , $ path ) ) ; } return $ descriptor [ 'service' ] ; }
|
Loads information about services from descriptor file .
|
60,064
|
private function originalIsNumericallyEquivalent ( $ name ) { $ current = $ this -> attributes [ $ name ] ; $ original = $ this -> original [ $ name ] ; return is_numeric ( $ current ) && is_numeric ( $ original ) && strcmp ( ( string ) $ current , ( string ) $ original ) === 0 ; }
|
Determine if the new and old attribute values are numerically equivalent .
|
60,065
|
private function getJoinTable ( $ class ) { $ model1 = snake_case ( $ this -> getBaseClass ( ) ) ; $ model2 = snake_case ( $ this -> getBaseClass ( $ class ) ) ; $ models = [ $ model1 , $ model2 ] ; sort ( $ models ) ; return implode ( '_' , $ models ) ; }
|
Get the join table name for a many - to - many relation .
|
60,066
|
public function setTitle ( $ title , $ function = '' ) { $ this -> completeTitle = $ title ; if ( $ function != '' ) { $ this -> completeTitle .= ' - ' . $ function ; $ this -> menuManager -> setBreadcrumbFunction ( $ function ) ; } $ this -> metaInformationManager -> setTitle ( $ this -> completeTitle ) ; }
|
Sets the title of the page
|
60,067
|
public function activateMenuEntry ( $ key = '' ) { if ( $ key != '' ) { $ menuEntry = $ this -> menuManager -> getMenuEntryForKey ( $ key ) ; if ( $ menuEntry !== false ) { $ this -> menuManager -> setActiveMenuEntry ( $ menuEntry ) ; } } else { $ this -> menuManager -> activateCorrectMenuEntry ( ) ; } return $ this -> menuManager -> getActiveMenuEntry ( ) ; }
|
Activates the correct menu entry and returns the activated menu entry
|
60,068
|
public function getDefaultErrorStrategy ( ) { if ( ! $ this -> defaultErrorStrategy ) { $ services = $ this -> getServices ( ) ; $ strategy = $ services -> get ( 'HtmlErrorStrategy' ) ; $ this -> setDefaultErrorStrategy ( $ strategy ) ; } return $ this -> defaultErrorStrategy ; }
|
Gets the strategy of html error handling .
|
60,069
|
public function attachErrorStrategy ( AbstractErrorStrategy $ strategy ) { if ( $ strategy instanceof HtmlErrorStrategy ) { $ this -> setDefaultErrorStrategy ( $ strategy ) ; return ; } $ this -> strategies -> attach ( $ strategy ) ; }
|
Adds the specific strategy of error handling .
|
60,070
|
public function read ( $ key ) { $ key = strval ( $ key ) ; $ val = null ; if ( strlen ( $ key ) == 0 ) { return $ val ; } $ this -> openSession ( ) ; if ( isset ( $ _SESSION [ $ key ] ) == true ) { $ val = $ _SESSION [ $ key ] ; } $ this -> closeSession ( ) ; return $ val ; }
|
Retrieve the session value associated with the key .
|
60,071
|
public function write ( $ key , $ val ) { $ key = strval ( $ key ) ; if ( strlen ( $ key ) == 0 ) { $ msg = 'The key cannot be empty.' ; throw new InvalidArgumentException ( $ msg ) ; } $ this -> openSession ( ) ; $ _SESSION [ $ key ] = $ val ; $ this -> closeSession ( ) ; }
|
Writes a session value to the session .
|
60,072
|
public function unsetSessionValue ( $ key ) { $ key = strval ( $ key ) ; $ this -> openSession ( ) ; unset ( $ _SESSION [ $ key ] ) ; $ this -> closeSession ( ) ; }
|
Unset the specified session variable .
|
60,073
|
public function destroy ( ) { session_start ( ) ; if ( ini_get ( "session.use_cookies" ) ) { $ params = session_get_cookie_params ( ) ; setcookie ( session_name ( ) , '' , time ( ) - 42000 , $ params [ "path" ] , $ params [ "domain" ] , $ params [ "secure" ] , $ params [ "httponly" ] ) ; } session_unset ( ) ; session_regenerate_id ( true ) ; session_destroy ( ) ; session_write_close ( ) ; }
|
Completely eliminate all session data .
|
60,074
|
public static function hasEnding ( string $ needle , string $ haystack ) : bool { return $ needle === '' || substr ( $ haystack , - strlen ( $ needle ) ) === $ needle ; }
|
Returns true if this string ends with the given needle .
|
60,075
|
public function update ( $ vars ) { $ this -> vars = $ vars + $ this -> vars ; $ this -> preprocess ( $ this -> vars ) ; }
|
Updates variables for template .
|
60,076
|
public function render ( $ vars = [ ] , $ asc = 0 ) { $ vars = $ this -> vars + $ vars ; $ className = get_called_class ( ) ; while ( $ asc > 0 ) { $ parentClass = get_parent_class ( $ className ) ; if ( ! $ parentClass ) { break ; } $ className = $ parentClass ; $ asc -- ; } do { $ reflection = new \ ReflectionClass ( $ className ) ; $ classFile = $ reflection -> getFileName ( ) ; $ fileContent = file_get_contents ( $ classFile ) ; $ tokens = token_get_all ( $ fileContent ) ; $ hasHalt = FALSE ; foreach ( $ tokens as $ token ) { if ( is_array ( $ token ) && isset ( $ token [ 0 ] , $ token [ 2 ] ) ) { if ( $ token [ 0 ] == T_HALT_COMPILER ) { $ hasHalt = TRUE ; $ this -> haltLine = $ token [ 2 ] - 1 ; } } } if ( $ hasHalt ) { $ template = $ tokens [ count ( $ tokens ) - 1 ] [ 1 ] ; break ; } $ className = get_parent_class ( $ className ) ; if ( ! $ className || $ className == get_class ( ) ) { throw new \ Exception ( sprintf ( 'Cannot locate template. ' . 'No call to __halt_compiler() found along inheritance chain of %s.' , get_called_class ( ) ) ) ; } } while ( ! $ hasHalt ) ; $ renderScope = \ Closure :: Bind ( function ( ) use ( $ template , $ vars , $ classFile ) { extract ( $ vars ) ; ob_start ( ) ; try { eval ( $ template ) ; } catch ( \ Exception $ e ) { error_log ( 'Exception thrown in template: ' . $ classFile . ':' . ( $ e -> getLine ( ) + $ this -> haltLine ) . PHP_EOL . $ e -> getMessage ( ) ) ; throw $ e ; } $ content = ob_get_contents ( ) ; ob_end_clean ( ) ; return $ content ; } , $ this , get_called_class ( ) ) ; $ result = $ renderScope ( ) ; if ( isset ( $ vars [ '__debug' ] ) && $ vars [ '__debug' ] ) { $ result = sprintf ( "<!-- START %s , get_called_class ( ) , $ result , get_called_class ( ) ) ; } return $ result ; }
|
Render self to string for display .
|
60,077
|
public function getUserProfiles ( Request $ request ) { if ( $ this -> userProfiles === NULL ) { $ this -> userProfiles = $ request -> session -> exist ( $ this -> sessionProfile ) ? $ request -> session -> get ( $ this -> sessionProfile ) : 'default' ; } return $ this -> userProfiles ; }
|
Retorna los perfiles del usuario actual del sistema Por defecto default
|
60,078
|
public function userHasAccess ( $ request , $ moduleName ) { $ userProfile = $ this -> getUserProfiles ( $ request ) ; $ maps = FALSE ; if ( is_array ( $ userProfile ) ) { $ maps = $ this -> profilesHasAccess ( $ userProfile , $ moduleName ) ; } else { $ maps = $ this -> profileHasAccess ( $ userProfile , $ moduleName ) ; } return $ maps ; }
|
Indica si el usuario logueado tiene acceso a un modulo
|
60,079
|
public function profilesHasAccess ( $ profilesName , $ moduleName ) { $ maps = FALSE ; foreach ( $ profilesName as $ profile ) { $ maps = $ this -> profileHasAccess ( $ profile , $ moduleName ) ; } return $ maps ; }
|
Indica si un conjunto de perfiles tienen acceso a un modulo Si un perfil tiene acceso el conjunto lo tiene
|
60,080
|
public function profileHasAccess ( $ profileName , $ moduleName ) { $ maps = FALSE ; if ( $ this -> getProfile ( $ profileName ) != NULL ) { $ config_seguridad = $ this -> getProfile ( $ profileName ) ; if ( isset ( $ config_seguridad [ 'join' ] ) ) { $ maps = $ this -> profileHasAccess ( $ config_seguridad [ 'join' ] , $ moduleName ) ; } if ( ! $ maps ) { $ permisos = $ config_seguridad [ 'permit' ] ; $ maps = in_array ( $ moduleName , $ permisos ) ; } if ( $ maps ) { $ denegados = $ config_seguridad [ 'deny' ] ; $ maps = ! in_array ( $ moduleName , $ denegados ) ; } } return $ maps ; }
|
Indica si un perfil tiene acceso a un modulo
|
60,081
|
public function userHasAccessToUrl ( $ request , $ url , $ method ) { $ userProfile = $ this -> getUserProfiles ( $ request ) ; $ maps = FALSE ; if ( is_array ( $ userProfile ) ) { $ maps = $ this -> profilesHasAccessToUrl ( $ userProfile , $ url , $ method ) ; } else { $ maps = $ this -> profileHasAccessToUrl ( $ userProfile , $ url , $ method ) ; } return $ maps ; }
|
Indica si el usuario logueado tiene acceso a un url y request method
|
60,082
|
public function profilesHasAccessToUrl ( $ profilesName , $ url , $ method ) { $ maps = FALSE ; foreach ( $ profilesName as $ profile ) { $ maps = $ this -> profileHasAccessToUrl ( $ profile , $ url , $ method ) ; } return $ maps ; }
|
Indica si un conjunto de perfiles tienen acceso a una url y request method Si un perfil tiene acceso el conjunto lo tiene
|
60,083
|
public function profileHasAccessToUrl ( $ profileName , $ url , $ method ) { $ maps = FALSE ; if ( $ this -> getProfile ( $ profileName ) != NULL ) { $ config_seguridad = $ this -> getProfile ( $ profileName ) ; if ( isset ( $ config_seguridad [ 'join' ] ) ) { $ maps = $ this -> profileHasAccessToUrl ( $ config_seguridad [ 'join' ] , $ url , $ method ) ; } if ( ! $ maps ) { $ permisos = $ config_seguridad [ 'permit' ] ; foreach ( $ permisos as $ permiso ) { if ( $ this -> mapsModule ( $ permiso , $ url , $ method ) ) { $ maps = TRUE ; break ; } } } if ( $ maps ) { $ denegados = $ config_seguridad [ 'deny' ] ; foreach ( $ denegados as $ denegado ) { if ( $ this -> mapsModule ( $ denegado , $ url , $ method ) ) { $ maps = FALSE ; break ; } } } } return $ maps ; }
|
Indica si un perfil tiene acceso a una url y request method
|
60,084
|
protected function mapsModule ( $ moduleName , $ url , $ method ) { $ maps = FALSE ; foreach ( $ this -> getModule ( $ moduleName ) as $ key ) { $ maps = $ this -> mapsKey ( $ key , $ url , $ method ) ; if ( $ maps ) { break ; } } return $ maps ; }
|
Indica si para un modulo dado la url y el request method mapean con el
|
60,085
|
public function mapsKey ( $ key , $ url , $ method ) { return ( \ Enola \ Http \ UrlUri :: mapsActualUrl ( $ key [ 'url' ] , $ url ) && \ Enola \ Http \ UrlUri :: mapsActualMethod ( $ key [ 'method' ] , $ method ) ) ; }
|
Indica si para la llave de un modulo dado la url y el request method mapean con el
|
60,086
|
public function userHasAccessToComponentDefinition ( $ request , $ component ) { if ( isset ( $ component [ 'authorization-profiles' ] ) && $ component [ 'authorization-profiles' ] != "" ) { $ profiles = str_replace ( ' ' , '' , $ component [ 'authorization-profiles' ] ) ; $ profiles = explode ( ',' , $ component [ 'authorization-profiles' ] ) ; $ userProfile = $ this -> getUserProfiles ( $ request ) ; if ( is_array ( $ userProfile ) ) { return ( count ( array_intersect ( $ userProfile , $ profiles ) ) > 0 ) ; } else { return in_array ( $ userProfile , $ profiles ) ; } } else { return TRUE ; } }
|
Indica si el usuario logueado tiene acceso a la definicion de un componente
|
60,087
|
public function userHasAccessToComponent ( $ request , $ componentName ) { $ component = $ this -> context -> getComponentsDefinition ( ) [ $ componentName ] ; return $ this -> userHasAccessToComponentDefinition ( $ request , $ component ) ; }
|
Indica si el usuario logueado tiene acceso a un componente
|
60,088
|
public function profilesHasAccessToComponent ( $ profilesName , $ componentName ) { $ component = $ this -> context -> getComponentsDefinition ( ) [ $ componentName ] ; if ( isset ( $ component [ 'authorization-profiles' ] ) && $ component [ 'authorization-profiles' ] != "" ) { $ profiles = str_replace ( ' ' , '' , $ component [ 'authorization-profiles' ] ) ; $ profiles = explode ( ',' , $ component [ 'authorization-profiles' ] ) ; return ( count ( array_intersect ( $ profilesName , $ profiles ) ) > 0 ) ; } else { return TRUE ; } }
|
Indica si un conjunto de perfiles tienen acceso a un componente Si un perfil tiene acceso el conjunto lo tiene
|
60,089
|
public function profileHasAccessToComponent ( $ profileName , $ componentName ) { $ component = $ this -> context -> getComponentsDefinition ( ) [ $ componentName ] ; if ( isset ( $ component [ 'authorization-profiles' ] ) && $ component [ 'authorization-profiles' ] != "" ) { $ profiles = str_replace ( ' ' , '' , $ component [ 'authorization-profiles' ] ) ; $ profiles = explode ( ',' , $ component [ 'authorization-profiles' ] ) ; return in_array ( $ profileName , $ profiles ) ; } else { return TRUE ; } }
|
Indica si un perfil tiene acceso a un componente
|
60,090
|
public static function arrayClone ( array $ array ) { return array_map ( function ( $ element ) { return ( ( is_array ( $ element ) ) ? call_user_func ( __FUNCTION__ , $ element ) : ( ( is_object ( $ element ) ) ? clone $ element : $ element ) ) ; } , $ array ) ; }
|
Clones an array taking care of cloning its objects and subarrays as well .
|
60,091
|
public function getProperties ( $ value , ReflectionClass $ class , $ propertyFilter ) { $ attributes = array_merge ( $ value -> getAttributes ( ) , $ value -> getRelations ( ) ) ; $ visible = $ value -> getVisible ( ) ; if ( count ( $ visible ) === 0 ) { $ visible = array_diff ( array_keys ( $ attributes ) , $ value -> getHidden ( ) ) ; } if ( ! $ this -> showHidden ( $ propertyFilter ) ) { return array_intersect_key ( $ attributes , array_flip ( $ visible ) ) ; } $ properties = [ ] ; foreach ( $ attributes as $ key => $ value ) { if ( ! in_array ( $ key , $ visible ) ) { $ key = sprintf ( '<protected>%s</protected>' , $ key ) ; } $ properties [ $ key ] = $ value ; } return $ properties ; }
|
Get an array of Model object properties .
|
60,092
|
public function setMapper ( KeyMapperInterface $ mapper ) { $ this -> mapper = $ mapper ; $ this -> mapper -> setDelimiter ( $ this -> delimiter ) ; }
|
Set your own custom mapper .
|
60,093
|
public function invalidate ( $ namespace ) { if ( $ this -> prefix ) { $ namespace = $ this -> prefix . $ this -> delimiter . $ namespace ; } return $ this -> mapper -> invalidate ( $ namespace ) ; }
|
Deletes all the keys in an entire namespace .
|
60,094
|
protected function callCacheMethod ( $ method , array $ args = array ( ) ) { if ( isset ( $ args [ 0 ] ) ) { if ( $ this -> prefix ) { $ args [ 0 ] = $ this -> prefix . $ this -> delimiter . $ args [ 0 ] ; } $ args [ 0 ] = $ this -> mapper -> parse ( $ args [ 0 ] ) ; } return call_user_func_array ( array ( $ this -> cache , $ method ) , $ args ) ; }
|
Call a given method on the stored cache instance .
|
60,095
|
public function loadHelper ( $ name , $ namespace = NULL ) { $ helper_class = ( $ namespace ? $ namespace : 'PowerOn\Helper\\' ) . Inflector :: classify ( $ name ) . 'Helper' ; if ( ! class_exists ( $ helper_class ) ) { throw new \ Exception ( sprintf ( 'No se encuentra la clase(%s), debe configurar correctamente su autoloader' , $ helper_class ) ) ; } $ this -> _container [ $ name ] = function ( $ c ) use ( $ helper_class ) { return new $ helper_class ( $ c ) ; } ; }
|
Carga un Helper
|
60,096
|
public function getHelper ( $ name ) { if ( ! $ this -> helperExist ( $ name ) ) { throw new \ Exception ( sprintf ( 'El Helper (%s) solicitado no fue cargado.' , $ name ) ) ; } $ helper = $ this -> _container [ $ name ] ; $ helper -> configure ( [ ] ) ; return $ helper ; }
|
Devuelve el Helper solicitado
|
60,097
|
public function showAction ( Pais $ pai ) { $ deleteForm = $ this -> createDeleteForm ( $ pai ) ; return $ this -> render ( 'UbicacionBundle:pais:show.html.twig' , array ( 'pai' => $ pai , 'delete_form' => $ deleteForm -> createView ( ) , ) ) ; }
|
Finds and displays a Pais entity .
|
60,098
|
public function deleteAction ( Request $ request , Pais $ pai ) { $ form = $ this -> createDeleteForm ( $ pai ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> remove ( $ pai ) ; $ em -> flush ( ) ; } return $ this -> redirectToRoute ( 'pais_index' ) ; }
|
Deletes a Pais entity .
|
60,099
|
private function createDeleteForm ( Pais $ pai ) { return $ this -> createFormBuilder ( ) -> setAction ( $ this -> generateUrl ( 'pais_delete' , array ( 'id' => $ pai -> getId ( ) ) ) ) -> setMethod ( 'DELETE' ) -> getForm ( ) ; }
|
Creates a form to delete a Pais entity .
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.