本文整理汇总了PHP中modX::getOption方法的典型用法代码示例。如果您正苦于以下问题:PHP modX::getOption方法的具体用法?PHP modX::getOption怎么用?PHP modX::getOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modX
的用法示例。
在下文中一共展示了modX::getOption方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* 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/');
}
示例2: array
/**
* 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;
}
}
}
示例3: __construct
/**
* @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;
}
示例4: initialize
/**
* 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;
}
示例5: __construct
/**
* @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');
}
示例6: __construct
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);
}
示例7: __construct
/**
* @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;
}
示例8: __construct
/**
* @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');
}
}
示例9: __construct
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));
}
}
示例10: setCachePath
/**
* 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;
}
示例11: array
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');
}
示例12: array
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');
}
示例13: array
/**
* 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';
}
示例14: __construct
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);
}
示例15: setUp
/**
* 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();
}