Пример #1
0
 /**
  * Print AJAX request output
  *
  * @param mixed $viewer Viewer to display in AJAX
  *
  * @return void
  */
 protected function printAJAXOutput($viewer)
 {
     $content = $viewer->getContent();
     $class = 'ajax-container-loadable' . ' ctrl-' . implode('-', \XLite\Core\Operator::getInstance()->getClassNameAsKeys(get_called_class())) . ' widget-' . implode('-', \XLite\Core\Operator::getInstance()->getClassNameAsKeys($viewer));
     echo '<div' . ' class="' . $class . '"' . ' title="' . func_htmlspecialchars(static::t($this->getTitle())) . '">' . $content . '</div>';
 }
Пример #2
0
 /**
  * Prepare back trace
  *
  * @param array $trace Back trace raw data
  *
  * @return array
  */
 protected function prepareBackTrace(array $trace)
 {
     return \XLite\Core\Operator::getInstance()->prepareBackTrace($trace);
 }
Пример #3
0
 /**
  * Generate unique parcel number and set it to current parcel
  * 
  * @return void
  */
 public function autoGenerateNumber()
 {
     $number = \XLite\Core\Operator::getInstance()->generateToken(static::PARCEL_NUMBER_LENGTH, static::$chars);
     $this->setNumber($number);
 }
Пример #4
0
 /**
  * Run test
  *
  * @return void
  * @access protected
  * @see    ____func_see____
  * @since  1.0.0
  */
 protected function runTest()
 {
     try {
         $shortName = lcfirst(substr($this->getName(), 4));
         if (self::$testsRange && !in_array($shortName, self::$testsRange)) {
             $this->markTestSkipped();
         } elseif ($this->temporarySkipped) {
             $this->markTestSkipped('Temporary skipped - fix test ASAP!');
         } else {
             parent::runTest();
         }
     } catch (\Exception $exception) {
         if (isset($this->drivers[0]) && $this->drivers[0]->getSessionId()) {
             try {
                 $location = preg_replace('/[^\\w]/Ss', '-', $this->getLocation());
                 $location = preg_replace('/-+/Ss', '-', $location);
                 $html = $this->getHtmlSource();
                 $trace = array();
                 if (!defined('DEPLOYMENT_TEST')) {
                     $trace = \XLite\Core\Operator::getInstance()->getBackTrace();
                 }
                 file_put_contents(TESTS_LOG_DIR . 'selenium.' . $location . '.' . date('Ymd-His') . '.html', '<!--' . PHP_EOL . 'Exception: ' . $exception->getMessage() . ';' . PHP_EOL . ($trace ? 'Back trace: ' . var_export($trace, true) . PHP_EOL : '') . '-->' . PHP_EOL . $html);
             } catch (\RuntimeException $e) {
             }
         }
         $backtrace = array();
         foreach ($exception->getTrace() as $t) {
             $b = null;
             if (isset($t['file'])) {
                 $b = $t['file'] . ' : ' . $t['line'];
             } elseif (isset($t['function'])) {
                 $b = 'function ' . $t['function'] . '()';
                 if (isset($t['line'])) {
                     $b .= ' : ' . $t['line'];
                 }
             }
             if ($b) {
                 $backtrace[] = $b;
             }
         }
         file_put_contents(TESTS_LOG_DIR . 'selenium.' . date('Ymd-His') . '.backtrace', 'Exception: ' . $exception->getMessage() . ';' . PHP_EOL . PHP_EOL . 'Backtrace: ' . PHP_EOL . implode(PHP_EOL, $backtrace) . PHP_EOL);
         throw $exception;
     }
 }
Пример #5
0
 /**
  * Get view class name as keys list
  *
  * @return array
  */
 protected function getViewClassKeys()
 {
     return \XLite\Core\Operator::getInstance()->getClassNameAsKeys(get_called_class());
 }
Пример #6
0
 /**
  * Renew transaction ID
  *
  * @return void
  */
 public function renewTransactionId()
 {
     if (!$this->getPublicTxnId()) {
         $this->setPublicTxnId(\XLite\Core\Operator::getInstance()->generateToken(static::PUBLIC_TOKEN_LENGTH, static::$chars));
     }
     $this->setPublicId($this->getPaymentMethod()->getProcessor()->generateTransactionId($this));
 }
Пример #7
0
 /**
  * Generate password
  *
  * @return string
  */
 public function generatePassword()
 {
     return \XLite\Core\Operator::getInstance()->generateToken(static::PASSWORD_LENGTH, $this->chars);
 }
Пример #8
0
 /**
  * Set disabled tables list
  *
  * @param string $module     Module unique name
  * @param array  $structures Disabled structures OPTIONAL
  *
  * @return void
  */
 public function setDisabledStructures($module, array $structures = array())
 {
     if (!\Includes\Utils\ModulesManager::moveModuleToDisabledRegistry($module)) {
         $path = $this->getDisabledStructuresPath();
         $data = array();
         if (file_exists($path)) {
             $data = \XLite\Core\Operator::getInstance()->loadServiceYAML($path);
         }
         if (!$structures || !$structures['tables'] && !$structures['columns']) {
             unset($data[$module]);
         } else {
             $data[$module] = $structures;
         }
         \Includes\Utils\ModulesManager::storeModuleRegistry($path, $data);
     }
 }
Пример #9
0
 /**
  * Generate unique parcel number and set it to current parcel
  * 
  * @return string
  */
 public static function generateTransactionId()
 {
     return \XLite\Core\Operator::getInstance()->generateToken(static::TRANSACTION_ID_LENGTH, static::$chars);
 }
Пример #10
0
 /**
  * Set disabled tables list
  *
  * @param string $module     Module unique name
  * @param array  $structures Disabled structures OPTIONAL
  *
  * @return void
  */
 public function setDisabledStructures($module, array $structures = array())
 {
     $remove = !$structures || !$structures['tables'] && !$structures['columns'];
     if ($remove) {
         \Includes\Utils\ModulesManager::removeModuleFromDisabledStructure($module);
     } else {
         if (!\Includes\Utils\ModulesManager::moveModuleToDisabledRegistry($module)) {
             $path = $this->getDisabledStructuresPath();
             $data = file_exists($path) ? \XLite\Core\Operator::getInstance()->loadServiceYAML($path) : array();
             $data[$module] = $structures;
             \Includes\Utils\ModulesManager::storeModuleRegistry($path, $data);
         }
     }
 }