public function __construct(\DocumentParser $modx) { $this->FS = \Helpers\FS::getInstance(); $this->modx = $modx; $this->params = $modx->event->params; $this->rid = isset($_REQUEST[$this->rfName]) ? (int) $_REQUEST[$this->rfName] : 0; }
public function __construct($modx, $tv) { $this->modx = $modx; $this->tv = $tv; $this->DLTemplate = \DLTemplate::getInstance($this->modx); $this->fs = \Helpers\FS::getInstance(); }
public function __construct($cfg = array()) { if ($cfg) { $this->setConfig($cfg); } $this->fs = \Helpers\FS::getInstance(); }
/** * is not allowed to call from outside: private! * */ private function __construct(DocumentParser $modx) { $this->modx = $modx; $this->fs = \Helpers\FS::getInstance(); }
public function __construct($modx, $debug = false) { parent::__construct($modx, $debug); $this->modx = $modx; $this->params = isset($modx->event->params) && is_array($modx->event->params) ? $modx->event->params : array(); $this->fs = \Helpers\FS::getInstance(); }
public function __construct($modx) { $this->modx = $modx; $this->params = $modx->event->params; $this->fs = \Helpers\FS::getInstance(); $this->_table = $modx->getFullTableName($this->table); if (!$this->checkTable()) { $result = $this->createTable(); if (!$result) { $modx->logEvent(0, 3, "Cannot create {$this->table} table.", $this->pluginName); return; } } }
public function __construct(\DocumentParser $modx, $ajax = false, $tplFolder = null) { $this->_modx = $modx; self::$_ajax = (bool) $ajax; $this->loadVars(); if (is_null($tplFolder)) { $tplFolder = dirname(dirname(__FILE__)); } $FS = \Helpers\FS::getInstance(); $tplFolder = $FS->relativePath($tplFolder); $this->_publicFolder = "/" . $tplFolder . "/public/"; $this->_tplFolder = MODX_BASE_PATH . $tplFolder . "/template/"; if (!defined('MODX_MAIN_URL')) { define('MODX_MAIN_URL', MODX_SITE_URL); } }
/** * @param $modx * @param string $lang_attribute * @param bool $debug */ public function __construct($modx, $lang_attribute = 'en', $debug = false) { $this->modx = $modx; $this->_table = $modx->getFullTableName($this->table); $this->lang_attribute = $lang_attribute; $this->params = $modx->event->params; if ($this->checkTemplate && !isset($this->params['template']) && $modx->event->name != 'OnEmptyTrash') { $this->params['template'] = array_pop($modx->getDocument($this->params['id'], 'template', 'all', 'all')); } //overload plugin and class properties $_params = $modx->parseProperties('&template=;;' . $this->params['template'] . ' &id=;;' . $this->params['id'], $modx->event->activePlugin, 'plugin'); foreach ($_params as $key => $value) { if (property_exists($this, $key)) { $this->{$key} = $value; } } $this->params = array_merge($this->params, $_params); $modx->event->_output = ""; $this->DLTemplate = \DLTemplate::getInstance($this->modx); $this->fs = \Helpers\FS::getInstance(); }
protected static function loadLang($lang) { $file = dirname(dirname(__FILE__)) . '/lang/' . $lang . '.php'; if (!FS::getInstance()->checkFile($file)) { $file = false; } if (!empty($lang) && !isset(static::$langDic[$lang]) && !empty($file)) { static::$langDic[$lang] = (include_once $file); if (is_array(static::$langDic[$lang])) { static::$langDic[$lang] = APIHelpers::renameKeyArr(static::$langDic[$lang], $lang); } else { static::$langDic[$lang] = array(); } } return !(empty($lang) || empty(static::$langDic[$lang])); }
<?php include_once MODX_MANAGER_PATH . "/composer/vendor/autoload.php"; $modx->doc = new modResource($modx); $modx->tpl = DLTemplate::getInstance($modx); $modx->fs = \Helpers\FS::getInstance(); switch (true) { case function_exists('apc_cache_info'): $modx->cache = new \Doctrine\Common\Cache\ApcCache(); break; case class_exists('Memcache'): $modx->cache = new \Doctrine\Common\Cache\MemcacheCache(); $memcache = new Memcache(); $memcache->connect('localhost', 11211); $modx->cache->setMemcache($memcache); break; case class_exists('Memcached'): $modx->cache = new \Doctrine\Common\Cache\MemcachedCache(); $memcached = new Memcached(); $memcached->connect('localhost', 11211); $modx->cache->setMemcache($memcached); break; case class_exists('SQLite3'): $modx->cache = new \Doctrine\Common\Cache\SQLite3Cache(new SQLite3(MODX_BASE_PATH . 'assets/cache/sqlite.db'), 'cache'); break; default: $modx->cache = new Doctrine\Common\Cache\FilesystemCache(MODX_BASE_PATH . 'assets/cache/template/'); } $modx->cache->setNamespace($modx->getConfig('site_name')); $moduleDebug = false; if (!is_ajax() && ($modx->isFrontend() && $modx->getLoginUserID('mgr')) || $modx->isBackend() && isset($_GET['a']) && $_GET['a'] == 112 && $moduleDebug) {
/** * Конструктор контроллеров DocLister * * @param DocumentParser $modx объект DocumentParser - основной класс MODX * @param array $cfg массив параметров сниппета * @param int $startTime время запуска сниппета */ public function __construct($modx, $cfg = array(), $startTime = null) { $this->setTimeStart($startTime); if (extension_loaded('mbstring')) { mb_internal_encoding("UTF-8"); } else { throw new Exception('Not found php extension mbstring'); } if ($modx instanceof DocumentParser) { $this->modx = $modx; $this->setDebug(1); $this->loadLang(array('core', 'json')); if (!is_array($cfg) || empty($cfg)) { $cfg = $this->modx->Event->params; } } else { throw new Exception('MODX var is not instaceof DocumentParser'); } $this->FS = \Helpers\FS::getInstance(); if (isset($cfg['config'])) { $cfg = array_merge($this->loadConfig($cfg['config']), $cfg); } if (!$this->setConfig($cfg)) { throw new Exception('no parameters to run DocLister'); } $this->setDebug($this->getCFGDef('debug', 0)); if ($this->checkDL()) { $cfg = array(); $idType = $this->getCFGDef('idType', ''); if (empty($idType) && $this->getCFGDef('documents', '') != '') { $idType = 'documents'; } switch ($idType) { case 'documents': $IDs = $this->getCFGDef('documents'); $cfg['idType'] = "documents"; break; case 'parents': default: $cfg['idType'] = "parents"; if (($IDs = $this->getCFGDef('parents')) === null) { $IDs = $this->getCurrentMODXPageID(); } break; } $this->setConfig($cfg); $this->table = $this->getTable($this->getCFGDef('table', 'site_content')); $this->idField = $this->getCFGDef('idField', 'id'); $this->parentField = $this->getCFGDef('parentField', 'parent'); $this->setIDs($IDs); } $this->setLocate(); if ($this->getCFGDef("customLang")) { $this->getCustomLang(); } $this->loadExtender($this->getCFGDef("extender", "")); if ($this->checkExtender('request')) { $this->extender['request']->init($this, $this->getCFGDef("requestActive", "")); } $this->_filters = $this->getFilters($this->getCFGDef('filters', '')); $this->ownerTPL = $this->getCFGDef("ownerTPL", ""); }
if ($thumb['rid'] == $rid || $thumb['template'] == $template) { $out = $thumb; break; } } return $out; } } if ($e->name == "OnFileBrowserUpload" && isset($template) || $e->name == "OnSimpleGalleryRefresh") { $thumb = new \Helpers\PHPThumb(); $thumb->optimize($filepath . '/' . $filename); $fs = \Helpers\FS::getInstance(); $thumbConfig = getThumbConfig($tconfig, $sg_rid, $template); if (!empty($thumbConfig)) { extract($thumbConfig); $fs->makeDir($filepath . '/' . $folder); $thumb->create($filepath . '/' . $filename, $filepath . '/' . $folder . '/' . $filename, $options); $thumb->optimize($filepath . '/' . $folder . '/' . $filename); } } if ($e->name == "OnSimpleGalleryDelete") { $fs = \Helpers\FS::getInstance(); $thumbConfig = getThumbConfig($tconfig, $sg_rid, $template); if (!empty($thumbConfig)) { extract($thumbConfig); $file = $filepath . '/' . $folder . '/' . $filename; if (file_exists($file)) { unlink($file); } } }
/** * Core constructor. * @param \DocumentParser $modx * @param array $cfg */ public function __construct(\DocumentParser $modx, $cfg = array()) { $this->modx = $modx; $this->config = new Config(); $this->fs = FS::getInstance(); if (isset($cfg['config'])) { $this->config->loadConfig($cfg['config']); } $this->config->setConfig($cfg); if (isset($cfg['debug'])) { include_once MODX_BASE_PATH . 'assets/snippets/FormLister/lib/Debug.php'; $this->debug = new \Helpers\Debug($modx, array('caller' => 'FormLister\\\\' . $cfg['controller'])); } $this->lexicon = new Lexicon($modx, array('langDir' => 'assets/snippets/FormLister/core/lang/')); $this->formid = $this->getCFGDef('formid'); $this->_rq = strtolower($this->getCFGDef('formMethod', 'post')) == 'post' ? $_POST : $_GET; }
public function setUp() { $this->FS = FS::getInstance(); }