idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
15,200
public function modify ( MessageUpdateEvent $ event , $ eventName , EventDispatcherInterface $ dispatcher ) { if ( null !== $ message = MessageQuery :: create ( ) -> findPk ( $ event -> getMessageId ( ) ) ) { $ message -> setDispatcher ( $ dispatcher ) -> setName ( $ event -> getMessageName ( ) ) -> setSecured ( $ even...
Change a message
15,201
public function delete ( MessageDeleteEvent $ event , $ eventName , EventDispatcherInterface $ dispatcher ) { if ( null !== ( $ message = MessageQuery :: create ( ) -> findPk ( $ event -> getMessageId ( ) ) ) ) { $ message -> setDispatcher ( $ dispatcher ) -> delete ( ) ; $ event -> setMessage ( $ message ) ; } }
Delete a messageuration entry
15,202
public function getValidators ( ) { $ this -> validators = $ this -> generateInputs ( ) ; $ translatedInputs = [ ] ; foreach ( $ this -> validators as $ key => $ validator ) { $ translatedOperators = [ ] ; foreach ( $ validator [ 'availableOperators' ] as $ availableOperators ) { $ translatedOperators [ $ availableOper...
Return all validators
15,203
public function getSerializableCondition ( ) { $ serializableCondition = new SerializableCondition ( ) ; $ serializableCondition -> conditionServiceId = $ this -> getServiceId ( ) ; $ serializableCondition -> operators = $ this -> operators ; $ serializableCondition -> values = $ this -> values ; return $ serializableC...
Return a serializable Condition
15,204
protected function isCurrencyValid ( $ currencyValue ) { $ availableCurrencies = $ this -> facade -> getAvailableCurrencies ( ) ; $ currencyFound = false ; foreach ( $ availableCurrencies as $ currency ) { if ( $ currencyValue == $ currency -> getCode ( ) ) { $ currencyFound = true ; } } if ( ! $ currencyFound ) { thro...
Check if currency if valid or not
15,205
protected function isPriceValid ( $ priceValue ) { $ floatType = new FloatType ( ) ; if ( ! $ floatType -> isValid ( $ priceValue ) || $ priceValue <= 0 ) { throw new InvalidConditionValueException ( \ get_class ( ) , 'price' ) ; } return true ; }
Check if price is valid
15,206
protected function drawBackOfficeInputOperators ( $ inputKey ) { $ html = '' ; $ inputs = $ this -> getValidators ( ) ; if ( isset ( $ inputs [ 'inputs' ] [ $ inputKey ] ) ) { $ html = $ this -> facade -> getParser ( ) -> render ( 'coupon/condition-fragments/condition-selector.html' , [ 'operators' => $ inputs [ 'input...
Draw the operator input displayed in the BackOffice allowing Admin to set its Coupon Conditions
15,207
protected function drawBackOfficeBaseInputsText ( $ label , $ inputKey ) { $ operatorSelectHtml = $ this -> drawBackOfficeInputOperators ( $ inputKey ) ; $ currentValue = '' ; if ( isset ( $ this -> values ) && isset ( $ this -> values [ $ inputKey ] ) ) { $ currentValue = $ this -> values [ $ inputKey ] ; } return $ t...
Draw the base input displayed in the BackOffice allowing Admin to set its Coupon Conditions
15,208
protected function drawBackOfficeInputQuantityValues ( $ inputKey , $ max = 10 , $ min = 0 ) { return $ this -> facade -> getParser ( ) -> render ( 'coupon/condition-fragments/quantity-selector.html' , [ 'min' => $ min , 'max' => $ max , 'value' => isset ( $ this -> values [ $ inputKey ] ) ? $ this -> values [ $ inputK...
Draw the quantity input displayed in the BackOffice allowing Admin to set its Coupon Conditions
15,209
protected function drawBackOfficeCurrencyInput ( $ inputKey ) { $ currencies = CurrencyQuery :: create ( ) -> find ( ) ; $ cleanedCurrencies = [ ] ; foreach ( $ currencies as $ currency ) { $ cleanedCurrencies [ $ currency -> getCode ( ) ] = $ currency -> getSymbol ( ) ; } return $ this -> facade -> getParser ( ) -> re...
Draw the currency input displayed in the BackOffice allowing Admin to set its Coupon Conditions
15,210
private function setClass ( $ name , $ args ) { $ class = __NAMESPACE__ . '\\Notice\\' . ucfirst ( $ name ) ; return $ this -> class = class_exists ( $ class ) ? new $ class ( $ args ) : Filter :: add ( $ this ) ; }
Sets the class class property .
15,211
public static function show ( $ message , $ id , $ class = "notice notice-warning" ) { $ nonce = wp_nonce_field ( 'boldgrid_set_key' , 'set_key_auth' , true , false ) ; if ( self :: isDismissed ( $ id ) ) { return ; } printf ( '<div class="%1$s boldgrid-notice is-dismissible" data-notice-id="%2$s">%3$s%4$s</div>' , $ c...
Show an admin notice .
15,212
public function add ( $ name = null ) { $ name = $ name ? $ name : $ this -> getName ( ) ; $ path = __DIR__ ; $ name = ucfirst ( $ name ) ; include "{$path}/Views/{$name}.php" ; }
Displays the license notice in the WordPress admin .
15,213
public function dismiss ( ) { if ( isset ( $ _POST [ 'set_key_auth' ] ) && check_ajax_referer ( 'boldgrid_set_key' , 'set_key_auth' , false ) ) { $ id = sanitize_key ( $ _POST [ 'notice' ] ) ; $ dismissal = array ( 'id' => $ id , 'timestamp' => time ( ) , ) ; if ( ! Notice :: isDismissed ( $ id ) ) { add_user_meta ( ge...
Handle dismissal of the key prompt notice .
15,214
public function undismiss ( ) { if ( isset ( $ _POST [ 'set_key_auth' ] ) && ! empty ( $ _POST [ 'notice' ] ) && check_ajax_referer ( 'boldgrid_set_key' , 'set_key_auth' , false ) ) { $ id = sanitize_key ( $ _POST [ 'notice' ] ) ; $ dismissals = get_user_meta ( get_current_user_id ( ) , 'boldgrid_dismissed_admin_notice...
Handle undismissal of the key prompt notice .
15,215
public static function isDismissed ( $ id ) { $ dismissed = false ; $ id = sanitize_key ( $ id ) ; $ dismissals = get_user_meta ( get_current_user_id ( ) , 'boldgrid_dismissed_admin_notices' ) ; foreach ( $ dismissals as $ dismissal ) { if ( $ id === $ dismissal [ 'id' ] ) { $ dismissed = true ; break ; } } return $ di...
Is there a user dismissal record for a particular admin notice id?
15,216
public function exec ( ) { if ( version_compare ( phpversion ( ) , '5.5' , '<' ) ) { $ this -> validationMessages [ 'php_version' ] [ 'text' ] = $ this -> getI18nPhpVersionText ( '5.5' , phpversion ( ) , false ) ; $ this -> validationMessages [ 'php_version' ] [ 'status' ] = false ; $ this -> validationMessages [ 'php_...
Perform file permission check
15,217
protected function getI18nDirectoryText ( $ directory , $ isValid ) { if ( $ this -> translator !== null ) { if ( $ isValid ) { $ sentence = 'The directory %directory% is writable' ; } else { $ sentence = 'The directory %directory% is not writable' ; } $ translatedText = $ this -> translator -> trans ( $ sentence , arr...
Get Translated text about the directory state
15,218
protected function getI18nConfigText ( $ key , $ expectedValue , $ currentValue , $ isValid ) { if ( $ isValid ) { $ sentence = 'The PHP "%key%" configuration value (currently %currentValue%) is correct (%expectedValue% required).' ; } else { $ sentence = 'The PHP "%key%" configuration value (currently %currentValue%) ...
Get Translated text about the directory state Not usable with CLI
15,219
protected function getI18nPhpVersionText ( $ expectedValue , $ currentValue , $ isValid ) { if ( $ this -> translator !== null ) { if ( $ isValid ) { $ sentence = 'PHP version %currentValue% matches the minimum required (PHP %expectedValue%).' ; } else { $ sentence = 'The installer detected PHP version %currentValue%, ...
Get Translated hint about the PHP version requirement issue
15,220
protected function verifyServerMemoryValues ( $ key , $ necessaryValueInBytes ) { $ serverValueInBytes = $ this -> returnBytes ( ini_get ( $ key ) ) ; if ( $ serverValueInBytes == - 1 ) { return true ; } return ( $ serverValueInBytes >= $ necessaryValueInBytes ) ; }
Check if a server memory value is met or not
15,221
protected function returnBytes ( $ val ) { $ val = trim ( $ val ) ; $ last = strtolower ( $ val [ strlen ( $ val ) - 1 ] ) ; switch ( $ last ) { case 'g' : $ val = ( int ) $ val * 1024 ; case 'm' : $ val = ( int ) $ val * 1024 ; case 'k' : $ val = ( int ) $ val * 1024 ; } return $ val ; }
Return bytes from memory . ini value
15,222
public function isActionButtonActive ( $ actionwanted ) { $ active = 0 ; $ pathArrayConfig = '' ; switch ( $ actionwanted ) { case 'save' : $ pathArrayConfig = 'meliscms_page_action_save' ; break ; case 'delete' : $ pathArrayConfig = 'meliscms_page_action_delete' ; break ; case 'publish' : $ pathArrayConfig = 'meliscms...
This function returns whether or not a user has access to the save delete publish unpublish action buttons in the interface . Allowing to expand the rights to php saving functions and updating treeview right menu
15,223
protected function trackMeter ( $ meterId , $ buckets , $ rates ) { $ trackKey = sprintf ( 'track:%s' , $ buckets [ 0 ] ) ; $ this -> redis -> hset ( $ trackKey , $ meterId , $ rates [ 0 ] ) ; $ expireAt = $ buckets [ 0 ] + ( $ this -> config [ 'bucket_size' ] * $ this -> config [ 'num_buckets' ] ) ; $ this -> redis ->...
This method allows you to change how the meter is tracked So if you d like to use a sorted set rather than a hash go on ahead!
15,224
public static function afterTax ( $ amount , Taxable $ taxable ) { return static :: beforeTax ( $ taxable -> getAmountWithoutTax ( static :: asMoney ( $ amount ) ) , $ taxable ) ; }
Make object with Tax .
15,225
public function getAmountWithTax ( ) : string { if ( ! $ this -> hasTax ( ) ) { return $ this -> getMoney ( ) -> getAmount ( ) ; } return $ this -> getTax ( ) -> getAmountWithTax ( $ this -> getMoney ( ) ) ; }
Returns the value represented by this object with Tax .
15,226
public function allocateWithTax ( array $ ratios ) : array { $ method = $ this -> hasTax ( ) ? 'afterTax' : 'withoutTax' ; $ results = [ ] ; $ allocates = static :: asMoney ( $ this -> getAmountWithTax ( ) ) -> allocate ( $ ratios ) ; foreach ( $ allocates as $ allocate ) { $ results [ ] = static :: { $ method } ( $ al...
Allocate the money according to a list of ratios with Tax .
15,227
public function allocateWithTaxTo ( int $ n ) : array { $ method = $ this -> hasTax ( ) ? 'afterTax' : 'withoutTax' ; $ results = [ ] ; $ allocates = static :: asMoney ( $ this -> getAmountWithTax ( ) ) -> allocateTo ( $ n ) ; foreach ( $ allocates as $ allocate ) { $ results [ ] = static :: { $ method } ( $ allocate -...
Allocate the money among N targets with GST .
15,228
public static function getDefaultLanguage ( ) { if ( null === self :: $ defaultLanguage ) { self :: $ defaultLanguage = LangQuery :: create ( ) -> findOneByByDefault ( 1 ) ; if ( null === self :: $ defaultLanguage ) { throw new \ RuntimeException ( "No default language is defined. Please define one." ) ; } } return sel...
Return the default language object using a local variable to cache it .
15,229
private function convertValuesToIds ( $ varValue ) : array { $ aliasColumn = $ this -> getAliasColumn ( ) ; $ alias = [ ] ; foreach ( $ varValue as $ valueId => $ value ) { if ( array_key_exists ( $ aliasColumn , $ value ) ) { $ alias [ $ valueId ] = $ value [ $ aliasColumn ] ; continue ; } if ( array_key_exists ( self...
Convert the passed values to a value id list .
15,230
protected function calculateFilterOptionsCount ( $ items , & $ amountArray , $ idList ) { $ builder = $ this -> getConnection ( ) -> createQueryBuilder ( ) -> select ( 'value_id' ) -> addSelect ( 'COUNT(item_id) AS amount' ) -> from ( 'tl_metamodel_tag_relation' ) -> where ( 'att_id=:attId' ) -> setParameter ( 'attId' ...
Calculate the amount how often each value has been assigned .
15,231
public function getNextPosition ( ) { $ query = $ this -> createQuery ( ) -> orderByPosition ( Criteria :: DESC ) -> limit ( 1 ) ; $ this -> addCriteriaToPositionQuery ( $ query ) ; $ last = $ query -> findOne ( ) ; return $ last != null ? $ last -> getPosition ( ) + 1 : 1 ; }
Get the position of the next inserted object
15,232
protected function movePositionUpOrDown ( $ up = true ) { $ myPosition = $ this -> getPosition ( ) ; $ search = $ this -> createQuery ( ) ; $ this -> addCriteriaToPositionQuery ( $ search ) ; if ( $ up === true ) { $ search -> filterByPosition ( array ( 'max' => $ myPosition - 1 ) ) -> orderByPosition ( Criteria :: DES...
Move up or down a object
15,233
public function changeAbsolutePosition ( $ newPosition ) { $ current_position = $ this -> getPosition ( ) ; if ( $ newPosition != null && $ newPosition > 0 && $ newPosition != $ current_position ) { $ search = $ this -> createQuery ( ) ; $ this -> addCriteriaToPositionQuery ( $ search ) ; if ( $ newPosition > $ current...
Changes object position
15,234
public function findForActiveModules ( ) { $ fs = new Filesystem ( ) ; $ codes = $ this -> queryActiveModuleCodes ( ) ; foreach ( $ codes as $ key => $ code ) { if ( ! $ fs -> exists ( THELIA_MODULE_DIR . $ code ) ) { unset ( $ codes [ $ key ] ) ; } } $ codes = array_values ( $ codes ) ; return $ this -> findForModules...
Get schema documents for Thelia core and active modules as well as included external schemas .
15,235
protected function addModulesDependencies ( array $ modules = [ ] ) { if ( empty ( $ modules ) ) { return [ ] ; } if ( ! \ in_array ( 'Thelia' , $ modules ) ) { $ modules [ ] = 'Thelia' ; } foreach ( $ modules as $ module ) { if ( $ module === 'Thelia' ) { continue ; } $ moduleValidator = new ModuleValidator ( "{$this-...
Add dependencies of some modules .
15,236
protected function addExternalSchemaDocuments ( array $ schemaDocuments ) { $ fs = new Filesystem ( ) ; $ externalSchemaDocuments = [ ] ; foreach ( $ schemaDocuments as $ schemaDocument ) { foreach ( $ schemaDocument -> getElementsByTagName ( 'external-schema' ) as $ externalSchemaElement ) { if ( ! $ externalSchemaEle...
Add external schema documents not already included .
15,237
public function reconnect ( $ name = null ) { $ name = $ name ? : $ this -> default ; $ this -> disconnect ( $ name ) ; return $ this -> connection ( $ name ) ; }
Reconnect to the given connection .
15,238
public function adminLogAppend ( $ resource , $ action , $ message , $ resourceId = null ) { AdminLog :: append ( $ resource , $ action , $ message , $ this -> getRequest ( ) , $ this -> getSecurityContext ( ) -> getAdminUser ( ) , true , $ resourceId ) ; }
Helper to append a message to the admin log .
15,239
public function processTemplateAction ( $ template ) { try { if ( ! empty ( $ template ) ) { return $ this -> render ( $ template ) ; } elseif ( null != $ view = $ this -> getRequest ( ) -> get ( 'view' ) ) { return $ this -> render ( $ view ) ; } } catch ( \ Exception $ ex ) { return $ this -> errorPage ( $ ex -> getM...
This method process the rendering of view called from an admin page
15,240
protected function errorPage ( $ message , $ status = 500 ) { if ( $ message instanceof \ Exception ) { $ strMessage = $ this -> getTranslator ( ) -> trans ( "Sorry, an error occured: %msg" , [ '%msg' => $ message -> getMessage ( ) ] ) ; Tlog :: getInstance ( ) -> addError ( $ strMessage . ": " . $ message -> getTraceA...
Return a general error page
15,241
protected function checkAuth ( $ resources , $ modules , $ accesses ) { $ resources = \ is_array ( $ resources ) ? $ resources : array ( $ resources ) ; $ modules = \ is_array ( $ modules ) ? $ modules : array ( $ modules ) ; $ accesses = \ is_array ( $ accesses ) ? $ accesses : array ( $ accesses ) ; if ( $ this -> ge...
Check current admin user authorisations . An ADMIN role is assumed .
15,242
protected function setupFormErrorContext ( $ action , $ error_message , BaseForm $ form = null , \ Exception $ exception = null ) { if ( $ error_message !== false ) { Tlog :: getInstance ( ) -> error ( $ this -> getTranslator ( ) -> trans ( "Error during %action process : %error. Exception was %exc" , array ( '%action'...
Setup the error context when an error occurs in a action method .
15,243
protected function getCurrentEditionCurrency ( ) { if ( null !== $ edit_currency_id = $ this -> getRequest ( ) -> get ( 'edit_currency_id' , null ) ) { if ( null !== $ edit_currency = CurrencyQuery :: create ( ) -> findOneById ( $ edit_currency_id ) ) { return $ edit_currency ; } } return $ this -> getSession ( ) -> ge...
Get the current edition currency ID checking if a change was requested in the current request .
15,244
protected function getCurrentEditionLang ( ) { if ( null !== $ edit_language_id = $ this -> getRequest ( ) -> get ( 'edit_language_id' , null ) ) { if ( null !== $ edit_language = LangQuery :: create ( ) -> findOneById ( $ edit_language_id ) ) { return $ edit_language ; } } return $ this -> getSession ( ) -> getAdminEd...
Get the current edition lang ID checking if a change was requested in the current request .
15,245
protected function getUrlLanguage ( $ locale = null ) { if ( ! ConfigQuery :: isMultiDomainActivated ( ) ) { return null ; } if ( ! $ locale ) { $ locale = $ this -> getCurrentEditionLocale ( ) ; } return LangQuery :: create ( ) -> findOneByLocale ( $ locale ) -> getUrl ( ) ; }
A simple helper to get the URL based on the language .
15,246
protected function getListOrderFromSession ( $ objectName , $ requestParameterName , $ defaultListOrder , $ updateSession = true ) { $ orderSessionIdentifier = sprintf ( "admin.%s.currentListOrder" , $ objectName ) ; $ order = $ this -> getRequest ( ) -> get ( $ requestParameterName , $ this -> getSession ( ) -> get ( ...
Return the current list order identifier for a given object name updating in using the current request .
15,247
public function appendParameter ( $ parameter ) { if ( is_callable ( $ parameter ) ) { $ parameter = $ parameter ( $ this ) ; } if ( ! ( $ parameter instanceof ParameterNode ) ) { throw new \ InvalidArgumentException ( ) ; } $ this -> parameters -> appendItem ( $ parameter ) ; return $ this ; }
Appends a parameter .
15,248
public function insertParameter ( ParameterNode $ parameter , $ index ) { $ this -> parameters -> insertItem ( $ parameter , $ index ) ; return $ this ; }
Insert parameter before parameter at index .
15,249
public function getParameter ( $ key ) { if ( is_string ( $ key ) ) { return $ this -> getParameterByName ( $ key ) ; } elseif ( is_integer ( $ key ) ) { return $ this -> getParameterAtIndex ( $ key ) ; } else { throw new \ InvalidArgumentException ( "Illegal parameter index {$key}." ) ; } }
Gets a parameter by name or index .
15,250
public function getParameterByName ( $ name ) { $ name = ltrim ( $ name , '$' ) ; foreach ( $ this -> getParameters ( ) -> reverse ( ) as $ parameter ) { if ( $ parameter -> getName ( ) === $ name ) { return $ parameter ; } } throw new \ UnexpectedValueException ( "Parameter {$name} does not exist." ) ; }
Gets a parameter by its name .
15,251
public function getBaseUrl ( $ scheme_only = false ) { if ( null === $ this -> baseUrlScheme ) { $ scheme = "http" ; $ port = 80 ; if ( $ host = $ this -> requestContext -> getHost ( ) ) { $ scheme = $ this -> requestContext -> getScheme ( ) ; $ port = '' ; if ( 'http' === $ scheme && 80 != $ this -> requestContext -> ...
Return the base URL either the base_url defined in Config or the URL of the current language if one_domain_foreach_lang is enabled .
15,252
public function adminViewUrl ( $ viewName , array $ parameters = array ( ) ) { $ path = sprintf ( "%s/admin/%s" , $ this -> getIndexPage ( ) , $ viewName ) ; return $ this -> absoluteUrl ( $ path , $ parameters ) ; }
Returns the Absolute URL to a administration view
15,253
public function viewUrl ( $ viewName , array $ parameters = array ( ) ) { $ path = sprintf ( "?view=%s" , $ viewName ) ; return $ this -> absoluteUrl ( $ path , $ parameters ) ; }
Returns the Absolute URL to a view
15,254
public function retrieve ( $ view , $ viewId , $ viewLocale ) { if ( ConfigQuery :: isRewritingEnable ( ) ) { $ this -> retriever -> loadViewUrl ( $ view , $ viewLocale , $ viewId ) ; } else { $ allParametersWithoutView = array ( ) ; $ allParametersWithoutView [ 'lang' ] = $ viewLocale ; if ( null !== $ viewId ) { $ al...
Retrieve a rewritten URL from a view a view id and a locale
15,255
public function retrieveCurrent ( Request $ request ) { if ( ConfigQuery :: isRewritingEnable ( ) ) { $ view = $ request -> attributes -> get ( '_view' , null ) ; $ viewLocale = $ this -> getViewLocale ( $ request ) ; $ viewId = $ view === null ? null : $ request -> query -> get ( $ view . '_id' , null ) ; $ allOtherPa...
Retrieve a rewritten URL from the current GET parameters
15,256
private function getViewLocale ( Request $ request ) { $ viewLocale = $ request -> query -> get ( 'lang' , null ) ; if ( null === $ viewLocale ) { $ viewLocale = $ request -> query -> get ( 'locale' , null ) ; } return $ viewLocale ; }
Get the locale code from the lang attribute in URL .
15,257
public static function loadFromPostage ( $ postage ) { if ( $ postage instanceof OrderPostage ) { $ orderPostage = $ postage ; } else { $ orderPostage = new OrderPostage ( $ postage ) ; } return $ orderPostage ; }
Convert a amount or OrderPostage object to an OrderPostage object
15,258
public function processDocument ( DocumentEvent $ event ) { $ subdir = $ event -> getCacheSubdirectory ( ) ; $ sourceFile = $ event -> getSourceFilepath ( ) ; if ( null == $ subdir || null == $ sourceFile ) { throw new \ InvalidArgumentException ( "Cache sub-directory and source file path cannot be null" ) ; } $ origin...
Process document and write the result in the document cache .
15,259
public function create ( CategoryCreateEvent $ event , $ eventName , EventDispatcherInterface $ dispatcher ) { $ category = new CategoryModel ( ) ; $ category -> setDispatcher ( $ dispatcher ) -> setLocale ( $ event -> getLocale ( ) ) -> setParent ( $ event -> getParent ( ) ) -> setVisible ( $ event -> getVisible ( ) )...
Create a new category entry
15,260
public function update ( CategoryUpdateEvent $ event , $ eventName , EventDispatcherInterface $ dispatcher ) { if ( null !== $ category = CategoryQuery :: create ( ) -> findPk ( $ event -> getCategoryId ( ) ) ) { $ category -> setDispatcher ( $ dispatcher ) -> setDefaultTemplateId ( $ event -> getDefaultTemplateId ( ) ...
Change a category
15,261
public function delete ( CategoryDeleteEvent $ event , $ eventName , EventDispatcherInterface $ dispatcher ) { if ( null !== $ category = CategoryQuery :: create ( ) -> findPk ( $ event -> getCategoryId ( ) ) ) { $ con = Propel :: getWriteConnection ( CategoryTableMap :: DATABASE_NAME ) ; $ con -> beginTransaction ( ) ...
Delete a category entry
15,262
public function toggleVisibility ( CategoryToggleVisibilityEvent $ event , $ eventName , EventDispatcherInterface $ dispatcher ) { $ category = $ event -> getCategory ( ) ; $ category -> setDispatcher ( $ dispatcher ) -> setVisible ( $ category -> getVisible ( ) ? false : true ) -> save ( ) ; $ event -> setCategory ( $...
Toggle category visibility . No form used here
15,263
public function viewCheck ( ViewCheckEvent $ event , $ eventName , EventDispatcherInterface $ dispatcher ) { if ( $ event -> getView ( ) == 'category' ) { $ category = CategoryQuery :: create ( ) -> filterById ( $ event -> getViewId ( ) ) -> filterByVisible ( 1 ) -> count ( ) ; if ( $ category == 0 ) { $ dispatcher -> ...
Check if is a category view and if category_id is visible
15,264
public function renderToolSiteHeaderAction ( ) { $ melisTool = $ this -> getServiceLocator ( ) -> get ( 'MelisCoreTool' ) ; $ melisKey = $ this -> params ( ) -> fromRoute ( 'melisKey' , '' ) ; $ melisTool -> setMelisToolKey ( self :: TOOL_INDEX , self :: TOOL_KEY ) ; $ view = new ViewModel ( ) ; $ view -> title = $ mel...
Renders to the header section of the tool
15,265
public function renderToolSiteModalAddAction ( ) { $ melisTool = $ this -> getServiceLocator ( ) -> get ( 'MelisCoreTool' ) ; $ melisTool -> setMelisToolKey ( self :: TOOL_INDEX , self :: TOOL_KEY ) ; $ view = new ViewModel ( ) ; $ view -> setVariable ( 'meliscms_site_tool_creation_form' , $ melisTool -> getForm ( 'mel...
Displays the add form in the modal
15,266
public function getSiteDomainPlatform ( ) { $ data = array ( ) ; if ( $ this -> getRequest ( ) -> isGet ( ) ) { $ siteDomain = $ this -> getServiceLocator ( ) -> get ( 'SiteDomain' ) ; $ data = $ siteDomain -> getSiteDomain ( ) ; } return $ data ; }
Return site domain
15,267
public function getSiteEnvironmentAction ( ) { $ json = array ( ) ; $ siteId = ( int ) $ this -> params ( ) -> fromQuery ( 'siteId' ) ; $ melisEngineTableSiteDomain = $ this -> getServiceLocator ( ) -> get ( 'MelisEngineTableSiteDomain' ) ; $ sitePlatform = $ melisEngineTableSiteDomain -> getEntryByField ( 'sdom_site_i...
Fetching Current Platform on specific Site
15,268
public function getSiteEnvironmentsAction ( ) { $ json = array ( ) ; $ siteId = ( int ) $ this -> params ( ) -> fromQuery ( 'siteId' ) ; $ domainTable = $ this -> getServiceLocator ( ) -> get ( 'MelisCoreTablePlatform' ) ; $ domainData = $ domainTable -> fetchAll ( ) ; $ domainData = $ domainData -> toArray ( ) ; if ( ...
Fetching all Core Platforms
15,269
public function deleteSiteByIdAction ( ) { $ translator = $ this -> getServiceLocator ( ) -> get ( 'translator' ) ; $ request = $ this -> getRequest ( ) ; $ domainId = null ; $ success = 0 ; $ textTitle = 'tr_meliscms_tool_site' ; $ textMessage = '' ; $ eventDatas = array ( ) ; $ this -> getEventManager ( ) -> trigger ...
Deletes the specific information of an environment
15,270
public function setAlias ( $ alias ) { if ( is_string ( $ alias ) ) { $ alias = new TokenNode ( T_STRING , $ alias ) ; } if ( $ alias instanceof TokenNode ) { if ( $ this -> hasAlias ( ) ) { $ this -> alias -> replaceWith ( $ alias ) ; } else { $ this -> alias = $ alias ; $ this -> addChild ( WhitespaceNode :: create (...
Sets the imported item s alias . If NULL is passed the alias is removed .
15,271
public function getBoundedName ( ) { if ( $ this -> alias ) { return $ this -> alias -> getText ( ) ; } else { return $ this -> name -> lastChild ( ) -> getText ( ) ; } }
Name bounded inside namespace .
15,272
public function orderCartClear ( OrderEvent $ event , $ eventName , EventDispatcherInterface $ dispatcher ) { $ session = $ this -> getSession ( ) ; $ session -> clearSessionCart ( $ dispatcher ) ; $ session -> setOrder ( new OrderModel ( ) ) ; }
Clear the cart and the order in the customer session once the order is placed and the payment performed .
15,273
public function getStockUpdateOnOrderStatusChange ( GetStockUpdateOperationOnOrderStatusChangeEvent $ event , $ eventName , EventDispatcherInterface $ dispatcher ) { $ order = $ event -> getOrder ( ) ; $ newStatus = $ event -> getNewOrderStatus ( ) ; if ( $ newStatus -> getId ( ) !== $ order -> getStatusId ( ) ) { if (...
Check if a stock update is required on order products for a given order status change and compute if the stock should be decreased or increased .
15,274
protected function updateQuantity ( ModelOrder $ order , $ newStatus , EventDispatcherInterface $ dispatcher ) { if ( $ newStatus !== $ order -> getStatusId ( ) ) { if ( null !== $ newStatusModel = OrderStatusQuery :: create ( ) -> findPk ( $ newStatus ) ) { $ operationEvent = new GetStockUpdateOperationOnOrderStatusCh...
Update order products stock after an order status change
15,275
public function admin_notices ( ) { $ afterKeyAdded = get_option ( $ this -> option ) ; if ( empty ( $ afterKeyAdded ) ) { return ; } switch ( $ afterKeyAdded ) { case 'success' : echo '<div class="notice notice-success is-dismissible bglib-key-added"><p>' . esc_html ( 'Your new BoldGrid Connect Key has been successful...
Admin notices .
15,276
public static function getCentralUrl ( ) { $ returnUrl = apply_filters ( 'Boldgrid\Library\Key\returnUrl' , admin_url ( 'options-general.php?page=boldgrid-connect.php' ) ) ; $ returnUrl = add_query_arg ( 'nonce' , wp_create_nonce ( 'bglib-key-prompt' ) , $ returnUrl ) ; return add_query_arg ( array ( 'wp-url' => urlenc...
Get the url to BoldGrid Central for the user to get a new Connect Key .
15,277
public function processPost ( ) { if ( $ this -> isPosting ( ) ) { $ releaseChannel = new ReleaseChannel ; $ key = new Key ( $ releaseChannel ) ; $ hashed_key = md5 ( $ _POST [ 'activateKey' ] ) ; $ success = $ key -> addKey ( $ hashed_key ) ; update_option ( $ this -> option , $ success ? 'success' : 'fail' ) ; header...
Handle the submission of an api key via a post call .
15,278
private function isPosting ( ) { if ( empty ( $ _POST [ 'activateKey' ] ) ) { return false ; } if ( empty ( $ _GET [ 'nonce' ] ) || ! wp_verify_nonce ( $ _GET [ 'nonce' ] , 'bglib-key-prompt' ) ) { return false ; } if ( ! current_user_can ( 'update_plugins' ) ) { return false ; } return true ; }
Determine whether or not we are posting a new Connect Key to the dashboard .
15,279
public function setRestContent ( $ data ) { $ serializer = $ this -> getSerializer ( ) ; if ( isset ( $ data ) ) { $ this -> setContent ( $ serializer -> serialize ( $ data , $ this -> format ) ) ; } return $ this ; }
Set Content to be serialized in the response array or object
15,280
public static function create ( $ name ) { $ parts = explode ( '\\' , $ name ) ; $ name_node = new NameNode ( ) ; foreach ( $ parts as $ i => $ part ) { $ part = trim ( $ part ) ; if ( $ i > 0 ) { $ name_node -> append ( Token :: namespaceSeparator ( ) ) ; } if ( $ part !== '' ) { $ name_node -> append ( Token :: ident...
Create namespace path .
15,281
public function getPathInfo ( ) { $ first = $ this -> firstChild ( ) ; $ absolute = $ first -> getType ( ) === T_NS_SEPARATOR ; $ relative = $ first -> getType ( ) === T_NAMESPACE ; $ parts = $ this -> getParts ( ) ; return [ 'absolute' => $ absolute , 'relative' => $ relative , 'qualified' => ! $ absolute && count ( $...
Return information about the name .
15,282
public function getPath ( ) { $ path = '' ; $ child = $ this -> head ; while ( $ child ) { $ type = $ child -> getType ( ) ; if ( $ type === T_NAMESPACE || $ type === T_NS_SEPARATOR || $ type === T_STRING ) { $ path .= $ child -> getText ( ) ; } $ child = $ child -> next ; } return $ path ; }
Get the namespace path .
15,283
protected function resolveUnqualified ( $ name ) { if ( $ this -> parent instanceof NamespaceNode ) { return '\\' . $ name ; } if ( $ this -> parent instanceof UseDeclarationNode ) { return '\\' . $ name ; } $ namespace = $ this -> getNamespace ( ) ; $ use_declarations = array ( ) ; if ( $ namespace ) { $ use_declarati...
Resolve an unqualified name to fully qualified name .
15,284
public function analyze ( string $ path ) { $ contents = ( string ) file_get_contents ( $ path ) ; $ traverser = new NodeTraverser ( ) ; $ traverser -> addVisitor ( new NameResolver ( ) ) ; $ traverser -> addVisitor ( $ imports = new ImportVisitor ( ) ) ; $ traverser -> addVisitor ( $ names = new NameVisitor ( ) ) ; $ ...
Get the fullyqualified imports and typehints .
15,285
public static function create ( $ comment ) { $ comment = trim ( $ comment ) ; $ nl_count = substr_count ( $ comment , "\n" ) ; if ( $ nl_count > 1 ) { return LineCommentBlockNode :: create ( $ comment ) ; } else { return new CommentNode ( T_COMMENT , '// ' . $ comment . "\n" ) ; } }
Create line comment .
15,286
public function getWebhookForClient ( $ name ) { return Arr :: get ( $ this -> clientsConfig [ $ name ] , 'webhook' ) ? : Arr :: get ( $ this -> clientsDefaults , 'webhook' ) ; }
Get the webhook for the given client .
15,287
public function getMessageDefaultsForClient ( $ name ) { return array_merge ( Arr :: get ( $ this -> clientsDefaults , 'message_defaults' , [ ] ) , Arr :: get ( $ this -> clientsConfig [ $ name ] , 'message_defaults' , [ ] ) ) ; }
Get the message defaults for the given client .
15,288
public function sendRestorePassword ( string $ email , string $ hash ) : void { $ mail = $ this -> createMail ( 'restorePassword' ) ; $ mail -> link = $ this -> link ( 'Cms:Sign:restorePassword' , [ 'hash' => $ hash ] ) ; $ mail -> setSubject ( 'cms.mailing.restorePassword.subject' ) -> addTo ( $ email ) ; $ mail -> se...
Odeslani linku pro zmenu hesla
15,289
public function sendNewUser ( string $ email , string $ username , string $ password ) : void { $ mail = $ this -> createMail ( 'newUser' ) ; $ mail -> link = $ this -> link ( 'Cms:Sign:in' ) ; $ mail -> username = $ username ; $ mail -> password = $ password ; $ mail -> setSubject ( 'cms.mailing.newUser.subject' ) -> ...
Posle email novemu uzivateli s loginem a heslem
15,290
public function toggleVisibility ( StateToggleVisibilityEvent $ event , $ eventName , EventDispatcherInterface $ dispatcher ) { $ state = $ event -> getState ( ) ; $ state -> setDispatcher ( $ dispatcher ) -> setVisible ( ! $ state -> getVisible ( ) ) -> save ( ) ; $ event -> setState ( $ state ) ; }
Toggle State visibility
15,291
public function getLineCount ( ) { $ count = 1 ; $ this -> find ( Filter :: isInstanceOf ( '\Pharborist\WhitespaceNode' ) ) -> each ( function ( WhitespaceNode $ node ) use ( & $ count ) { $ count += $ node -> getNewlineCount ( ) ; } ) ; return $ count ; }
Gets the number of lines spanned by this statement .
15,292
public function addCommentAbove ( $ comment ) { if ( $ comment instanceof LineCommentBlockNode ) { $ this -> before ( $ comment ) ; } elseif ( is_string ( $ comment ) ) { $ this -> addCommentAbove ( LineCommentBlockNode :: create ( $ comment ) ) ; } else { throw new \ InvalidArgumentException ( ) ; } return $ this ; }
Adds a line comment block above the statement .
15,293
public static function create ( $ parameter_name ) { $ parameter_name = '$' . ltrim ( $ parameter_name , '$' ) ; $ parameter_node = new ParameterNode ( ) ; $ parameter_node -> addChild ( new VariableNode ( T_VARIABLE , $ parameter_name ) , 'name' ) ; return $ parameter_node ; }
Create a parameter node .
15,294
public function getDocBlockTag ( ) { $ doc_comment = $ this -> getFunction ( ) -> getDocComment ( ) ; return $ doc_comment ? $ doc_comment -> getParameter ( $ this -> name -> getText ( ) ) : NULL ; }
Get the doc block tag associated with this parameter .
15,295
public function hasDocTypes ( ) { $ doc_comment = $ this -> getFunction ( ) -> getDocComment ( ) ; if ( ! $ doc_comment ) { return FALSE ; } $ param_tag = $ doc_comment -> getParameter ( $ this -> getName ( ) ) ; if ( ! $ param_tag ) { return FALSE ; } $ types = $ param_tag -> getTypes ( ) ; return ! empty ( $ types ) ...
Return TRUE if parameter has a phpDoc type .
15,296
public function getDocTypes ( ) { $ types = [ 'mixed' ] ; $ doc_comment = $ this -> getFunction ( ) -> getDocComment ( ) ; if ( ! $ doc_comment ) { return $ types ; } $ param_tag = $ doc_comment -> getParameter ( $ this -> getName ( ) ) ; if ( ! $ param_tag ) { return $ types ; } $ types = Types :: normalize ( $ param_...
Get the php doc types for parameter .
15,297
public function getTypes ( ) { if ( $ this -> typeHint ) { if ( $ this -> typeHint instanceof TokenNode ) { if ( $ this -> typeHint -> getType ( ) === T_ARRAY ) { $ docTypes = $ this -> getDocTypes ( ) ; foreach ( $ docTypes as $ docType ) { if ( $ docType !== 'array' && substr ( $ docType , - 2 ) !== '[]' ) { return [...
Get the type of the parameter as defined by type hinting or doc comment .
15,298
public function addAdditionalFolderAction ( ) { if ( null !== $ response = $ this -> checkAuth ( $ this -> resourceCode , array ( ) , AccessManager :: UPDATE ) ) { return $ response ; } $ folder_id = \ intval ( $ this -> getRequest ( ) -> request -> get ( 'additional_folder_id' ) ) ; if ( $ folder_id > 0 ) { $ event = ...
controller adding content to additional folder
15,299
public function removeAdditionalFolderAction ( ) { if ( null !== $ response = $ this -> checkAuth ( $ this -> resourceCode , array ( ) , AccessManager :: UPDATE ) ) { return $ response ; } $ folder_id = \ intval ( $ this -> getRequest ( ) -> request -> get ( 'additional_folder_id' ) ) ; if ( $ folder_id > 0 ) { $ event...
controller removing additional folder to a content