Exemple #1
0
 /**
  * Retrive list of files that must be overwritten by request for install upgrades
  *
  * @return array
  */
 protected function getFilesToOverWrite()
 {
     $allFilesPlain = array();
     foreach (\XLite\Upgrade\Cell::getInstance()->getCustomFiles() as $files) {
         $allFilesPlain = array_merge($allFilesPlain, $files);
     }
     return \Includes\Utils\ArrayManager::filterByKeys($allFilesPlain, array_keys((array) \XLite\Core\Request::getInstance()->toRemain), true);
 }
Exemple #2
0
 /**
  * Prepare and save passed data
  *
  * @param array       $data Passed data OPTIONAL
  * @param string|null $name Index in request data array (optional) OPTIONAL
  *
  * @return void
  */
 protected function defineRequestData(array $data = array(), $name = null)
 {
     if (empty($data)) {
         $data = $this->prepareRequestParamsList();
     }
     // FIXME: check if there is the way to avoid this
     $this->formFields = null;
     // TODO: check if there is more convenient way to do this
     $this->requestData = $this->prepareRequestData($data);
     $this->requestData = \Includes\Utils\ArrayManager::filterByKeys($this->requestData, $this->getFormFields(true));
     $this->requestData = $this->prepareRequestDataByFormFields($this->requestData);
 }
Exemple #3
0
 /**
  * Get specific options list for 'from' and for 'to' lists
  *
  * @param boolean $from Flag: is need to get options for 'from' list
  *
  * @return array
  */
 protected function getSpecificOptions($from = true)
 {
     $options = $this->getOptions();
     $values = $this->getValue();
     $keys = is_array($values) ? $values : array($values);
     $result = \Includes\Utils\ArrayManager::filterByKeys($options, $keys, $from);
     return $result;
 }
Exemple #4
0
 /**
  * Returns true if order has allowed backend payment transactions
  *
  * @param \XLite\Model\Order $entity Order
  *
  * @return boolean
  */
 protected function hasPaymentActions(\XLite\Model\Order $entity)
 {
     $result = \Includes\Utils\ArrayManager::filterByKeys($entity->getAllowedPaymentActions(), $this->getTransactionsFilter());
     return !empty($result);
 }
Exemple #5
0
 /**
  * getRequestData
  * TODO: to remove
  *
  * @return array
  */
 protected function getRequestData()
 {
     return \Includes\Utils\ArrayManager::filterByKeys(\XLite\Core\Request::getInstance()->getData(), array('paymentStatus', 'shippingStatus', 'adminNotes'));
 }
Exemple #6
0
 /**
  * Return fields list by the corresponding schema
  *
  * @return array
  */
 protected function getFormFieldsForSectionMain()
 {
     // Get main schema from parent class
     $schema = $this->mainSchema;
     // Exclude fields specified in $mainSchemaRemovedFields
     $schema = \Includes\Utils\ArrayManager::filterByKeys($schema, static::$mainSchemaRemovedFields, true);
     // Lock all fields specified in $mainSchemaReadonlyFields
     array_walk($schema, array($this, 'lockSectionField'), static::$mainSchemaReadonlyFields);
     // Modify the main schema
     $this->mainSchema = $schema;
     return parent::getFormFieldsForSectionMain();
 }
Exemple #7
0
 /**
  * Prepare list childs templates-based
  *
  * @param array $list List
  *
  * @return array
  */
 protected function prepareListChildTemplates(array $list)
 {
     \XLite::getInstance()->initModules();
     $skins = array();
     $hasSubstSkins = false;
     foreach (\XLite\Core\Layout::getInstance()->getSkinsAll() as $interface => $path) {
         $skins[$interface] = \XLite\Core\Layout::getInstance()->getSkins($interface);
         if (!$hasSubstSkins) {
             $hasSubstSkins = 1 < count($skins[$interface]);
         }
     }
     if ($hasSubstSkins) {
         $patterns = $hash = array();
         foreach ($skins as $interface => $data) {
             $patterns[$interface] = array();
             foreach ($data as $skin) {
                 $patterns[$interface][] = preg_quote($skin, '/');
             }
             $patterns[$interface] = '/^(' . implode('|', $patterns[$interface]) . ')' . preg_quote(LC_DS, '/') . '/US';
         }
         foreach ($list as $index => $item) {
             $path = \Includes\Utils\FileManager::getRelativePath($item['path'], LC_DIR_SKINS);
             if (preg_match($patterns[$item['zone']], $path, $matches)) {
                 $hash[$item['zone']][$matches[1]][$item['tpl']][] = $index;
             }
         }
         foreach ($hash as $interface => &$data) {
             $data[static::PREPARED_SKIN_NAME] = array();
             foreach (array_reverse($skins[$interface]) as $skin) {
                 if (!empty($data[$skin])) {
                     foreach ($data[$skin] as $tpl => $indexes) {
                         $data[static::PREPARED_SKIN_NAME][$tpl] = $indexes;
                     }
                 }
             }
         }
         $index = \Includes\Utils\ArrayManager::getArraysArrayFieldValues($hash, static::PREPARED_SKIN_NAME);
         unset($hash);
         $ids = array();
         foreach ($index as $interface => $tpls) {
             foreach ($tpls as $tpl => $indexes) {
                 $ids = array_merge($ids, $indexes);
             }
         }
         unset($index);
         $list = \Includes\Utils\ArrayManager::filterByKeys($list, $ids);
     }
     return $list;
 }