idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
15,300 | public function getDeliveryCountry ( ) { if ( null === $ this -> taxCountry ) { if ( null !== $ customer = $ this -> getSession ( ) -> getCustomerUser ( ) ) { if ( null !== $ this -> getSession ( ) -> getOrder ( ) && null !== $ this -> getSession ( ) -> getOrder ( ) -> getChoosenDeliveryAddress ( ) && null !== $ currentDeliveryAddress = AddressQuery :: create ( ) -> findPk ( $ this -> getSession ( ) -> getOrder ( ) -> getChoosenDeliveryAddress ( ) ) ) { $ this -> taxCountry = $ currentDeliveryAddress -> getCountry ( ) ; $ this -> taxState = $ currentDeliveryAddress -> getState ( ) ; } else { $ customerDefaultAddress = $ customer -> getDefaultAddress ( ) ; if ( isset ( $ customerDefaultAddress ) ) { $ this -> taxCountry = $ customerDefaultAddress -> getCountry ( ) ; $ this -> taxState = $ customerDefaultAddress -> getState ( ) ; } } } if ( null == $ this -> taxCountry ) { $ this -> taxCountry = CountryQuery :: create ( ) -> findOneByByDefault ( 1 ) ; $ this -> taxState = null ; } } return $ this -> taxCountry ; } | Find Tax Country Id First look for a picked delivery address country Then look at the current customer default address country Else look at the default website country |
15,301 | public function setToggleVisibilityAction ( ) { if ( null !== $ response = $ this -> checkAuth ( $ this -> resourceCode , array ( ) , AccessManager :: UPDATE ) ) { return $ response ; } $ event = new CategoryToggleVisibilityEvent ( $ this -> getExistingObject ( ) ) ; try { $ this -> dispatch ( TheliaEvents :: CATEGORY_TOGGLE_VISIBILITY , $ event ) ; } catch ( \ Exception $ ex ) { return $ this -> errorPage ( $ ex ) ; } return $ this -> nullResponse ( ) ; } | Online status toggle category |
15,302 | public function addRelatedPictureAction ( ) { if ( null !== $ response = $ this -> checkAuth ( $ this -> resourceCode , array ( ) , AccessManager :: UPDATE ) ) { return $ response ; } return $ this -> redirectToEditionTemplate ( ) ; } | Add category pictures |
15,303 | public static function process ( array $ docs ) { return self :: flatmap ( function ( $ doc ) { return self :: flatmap ( function ( $ tag ) { return self :: flatmap ( function ( $ type ) { return self :: processType ( $ type ) ; } , self :: processTag ( $ tag ) ) ; } , $ doc -> getTags ( ) ) ; } , $ docs ) ; } | Process an array of phpdoc . |
15,304 | private static function processTag ( BaseTag $ tag ) { $ types = [ ] ; if ( method_exists ( $ tag , 'getType' ) && is_callable ( [ $ tag , 'getType' ] ) ) { if ( ( $ type = $ tag -> getType ( ) ) !== null ) { $ types [ ] = $ type ; } } if ( method_exists ( $ tag , 'getArguments' ) && is_callable ( [ $ tag , 'getArguments' ] ) ) { foreach ( $ tag -> getArguments ( ) as $ param ) { if ( ( $ type = $ param [ 'type' ] ?? null ) !== null ) { $ types [ ] = $ type ; } } } return $ types ; } | Process a tag into types . |
15,305 | private static function processType ( Type $ type ) { if ( $ type instanceof Array_ ) { return self :: flatmap ( function ( $ t ) { return self :: processType ( $ t ) ; } , [ $ type -> getKeyType ( ) , $ type -> getValueType ( ) ] ) ; } if ( $ type instanceof Compound ) { return self :: flatmap ( function ( $ t ) { return self :: processType ( $ t ) ; } , iterator_to_array ( $ type ) ) ; } if ( $ type instanceof Nullable ) { return self :: processType ( $ type -> getActualType ( ) ) ; } if ( $ type instanceof Object_ ) { if ( ( $ fq = $ type -> getFqsen ( ) ) !== null ) { return [ ltrim ( ( string ) $ fq , '\\' ) ] ; } } return [ ] ; } | Process a type into FQCN strings . |
15,306 | protected function initialize ( ) { $ class = \ get_class ( $ this ) ; if ( null === self :: $ loopDefinitions ) { self :: $ loopDefinitions = \ array_flip ( $ this -> container -> getParameter ( 'thelia.parser.loops' ) ) ; } if ( isset ( self :: $ loopDefinitions [ $ class ] ) ) { $ this -> loopName = self :: $ loopDefinitions [ $ class ] ; } if ( ! isset ( self :: $ loopDefinitionsArgs [ $ class ] ) ) { $ this -> args = $ this -> getArgDefinitions ( ) -> addArguments ( $ this -> getDefaultArgs ( ) , false ) ; $ eventName = $ this -> getDispatchEventName ( TheliaEvents :: LOOP_EXTENDS_ARG_DEFINITIONS ) ; if ( null !== $ eventName ) { $ this -> dispatcher -> dispatch ( $ eventName , new LoopExtendsArgDefinitionsEvent ( $ this ) ) ; } ; self :: $ loopDefinitionsArgs [ $ class ] = $ this -> args ; } $ this -> args = self :: $ loopDefinitionsArgs [ $ class ] ; } | Initialize the loop |
15,307 | protected function getDefaultArgs ( ) { $ defaultArgs = [ Argument :: createBooleanTypeArgument ( 'backend_context' , false ) , Argument :: createBooleanTypeArgument ( 'force_return' , false ) , Argument :: createAnyTypeArgument ( 'type' ) , Argument :: createBooleanTypeArgument ( 'no-cache' , false ) , Argument :: createBooleanTypeArgument ( 'return_url' , true ) ] ; if ( true === $ this -> countable ) { $ defaultArgs [ ] = Argument :: createIntTypeArgument ( 'offset' , 0 ) ; $ defaultArgs [ ] = Argument :: createIntTypeArgument ( 'page' ) ; $ defaultArgs [ ] = Argument :: createIntTypeArgument ( 'limit' , PHP_INT_MAX ) ; } if ( $ this instanceof SearchLoopInterface ) { $ defaultArgs [ ] = Argument :: createAnyTypeArgument ( 'search_term' ) ; $ defaultArgs [ ] = new Argument ( 'search_in' , new TypeCollection ( new EnumListType ( $ this -> getSearchIn ( ) ) ) ) ; $ defaultArgs [ ] = new Argument ( 'search_mode' , new TypeCollection ( new EnumType ( [ SearchLoopInterface :: MODE_ANY_WORD , SearchLoopInterface :: MODE_SENTENCE , SearchLoopInterface :: MODE_STRICT_SENTENCE , ] ) ) , SearchLoopInterface :: MODE_STRICT_SENTENCE ) ; } return $ defaultArgs ; } | Define common loop arguments |
15,308 | public function initializeArgs ( array $ nameValuePairs ) { $ faultActor = [ ] ; $ faultDetails = [ ] ; if ( null !== $ eventName = $ this -> getDispatchEventName ( TheliaEvents :: LOOP_EXTENDS_INITIALIZE_ARGS ) ) { $ event = new LoopExtendsInitializeArgsEvent ( $ this , $ nameValuePairs ) ; $ this -> dispatcher -> dispatch ( $ eventName , $ event ) ; $ nameValuePairs = $ event -> getLoopParameters ( ) ; } $ loopType = isset ( $ nameValuePairs [ 'type' ] ) ? $ nameValuePairs [ 'type' ] : "undefined" ; $ loopName = isset ( $ nameValuePairs [ 'name' ] ) ? $ nameValuePairs [ 'name' ] : "undefined" ; $ this -> args -> rewind ( ) ; while ( ( $ argument = $ this -> args -> current ( ) ) !== false ) { $ this -> args -> next ( ) ; $ value = isset ( $ nameValuePairs [ $ argument -> name ] ) ? $ nameValuePairs [ $ argument -> name ] : null ; if ( $ value === null && $ argument -> mandatory ) { $ faultActor [ ] = $ argument -> name ; $ faultDetails [ ] = $ this -> translator -> trans ( '"%param" parameter is missing in loop type: %type, name: %name' , [ '%param' => $ argument -> name , '%type' => $ loopType , '%name' => $ loopName ] ) ; } elseif ( $ value === '' ) { if ( ! $ argument -> empty ) { $ faultActor [ ] = $ argument -> name ; $ faultDetails [ ] = $ this -> translator -> trans ( '"%param" parameter cannot be empty in loop type: %type, name: %name' , [ '%param' => $ argument -> name , '%type' => $ loopType , '%name' => $ loopName ] ) ; } } elseif ( $ value !== null && ! $ argument -> type -> isValid ( $ value ) ) { $ faultActor [ ] = $ argument -> name ; $ faultDetails [ ] = $ this -> translator -> trans ( 'Invalid value "%value" for "%param" parameter in loop type: %type, name: %name' , [ '%value' => $ value , '%param' => $ argument -> name , '%type' => $ loopType , '%name' => $ loopName ] ) ; } else { if ( $ value === null ) { $ value = $ argument -> default ; } $ argument -> setValue ( $ value ) ; } } if ( ! empty ( $ faultActor ) ) { $ complement = sprintf ( '[%s]' , implode ( ', ' , $ faultDetails ) ) ; throw new \ InvalidArgumentException ( $ complement ) ; } } | Initialize the loop arguments . |
15,309 | protected function getArg ( $ argumentName ) { $ arg = $ this -> args -> get ( $ argumentName ) ; if ( $ arg === null ) { throw new \ InvalidArgumentException ( $ this -> translator -> trans ( 'Undefined loop argument "%name"' , [ '%name' => $ argumentName ] ) ) ; } return $ arg ; } | Return a loop argument |
15,310 | protected function getDispatchEventName ( $ eventName ) { $ customEventName = TheliaEvents :: getLoopExtendsEvent ( $ eventName , $ this -> loopName ) ; if ( ! isset ( self :: $ dispatchCache [ $ customEventName ] ) ) { self :: $ dispatchCache [ $ customEventName ] = $ this -> dispatcher -> hasListeners ( $ customEventName ) ; } return self :: $ dispatchCache [ $ customEventName ] ? $ customEventName : null ; } | Get the event name for the loop depending of the event name and the loop name . |
15,311 | protected function extendsBuildModelCriteria ( ModelCriteria $ search = null ) { if ( null === $ search ) { return null ; } $ eventName = $ this -> getDispatchEventName ( TheliaEvents :: LOOP_EXTENDS_BUILD_MODEL_CRITERIA ) ; if ( null !== $ eventName ) { $ this -> dispatcher -> dispatch ( $ eventName , new LoopExtendsBuildModelCriteriaEvent ( $ this , $ search ) ) ; } return $ search ; } | Dispatch an event to extend the BuildModelCriteria |
15,312 | protected function extendsBuildArray ( array $ search = null ) { if ( null === $ search ) { return null ; } $ eventName = $ this -> getDispatchEventName ( TheliaEvents :: LOOP_EXTENDS_BUILD_ARRAY ) ; if ( null !== $ eventName ) { $ event = new LoopExtendsBuildArrayEvent ( $ this , $ search ) ; $ this -> dispatcher -> dispatch ( $ eventName , $ event ) ; $ search = $ event -> getArray ( ) ; } return $ search ; } | Dispatch an event to extend the BuildArray |
15,313 | protected function extendsParseResults ( LoopResult $ loopResult ) { $ eventName = $ this -> getDispatchEventName ( TheliaEvents :: LOOP_EXTENDS_PARSE_RESULTS ) ; if ( null !== $ eventName ) { $ this -> dispatcher -> dispatch ( $ eventName , new LoopExtendsParseResultsEvent ( $ this , $ loopResult ) ) ; } return $ loopResult ; } | Dispatch an event to extend the ParseResults |
15,314 | public function setNotice ( $ forceDisplay = false ) { if ( $ this -> notice ) { return $ this -> notice ; } if ( 0 === get_site_transient ( 'boldgrid_available' ) ) { return new Notice ( 'ConnectionIssue' ) ; } if ( ! Configs :: get ( 'key' ) || ! self :: $ valid || $ forceDisplay ) { return new Notice ( 'keyPrompt' , $ this ) ; } } | Add the appropriate notice to the WordPress dashboard . |
15,315 | public function addKey ( $ key ) { delete_site_transient ( 'bg_license_data' ) ; delete_site_transient ( 'boldgrid_api_data' ) ; $ data = $ this -> callCheckVersion ( array ( 'key' => $ key ) ) ; if ( is_object ( $ data ) ) { $ this -> save ( $ data , $ key ) ; return true ; } else { return false ; } } | Add a key . |
15,316 | public function callCheckVersion ( $ args ) { if ( ! empty ( $ args [ 'key' ] ) ) { $ call = new Api \ Call ( Configs :: get ( 'api' ) . '/api/plugin/checkVersion' , $ args ) ; if ( ! $ response = $ call -> getError ( ) ) { $ response = $ call -> getResponse ( ) ; } } else { $ response = 'No Connect Key available.' ; } return $ response ; } | Call the API check - version endpoint for API data . |
15,317 | public function verify ( $ key = null ) { $ key = $ key ? $ key : Configs :: get ( 'key' ) ; $ data = $ this -> callCheckVersion ( array ( 'key' => $ key , 'channel' => $ this -> releaseChannel -> getPluginChannel ( ) , 'theme_channel' => $ this -> releaseChannel -> getThemeChannel ( ) , ) ) ; if ( $ this -> verifyData ( $ data ) ) { $ data -> license_status = true ; } return $ data ; } | Validates the API key and returns details on if it is valid as well as version . |
15,318 | public function client ( $ client ) { $ this -> client = $ client instanceof Client ? $ client : bearychat ( $ client ) ; if ( $ this -> message ) { $ this -> message -> setClient ( $ this -> client ) ; } return $ this ; } | Set the BearyChat client . |
15,319 | protected function createImagineInstance ( ) { $ driver = ConfigQuery :: read ( "imagine_graphic_driver" , "gd" ) ; switch ( $ driver ) { case 'imagick' : $ image = new ImagickImagine ( ) ; break ; case 'gmagick' : $ image = new GmagickImagine ( ) ; break ; case 'gd' : default : $ image = new Imagine ( ) ; } return $ image ; } | Create a new Imagine object using current driver configuration |
15,320 | public function make ( array $ config ) { Arr :: requires ( $ config , [ 'token' ] ) ; $ client = new Client ( ) ; return new BallouGateway ( $ client , $ config ) ; } | Create a new ballou gateway instance . |
15,321 | protected function childrenByInstance ( $ class_name ) { $ matches = [ ] ; $ child = $ this -> head ; while ( $ child ) { if ( $ child instanceof $ class_name ) { $ matches [ ] = $ child ; } $ child = $ child -> next ; } return $ matches ; } | Get children that are instance of class . |
15,322 | protected function prependChild ( Node $ node ) { if ( $ this -> head === NULL ) { $ this -> childCount ++ ; $ node -> parent = $ this ; $ node -> previous = NULL ; $ node -> next = NULL ; $ this -> head = $ this -> tail = $ node ; } else { $ this -> insertBeforeChild ( $ this -> head , $ node ) ; $ this -> head = $ node ; } return $ this ; } | Prepend a child to node . |
15,323 | protected function appendChild ( Node $ node ) { if ( $ this -> tail === NULL ) { $ this -> prependChild ( $ node ) ; } else { $ this -> insertAfterChild ( $ this -> tail , $ node ) ; $ this -> tail = $ node ; } return $ this ; } | Append a child to node . |
15,324 | public function addChild ( Node $ node , $ property_name = NULL ) { $ this -> appendChild ( $ node ) ; if ( $ property_name !== NULL ) { $ this -> { $ property_name } = $ node ; } return $ this ; } | Add a child to node . |
15,325 | public function mergeNode ( ParentNode $ node ) { $ child = $ node -> head ; while ( $ child ) { $ next = $ child -> next ; $ this -> appendChild ( $ child ) ; $ child = $ next ; } foreach ( $ node -> getChildProperties ( ) as $ name => $ value ) { $ this -> { $ name } = $ value ; } } | Merge another parent node into this node . |
15,326 | protected function insertBeforeChild ( Node $ child , Node $ node ) { $ this -> childCount ++ ; $ node -> parent = $ this ; if ( $ child -> previous === NULL ) { $ this -> head = $ node ; } else { $ child -> previous -> next = $ node ; } $ node -> previous = $ child -> previous ; $ node -> next = $ child ; $ child -> previous = $ node ; return $ this ; } | Insert a node before a child . |
15,327 | protected function insertAfterChild ( Node $ child , Node $ node ) { $ this -> childCount ++ ; $ node -> parent = $ this ; if ( $ child -> next === NULL ) { $ this -> tail = $ node ; } else { $ child -> next -> previous = $ node ; } $ node -> previous = $ child ; $ node -> next = $ child -> next ; $ child -> next = $ node ; return $ this ; } | Insert a node after a child . |
15,328 | protected function removeChild ( Node $ child ) { $ this -> childCount -- ; foreach ( $ this -> getChildProperties ( ) as $ name => $ value ) { if ( $ child === $ value ) { $ this -> { $ name } = NULL ; break ; } } if ( $ child -> previous === NULL ) { $ this -> head = $ child -> next ; } else { $ child -> previous -> next = $ child -> next ; } if ( $ child -> next === NULL ) { $ this -> tail = $ child -> previous ; } else { $ child -> next -> previous = $ child -> previous ; } $ child -> parent = NULL ; $ child -> previous = NULL ; $ child -> next = NULL ; return $ this ; } | Remove a child node . |
15,329 | protected function replaceChild ( Node $ child , Node $ replacement ) { foreach ( $ this -> getChildProperties ( ) as $ name => $ value ) { if ( $ child === $ value ) { $ this -> { $ name } = $ replacement ; break ; } } $ replacement -> parent = $ this ; $ replacement -> previous = $ child -> previous ; $ replacement -> next = $ child -> next ; if ( $ child -> previous === NULL ) { $ this -> head = $ replacement ; } else { $ child -> previous -> next = $ replacement ; } if ( $ child -> next === NULL ) { $ this -> tail = $ replacement ; } else { $ child -> next -> previous = $ replacement ; } $ child -> parent = NULL ; $ child -> previous = NULL ; $ child -> next = NULL ; return $ this ; } | Replace a child node . |
15,330 | public function getTree ( ) { $ children = array ( ) ; $ properties = $ this -> getChildProperties ( ) ; $ child = $ this -> head ; $ i = 0 ; while ( $ child ) { $ key = array_search ( $ child , $ properties , TRUE ) ; if ( ! $ key ) { $ key = $ i ; } if ( $ child instanceof ParentNode ) { $ children [ $ key ] = $ child -> getTree ( ) ; } else { $ children [ $ key ] = array ( $ child -> getTypeName ( ) => $ child -> getText ( ) ) ; } $ child = $ child -> next ; $ i ++ ; } $ class_name = get_class ( $ this ) ; return array ( $ class_name => $ children ) ; } | Convert tree into array . |
15,331 | protected function checkTypeAllowed ( ) { if ( ! in_array ( $ this -> type , static :: $ ALLOWED_TYPES ) ) { throw new \ Exception ( sprintf ( "`%s` is not a valid environment type. Expected one of: %s" , $ this -> type , implode ( ', ' , static :: $ ALLOWED_TYPES ) ) ) ; } } | Makes sure the current type is allowed |
15,332 | public function verifyTemplates ( $ value , ExecutionContextInterface $ context ) { $ data = $ context -> getRoot ( ) -> getData ( ) ; if ( ! empty ( $ data [ 'templates' ] ) && $ data [ 'method' ] !== BaseHook :: INJECT_TEMPLATE_METHOD_NAME ) { $ context -> addViolation ( $ this -> trans ( "If you use automatic insert templates, you should use the method %method%" , [ '%method%' => BaseHook :: INJECT_TEMPLATE_METHOD_NAME ] ) ) ; } } | Check if method is the right one if we want to use automatic inserted templates . |
15,333 | public static function getI18n ( Translator $ translator , $ operator ) { $ ret = $ operator ; switch ( $ operator ) { case self :: INFERIOR : $ ret = $ translator -> trans ( 'Less than' , [ ] ) ; break ; case self :: INFERIOR_OR_EQUAL : $ ret = $ translator -> trans ( 'Less than or equals' , [ ] ) ; break ; case self :: EQUAL : $ ret = $ translator -> trans ( 'Equal to' , [ ] ) ; break ; case self :: SUPERIOR_OR_EQUAL : $ ret = $ translator -> trans ( 'Greater than or equals' , [ ] ) ; break ; case self :: SUPERIOR : $ ret = $ translator -> trans ( 'Greater than' , [ ] ) ; break ; case self :: DIFFERENT : $ ret = $ translator -> trans ( 'Not equal to' , [ ] ) ; break ; case self :: IN : $ ret = $ translator -> trans ( 'In' , [ ] ) ; break ; case self :: OUT : $ ret = $ translator -> trans ( 'Not in' , [ ] ) ; break ; default : } return $ ret ; } | Get operator translation |
15,334 | public function getErrorMessages ( Form $ form ) { $ errors = '' ; foreach ( $ form -> getErrors ( ) as $ key => $ error ) { $ errors .= $ error -> getMessage ( ) . ', ' ; } foreach ( $ form -> all ( ) as $ child ) { if ( ! $ child -> isValid ( ) ) { $ fieldName = $ child -> getConfig ( ) -> getOption ( 'label' , null ) ; if ( empty ( $ fieldName ) ) { $ fieldName = $ child -> getName ( ) ; } $ errors .= sprintf ( "[%s] %s, " , $ fieldName , $ this -> getErrorMessages ( $ child ) ) ; } } return rtrim ( $ errors , ', ' ) ; } | Get all errors that occurred in a form |
15,335 | protected function getUpdateSeoEvent ( $ formData ) { $ updateSeoEvent = new UpdateSeoEvent ( $ formData [ 'id' ] ) ; $ updateSeoEvent -> setLocale ( $ formData [ 'locale' ] ) -> setMetaTitle ( $ formData [ 'meta_title' ] ) -> setMetaDescription ( $ formData [ 'meta_description' ] ) -> setMetaKeywords ( $ formData [ 'meta_keywords' ] ) -> setUrl ( $ formData [ 'url' ] ) ; return $ updateSeoEvent ; } | Creates the update SEO event with the provided form data |
15,336 | protected function hydrateSeoForm ( $ object ) { $ locale = $ object -> getLocale ( ) ; $ data = array ( 'id' => $ object -> getId ( ) , 'locale' => $ locale , 'url' => $ object -> getRewrittenUrl ( $ locale ) , 'meta_title' => $ object -> getMetaTitle ( ) , 'meta_description' => $ object -> getMetaDescription ( ) , 'meta_keywords' => $ object -> getMetaKeywords ( ) ) ; $ seoForm = $ this -> createForm ( AdminForm :: SEO , "form" , $ data ) ; $ this -> getParserContext ( ) -> addForm ( $ seoForm ) ; $ this -> getParserContext ( ) -> set ( 'url_language' , $ this -> getUrlLanguage ( $ locale ) ) ; } | Hydrate the SEO form for this object before passing it to the update template |
15,337 | public function processUpdateSeoAction ( ) { if ( null !== $ response = $ this -> checkAuth ( $ this -> resourceCode , $ this -> getModuleCode ( ) , AccessManager :: UPDATE ) ) { return $ response ; } $ error_msg = false ; $ updateSeoForm = $ this -> getUpdateSeoForm ( $ this -> getRequest ( ) ) ; $ this -> getRequest ( ) -> attributes -> set ( $ this -> objectName . '_id' , $ this -> getRequest ( ) -> get ( 'current_id' ) ) ; try { $ form = $ this -> validateForm ( $ updateSeoForm , "POST" ) ; $ data = $ form -> getData ( ) ; $ updateSeoEvent = $ this -> getUpdateSeoEvent ( $ data ) ; $ this -> dispatch ( $ this -> updateSeoEventIdentifier , $ updateSeoEvent ) ; $ response = $ this -> performAdditionalUpdateSeoAction ( $ updateSeoEvent ) ; if ( $ response == null ) { if ( $ this -> getRequest ( ) -> get ( 'save_mode' ) == 'stay' ) { return $ this -> redirectToEditionTemplate ( $ this -> getRequest ( ) ) ; } return $ this -> generateSuccessRedirect ( $ updateSeoForm ) ; } else { return $ response ; } } catch ( FormValidationException $ ex ) { $ error_msg = $ this -> createStandardFormValidationErrorMessage ( $ ex ) ; } if ( null !== $ object = $ this -> getExistingObject ( ) ) { $ changeForm = $ this -> hydrateObjectForm ( $ object ) ; $ this -> getParserContext ( ) -> addForm ( $ changeForm ) ; } if ( false !== $ error_msg ) { $ this -> setupFormErrorContext ( $ this -> getTranslator ( ) -> trans ( "%obj SEO modification" , array ( '%obj' => $ this -> objectName ) ) , $ error_msg , $ updateSeoForm , $ ex ) ; return $ this -> renderEditionTemplate ( ) ; } } | Update SEO modification and either go back to the object list or stay on the edition page . |
15,338 | private function checkDeactivation ( $ module ) { $ moduleValidator = new ModuleValidator ( $ module -> getAbsoluteBaseDir ( ) ) ; $ modules = $ moduleValidator -> getModulesDependOf ( ) ; if ( \ count ( $ modules ) > 0 ) { $ moduleList = implode ( ', ' , array_column ( $ modules , 'code' ) ) ; $ message = ( \ count ( $ modules ) == 1 ) ? Translator :: getInstance ( ) -> trans ( '%s has dependency to module %s. You have to deactivate this module before.' ) : Translator :: getInstance ( ) -> trans ( '%s have dependencies to module %s. You have to deactivate these modules before.' ) ; throw new ModuleException ( sprintf ( $ message , $ moduleList , $ moduleValidator -> getModuleDefinition ( ) -> getCode ( ) ) ) ; } return true ; } | Check if module can be deactivated safely because other modules could have dependencies to this module |
15,339 | public function recursiveActivation ( ModuleToggleActivationEvent $ event , $ eventName , EventDispatcherInterface $ dispatcher ) { if ( null !== $ module = ModuleQuery :: create ( ) -> findPk ( $ event -> getModuleId ( ) ) ) { $ moduleValidator = new ModuleValidator ( $ module -> getAbsoluteBaseDir ( ) ) ; $ dependencies = $ moduleValidator -> getCurrentModuleDependencies ( ) ; foreach ( $ dependencies as $ defMod ) { $ submodule = ModuleQuery :: create ( ) -> findOneByCode ( $ defMod [ "code" ] ) ; if ( $ submodule && $ submodule -> getActivate ( ) != BaseModule :: IS_ACTIVATED ) { $ subevent = new ModuleToggleActivationEvent ( $ submodule -> getId ( ) ) ; $ subevent -> setRecursive ( true ) ; $ dispatcher -> dispatch ( TheliaEvents :: MODULE_TOGGLE_ACTIVATION , $ subevent ) ; } } } } | Get dependencies of the current module and activate it if needed |
15,340 | public function pay ( OrderPaymentEvent $ event ) { $ order = $ event -> getOrder ( ) ; if ( null === $ paymentModule = ModuleQuery :: create ( ) -> findPk ( $ order -> getPaymentModuleId ( ) ) ) { throw new \ RuntimeException ( Translator :: getInstance ( ) -> trans ( "Failed to find a payment Module with ID=%mid for order ID=%oid" , [ "%mid" => $ order -> getPaymentModuleId ( ) , "%oid" => $ order -> getId ( ) ] ) ) ; } $ paymentModuleInstance = $ paymentModule -> getPaymentModuleInstance ( $ this -> container ) ; $ response = $ paymentModuleInstance -> pay ( $ order ) ; if ( null !== $ response && $ response instanceof Response ) { $ event -> setResponse ( $ response ) ; } } | Call the payment method of the payment module of the given order |
15,341 | public function isMatching ( ) { $ condition1 = $ this -> conditionValidator -> variableOpComparison ( $ this -> facade -> getCartTotalTaxPrice ( ) , $ this -> operators [ self :: CART_TOTAL ] , $ this -> values [ self :: CART_TOTAL ] ) ; if ( $ condition1 ) { $ condition2 = $ this -> conditionValidator -> variableOpComparison ( $ this -> facade -> getCheckoutCurrency ( ) , $ this -> operators [ self :: CART_CURRENCY ] , $ this -> values [ self :: CART_CURRENCY ] ) ; if ( $ condition2 ) { return true ; } } return false ; } | Test if Customer meets conditions |
15,342 | public static function findFiles ( $ directory , $ extensions = [ 'php' ] ) { if ( ! is_dir ( $ directory ) ) { return [ ] ; } $ directory_iterator = new \ RecursiveDirectoryIterator ( $ directory ) ; $ iterator = new \ RecursiveIteratorIterator ( $ directory_iterator ) ; $ pattern = '/^.+\.(' . implode ( '|' , $ extensions ) . ')$/i' ; $ regex = new \ RegexIterator ( $ iterator , $ pattern , \ RecursiveRegexIterator :: GET_MATCH ) ; $ files = [ ] ; foreach ( $ regex as $ name => $ object ) { $ files [ ] = $ name ; } return $ files ; } | Recursively find files in a directory with matching extensions . |
15,343 | public function exec ( ) { $ dsn = "mysql:host=%s;port=%s" ; try { $ this -> connection = new \ PDO ( sprintf ( $ dsn , $ this -> host , $ this -> port ) , $ this -> user , $ this -> password ) ; } catch ( \ PDOException $ e ) { $ this -> validationMessages = 'Wrong connection information' ; $ this -> isValid = false ; } return $ this -> isValid ; } | Perform database connection check |
15,344 | public function getIndent ( ) { $ whitespace_token = $ this -> previousToken ( ) ; if ( empty ( $ whitespace_token ) || $ whitespace_token -> getType ( ) !== T_WHITESPACE ) { return '' ; } $ nl = FormatterFactory :: getDefaultFormatter ( ) -> getConfig ( 'nl' ) ; $ lines = explode ( $ nl , $ whitespace_token -> getText ( ) ) ; $ last_line = end ( $ lines ) ; return $ last_line ; } | Get the indent proceeding this node . |
15,345 | public function createOrUpdate ( $ code , $ title , array $ effects , $ type , $ isRemovingPostage , $ shortDescription , $ description , $ isEnabled , $ expirationDate , $ isAvailableOnSpecialOffers , $ isCumulative , $ maxUsage , $ defaultSerializedRule , $ locale , $ freeShippingForCountries , $ freeShippingForMethods , $ perCustomerUsageCount , $ startDate = null ) { $ con = Propel :: getWriteConnection ( CouponTableMap :: DATABASE_NAME ) ; $ con -> beginTransaction ( ) ; try { $ this -> setCode ( $ code ) -> setType ( $ type ) -> setEffects ( $ effects ) -> setIsRemovingPostage ( $ isRemovingPostage ) -> setIsEnabled ( $ isEnabled ) -> setStartDate ( $ startDate ) -> setExpirationDate ( $ expirationDate ) -> setIsAvailableOnSpecialOffers ( $ isAvailableOnSpecialOffers ) -> setIsCumulative ( $ isCumulative ) -> setMaxUsage ( $ maxUsage ) -> setPerCustomerUsageCount ( $ perCustomerUsageCount ) -> setLocale ( $ locale ) -> setTitle ( $ title ) -> setShortDescription ( $ shortDescription ) -> setDescription ( $ description ) ; if ( null === $ this -> getSerializedConditions ( ) ) { $ this -> setSerializedConditions ( $ defaultSerializedRule ) ; } $ this -> save ( ) ; CouponCountryQuery :: create ( ) -> filterByCouponId ( $ this -> id ) -> delete ( ) ; CouponModuleQuery :: create ( ) -> filterByCouponId ( $ this -> id ) -> delete ( ) ; foreach ( $ freeShippingForCountries as $ countryId ) { if ( $ countryId <= 0 ) { continue ; } $ couponCountry = new CouponCountry ( ) ; $ couponCountry -> setCouponId ( $ this -> getId ( ) ) -> setCountryId ( $ countryId ) -> save ( ) ; ; } foreach ( $ freeShippingForMethods as $ moduleId ) { if ( $ moduleId <= 0 ) { continue ; } $ couponModule = new CouponModule ( ) ; $ couponModule -> setCouponId ( $ this -> getId ( ) ) -> setModuleId ( $ moduleId ) -> save ( ) ; } $ con -> commit ( ) ; } catch ( \ Exception $ ex ) { $ con -> rollback ( ) ; throw $ ex ; } } | Create or Update this Coupon |
15,346 | public function createOrUpdateConditions ( $ serializableConditions , $ locale ) { $ this -> setSerializedConditions ( $ serializableConditions ) ; if ( ! \ is_null ( $ locale ) ) { $ this -> setLocale ( $ locale ) ; } $ this -> save ( ) ; } | Create or Update this coupon condition |
15,347 | public function setAmount ( $ amount ) { $ effects = $ this -> unserializeEffects ( $ this -> getSerializedEffects ( ) ) ; $ effects [ 'amount' ] = \ floatval ( $ amount ) ; $ this -> setEffects ( $ effects ) ; return $ this ; } | Set Coupon amount |
15,348 | public function getUsagesLeft ( $ customerId = null ) { $ usageLeft = $ this -> getMaxUsage ( ) ; if ( $ this -> getPerCustomerUsageCount ( ) ) { if ( null !== $ couponCustomerCount = CouponCustomerCountQuery :: create ( ) -> filterByCouponId ( $ this -> getId ( ) ) -> filterByCustomerId ( $ customerId ) -> findOne ( ) ) { $ usageLeft -= $ couponCustomerCount -> getCount ( ) ; } } return $ usageLeft ; } | Get coupon usage left either overall or per customer . |
15,349 | public function processImage ( $ fileBeingUploaded , $ parentId , $ parentType , $ objectType , $ validMimeTypes = array ( ) , $ extBlackList = array ( ) ) { @ trigger_error ( 'The ' . __METHOD__ . ' method is deprecated since version 2.3 and will be removed in 2.6. Please use the process method File present in the same class.' , E_USER_DEPRECATED ) ; return $ this -> processFile ( $ fileBeingUploaded , $ parentId , $ parentType , $ objectType , $ validMimeTypes , $ extBlackList ) ; } | Process file uploaded |
15,350 | public function saveImageAjaxAction ( $ parentId , $ parentType ) { $ config = FileConfiguration :: getImageConfig ( ) ; return $ this -> saveFileAjaxAction ( $ parentId , $ parentType , $ config [ 'objectType' ] , $ config [ 'validMimeTypes' ] , $ config [ 'extBlackList' ] ) ; } | Manage how a image collection has to be saved |
15,351 | public function saveDocumentAjaxAction ( $ parentId , $ parentType ) { $ config = FileConfiguration :: getDocumentConfig ( ) ; return $ this -> saveFileAjaxAction ( $ parentId , $ parentType , $ config [ 'objectType' ] , $ config [ 'validMimeTypes' ] , $ config [ 'extBlackList' ] ) ; } | Manage how a document collection has to be saved |
15,352 | public function viewImageAction ( $ imageId , $ parentType ) { if ( null !== $ response = $ this -> checkAuth ( $ this -> getAdminResources ( ) -> getResource ( $ parentType , static :: MODULE_RIGHT ) , array ( ) , AccessManager :: UPDATE ) ) { return $ response ; } $ fileManager = $ this -> getFileManager ( ) ; $ imageModel = $ fileManager -> getModelInstance ( 'image' , $ parentType ) ; $ image = $ imageModel -> getQueryInstance ( ) -> findPk ( $ imageId ) ; $ redirectUrl = $ image -> getRedirectionUrl ( ) ; return $ this -> render ( 'image-edit' , array ( 'imageId' => $ imageId , 'imageType' => $ parentType , 'redirectUrl' => $ redirectUrl , 'formId' => $ imageModel -> getUpdateFormId ( ) , 'breadcrumb' => $ image -> getBreadcrumb ( $ this -> getRouter ( $ this -> getCurrentRouter ( ) ) , $ this -> container , 'images' , $ this -> getCurrentEditionLocale ( ) ) ) ) ; } | Manage how an image is viewed |
15,353 | public function viewDocumentAction ( $ documentId , $ parentType ) { if ( null !== $ response = $ this -> checkAuth ( $ this -> getAdminResources ( ) -> getResource ( $ parentType , static :: MODULE_RIGHT ) , array ( ) , AccessManager :: UPDATE ) ) { return $ response ; } $ fileManager = $ this -> getFileManager ( ) ; $ documentModel = $ fileManager -> getModelInstance ( 'document' , $ parentType ) ; $ document = $ documentModel -> getQueryInstance ( ) -> findPk ( $ documentId ) ; $ redirectUrl = $ document -> getRedirectionUrl ( ) ; return $ this -> render ( 'document-edit' , array ( 'documentId' => $ documentId , 'documentType' => $ parentType , 'redirectUrl' => $ redirectUrl , 'formId' => $ documentModel -> getUpdateFormId ( ) , 'breadcrumb' => $ document -> getBreadcrumb ( $ this -> getRouter ( $ this -> getCurrentRouter ( ) ) , $ this -> container , 'documents' , $ this -> getCurrentEditionLocale ( ) ) ) ) ; } | Manage how an document is viewed |
15,354 | public function updateImageAction ( $ imageId , $ parentType ) { if ( null !== $ response = $ this -> checkAuth ( $ this -> getAdminResources ( ) -> getResource ( $ parentType , static :: MODULE_RIGHT ) , array ( ) , AccessManager :: UPDATE ) ) { return $ response ; } $ imageInstance = $ this -> updateFileAction ( $ imageId , $ parentType , 'image' , TheliaEvents :: IMAGE_UPDATE ) ; if ( $ imageInstance instanceof \ Symfony \ Component \ HttpFoundation \ Response ) { return $ imageInstance ; } else { return $ this -> render ( 'image-edit' , array ( 'imageId' => $ imageId , 'imageType' => $ parentType , 'redirectUrl' => $ imageInstance -> getRedirectionUrl ( ) , 'formId' => $ imageInstance -> getUpdateFormId ( ) ) ) ; } } | Manage how an image is updated |
15,355 | public function updateDocumentAction ( $ documentId , $ parentType ) { if ( null !== $ response = $ this -> checkAuth ( $ this -> getAdminResources ( ) -> getResource ( $ parentType , static :: MODULE_RIGHT ) , array ( ) , AccessManager :: UPDATE ) ) { return $ response ; } $ documentInstance = $ this -> updateFileAction ( $ documentId , $ parentType , 'document' , TheliaEvents :: DOCUMENT_UPDATE ) ; if ( $ documentInstance instanceof \ Symfony \ Component \ HttpFoundation \ Response ) { return $ documentInstance ; } else { return $ this -> render ( 'document-edit' , array ( 'documentId' => $ documentId , 'documentType' => $ parentType , 'redirectUrl' => $ documentInstance -> getRedirectionUrl ( ) , 'formId' => $ documentInstance -> getUpdateFormId ( ) ) ) ; } } | Manage how an document is updated |
15,356 | public function deleteFileAction ( $ fileId , $ parentType , $ objectType , $ eventName ) { $ message = null ; $ this -> checkAuth ( $ this -> getAdminResources ( ) -> getResource ( $ parentType , static :: MODULE_RIGHT ) , array ( ) , AccessManager :: UPDATE ) ; $ this -> checkXmlHttpRequest ( ) ; $ fileManager = $ this -> getFileManager ( ) ; $ modelInstance = $ fileManager -> getModelInstance ( $ objectType , $ parentType ) ; $ model = $ modelInstance -> getQueryInstance ( ) -> findPk ( $ fileId ) ; if ( $ model == null ) { return $ this -> pageNotFound ( ) ; } $ fileDeleteEvent = new FileDeleteEvent ( $ model ) ; try { $ this -> dispatch ( $ eventName , $ fileDeleteEvent ) ; $ this -> adminLogAppend ( $ this -> getAdminResources ( ) -> getResource ( $ parentType , static :: MODULE_RIGHT ) , AccessManager :: UPDATE , $ this -> getTranslator ( ) -> trans ( 'Deleting %obj% for %id% with parent id %parentId%' , array ( '%obj%' => $ objectType , '%id%' => $ fileDeleteEvent -> getFileToDelete ( ) -> getId ( ) , '%parentId%' => $ fileDeleteEvent -> getFileToDelete ( ) -> getParentId ( ) , ) ) , $ fileDeleteEvent -> getFileToDelete ( ) -> getId ( ) ) ; } catch ( \ Exception $ e ) { $ message = $ this -> getTranslator ( ) -> trans ( 'Fail to delete %obj% for %id% with parent id %parentId% (Exception : %e%)' , array ( '%obj%' => $ objectType , '%id%' => $ fileDeleteEvent -> getFileToDelete ( ) -> getId ( ) , '%parentId%' => $ fileDeleteEvent -> getFileToDelete ( ) -> getParentId ( ) , '%e%' => $ e -> getMessage ( ) ) ) ; $ this -> adminLogAppend ( $ this -> getAdminResources ( ) -> getResource ( $ parentType , static :: MODULE_RIGHT ) , AccessManager :: UPDATE , $ message , $ fileDeleteEvent -> getFileToDelete ( ) -> getId ( ) ) ; } if ( null === $ message ) { $ message = $ this -> getTranslator ( ) -> trans ( '%obj%s deleted successfully' , [ '%obj%' => ucfirst ( $ objectType ) ] , 'image' ) ; } return new Response ( $ message ) ; } | Manage how a file has to be deleted |
15,357 | public function formatMessage ( $ string ) { $ string = str_replace ( '&' , '&' , $ string ) ; $ string = str_replace ( '<' , '<' , $ string ) ; $ string = str_replace ( '>' , '>' , $ string ) ; return $ string ; } | Formats a string for Slack . |
15,358 | public function create ( ConfigCreateEvent $ event , $ eventName , EventDispatcherInterface $ dispatcher ) { $ config = new ConfigModel ( ) ; $ config -> setDispatcher ( $ dispatcher ) -> setName ( $ event -> getEventName ( ) ) -> setValue ( $ event -> getValue ( ) ) -> setLocale ( $ event -> getLocale ( ) ) -> setTitle ( $ event -> getTitle ( ) ) -> setHidden ( $ event -> getHidden ( ) ) -> setSecured ( $ event -> getSecured ( ) ) -> save ( ) ; $ event -> setConfig ( $ config ) ; } | Create a new configuration entry |
15,359 | public function setValue ( ConfigUpdateEvent $ event , $ eventName , EventDispatcherInterface $ dispatcher ) { if ( null !== $ config = ConfigQuery :: create ( ) -> findPk ( $ event -> getConfigId ( ) ) ) { if ( $ event -> getValue ( ) !== $ config -> getValue ( ) ) { $ config -> setDispatcher ( $ dispatcher ) -> setValue ( $ event -> getValue ( ) ) -> save ( ) ; $ event -> setConfig ( $ config ) ; } } } | Change a configuration entry value |
15,360 | public function modify ( ConfigUpdateEvent $ event , $ eventName , EventDispatcherInterface $ dispatcher ) { if ( null !== $ config = ConfigQuery :: create ( ) -> findPk ( $ event -> getConfigId ( ) ) ) { $ config -> setDispatcher ( $ dispatcher ) -> setName ( $ event -> getEventName ( ) ) -> setValue ( $ event -> getValue ( ) ) -> setHidden ( $ event -> getHidden ( ) ) -> setSecured ( $ event -> getSecured ( ) ) -> setLocale ( $ event -> getLocale ( ) ) -> setTitle ( $ event -> getTitle ( ) ) -> setDescription ( $ event -> getDescription ( ) ) -> setChapo ( $ event -> getChapo ( ) ) -> setPostscriptum ( $ event -> getPostscriptum ( ) ) -> save ( ) ; $ event -> setConfig ( $ config ) ; } } | Change a configuration entry |
15,361 | public function delete ( ConfigDeleteEvent $ event , $ eventName , EventDispatcherInterface $ dispatcher ) { if ( null !== ( $ config = ConfigQuery :: create ( ) -> findPk ( $ event -> getConfigId ( ) ) ) ) { if ( ! $ config -> getSecured ( ) ) { $ config -> setDispatcher ( $ dispatcher ) -> delete ( ) ; $ event -> setConfig ( $ config ) ; } } } | Delete a configuration entry |
15,362 | protected function addStandardDescFields ( $ exclude = array ( ) ) { if ( ! \ in_array ( 'locale' , $ exclude ) ) { $ this -> formBuilder -> add ( 'locale' , 'hidden' , [ 'constraints' => [ new NotBlank ( ) ] , 'required' => true , ] ) ; } if ( ! \ in_array ( 'title' , $ exclude ) ) { $ this -> formBuilder -> add ( 'title' , 'text' , [ 'constraints' => [ new NotBlank ( ) ] , 'required' => true , 'label' => Translator :: getInstance ( ) -> trans ( 'Title' ) , 'label_attr' => [ 'for' => 'title_field' , ] , 'attr' => [ 'placeholder' => Translator :: getInstance ( ) -> trans ( 'A descriptive title' ) , ] ] ) ; } if ( ! \ in_array ( 'chapo' , $ exclude ) ) { $ this -> formBuilder -> add ( 'chapo' , 'textarea' , [ 'constraints' => [ ] , 'required' => false , 'label' => Translator :: getInstance ( ) -> trans ( 'Summary' ) , 'label_attr' => [ 'for' => 'summary_field' , 'help' => Translator :: getInstance ( ) -> trans ( 'A short description, used when a summary or an introduction is required' ) , ] , 'attr' => [ 'rows' => 3 , 'placeholder' => Translator :: getInstance ( ) -> trans ( 'Short description text' ) , ] ] ) ; } if ( ! \ in_array ( 'description' , $ exclude ) ) { $ this -> formBuilder -> add ( 'description' , 'textarea' , [ 'constraints' => [ ] , 'required' => false , 'label' => Translator :: getInstance ( ) -> trans ( 'Detailed description' ) , 'label_attr' => [ 'for' => 'detailed_description_field' , 'help' => Translator :: getInstance ( ) -> trans ( 'The detailed description.' ) , ] , 'attr' => [ 'rows' => 10 , ] ] ) ; } if ( ! \ in_array ( 'postscriptum' , $ exclude ) ) { $ this -> formBuilder -> add ( 'postscriptum' , 'textarea' , [ 'constraints' => [ ] , 'required' => false , 'label' => Translator :: getInstance ( ) -> trans ( 'Conclusion' ) , 'label_attr' => [ 'for' => 'conclusion_field' , 'help' => Translator :: getInstance ( ) -> trans ( 'A short text, used when an additional or supplemental information is required.' ) , ] , 'attr' => [ 'placeholder' => Translator :: getInstance ( ) -> trans ( 'Short additional text' ) , 'rows' => 3 , ] ] ) ; } } | Add standard description fields + locale tot the form |
15,363 | public function setDataNodeName ( $ dataNodeName ) { $ this -> dataNodeName = $ dataNodeName ; $ this -> xmlEncoder -> setRootNodeName ( $ this -> dataNodeName ) ; return $ this ; } | Set data node name |
15,364 | public function registerPreviousUrl ( PostResponseEvent $ event ) { $ request = $ event -> getRequest ( ) ; if ( ! $ request -> isXmlHttpRequest ( ) && $ event -> getResponse ( ) -> isSuccessful ( ) ) { $ referrer = $ request -> attributes -> get ( '_previous_url' , null ) ; $ catalogViews = [ 'category' , 'product' ] ; $ view = $ request -> attributes -> get ( '_view' , null ) ; if ( null !== $ referrer ) { if ( 'dont-save' == $ referrer ) { $ referrer = null ; } } else { $ referrer = $ request -> getUri ( ) ; } if ( null !== $ referrer ) { $ session = $ request -> getSession ( ) ; if ( ConfigQuery :: isMultiDomainActivated ( ) ) { $ components = parse_url ( $ referrer ) ; $ lang = LangQuery :: create ( ) -> filterByUrl ( sprintf ( "%s://%s" , $ components [ "scheme" ] , $ components [ "host" ] ) , ModelCriteria :: LIKE ) -> findOne ( ) ; if ( null !== $ lang ) { $ session -> setReturnToUrl ( $ referrer ) ; if ( \ in_array ( $ view , $ catalogViews ) ) { $ session -> setReturnToCatalogLastUrl ( $ referrer ) ; } } } else { if ( false !== strpos ( $ referrer , $ request -> getSchemeAndHttpHost ( ) ) ) { $ session -> setReturnToUrl ( $ referrer ) ; if ( \ in_array ( $ view , $ catalogViews ) ) { $ session -> setReturnToCatalogLastUrl ( $ referrer ) ; } } } } } } | Save the previous URL in session which is based on the referer header or the request or the _previous_url request attribute if defined . |
15,365 | public function make ( array $ config ) { Arr :: requires ( $ config , [ 'endpoint' ] ) ; $ client = new Client ( ) ; return new WebhookGateway ( $ client , $ config ) ; } | Create a new webhook gateway instance . |
15,366 | public static function create ( $ boolean = TRUE ) { $ is_upper = FormatterFactory :: getDefaultFormatter ( ) -> getConfig ( 'boolean_null_upper' ) ; $ node = new TrueNode ( ) ; $ node -> addChild ( NameNode :: create ( $ is_upper ? 'TRUE' : 'true' ) , 'constantName' ) ; return $ node ; } | Create a new TrueNode . |
15,367 | public static function create ( $ name = 'null' ) { $ is_upper = FormatterFactory :: getDefaultFormatter ( ) -> getConfig ( 'boolean_null_upper' ) ; $ node = new NullNode ( ) ; $ node -> addChild ( NameNode :: create ( $ is_upper ? 'NULL' : 'null' ) , 'constantName' ) ; return $ node ; } | Create a new NullNode . |
15,368 | public function getPostage ( DeliveryPostageEvent $ event , $ eventName , EventDispatcherInterface $ dispatcher ) { $ module = $ event -> getModule ( ) ; $ dispatcher -> dispatch ( TheliaEvents :: getModuleEvent ( TheliaEvents :: MODULE_DELIVERY_GET_POSTAGE , $ module -> getCode ( ) ) , $ event ) ; if ( $ event -> isPropagationStopped ( ) ) { return ; } $ event -> setValidModule ( $ module -> isValidDelivery ( $ event -> getCountry ( ) ) ) ; if ( $ event -> isValidModule ( ) ) { $ event -> setPostage ( $ module -> getPostage ( $ event -> getCountry ( ) ) ) ; } } | Get postage from module using the classical module functions |
15,369 | public function addBreadcrumbLink ( string $ name , string $ link = null , array $ arguments = [ ] ) : Link { return $ this [ 'breadcrumb' ] -> addLink ( $ name , $ link , $ arguments ) ; } | Prida link do drobeckove navigace |
15,370 | public function viewMobileMenu ( bool $ view = true ) : void { $ this -> template -> shifted = $ view ; $ this [ 'dockbar' ] -> setShifted ( $ view ) ; } | Nastavi zobrazeni menu v mobilni verzi |
15,371 | public function addCountry ( ) { if ( null !== $ response = $ this -> checkAuth ( $ this -> resourceCode , array ( ) , AccessManager :: UPDATE ) ) { return $ response ; } $ areaCountryForm = $ this -> createForm ( AdminForm :: AREA_COUNTRY ) ; $ error_msg = null ; try { $ form = $ this -> validateForm ( $ areaCountryForm ) ; $ event = new AreaAddCountryEvent ( $ form -> get ( 'area_id' ) -> getData ( ) , $ form -> get ( 'country_id' ) -> getData ( ) ) ; $ this -> dispatch ( TheliaEvents :: AREA_ADD_COUNTRY , $ event ) ; if ( ! $ this -> eventContainsObject ( $ event ) ) { throw new \ LogicException ( $ this -> getTranslator ( ) -> trans ( "No %obj was updated." , array ( '%obj' , $ this -> objectName ) ) ) ; } if ( null !== $ changedObject = $ this -> getObjectFromEvent ( $ event ) ) { $ this -> adminLogAppend ( $ this -> resourceCode , AccessManager :: UPDATE , sprintf ( "%s %s (ID %s) modified, new country added" , ucfirst ( $ this -> objectName ) , $ this -> getObjectLabel ( $ changedObject ) , $ this -> getObjectId ( $ changedObject ) ) , $ this -> getObjectId ( $ changedObject ) ) ; } return $ this -> generateSuccessRedirect ( $ areaCountryForm ) ; } catch ( FormValidationException $ ex ) { $ error_msg = $ this -> createStandardFormValidationErrorMessage ( $ ex ) ; } catch ( \ Exception $ ex ) { $ error_msg = $ ex -> getMessage ( ) ; } $ this -> setupFormErrorContext ( $ this -> getTranslator ( ) -> trans ( "%obj modification" , array ( '%obj' => $ this -> objectName ) ) , $ error_msg , $ areaCountryForm ) ; return $ this -> renderEditionTemplate ( ) ; } | add a country to a define area |
15,372 | public function removeCountries ( ) { if ( null !== $ response = $ this -> checkAuth ( $ this -> resourceCode , array ( ) , AccessManager :: UPDATE ) ) { return $ response ; } $ areaDeleteCountriesForm = $ this -> createForm ( AdminForm :: AREA_DELETE_COUNTRY ) ; try { $ form = $ this -> validateForm ( $ areaDeleteCountriesForm ) ; $ data = $ form -> getData ( ) ; foreach ( $ data [ 'country_id' ] as $ countryId ) { $ country = explode ( '-' , $ countryId ) ; $ this -> removeOneCountryFromArea ( $ data [ 'area_id' ] , $ country [ 0 ] , $ country [ 1 ] ) ; } return $ this -> generateSuccessRedirect ( $ areaDeleteCountriesForm ) ; } catch ( FormValidationException $ ex ) { $ error_msg = $ this -> createStandardFormValidationErrorMessage ( $ ex ) ; } catch ( \ Exception $ ex ) { $ error_msg = $ ex -> getMessage ( ) ; } $ this -> setupFormErrorContext ( $ this -> getTranslator ( ) -> trans ( "Failed to delete selected countries" ) , $ error_msg , $ areaDeleteCountriesForm ) ; return $ this -> renderEditionTemplate ( ) ; } | delete several countries from a shipping zone |
15,373 | protected function getStamp ( $ directory ) { $ stamp = '' ; $ iterator = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ directory , \ RecursiveDirectoryIterator :: SKIP_DOTS ) , \ RecursiveIteratorIterator :: LEAVES_ONLY ) ; foreach ( $ iterator as $ file ) { $ stamp .= $ file -> getMTime ( ) ; } return md5 ( $ stamp ) ; } | Create a stamp form the modification time of the content of the given directory and all of its subdirectories |
15,374 | protected function copyAssets ( Filesystem $ fs , $ from_directory , $ to_directory ) { Tlog :: getInstance ( ) -> addDebug ( "Copying assets from $from_directory to $to_directory" ) ; $ iterator = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ from_directory , \ RecursiveDirectoryIterator :: SKIP_DOTS ) , \ RecursiveIteratorIterator :: SELF_FIRST ) ; $ fs -> mkdir ( $ to_directory , 0777 ) ; foreach ( $ iterator as $ item ) { if ( $ item -> isDir ( ) ) { $ dest_dir = $ to_directory . DS . $ iterator -> getSubPathName ( ) ; if ( ! is_dir ( $ dest_dir ) ) { if ( $ fs -> exists ( $ dest_dir ) ) { $ fs -> remove ( $ dest_dir ) ; } $ fs -> mkdir ( $ dest_dir , 0777 ) ; } } elseif ( ! $ this -> isSourceFile ( $ item ) ) { $ dest_file = $ to_directory . DS . $ iterator -> getSubPathName ( ) ; if ( $ fs -> exists ( $ dest_file ) ) { $ fs -> remove ( $ dest_file ) ; } $ fs -> copy ( $ item , $ dest_file ) ; } } } | Recursively copy assets from the source directory to the destination directory in the web space omitting source files . |
15,375 | public function prepareAssets ( $ sourceAssetsDirectory , $ webAssetsDirectoryBase , $ webAssetsTemplate , $ webAssetsKey ) { $ to_directory = $ this -> getDestinationDirectory ( $ webAssetsDirectoryBase , $ webAssetsTemplate , $ webAssetsKey ) ; $ stamp_file_path = $ to_directory . DS . '.source-stamp' ; $ prev_stamp = @ file_get_contents ( $ stamp_file_path ) ; $ curr_stamp = $ this -> getStamp ( $ sourceAssetsDirectory ) ; if ( $ prev_stamp !== $ curr_stamp ) { $ fs = new Filesystem ( ) ; $ tmp_dir = "$to_directory.tmp" ; $ fs -> remove ( $ tmp_dir ) ; $ this -> copyAssets ( $ fs , $ sourceAssetsDirectory , $ tmp_dir ) ; if ( $ fs -> exists ( $ to_directory ) ) { $ fs -> remove ( $ to_directory ) ; } $ fs -> rename ( $ tmp_dir , $ to_directory ) ; if ( false === @ file_put_contents ( $ stamp_file_path , $ curr_stamp ) ) { throw new \ RuntimeException ( "Failed to create asset stamp file $stamp_file_path. Please check that your web server has the proper access rights to do that." ) ; } } } | Prepare an asset directory by checking that no changes occured in the source directory . If any change is detected the whole asset directory is copied in the web space . |
15,376 | protected function decodeAsseticFilters ( FilterManager $ filterManager , $ filters ) { if ( ! empty ( $ filters ) ) { $ filter_list = \ is_array ( $ filters ) ? $ filters : explode ( ',' , $ filters ) ; foreach ( $ filter_list as $ filter_name ) { $ filter_name = trim ( $ filter_name ) ; foreach ( $ this -> assetFilters as $ filterIdentifier => $ filterInstance ) { if ( $ filterIdentifier == $ filter_name ) { $ filterManager -> set ( $ filterIdentifier , $ filterInstance ) ; goto filterFound ; } } throw new \ InvalidArgumentException ( "Unsupported Assetic filter: '$filter_name'" ) ; break ; filterFound : } } else { $ filter_list = array ( ) ; } return $ filter_list ; } | Decode the filters names and initialize the Assetic FilterManager |
15,377 | public function toggleActivity ( ) { if ( null !== $ response = $ this -> checkAuth ( AdminResources :: SALES , [ ] , AccessManager :: UPDATE ) ) { return $ response ; } try { $ this -> dispatch ( TheliaEvents :: SALE_TOGGLE_ACTIVITY , new SaleToggleActivityEvent ( $ this -> getExistingObject ( ) ) ) ; } catch ( \ Exception $ ex ) { return $ this -> errorPage ( $ ex ) ; } return $ this -> nullResponse ( ) ; } | Toggle activity status of the sale . |
15,378 | public function render ( string $ template , array $ data = [ ] ) : string { $ data = array_merge ( $ this -> data , $ data ) ; return $ this -> getRenderer ( ) -> make ( $ template , $ data ) -> render ( ) ; } | Render and return compiled data . |
15,379 | protected function getRelatedCartItem ( $ product ) { $ cartItemIdList = $ this -> facade -> getRequest ( ) -> getSession ( ) -> get ( $ this -> getSessionVarName ( ) , array ( ) ) ; if ( isset ( $ cartItemIdList [ $ product -> getId ( ) ] ) ) { $ cartItemId = $ cartItemIdList [ $ product -> getId ( ) ] ; if ( $ cartItemId == self :: ADD_TO_CART_IN_PROCESS ) { return self :: ADD_TO_CART_IN_PROCESS ; } elseif ( null !== $ cartItem = CartItemQuery :: create ( ) -> findPk ( $ cartItemId ) ) { return $ cartItem ; } } else { $ cartItems = $ this -> facade -> getCart ( ) -> getCartItems ( ) ; foreach ( $ cartItems as $ cartItem ) { if ( $ cartItem -> getProduct ( ) -> getId ( ) == $ this -> offeredProductId ) { $ this -> setRelatedCartItem ( $ product , $ cartItem -> getId ( ) ) ; return $ cartItem ; } } } return false ; } | Return the cart item id which contains the free product related to a given product |
15,380 | protected function setRelatedCartItem ( $ product , $ cartItemId ) { $ cartItemIdList = $ this -> facade -> getRequest ( ) -> getSession ( ) -> get ( $ this -> getSessionVarName ( ) , array ( ) ) ; if ( ! \ is_array ( $ cartItemIdList ) ) { $ cartItemIdList = array ( ) ; } $ cartItemIdList [ $ product -> getId ( ) ] = $ cartItemId ; $ this -> facade -> getRequest ( ) -> getSession ( ) -> set ( $ this -> getSessionVarName ( ) , $ cartItemIdList ) ; } | Set the cart item id which contains the free product related to a given product |
15,381 | public static function create ( $ comment ) { $ block_comment = new LineCommentBlockNode ( ) ; $ comment = trim ( $ comment ) ; $ lines = array_map ( 'rtrim' , explode ( "\n" , $ comment ) ) ; foreach ( $ lines as $ line ) { $ comment_node = new CommentNode ( T_COMMENT , '// ' . $ line . "\n" ) ; $ block_comment -> addChild ( $ comment_node ) ; } return $ block_comment ; } | Create line comment block . |
15,382 | public function addIndent ( $ whitespace ) { $ has_indent = $ this -> children ( function ( Node $ node ) { return ! ( $ node instanceof CommentNode ) ; } ) -> count ( ) > 0 ; if ( $ has_indent ) { $ this -> children ( Filter :: isInstanceOf ( '\Pharborist\WhitespaceNode' ) ) -> each ( function ( WhitespaceNode $ ws_node ) use ( $ whitespace ) { $ ws_node -> setText ( $ ws_node -> getText ( ) . $ whitespace ) ; } ) ; } else { $ this -> children ( ) -> before ( Token :: whitespace ( $ whitespace ) ) ; } return $ this ; } | Add indent to comment . |
15,383 | public function setAttribute ( $ name , $ value = null ) { if ( is_array ( $ name ) ) { foreach ( $ name as $ k => $ v ) { $ this -> attributes [ $ k ] = $ v ; } } else { $ this -> attributes [ $ name ] = $ value ; } } | Set an event attribute . |
15,384 | public function formatStandardNumber ( $ number , $ decimals = null ) { $ lang = $ this -> request -> getSession ( ) -> getLang ( ) ; if ( $ decimals === null ) { $ decimals = $ lang -> getDecimals ( ) ; } return number_format ( $ number , $ decimals , '.' , '' ) ; } | Get a standard number with . as decimal point and no thousands separator so that this number can be used to perform calculations . |
15,385 | public static function getFiltered ( $ pattern = '' ) { if ( ! function_exists ( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php' ; } $ plugins = get_plugins ( ) ; if ( empty ( $ pattern ) ) { return $ plugins ; } $ filtered = array ( ) ; foreach ( $ plugins as $ slug => $ data ) { if ( preg_match ( '#' . $ pattern . '#' , $ slug ) ) { $ filtered [ $ slug ] = $ data ; } } return $ filtered ; } | Get plugin data filtered by plugin slug pattern . |
15,386 | public static function isBoldgridPlugin ( $ plugin ) { if ( empty ( $ plugin ) ) { return false ; } $ pluginChecker = new \ Boldgrid \ Library \ Library \ Plugin \ Checker ( ) ; $ plugins = \ Boldgrid \ Library \ Library \ Util \ Plugin :: getFiltered ( $ pluginChecker -> getPluginPattern ( ) ) ; return array_key_exists ( $ plugin , $ plugins ) ; } | Determine if a plugin is a BoldGrid plugin . |
15,387 | public function getTranslationsList ( ) { $ data = "" ; $ melisCmsAuth = $ this -> getServiceLocator ( ) -> get ( 'MelisCoreAuth' ) ; $ melisCmsRights = $ this -> getServiceLocator ( ) -> get ( 'MelisCoreRights' ) ; return $ data ; } | get translations return array |
15,388 | public function getDataTableTranslationsAction ( ) { $ container = new Container ( 'meliscms' ) ; $ locale = $ container [ 'melis-lang-locale' ] ; $ translator = $ this -> getServiceLocator ( ) -> get ( 'translator' ) ; $ transData = array ( 'sEmptyTable' => $ translator -> translate ( 'tr_meliscms_dt_sEmptyTable' ) , 'sInfo' => $ translator -> translate ( 'tr_meliscms_dt_sInfo' ) , 'sInfoEmpty' => $ translator -> translate ( 'tr_meliscms_dt_sInfoEmpty' ) , 'sInfoFiltered' => $ translator -> translate ( 'tr_meliscms_dt_sInfoFiltered' ) , 'sInfoPostFix' => $ translator -> translate ( 'tr_meliscms_dt_sInfoPostFix' ) , 'sInfoThousands' => $ translator -> translate ( 'tr_meliscms_dt_sInfoThousands' ) , 'sLengthMenu' => $ translator -> translate ( 'tr_meliscms_dt_sLengthMenu' ) , 'sLoadingRecords' => $ translator -> translate ( 'tr_meliscms_dt_sLoadingRecords' ) , 'sProcessing' => $ translator -> translate ( 'tr_meliscms_dt_sProcessing' ) , 'sSearch' => $ translator -> translate ( 'tr_meliscms_dt_sSearch' ) , 'sZeroRecords' => $ translator -> translate ( 'tr_meliscms_dt_sZeroRecords' ) , 'oPaginate' => array ( 'sFirst' => $ translator -> translate ( 'tr_meliscms_dt_sFirst' ) , 'sLast' => $ translator -> translate ( 'tr_meliscms_dt_sLast' ) , 'sNext' => $ translator -> translate ( 'tr_meliscms_dt_sNext' ) , 'sPrevious' => $ translator -> translate ( 'tr_meliscms_dt_sPrevious' ) , ) , 'oAria' => array ( 'sSortAscending' => $ translator -> translate ( 'tr_meliscms_dt_sSortAscending' ) , 'sSortDescending' => $ translator -> translate ( 'tr_meliscms_dt_sSortDescending' ) , ) , ) ; return new JsonModel ( $ transData ) ; } | Creates translations for table actions in tools |
15,389 | protected function getArrayFromJson22Compat ( $ obj ) { $ obj = $ this -> getArrayFromJson ( $ obj ) ; if ( isset ( $ obj [ 0 ] ) && ! \ is_array ( $ obj [ 0 ] ) ) { $ objEx = [ ] ; foreach ( $ obj as $ item ) { $ objEx [ ] = [ $ item , 0 ] ; } return $ objEx ; } return $ obj ; } | This method ensures compatibility with the 2 . 2 . x country arrays passed throught the TaxRuleEvent |
15,390 | private function handleAction ( Request $ request , & $ data ) { if ( $ this -> isAction ( $ request , "searchByKeyword" ) ) { $ preparedKeywords = htmlspecialchars ( $ data [ "keywords" ] ) ; $ data [ "listings" ] = $ this -> listingController ( $ data ) -> setSortBy ( $ data [ "sortBy" ] ) -> setReverseSort ( $ data [ "reverseSort" ] ) -> searchByKeyword ( $ preparedKeywords ) ; } else if ( $ this -> isAction ( $ request , "search" ) ) { $ data [ "listings" ] = $ this -> listingController ( $ data ) -> setSortBy ( $ data [ "sortBy" ] ) -> setReverseSort ( $ data [ "reverseSort" ] ) -> search ( $ data [ "keywords" ] , $ data [ "extra" ] , $ data [ "maxPrice" ] , $ data [ "minPrice" ] , $ data [ "beds" ] , $ data [ "baths" ] , $ data [ "includeResidential" ] , $ data [ "includeLand" ] , $ data [ "includeCommercial" ] ) ; } else if ( $ this -> isAction ( $ request , "getListingsByDMQL" ) ) { $ results = GetRETS :: getRETSListing ( ) -> setSortBy ( $ data [ "sortBy" ] ) -> setReverseSort ( $ data [ "reverseSort" ] ) -> getListingsByDMQL ( $ data [ "dmql" ] , ExampleController :: EXAMPLE_SOURCE , "Residential" ) ; if ( ! empty ( $ results ) ) { if ( $ results -> success && ! empty ( $ results -> data ) ) { $ data [ "listings" ] = $ results -> data ; } } } else if ( $ this -> isAction ( $ request , "executeDMQL" ) ) { $ data [ "rawData" ] = GetRETS :: getRETSListing ( ) -> executeDMQL ( $ data [ "dmql" ] , ExampleController :: EXAMPLE_SOURCE , "Residential" ) ; } } | Handles requested action from a form post |
15,391 | private function getPageData ( Request $ request ) { $ publicDMQL = '(L_UpdateDate=' . date ( 'Y-m-d' , ( strtotime ( '-1 day' , time ( ) ) ) ) . '-' . date ( 'Y-m-d' ) . ')' ; $ data = [ "isPublic" => ExampleController :: IS_PUBLIC , "disableCache" => ! empty ( $ request -> disableCache ) , "keywords" => $ request -> keywords ? : ExampleController :: EXAMPLE_ADDRESS , "extra" => $ request -> extra , "maxPrice" => $ request -> maxPrice , "minPrice" => $ request -> minPrice , "beds" => $ request -> beds , "baths" => $ request -> baths , "includeResidential" => $ request -> includeResidential , "includeLand" => $ request -> includeLand , "includeCommercial" => $ request -> includeCommercial , "sortBy" => $ request -> sortBy ? : "rawListPrice" , "reverseSort" => ! empty ( $ request -> reverseSort ) , "dmql" => ( ! empty ( $ request -> dmql ) && ! $ data [ "isPublic" ] ) ? $ request -> dmql : $ publicDMQL , "listings" => null , "detail" => null , "rawData" => null , "allInput" => $ request -> all ( ) , ] ; if ( $ request -> isMethod ( 'POST' ) ) { $ this -> handleAction ( $ request , $ data ) ; } if ( $ request -> has ( "source" ) && $ request -> has ( "type" ) && $ request -> has ( "id" ) ) { $ data [ "detail" ] = $ this -> listingController ( $ data ) -> details ( $ request -> source , $ request -> type , $ request -> id ) ; } return $ data ; } | Returns an array of data to be used in the view |
15,392 | public function countSaleElements ( $ con = null ) { return ProductSaleElementsQuery :: create ( ) -> filterByProductId ( $ this -> id ) -> count ( $ con ) ; } | Return PSE count fir this product . |
15,393 | public function setDefaultCategory ( $ defaultCategoryId ) { if ( $ defaultCategoryId <= 0 ) { $ defaultCategoryId = null ; } $ productCategory = ProductCategoryQuery :: create ( ) -> filterByProductId ( $ this -> getId ( ) ) -> filterByDefaultCategory ( true ) -> findOne ( ) ; if ( $ productCategory !== null && ( int ) $ productCategory -> getCategoryId ( ) === ( int ) $ defaultCategoryId ) { return $ this ; } if ( $ productCategory !== null ) { $ productCategory -> delete ( ) ; } if ( null !== $ productCategory = ProductCategoryQuery :: create ( ) -> filterByProduct ( $ this ) -> filterByCategoryId ( $ defaultCategoryId ) -> findOne ( ) ) { $ productCategory -> setDefaultCategory ( true ) -> save ( ) ; } else { $ position = ( new ProductCategory ( ) ) -> setCategoryId ( $ defaultCategoryId ) -> getNextPosition ( ) ; ( new ProductCategory ( ) ) -> setProduct ( $ this ) -> setCategoryId ( $ defaultCategoryId ) -> setDefaultCategory ( true ) -> setPosition ( $ position ) -> save ( ) ; $ this -> setPosition ( $ position ) ; } return $ this ; } | Set default category for this product |
15,394 | public function create ( $ defaultCategoryId , $ basePrice , $ priceCurrencyId , $ taxRuleId , $ baseWeight , $ baseQuantity = 0 ) { $ con = Propel :: getWriteConnection ( ProductTableMap :: DATABASE_NAME ) ; $ con -> beginTransaction ( ) ; $ this -> dispatchEvent ( TheliaEvents :: BEFORE_CREATEPRODUCT , new ProductEvent ( $ this ) ) ; try { $ this -> save ( $ con ) ; $ this -> setDefaultCategory ( $ defaultCategoryId ) -> save ( $ con ) ; $ this -> setTaxRuleId ( $ taxRuleId ) ; $ this -> createProductSaleElement ( $ con , $ baseWeight , $ basePrice , $ basePrice , $ priceCurrencyId , true , false , false , $ baseQuantity ) ; $ con -> commit ( ) ; $ this -> dispatchEvent ( TheliaEvents :: AFTER_CREATEPRODUCT , new ProductEvent ( $ this ) ) ; } catch ( \ Exception $ ex ) { $ con -> rollback ( ) ; throw $ ex ; } } | Create a new product along with the default category ID |
15,395 | public function createProductSaleElement ( ConnectionInterface $ con , $ weight , $ basePrice , $ salePrice , $ currencyId , $ isDefault , $ isPromo = false , $ isNew = false , $ quantity = 0 , $ eanCode = '' , $ ref = false ) { $ saleElements = new ProductSaleElements ( ) ; $ saleElements -> setProduct ( $ this ) -> setRef ( $ ref == false ? $ this -> getRef ( ) : $ ref ) -> setPromo ( $ isPromo ) -> setNewness ( $ isNew ) -> setWeight ( $ weight ) -> setIsDefault ( $ isDefault ) -> setEanCode ( $ eanCode ) -> setQuantity ( $ quantity ) -> save ( $ con ) ; $ productPrice = new ProductPrice ( ) ; $ productPrice -> setProductSaleElements ( $ saleElements ) -> setPromoPrice ( $ salePrice ) -> setPrice ( $ basePrice ) -> setCurrencyId ( $ currencyId ) -> setFromDefaultCurrency ( false ) -> save ( $ con ) ; return $ saleElements ; } | Create a basic product sale element attached to this product . |
15,396 | protected function addCriteriaToPositionQuery ( $ query ) { $ products = ProductCategoryQuery :: create ( ) -> filterByCategoryId ( $ this -> getDefaultCategoryId ( ) ) -> filterByDefaultCategory ( true ) -> select ( 'product_id' ) -> find ( ) ; if ( $ products != null ) { $ query -> filterById ( $ products , Criteria :: IN ) ; } } | Calculate next position relative to our default category |
15,397 | public function getPageContent ( $ pageId ) { $ melisEngineCacheSystem = $ this -> getServiceLocator ( ) -> get ( 'MelisEngineCacheSystem' ) ; $ pageContent = $ melisEngineCacheSystem -> getCacheByKey ( $ this -> cachekey . $ pageId , $ this -> cacheConfig , true ) ; return $ pageContent ; } | This method will retieve Page content from cache file |
15,398 | public function setHash ( $ key = null ) { $ key = $ key ? $ this -> sanitizeKey ( $ key ) : $ this -> getKey ( ) ; return $ this -> hash = $ this -> hashKey ( $ key ) ; } | Sets the hash class property . |
15,399 | public function sanitizeKey ( $ key ) { $ key = trim ( strtolower ( preg_replace ( '/-/' , '' , $ key ) ) ) ; $ key = implode ( '-' , str_split ( $ key , 8 ) ) ; return sanitize_key ( $ key ) ; } | Sanitizes the key input for loose validation of format . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.