/** {@inheritDoc} */
 public function initialize()
 {
     /** @var gl $gl */
     $this->gl = $this->modx->getService('gl');
     $this->gl->initialize($this->getProperty('context', $this->modx->context->key));
     return parent::initialize();
 }
 public function initialize()
 {
     $signature = $this->getProperty('signature');
     $this->package = $this->modx->getObject('transport.modTransportPackage', $signature);
     if (empty($this->package)) {
         $msg = $this->modx->lexicon('package_err_nf');
         $this->modx->log(modX::LOG_LEVEL_ERROR, $msg);
         return $msg;
     }
     $this->packageSignature = explode('-', $this->package->get('signature'));
     if ($this->package->provider != 0) {
         /* if package has a provider */
         $this->provider = $this->package->getOne('Provider');
         if (empty($this->provider)) {
             $msg = $this->modx->lexicon('provider_err_nf');
             $this->modx->log(modX::LOG_LEVEL_ERROR, $msg);
             return $msg;
         }
     } else {
         /* if no provider, output error. you can't update something without a provider! */
         $msg = $this->modx->lexicon('package_update_err_provider_nf');
         $this->modx->log(modX::LOG_LEVEL_ERROR, $msg);
         return $msg;
     }
     return parent::initialize();
 }
 public function initialize()
 {
     $signature = $this->getProperty('signature');
     $this->package = $this->modx->getObject('transport.modTransportPackage', $signature);
     if (empty($this->package)) {
         $msg = $this->modx->lexicon('package_err_nf');
         $this->modx->log(modX::LOG_LEVEL_ERROR, $msg);
         return $msg;
     }
     $this->package->parseSignature();
     if ($this->package->provider != 0) {
         /* if package has a provider */
         $this->provider = $this->package->getOne('Provider');
         if (empty($this->provider)) {
             $msg = $this->modx->lexicon('provider_err_nf');
             $this->modx->log(modX::LOG_LEVEL_ERROR, $msg);
             return $msg;
         }
     } else {
         /* if no provider, indicate it is up to date */
         $msg = $this->modx->lexicon('package_err_uptodate', array('signature' => $this->package->get('signature')));
         $this->modx->log(modX::LOG_LEVEL_INFO, $msg);
         return $msg;
     }
     return parent::initialize();
 }
Exemple #4
0
 public function initialize()
 {
     $mode = $this->getProperty('mode');
     if (in_array($mode, array('insert', 'overwrite', 'replace'))) {
         $this->mode = $mode;
     }
     return parent::initialize();
 }
Exemple #5
0
 function __construct(modX &$modx, array $properties = array())
 {
     parent::__construct($modx, $properties);
     if (!($billing_path = $modx->getOption('billing.core_path'))) {
         $billing_path = $modx->getOption('core_path') . 'components/billing/';
     }
     $this->setProperties(array("billing_path" => $billing_path));
 }
 public function initialize()
 {
     /*
         Устанавливаем автоподстановку Тегов <br /> для Джевикса
     */
     $this->modx->setOption('modjevix.AutoBrMode', true);
     return parent::initialize();
 }
 public function initialize()
 {
     $notifications = $this->getProperty('notifications');
     if (empty($notifications)) {
         return $this->modx->lexicon('quip.notification_err_ns');
     }
     return parent::initialize();
 }
 public function initialize()
 {
     $threads = $this->getProperty('threads');
     if (empty($threads)) {
         return $this->modx->lexicon('quip.thread_err_ns');
     }
     return parent::initialize();
 }
Exemple #9
0
 public function initialize()
 {
     if (!($this->mxManager = $this->modx->getService('mxmanager', 'mxManager', MODX_CORE_PATH . 'components/mxmanager/model/mxmanager/'))) {
         return false;
     }
     $this->_permissions = array('new_document' => $this->modx->hasPermission('new_document'), 'new_weblink' => $this->modx->hasPermission('new_weblink'), 'new_symlink' => $this->modx->hasPermission('new_symlink'), 'new_static_resource' => $this->modx->hasPermission('new_static_resource'));
     return parent::initialize();
 }
 public function initialize()
 {
     $comments = $this->getProperty('comments');
     if (empty($comments)) {
         return $this->modx->lexicon('quip.comment_err_ns');
     }
     return parent::initialize();
 }
Exemple #11
0
 function __construct(modX &$modx, array $properties = array())
 {
     parent::__construct($modx, $properties);
     if (!($namespace = $modx->getObject('modNamespace', 'dadata'))) {
         $error = "[dadata] Not found modNamespace: dadata ";
         $this->modx->log(modX::LOG_LEVEL_ERROR, $error);
         return $this->failure($error);
     }
 }
 public function initialize()
 {
     $ids = $this->getProperty('ids');
     if (empty($ids)) {
         return $this->failure();
     }
     $this->ids = explode(',', $ids);
     return parent::initialize();
 }
 public function initialize()
 {
     $this->setProperties(array("exchange_rate_tv" => (int) $this->modx->getOption('shopmodx.exchange_rate_tv')));
     # if(!$this->getProperty('exchange_rate_tv')){
     #     $error = "Не указан ID TV-параметра курса валют";
     #     $this->modx->log(xPDO::LOG_LEVEL_ERROR, "[- ". __CLASS__ ." -] {$error}");
     #     return $error;
     # }
     return parent::initialize() && !$this->hasErrors();
 }
 public function __construct(modX &$modx, array $config = array())
 {
     parent::__construct($modx, $config);
     // using system settings instead of namespace for lightweight def. settings request
     $basePath = $this->modx->getOption('modexif.core_path', $config, $this->modx->getOption('core_path') . 'components/modexif/');
     $assetsUrl = $this->modx->getOption('modexif.assets_url', $config, $this->modx->getOption('assets_url') . 'components/modexif/');
     $managerUrl = $this->modx->getOption('modexif.manager_url', $config, $this->modx->getOption('manager_url') . 'components/modexif/');
     $this->config = array_merge(array('corePath' => $basePath, 'modelPath' => $basePath . 'model/', 'processorsPath' => $basePath . 'processors/', 'templatesPath' => $basePath . 'templates/', 'elementsPath' => $basePath . 'elements/', 'jsUrl' => $managerUrl . 'js/', 'cssUrl' => $managerUrl . 'css/', 'assetsUrl' => $assetsUrl, 'managerUrl' => $managerUrl, 'connectorsUrl' => $managerUrl . 'connectors/'), $config);
     $this->publicConfig = array('jsUrl' => $this->config['jsUrl'], 'cssUrl' => $this->config['cssUrl'], 'assetsUrl' => $this->config['assetsUrl'], 'managerUrl' => $this->config['managerUrl'], 'connectorsUrl' => $this->config['connectorsUrl']);
 }
Exemple #15
0
 public function initialize()
 {
     $this->setProperties($this->getInitializeProperties());
     if ($email = mb_strtolower(trim($this->getProperty('email')))) {
         $this->setProperty('email', $email);
     }
     // Выполнеяем проверку данных
     if (!$this->validateFields()) {
         return "Проверьте правильность заполнения формы";
     }
     return parent::initialize() && !$this->hasErrors();
 }
 /**
  * Ensure the info was properly passed and initialize the processor
  *
  * {@inheritDoc}
  * @return boolean
  */
 public function initialize()
 {
     @set_time_limit(0);
     $info = $this->getProperty('info', '');
     if (empty($info)) {
         return $this->modx->lexicon('package_download_err_ns');
     }
     if (!$this->parseInfo($info)) {
         return $this->modx->lexicon('invalid_data');
     }
     return parent::initialize();
 }
 public function initialize()
 {
     $data = $this->getProperty('data');
     if (empty($data)) {
         return $this->modx->lexicon('invalid_data');
     }
     $data = $this->modx->fromJSON($data);
     if (empty($data)) {
         return $this->modx->lexicon('invalid_data');
     }
     $this->setProperties($data);
     $this->unsetProperty('data');
     return parent::initialize();
 }
Exemple #18
0
 public static function getInstance(modX &$modx, $className, $properties = array())
 {
     // Здесь мы имеем возможность переопределить реальный класс процессора
     if (!empty($properties['basket_action']) && !self::$actualClassName) {
         switch ($properties['basket_action']) {
             case 'products_add':
             case 'products/add':
                 require dirname(dirname(__FILE__)) . '/orders/products/add.class.php';
                 self::$actualClassName = 'modBasketWebOrdersProductsAddProcessor';
                 break;
             case 'products_getdata':
                 require dirname(dirname(__FILE__)) . '/orders/products/getdata.class.php';
                 self::$actualClassName = 'modBasketWebOrdersProductsGetdataProcessor';
                 break;
                 // Это чисто для Ajax-а. Состояние корзины
             // Это чисто для Ajax-а. Состояние корзины
             case 'getdata':
                 require dirname(dirname(__FILE__)) . '/ajax/orders/getdata.class.php';
                 self::$actualClassName = 'modBasketWebAjaxOrdersGetdataProcessor';
                 break;
             case 'products_remove':
             case 'products/remove':
                 require dirname(dirname(__FILE__)) . '/orders/products/remove.class.php';
                 self::$actualClassName = 'modBasketWebOrdersProductsRemoveProcessor';
                 break;
             case 'recalculate':
                 require dirname(dirname(__FILE__)) . '/orders/recalculate.class.php';
                 self::$actualClassName = 'modBasketWebOrdersRecalculateProcessor';
                 break;
             case 'empty_basket':
                 require dirname(dirname(__FILE__)) . '/orders/empty.class.php';
                 self::$actualClassName = 'modBasketWebOrdersEmptyProcessor';
                 break;
             default:
         }
         /*
             Если переопределяете в дочернем процессоре,
             не забудьте скопировать и это
         */
         /*if($actualClassName){
               $className = $actualClassName;
               unset($properties['basket_action']);
           }*/
     }
     if (self::$actualClassName) {
         $className = self::$actualClassName;
     }
     return parent::getInstance($modx, $className, $properties);
 }
 /**
  * Tests and ensures processors run correctly
  * 
  * @param array $properties
  * @param boolean $success
  * @param string $message
  * @param array $object
  * @dataProvider providerRun
  * @depends testSetProperties
  * @depends testSetPath
  */
 public function testRun(array $properties, $success = true, $message = '', $object = array())
 {
     $this->processor->setPath(MODX_BASE_PATH . self::MODX_TEST_PROCESSOR);
     $this->processor->setProperties($properties);
     /** @var modProcessorResponse $response */
     $response = $this->processor->run();
     $this->assertInstanceOf('modProcessorResponse', $response);
     $this->assertEquals($success, $response->response['success'], 'modProcessor->run did not return the proper response type: ' . ($success ? 'success' : 'failure'));
     if (!empty($message)) {
         $this->assertEquals($message, $response->response['message'], 'modProcessor->run did not return the proper response message.');
     }
     if (!empty($object)) {
         $this->assertEquals($object, $response->response['object'], 'modProcessor->run did not return the proper response object.');
     }
 }
 function __construct(modX &$modx, array $properties = array())
 {
     parent::__construct($modx, $properties);
     // Получаем путь до процессоров
     if (!($ns = $modx->getObject('modNamespace', 'modxrepository'))) {
         $err = "Не было получено пространство имен modxrepository";
         $modx->log(xPDO::LOG_LEVEL_ERROR, $err);
         $this->failure($err);
         return;
     }
     // Get processors params
     $this->processorsParams = array('processors_path' => $ns->getCorePath() . 'processors/', 'location' => 'rest/');
     /*
      * Be sure you set system setting modxRepository.handler_doc_id  
      */
     if (!($this->parent = $modx->getOption('modxRepository.handler_doc_id', null, false))) {
         return $modx->log(xPDO::LOG_LEVEL_ERROR, 'Please, be sure you set system setting modxRepository.handler_doc_id');
     }
 }
 public static function getInstance(modX &$modx, $className, $properties = array())
 {
     $actualClass = '';
     // Here we cah redefine processor class
     if (!empty($properties['pub_action'])) {
         switch ($properties['pub_action']) {
             case 'dictionary/getfield':
                 require dirname(dirname(__FILE__)) . '/dictionaries/getfield.class.php';
                 $actualClass = 'modWebDictionariesGetfieldProcessor';
                 break;
             default:
         }
     }
     if ($actualClass) {
         $className = $actualClass;
         unset($properties['pub_action']);
     }
     return parent::getInstance($modx, $className, $properties);
 }
 public function initialize()
 {
     //print_r($this->getProperties());
     if ($data = $this->modx->fromJSON($this->getProperty('data'))) {
         $this->setDefaultProperties($data);
     }
     //print_r($this->getProperties());
     if (!(int) $this->getProperty('parent')) {
         return 'Не был получен ID модели';
     }
     /*if(!$color = $this->getProperty('color')){
           return 'Не был получен цвет';
       }
       
       if(!$color = $this->getProperty('color')){
           return 'Не было получено цветовое исполнение';
       }*/
     return parent::initialize();
 }
Exemple #23
0
 public static function getInstance(modX &$modx, $className, $properties = array())
 {
     // Здесь мы имеем возможность переопределить реальный класс процессора
     if (!empty($properties['pub_action']) && !self::$actualClassName) {
         switch ($properties['pub_action']) {
             case 'currencies/update_courses':
                 require_once dirname(dirname(__FILE__)) . '/currencies/update_courses.class.php';
                 self::$actualClassName = "modWebCurrenciesUpdatecoursesProcessor";
                 break;
             case 'login':
                 require_once dirname(dirname(__FILE__)) . '/users/login.class.php';
                 self::$actualClassName = "modWebUsersLoginProcessor";
                 break;
             default:
         }
     }
     if (self::$actualClassName) {
         $className = self::$actualClassName;
         return $className::getInstance($modx, $className, $properties);
     }
     return parent::getInstance($modx, $className, $properties);
 }
Exemple #24
0
 public function initialize()
 {
     $flag = true;
     $componentPath = (string) $this->modx->getOption('phpthumbon.core_path', null, $this->modx->getOption('core_path') . 'components/phpthumbon/');
     $this->_cfg = array('componentPath' => $componentPath, 'modelPath' => $componentPath . 'model/');
     $this->modx->addPackage("phpthumbon", $this->_cfg['modelPath']);
     CreateThumbProcessor::$TotalQueue = $this->modx->getOption('phpthumbon.total_queue', array(), CreateThumbProcessor::$TotalQueue);
     $this->protectTotal();
     if (!isset($this->modx->phpThumbOn)) {
         $this->properties = array('phpthumbon.queue' => 0);
         $this->modx->phpThumbOn = $this->modx->getService("phpthumbon", "phpThumbOn", $this->_cfg['modelPath'] . 'phpthumbon/', $this->getProperties());
     }
     if (!($flag = $this->modx->phpThumbOn instanceof phpThumbOn)) {
         $this->modx->log(modX::LOG_LEVEL_ERROR, '[phpthumbon] Could not load phpThumbOn class');
         $this->modx->error->failure('Could not load phpThumbOn class');
         $this->modx->phpThumbOn = null;
         $flag = false;
     } else {
         $flag = $this->_getObject();
     }
     return $flag ? parent::initialize() : false;
 }
 /**
  * Ensure the info was properly passed and initialize the processor
  *
  * {@inheritDoc}
  * @return boolean
  */
 public function initialize()
 {
     @set_time_limit(0);
     $signature = $this->getProperty('signature', '');
     $name = $this->getProperty('name', '');
     $constraints = $this->getProperty('constraints', '');
     if (empty($signature)) {
         return $this->modx->lexicon('package_download_err_ns');
     }
     if (empty($name)) {
         return $this->modx->lexicon('package_download_err_ns');
     }
     if (empty($constraints)) {
         return $this->modx->lexicon('package_download_err_ns');
     }
     $package = $this->modx->getObject('transport.modTransportPackage', $signature);
     $resolution = $package->findResolution($name, $constraints);
     $resolution = $resolution[0];
     $this->signature = $resolution['signature'];
     $this->location = $resolution['location'];
     return parent::initialize();
 }
Exemple #26
0
 public function initialize()
 {
     $this->setDefaultProperties(array('startId' => 0, 'excludeDocs' => array(), 'showHidden' => true, 'showUnpub' => false, 'showDeleted' => false, 'showHome' => false));
     return parent::initialize();
 }
Exemple #27
0
 function __construct(modX &$modx, array $properties = array())
 {
     set_exception_handler(array($this, 'exceptionHandler'));
     parent::__construct($modx, $properties);
 }
 public function initialize()
 {
     //print_r($this->getProperties());
     if ($data = $this->modx->fromJSON($this->getProperty('data'))) {
         $this->setDefaultProperties($data);
     }
     //print_r($this->getProperties());
     if (!(int) $this->getProperty('parent')) {
         return 'Не был получен ID модели';
     }
     if (!($old_price = (int) $this->getProperty('old_price'))) {
         return 'Не была получена старая цена';
     }
     if (!($sm_price = (int) $this->getProperty('sm_price'))) {
         return 'Не была получена новая цена';
     }
     return parent::initialize();
 }
Exemple #29
0
 public function initialize()
 {
     $this->setDefaultProperties(array('startId' => !empty($this->modx->resource->id) ? $this->modx->resource->id : 0, 'id' => 'menu', 'cacheable' => false, 'level' => 1, 'sortBy' => 'menuindex', 'sortOrder' => 'ASC', 'levelClass' => '', 'activeClass' => 'active', 'ignoreHidden' => false, 'showUnpublished' => false, 'hideSubMenus' => false));
     return parent::initialize();
 }
 public function initialize()
 {
     $this->setDefaultProperties(array('cache' => 1, 'cache_lifetime' => 0, 'cache_prefix' => 'getdata/', "path" => "/"));
     return parent::initialize();
 }