idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 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 !== $ curren... | 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_... | 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 , 'getArgumen... | 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 ) { ret... | 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 :: $ loopDe... | 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 :: cre... | 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 -> dis... | 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 ( $ customEvent... | 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 LoopExtendsB... | 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 -> d... | 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 $ loop... | 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' ,... | 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.' ; }... | 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... | 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 $ i... | 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 = $ no... | 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 -> p... | 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 = $ n... | 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 -> ... | 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 -... | 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 ] = $ chil... | 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... | 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 ... | 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 ... | 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 [ 'm... | 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 ( ) , 'm... | 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 ... | 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 ( ... | 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 ( ) ) ; $ dependenc... | 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 ... | 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 -> variableOpCo... | 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 ( '|' , $ exten... | 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 ;... | 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... | 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 , $ freeShippingForMetho... | 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 ( )... | 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 sam... | 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 ( ) ; $ imag... | 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 ( ) ; ... | 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 ( $ im... | 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 -> updateFileActi... | 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 = $ th... | 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 ( ) ) -> setTitl... | 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 ) -> setVa... | 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 -> getV... | 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 -> set... | 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 ( 'ti... | 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' ] ... | 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 -> isPr... | 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 ( $ areaCountryFo... | 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 ( $ areaDeleteCoun... | 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 ( ) ;... | 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 :: SK... | 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 ... | 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 -> assetFilte... | 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 ( \ Exce... | 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 ( $ cartIt... | 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 ( ) ] = ... | 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 -> add... | 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_no... | 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_ma... | 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_exist... | 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' ) , ... | 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 ... | 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 -> ... | 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 ... | 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 ProductEve... | 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 ) -> s... | 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 ... | 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.