idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
15,400
public function addLocator ( LocatorInterface $ locator , $ id = null ) { if ( $ id === null ) { $ this -> _locators [ ] = $ locator ; } else { $ this -> _locators [ $ id ] = $ locator ; } return $ this ; }
Add fallback locator
15,401
final protected function setFileLocation ( string $ file ) { $ file = $ this -> getLocation ( ) . $ file ; $ pathParts = pathinfo ( $ file ) ; $ this -> file = ! isset ( $ pathParts [ 'extension' ] ) ? $ file . ".inc" : $ file ; }
Sets the template file location
15,402
final protected function display ( bool $ return = FALSE ) { if ( file_exists ( $ this -> file ) ) : $ output = file_get_contents ( $ this -> file ) ; foreach ( $ this -> assignedVariables as $ key => $ value ) $ output = preg_replace ( '/{' . $ key . '}/' , $ value , $ output ) ; else : $ output = "*** Missing templat...
Displays the template being generated
15,403
static function createBackend ( $ options = [ ] , $ backend = null ) { $ options = self :: normalizeOptions ( $ options ) ; if ( isset ( $ options [ self :: PARAM_TYPE ] ) ) { $ backendType = ( string ) $ options [ self :: PARAM_TYPE ] ; unset ( $ options [ self :: PARAM_TYPE ] ) ; } else { $ backendType = self :: DEFA...
Create the backend
15,404
static public function createFrontend ( $ options = [ ] ) { $ options = self :: normalizeOptions ( $ options ) ; if ( isset ( $ options [ self :: PARAM_LIFETIME ] ) ) { $ lifetime = ( int ) $ options [ self :: PARAM_LIFETIME ] ; unset ( $ options [ self :: PARAM_LIFETIME ] ) ; } $ frontend = new Wrapper ( self :: creat...
Create the frontend The lifetime option is only supported others will be passed further
15,405
static public function createFrontendFactory ( $ options = [ ] ) { $ options = self :: normalizeOptions ( $ options ) ; if ( isset ( $ options [ self :: PARAM_LIFETIME ] ) ) { $ lifetime = ( int ) $ options [ self :: PARAM_LIFETIME ] ; unset ( $ options [ self :: PARAM_LIFETIME ] ) ; } $ frontend = new FrontendFactory ...
Create the frontend factory The lifetime option is only supported others will be passed further
15,406
static protected function normalizeOptions ( $ options ) { if ( $ options instanceof Traversable ) { $ options = iterator_to_array ( $ options ) ; } if ( ! is_array ( $ options ) ) { throw new InvalidOptions ( 'Options must be an array or a Traversable implementation' ) ; } return $ options ; }
Normalize the options
15,407
public function getService ( $ id ) { if ( $ this -> factoryMode ) { return $ this -> initService ( $ id ) ; } $ fullId = $ id . ':' . $ this -> getIdByArgs ( [ ] ) ; if ( ! isset ( $ this -> services [ $ fullId ] ) ) { $ this -> services [ $ fullId ] = $ this -> initService ( $ id ) ; } return $ this -> services [ $ f...
Get service without arguments
15,408
public function boot ( ) { if ( Config :: get ( 'images.dynamic_image_sizes' ) !== false ) { $ this -> add_filter ( 'media_meta' , 'add_image_sizes_meta_to_media' ) ; $ this -> add_filter ( 'attachment_fields_to_edit' , 'add_intermediate_mgmt_fields' ) ; $ this -> add_filter ( 'attachment_fields_to_save' , 'handle_dele...
Only enable dynamic image sizes if sizes have been defined .
15,409
public function add_additional_mime_type_support ( $ post_mime_types ) { $ additional_mime_types = [ 'application/msword' => [ \ __ ( 'Word Docs' , 'snap' ) , \ __ ( 'Manage Word Docs' , 'snap' ) , \ _n_noop ( 'Word Doc <span class="count">(%s)</span>' , 'Word Docs <span class="count">(%s)</span>' ) , ] , 'application/...
Add some additional mime type filters to media pages .
15,410
public function add_image_sizes_meta_to_media ( $ form_meta , $ post = null ) { if ( wp_attachment_is_image ( $ post -> ID ) && current_user_can ( 'manage_options' ) ) { $ meta = wp_get_attachment_metadata ( $ post -> ID ) ; $ form_meta .= '<strong>Available sizes: </strong>' . \ count ( $ meta [ 'sizes' ] ) ; } return...
Adds the additional meta to all images within the admin media view .
15,411
public function add_intermediate_mgmt_fields ( $ form_fields , $ post = null ) { $ current_screen = \ get_current_screen ( ) ; if ( isset ( $ current_screen -> base ) && $ current_screen -> base === 'post' ) { return $ form_fields ; } if ( \ strpos ( \ wp_get_referer ( ) , 'upload.php' ) !== false && \ wp_attachment_is...
Output the HTML for the dynamic image management .
15,412
public function handle_delete_intermediate_ajax ( $ post , $ attachment_data ) { if ( isset ( $ attachment_data [ 'delete-intermediate' ] ) && ! empty ( $ attachment_data [ 'delete-intermediate' ] ) ) { $ sizes = $ attachment_data [ 'delete-intermediate' ] ; $ meta = \ wp_get_attachment_metadata ( $ post [ 'ID' ] ) ; $...
DThe AJAX handler for deleting a dynamic image size .
15,413
private function is_media_screen ( ) { $ current_screen = \ get_current_screen ( ) ; if ( isset ( $ current_screen -> base ) && $ current_screen -> base === 'upload' ) { return true ; } return false ; }
A simple utility for checking whether to render the media JS or not .
15,414
public function setTotal ( $ total ) { NumericValidator :: validate ( $ total , "Total" ) ; $ total = Formatter :: formatToPrice ( $ total , $ this -> getCurrency ( ) ) ; $ this -> total = $ total ; return $ this ; }
Total amount charged from the payer to the payee . In case of a refund this is the refunded amount to the original payer from the payee . 10 characters max with support for integers .
15,415
private function generateImages ( $ type ) { $ imagable = \ Yii :: $ app -> shop_imagable ; $ nameFile = ( new Security ( ) ) -> generateRandomString ( ) ; $ this -> $ type -> saveAs ( $ imagable -> imagesPath . '/' . $ nameFile . '.' . $ this -> $ type -> extension ) ; $ image_name = $ imagable -> create ( 'shop-categ...
Generates images from uploaded image using Imagable component
15,416
public function setAutoFlush ( $ auto_flush ) { foreach ( $ this -> channel_list as $ channel ) { $ channel -> setAutoFlush ( $ auto_flush ) ; } return $ this ; }
Update auto flush flags in all channels
15,417
public function getModuleForAsset ( AssetInterface $ asset ) { $ sourceRoot = $ asset -> getSourceRoot ( ) ; $ bundleName = $ this -> bundleMap [ $ sourceRoot ] ; if ( ! isset ( $ bundleName ) ) { throw new \ Exception ( 'Could not map the asset to a bundle' ) ; } return $ bundleName . '.templates' ; }
Create module name for asset . This is bundle name .
15,418
public function getForAsset ( AssetInterface $ asset ) { $ sourceRoot = $ asset -> getSourceRoot ( ) ; if ( ! isset ( $ this -> bundleMap [ $ sourceRoot ] ) ) { throw new \ Exception ( 'Could not map the asset to a bundle' ) ; } $ templateName = $ asset -> getSourcePath ( ) ; $ templateName = str_replace ( 'Resources/v...
Create template name for asset .
15,419
protected function compile ( ) { if ( $ this -> objWrapper -> getType ( ) == ContentWrapper \ Model :: TYPE_START ) { $ GLOBALS [ 'accordionGroup' ] = 'accordion-group-' . $ this -> id ; $ GLOBALS [ 'accordionGroupFirst' ] = true ; $ this -> Template -> groupId = $ GLOBALS [ 'accordionGroup' ] ; } else { $ GLOBALS [ 'a...
compile accordion group
15,420
public function make ( $ name , array $ data = [ ] , $ format = null ) { return new Facile ( $ this , $ name , $ data , $ format ) ; }
Create a new Facile instance .
15,421
public function name ( string $ name , $ parser ) : void { if ( \ is_string ( $ parser ) && ( \ class_exists ( $ parser , false ) || $ this -> app -> bound ( $ parser ) ) ) { $ parser = $ this -> app -> make ( $ parser ) ; } $ this -> parsers [ $ name ] = $ parser ; }
Register a named parser .
15,422
protected function getPrefersFor ( Template \ Parser $ parser ) : ? string { return $ this -> request -> prefers ( $ parser -> getSupportedFormats ( ) ) ; }
Get request format .
15,423
public function resolve ( $ name , $ format , array $ data , $ method = 'compose' ) { $ parser = $ this -> parse ( $ name ) ; $ format = $ format ?? $ this -> getPrefersFor ( $ parser ) ; return $ parser -> compose ( $ format , $ data , $ method ) ; }
Resolve parser from factory .
15,424
public function addElement ( $ row , $ name = null , $ attrs = null ) { if ( is_array ( $ row ) ) { $ row = new TableRow ( $ row , $ attrs , $ this -> _headPart ) ; } else if ( ! $ row instanceof TableRow ) { throw new Exception ( 'Element must be an instance of the TableRow or an array' ) ; } return parent :: addEleme...
Add a row to a table
15,425
public static function generate ( array $ options , int $ descriptionLength ) : string { $ lines = array ( ) ; $ nameCols = array ( ) ; $ maxLineLength = 0 ; $ options = array_values ( $ options ) ; foreach ( $ options as $ option ) { $ line = ' ' ; $ line .= $ option -> getPrintableName ( ) ; $ aliases = $ option -> ...
Generate help text given an array of options
15,426
private static function formatLineWithDescription ( string $ line , string $ description , int $ desciptionCharStart , int $ descriptionLength , array & $ lines ) { $ description = preg_replace ( '/\n|\r/' , '' , $ description ) ; $ spaceRepeat = $ desciptionCharStart - strlen ( $ line ) ; $ line .= str_repeat ( ' ' , ...
Format lines that have a description
15,427
private static function descriptionTrimmer ( string $ description , int $ desciptionCharStart , int $ descriptionLength ) { $ remainder = $ description ; $ firstLine = true ; while ( strlen ( $ remainder ) > 0 ) { $ space = '' ; if ( ! $ firstLine ) { $ space = str_repeat ( ' ' , $ desciptionCharStart ) ; } if ( ( $ le...
Load options from a . json file
15,428
public function processWhoColumns ( $ types , & $ row , $ timestamp = null ) { if ( $ types === 'all' ) $ types = array_keys ( $ this -> who ) ; if ( ! is_array ( $ types ) ) $ types = [ $ types ] ; if ( empty ( $ timestamp ) ) $ timestamp = \ Format :: now ( 'timestamp' ) ; foreach ( $ types as $ type ) { if ( ! empty...
Process who columns
15,429
public function processColumns ( & $ data , $ options = [ ] ) { $ save = [ ] ; $ data_columns = [ ] ; foreach ( $ data as $ k => $ v ) { if ( strpos ( $ k , ';' ) !== false ) { $ k2 = explode ( ';' , $ k ) [ 0 ] ; if ( ! empty ( $ this -> columns [ $ k2 ] ) ) { $ data_columns [ $ k2 ] = $ k ; } } } foreach ( $ this -> ...
Process columns removes not existing columns processes column types
15,430
public function sequence ( string $ column , string $ type = 'nextval' , $ tenant = null , $ module = null ) : int { if ( empty ( $ tenant ) && $ this -> tenant ) { $ tenant = \ Tenant :: id ( ) ; } $ temp = $ this -> db_object -> sequence ( $ this -> full_table_name . '_' . $ column . '_seq' , $ type , $ tenant , $ mo...
Generate a sequence
15,431
public function resetCache ( ) { if ( ! empty ( $ this -> db_object -> object -> options [ 'cache_link' ] ) ) { $ tags = array_unique ( $ this -> cache_tags ) ; sort ( $ tags , SORT_STRING ) ; $ hash = sha1 ( serialize ( $ tags ) ) ; \ Cache :: $ reset_caches [ $ this -> db_object -> object -> options [ 'cache_link' ] ...
Reset caches on exit
15,432
public function collection ( array $ options = [ ] ) : \ Object \ Collection { if ( ! empty ( $ this -> virtual_class_name ) ) { $ options [ 'model' ] = $ this -> virtual_class_name ; return \ Object \ Collection :: collectionToModel ( $ options ) ; } else { return self :: collectionStatic ( $ options ) ; } }
Create collection object
15,433
public function checkUniqueConstraint ( string $ name , array $ pk , array $ values ) : bool { $ query = $ this -> queryBuilder ( [ 'alias' => 'a' ] ) -> select ( ) -> columns ( $ pk ) ; foreach ( $ this -> unique [ $ name ] as $ v2 ) { if ( $ v2 == $ this -> tenant_column ) { $ values [ $ v2 ] = \ Tenant :: id ( ) ; c...
Check unique constraint
15,434
protected function _cbElementStart ( $ parser , $ name , Array $ attributes ) { $ idx = xml_get_current_byte_index ( $ this -> _parser ) ; $ this -> _empty = $ this -> _buffer [ $ idx - $ this -> _offset ] == '/' ; $ attrs = "" ; foreach ( $ attributes as $ key => $ val ) { $ attrs .= " " . $ key . "=\"" . $ val . "\""...
Element start callback
15,435
protected function _cbElementEnd ( $ parser , $ name ) { if ( ! $ this -> _empty ) { -- $ this -> _depth ; fwrite ( $ this -> _output , $ this -> _getPaddingStr ( ) . "</" . $ name . ">" . "\n" ) ; } else { $ this -> _empty = false ; } }
Element end callback
15,436
protected function _cbCharacterData ( $ parser , $ data ) { if ( ! $ this -> _options [ "formatCData" ] ) { return ; } $ data = trim ( $ data ) ; if ( strlen ( $ data ) ) { $ pad = $ this -> _getPaddingStr ( ) ; if ( $ this -> _options [ "multipleLineCData" ] ) { $ data = str_replace ( "\t" , "" , $ data ) ; $ data = i...
Character data callback
15,437
public function format ( ) { while ( $ this -> _buffer = fread ( $ this -> _input , $ this -> _options [ "bufferSize" ] ) ) { if ( ! xml_parse ( $ this -> _parser , $ this -> _buffer , feof ( $ this -> _input ) ) ) { throw new Exception ( sprintf ( "XML error: %s at line %d" , xml_error_string ( xml_get_error_code ( $ ...
Main format method
15,438
public function getServiceClass ( ) { $ this -> checkFilePermissions ( ) ; $ logger_name = 'MicroCMS_' . $ this -> env ; $ logger = new Logger ( $ logger_name ) ; $ logger -> pushHandler ( new StreamHandler ( $ this -> logFile , $ this -> getHandlerLevel ( ) ) ) ; return ( $ logger ) ; }
getServiceClass Build the Monolog logger for use in the container .
15,439
public function getFunctions ( $ prepend , $ available ) { if ( empty ( $ this -> filepath ) ) { return [ ] ; } $ configs = include $ this -> filepath ; if ( empty ( $ configs ) ) { return [ ] ; } $ functions = [ ] ; foreach ( $ configs as $ key => $ args ) { if ( ! in_array ( $ key , $ available ) || empty ( $ args ) ...
Initialize filepath with configs .
15,440
public function getBonusEnabled ( ) { $ result = $ this -> scopeConfig -> getValue ( 'praxigento_downline/referral_bonus/enabled' , AScope :: SCOPE_STORE ) ; $ result = filter_var ( $ result , FILTER_VALIDATE_BOOLEAN ) ; return $ result ; }
Return true if Referral Bonus is enabled .
15,441
public function getBonusFeeMax ( ) { $ result = $ this -> scopeConfig -> getValue ( 'praxigento_downline/referral_bonus/fee_max' , AScope :: SCOPE_STORE ) ; $ result = filter_var ( $ result , FILTER_VALIDATE_FLOAT ) ; if ( $ result < 0 ) $ result = 0 ; return $ result ; }
Get maximal amount of the referral bonus fee .
15,442
public function getBonusPayoutDelay ( ) { $ result = $ this -> scopeConfig -> getValue ( 'praxigento_downline/referral_bonus/delay_days' , AScope :: SCOPE_STORE ) ; if ( is_null ( $ result ) ) $ result = 7 ; $ result = filter_var ( $ result , FILTER_VALIDATE_INT ) ; if ( $ result < 0 ) $ result = 7 ; return $ result ; ...
Days delay before payout will be made .
15,443
public function getPaginator ( Criteria $ criteria = null ) { if ( $ criteria === null ) { $ criteria = $ this -> query ( ) ; } return new Paginator ( new AdapterCriteria ( $ criteria ) ) ; }
Get the paginator
15,444
protected function getPrimaryName ( ) { if ( $ this -> primary === null ) { $ tableModel = $ this -> getTableModel ( ) ; $ this -> primary = $ tableModel -> getModelsMetaData ( ) -> getPrimaryKeyAttributes ( $ tableModel ) ; if ( empty ( $ this -> primary ) ) { $ this -> primary = false ; } if ( count ( $ this -> prima...
Get the name of the primary identity
15,445
public function getTransactionsManager ( ) { if ( $ this -> _transactionsManager === null ) { if ( $ this -> hasLocator ( ) ) { $ locator = $ this -> getLocator ( ) ; if ( $ locator -> has ( self :: PHSRV_TRANSACTIONS ) ) { $ this -> _transactionsManager = $ locator -> get ( self :: PHSRV_TRANSACTIONS ) ; } } if ( $ th...
Get the transactions manager
15,446
protected function getTableModel ( ) { if ( $ this -> _model === null ) { $ this -> _model = $ this -> createTableModel ( ) ; } return $ this -> _model ; }
Get the phalcon model instance
15,447
protected function createTableModel ( Model $ model = null ) { $ phalconModel = new PhalconModel ( $ this -> getTableModelDi ( ) ) ; $ phalconModel -> setDatagate ( $ this ) ; if ( $ model !== null ) { $ phalconModel -> assign ( $ model -> getData ( ) ) ; } return $ phalconModel ; }
Create the phalcon model instance
15,448
public function getTableModelDi ( ) { if ( $ this -> _modelDi !== null ) { return $ this -> _modelDi ; } if ( self :: $ _allowSharedModelDi && self :: $ _sharedModelsDi !== null ) { return self :: $ _sharedModelsDi ; } if ( $ this -> hasLocator ( ) ) { $ locator = $ this -> getLocator ( ) ; if ( $ locator -> has ( 'mod...
Get the dependency injector for the phalcon table model If has not been supplied trying to create the our own
15,449
public function addAdminMenuItem ( MenuCollectionEvent $ event ) : void { if ( ! $ this -> auth -> isGranted ( 'ROLE_ADMIN' ) ) { return ; } $ menu = $ event -> getMenu ( ) ; $ admin = $ this -> factory -> createItem ( 'menu_item.admin' , [ 'route' => 'bkstg_admin_redirect' , 'extras' => [ 'icon' => 'wrench' , 'transla...
Add the admin menu item .
15,450
public static function root ( $ segments = null ) : string { $ path = __DIR__ ; for ( $ c1 = 0 ; $ c1 < 4 ; $ c1 ++ ) { $ path = dirname ( $ path ) ; } $ path = str_replace ( '\\' , '/' , $ path ) ; $ path = self :: addSegmentsToPath ( $ path , $ segments ) ; return $ path ; }
Get path to root of site .
15,451
public function addServer ( $ tld , $ server ) { $ this -> server [ ( string ) $ tld ] = ( string ) $ server ; return $ this ; }
Can be used to add a server for a given TLD .
15,452
public function getWhoisServer ( $ domain ) { $ domain = strtolower ( $ domain ) ; $ tld = $ this -> getTld ( $ domain ) ; if ( ! isset ( $ this -> server [ $ tld ] ) ) { throw new UnknownTldException ( "$tld is not in the list of servers." ) ; } return $ this -> server [ $ tld ] ; }
Returns the whois server for the given domain name .
15,453
public function lookup ( $ domain ) { $ result = $ this -> queryServer ( $ domain ) ; while ( preg_match_all ( '/.*Whois Server: (.*)/' , $ result , $ matches ) ) { $ server = array_pop ( $ matches [ 1 ] ) ; if ( $ server ) { $ result = $ this -> queryServer ( $ domain , $ server ) ; } } return $ result ; }
Recursively lookups up a domain name .
15,454
public function queryServer ( $ domain , $ server = false ) { $ domain = strtolower ( $ domain ) ; if ( ! $ server ) { $ server = $ this -> getWhoisServer ( $ domain ) ; } if ( ! $ this -> socket -> connect ( $ server , self :: WHOIS_PORT ) ) { return false ; } if ( $ server == 'whois.verisign-grs.com' ) { $ domain = '...
Performs a single lookup to a given whois server .
15,455
protected function getProcessBuilder ( array $ builderArguments = null ) { $ builder = new ProcessBuilder ( $ builderArguments ) ; if ( isset ( $ this -> config [ 'options' ] ) ) { foreach ( $ this -> config [ 'options' ] as $ key => $ val ) { $ builder -> setOption ( $ key , $ val ) ; } } $ builder -> setTimeout ( $ t...
Return a new instance of a pre - configured process builder .
15,456
public function transcodeFile ( File $ inFile , Preset $ preset , $ outFilePath ) { $ builder = $ this -> buildProcess ( $ inFile , $ preset , $ outFilePath ) ; if ( ! $ builder instanceof ProcessBuilder ) { throw new \ InvalidArgumentException ( sprintf ( "%s must return an instance of Symfony\Component\Process\Proces...
Runs a transcode process by wrapping a command - line process .
15,457
public static function exists ( string $ func ) : bool { if ( strpos ( $ func , "::" ) !== false ) { list ( $ class , $ method ) = explode ( "::" , $ func ) ; return method_exists ( $ class , $ method ) ; } return function_exists ( $ func ) ; }
Verify a callable provided as a string
15,458
public static function getReflection ( callable $ func ) : \ ReflectionFunctionAbstract { if ( is_string ( $ func ) && strpos ( $ func , "::" ) !== false ) { list ( $ classname , $ method ) = explode ( "::" , $ func , 2 ) ; $ rc = new \ ReflectionClass ( $ classname ) ; return $ rc -> getMethod ( $ method ) ; } return ...
Get a reflection object for a function or static method
15,459
final public function openConnection ( ) { $ this -> connection = mysqli_connect ( getConstant ( 'DB_HOST' , TRUE ) , getConstant ( 'DB_USERNAME' , TRUE ) , getConstant ( 'DB_PASSWORD' , TRUE ) , getConstant ( 'DB_NAME' , TRUE ) ) ; $ errorMessage = "Database connection failed: " . mysqli_connect_error ( ) ; $ errorMes...
Opens Database connection .
15,460
final public function query ( string $ sql ) { static :: $ lastQuery = $ sql ; $ result = mysqli_query ( $ this -> connection , $ sql ) ; $ this -> confirmQuery ( $ result ) ; return $ result ; }
Querys the database with provided sql .
15,461
final public function escapeValues ( array $ values ) : array { $ sanitizedValues = [ ] ; foreach ( $ values as $ key => $ value ) : $ key = $ this -> escapeValue ( $ key ) ; $ sanitizedValues [ $ key ] = ( is_array ( $ value ) ) ? $ this -> escapeValues ( $ value ) : $ this -> escapeValue ( $ value ) ; endforeach ; re...
Escapes values for database query
15,462
private function confirmQuery ( $ result ) { if ( $ result ) return ; $ outputMessage = "" ; if ( DEPLOYMENT_STATE == "local" ) : $ outputMessage = "Database query failed: " . mysqli_error ( $ this -> connection ) . "<br /><br />" ; $ outputMessage .= "Last SQL query: " . static :: lastQuery ( ) ; else : $ outputMessag...
Confirms result from database query
15,463
protected function assignPropertyValues ( array $ values ) { foreach ( $ values as $ property => $ value ) { if ( property_exists ( $ this , $ property ) ) { $ this -> { $ property } = $ value ; } } }
Assign values to properties
15,464
public function hasRequiredSettings ( bool $ refresh = false ) : bool { $ required = $ this -> getParsedRequiredProperties ( $ refresh ) ; if ( ! $ this -> allRequired && ( empty ( $ required ) || $ required === null ) ) { return true ; } return $ this -> validateProperties ( $ required ) ; }
Check the settings have all required settings with valid types
15,465
protected function parseRequiredProperties ( bool $ refresh = false ) { if ( $ this -> requiredParsed !== null && ! $ refresh ) { return $ this -> requiredParsed ; } foreach ( $ this -> required as $ index => $ item ) { $ property = is_int ( $ index ) ? $ item : $ index ; $ type = 'any' ; if ( in_array ( $ property , $...
Parse required properties + types
15,466
public function setRequiredProperties ( array $ required ) { if ( empty ( $ required ) ) { return $ this ; } if ( isset ( $ required [ 0 ] ) && $ required [ 0 ] === '*' ) { $ this -> required = get_object_vars ( $ this ) ; $ this -> allRequired = true ; } else { $ this -> required = $ required ; } unset ( $ this -> req...
Set required properties
15,467
public function setRequiredTypes ( array $ types ) { $ this -> required = array_merge ( $ this -> required , $ types ) ; $ this -> requiredTypes = $ types ; return $ this ; }
Set required types
15,468
public function setRequiredPropertyTypes ( string $ property , $ types ) { $ this -> required [ $ property ] = $ types ; $ this -> requiredTypes [ $ property ] = $ types ; return $ this ; }
Set required types for property
15,469
protected function getHead ( ) { $ data = $ this -> head ; if ( preg_match ( '#last-updated: (.*)#' , $ data , $ match ) ) { $ data = str_replace ( $ match [ 1 ] , date ( 'c' , $ this -> lastchange ) , $ data ) ; } if ( $ this -> transifexProject && preg_match_all ( '#https://www.transifex.com/projects/p/.*/language/.*...
Retrieve the file heading .
15,470
public function getValue ( $ key ) { return isset ( $ this -> langstrings [ $ key ] ) ? $ this -> langstrings [ $ key ] : null ; }
Retrieve a language value .
15,471
protected function load ( ) { $ data = file_get_contents ( $ this -> filename ) ; preg_match ( '#^(.+\*/)#sU' , $ data , $ matches ) ; if ( $ matches && count ( $ matches [ 0 ] ) ) { $ this -> head = $ matches [ 0 ] ; if ( preg_match ( '#https://www.transifex.com/projects/p/(.*)/language/(.*)/#' , $ this -> head , $ ma...
Parse a language file into language strings .
15,472
public function save ( ) { $ keys = array_keys ( $ this -> langstrings ) ; sort ( $ keys ) ; $ maxlen = 0 ; $ langPrefixes = array ( ) ; foreach ( $ keys as $ key ) { $ tokens = explode ( '.' , $ key ) ; if ( preg_match ( '/tl_layout\.[a-z]+\.css\./' , $ key ) ) { $ tokens = array ( $ tokens [ 0 ] , $ tokens [ 1 ] . '....
Save the file to disk .
15,473
protected function findFullCredentialsPath ( $ credentialsPathOption ) { if ( ! $ this -> isFullCredentialsPathFindable ( $ this -> fileOptionToFullPath ( $ credentialsPathOption ) ) ) { return NULL ; } return $ this -> fileOptionToFullPath ( $ credentialsPathOption ) ; }
Finds the full path to the credentials file .
15,474
public function stopNow ( ) { $ this -> run = false ; $ this -> boss -> stopEmployees ( ) ; $ this -> boss -> updateProgress ( ) ; }
Stop the process immediately this kills jobs mid - process .
15,475
public function updateSourceCode ( $ branch = CFG_GIT_BRANCH ) { if ( ! FileSystem :: checkFileName ( $ branch ) ) { return $ this ; } exec ( 'git reset --hard origin/' . $ branch . ' 2>&1; git pull -v origin ' . $ branch . ' 2>&1' , $ out ) ; if ( $ out ) { $ this -> result_message [ ] = $ out ; } @ Cacher :: getInsta...
Updates files from git repository Make sure user have access to repository and command is run as this user
15,476
public function updateComposerVendors ( ) { chdir ( DIR_BASE ) ; exec ( 'COMPOSER_HOME="' . substr ( DIR_BASE , 0 , - 1 ) . '" composer -v update 2>&1' , $ out ) ; if ( $ out ) { $ this -> result_message [ ] = $ out ; } Cacher :: getInstance ( ) -> clearAllCaches ( ) ; return $ this ; }
Updates files from composer
15,477
public function runMigrations ( ) { if ( ! file_exists ( DIR_MIGRATIONS ) ) { return 0 ; } new MigrationEntityRepository ; $ migrated_files = [ ] ; if ( SQL :: getInstance ( ) -> getTables ( ) ) { $ migrated_files = MigrationEntityRepository :: getInstance ( ) -> getPairs ( 'filename' , 'filename' ) ; } $ existing_file...
Run DB migrations from migration . sql files
15,478
public function runMigrationFile ( $ filename ) { SQL :: startTransaction ( ) ; @ q ( file_get_contents ( DIR_MIGRATIONS . $ filename ) ) ; SQL :: confirmTransaction ( ) ; return $ this ; }
Run one migration . sql file
15,479
private function setMigrationFileAsCompleted ( $ filename ) { $ migration = new MigrationEntity ( ) ; $ migration -> setFilename ( sql_prepare ( $ filename ) ) ; @ $ migration -> save ( ) ; return $ this ; }
Set migration . sql file as already finished
15,480
public function count ( $ key ) { if ( $ this -> has ( $ key ) ) { if ( \ is_array ( $ this -> get ( $ key ) ) ) { return \ count ( $ this -> get ( $ key ) ) ; } return 1 ; } return 0 ; }
Return how many files were uploaded for a given key .
15,481
protected function set_data ( array $ contents = [ ] ) { foreach ( $ contents as $ key => $ file ) { $ this -> data [ $ key ] = $ this -> add_file ( $ file ) ; } }
Add the individual files to the bag .
15,482
public function setGroup ( $ title , $ path ) { $ path = rtrim ( realpath ( $ path ) , DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR ; $ this -> groups [ ( string ) $ title ] = $ path ; }
Set the group of the files by the path
15,483
protected function includePathInfo ( Infoset $ info ) { $ list = $ this -> createList ( ) ; $ list -> setTitle ( 'Include path' ) ; $ include = explode ( PATH_SEPARATOR , get_include_path ( ) ) ; foreach ( $ include as $ path ) { $ list [ ] = $ path ; } $ info [ ] = $ list ; }
Create the include path information
15,484
protected function includedFilesInfo ( array $ apcFiles = null ) { foreach ( $ this -> getIncludedFiles ( ) as $ file ) { if ( $ apcFiles !== null && isset ( $ apcFiles [ $ file ] ) ) { $ apcMem = $ this -> formatMemory ( $ apcFiles [ $ file ] [ 'mem_size' ] ) ; $ apcHits = $ apcFiles [ $ file ] [ 'num_hits' ] ; $ file...
Create groups with information about the included files
15,485
protected function apcInfo ( Infoset $ infoset , array $ apcInfo ) { $ info = $ this -> createTable ( ) -> setColsWidths ( [ 50 , 50 ] ) -> setTitle ( 'APC Info' ) -> enableBbCodes ( ) ; $ infoset [ ] = $ info ; $ info [ ] = [ 'Memory:' , '[info]' . $ this -> formatMemory ( $ apcInfo [ 'mem_size' ] ) . '[/info]' ] ; if...
Collect the APC info
15,486
protected function prepareCacheId ( $ locale , $ domain ) { if ( is_array ( $ locale ) ) { $ list = [ ] ; if ( is_array ( $ domain ) ) { foreach ( $ locale as $ part1 ) { foreach ( $ domain as $ part2 ) { $ list [ ] = $ part1 . '_' . $ part2 ; } } return $ list ; } foreach ( $ locale as $ part ) { $ list [ ] = $ part1 ...
Prepare the cahce IDs list
15,487
public function composeHtml ( array $ data = [ ] , int $ status = 200 , array $ config = [ ] ) : SymfonyResponse { if ( \ is_null ( $ view = $ config [ 'view' ] ) ) { throw new InvalidArgumentException ( 'Missing [$view].' ) ; } return Response :: make ( $ this -> convertToViewable ( $ view , $ data , $ config ) , $ st...
Compose HTML .
15,488
protected static function executeCall ( $ method , $ payLoad , $ headers = array ( ) , $ apiContext = null , $ soapCall = null , $ handlers = array ( 'PayU\Handler\BasicAuthHandler' ) , $ path = '' ) { $ apiContext = $ apiContext ? $ apiContext : new ApiContext ( self :: $ credential ) ; self :: $ apiContext = $ apiCon...
Execute SDK Call to PayU services
15,489
public static function get ( $ reference , $ apiContext = null , $ soapCall = null ) { $ methodName = 'getTransaction' ; ArgumentValidator :: validate ( $ reference , 'PayUReference' ) ; $ payload = array ( 'AdditionalInformation' => array ( 'payUReference' => $ reference ) ) ; $ json = self :: executeCall ( $ methodNa...
Shows details a of payment or redirect resource .
15,490
public function create ( $ apiContext = null , $ soapCall = null ) { $ methodName = 'doTransaction' ; $ payload = $ this -> request -> parseForEnterpriseAPI ( $ this ) ; $ json = self :: executeCall ( $ methodName , $ payload , null , $ apiContext , $ soapCall ) ; $ this -> fromJson ( $ json ) ; return $ this ; }
Executes or completes direct payment processing . In the JSON request body include a payment object with the intent customer fundingInstrument transaction etc . Also include return notify and cancel URLs in the payment object .
15,491
public function refund ( $ apiContext = null , $ soapCall = null ) { $ methodName = 'doTransaction' ; ArgumentValidator :: validate ( $ this -> return -> payUReference , "payUReference" ) ; ArgumentValidator :: validate ( $ this -> return -> merchantReference , 'merchantReference' ) ; $ payLoad = $ this -> request -> p...
Refund a captured payment . In addition include an amount object in the body of the request JSON .
15,492
public function capture ( $ apiContext = null , $ soapCall = null ) { $ methodName = 'doTransaction' ; ArgumentValidator :: validate ( $ this -> payu_reference , "payUReference" ) ; ArgumentValidator :: validate ( $ this -> merchant_reference , "merchantReference" ) ; $ payLoad = $ this -> request -> parseReserveResour...
Captures and processes an authorization by ID . To use this call the original payment call must specify an intent of reserve .
15,493
public function void ( $ apiContext = null , $ soapCall = null ) { $ methodName = 'doTransaction' ; ArgumentValidator :: validate ( $ this -> getReturn ( ) -> getPayUReference ( ) , "payUReference" ) ; ArgumentValidator :: validate ( $ this -> getReturn ( ) -> getMerchantReference ( ) , "merchantReference" ) ; $ payLoa...
Voids or cancels an authorization by ID . You cannot void a fully captured authorization .
15,494
public function set ( $ key , $ value , $ ttl ) { if ( ! $ this -> safe ) { return false ; } return apc_store ( $ key , $ value , $ ttl ) ; }
Add a value to the cache under a unique key
15,495
public static function Load ( $ directory , $ file ) { self :: CheckBackend ( ) ; self :: $ backend -> Load ( $ directory , $ file ) ; }
Loads the configuration file on the given directory .
15,496
public static function GetGroupValue ( $ group , $ option ) { self :: CheckBackend ( ) ; return self :: $ backend -> GetGroupValue ( $ group , $ option ) ; }
Gets the value of a specific option inside a group .
15,497
public static function GetExtensionName ( ) { self :: CheckBackend ( ) ; $ name = self :: $ backend -> Get ( "name" ) ; if ( strlen ( $ name ) <= 0 ) { $ dir_parts = explode ( "/" , str_replace ( "\\" , "/" , self :: $ backend -> directory ) ) ; $ name = $ dir_parts [ count ( $ dir_parts ) - 1 ] ; } return $ name ; }
Get the current extension name .
15,498
public static function Set ( $ option , $ value ) { self :: CheckBackend ( ) ; self :: $ backend -> Set ( $ option , $ value ) ; }
Modify or add a new option .
15,499
public static function SetGroupValue ( $ group , $ option , $ value ) { self :: CheckBackend ( ) ; self :: $ backend -> SetGroupValue ( $ group , $ option , $ value ) ; }
Modify or add a new group with an option .