idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
57,800
public function getAllowedHumanValues ( array $ except = [ ] ) { $ map = $ this -> getMap ( ) ; $ humanValues = array_diff ( array_values ( $ map ) , $ except ) ; return $ humanValues ; }
Returns list of the all registered humanized values
57,801
public function getMap ( ) { $ result = [ ] ; foreach ( $ this -> getConstants ( ) as $ dbName => $ dbValue ) { if ( 0 === strpos ( $ dbName , self :: PREFIX_DB ) ) { $ result [ $ dbValue ] = $ this -> getAppropriateConstValue ( self :: PREFIX_DB , $ dbName ) ; } } return $ result ; }
Returns map of the all registered values in the key = > value pairs . The key equal to database value and the value equal to humanized value .
57,802
public function getRandomDbValue ( array $ except = [ ] ) { $ values = $ this -> getAllowedDbValues ( $ except ) ; shuffle ( $ values ) ; return array_shift ( $ values ) ; }
Returns random database value
57,803
public function getRandomHumanValue ( array $ except = [ ] ) { $ values = $ this -> getAllowedHumanValues ( $ except ) ; shuffle ( $ values ) ; return array_shift ( $ values ) ; }
Returns random humanized value
57,804
protected function getAppropriateConstValue ( $ prefixFrom , $ constName ) { $ prefixTo = $ prefixFrom === self :: PREFIX_DB ? self :: PREFIX_HUMAN : self :: PREFIX_DB ; $ count = 1 ; $ constName = str_replace ( $ prefixFrom , $ prefixTo , $ constName , $ count ) ; return constant ( 'static::' . $ constName ) ; }
Returns appropriated pair value
57,805
private function convert ( $ value , $ prefixFrom ) { foreach ( $ this -> getConstants ( ) as $ constName => $ constValue ) { if ( 0 === strpos ( $ constName , $ prefixFrom ) && $ value === $ constValue ) { return $ this -> getAppropriateConstValue ( $ prefixFrom , $ constName ) ; } } throw new UndefinedMapValueExcepti...
Returns appropriated value by received origin value . Humanized value by received database value and vise versa .
57,806
private function getConstants ( ) { if ( empty ( $ this -> constants ) ) { try { $ reflection = new \ ReflectionClass ( $ this -> getClassName ( ) ) ; $ this -> constants = $ reflection -> getConstants ( ) ; } catch ( \ ReflectionException $ e ) { $ this -> constants = [ ] ; } } return $ this -> constants ; }
Returns list of the all available constants of the current class
57,807
public function getAuthorizeUrl ( array $ params = [ ] ) { $ result = $ this -> OAuthRequest ( self :: API_BASE . self :: REQUEST_PATH , $ params ) ; if ( $ result -> getCode ( ) == 200 ) { $ tokens = $ this -> parseResponse ( $ result -> getResponse ( ) ) ; return [ 'auth_url' => self :: API_BASE . $ this -> auth_meth...
Gets the authorization url .
57,808
public function loadRequest ( $ buffer ) { $ this -> requestAt = microtime ( true ) ; list ( $ this -> _rawHeader , $ this -> _rawBody ) = explode ( "\r\n\r\n" , $ buffer , 2 ) ; $ headers = explode ( "\r\n" , $ this -> _rawHeader , 2 ) ; list ( $ this -> method , $ this -> uri , $ this -> version ) = explode ( ' ' , $...
load reqeust buffer to this object
57,809
public static function getCheckDigit ( string $ number ) : int { if ( ! ctype_digit ( $ number ) ) { throw new \ InvalidArgumentException ( 'The number must be a string of digits' ) ; } $ checksum = self :: checksum ( $ number . '0' ) ; return ( $ checksum === 0 ) ? 0 : 10 - $ checksum ; }
Computes and returns the check digit of a number .
57,810
public static function isValid ( string $ number ) : bool { if ( ctype_digit ( $ number ) ) { return self :: checksum ( $ number ) === 0 ; } return false ; }
Checks that a number is valid .
57,811
private static function checksum ( string $ number ) : int { $ number = strrev ( $ number ) ; $ length = strlen ( $ number ) ; $ sum = 0 ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ value = $ number [ $ i ] * ( $ i % 2 + 1 ) ; $ sum += ( $ value >= 10 ? $ value - 9 : $ value ) ; } return $ sum % 10 ; }
Computes the checksum of a number .
57,812
public static function api_support ( ) { $ existing_classes = get_declared_classes ( ) ; foreach ( glob ( dirname ( dirname ( __FILE__ ) ) . '/services/*.class.php' ) as $ file ) { include $ file ; } $ with_sdk_classes = get_declared_classes ( ) ; $ new_classes = array_diff ( $ with_sdk_classes , $ existing_classes ) ;...
Gets information about the web service APIs that the SDK supports .
57,813
public function assertIsInstance ( $ class , $ instance , $ message = '%s and %s are not the same instance' , $ exception = 'Asserts' ) { $ is_instance = ( get_class ( $ class ) === $ instance ) ; if ( $ is_instance === false ) { $ this -> throwException ( $ exception , $ message , array ( get_class ( $ class ) , $ ins...
Verifies that the specified conditions are of the same instance . The assertion fails if they are not .
57,814
public function listenerHandle ( IEvent $ event ) { $ event -> post -> count_views ++ ; $ event -> post -> save ( ) ; var_dump ( $ event -> post -> count_views ) ; }
Update the post view count
57,815
public function hiddenInput ( $ options = [ ] ) { $ options = array_replace_recursive ( $ this -> inputOptions , $ options ) ; $ this -> adjustLabelFor ( $ options ) ; $ this -> parts [ '{label}' ] = false ; $ this -> parts [ '{input}' ] = Html :: activeHiddenInput ( $ this -> model , $ this -> attribute , $ options ) ...
override original method
57,816
public function getEventDescription ( ) { $ event = array ( 'type' => null , 'name' => null , 'args' => null , 'params' => null ) ; if ( is_string ( $ this -> value ) ) { $ event [ 'type' ] = $ this -> value ; } else { $ event [ 'type' ] = isset ( $ this -> value [ 'type' ] ) ? $ this -> value [ 'type' ] : null ; $ eve...
Retrieve event description
57,817
public function getImporters ( $ all = false ) { $ importers = [ ] ; foreach ( $ this -> importers as $ importer ) { if ( $ importer -> isEnabled ( ) || true === $ all ) { $ importers [ $ importer -> getKey ( ) ] = $ importer ; } } return $ importers ; }
Returns importers keyed by their internal key .
57,818
public function getImporter ( $ key ) { foreach ( $ this -> getImporters ( true ) as $ k => $ importer ) { if ( $ key === $ k ) { return $ importer ; } } throw new \ InvalidArgumentException ( sprintf ( 'Importer could not be found by key `%s`.' , $ key ) ) ; }
Retrieves an importer by key
57,819
public function getImporterKeys ( $ all = false ) { $ keys = [ ] ; if ( $ all ) { $ keys = $ this -> importerKeys ; } else { foreach ( $ this -> importerKeys as $ key => $ bit ) { if ( $ bit ) { $ keys [ ] = $ key ; } } } return $ keys ; }
Returns the stored enabled importers for this model .
57,820
public function getSegmentKeys ( $ all = false ) { $ keys = [ ] ; if ( $ all ) { $ keys = $ this -> segmentKeys ; } else { foreach ( $ this -> segmentKeys as $ key => $ bit ) { if ( $ bit ) { $ keys [ ] = $ key ; } } } return $ keys ; }
Returns the stored enabled segments for this model .
57,821
public function getSegment ( $ key ) { foreach ( $ this -> getImporters ( ) as $ importer ) { if ( $ importer -> hasSegment ( $ key ) ) { return $ importer -> getSegment ( $ key ) ; } } throw new \ InvalidArgumentException ( sprintf ( 'Segment could not be found by key `%s`.' , $ key ) ) ; }
Retrieves a segment by key
57,822
public function toggleImporter ( $ key ) { $ importer = $ this -> getImporter ( $ key ) ; $ importer -> toggle ( ) ; foreach ( $ importer -> getSegments ( ) as $ segment ) { if ( $ importer -> isEnabled ( ) ) { $ this -> addSegment ( $ segment ) ; } else { $ this -> removeSegment ( $ segment ) ; } } }
Toggles an importer and its segments
57,823
public function toggleSegment ( $ key ) { $ segment = $ this -> getSegment ( $ key ) ; if ( false === $ segment -> isEnabled ( ) ) { return $ segment -> enable ( ) ; } return $ segment -> disable ( ) ; }
Toggles a segment
57,824
public function getSegments ( $ all = false ) { if ( $ all ) { return $ this -> segments ; } $ segments = [ ] ; foreach ( $ this -> segments as $ segment ) { if ( $ segment -> isEnabled ( ) ) { $ segments [ ] = $ segment ; } } return $ segments ; }
Returns segments keyed by their internal key .
57,825
final protected function process ( \ SelectQueryInterface $ select , Query $ query ) { if ( $ query -> hasSortField ( ) ) { $ select -> orderBy ( $ query -> getSortField ( ) , Query :: SORT_DESC === $ query -> getSortOrder ( ) ? 'desc' : 'asc' ) ; } $ select -> orderBy ( 'u.uid' , Query :: SORT_DESC === $ query -> getS...
Implementors must set the users table with u as alias and call this method for the datasource to work correctly .
57,826
public function requestToken ( TokenRequest $ request ) { $ result = $ this -> request ( 'POST' , '/tokens' , [ 'card[number]' => $ request -> getCardNumber ( ) , 'card[exp_month]' => $ request -> getExpirationMonth ( ) , 'card[exp_year]' => $ request -> getExpirationYear ( ) , 'card[cvc]' => $ request -> getSecurityCo...
Returns a new token .
57,827
public function getToken ( $ id ) { $ result = $ this -> request ( 'GET' , '/tokens/' . $ id ) ; return $ this -> objectConverter -> convert ( $ result ) ; }
Returns the token by id .
57,828
public function getCharges ( $ limit = 10 , $ startingAfter = null , $ endingBefore = null ) { $ endpointUrl = '/charges?limit=' . $ limit ; if ( $ startingAfter ) { $ endpointUrl .= '&starting_after=' . $ startingAfter ; } if ( $ endingBefore ) { $ endpointUrl .= '&ending_before=' . $ endingBefore ; } $ result = $ thi...
Returns the charges .
57,829
public function getCharge ( $ id ) { $ result = $ this -> request ( 'GET' , '/charges/' . $ id ) ; return $ this -> objectConverter -> convert ( $ result ) ; }
Returns the charge by id .
57,830
public function charge ( ChargeRequest $ request ) { $ result = $ this -> request ( 'POST' , '/charges' , [ 'card' => ( string ) $ request -> getToken ( ) , 'amount' => $ request -> getAmount ( ) ? $ request -> getAmount ( ) -> getAmount ( ) : null , 'currency' => $ request -> getAmount ( ) ? $ request -> getAmount ( )...
Creates a new charge .
57,831
public function capture ( $ charge ) { $ result = $ this -> request ( 'POST' , '/charges/' . $ charge . '/capture' ) ; return $ this -> objectConverter -> convert ( $ result ) ; }
Captures the charge .
57,832
public function refund ( $ charge ) { $ result = $ this -> request ( 'POST' , '/charges/' . $ charge . '/refund' ) ; return $ this -> objectConverter -> convert ( $ result ) ; }
Refunds the charge .
57,833
public static function getPrefixSuffix ( $ expressionType = Expression :: EXPRESSION_TYPE_PLAIN ) { $ prefix = '' ; $ suffix = '' ; $ patternPrefix = '' ; $ patternSuffix = '' ; switch ( $ expressionType ) { case Expression :: EXPRESSION_TYPE_PLAIN : $ patternPrefix = '^' ; $ patternSuffix = '$' ; break ; case Expressi...
Get prefix and suffix
57,834
public function selector ( $ selector ) { if ( is_scalar ( $ selector ) ) { $ this -> selector = json_encode ( $ selector ) ; } else { $ this -> selector = Buffering \ Callback :: do ( $ selector ) ; } return $ this ; }
Keeps jquery selector
57,835
function getQueryExecutor ( ) { if ( ! $ this -> exec ) { $ this -> exec = new QueryExecutor ( $ this -> conn ) ; } return $ this -> exec ; }
Get the query executor
57,836
function getMetadataCache ( ) { if ( ! isset ( $ this -> metadatCache ) ) { $ this -> metadataCache = static :: $ defaultMetadataCache ? : new Table \ StaticCache ; } return $ this -> metadataCache ; }
Get the metadata cache
57,837
function getIdentity ( ) { if ( ! isset ( $ this -> identity ) ) { $ this -> identity = new Table \ Identity ( $ this ) ; } return $ this -> identity ; }
Get the primary key
57,838
function getRelations ( ) { if ( ! isset ( $ this -> relations ) ) { $ this -> relations = new Table \ Relations ( $ this ) ; } return $ this -> relations ; }
Get foreign key relations
57,839
function notify ( \ pq \ Gateway \ Row $ row = null , $ event = null , array & $ where = null ) { foreach ( $ this -> observers as $ observer ) { $ observer -> update ( $ this , $ row , $ event , $ where ) ; } }
Implements \ SplSubject
57,840
public function onResult ( \ pq \ Result $ result = null ) { if ( $ result && $ result -> status != \ pq \ Result :: TUPLES_OK ) { return $ result ; } $ rowset = $ this -> getRowsetPrototype ( ) ; if ( is_callable ( $ rowset ) ) { return $ rowset ( $ result ) ; } elseif ( $ rowset ) { return new $ rowset ( $ this , $ r...
Retreives the result of an executed query
57,841
function find ( array $ where = null , $ order = null , $ limit = 0 , $ offset = 0 , $ lock = null ) { $ query = $ this -> getQueryWriter ( ) -> reset ( ) ; $ query -> write ( "SELECT * FROM" , $ this -> conn -> quoteName ( $ this -> name ) ) ; if ( $ where ) { $ query -> write ( "WHERE" ) -> criteria ( $ where ) ; } i...
Find rows in the table
57,842
function of ( Row $ foreign , $ ref = null , $ order = null , $ limit = 0 , $ offset = 0 ) { if ( ! ( $ rel = $ this -> getRelation ( $ foreign -> getTable ( ) -> getName ( ) , $ ref ) ) ) { return $ this -> onResult ( null ) ; } $ where = array ( ) ; foreach ( $ rel as $ key => $ ref ) { $ where [ "$key=" ] = $ foreig...
Get the child rows of a row by foreign key
57,843
function by ( Row $ foreign , $ ref = null ) { if ( ! ( $ rel = $ foreign -> getTable ( ) -> getRelation ( $ this -> getName ( ) , $ ref ) ) ) { return $ this -> onResult ( null ) ; } $ where = array ( ) ; foreach ( $ rel as $ key => $ ref ) { $ where [ "$ref=" ] = $ foreign -> $ key ; } return $ this -> find ( $ where...
Get the parent rows of a row by foreign key
57,844
function with ( array $ relations , array $ where = null , $ order = null , $ limit = 0 , $ offset = 0 ) { $ qthis = $ this -> conn -> quoteName ( $ this -> getName ( ) ) ; $ query = $ this -> getQueryWriter ( ) -> reset ( ) ; $ query -> write ( "SELECT" , "$qthis.*" , "FROM" , $ qthis ) ; foreach ( $ relations as $ re...
Get rows dependent on other rows by foreign keys
57,845
function create ( array $ data = null , $ returning = "*" ) { $ query = $ this -> getQueryWriter ( ) -> reset ( ) ; $ query -> write ( "INSERT INTO" , $ this -> conn -> quoteName ( $ this -> name ) ) ; if ( $ data ) { $ first = true ; $ params = array ( ) ; foreach ( $ data as $ key => $ val ) { $ query -> write ( $ fi...
Insert a row into the table
57,846
function update ( array $ where , array $ data , $ returning = "*" ) { $ query = $ this -> getQueryWriter ( ) -> reset ( ) ; $ query -> write ( "UPDATE" , $ this -> conn -> quoteName ( $ this -> name ) ) ; $ first = true ; foreach ( $ data as $ key => $ val ) { $ query -> write ( $ first ? "SET" : "," , $ key , "=" , $...
Update rows in the table
57,847
function delete ( array $ where , $ returning = null ) { $ query = $ this -> getQueryWriter ( ) -> reset ( ) ; $ query -> write ( "DELETE FROM" , $ this -> conn -> quoteName ( $ this -> name ) ) ; $ query -> write ( "WHERE" ) -> criteria ( $ where ) ; if ( strlen ( $ returning ) ) { $ query -> write ( "RETURNING" , $ r...
Delete rows from the table
57,848
public function load ( $ data , $ dataType = 'json' ) { $ this -> _data = ( $ dataType != 'json' ) ? $ this -> dataToJson ( $ data ) : $ data ; }
loads the dataset and converts it to the correct format
57,849
public function draw ( $ div , array $ options = [ ] ) { $ output = '' ; if ( self :: $ _first ) { $ output .= $ this -> initChart ( ) ; } $ output .= '<script type="text/javascript">' . "\n" ; $ output .= 'google.setOnLoadCallback(drawChart' . self :: $ _count . ');' . "\n" ; $ output .= 'function drawChart' . self ::...
draws the chart
57,850
private function getColumns ( $ data ) { $ cols = [ ] ; foreach ( $ data [ 0 ] as $ key => $ value ) { if ( is_numeric ( $ key ) ) { if ( is_string ( $ data [ 1 ] [ $ key ] ) ) { $ cols [ ] = [ 'id' => '' , 'label' => $ value , 'type' => 'string' ] ; } else { $ cols [ ] = [ 'id' => '' , 'label' => $ value , 'type' => '...
substracts the column names from the first and second row in the dataset
57,851
private function dataToJson ( $ data ) { $ cols = $ this -> getColumns ( $ data ) ; $ rows = [ ] ; foreach ( $ data as $ key => $ row ) { if ( $ key != 0 || ! $ this -> _skipFirstRow ) { $ c = [ ] ; foreach ( $ row as $ v ) { $ c [ ] = [ 'v' => $ v ] ; } $ rows [ ] = [ 'c' => $ c ] ; } } return json_encode ( [ 'cols' =...
convert array data to json
57,852
protected function processResponse ( ResponseInterface $ response ) { if ( 200 !== $ response -> getStatusCode ( ) ) { throw new IcoBenchException ( sprintf ( 'IcoBench replied with non-success status (%s)' , $ response -> getStatusCode ( ) ) ) ; } $ data = json_decode ( $ response -> getBody ( ) , true ) ; if ( isset ...
Get data from response
57,853
public function getTotal ( $ user , $ type = '' , $ count = 'points' ) { $ em = $ this -> serviceLocator -> get ( 'playgroundflow_doctrine_em' ) ; if ( $ count == 'points' ) { $ aggregate = 'SUM(e.points)' ; } elseif ( $ count == 'count' ) { $ aggregate = 'COUNT(e.id)' ; } switch ( $ type ) { case 'game' : $ filter = a...
This function return count of events or total points by event category for one user
57,854
public function clear ( ) { if ( $ this -> files -> exists ( $ this -> destination ) ) { $ this -> files -> remove ( $ this -> destination ) ; } $ this -> files -> mkdir ( $ this -> destination ) ; }
Clear destination folder
57,855
public function build ( Route $ route , $ name , array $ parameters = [ ] ) { $ url = $ this -> app [ 'url_generator' ] -> generate ( $ name , $ parameters , UrlGeneratorInterface :: ABSOLUTE_URL ) ; $ request = Request :: create ( $ url , 'GET' , array_merge ( [ '_format' => $ route -> getFormat ( ) ] , $ parameters )...
Dump the given Route into a file
57,856
public function getBoundary ( ) : Geometry { $ event = new AccessorOpEvent ( $ this ) ; $ this -> fireOperationEvent ( AccessorOpEvent :: BOUNDARY_EVENT , $ event ) ; return $ event -> getResults ( ) ; }
Gets the closure of the combinatorial bound of this Geometry object
57,857
public function getEnvelope ( ) : Geometry { $ event = new AccessorOpEvent ( $ this ) ; $ this -> fireOperationEvent ( AccessorOpEvent :: ENVELOPE_EVENT , $ event ) ; return $ event -> getResults ( ) ; }
Gets the minimum bounding box for this Geometry as a Geometry .
57,858
public function asText ( bool $ extended = false ) : string { $ event = new OutputOpEvent ( $ this , [ 'extended' => $ extended ] ) ; $ this -> fireOperationEvent ( OutputOpEvent :: AS_TEXT_EVENT , $ event ) ; return $ event -> getResults ( ) ; }
Exports this Geometry object to a specific Well - known Text Representation .
57,859
public function asBinary ( bool $ extended = false , string $ endianness = 'NDR' , bool $ unpack = false ) : string { $ event = new OutputOpEvent ( $ this , [ 'extended' => $ extended , 'endianness' => $ endianness , 'unpack' => $ unpack ] ) ; $ this -> fireOperationEvent ( OutputOpEvent :: AS_BINARY_EVENT , $ event ) ...
Exports this Geometry object to a specific Well - known Binary Representation .
57,860
public function isSimple ( ) : bool { $ event = new AccessorOpEvent ( $ this ) ; $ this -> fireOperationEvent ( AccessorOpEvent :: IS_SIMPLE_EVENT , $ event ) ; return $ event -> getResults ( ) ; }
Indicates whether this Geometry object has no anomalous geometric points such as self intersection of self tangency .
57,861
public function convexHull ( ) : Geometry { $ event = new ProcessOpEvent ( $ this ) ; $ this -> fireOperationEvent ( ProcessOpEvent :: CONVEX_HULL_EVENT , $ event ) ; return $ event -> getResults ( ) ; }
Gets a Geometry that represents the convex hull of this Geometry .
57,862
public function getCentroid ( bool $ use_spheriod = false ) : Point { $ event = new AccessorOpEvent ( $ this , [ 'use_spheriod' => $ use_spheriod ] ) ; $ this -> fireOperationEvent ( AccessorOpEvent :: CENTROID_EVENT , $ event ) ; return $ event -> getResults ( ) ; }
The mathematical centroid for this Surface as a Point . The result is not guaranteed to be on this Surface .
57,863
public function authentication ( ) { $ response = \ Aperdia \ Clef :: authentication ( $ _GET [ 'code' ] ) ; if ( ! $ response ) { $ error = 'Error' ; } elseif ( isset ( $ response [ 'error' ] ) ) { $ error = $ response [ 'error' ] ; } elseif ( isset ( $ response [ 'success' ] ) ) { $ verif = Authentication :: wherepro...
Authentication with Clef account
57,864
public function logout ( ) { if ( isset ( $ _POST [ 'logout_token' ] ) ) { $ clef = \ Aperdia \ Clef :: logout ( $ _POST [ 'logout_token' ] ) ; if ( ! $ clef ) { $ auth = Authentication :: whereprovider ( "clef" ) -> whereprovider_uid ( $ clef ) -> first ( ) ; if ( ! empty ( $ auth ) ) { $ user = User :: find ( $ auth ...
Logout by WebHook
57,865
public function getWizard ( ManipulateWidgetEvent $ event ) { if ( $ event -> getModel ( ) -> getProviderName ( ) !== $ this -> metaModel -> getTableName ( ) || $ event -> getProperty ( ) -> getName ( ) !== $ this -> propertyName ) { return ; } $ propName = $ event -> getProperty ( ) -> getName ( ) ; $ model = $ event ...
Build the wizard string .
57,866
public function build ( string $ key , $ value , \ DateTimeInterface $ expire = null ) : Cookie { return new Cookie ( $ key , $ this -> encryptor -> encrypt ( $ value ) , $ expire , '/' , $ this -> domain , $ this -> secure ) ; }
Builds a new cookie
57,867
public function clearCache ( ) { if ( $ this -> connector -> getURL ( ) === null ) { return 'Cannot find site URL from configuration.' ; } $ url = $ this -> connector -> getURL ( ) . self :: VERSION . $ this -> connector -> getSiteID ( ) . '/cache-clear' ; $ params = [ ] ; $ response = $ this -> connector -> connecting...
Clear site cache .
57,868
public function createBackup ( $ label , $ components ) { if ( $ this -> connector -> getURL ( ) === null ) { return 'Cannot find site URL from configuration.' ; } $ url = $ this -> connector -> getURL ( ) . self :: VERSION . $ this -> connector -> getSiteID ( ) . '/backup' ; $ params = [ 'label' => $ label , 'componen...
Create backup for specific site in site factory .
57,869
public function deleteBackup ( $ backupId , $ callbackUrl , $ callbackMethod , $ callerData ) { if ( $ this -> connector -> getURL ( ) === null ) { return 'Cannot find site URL from configuration.' ; } $ url = $ this -> connector -> getURL ( ) . self :: VERSION . $ this -> connector -> getSiteID ( ) . '/backups/' . $ b...
Delete backup .
57,870
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 .
57,871
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
57,872
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 .
57,873
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 .
57,874
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 .
57,875
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 .
57,876
public function output ( $ args ) { $ args += [ '' , '' , 63 ] ; $ this -> _consoleOutput -> write ( $ this -> _getState ( $ args [ 0 ] , $ args [ 1 ] , $ args [ 2 ] ) ) ; }
This method should output formatted message .
57,877
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
57,878
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 .
57,879
public function name ( $ name = null ) { if ( $ name === null ) return $ this -> ruleName ; $ this -> ruleName = $ name ; return $ this ; }
Unique route name
57,880
public function pattern ( $ pattern = null ) { if ( $ pattern === null ) return $ this -> rulePattern ; $ this -> rulePattern = $ pattern ; return $ this ; }
Route match pattern
57,881
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
57,882
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
57,883
protected function isCallableOption ( $ callback , $ parameter ) { $ option = 'function(' . $ parameter . '){' . PHP_EOL ; $ option .= Buffering \ Callback :: do ( $ callback ) ; $ option .= '}' ; return $ option ; }
Protected is callable option
57,884
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
57,885
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
57,886
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 .
57,887
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 .
57,888
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
57,889
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
57,890
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
57,891
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
57,892
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
57,893
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
57,894
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
57,895
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 .
57,896
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
57,897
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
57,898
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
57,899
public function get ( $ command ) { $ commands = $ this -> getHandlers ( ) ; return empty ( $ commands [ $ command ] ) ? array ( ) : $ commands [ $ command ] ; }
Returns a single command