本文整理汇总了PHP中modX::addPackage方法的典型用法代码示例。如果您正苦于以下问题:PHP modX::addPackage方法的具体用法?PHP modX::addPackage怎么用?PHP modX::addPackage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modX
的用法示例。
在下文中一共展示了modX::addPackage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* @param modX $modx
* @param array $config
*/
function __construct(modX &$modx, array $config = array())
{
$this->modx =& $modx;
$corePath = $this->modx->getOption('msprofile_core_path', $config, $this->modx->getOption('core_path') . 'components/msprofile/');
$assetsUrl = $this->modx->getOption('msprofile_assets_url', $config, $this->modx->getOption('assets_url') . 'components/msprofile/');
$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/', 'templatesPath' => $corePath . 'elements/templates/', 'chunkSuffix' => '.chunk.tpl', 'snippetsPath' => $corePath . 'elements/snippets/', 'processorsPath' => $corePath . 'processors/'), $config);
$this->modx->addPackage('msprofile', $this->config['modelPath']);
$this->modx->lexicon->load('msprofile:default');
$this->ms2 = $modx->getService('miniShop2');
$this->ms2->initialize($this->modx->context->key);
}
示例2: 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/');
}
示例3: __construct
/**
* Constructs the object
*
* @param modX &$modx A reference to the modX object
* @param array $config An array of configuration options
*/
public function __construct(modX &$modx, array $config = array())
{
$this->modx =& $modx;
$basePath = $this->modx->getOption('quickstartbuttons.core_path', $config, $this->modx->getOption('core_path') . 'components/quickstartbuttons/');
$assetsPath = $this->modx->getOption('quickstartbuttons.assets_path', $config, $this->modx->getOption('assets_path') . 'components/quickstartbuttons/');
$assetsUrl = $this->modx->getOption('quickstartbuttons.assets_url', $config, $this->modx->getOption('assets_url') . 'components/quickstartbuttons/');
$this->config = array_merge(array('basePath' => $basePath, 'corePath' => $basePath, 'lexiconPath' => $basePath . 'lexicon/', 'modelPath' => $basePath . 'model/', 'controllersPath' => $basePath . 'controllers/', 'processorsPath' => $basePath . 'processors/', 'templatesPath' => $basePath . 'templates/', 'elementsPath' => $basePath . 'elements/', 'chunksPath' => $basePath . 'elements/chunks/', 'hooksPath' => $basePath . 'hooks/', 'assetsPath' => $assetsPath, 'ordersPath' => $assetsPath . 'orders/', 'assetsUrl' => $assetsUrl, 'connectorUrl' => $assetsUrl . 'connector.php', 'jsUrl' => $assetsUrl . 'js/', 'cssUrl' => $assetsUrl . 'css/', 'imgsUrl' => $assetsUrl . 'images/'), $config);
$this->modx->addPackage('quickstartbuttons', $this->config['modelPath']);
}
示例4: array
function __construct(modX &$modx, array $config = array())
{
$this->modx =& $modx;
$corePath = $this->modx->getOption('urlhistory.core_path', $config, $this->modx->getOption('core_path') . 'components/urlhistory/');
$assetsUrl = $this->modx->getOption('urlhistory.assets_url', $config, $this->modx->getOption('assets_url') . 'components/urlhistory/');
$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/'), $config);
$this->modx->addPackage('urlhistory', $this->config['modelPath']);
$this->modx->lexicon->load('urlhistory:default');
}
示例5: array
function __construct(modX &$modx, array $config = array())
{
$this->modx =& $modx;
$this->namespace = $this->getOption('namespace', $config, 'a11y');
$corePath = $this->getOption('core_path', $config, $this->modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/a11y/');
$assetsUrl = $this->getOption('assets_url', $config, $this->modx->getOption('assets_url', null, MODX_ASSETS_URL) . 'components/a11y/');
$connectorUrl = $assetsUrl . 'connector.php';
$this->config = array_merge(array('assets_url' => $assetsUrl, 'core_path' => $corePath, 'assetsUrl' => $assetsUrl, 'cssUrl' => $assetsUrl . 'css/', 'jsUrl' => $assetsUrl . 'js/', 'connectorUrl' => $connectorUrl, 'corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'processorsPath' => $corePath . 'processors/', 'templatesPath' => $corePath . 'templates/'), $config);
$this->modx->addPackage('a11y', $this->config['modelPath']);
$this->modx->lexicon->load('a11y:default');
$this->modx->lexicon->load('a11y:dashboard');
}
示例6: array
/**
* @param \modX $modx
* @param array $config
*/
function __construct(modX &$modx, array $config = array())
{
$this->modx =& $modx;
$corePath = $this->modx->getOption('clientconfig.core_path', $config, $this->modx->getOption('core_path') . 'components/clientconfig/');
$assetsUrl = $this->modx->getOption('clientconfig.assets_url', $config, $this->modx->getOption('assets_url') . 'components/clientconfig/');
$assetsPath = $this->modx->getOption('clientconfig.assets_path', $config, $this->modx->getOption('assets_path') . 'components/clientconfig/');
$this->config = array_merge(array('basePath' => $corePath, 'corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'processorsPath' => $corePath . 'processors/', 'elementsPath' => $corePath . 'elements/', 'templatesPath' => $corePath . 'templates/', 'assetsPath' => $assetsPath, 'jsUrl' => $assetsUrl . 'js/', 'cssUrl' => $assetsUrl . 'css/', 'assetsUrl' => $assetsUrl, 'connectorUrl' => $assetsUrl . 'connector.php', 'verticalTabs' => (bool) $this->modx->getOption('clientconfig.vertical_tabs', null, false)), $config);
$modelPath = $this->config['modelPath'];
$this->modx->addPackage('clientconfig', $modelPath);
$this->modx->lexicon->load('clientconfig:default');
$this->debug = (bool) $this->modx->getOption('clientconfig.debug', null, false);
}
示例7: array
function __construct(modX &$modx, array $config = array())
{
$this->modx =& $modx;
$this->namespace = $this->getOption('namespace', $config, 'collections');
$corePath = $this->getOption('core_path', $config, $this->modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/collections/');
$assetsUrl = $this->getOption('assets_url', $config, $this->modx->getOption('assets_url', null, MODX_ASSETS_URL) . 'components/collections/');
$connectorUrl = $assetsUrl . 'connector.php';
$taggerCorePath = $modx->getOption('tagger.core_path', null, $modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/tagger/');
if (file_exists($taggerCorePath . 'model/tagger/tagger.class.php')) {
/** @var Tagger $tagger */
$tagger = $modx->getService('tagger', 'Tagger', $taggerCorePath . 'model/tagger/', array('core_path' => $taggerCorePath));
} else {
$tagger = null;
}
$quipCorePath = $modx->getOption('quip.core_path', null, $modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/quip/');
if (file_exists($quipCorePath . 'model/quip/quip.class.php')) {
/** @var Quip $quip */
$quip = $modx->getService('quip', 'Quip', $quipCorePath . 'model/quip/', array('core_path' => $quipCorePath));
} else {
$quip = null;
}
$this->config = array_merge(array('assets_url' => $assetsUrl, 'core_path' => $corePath, '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/', 'taggerInstalled' => $tagger instanceof Tagger, 'quipInstalled' => $quip instanceof Quip), $config);
$this->modx->addPackage('collections', $this->config['modelPath']);
$this->modx->lexicon->load('collections:default');
$this->modx->lexicon->load('collections:selections');
}
示例8: array
/**
* @param modX $modx
* @param array $config
*/
function __construct(modX &$modx, array $config = array())
{
$this->modx =& $modx;
$corePath = $this->modx->getOption('ms2gallery.core_path', $config, $this->modx->getOption('core_path') . 'components/ms2gallery/');
$assetsUrl = $this->modx->getOption('ms2gallery.assets_url', $config, $this->modx->getOption('assets_url') . 'components/ms2gallery/');
$actionUrl = $this->modx->getOption('ms2gallery.action_url', $config, $assetsUrl . 'action.php');
$connectorUrl = $assetsUrl . 'connector.php';
$pageSize = $this->modx->getOption('ms2gallery_page_size', null, 20);
$this->config = array_merge(array('assetsUrl' => $assetsUrl, 'cssUrl' => $assetsUrl . 'css/', 'jsUrl' => $assetsUrl . 'js/', 'imagesUrl' => $assetsUrl . 'images/', 'customPath' => $corePath . 'custom/', 'connector_url' => $connectorUrl, 'actionUrl' => $actionUrl, 'corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'ctx' => 'web', 'json_response' => false, 'templatesPath' => $corePath . 'elements/templates/', 'pageSize' => $pageSize), $config);
$this->modx->addPackage('ms2gallery', $this->config['modelPath']);
$this->modx->lexicon->load('ms2gallery:default');
}
示例9: __construct
/**
* @param \modX $modx
* @param array $config
*/
public function __construct(modX &$modx, array $config = array())
{
$this->modx =& $modx;
$basePath = $this->modx->getOption('scheduler.core_path', $config, $this->modx->getOption('core_path') . 'components/scheduler/');
$assetsUrl = $this->modx->getOption('scheduler.assets_url', $config, $this->modx->getOption('assets_url') . 'components/scheduler/');
$assetsPath = $this->modx->getOption('scheduler.assets_path', $config, $this->modx->getOption('assets_path') . 'components/scheduler/');
$managerUrl = $this->modx->getOption('manager_url', $config, $this->modx->getOption('base_url') . 'manager/');
$this->config = array_merge(array('basePath' => $basePath, 'corePath' => $basePath, 'modelPath' => $basePath . 'model/', 'processorsPath' => $basePath . 'processors/', 'elementsPath' => $basePath . 'elements/', 'templatesPath' => $basePath . 'templates/', 'assetsPath' => $assetsPath, 'assetsUrl' => $assetsUrl, 'jsUrl' => $assetsUrl . 'js/', 'cssUrl' => $assetsUrl . 'css/', 'connectorUrl' => $assetsUrl . 'connector.php', 'managerUrl' => $managerUrl, 'hideLogo' => $this->modx->getOption('scheduler.hideLogo', null, false)), $config);
$this->modx->addPackage('scheduler', $this->config['modelPath']);
$this->modx->loadClass('sTask', $this->config['modelPath'] . 'scheduler/');
$this->modx->loadClass('sTaskRun', $this->config['modelPath'] . 'scheduler/');
}
示例10: array
/**
* @param modX $modx
* @param array $config
*/
function __construct(modX &$modx, array $config = array())
{
$this->modx =& $modx;
$corePath = $this->getOption('core_path', $config, $this->modx->getOption('core_path') . 'components/moddevtools/');
$assetsUrl = $this->getOption('assets_url', $config, $this->modx->getOption('assets_url') . 'components/moddevtools/');
$debug = $this->getOption('debug', $config, false);
// Load some default paths for easier management
$this->config = array_merge(array('namespace' => $this->namespace, 'version' => $this->version, 'assetsUrl' => $assetsUrl, 'cssUrl' => $assetsUrl . 'css/', 'jsUrl' => $assetsUrl . 'js/', 'imagesUrl' => $assetsUrl . 'images/', 'connectorUrl' => $assetsUrl . 'connector.php', 'corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'chunksPath' => $corePath . 'elements/chunks/', 'templatesPath' => $corePath . 'elements/templates/', 'chunkSuffix' => '.chunk.tpl', 'snippetsPath' => $corePath . 'elements/snippets/', 'processorsPath' => $corePath . 'processors/'), $config);
// set default options
$this->config = array_merge($this->config, array('debug' => $debug, 'accessRegenerate' => $this->modx->user->get('sudo') || $this->modx->hasPermission('system_perform_maintenance_tasks'), 'viewChunk' => $this->modx->user->get('sudo') || $this->modx->hasPermission('view_chunk'), 'saveChunk' => $this->modx->user->get('sudo') || $this->modx->hasPermission('save_chunk'), 'viewTemplate' => $this->modx->user->get('sudo') || $this->modx->hasPermission('view_template'), 'saveTemplate' => $this->modx->user->get('sudo') || $this->modx->hasPermission('save_template'), 'viewSnippet' => $this->modx->user->get('sudo') || $this->modx->hasPermission('view_snippet'), 'editSnippet' => $this->modx->user->get('sudo') || $this->modx->hasPermission('edit_snippet'), 'saveSnippet' => $this->modx->user->get('sudo') || $this->modx->hasPermission('save_snippet'), 'viewResource' => $this->modx->user->get('sudo') || $this->modx->hasPermission('view_document'), 'saveResource' => $this->modx->user->get('sudo') || $this->modx->hasPermission('save_document'), 'extractLines' => 6, 'extractEllips' => '...', 'extractSeparator' => '<br>', 'extractQuantity' => 1, 'pcreModifier' => 'u'));
$this->modx->addPackage('moddevtools', $this->config['modelPath']);
$this->modx->lexicon->load('moddevtools:default');
}
示例11: array
/**
* @param modX $modx
* @param array $config
*/
function __construct(modX &$modx, array $config = array())
{
$this->modx =& $modx;
$this->ms2Gallery = $this->modx->getService('ms2Gallery', 'ms2Gallery', MODX_CORE_PATH . 'components/ms2gallery/model/ms2gallery/');
$corePath = $this->modx->getOption('ms2galleryForm.core_path', $config, $this->modx->getOption('core_path') . 'components/ms2galleryform/');
$assetsUrl = $this->modx->getOption('ms2galleryForm.assets_url', $config, $this->modx->getOption('assets_url') . 'components/ms2galleryform/');
$actionUrl = $this->modx->getOption('ms2galleryForm.action_url', $config, $assetsUrl . 'action.php');
$connectorUrl = $assetsUrl . 'connector.php';
$this->config = array_merge(array('assetsUrl' => $assetsUrl, 'cssUrl' => $assetsUrl . 'css/', 'jsUrl' => $assetsUrl . 'js/', 'imagesUrl' => $assetsUrl . 'images/', 'connector_url' => $connectorUrl, 'actionUrl' => $actionUrl, 'corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'ctx' => 'web', 'json_response' => false), $config);
$this->modx->addPackage('ms2galleryForm', $this->config['modelPath']);
$this->modx->lexicon->load('ms2galleryform:default');
$this->authenticated = $this->modx->user->isAuthenticated($this->modx->context->get('key'));
}
示例12: array
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('formsave.core_path', null, $modx->getOption('core_path') . 'components/formsave/');
$assetsPath = $this->modx->getOption('formsave.assets_path', null, $modx->getOption('assets_path') . 'components/formsave/');
$assetsUrl = $this->modx->getOption('formsave.assets_url', null, $modx->getOption('assets_url') . 'components/formsave/');
$this->config = array_merge(array('corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'processorsPath' => $corePath . 'processors/', 'controllersPath' => $corePath . 'controllers/', 'chunksPath' => $corePath . 'elements/chunks/', 'snippetsPath' => $corePath . 'elements/snippets/', 'baseUrl' => $assetsUrl, 'cssUrl' => $assetsUrl . 'css/', 'jsUrl' => $assetsUrl . 'js/', 'connectorUrl' => $assetsUrl . 'connector.php', 'thread' => '', 'tplformsaveAddComment' => '', 'tplformsaveComment' => '', 'tplformsaveCommentOptions' => '', 'tplformsaveComments' => '', 'tplformsaveLoginToComment' => '', 'tplformsaveReport' => ''), $config);
$this->modx->addPackage('formsave', $this->config['modelPath']);
if ($this->modx->lexicon) {
$this->modx->lexicon->load('formsave:default');
}
}
示例13: add
public static function add(phpThumbOn $ThumbOn, modX $modx)
{
$from = $ThumbOn->getOption('input');
$to = $ThumbOn->getOption('_cacheFileName');
$options = $ThumbOn->getOption('_options', array('f' => $ThumbOn::DEFAULT_EXT));
$noImage = $ThumbOn->getOption('noimage');
$modx->addPackage("phpthumbon", $ThumbOn->getOption('modelPath'));
switch ($ThumbOn->getOption('queue')) {
case 2:
//Отправляем в очередь и сжимаем картику noimage
$path = $ThumbOn->getOption('assetsPath', MODX_BASE_PATH . '/assets/') . "/components/phpthumbon/cache/";
$tmp = md5(serialize($options)) . "." . $options['f'];
$ThumbOn->makeDir($path);
if (file_exists($path . $tmp)) {
copy($path . $tmp, $to);
} else {
if ($to = $ThumbOn->loadResizer($noImage, $to)) {
copy($to, $path . $tmp);
}
}
$modx->newObject("ThumbImages", array('image' => $from, 'cache_image' => $to, 'config' => $options, 'isend' => $from == $noImage))->save();
break;
case 1:
default:
//Отправляем в очередь и сразу отдаем картинку noimage
if (!file_exists($to)) {
copy($noImage, $to);
}
$modx->newObject("ThumbImages", array('image' => $from, 'cache_image' => $to, 'config' => $options, 'isend' => 0))->save();
break;
}
return $to;
}
示例14: loadModels
/**
* Loads specified list of packages models
*/
public function loadModels()
{
if (empty($this->config['loadModels'])) {
return;
}
$time = microtime(true);
$models = array();
if (strpos(ltrim($this->config['loadModels']), '{') === 0) {
$tmp = $this->modx->fromJSON($this->config['loadModels']);
foreach ($tmp as $k => $v) {
$v = trim(strtolower($v));
$models[$k] = strpos($v, MODX_CORE_PATH) === false ? MODX_CORE_PATH . ltrim($v, '/') : $v;
}
} else {
$tmp = array_map('trim', explode(',', $this->config['loadModels']));
foreach ($tmp as $v) {
$models[$v] = MODX_CORE_PATH . 'components/' . strtolower($v) . '/model/';
}
}
if (!empty($models)) {
foreach ($models as $k => $v) {
$t = '/' . str_replace(MODX_BASE_PATH, '', $v);
if ($this->modx->addPackage(strtolower($k), $v)) {
$this->addTime('Loaded model "' . $k . '" from "' . $t . '"', microtime(true) - $time);
} else {
$this->addTime('Could not load model "' . $k . '" from "' . $t . '"', microtime(true) - $time);
}
$time = microtime(true);
}
}
$this->config['loadModels'] = '';
}
示例15: __construct
public function __construct(modX &$modx, array $config = array())
{
$this->modx =& $modx;
$corePath = $this->modx->getOption('msearch2.core_path', $config, $this->modx->getOption('core_path') . 'components/msearch2/');
$assetsUrl = $this->modx->getOption('msearch2.assets_url', $config, $this->modx->getOption('assets_url') . 'components/msearch2/');
$actionUrl = $this->modx->getOption('msearch2.action_url', $config, $assetsUrl . 'action.php');
$connectorUrl = $assetsUrl . 'connector.php';
$this->config = array_merge(array('assetsUrl' => $assetsUrl, 'cssUrl' => $assetsUrl . 'css/', 'jsUrl' => $assetsUrl . 'js/', 'imagesUrl' => $assetsUrl . 'images/', 'customPath' => $corePath . 'custom/', 'connectorUrl' => $connectorUrl, 'actionUrl' => $actionUrl, 'corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'templatesPath' => $corePath . 'elements/templates/', 'processorsPath' => $corePath . 'processors/', 'cacheTime' => 1800, 'languages' => array('ru_RU' => array('storage' => 'file'), 'en_EN' => array('storage' => 'file')), 'min_word_length' => $this->modx->getOption('mse2_index_min_words_length', null, 3, true), 'exact_match_bonus' => $this->modx->getOption('mse2_search_exact_match_bonus', null, 5, true), 'all_words_bonus' => $this->modx->getOption('mse2_search_all_words_bonus', null, 5, true), 'introCutBefore' => 50, 'introCutAfter' => 250, 'filter_delimeter' => '|', 'method_delimeter' => ':', 'values_delimeter' => ',', 'split_words' => $this->modx->getOption('mse2_search_split_words', null, '#\\s#', true), 'split_all' => '#\\s|[,.:;!?"\'(){}\\/\\#]#', 'suggestionsRadio' => array()), $config);
if (!is_array($this->config['languages'])) {
$this->config['languages'] = $modx->fromJSON($this->config['languages']);
}
if (!is_array($this->config['suggestionsRadio'])) {
$this->config['suggestionsRadio'] = array_map('trim', explode(',', $this->config['suggestionsRadio']));
}
$this->modx->addPackage('msearch2', $this->config['modelPath']);
$this->modx->lexicon->load('msearch2:default');
}