PHP Method modX::getOption Code Examples

PHP modX::getOption - 30 examples found. These are the top rated real world PHP examples of method modX::getOption extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
0
 public final function __construct(modX &$modx, array $options = array())
 {
     require_once $modx->getOption('core_path') . 'components/modfire/firephp.class.php';
     $enabled = $modx->getOption('modfire.enabled');
     $this->setEnabled($enabled);
     $this->setOptions($options);
 }
 /**
  * Initialize the importer and load the Quip package
  */
 public function initialize()
 {
     @set_time_limit(0);
     @ini_set('memory_limit', '1024M');
     $quipPath = $this->modx->getOption('quip.core_path', null, $this->modx->getOption('core_path') . 'components/quip/');
     $this->modx->addPackage('quip', $quipPath . 'model/');
 }
Example #3
0
 /**
  * Prepare string or array of files fo send in Munee
  *
  * @param array|string $files
  *
  * @return string
  */
 public function prepareFiles($files)
 {
     if (is_string($files)) {
         $files = array_map('trim', explode(',', $files));
     }
     if (!is_array($files)) {
         return '';
     }
     $site_url = $this->modx->getOption('site_url');
     $output = array();
     foreach ($files as $file) {
         if (!empty($file) && $file[0] !== '-') {
             $file = str_replace(MODX_BASE_PATH, '', $file);
             $file = str_replace($site_url, '', $file);
             if (!preg_match('#(http|https)://#', $file) && $file[0] != '/') {
                 $file = '/' . $file;
             }
             if ($tmp = parse_url($file)) {
                 // Adding file
                 $output[] = $tmp['path'];
                 // Parse file properties if set
                 if (!empty($tmp['query'])) {
                     $tmp2 = explode('&', $tmp['query']);
                     foreach ($tmp2 as $v) {
                         if ($tmp3 = explode('=', $v)) {
                             $_GET[$tmp3[0]] = @$tmp3[1];
                         }
                     }
                 }
             }
         }
     }
     return implode(',', $output);
 }
 /**
  * Initializes component into different contexts.
  *
  * @param string $ctx The context to load. Defaults to web.
  * @param array $scriptProperties
  *
  * @return boolean
  */
 public function initialize($ctx = 'web', $scriptProperties = array())
 {
     $this->config = array_merge($this->config, $scriptProperties);
     $this->config['ctx'] = $ctx;
     if (empty($this->initialized[$ctx])) {
         $properties = $this->ms2Gallery->getSourceProperties();
         $config_js = array('ctx' => $ctx, 'jsUrl' => $this->config['jsUrl'] . 'web/', 'cssUrl' => $this->config['cssUrl'] . 'web/', 'actionUrl' => $this->config['actionUrl'], 'source' => array('size' => !empty($properties['maxUploadSize']) ? $properties['maxUploadSize'] : 3145728, 'height' => !empty($properties['maxUploadHeight']) ? $properties['maxUploadHeight'] : 1080, 'width' => !empty($properties['maxUploadWidth']) ? $properties['maxUploadWidth'] : 1920, 'extensions' => !empty($properties['allowedFileTypes']) ? $properties['allowedFileTypes'] : 'jpg,jpeg,png,gif'));
         $this->modx->regClientStartupScript('<script type="text/javascript">ms2GalleryFormConfig=' . $this->modx->toJSON($config_js) . '</script>', true);
         $css = !empty($this->config['frontend_css']) ? $this->config['frontend_css'] : $this->config['cssUrl'] . 'web/default.css';
         if (!empty($css) && preg_match('/\\.css/i', $css)) {
             $this->modx->regClientCSS($css);
         }
         $js = !empty($this->config['frontend_js']) ? $this->config['frontend_js'] : $this->config['jsUrl'] . 'web/default.js';
         if (!empty($js) && preg_match('/\\.js/i', $js)) {
             $this->modx->regClientScript($js);
         }
         $this->modx->regClientScript($this->config['jsUrl'] . 'web/lib/plupload/plupload.full.min.js');
         $this->modx->regClientScript($this->config['jsUrl'] . 'web/files.js');
         $lang = $this->modx->getOption('cultureKey');
         if ($lang != 'en' && file_exists($this->config['jsUrl'] . 'web/lib/plupload/i18n/' . $lang . '.js')) {
             $this->modx->regClientScript($this->config['jsUrl'] . 'web/lib/plupload/i18n/' . $lang . '.js');
         }
         $this->initialized[$ctx] = true;
     }
     return true;
 }
Example #5
0
 public function init()
 {
     if (isset($this->sp['resource'])) {
         if (!$this->sp['resource']->richtext) {
             return false;
         }
     }
     $useEditor = $this->modx->getOption('use_editor', false);
     $whichEditor = $this->modx->getOption('which_editor', '');
     if ($useEditor && $whichEditor != 'MarkdownEditor') {
         $initCondition = $this->md->getOption('init.condition');
         if (empty($initCondition)) {
             $initCondition = '[]';
         }
         $initCondition = $this->modx->fromJSON($initCondition);
         if (!empty($initCondition)) {
             $c = $this->modx->newQuery('modResource');
             $c->where([['id' => $this->sp['resource']->id], $initCondition]);
             $check = $this->modx->getObject('modResource', $c);
             if ($check) {
                 $this->modx->setOption('which_editor', 'MarkdownEditor');
                 $whichEditor = 'MarkdownEditor';
             }
         }
     }
     if ($useEditor && $whichEditor == 'MarkdownEditor') {
         return true;
     }
     return false;
 }
Example #6
0
 /**
  * Creates an instance of the Login class.
  *
  * @param modX &$modx A reference to the modX instance.
  * @param array $config An array of configuration parameters.
  * @return Login
  */
 function __construct(modX &$modx, array $config = array())
 {
     $this->modx =& $modx;
     $corePath = $modx->getOption('login.core_path', $config, $modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/login/');
     $this->config = array_merge(array('chunksPath' => $corePath . 'chunks/', 'controllersPath' => $corePath . 'controllers/', 'corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'processorsPath' => $corePath . 'processors/', 'testsPath' => $corePath . 'test/'), $config);
     $this->modx->lexicon->load('login:default');
 }
Example #7
0
 function __construct(modX &$modx, array $config = array())
 {
     $this->modx =& $modx;
     $corePath = $modx->getOption('taglister.core_path', null, $modx->getOption('core_path') . 'components/taglister/');
     $assetsUrl = $modx->getOption('taglister.assets_url', null, $modx->getOption('assets_url') . 'components/taglister/');
     $this->config = array_merge(array('corePath' => $corePath, 'chunksPath' => $corePath . 'elements/chunks/', 'snippetsPath' => $corePath . 'elements/snippets/'), $config);
 }
Example #8
0
 /**
  * @param modX $modx
  * @param array $config
  */
 public function __construct(modX &$modx, $config = array())
 {
     $this->modx =& $modx;
     $config = array_merge(array('firstClass' => 'first', 'lastClass' => 'last', 'hereClass' => 'active', 'parentClass' => '', 'rowClass' => '', 'outerClass' => '', 'innerClass' => '', 'levelClass' => '', 'selfClass' => '', 'webLinkClass' => '', 'limit' => 0, 'hereId' => 0), $config, array('return' => 'data'));
     if (empty($config['tplInner']) && !empty($config['tplOuter'])) {
         $config['tplInner'] = $config['tplOuter'];
     }
     if (empty($config['hereId']) && !empty($modx->resource)) {
         $config['hereId'] = $modx->resource->id;
     }
     $fqn = $modx->getOption('pdoFetch.class', null, 'pdotools.pdofetch', true);
     $path = $modx->getOption('pdofetch_class_path', null, MODX_CORE_PATH . 'components/pdotools/model/', true);
     if ($pdoClass = $modx->loadClass($fqn, $path, false, true)) {
         $this->pdoTools = new $pdoClass($modx, $config);
     } else {
         return;
     }
     if ($config['hereId']) {
         $here = $this->pdoTools->getObject('modResource', $config['hereId'], array('select' => 'id, context_key'));
         if ($here) {
             $tmp = $modx->getParentIds($here['id'], 100, array('context' => $here['context_key']));
             $tmp[] = $config['hereId'];
             $this->parentTree = array_flip($tmp);
         }
     }
     $modx->lexicon->load('pdotools:pdomenu');
 }
 public function __construct($modx, &$scriptProperties)
 {
     $this->scriptProperties =& $scriptProperties;
     $this->modx =& $modx;
     $corePath = $this->modx->getOption('pdfresource.core_path', null, $this->modx->getOption('core_path') . 'components/pdfresource/');
     $this->pdfresource = $this->modx->getService('pdfresource', 'PDFResource', $corePath . 'model/pdfresource/', array('core_path' => $corePath));
 }
Example #10
0
 /**
  * The Quip Constructor.
  *
  * This method is used to create a new Quip object.
  *
  * @param modX &$modx A reference to the modX object.
  * @param array $config A collection of properties that modify Quip
  * behaviour.
  * @return Quip A unique Quip instance.
  */
 function __construct(modX &$modx, array $config = array())
 {
     $this->modx =& $modx;
     /* allows you to set paths in different environments
      * this allows for easier SVN management of files
      */
     $corePath = $this->modx->getOption('xdbedit.core_path', null, $modx->getOption('core_path') . 'components/xdbedit/');
     $assetsPath = $this->modx->getOption('xdbedit.assets_path', null, $modx->getOption('assets_path') . 'components/xdbedit/');
     $assetsUrl = $this->modx->getOption('xdbedit.assets_url', null, $modx->getOption('assets_url') . 'components/xdbedit/');
     $this->config = array_merge(array('corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'processorsPath' => $corePath . 'processors/', 'controllersPath' => $corePath . 'controllers/', 'chunksPath' => $corePath . 'elements/chunks/', 'snippetsPath' => $corePath . 'elements/snippets/', 'auto_create_tables' => true, 'baseUrl' => $assetsUrl, 'cssUrl' => $assetsUrl . 'css/', 'jsUrl' => $assetsUrl . 'js/', 'connectorUrl' => $assetsUrl . 'connector.php', 'thread' => ''), $config);
     /* load debugging settings */
     if ($this->modx->getOption('debug', $this->config, false)) {
         error_reporting(E_ALL);
         ini_set('display_errors', true);
         $this->modx->setLogTarget('HTML');
         $this->modx->setLogLevel(modX::LOG_LEVEL_ERROR);
         $debugUser = $this->config['debugUser'] == '' ? $this->modx->user->get('username') : 'anonymous';
         $user = $this->modx->getObject('modUser', array('username' => $debugUser));
         if ($user == null) {
             $this->modx->user->set('id', $this->modx->getOption('debugUserId', $this->config, 1));
             $this->modx->user->set('username', $debugUser);
         } else {
             $this->modx->user = $user;
         }
     }
 }
Example #11
0
 /**
  * The Babel Constructor.
  *
  * This method is used to create a new Babel object.
  *
  * @param modX &$modx A reference to the modX object.
  * @param array $config A collection of properties that modify Babel
  * behaviour.
  * @return Babel A unique Babel instance.
  */
 function __construct(modX &$modx, array $config = array())
 {
     $this->modx =& $modx;
     $corePath = $this->modx->getOption('babel.core_path', null, $modx->getOption('core_path') . 'components/babel/');
     $assetsUrl = $this->modx->getOption('babel.assets_url', null, $modx->getOption('assets_url') . 'components/babel/');
     $contextKeysOption = $this->modx->getOption('babel.contextKeys', $config, '');
     $contextKeyToGroup = $this->decodeContextKeySetting($contextKeysOption);
     $syncTvsOption = $this->modx->getOption('babel.syncTvs', $config, '');
     $syncTvs = array();
     if (!empty($syncTvsOption)) {
         $syncTvs = explode(',', $syncTvsOption);
         $syncTvs = array_map('intval', $syncTvs);
     }
     $babelTvName = $this->modx->getOption('babel.babelTvName', $config, 'babelLanguageLinks');
     $this->config = array_merge(array('corePath' => $corePath, 'chunksPath' => $corePath . 'elements/chunks/', 'chunkSuffix' => '.chunk.tpl', 'cssUrl' => $assetsUrl . 'css/', 'jsUrl' => $assetsUrl . 'js/', 'contextKeyToGroup' => $contextKeyToGroup, 'syncTvs' => $syncTvs, 'babelTvName' => $babelTvName), $config);
     /* load babel lexicon */
     if ($this->modx->lexicon) {
         $this->modx->lexicon->load('babel:default');
     }
     /* load babel TV */
     $this->babelTv = $modx->getObject('modTemplateVar', array('name' => $babelTvName));
     if (!$this->babelTv) {
         $this->modx->log(modX::LOG_LEVEL_WARN, 'Could not load babel TV: ' . $babelTvName . ' will try to create it...');
         $fields = array('name' => $babelTvName, 'type' => 'hidden', 'default_text' => '', 'caption' => $this->modx->lexicon('babel.tv_caption'), 'description' => $this->modx->lexicon('babel.tv_description'));
         $this->babelTv = $modx->newObject('modTemplateVar', $fields);
         if ($this->babelTv->save()) {
             $this->modx->log(modX::LOG_LEVEL_INFO, 'Created babel TV: ' . $babelTvName);
         } else {
             $this->modx->log(modX::LOG_LEVEL_ERROR, 'Could not create babel TV: ' . $babelTvName);
         }
     }
 }
 /**
  * CustomRequest constructor
  *
  * @param modX &$modx A reference to the modX instance.
  * @param array $config An array of configuration options. Optional.
  */
 function __construct(modX &$modx, array $config = array())
 {
     $this->modx =& $modx;
     $corePath = $this->modx->getOption('customrequest.core_path', NULL, MODX_CORE_PATH . 'components/customrequest/');
     /* loads some default paths for easier management */
     $this->config = array_merge(array('corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'pluginsPath' => $corePath . 'elements/plugins/', 'configsPath' => $this->modx->getOption('customrequest.configsPath', NULL, $corePath . 'configs/'), 'debug' => $this->modx->getOption('customrequest.debug', NULL, FALSE)), $config);
     $this->requests = $this->modx->fromJson($this->config['aliases']);
 }
Example #13
0
 public function __construct(modX $modx, &$scriptProperties)
 {
     $this->scriptProperties =& $scriptProperties;
     $this->modx = $modx;
     $fqn = $modx->getOption('twiggy_class', null, 'twiggy.twiggy', true);
     $path = $modx->getOption('twiggy_class_path', null, MODX_CORE_PATH . 'components/twiggy/model/', true);
     $this->twiggy = $modx->getService($fqn, '', $path, $this->scriptProperties);
 }
Example #14
0
 public function __construct(modX &$modx, &$scriptProperties)
 {
     $this->scriptProperties =& $scriptProperties;
     $this->modx =& $modx;
     if (!is_object($this->ecc)) {
         $corePath = $modx->getOption('ecc_core_path', null, $modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/ecc/');
         $this->ecc = $modx->getService('ecc', 'ecc', $corePath . 'model/ecc/', array('core_path' => $corePath));
     }
 }
 /**
  * Create an instance of ArticlesService.
  *
  * @param modX $modx A reference to the modX object
  * @param array $config A configuration array
  */
 function __construct(modX &$modx, array $config = array())
 {
     $this->modx =& $modx;
     $corePath = $this->modx->getOption('articles.core_path', $config, $this->modx->getOption('core_path') . 'components/articles/');
     $assetsUrl = $this->modx->getOption('articles.assets_url', $config, $this->modx->getOption('assets_url') . 'components/articles/');
     $connectorUrl = $assetsUrl . 'connector.php';
     $this->config = array_merge(array('assetsUrl' => $assetsUrl, 'cssUrl' => $assetsUrl . 'css/', 'jsUrl' => $assetsUrl . 'js/', 'imagesUrl' => $assetsUrl . 'images/', 'connectorUrl' => $connectorUrl, 'corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'elementsPath' => $corePath . 'elements/', 'snippetsPath' => $corePath . 'elements/snippets/', 'tvsPath' => $corePath . 'elements/tvs/', 'chunksPath' => $corePath . 'elements/chunks/', 'chunkSuffix' => '.chunk.tpl', 'processorsPath' => $corePath . 'processors/'), $config);
     $this->modx->lexicon->load('articles:default');
 }
 /**
  * Sets the cache path for this Smarty instance
  *
  * @access public
  * @param string $path The path to set. Defaults to '', which in turn
  * defaults to $this->modx->cachePath.
  */
 public function setCachePath($path = '')
 {
     $path = $this->modx->getOption(xPDO::OPT_CACHE_PATH) . $path;
     if (!is_dir($path)) {
         $this->modx->getCacheManager();
         $this->modx->cacheManager->writeTree($path);
     }
     $this->compile_dir = $path;
 }
Example #17
0
 /**
  * @param $modx
  * @param $config
  */
 public function __construct($modx, &$config)
 {
     $this->modx = $modx;
     $this->config =& $config;
     $corePath = $this->modx->getOption('dadata_core_path', null, $this->modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/dadata/');
     /** @var dadata $dadata */
     $this->dadata =& $this->modx->getService('dadata', 'dadata', $corePath . 'model/dadata/', array('core_path' => $corePath));
     $this->namespace = $this->dadata->namespace;
 }
Example #18
0
 /**
  * Default constructor for PackMan
  *
  * @constructor
  * @param modX &$modx A reference to a modX instance.
  * @param array $config (optional) Configuration properties.
  * @return packman
  */
 function __construct(modX &$modx, array $config = array())
 {
     $this->modx =& $modx;
     $corePath = $modx->getOption('packman.core_path', null, $modx->getOption('core_path') . 'components/packman/');
     $assetsUrl = $modx->getOption('packman.assets_url', null, $modx->getOption('assets_url') . 'components/packman/');
     $this->config = array_merge(array('corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'processorsPath' => $corePath . 'processors/', 'controllersPath' => $corePath . 'controllers/', 'includesPath' => $corePath . 'includes/', 'baseUrl' => $assetsUrl, 'cssUrl' => $assetsUrl . 'css/', 'jsUrl' => $assetsUrl . 'js/', 'connectorUrl' => $assetsUrl . 'connector.php'), $config);
     $this->modx->addPackage('packman', $this->config['modelPath']);
     $this->modx->lexicon->load('packman:default');
 }
Example #19
0
 /**
  * @param $modx
  * @param $config
  */
 public function __construct($modx, &$config)
 {
     $this->modx = $modx;
     $this->config =& $config;
     $corePath = $this->modx->getOption('subdomainsfolder_core_path', null, $this->modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/subdomainsfolder/');
     /** @var SubdomainsFolder $SubdomainsFolder */
     $this->SubdomainsFolder = $this->modx->getService('SubdomainsFolder', 'SubdomainsFolder', $corePath . 'model/subdomainsfolder/', array('core_path' => $corePath));
     $this->namespace = $this->SubdomainsFolder->namespace;
 }
 /**
  * @param modX $modx
  * @param array $config
  */
 public function __construct(modX &$modx, array $config = array())
 {
     $this->modx =& $modx;
     $this->config = array_merge(array('basePath' => $this->modx->getOption('base_path', null, MODX_BASE_PATH), 'collectionResultsKey' => 'results', 'collectionTotalKey' => 'total', 'controllerClassPrefix' => 'modRestController', 'controllerClassSeparator' => '', 'defaultAction' => 'index', 'defaultResponseFormat' => 'json', 'defaultFailureStatusCode' => 200, 'defaultSuccessStatusCode' => 200, 'errorMessageSeparator' => ' ', 'exitOnResponse' => true, 'propertyLimit' => 'limit', 'propertyOffset' => 'start', 'propertySearch' => 'search', 'propertySort' => 'sort', 'propertySortDir' => 'dir', 'requestParameter' => '_rest', 'responseErrorsKey' => 'errors', 'responseMessageKey' => 'message', 'responseObjectKey' => 'object', 'responseSuccessKey' => 'success', 'trimParameters' => false, 'xmlRootNode' => 'response'), $config);
     $this->modx->getService('lexicon', 'modLexicon');
     if ($this->modx->lexicon) {
         $this->modx->lexicon->load('rest');
     }
 }
Example #21
0
 public function __construct($modx, &$scriptProperties)
 {
     $this->scriptProperties =& $scriptProperties;
     $this->modx = $modx;
     $this->gl = $this->modx->gl;
     if (!is_object($this->gl) or !$this->gl instanceof gl) {
         $corePath = $this->modx->getOption('gl_core_path', null, $this->modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/gl/');
         $this->gl = $this->modx->getService('gl', 'gl', $corePath . 'model/gl/', $this->scriptProperties);
     }
 }
Example #22
0
 /**
  * Main CookieList constructor for setting up configuration etc.
  *
  * @param \modX $modx
  * @param array $config
  * @return \CookieList
  */
 function __construct(modX &$modx, array $config = array())
 {
     $this->modx =& $modx;
     $basePath = $this->modx->getOption('cookielist.core_path', $config, $this->modx->getOption('core_path') . 'components/cookielist/');
     $assetsUrl = $this->modx->getOption('cookielist.assets_url', $config, $this->modx->getOption('assets_url') . 'components/cookielist/');
     $assetsPath = $this->modx->getOption('cookielist.assets_path', $config, $this->modx->getOption('assets_path') . 'components/cookielist/');
     $this->config = array_merge(array('base_bath' => $basePath, 'core_path' => $basePath, 'model_path' => $basePath . 'model/', 'processors_path' => $basePath . 'processors/', 'elements_path' => $basePath . 'elements/', 'assets_path' => $assetsPath, 'js_url' => $assetsUrl . 'js/', 'css_url' => $assetsUrl . 'css/', 'assets_url' => $assetsUrl, 'connector_url' => $assetsUrl . 'connector.php'), $config);
     $this->modx->lexicon->load('cookielist:default');
     $this->cookiename = $modx->getOption('cookielist.cookie.name') ? $modx->getOption('cookielist.cookie.name') : 'cookieList';
 }
Example #23
0
 function __construct(modX &$modx, array $config = array())
 {
     $this->modx =& $modx;
     $corePath = $this->modx->getOption('schedule.core_path', $config, $this->modx->getOption('core_path') . 'components/schedule/');
     $assetsUrl = $this->modx->getOption('schedule.assets_url', $config, $this->modx->getOption('assets_url') . 'components/schedule/');
     $connectorUrl = $assetsUrl . 'connector.php';
     $this->config = array_merge(array('assetsUrl' => $assetsUrl, 'cssUrl' => $assetsUrl . 'css/', 'jsUrl' => $assetsUrl . 'js/', 'imagesUrl' => $assetsUrl . 'images/', 'connectorUrl' => $connectorUrl, 'corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'chunksPath' => $corePath . 'elements/chunks/', 'chunkSuffix' => '.chunk.tpl', 'snippetsPath' => $corePath . 'elements/snippets/', 'processorsPath' => $corePath . 'processors/', 'templatesPath' => $corePath . 'templates/', 'parents' => $modx->getOption('schedule.parents', '', 0), 'resources' => $modx->getOption('schedule.resources', '', 0), 'render_data_tpl' => $modx->getOption('schedule.render_data_tpl', '', 'tpl.Schedule.data.row')), $config);
     $this->modx->addPackage('schedule', $this->config['modelPath']);
     $this->modx->lexicon->load('schedule:default');
 }
 function __construct(modX &$modx, array $config = array())
 {
     $this->modx =& $modx;
     $corePath = $this->modx->getOption('ajaxfileupload.core_path', null, $this->modx->getOption('core_path') . 'components/ajaxfileupload/');
     $assetsUrl = $this->modx->getOption('ajaxfileupload.assets_url', null, $this->modx->getOption('assets_url') . 'components/ajaxfileupload/');
     $endpointUrl = $assetsUrl . 'upload.php';
     $this->config = array_merge(array('assetsUrl' => $assetsUrl, 'cssUrl' => $assetsUrl . 'css/', 'jsUrl' => $assetsUrl . 'js/', 'corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'processorsPath' => $corePath . 'processors/', 'id' => 'ajaxfileupload', 'endpointUrl' => $endpointUrl, 'uploadPath' => '', 'allowedExtensions' => $modx->getOption('upload_files'), 'sizeLimit' => $modx->getOption('upload_maxsize'), 'multiple' => true, 'maxConnections' => 3, 'actions' => 'registerCSS, registerJS, registerJSTpl, outputUploadTpl', 'addToRequestParams' => 'id, allowedExtensions, sizeLimit, uploadPath', 'cssFile' => $assetsUrl . 'css/fineuploader.css', 'jsFile' => $assetsUrl . 'js/web/jquery.fineuploader-3.0.min.js', 'uploadTpl' => 'ajaxfileupload.tpl.upload', 'jsTpl' => 'ajaxfileupload.tpl.js', 'toPlaceholder' => false, 'placeholderPrefix' => 'ajaxfileupload.tpl.'), $config);
     $lang = isset($this->config['lang']) ? $this->config['lang'] . ':' : '';
     $this->modx->lexicon->load($lang . 'ajaxfileupload:default');
 }
Example #25
0
 /**
  * Ensure all tests have a reference to the MODX and FormIt objects
  */
 public function setUp()
 {
     $this->modx = FiTestHarness::_getConnection();
     $fiCorePath = $this->modx->getOption('formit.core_path', null, $this->modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/formit/');
     require_once $fiCorePath . 'model/formit/formit.class.php';
     $this->formit = new FormIt($this->modx);
     /* set this here to prevent emails/headers from being sent */
     $this->formit->inTestMode = true;
     /* make sure to reset MODX placeholders so as not to keep placeholder data across tests */
     $this->modx->placeholders = array();
 }
 public function __construct(modX &$modx, $config = array())
 {
     require_once $modx->getOption('repoman.core_path', '', MODX_CORE_PATH . 'components/repoman/') . 'vendor/autoload.php';
     $controller = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'home';
     if (!in_array($controller, $this->valid_controllers)) {
         $_REQUEST['action'] = '404';
     }
     $assets_url = $modx->getOption('repoman.assets_url', '', MODX_ASSETS_URL . 'components/repoman/');
     $modx->regClientCSS($assets_url . 'style.css');
     parent::__construct($modx, $config);
 }
Example #27
0
 function __construct(modX &$modx, array $config = array())
 {
     $this->modx =& $modx;
     $corePath = $modx->getOption('gauthx.core_path', null, $modx->getOption('core_path') . 'components/gauthx/');
     $assetsUrl = $modx->getOption('gauthx.assets_url', null, $modx->getOption('assets_url') . 'components/gauthx/');
     $this->config = array_merge(array('corePath' => $corePath, 'chunksPath' => $corePath . 'elements/chunks/', 'modelPath' => $corePath . 'model/', 'processorsPath' => $corePath . 'processors/', 'templatesPath' => $corePath . 'templates/', 'assetsUrl' => $assetsUrl, 'cssUrl' => $assetsUrl . 'css/', 'jsUrl' => $assetsUrl . 'js/'), $config);
     $this->modx->addPackage('GAuthx', $this->config['modelPath']);
     if ($this->modx->lexicon) {
         $this->modx->lexicon->load('example:default');
     }
 }
Example #28
0
 /**
  * @param $modx
  * @param $config
  */
 public function __construct($modx, &$config)
 {
     $this->modx = $modx;
     $this->config =& $config;
     $this->gl = $this->modx->gl;
     if (!is_object($this->gl) or !$this->gl instanceof gl) {
         $corePath = $this->modx->getOption('gl_core_path', null, $this->modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/gl/');
         $this->gl = $this->modx->getService('gl', 'gl', $corePath . 'model/gl/', $this->config);
     }
     $this->namespace = $this->gl->namespace;
 }
Example #29
0
 function __construct(modX &$modx, array $config = array())
 {
     $this->modx =& $modx;
     $corePath = $modx->getOption('batcher.core_path', null, $modx->getOption('core_path') . 'components/batcher/');
     $assetsUrl = $modx->getOption('batcher.assets_url', null, $modx->getOption('assets_url') . 'components/batcher/');
     $this->config = array_merge(array('corePath' => $corePath, 'chunksPath' => $corePath . 'elements/chunks/', 'modelPath' => $corePath . 'model/', 'processorsPath' => $corePath . 'processors/', 'assetsUrl' => $assetsUrl, 'connectorUrl' => $assetsUrl . 'connector.php', 'cssUrl' => $assetsUrl . 'css/', 'jsUrl' => $assetsUrl . 'js/'), $config);
     $this->modx->addPackage('batcher', $this->config['modelPath']);
     if ($this->modx->lexicon) {
         $this->modx->lexicon->load('batcher:default');
     }
 }
Example #30
0
 /**
  * Ensure all tests have a reference to the MODX and Discuss objects
  */
 public function setUp()
 {
     $this->modx =& DiscussTestHarness::_getConnection();
     $disCorePath = $this->modx->getOption('discuss.core_path', null, $this->modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/discuss/');
     require_once $disCorePath . 'model/discuss/discuss.class.php';
     $this->discuss = new Discuss($this->modx);
     $this->modx->discuss =& $this->discuss;
     /* set this here to prevent emails/headers from being sent */
     $this->discuss->inTestMode = true;
     /* make sure to reset MODX placeholders so as not to keep placeholder data across tests */
     $this->modx->placeholders = array();
 }