idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
238,800
public function getBackupURL ( $ backupId ) { if ( $ this -> connector -> getURL ( ) === null ) { return 'Cannot find site URL from configuration.' ; } $ url = $ this -> connector -> getURL ( ) . self :: VERSION . $ this -> connector -> getSiteID ( ) . '/backups/' . $ backupId . '/url' ; $ params = [ ] ; $ response = $...
Get backup URL .
238,801
public function getSiteDetails ( $ siteId ) { if ( $ this -> connector -> getURL ( ) === null ) { return 'Cannot find site URL from configuration.' ; } $ url = $ this -> connector -> getURL ( ) . self :: VERSION . $ siteId ; $ params = [ ] ; $ response = $ this -> connector -> connecting ( $ url , $ params , 'GET' ) ; ...
Get site details
238,802
public function listBackups ( ) { if ( $ this -> connector -> getURL ( ) === null ) { return 'Cannot find site URL from configuration.' ; } $ url = $ this -> connector -> getURL ( ) . self :: VERSION . $ this -> connector -> getSiteID ( ) . '/backups' ; $ params = [ ] ; $ response = $ this -> connector -> connecting ( ...
List all backups in for specific site in site factory .
238,803
public function getLastBackupTime ( ) { $ backups = $ this -> listBackups ( ) ; if ( is_array ( $ backups ) ) { if ( ! empty ( $ backups ) ) { $ timestamp = $ backups [ 0 ] -> timestamp ; return $ timestamp ; } return 'There is no backup available.' ; } return $ backups ; }
Get the last backup timestamp .
238,804
public function backupSuccessIndicator ( $ label ) { $ backups = $ this -> listBackups ( ) ; if ( is_array ( $ backups ) ) { if ( ! empty ( $ backups ) ) { if ( $ backups [ 0 ] -> label === $ label ) { return true ; } return false ; } return false ; } }
Indicate when required backup is generated .
238,805
public function listSites ( $ limit , $ page , $ canary = false ) { if ( $ this -> connector -> getURL ( ) === null ) { return 'Cannot find site URL from configuration.' ; } $ params = [ 'limit' => $ limit , 'page' => $ page , 'canary' => $ canary , ] ; $ url = $ this -> connector -> getURL ( ) . self :: VERSION ; $ re...
List sites .
238,806
public function output ( $ args ) { $ args += [ '' , '' , 63 ] ; $ this -> _consoleOutput -> write ( $ this -> _getState ( $ args [ 0 ] , $ args [ 1 ] , $ args [ 2 ] ) ) ; }
This method should output formatted message .
238,807
static public function mysql_aes_encrypt ( $ val , $ ky ) { if ( empty ( $ ky ) && empty ( $ val ) ) return null ; $ key = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" ; for ( $ a = 0 ; $ a < strlen ( $ ky ) ; $ a ++ ) { $ key [ $ a % 16 ] = chr ( ord ( $ key [ $ a % 16 ] ) ^ ord ( $ ky [ $ a ] ) ) ; } $ mode = MCRYPT_MODE_ECB ;...
aes mysql encryption
238,808
public function resolveUrl ( $ url , & $ parameters ) { $ parameters = array ( ) ; $ patternSegments = $ this -> segments ; $ patternSegmentNum = count ( $ patternSegments ) ; $ urlSegments = Helper :: segmentizeUrl ( $ url ) ; if ( count ( $ urlSegments ) > count ( $ patternSegments ) ) return false ; foreach ( $ patt...
Checks whether a given URL matches a given pattern .
238,809
public function name ( $ name = null ) { if ( $ name === null ) return $ this -> ruleName ; $ this -> ruleName = $ name ; return $ this ; }
Unique route name
238,810
public function pattern ( $ pattern = null ) { if ( $ pattern === null ) return $ this -> rulePattern ; $ this -> rulePattern = $ pattern ; return $ this ; }
Route match pattern
238,811
public function afterMatch ( $ callback = null ) { if ( $ callback !== null ) { if ( ! is_callable ( $ callback ) ) { throw new InvalidArgumentException ( sprintf ( "The after match callback provided is not valid. Given (%s)" , gettype ( $ callback ) ) ) ; } $ this -> afterMatchCallback = $ callback ; return $ this ; }...
After match callback
238,812
protected function openCloseTag ( $ string ) { if ( $ this -> tag === true ) { $ script = $ this -> getScriptClass ( ) ; $ string = $ script -> open ( ) . $ string . $ script -> close ( ) ; } $ this -> tag = false ; return $ string ; }
Protected script open close tag
238,813
protected function isCallableOption ( $ callback , $ parameter ) { $ option = 'function(' . $ parameter . '){' . PHP_EOL ; $ option .= Buffering \ Callback :: do ( $ callback ) ; $ option .= '}' ; return $ option ; }
Protected is callable option
238,814
public function docbookdocAction ( ) { $ title = _T ( 'User manual' ) ; $ md_parser = $ this -> wdb -> getMarkdownParser ( ) ; $ path = Kernel :: getPath ( 'webdocbook_assets' ) . Kernel :: getConfig ( 'pages:user_manual' , '' ) ; $ update = Helper :: getDateTimeFromTimestamp ( filemtime ( $ path ) ) ; $ file_content =...
The internal documentation action
238,815
public function adminAction ( ) { $ allowed = Kernel :: getConfig ( 'expose_admin' , false , 'user_config' ) ; $ saveadmin = $ this -> wdb -> getUser ( ) -> getSession ( ) -> get ( 'saveadmin' ) ; $ this -> wdb -> getUser ( ) -> getSession ( ) -> remove ( 'saveadmin' ) ; if ( ( ! $ allowed || ( 'true' !== $ allowed && ...
Admin panel action
238,816
public function write ( iterable $ data , ? array $ headers = null ) : void { $ this -> assertAttached ( ) ; $ this -> begin ( $ headers ) ; foreach ( $ data as $ element ) { $ this -> writeElement ( $ element ) ; } $ this -> end ( ) ; }
Write to traversable data to stream .
238,817
public function setMetadataClass ( string $ metadataClass ) : void { if ( ! class_exists ( $ metadataClass ) || ! ( new \ ReflectionClass ( $ metadataClass ) ) -> implementsInterface ( ClassMetadataInterface :: class ) ) { throw InvalidArgumentException :: create ( InvalidArgumentException :: INVALID_METADATA_CLASS , $...
Set the metadata class to be created by this factory .
238,818
protected function write ( $ message , $ level , array $ parameters ) { if ( $ this -> enabled === false ) { return null ; } if ( $ this -> log_request_identifier === null ) { $ this -> log_request_identifier = "MISSING_REQUEST_ID" ; } $ ExceptionToTrace = $ message ; if ( $ message instanceof \ Exception ) { $ message...
Don t generate errors and only write to log file when possible
238,819
public function enableComponent ( $ name ) { if ( ! array_key_exists ( $ name , $ this -> components ) ) { throw new NotValidCompoenentException ( $ name . ' component is not valid' ) ; } $ this -> components [ $ name ] = true ; return $ this ; }
Enable named component for compiler
238,820
public function enableAll ( array $ except = [ ] ) { foreach ( $ except as $ name ) { if ( ! array_key_exists ( $ name , $ this -> components ) ) { throw new NotValidCompoenentException ( $ name . ' component is not valid' ) ; } } foreach ( $ this -> components as $ name => & $ status ) { $ status = ! in_array ( $ name...
Enable all components except listed ones
238,821
public function compile ( $ force = false ) { $ jsOutputPath = $ this -> outputPath [ 'js' ] . '/bootstrap.min.js' ; $ cssOutputPath = $ this -> outputPath [ 'css' ] . '/bootstrap.min.css' ; if ( $ force === true || ! $ this -> filesystem -> exists ( $ jsOutputPath ) ) { $ this -> filesystem -> makeDirectory ( dirname ...
Compile enabled components
238,822
protected function minifyJs ( ) { $ minifier = new Minify \ JS ( ) ; $ this -> addJsToMinifier ( $ minifier , 'dropdowns' , 'dropdown' ) ; $ this -> addJsToMinifier ( $ minifier , 'modals' , 'modal' ) ; $ this -> addJsToMinifier ( $ minifier , 'tooltip' ) ; $ this -> addJsToMinifier ( $ minifier , 'popovers' , 'popover...
Minify JS components to single string
238,823
protected function addJsToMinifier ( Minify \ JS $ minify , $ componentName , $ fileName = null ) { if ( $ fileName === null ) { $ fileName = $ componentName ; } if ( $ this -> components [ $ componentName ] === true ) { $ minify -> add ( base_path ( "vendor/twbs/bootstrap/js/{$fileName}.js" ) ) ; } }
Add components javascript file to minifier if component is enabled
238,824
protected function prepareCssForLess ( $ componentName , $ fileName = null ) { if ( $ fileName === null ) { $ fileName = $ componentName ; } if ( $ this -> components [ $ componentName ] === true ) { return "@import \"{$fileName}.less\";" ; } return '' ; }
Prepare components less file for less processor s input if component is enabled
238,825
public function addEnvironmentVariable ( PostProcessCreationEvent $ event ) { $ env = $ event -> getProcess ( ) -> getEnv ( ) ; $ env [ 'para_project' ] = $ event -> getProject ( ) -> getName ( ) ; $ event -> getProcess ( ) -> setEnv ( $ env ) ; }
This callback method adds an environment variable to a created process .
238,826
public function _media_buttons ( $ editor_id = 'content' ) { $ post_type = get_post_type ( ) ; if ( ! $ post_type ) { return ; } $ post_type_object = get_post_type_object ( $ post_type ) ; if ( ! $ post_type_object || ! $ post_type_object -> public ) { return ; } ?> <button type="button" id="button-wp-awesome-component...
Added Add components button
238,827
public function _edit_form_after_editor ( ) { $ post_type = get_post_type ( ) ; if ( ! $ post_type ) { return ; } if ( false === get_post_type_object ( $ post_type ) -> public ) { return ; } ob_start ( ) ; include ( __DIR__ . '/view/modal.php' ) ; echo ob_get_clean ( ) ; }
Added modal html
238,828
public function getHandlers ( ) { $ commands = & gplcart_static ( 'module.file_manager.handlers' ) ; if ( isset ( $ commands ) ) { return $ commands ; } $ commands = ( array ) gplcart_config_get ( __DIR__ . '/../config/commands.php' ) ; foreach ( $ commands as $ id => & $ command ) { $ command [ 'command_id' ] = $ id ;...
Returns an array of supported commands
238,829
public function get ( $ command ) { $ commands = $ this -> getHandlers ( ) ; return empty ( $ commands [ $ command ] ) ? array ( ) : $ commands [ $ command ] ; }
Returns a single command
238,830
public function getAllowed ( $ file ) { $ commands = array ( ) ; foreach ( $ this -> getHandlers ( ) as $ id => $ command ) { if ( $ this -> isAllowed ( $ command , $ file ) ) { $ commands [ $ id ] = $ command ; } } return $ commands ; }
Returns an array of allowed commands for the given file
238,831
public function callHandler ( array $ command , $ method , $ args = array ( ) ) { try { $ handlers = $ this -> getHandlers ( ) ; return Handler :: call ( $ handlers , $ command [ 'command_id' ] , $ method , $ args ) ; } catch ( Exception $ ex ) { return $ ex -> getMessage ( ) ; } }
Call a command handler
238,832
public function submit ( array $ command , array $ args ) { $ result = ( array ) $ this -> callHandler ( $ command , 'submit' , $ args ) ; $ result += array ( 'redirect' => '' , 'message' => '' , 'severity' => '' ) ; return $ result ; }
Submit a command
238,833
public function getUrl ( ) { $ query = $ this -> getQueryString ( ) ; return sprintf ( '%s://%s/%s/%s%s' , $ this -> getScheme ( ) , trim ( $ this -> getHost ( ) , '/' ) , trim ( $ this -> config -> getRootEndpoint ( ) , '/' ) , $ this -> getEntityType ( ) , empty ( $ query ) ? '' : sprintf ( '?%s' , $ query ) ) ; }
Generates the request URL based on its current object state .
238,834
public function getQueryString ( ) { $ query = [ ] ; if ( ! empty ( $ this -> pagination ) ) { $ query [ self :: PARAM_PAGINATION ] = $ this -> pagination ; } if ( ! empty ( $ this -> filters ) ) { $ query [ self :: PARAM_FILTERING ] = $ this -> filters ; } foreach ( $ this -> fields as $ modelType => $ fields ) { $ qu...
Gets the query string based on the current object properties .
238,835
public function isAutocomplete ( ) { if ( false === $ this -> hasFilter ( self :: FILTER_AUTOCOMPLETE ) ) { return false ; } $ autocomplete = $ this -> getFilter ( self :: FILTER_AUTOCOMPLETE ) ; return isset ( $ autocomplete [ self :: FILTER_AUTOCOMPLETE_KEY ] ) && isset ( $ autocomplete [ self :: FILTER_AUTOCOMPLETE_...
Determines if this has an autocomplete filter enabled .
238,836
public function getAutocompleteKey ( ) { if ( false === $ this -> isAutocomplete ( ) ) { return null ; } return $ this -> getFilter ( self :: FILTER_AUTOCOMPLETE ) [ self :: FILTER_AUTOCOMPLETE_KEY ] ; }
Gets the autocomplete attribute key .
238,837
public function getAutocompleteValue ( ) { if ( false === $ this -> isAutocomplete ( ) ) { return null ; } return $ this -> getFilter ( self :: FILTER_AUTOCOMPLETE ) [ self :: FILTER_AUTOCOMPLETE_VALUE ] ; }
Gets the autocomplete search value .
238,838
public function isQuery ( ) { if ( false === $ this -> hasFilter ( self :: FILTER_QUERY ) ) { return false ; } $ query = $ this -> getFilter ( self :: FILTER_QUERY ) ; return isset ( $ query [ self :: FILTER_QUERY_CRITERIA ] ) ; }
Determines if this has the database query filter enabled .
238,839
public function getQueryCriteria ( ) { if ( false === $ this -> isQuery ( ) ) { return [ ] ; } $ queryKey = self :: FILTER_QUERY ; $ criteriaKey = self :: FILTER_QUERY_CRITERIA ; $ decoded = @ json_decode ( $ this -> getFilter ( $ queryKey ) [ $ criteriaKey ] , true ) ; if ( ! is_array ( $ decoded ) ) { $ param = sprin...
Gets the query criteria value .
238,840
public function getFilter ( $ key ) { if ( ! isset ( $ this -> filters [ $ key ] ) ) { return null ; } return $ this -> filters [ $ key ] ; }
Gets a specific filter by key .
238,841
private function parsePath ( $ path ) { $ parts = explode ( '/' , trim ( $ path , '/' ) ) ; for ( $ i = 0 ; $ i < 1 ; $ i ++ ) { if ( false === $ this -> issetNotEmpty ( $ i , $ parts ) ) { throw RestException :: invalidEndpoint ( $ path ) ; } } $ this -> extractEntityType ( $ parts ) ; $ this -> extractIdentifier ( $ ...
Parses the incoming request path and sets appropriate properties on this RestRequest object .
238,842
private function extractRelationship ( array $ parts ) { if ( isset ( $ parts [ 2 ] ) ) { if ( 'relationships' === $ parts [ 2 ] ) { if ( ! isset ( $ parts [ 3 ] ) ) { throw RestException :: invalidRelationshipEndpoint ( $ this -> parsedUri [ 'path' ] ) ; } $ this -> relationship = [ 'type' => 'self' , 'field' => $ par...
Extracts the entity relationship properties from an array of path parts .
238,843
private function parseQueryString ( $ queryString ) { parse_str ( $ queryString , $ parsed ) ; $ supported = $ this -> getSupportedParams ( ) ; foreach ( $ parsed as $ param => $ value ) { if ( ! isset ( $ supported [ $ param ] ) ) { throw RestException :: unsupportedQueryParam ( $ param , array_keys ( $ supported ) ) ...
Parses the incoming request query string and sets appropriate properties on this RestRequest object .
238,844
private function extractInclusions ( array $ params ) { if ( false === $ this -> issetNotEmpty ( self :: PARAM_INCLUSIONS , $ params ) ) { if ( true === $ this -> config -> includeAllByDefault ( ) ) { $ this -> inclusions = [ '*' => true ] ; } return $ this ; } $ inclusions = explode ( ',' , $ params [ self :: PARAM_IN...
Extracts relationship inclusions from an array of query params .
238,845
private function extractSorting ( array $ params ) { if ( false === $ this -> issetNotEmpty ( self :: PARAM_SORTING , $ params ) ) { return $ this ; } $ sort = explode ( ',' , $ params [ self :: PARAM_SORTING ] ) ; $ this -> sorting = [ ] ; foreach ( $ sort as $ field ) { $ direction = 1 ; if ( 0 === strpos ( $ field ,...
Extracts sorting criteria from an array of query params .
238,846
private function extractFields ( array $ params ) { if ( false === $ this -> issetNotEmpty ( self :: PARAM_FIELDSETS , $ params ) ) { return $ this ; } $ fields = $ params [ self :: PARAM_FIELDSETS ] ; if ( ! is_array ( $ fields ) ) { throw RestException :: invalidQueryParam ( self :: PARAM_FIELDSETS , 'The field param...
Extracts fields to return from an array of query params .
238,847
private function extractFilters ( array $ params ) { if ( false === $ this -> issetNotEmpty ( self :: PARAM_FILTERING , $ params ) ) { return $ this ; } $ filters = $ params [ self :: PARAM_FILTERING ] ; if ( ! is_array ( $ filters ) ) { throw RestException :: invalidQueryParam ( self :: PARAM_FILTERING , 'The filter p...
Extracts filtering criteria from an array of query params .
238,848
public function getSupportedParams ( ) { return [ self :: PARAM_INCLUSIONS => true , self :: PARAM_FIELDSETS => true , self :: PARAM_SORTING => true , self :: PARAM_PAGINATION => true , self :: PARAM_FILTERING => true , ] ; }
Gets query string parameters that this request supports .
238,849
public function userAction ( ) { $ page = ( int ) $ this -> getEvent ( ) -> getRouteMatch ( ) -> getParam ( 'page' ) ; $ userId = ( int ) $ this -> getEvent ( ) -> getRouteMatch ( ) -> getParam ( 'userId' ) ; $ user = \ SoliantEntityAudit \ Module :: getModuleOptions ( ) -> getEntityManager ( ) -> getRepository ( \ Sol...
Renders a paginated list of revisions for the given user
238,850
public function revisionEntityAction ( ) { $ this -> mapAllAuditedClasses ( ) ; $ page = ( int ) $ this -> getEvent ( ) -> getRouteMatch ( ) -> getParam ( 'page' ) ; $ revisionEntityId = ( int ) $ this -> getEvent ( ) -> getRouteMatch ( ) -> getParam ( 'revisionEntityId' ) ; $ revisionEntity = \ SoliantEntityAudit \ Mo...
Show the detail for a specific revision entity
238,851
public function entityAction ( ) { $ page = ( int ) $ this -> getEvent ( ) -> getRouteMatch ( ) -> getParam ( 'page' ) ; $ entityClass = $ this -> getEvent ( ) -> getRouteMatch ( ) -> getParam ( 'entityClass' ) ; return array ( 'entityClass' => $ entityClass , 'page' => $ page , ) ; }
Lists revisions for the supplied entity . Takes an audited entity class or audit class
238,852
private function packHeader ( int $ id , int $ offset , int $ size , int $ flags = 0 ) : string { return pack ( 'SSQI' , $ id , $ offset , $ size , $ flags ) ; }
Blocking method writes process result state to state file
238,853
public function & setDatabaseName ( $ database_name , $ select_database = true ) { if ( empty ( $ select_database ) || $ this -> link -> select_db ( $ database_name ) ) { $ this -> database_name = $ database_name ; } else { throw new ConnectionException ( "Failed to select database '$database_name'" ) ; } return $ this...
Set database name and optionally select that database .
238,854
private function tryToRecoverFromFailedQuery ( $ sql , $ arguments , $ load_mode , $ return_mode ) { switch ( $ this -> link -> errno ) { case 1196 : return null ; case 2006 : case 2013 : return $ this -> handleMySqlGoneAway ( $ sql , $ arguments , $ load_mode , $ return_mode ) ; case 1213 : return $ this -> handleDead...
Try to recover from failed query .
238,855
public function onLogQuery ( callable $ callback = null ) { if ( $ callback === null || is_callable ( $ callback ) ) { $ this -> on_log_query = $ callback ; } else { throw new InvalidArgumentException ( 'Callback needs to be NULL or callable' ) ; } }
Set a callback that will receive every query after we run it .
238,856
public function getLanguageId ( string $ shortCode ) : string { $ query = $ this -> Languages -> find ( 'all' , [ 'conditions' => [ 'Languages.code' => $ shortCode ] ] ) ; $ language = $ query -> first ( ) ; if ( empty ( $ language -> id ) ) { throw new InvalidArgumentException ( "Unsupported language code [$shortCode]...
Retrive language ID by code
238,857
public static function _genRijndael256IV ( $ cypher = FALSE ) { if ( ! $ cypher ) { $ cypher = mcrypt_module_open ( 'rijndael-256' , '' , 'ofb' , '' ) ; } $ iv = mcrypt_create_iv ( mcrypt_enc_get_iv_size ( $ cypher ) , MCRYPT_RAND ) ; mcrypt_module_close ( $ cypher ) ; return $ iv ; }
Generate a rijndael 256 initialisation vector
238,858
public static function _encryptRijndael256 ( $ str , $ key , $ iv = FALSE ) { if ( empty ( $ str ) ) { return '' ; } $ cypher = mcrypt_module_open ( 'rijndael-256' , '' , 'ofb' , '' ) ; if ( $ iv === FALSE ) { $ iv = self :: _genRijndael256IV ( $ cypher ) ; } $ key = substr ( $ key , 0 , mcrypt_enc_get_key_size ( $ cyp...
Encrypt and return a string using the Rijndael 256 cypher
238,859
public static function _decryptRijndael256 ( $ str , $ key , $ iv ) { if ( empty ( $ str ) ) { return '' ; } $ cypher = mcrypt_module_open ( 'rijndael-256' , '' , 'ofb' , '' ) ; $ key = substr ( $ key , 0 , mcrypt_enc_get_key_size ( $ cypher ) ) ; mcrypt_generic_init ( $ cypher , $ key , $ iv ) ; $ decrypted = mdecrypt...
Decrypt and return a string using the Rijndael 256 cypher
238,860
public function updateActionPost ( ) : object { $ response = $ this -> di -> get ( "response" ) ; $ request = $ this -> di -> get ( "request" ) ; $ session = $ this -> di -> get ( "session" ) ; $ key = $ request -> getPost ( "stylechooser" ) ; if ( $ key === "none" ) { $ session -> set ( "flashmessage" , "Unsetting the...
Update current selected style .
238,861
public function updateActionGet ( $ style ) : object { $ response = $ this -> di -> get ( "response" ) ; $ session = $ this -> di -> get ( "session" ) ; $ key = $ this -> cssUrl . "/" . $ style . ".css" ; $ keyMin = $ this -> cssUrl . "/" . $ style . ".min.css" ; if ( $ style === "none" ) { $ session -> set ( "flashmes...
Update current selected style using a GET url and redirect to last page visited .
238,862
public function get ( $ class = null ) { $ class = $ this -> getClass ( $ class ) ; if ( Arrays :: exists ( $ class , $ this -> reflections ) ) { return $ this -> reflections [ $ class ] ; } throw new Exception ( "Class not found: $class" ) ; }
Get an Instantiated ReflectionClass .
238,863
protected function appendIgnorePattern ( $ config , $ latestWrapper , $ previousWrapper ) { $ latestWrapper -> setFilter ( $ config -> filter ( ) ) ; $ previousWrapper -> setFilter ( $ config -> filter ( ) ) ; }
Add pattern to exclude files .
238,864
public function debug ( $ message ) { if ( ! $ this -> getOutput ( ) -> isDebug ( ) ) { return null ; } if ( func_num_args ( ) > 1 ) { $ message = vsprintf ( $ message , array_slice ( func_get_args ( ) , 1 ) ) ; } $ this -> getOutput ( ) -> writeln ( $ message ) ; }
Print debug message .
238,865
public function getEnvironment ( $ config = null ) { if ( ! $ this -> environment ) { if ( null == $ config ) { $ config = $ this -> getConfig ( ) ; } $ this -> environment = new Environment ( $ config ) ; } return $ this -> environment ; }
Get environment object .
238,866
protected function getPreviousWrapper ( ) { if ( $ this -> previousWrapper ) { return $ this -> previousWrapper ; } $ input = $ this -> getInput ( ) ; $ this -> previousWrapper = $ this -> getWrapperInstance ( $ input -> getArgument ( 'previous' ) , $ input -> getOption ( 'type' ) ) ; return $ this -> previousWrapper ;...
Get the wrapper for the VCS .
238,867
protected function getWrapperInstance ( $ base , $ type = 'Directory' ) { $ wrapper = $ this -> getWrapperClass ( $ type ) ; if ( ! $ wrapper ) { throw new \ InvalidArgumentException ( sprintf ( '<error>Unknown wrapper-type "%s"</error>' , $ type ) ) ; } if ( is_dir ( $ base ) ) { $ wrapper = $ this -> getWrapperClass ...
Create a wrapper for the given target .
238,868
protected function parseFiles ( $ wrapper , $ prefix ) { $ this -> verbose ( $ prefix . 'Fetching files ...' ) ; $ time = microtime ( true ) ; $ fileAmount = count ( $ wrapper -> getAllFileNames ( ) ) ; $ this -> verbose ( sprintf ( "\r" . $ prefix . "Collected %d files in %0.2f seconds." , $ fileAmount , microtime ( t...
Parse files within a wrapper .
238,869
protected function printConfig ( ) { $ config = $ this -> getConfig ( ) ; $ output = $ this -> getOutput ( ) ; foreach ( $ config -> ruleSet ( ) -> getChildren ( ) as $ ruleSet ) { $ output -> writeln ( 'Using rule set ' . $ ruleSet -> getName ( ) ) ; if ( ! $ output -> isDebug ( ) ) { continue ; } if ( ! $ ruleSet -> ...
Print debug information of the used config .
238,870
protected function resolveConfigFile ( ) { $ ruleSet = $ this -> getInput ( ) -> getOption ( 'ruleSet' ) ; if ( null === $ ruleSet && file_exists ( 'phpsemver.xml' ) ) { return 'phpsemver.xml' ; } if ( null === $ ruleSet ) { $ ruleSet = 'SemVer2' ; } if ( file_exists ( $ ruleSet ) ) { return $ ruleSet ; } $ defaultPath...
Resolve path to rule set XML .
238,871
public function url ( ) { if ( $ this -> type === self :: FORGOT_PASSWORD ) { return $ this -> getApp ( ) [ 'base_url' ] . 'users/forgot/' . $ this -> link ; } else if ( $ this -> type === self :: TEMPORARY ) { return $ this -> getApp ( ) [ 'base_url' ] . 'users/signup/' . $ this -> link ; } return false ; }
Gets the URL for this link .
238,872
public function getTokens ( ) { fseek ( $ this -> stream , 0 ) ; $ this -> buffer = new StreamBuffer ( $ this -> stream , static :: BUFFER_SIZE , $ this -> minLength ) ; $ this -> buffer -> read ( ) ; $ last = null ; while ( ! $ this -> buffer -> isEof ( ) ) { foreach ( $ this -> state -> match ( $ this -> buffer ) as ...
Loop through the stream pulling maximum type length each time find the largest type that matches and create a token then move on length characters
238,873
public function persistAndFlush ( ) { if ( 0 === func_num_args ( ) ) { throw new \ LogicException ( 'Missing arguments' ) ; } $ persists = [ ] ; $ entities = func_get_args ( ) ; foreach ( $ entities as $ entity ) { if ( true === is_array ( $ entity ) ) { $ persists = array_merge ( $ persists , $ entity ) ; } else { $ p...
Persist and Flush
238,874
public function removeAndFlush ( ) { if ( 0 === func_num_args ( ) ) { throw new \ LogicException ( 'Missing arguments' ) ; } foreach ( func_get_args ( ) as $ remove ) { $ this -> getDoctrine ( ) -> getManager ( ) -> remove ( $ remove ) ; } $ this -> getDoctrine ( ) -> getManager ( ) -> flush ( ) ; return $ this ; }
Remove and Flush
238,875
public function registerPages ( ) { foreach ( $ this -> menus as $ menu ) { $ this -> registerPage ( $ menu [ 'title' ] , $ menu [ 'cap' ] , $ menu [ 'link' ] , $ menu [ 'class' ] , $ menu [ 'callback' ] , $ menu [ 'type' ] ) ; } $ this -> hideMenu ( ) ; }
register menu pages
238,876
private function registerPage ( $ title , $ capabilities , $ url_param , $ class , $ callback , $ type ) { if ( $ type == 'submenu' ) { add_submenu_page ( $ this -> url , $ title , $ title , $ capabilities , $ url_param , array ( $ class , $ callback ) ) ; } else { add_menu_page ( $ title , $ title , $ capabilities , $...
register using add_submenu_page
238,877
private function sort ( ) { uksort ( $ this -> tokens , function ( $ first , $ second ) { return strlen ( $ second ) - strlen ( $ first ) ; } ) ; }
Sort the tokens into reverse key length order
238,878
private function validHmac ( $ hmac , $ compareHmac ) { if ( function_exists ( "hash_equals" ) ) { return hash_equals ( $ hmac , $ compareHmac ) ; } $ hashLength = mb_strlen ( $ hmac , '8bit' ) ; $ compareLength = mb_strlen ( $ compareHmac , '8bit' ) ; if ( $ hashLength !== $ compareLength ) { return false ; } $ result...
Validates if the provided hmac is equal to the expected hmac
238,879
public function encrypt ( $ original_string , $ cipher_key ) { $ cipher_key = $ this -> _genKey ( $ cipher_key ) ; $ ivSize = openssl_cipher_iv_length ( 'AES-256-CBC' ) ; $ iv = openssl_random_pseudo_bytes ( $ ivSize ) ; $ cipher_text = $ iv . openssl_encrypt ( $ original_string , 'AES-256-CBC' , $ cipher_key , OPENSSL...
Encrypts a string using a secret
238,880
public function decrypt ( $ cipher_string , $ cipher_key ) { $ cipher_key = $ this -> _genKey ( $ cipher_key ) ; $ hmacSize = 64 ; $ hmacString = mb_substr ( $ cipher_string , 0 , $ hmacSize , "8bit" ) ; $ cipher_text = mb_substr ( $ cipher_string , $ hmacSize , null , "8bit" ) ; if ( ! $ this -> validHmac ( $ hmacStri...
Decrypts a string using a secret
238,881
public function listen ( $ action , $ logged = 'no' , $ callable ) { if ( ! is_string ( $ action ) || strlen ( $ action ) == 0 ) { throw new AjaxException ( "Invalid parameter for the action." ) ; } if ( is_callable ( $ callable ) ) { $ this -> registerWithClosure ( $ action , $ logged , $ callable ) ; } else { if ( st...
Handle the Ajax response . Run the appropriate action hooks used by WordPress in order to perform POST ajax request securely . Developers have the option to run ajax for the Front - end Back - end either users are logged in or not or both .
238,882
public function validate ( $ nonce = null , $ value = null , $ message = null , $ data = null ) { $ nonce = ( $ nonce ) ? $ nonce : $ this -> app [ 'request' ] -> get ( 'nonce' ) ; $ value = ( $ value ) ? $ value : $ this -> app [ 'config' ] -> get ( 'app.key' ) ; if ( ! wp_verify_nonce ( $ nonce , $ value ) ) { $ defa...
Check nonce against app . key
238,883
public function insert ( $ key , $ value ) { $ this -> file -> flock ( LOCK_SH ) ; $ this -> file -> fseek ( 0 , SEEK_END ) ; $ position = $ this -> file -> ftell ( ) ; if ( is_array ( $ value ) || is_object ( $ value ) ) { $ value = json_encode ( $ value ) ; } $ this -> file -> flock ( LOCK_EX ) ; $ this -> file -> fw...
Write the new record to the database file
238,884
public function read ( $ position ) { $ this -> file -> flock ( LOCK_SH ) ; $ metadata = $ this -> getMetadata ( $ position ) ; $ this -> file -> fseek ( $ metadata -> klen , SEEK_CUR ) ; $ value = $ this -> file -> fread ( $ metadata -> vlen ) ; $ this -> file -> flock ( LOCK_UN ) ; $ mixed = json_decode ( $ value , t...
Retrieves the data from the database for a Key based on position
238,885
public function update ( $ position , $ key , $ value ) { $ this -> remove ( $ position ) ; return $ this -> insert ( $ key , $ value ) ; }
Updates an existing key by removing it from the existing file and appending the new value to the end of the file .
238,886
public function truncate ( ) { $ this -> file -> flock ( LOCK_EX ) ; $ result = $ this -> file -> ftruncate ( 0 ) ; $ this -> file -> flock ( LOCK_UN ) ; return $ result ; }
Truncates the collection removing all the data from the file
238,887
public static function create ( $ context , $ type , LoggerInterface $ logger = null , $ persistentId = null , $ onNewSocket = null ) { if ( ! is_callable ( $ onNewSocket ) ) { $ onNewSocket = null ; } $ newSocket = false ; $ callback = function ( ) use ( $ onNewSocket , & $ newSocket ) { $ newSocket = true ; if ( $ on...
Create a new Socket .
238,888
public function hasEvents ( $ timeout = 0 ) { $ poll = new ZMQPoll ( ) ; $ poll -> add ( $ this , ZMQ :: POLL_IN ) ; $ read = $ write = array ( ) ; $ events = $ poll -> poll ( $ read , $ write , $ timeout ) ; if ( $ events > 0 ) { return true ; } return false ; }
Poll for new Events on this Socket .
238,889
public function mrecv ( $ mode = 0 ) { if ( $ this -> verbose ) { $ this -> getLogger ( ) -> debug ( 'PRE RECV: ' . $ this -> id ) ; } $ data = array ( ) ; while ( true ) { $ data [ ] = $ this -> recv ( $ mode ) ; if ( ! $ this -> getSockOpt ( ZMQ :: SOCKOPT_RCVMORE ) ) { break ; } } $ message = new Message ( $ data ) ...
Receive a Message .
238,890
public function msend ( Message $ msg ) { if ( ZMQ :: SOCKET_ROUTER === $ this -> getSocketType ( ) ) { $ msg -> prepend ( $ msg -> getRoutingInformation ( ) ) ; } if ( $ this -> verbose ) { $ this -> getLogger ( ) -> debug ( 'SEND: ' . $ this -> id ) ; $ this -> getLogger ( ) -> debug ( $ msg ) ; } $ parts = $ msg -> ...
Send a Messsage .
238,891
private function createResolverFactories ( $ config , ContainerBuilder $ container ) { if ( null !== $ this -> factories ) { return $ this -> factories ; } $ tempContainer = new ContainerBuilder ( ) ; $ parameterBag = $ container -> getParameterBag ( ) ; $ loader = new XmlFileLoader ( $ tempContainer , new FileLocator ...
Creates the resolver factories
238,892
public function getPagedResults ( $ limit = 50 , $ page = 0 ) { $ dql = sprintf ( self :: DQL_GET_PAGED , AuditEvent :: class ) ; return $ this -> getPaginator ( $ dql , $ limit , $ page ) ; }
Get all audit events paged .
238,893
public function connect ( ) { $ this -> errorHandler -> start ( ) ; if ( $ this -> configuration -> getSSL ( ) ) { $ this -> resource = $ this -> driver -> sslConnect ( $ this -> configuration -> getHost ( ) , $ this -> configuration -> getPort ( ) , $ this -> configuration -> getTimeout ( ) ) ; } else { $ this -> reso...
Standard function for creating a FTP connection and logging in .
238,894
public function fput ( $ stream , $ remote ) { $ this -> isAlive ( true ) ; $ this -> errorHandler -> start ( ) ; if ( $ this -> driver -> fput ( $ this -> resource , $ remote , $ stream , FTP_BINARY ) ) { $ this -> errorHandler -> stop ( ) ; return true ; } $ this -> errorHandler -> stop ( ) ; return false ; }
Similar to put but does not get the file localy .
238,895
public function putContents ( $ contents , $ remote ) { $ stream = fopen ( 'data://text/plain,' . $ contents , 'r' ) ; return $ this -> fput ( $ stream , $ remote ) ; }
Write the contents of a string to the remote .
238,896
public function fget ( $ remote ) { $ this -> isAlive ( true ) ; $ this -> errorHandler -> start ( ) ; $ handle = fopen ( 'php://temp' , 'r+' ) ; if ( $ this -> driver -> fget ( $ this -> resource , $ handle , $ remote , FTP_BINARY ) ) { rewind ( $ handle ) ; $ this -> errorHandler -> stop ( ) ; return $ handle ; } $ t...
Similar to get but does not save file localy .
238,897
public static function getActivity ( int $ id ) : Activity { self :: initializeActivities ( ) ; if ( ! isset ( self :: $ activities [ $ id ] ) ) { throw new RuneScapeException ( sprintf ( "Activity with id %d does not exist." , $ id ) ) ; } return self :: $ activities [ $ id ] ; }
Retrieve an activity by ID . You can use the ACTIVITY_ constants in this class for IDs .
238,898
public function kill_process ( $ pid ) { if ( ! is_numeric ( $ pid ) ) return false ; $ pid = ( int ) $ pid ; $ sql = "KILL $pid" ; return $ this -> db -> query ( $ sql ) ; }
kill a specific process
238,899
public function setArray ( $ key , array $ values ) { $ this -> validateKey ( $ key ) ; if ( empty ( $ values ) ) { throw new \ InvalidArgumentException ( "Missing value." ) ; } foreach ( $ values as $ v ) { $ this -> validateValue ( $ v ) ; } $ this -> params [ $ key ] = [ ] ; foreach ( $ values as $ v ) { $ this -> p...
Sets several values for the given parameter key .