idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
15,400
public function isValid ( $ key = null ) { $ key = $ key ? $ this -> sanitizeKey ( $ key ) : $ this -> getKey ( ) ; return strlen ( $ key ) === 35 ; }
Checks if key is valid length after format and sanitization is done .
15,401
public function getSeoKeywordsByPageId ( $ pageId ) { $ pageId = $ this -> params ( ) -> fromRoute ( 'idPage' , $ this -> params ( ) -> fromQuery ( 'idPage' , '' ) ) ; $ data = array ( ) ; $ seoKeywords = $ pageId -> getSeoKeywords ( $ pageId ) ; $ data = $ seoKeywords ; return $ data ; }
Return seo keywords
15,402
private function cleanURL ( string $ url = '' ) { $ url = str_replace ( ' ' , '-' , $ url ) ; $ url = preg_replace ( '/[^A-Za-z0-9\/\-]+/' , '-' , $ url ) ; if ( substr ( $ url , 0 , 1 ) == '/' ) { return preg_replace ( '/\//' , '' , $ url , 1 ) ; } return $ url ; }
Rids the URL from special characters
15,403
public function getAttribute ( $ attribute ) { $ data = $ this -> getData ( ) ; return ! empty ( $ data [ $ attribute ] ) ? $ data [ $ attribute ] : '' ; }
Get a specific attribute of our reseller .
15,404
public function getData ( ) { $ data = $ this -> resellerOption ; $ data [ 'reseller_identifier' ] = ! empty ( $ data [ 'reseller_identifier' ] ) ? strtolower ( $ data [ 'reseller_identifier' ] ) : null ; $ data [ 'reseller_website_url' ] = ! empty ( $ data [ 'reseller_website_url' ] ) ? esc_url ( $ data [ 'reseller_we...
Get the reseller data .
15,405
protected function getMenuItems ( ) { $ data = $ this -> getData ( ) ; return array ( 'topLevel' => array ( 'id' => 'reseller-adminbar-icon' , 'title' => '<span aria-hidden="true" class="' . $ data [ 'reseller_identifier' ] . '-icon ab-icon"></span>' , 'href' => $ data [ 'reseller_website_url' ] , 'meta' => array ( 'cl...
Get the menu items for this location .
15,406
protected function addRemoveFromAllTemplates ( $ eventType ) { if ( null !== $ response = $ this -> checkAuth ( $ this -> resourceCode , array ( ) , AccessManager :: UPDATE ) ) { return $ response ; } try { if ( null !== $ object = $ this -> getExistingObject ( ) ) { $ event = new FeatureEvent ( $ object ) ; $ this -> ...
Add or Remove from all product templates
15,407
public function manipulateTreePrickerForSortOrder ( ManipulateWidgetEvent $ event ) { $ widget = $ event -> getWidget ( ) ; if ( ! ( $ widget instanceof TreePicker ) ) { return ; } $ options = ( array ) $ widget -> options ; if ( 0 === \ count ( $ options ) ) { return ; } $ model = $ event -> getModel ( ) ; if ( ! ( $ ...
Manipulate the tree picker for sort order .
15,408
public function ajaxRedirect ( string $ destination , array $ args = [ ] ) : void { $ this -> payload -> forceRedirect = $ this -> link ( $ destination , $ args ) ; $ this -> sendPayload ( ) ; }
Presmerovani ajaxoveho pozadavku
15,409
public function serializeConditionCollection ( ConditionCollection $ collection ) { if ( $ collection -> count ( ) == 0 ) { $ conditionNone = $ this -> container -> get ( 'thelia.condition.match_for_everyone' ) ; $ collection [ ] = $ conditionNone ; } $ serializableConditions = [ ] ; foreach ( $ collection as $ conditi...
Serialize a collection of conditions
15,410
public function unserializeConditionCollection ( $ serializedConditions ) { $ unserializedConditions = json_decode ( base64_decode ( $ serializedConditions ) ) ; $ collection = new ConditionCollection ( ) ; if ( ! empty ( $ unserializedConditions ) ) { foreach ( $ unserializedConditions as $ condition ) { if ( $ this -...
Unserialize a collection of conditions
15,411
public function build ( $ conditionServiceId , array $ operators , array $ values ) { if ( ! $ this -> container -> has ( $ conditionServiceId ) ) { return false ; } $ condition = $ this -> container -> get ( $ conditionServiceId ) ; $ condition -> setValidatorsFromForm ( $ operators , $ values ) ; return clone $ condi...
Build a Condition from form
15,412
public function getInputsFromServiceId ( $ conditionServiceId ) { if ( ! $ this -> container -> has ( $ conditionServiceId ) ) { return false ; } $ condition = $ this -> container -> get ( $ conditionServiceId ) ; return $ this -> getInputsFromConditionInterface ( $ condition ) ; }
Get Condition inputs from serviceId
15,413
public function getConfigValue ( $ moduleId , $ variableName , $ defaultValue = null , $ valueLocale = null ) { $ value = null ; $ configValue = self :: create ( ) -> filterByModuleId ( $ moduleId ) -> filterByName ( $ variableName ) -> findOne ( ) ; ; if ( null !== $ configValue ) { if ( null !== $ valueLocale ) { $ c...
Get a module s configuration variable
15,414
public function setConfigValue ( $ moduleId , $ variableName , $ variableValue , $ valueLocale = null , $ createIfNotExists = true ) { $ configValue = self :: create ( ) -> filterByModuleId ( $ moduleId ) -> filterByName ( $ variableName ) -> findOne ( ) ; ; if ( null === $ configValue ) { if ( true === $ createIfNotEx...
Set module configuration variable creating it if required
15,415
public function deleteConfigValue ( $ moduleId , $ variableName ) { if ( null !== $ moduleConfig = self :: create ( ) -> filterByModuleId ( $ moduleId ) -> filterByName ( $ variableName ) -> findOne ( ) ) { $ moduleConfig -> delete ( ) ; } ; return $ this ; }
Delete a module s configuration variable
15,416
public function auto_update_plugin ( $ update , $ item ) { if ( ! apply_filters ( 'Boldgrid\Library\Update\isEnalbed' , false ) ) { return $ update ; } $ pluginAutoupdate = \ Boldgrid \ Library \ Util \ Option :: get ( 'plugin_autoupdate' ) ; if ( ! empty ( $ pluginAutoupdate ) || ! empty ( $ this -> settings [ 'plugin...
Auto update plugin .
15,417
public function auto_update_theme ( $ update , $ item ) { if ( ! apply_filters ( 'Boldgrid\Library\Update\isEnalbed' , false ) ) { return $ update ; } $ themeAutoupdate = \ Boldgrid \ Library \ Util \ Option :: get ( 'theme_autoupdate' ) ; if ( ! empty ( $ themeAutoupdate ) || ! empty ( $ this -> settings [ 'themes' ] ...
Auto update theme .
15,418
public static function create ( $ ns = NULL ) { $ node = new RootNode ( ) ; $ node -> addChild ( Token :: openTag ( ) ) ; if ( is_string ( $ ns ) && $ ns ) { NamespaceNode :: create ( $ ns ) -> appendTo ( $ node ) -> after ( Token :: newline ( ) ) ; } return $ node ; }
Creates a new blank PHP source file .
15,419
public function getNamespace ( $ ns ) { $ namespaces = $ this -> getNamespaces ( ) -> filter ( function ( NamespaceNode $ node ) use ( $ ns ) { return $ node -> getName ( ) -> getPath ( ) === $ ns ; } ) ; return $ namespaces -> isEmpty ( ) ? NULL : $ namespaces [ 0 ] ; }
Returns a particular namespace if it exists .
15,420
public function getNamespaceNames ( $ absolute = FALSE ) { $ iterator = function ( NamespaceNode $ ns ) use ( $ absolute ) { $ name = $ ns -> getName ( ) ; return $ absolute ? $ name -> getAbsolutePath ( ) : $ name -> getPath ( ) ; } ; return array_map ( $ iterator , $ this -> getNamespaces ( ) -> toArray ( ) ) ; }
Returns the name of every namespace in this document .
15,421
public function getSitePages ( $ siteId ) { $ results = array ( ) ; $ arrayParameters = $ this -> makeArrayFromParameters ( __METHOD__ , func_get_args ( ) ) ; $ arrayParameters = $ this -> sendEvent ( 'meliscmssite_service_get_site_pages_start' , $ arrayParameters ) ; $ siteTable = $ this -> getServiceLocator ( ) -> ge...
This method will return the page of a site
15,422
private function createSitePage ( $ siteName , $ fatherId , $ siteLangId , $ pageType , $ pageId , $ templateId , $ platformId ) { $ arrayParameters = $ this -> makeArrayFromParameters ( __METHOD__ , func_get_args ( ) ) ; $ arrayParameters = $ this -> sendEvent ( 'meliscmssite_service_save_site_page_start' , $ arrayPar...
This method creating Site page
15,423
private function createSitePageTemplate ( $ tplId , $ siteId , $ siteName , $ tempName , $ controler , $ action , $ platformId ) { $ cmsTemplateTbl = $ this -> getServiceLocator ( ) -> get ( 'MelisEngineTableTemplate' ) ; $ cmsPlatformTable = $ this -> getServiceLocator ( ) -> get ( 'MelisEngineTablePlatformIds' ) ; $ ...
This method creating Site page template
15,424
private function mapDirectory ( $ dir , $ targetModuleName , $ newModuleName ) { $ result = array ( ) ; $ cdir = scandir ( $ dir ) ; $ fileName = '' ; foreach ( $ cdir as $ key => $ value ) { if ( ! in_array ( $ value , array ( "." , ".." ) ) ) { if ( is_dir ( $ dir . '/' . $ value ) ) { if ( $ value == $ targetModuleN...
This method will map a directory to change some specific word that match the target and replace by new word
15,425
private function generateModuleNameCase ( $ str ) { $ i = array ( "-" , "_" ) ; $ str = preg_replace ( '/([a-z])([A-Z])/' , "$1 $2" , $ str ) ; $ str = str_replace ( $ i , ' ' , $ str ) ; $ str = str_replace ( ' ' , '' , ucwords ( strtolower ( $ str ) ) ) ; $ str = strtolower ( substr ( $ str , 0 , 1 ) ) . substr ( $ s...
This will modified a string to valid zf2 module name
15,426
public function hasReturnTypes ( ) { $ doc_comment = $ this -> getDocComment ( ) ; if ( ! $ doc_comment ) { return FALSE ; } $ return_tag = $ doc_comment -> getReturn ( ) ; if ( ! $ return_tag ) { return FALSE ; } $ types = $ return_tag -> getTypes ( ) ; return ! empty ( $ types ) ; }
Return TRUE if function has phpDoc return type .
15,427
public function getReturnTypes ( ) { $ types = [ 'void' ] ; $ doc_comment = $ this -> getDocComment ( ) ; if ( ! $ doc_comment ) { return $ types ; } $ return_tag = $ doc_comment -> getReturn ( ) ; if ( ! $ return_tag ) { return $ types ; } $ types = Types :: normalize ( $ return_tag -> getTypes ( ) ) ; if ( empty ( $ ...
Get the return type of the function as defined by the doc comment .
15,428
protected function setDefaultTimezone ( ) { $ timezone = 'UTC' ; if ( is_link ( '/etc/localtime' ) ) { $ filename = readlink ( '/etc/localtime' ) ; if ( strpos ( $ filename , '/usr/share/zoneinfo/' ) === 0 ) { $ timezone = substr ( $ filename , 20 ) ; } } elseif ( file_exists ( '/etc/timezone' ) ) { $ data = file_get_c...
Set the default timezone .
15,429
public function getUrl ( $ locale = null ) { if ( null === $ locale ) { $ locale = $ this -> getLocale ( ) ; } return URL :: getInstance ( ) -> retrieve ( $ this -> getRewrittenUrlViewName ( ) , $ this -> getId ( ) , $ locale ) -> toString ( ) ; }
Get the object URL for the given locale rewritten if rewriting is enabled .
15,430
public function generateRewrittenUrl ( $ locale ) { if ( $ this -> isNew ( ) ) { throw new \ RuntimeException ( sprintf ( 'Object %s must be saved before generating url' , $ this -> getRewrittenUrlViewName ( ) ) ) ; } $ this -> setLocale ( $ locale ) ; $ generateEvent = new GenerateRewrittenUrlEvent ( $ this , $ locale...
Generate a rewritten URL from the object title and store it in the rewriting table
15,431
public function getRewrittenUrl ( $ locale ) { $ rewritingUrl = RewritingUrlQuery :: create ( ) -> filterByViewLocale ( $ locale ) -> filterByView ( $ this -> getRewrittenUrlViewName ( ) ) -> filterByViewId ( $ this -> getId ( ) ) -> filterByRedirected ( null ) -> findOne ( ) ; if ( $ rewritingUrl ) { $ url = $ rewriti...
return the rewritten URL for the given locale
15,432
public function markRewrittenUrlObsolete ( ) { RewritingUrlQuery :: create ( ) -> filterByView ( $ this -> getRewrittenUrlViewName ( ) ) -> filterByViewId ( $ this -> getId ( ) ) -> update ( array ( "View" => ConfigQuery :: getObsoleteRewrittenUrlView ( ) ) ) ; }
Mark the current URL as obseolete
15,433
public function setRewrittenUrl ( $ locale , $ url ) { $ currentUrl = $ this -> getRewrittenUrl ( $ locale ) ; if ( $ currentUrl == $ url || null === $ url ) { return $ this ; } try { $ resolver = new RewritingResolver ( $ url ) ; if ( null === $ resolver -> redirectedToUrl ) { if ( $ resolver -> view == $ this -> getR...
Set the rewritten URL for the given locale
15,434
public static function create ( $ name , ExpressionNode $ value = NULL , $ visibility = 'public' ) { $ code = $ visibility . ' $' . ltrim ( $ name , '$' ) ; if ( $ value instanceof ExpressionNode ) { $ code .= ' = ' . $ value -> getText ( ) ; } $ class_node = Parser :: parseSnippet ( 'class Foo { ' . $ code . '; }' ) ;...
Creates a new class member .
15,435
public static function adminBarNode ( $ wpAdminBar , $ configs ) { $ wpAdminBar -> add_node ( $ configs [ 'topLevel' ] ) ; foreach ( $ configs [ 'items' ] as $ item ) { $ wpAdminBar -> add_menu ( $ item ) ; } }
Given a configuration of menu items to be added on
15,436
public static function setVal ( $ metaKey , $ elementKey , $ elementId , $ value ) { $ data = self :: create ( ) -> filterByMetaKey ( $ metaKey ) -> filterByElementKey ( $ elementKey ) -> filterByElementId ( $ elementId ) -> findOne ( ) ; if ( null === $ data ) { $ data = new MetaData ( ) ; $ data -> setMetaKey ( $ met...
Add or update the MetaData element
15,437
public function setName ( $ name ) { $ identifier = $ this -> name -> firstChild ( ) ; $ identifier -> setText ( $ name ) ; return $ this ; }
Set the identifier name of this node .
15,438
public function inNamespace ( $ ns ) { if ( is_string ( $ ns ) ) { $ namespace_node = $ this -> name -> getNamespace ( ) ; $ namespace = $ namespace_node === NULL ? '' : $ namespace_node -> getName ( ) -> getAbsolutePath ( ) ; return $ ns === $ namespace ; } elseif ( $ ns instanceof NamespaceNode ) { return $ this -> n...
Determine if this node belongs to namespace .
15,439
public function renderServer ( ) : void { $ this -> addBreadcrumbLink ( 'dockbar.info.server' ) ; $ this -> template -> refresh = $ this -> refresh ; $ this -> template -> system = $ this -> app -> info -> system ; $ this -> template -> fileSystem = $ this -> app -> info -> fileSystem ; $ this -> template -> hardware =...
Zobrazeni informaci o serveru
15,440
public function renderPhp ( ) : void { $ this -> addBreadcrumbLink ( 'dockbar.info.php' ) ; $ this -> template -> php = $ this -> app -> info -> phpInfo ; }
Zobrazeni informaci o PHP
15,441
public function setState ( int $ id , bool $ value ) : void { if ( $ this -> isAjax ( ) ) { $ user = $ this -> orm -> users -> getById ( $ id ) ; $ user -> active = $ value ; $ this -> orm -> persistAndFlush ( $ user ) ; $ this [ 'userList' ] -> redrawItem ( $ id ) ; } else { $ this -> terminate ( ) ; } }
Ulozi stav uzivatele
15,442
protected function createComponentAddForm ( ) : Form { $ form = $ this -> formFactory -> create ( ) ; $ form -> addProtection ( ) ; $ form -> addText ( 'username' , 'cms.user.username' ) -> setRequired ( ) ; $ form -> addText ( 'firstName' , 'cms.user.firstName' ) ; $ form -> addText ( 'surname' , 'cms.user.surname' ) ...
Formular pridani uzivatele
15,443
public function addFormSucceeded ( Form $ form , ArrayHash $ values ) : void { if ( $ values -> generatePassword ) { $ password = Random :: generate ( $ this -> minPasswordLength , $ this -> passwordChars ) ; } else { $ password = $ values -> password ; } $ user = new User ; $ this -> orm -> users -> attach ( $ user ) ...
Zpracovani noveho uzivatele
15,444
protected function createComponentEditForm ( ) : Form { $ form = $ this -> formFactory -> create ( ) ; $ form -> addProtection ( ) ; $ form -> addText ( 'username' , 'cms.user.username' ) -> setDefaultValue ( $ this -> currentUser -> username ) -> setRequired ( ) ; $ form -> addText ( 'firstName' , 'cms.user.firstName'...
Formular editace uzivatele
15,445
public function editFormSucceeded ( Form $ form , ArrayHash $ values ) : void { try { $ this -> currentUser -> setUsername ( $ values -> username ) ; } catch ( UniqueConstraintViolationException $ ex ) { $ form -> addError ( 'cms.user.duplicityUsername' ) ; return ; } catch ( InvalidArgumentException $ ex ) { $ form ->...
Zpracovani editace uzivatele
15,446
public function passwordFormSucceeded ( Form $ form , ArrayHash $ values ) : void { if ( $ values -> generatePassword ) { $ password = Random :: generate ( $ this -> minPasswordLength , $ this -> passwordChars ) ; } else { $ password = $ values -> password ; } $ this -> currentUser -> setPassword ( $ password ) ; $ thi...
Zpracovani zmeny hesla
15,447
public static function findAllChild ( $ folderId , $ depth = 0 , $ currentPosition = 0 ) { $ result = array ( ) ; if ( \ is_array ( $ folderId ) ) { foreach ( $ folderId as $ folderSingleId ) { $ result = array_merge ( $ result , ( array ) self :: findAllChild ( $ folderSingleId , $ depth , $ currentPosition ) ) ; } } ...
find all contents for a given folder .
15,448
public static function generateToken ( ) { $ raw = self :: getOpenSSLRandom ( ) ; if ( false === $ raw ) { $ raw = self :: getComplexRandom ( ) ; } return md5 ( $ raw ) ; }
Same method as getToken but can be called statically
15,449
public function indexAction ( $ _view = 'import' ) { $ authResponse = $ this -> checkAuth ( [ AdminResources :: IMPORT ] , [ ] , [ AccessManager :: VIEW ] ) ; if ( $ authResponse !== null ) { return $ authResponse ; } $ this -> getParserContext ( ) -> set ( 'category_order' , $ this -> getRequest ( ) -> query -> get ( ...
Handle default action that is list available imports
15,450
public function changeImportPositionAction ( ) { $ authResponse = $ this -> checkAuth ( [ AdminResources :: IMPORT ] , [ ] , [ AccessManager :: UPDATE ] ) ; if ( $ authResponse !== null ) { return $ authResponse ; } $ query = $ this -> getRequest ( ) -> query ; $ this -> dispatch ( TheliaEvents :: IMPORT_CHANGE_POSITIO...
Handle import position change action
15,451
protected function matchPositionMode ( $ mode ) { if ( $ mode === 'up' ) { return UpdatePositionEvent :: POSITION_UP ; } if ( $ mode === 'down' ) { return UpdatePositionEvent :: POSITION_DOWN ; } return UpdatePositionEvent :: POSITION_ABSOLUTE ; }
Match position mode string against position mode constant value
15,452
public function configureAction ( $ id ) { $ importHandler = $ this -> container -> get ( 'thelia.import.handler' ) ; $ import = $ importHandler -> getImport ( $ id ) ; if ( $ import === null ) { return $ this -> pageNotFound ( ) ; } $ extensions = [ ] ; $ mimeTypes = [ ] ; foreach ( $ this -> container -> get ( Regist...
Display import configuration view
15,453
public function importAction ( $ id ) { $ importHandler = $ this -> container -> get ( 'thelia.import.handler' ) ; $ import = $ importHandler -> getImport ( $ id ) ; if ( $ import === null ) { return $ this -> pageNotFound ( ) ; } $ form = $ this -> createForm ( AdminForm :: IMPORT ) ; try { $ validatedForm = $ this ->...
Handle import action
15,454
public function getMeter ( $ meterIdentifier ) { $ item_key = $ this -> getCacheKey ( $ meterIdentifier ) ; if ( ! ( $ meter = $ this -> cacheService -> retrieve ( $ item_key ) ) ) { try { $ meter = $ this -> meterStorage -> getMeter ( $ meterIdentifier ) ; } catch ( \ Exception $ e ) { $ meter = array ( ) ; } $ this -...
Gets the pulsar meter from cache or db
15,455
public static function normalize ( $ types ) { $ normalized_types = [ ] ; foreach ( $ types as $ type ) { switch ( $ type ) { case 'boolean' : $ normalized_types [ ] = 'bool' ; break ; case 'integer' : $ normalized_types [ ] = 'int' ; break ; case 'double' : $ normalized_types [ ] = 'float' ; break ; case 'callback' : ...
Normalize phpDoc type keywords as per PSR - 5 .
15,456
public function getTypes ( ) { $ types = [ 'mixed' ] ; $ doc_comment = $ this -> getDocComment ( ) ; if ( ! $ doc_comment ) { return $ types ; } $ doc_block = $ doc_comment -> getDocBlock ( ) ; $ var_tags = $ doc_block -> getTagsByName ( 'var' ) ; if ( empty ( $ var_tags ) ) { return $ types ; } $ var_tag = reset ( $ v...
Get the type of the members as defined by doc comment .
15,457
public function prependItem ( Node $ item ) { if ( $ this -> getItems ( ) -> isEmpty ( ) ) { $ this -> append ( $ item ) ; } else { $ this -> prepend ( [ $ item , Token :: comma ( ) , Token :: space ( ) , ] ) ; } return $ this ; }
Prepend item .
15,458
public function appendItem ( Node $ item ) { if ( $ this -> getItems ( ) -> isEmpty ( ) ) { $ this -> append ( $ item ) ; } else { $ this -> append ( [ Token :: comma ( ) , Token :: space ( ) , $ item , ] ) ; } return $ this ; }
Append item .
15,459
public function insertItem ( Node $ item , $ index ) { $ items = $ this -> getItems ( ) ; if ( $ items -> isEmpty ( ) ) { if ( $ index !== 0 ) { throw new \ OutOfBoundsException ( 'index out of bounds' ) ; } $ this -> append ( $ item ) ; } else { $ max_index = count ( $ items ) - 1 ; if ( $ index < 0 || $ index > $ max...
Insert item before index .
15,460
public function pop ( ) { $ items = $ this -> getItems ( ) ; if ( $ items -> isEmpty ( ) ) { return NULL ; } if ( count ( $ items ) === 1 ) { $ pop_item = $ items [ 0 ] ; $ pop_item -> remove ( ) ; return $ pop_item ; } $ pop_item = $ items [ count ( $ items ) - 1 ] ; $ pop_item -> previousUntil ( function ( $ node ) {...
Pop an item off end of the list .
15,461
public function shift ( ) { $ items = $ this -> getItems ( ) ; if ( $ items -> isEmpty ( ) ) { return NULL ; } if ( count ( $ items ) === 1 ) { $ pop_item = $ items [ 0 ] ; $ pop_item -> remove ( ) ; return $ pop_item ; } $ pop_item = $ items [ 0 ] ; $ pop_item -> nextUntil ( function ( $ node ) { if ( $ node instanceo...
Shift an item off start of the list .
15,462
public function toArrayNode ( ) { return ( $ this -> parent instanceof ArrayNode ) ? clone $ this -> parent : Parser :: parseExpression ( '[' . $ this -> getText ( ) . ']' ) ; }
Returns this comma list as an ArrayNode .
15,463
public function generateGatewayFormResponse ( $ order , $ gateway_url , $ form_data ) { $ parser = $ this -> getContainer ( ) -> get ( "thelia.parser" ) ; $ parser -> setTemplateDefinition ( $ parser -> getTemplateHelper ( ) -> getActiveFrontTemplate ( ) ) ; $ renderedTemplate = $ parser -> render ( "order-payment-gate...
Render the payment gateway template . The module should provide the gateway URL and the form fields names and values .
15,464
public function getPaymentSuccessPageUrl ( $ order_id ) { $ frontOfficeRouter = $ this -> getContainer ( ) -> get ( 'router.front' ) ; return URL :: getInstance ( ) -> absoluteUrl ( $ frontOfficeRouter -> generate ( "order.placed" , array ( "order_id" => $ order_id ) , Router :: ABSOLUTE_URL ) ) ; }
Return the order payment success page URL
15,465
public function handleClearCacheACL ( ) : void { if ( $ this -> isAjax ( ) ) { $ this -> authorizatorFactory -> cleanCache ( ) ; $ this -> flashNotifier -> success ( 'cms.permissions.aclCacheCleared' ) ; } else { $ this -> terminate ( ) ; } }
Smazani cache ACL
15,466
public function setRoleName ( int $ id , string $ value ) : void { if ( $ this -> isAjax ( ) ) { $ grid = $ this [ 'rolesList' ] ; try { $ role = $ this -> orm -> aclRoles -> getById ( $ id ) ; $ role -> setName ( $ value ) ; $ this -> orm -> persistAndFlush ( $ role ) ; $ this -> flashNotifier -> success ( 'default.da...
Ulozi jmeno role
15,467
public function setRoleParent ( int $ id , string $ value ) : void { if ( $ this -> isAjax ( ) ) { $ role = $ this -> orm -> aclRoles -> getById ( $ id ) ; $ role -> parent = $ value ; $ this -> orm -> persistAndFlush ( $ role ) ; $ this -> flashNotifier -> success ( 'default.dataSaved' ) ; $ this [ 'rolesList' ] -> re...
Ulozi rodice role
15,468
public function setPermissionRole ( int $ id , int $ value ) : void { if ( $ this -> isAjax ( ) ) { $ acl = $ this -> orm -> acl -> getById ( $ id ) ; $ acl -> role = $ value ; $ this -> orm -> persistAndFlush ( $ acl ) ; $ this -> flashNotifier -> success ( 'default.dataSaved' ) ; $ this [ 'permissionsList' ] -> redra...
Nastavi roli pravidlu
15,469
public function setPermissionResource ( int $ id , int $ value ) : void { if ( $ this -> isAjax ( ) ) { $ acl = $ this -> orm -> acl -> getById ( $ id ) ; $ acl -> resource = $ value ; $ this -> orm -> persistAndFlush ( $ acl ) ; $ this -> flashNotifier -> success ( 'default.dataSaved' ) ; $ this [ 'permissionsList' ] ...
Nastavi zdroj pravidlu
15,470
public function setPermissionPrivilege ( int $ id , string $ value ) : void { if ( $ this -> isAjax ( ) ) { $ permission = $ this -> orm -> acl -> getById ( $ id ) ; $ permission -> privilege = $ value ; $ this -> orm -> persistAndFlush ( $ permission ) ; $ this -> flashNotifier -> success ( 'default.dataSaved' ) ; $ t...
Ulozi operaci pravidla
15,471
public function setPermissionState ( int $ id , bool $ value ) : void { if ( $ this -> isAjax ( ) ) { $ permission = $ this -> orm -> acl -> getById ( $ id ) ; $ permission -> allowed = $ value ; $ this -> orm -> persistAndFlush ( $ permission ) ; $ this -> flashNotifier -> success ( 'default.dataSaved' ) ; $ this [ 'p...
Ulozi stav pravidla
15,472
public static function create ( $ function_name , $ parameters = NULL ) { $ function = Parser :: parseSnippet ( "function $function_name() {}" ) ; if ( is_array ( $ parameters ) ) { foreach ( $ parameters as $ parameter ) { if ( is_string ( $ parameter ) ) { $ parameter = ParameterNode :: create ( $ parameter ) ; } $ f...
Create a function declaration .
15,473
public function setName ( $ name ) { $ function_name = $ this -> getName ( ) -> firstChild ( ) ; $ function_name -> setText ( $ name ) ; return $ this ; }
Set the name of the declared function .
15,474
public function updateRatesAction ( ) { if ( null !== $ response = $ this -> checkAuth ( $ this -> resourceCode , array ( ) , AccessManager :: UPDATE ) ) { return $ response ; } try { $ event = new CurrencyUpdateRateEvent ( ) ; $ this -> dispatch ( TheliaEvents :: CURRENCY_UPDATE_RATES , $ event ) ; if ( $ event -> has...
Update currencies rates
15,475
public function setVisibleAction ( ) { if ( null !== $ response = $ this -> checkAuth ( $ this -> resourceCode , array ( ) , AccessManager :: UPDATE ) ) { return $ response ; } $ changeEvent = new CurrencyUpdateEvent ( ( int ) $ this -> getRequest ( ) -> get ( 'currency_id' , 0 ) ) ; $ changeEvent -> setVisible ( ( int...
Sets if the currency is visible for Front
15,476
public function make ( array $ config ) { Arr :: requires ( $ config , [ 'from' , 'client' , 'token' ] ) ; $ client = new Client ( ) ; return new TwilioGateway ( $ client , $ config ) ; }
Create a new twilio gateway instance .
15,477
public static function fromFunction ( FunctionDeclarationNode $ function_node ) { $ method_name = $ function_node -> getName ( ) -> getText ( ) ; $ parameters = $ function_node -> getParameterList ( ) -> getText ( ) ; $ body = $ function_node -> getBody ( ) -> getText ( ) ; $ class_node = Parser :: parseSnippet ( "clas...
Create method from function declaration .
15,478
public function getMethod ( $ name ) { $ methods = $ this -> getMethods ( ) -> filter ( function ( InterfaceMethodNode $ method ) use ( $ name ) { return $ method -> getName ( ) -> getText ( ) === $ name ; } ) ; return $ methods -> isEmpty ( ) ? NULL : $ methods [ 0 ] ; }
Returns a method by name if it exists .
15,479
public function appendMethod ( $ method ) { if ( is_string ( $ method ) ) { $ method = InterfaceMethodNode :: create ( $ method ) ; } $ this -> statements -> lastChild ( ) -> before ( $ method ) ; FormatterFactory :: format ( $ this ) ; return $ this ; }
Adds a method to interface .
15,480
public function makeItDefault ( ) { AddressQuery :: create ( ) -> filterByCustomerId ( $ this -> getCustomerId ( ) ) -> update ( array ( 'IsDefault' => '0' ) ) ; $ this -> setIsDefault ( 1 ) ; $ this -> save ( ) ; }
put the the current address as default one
15,481
public function preInsert ( ConnectionInterface $ con = null ) { parent :: preInsert ( $ con ) ; $ this -> dispatchEvent ( TheliaEvents :: BEFORE_CREATEADDRESS , new AddressEvent ( $ this ) ) ; return true ; }
Code to be run before inserting to database
15,482
public function postInsert ( ConnectionInterface $ con = null ) { parent :: postInsert ( $ con ) ; $ this -> dispatchEvent ( TheliaEvents :: AFTER_CREATEADDRESS , new AddressEvent ( $ this ) ) ; }
Code to be run after inserting to database
15,483
public function preUpdate ( ConnectionInterface $ con = null ) { parent :: preUpdate ( $ con ) ; $ this -> dispatchEvent ( TheliaEvents :: BEFORE_UPDATEADDRESS , new AddressEvent ( $ this ) ) ; return true ; }
Code to be run before updating the object in database
15,484
public function postUpdate ( ConnectionInterface $ con = null ) { parent :: postUpdate ( $ con ) ; $ this -> dispatchEvent ( TheliaEvents :: AFTER_UPDATEADDRESS , new AddressEvent ( $ this ) ) ; }
Code to be run after updating the object in database
15,485
public function preDelete ( ConnectionInterface $ con = null ) { parent :: preDelete ( $ con ) ; if ( $ this -> getIsDefault ( ) ) { return false ; } $ this -> dispatchEvent ( TheliaEvents :: BEFORE_DELETEADDRESS , new AddressEvent ( $ this ) ) ; return true ; }
Code to be run before deleting the object in database
15,486
public function postDelete ( ConnectionInterface $ con = null ) { parent :: postDelete ( $ con ) ; $ this -> dispatchEvent ( TheliaEvents :: AFTER_DELETEADDRESS , new AddressEvent ( $ this ) ) ; }
Code to be run after deleting the object in database
15,487
private function loadPluginTextdomain ( ) { load_textdomain ( $ this -> textdomain , $ this -> configs -> get ( 'libraryDir' ) . 'languages/' . $ this -> textdomain . '-' . get_locale ( ) . '.mo' ) ; }
Load the library s text domain .
15,488
public function loadPluginInstaller ( ) { if ( ! did_action ( 'Boldgrid\Library\Library\Start::loadPluginInstaller' ) ) { do_action ( 'Boldgrid\Library\Library\Start::loadPluginInstaller' ) ; if ( class_exists ( '\Boldgrid\Library\Plugin\Installer' ) ) { $ this -> pluginInstaller = new \ Boldgrid \ Library \ Plugin \ I...
Load the Plugin \ Installer class if exists .
15,489
public function filterConfigs ( $ configs ) { if ( ! empty ( $ configs [ 'libraryDir' ] ) ) { $ configs [ 'libraryUrl' ] = str_replace ( ABSPATH , get_site_url ( ) . '/' , $ configs [ 'libraryDir' ] ) ; } return $ configs ; }
Filter the configuration array .
15,490
protected function listImport ( OutputInterface $ output ) { $ table = new Table ( $ output ) ; foreach ( ( new ImportQuery ) -> find ( ) as $ import ) { $ table -> addRow ( [ $ import -> getRef ( ) , $ import -> getTitle ( ) , $ import -> getDescription ( ) ] ) ; } $ table -> setHeaders ( [ 'Reference' , 'Title' , 'De...
Output available imports
15,491
public function _build_xml ( $ k , $ v ) { if ( is_object ( $ v ) && strtolower ( get_class ( $ v ) ) == 'simplexmlelement' ) { return preg_replace ( '/<\?xml(.*?)\?>\n*/' , '' , $ v -> asXML ( ) ) ; } $ res = '' ; $ attrs = '' ; if ( ! is_numeric ( $ k ) ) { $ res = '<' . $ k . '{{attributes}}>' ; } if ( is_object ( $...
Simple recursive function to build an XML response .
15,492
public function _unicode_ord ( & $ c , & $ i = 0 ) { $ l = strlen ( $ c ) ; $ index = $ i ; if ( $ index >= $ l ) { return false ; } $ o = ord ( $ c [ $ index ] ) ; if ( $ o <= 0x7F ) { return $ o ; } elseif ( $ o < 0xC2 ) { return false ; } elseif ( $ o <= 0xDF && $ index < $ l - 1 ) { $ i += 1 ; return ( $ o & 0x1F )...
Returns the unicode value of the string
15,493
public function _xml_entities ( $ s , $ hex = true ) { if ( empty ( $ s ) ) { return $ s ; } $ s = ( string ) $ s ; $ r = '' ; $ l = strlen ( $ s ) ; for ( $ i = 0 ; $ i < $ l ; $ i ++ ) { $ o = $ this -> _unicode_ord ( $ s , $ i ) ; $ v = ( ( $ o >= 9 && $ o <= 13 ) || ( $ o == 32 ) || ( $ o == 33 ) || ( $ o >= 35 && ...
Makes the specified string XML - safe
15,494
public function _fetch ( $ url , $ method , $ params ) { if ( ! extension_loaded ( 'curl' ) ) { $ this -> error = 'cURL extension not loaded.' ; return false ; } $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ url ) ; curl_setopt ( $ ch , CURLOPT_MAXREDIRS , 3 ) ; curl_setopt ( $ ch , CURLOPT_FOLLOWLOCATION...
Fetch the specified request via cURL .
15,495
public function set ( $ k , $ v = false ) { if ( ! $ v && is_array ( $ k ) ) { foreach ( $ k as $ key => $ value ) { $ this -> _data [ $ key ] = $ value ; } } else { $ this -> _data [ $ k ] = $ v ; } return $ this ; }
Quick setter for chaining methods .
15,496
protected function getLog ( ) { if ( $ this -> log == null ) { $ this -> log = Tlog :: getNewInstance ( ) ; $ logFilePath = $ this -> getLogFilePath ( ) ; $ this -> log -> setPrefix ( "#LEVEL: #DATE #HOUR: " ) ; $ this -> log -> setDestinations ( "\\Thelia\\Log\\Destination\\TlogDestinationFile" ) ; $ this -> log -> se...
Returns the module - specific logger initializing it if required .
15,497
public function confirmPayment ( $ orderId ) { try { $ orderId = \ intval ( $ orderId ) ; if ( null !== $ order = $ this -> getOrder ( $ orderId ) ) { $ this -> getLog ( ) -> addInfo ( $ this -> getTranslator ( ) -> trans ( "Processing confirmation of order ref. %ref, ID %id" , array ( '%ref' => $ order -> getRef ( ) ,...
Process the confirmation of an order . This method should be called once the module has performed the required checks to confirm a valid payment .
15,498
protected function getOrder ( $ orderId ) { if ( null == $ order = OrderQuery :: create ( ) -> findPk ( $ orderId ) ) { $ this -> getLog ( ) -> addError ( $ this -> getTranslator ( ) -> trans ( "Unknown order ID: %id" , array ( '%id' => $ orderId ) ) ) ; } return $ order ; }
Get an order and issue a log message if not found .
15,499
public function redirectToSuccessPage ( $ orderId ) { $ this -> getLog ( ) -> addInfo ( "Redirecting customer to payment success page" ) ; throw new RedirectException ( $ this -> retrieveUrlFromRouteId ( 'order.placed' , [ ] , [ 'order_id' => $ orderId ] , Router :: ABSOLUTE_PATH ) ) ; }
Redirect the customer to the successful payment page .