• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP modX类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中modX的典型用法代码示例。如果您正苦于以下问题:PHP modX类的具体用法?PHP modX怎么用?PHP modX使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了modX类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * 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;
         }
     }
 }
开发者ID:Bruno17,项目名称:xdbedit,代码行数:36,代码来源:xdbedit.class.php


示例2: 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;
 }
开发者ID:gvozdb,项目名称:phpthumbon,代码行数:33,代码来源:QueueThumb.class.php


示例3: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     require_once dirname(__FILE__) . '/build.config.php';
     require_once dirname(__FILE__) . '/uthelpers.class.php';
     require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
     $modx = new modX();
     $modx->initialize('mgr');
     $modx->getService('error', 'error.modError', '', '');
     $this->utHelpers = new UtHelpers();
     $this->mc = new MyComponentProject($modx);
     $this->mc->init(array(), 'unittest');
     $this->mc->createCategories();
     $this->mc->createBasics();
     $this->modx =& $this->mc->modx;
     if ($this->mc->props['categories']['UnitTest']['category'] != 'UnitTest') {
         die('wrong config');
     }
     if (strstr($this->mc->targetRoot, 'unittest')) {
         // $this->utHelpers->rrmdir($this->mc->targetRoot);
     } else {
         die('Wrong Target Root!');
     }
     $modx->setLogLevel(modX::LOG_LEVEL_INFO);
     $modx->setLogTarget('ECHO');
 }
开发者ID:mooror,项目名称:MyComponent,代码行数:29,代码来源:exporttest.php


示例4: _modProcessMenus

function _modProcessMenus(modX &$modx, &$output, $menus, &$childrenCt, $showDescriptions = true)
{
    foreach ($menus as $menu) {
        if (!empty($menu['permissions'])) {
            $permissions = array();
            $exploded = explode(',', $menu['permissions']);
            foreach ($exploded as $permission) {
                $permissions[trim($permission)] = true;
            }
            if (!empty($permissions) && !$modx->hasPermission($permissions)) {
                continue;
            }
        }
        $smTpl = '<li>' . "\n";
        $description = !empty($menu['description']) ? '<span class="description">' . $menu['description'] . '</span>' . "\n" : '';
        if (!empty($menu['handler'])) {
            $smTpl .= '<a href="javascript:;" onclick="' . str_replace('"', '\'', $menu['handler']) . '">' . $menu['text'] . ($showDescriptions ? $description : '') . '</a>' . "\n";
        } else {
            $url = '?a=' . $menu['action'] . $menu['params'];
            $smTpl .= '<a href="' . $url . '">' . $menu['text'] . ($showDescriptions ? $description : '') . '</a>' . "\n";
        }
        if (!empty($menu['children'])) {
            $smTpl .= '<ul class="modx-subsubnav">' . "\n";
            _modProcessMenus($modx, $smTpl, $menu['children'], $childrenCt, $showDescriptions);
            $smTpl .= '</ul>' . "\n";
        }
        $smTpl .= '</li>';
        $output .= $smTpl;
        $childrenCt++;
    }
}
开发者ID:e-gob,项目名称:apps.gob.cl,代码行数:31,代码来源:header.php


示例5: getInstance

 /**
  * Return the appropriate Resource controller class based on the class_key request parameter
  * 
  * @static
  * @param modX $modx A reference to the modX instance
  * @param string $className The controller class name that is attempting to be loaded
  * @param array $config An array of configuration options for the action
  * @return modManagerController The proper controller class
  */
 public static function getInstance(modX &$modx, $className, array $config = array())
 {
     $resourceClass = 'modDocument';
     $isDerivative = false;
     if (!empty($_REQUEST['class_key'])) {
         $isDerivative = true;
         $resourceClass = in_array($_REQUEST['class_key'], array('modDocument', 'modResource')) ? 'modResource' : $_REQUEST['class_key'];
     } else {
         if (!empty($_REQUEST['id'])) {
             /** @var modResource $resource */
             $resource = $modx->getObject('modResource', $_REQUEST['id']);
             if ($resource && !in_array($resource->get('class_key'), array('modDocument', 'modResource'))) {
                 $isDerivative = true;
                 $resourceClass = $resource->get('class_key');
             }
         }
     }
     if ($isDerivative) {
         $resourceClass = str_replace(array('../', '..', '/', '\\'), '', $resourceClass);
         $delegateView = $modx->call($resourceClass, 'getControllerPath', array(&$modx));
         $action = strtolower(str_replace(array('Resource', 'ManagerController'), '', $className));
         $className = str_replace('mod', '', $resourceClass) . ucfirst($action) . 'ManagerController';
         $controllerFile = $delegateView . $action . '.class.php';
         require_once $controllerFile;
     }
     $controller = new $className($modx, $config);
     $controller->resourceClass = $resourceClass;
     return $controller;
 }
开发者ID:rosstimson,项目名称:revolution,代码行数:38,代码来源:resource.class.php


示例6: refreshURIs

 /**
  * Refresh Resource URI fields for children of the specified parent.
  *
  * @static
  * @param modX &$modx A reference to a valid modX instance.
  * @param int $parent The id of a Resource parent to start from (default is 0, the root)
  * @param array $options An array of various options for the method:
  *      - resetOverrides: if true, Resources with uri_override set to true will be included
  *      - contexts: an optional array of context keys to limit the refresh scope
  * @return void
  */
 public static function refreshURIs(modX &$modx, $parent = 0, array $options = array())
 {
     $resetOverrides = array_key_exists('resetOverrides', $options) ? (bool) $options['resetOverrides'] : false;
     $contexts = array_key_exists('contexts', $options) ? explode(',', $options['contexts']) : null;
     $criteria = $modx->newQuery('linguaSiteContent');
     $criteria->where(array('lang_id' => $options['lang_id'], 'parent' => $parent));
     if (!$resetOverrides) {
         $criteria->where(array('uri_override' => false));
     }
     if (!empty($contexts)) {
         $criteria->where(array('context_key:IN' => $contexts));
     }
     /** @var Resource $resource */
     $resources = $modx->getIterator('linguaSiteContent', $criteria);
     foreach ($resources as $resource) {
         $resource->set('refreshURIs', true);
         if ($resetOverrides) {
             $resource->set('uri_override', false);
         }
         if (!$resource->get('uri_override')) {
             $resource->set('uri', '');
         }
         $resource->save();
     }
 }
开发者ID:DeFi-ManriquezLuis,项目名称:MTLTransfer,代码行数:36,代码来源:linguasitecontent.class.php


示例7: __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);
 }
开发者ID:vgrish,项目名称:twiggy,代码行数:8,代码来源:twiggyplugin.class.php


示例8: getInstance

 public static function getInstance(modX &$modx, $className, $properties = array())
 {
     $object = $modx->getObject('modResource', $properties['id']);
     $classKey = !empty($properties['class_key']) ? $properties['class_key'] : ($object ? $object->get('class_key') : 'modDocument');
     $className = 'msProductDisableCacheUpdateProcessor';
     $processor = new $className($modx, $properties);
     return $processor;
 }
开发者ID:svyatoslavteterin,项目名称:belton.by,代码行数:8,代码来源:updatemsproduct.class.php


示例9: __construct

 /**
  * Constructs the BannerY object
  *
  * @param modX &$modx A reference to the modX object
  * @param array $config An array of configuration options
  */
 function __construct(modX &$modx, array $config = array())
 {
     $this->modx =& $modx;
     $basePath = $this->modx->getOption('bannery.core_path', $config, $this->modx->getOption('core_path') . 'components/bannery/');
     $assetsUrl = $this->modx->getOption('bannery.assets_url', $config, $this->modx->getOption('assets_url') . 'components/bannery/');
     $this->config = array_merge(array('baseUrl' => $modx->getOption('base_url'), 'basePath' => $basePath, 'corePath' => $basePath, 'modelPath' => $basePath . 'model/', 'processorsPath' => $basePath . 'processors/', 'templatesPath' => $basePath . 'templates/', 'chunksPath' => $basePath . 'elements/chunks/', 'jsUrl' => $assetsUrl . 'js/', 'cssUrl' => $assetsUrl . 'css/', 'assetsUrl' => $assetsUrl, 'connectorUrl' => $assetsUrl . 'connector.php', 'managerUrl' => $this->modx->getOption('manager_url'), 'media_source' => $this->modx->getOption('bannery_media_source', null, $this->modx->getOption('default_media_source'), true)), $config);
     $this->modx->addPackage('bannery', $this->config['modelPath']);
 }
开发者ID:suasti,项目名称:BannerY,代码行数:14,代码来源:bannery.class.php


示例10: getInstance

 public static function getInstance(modX &$modx, $className, $properties = array())
 {
     $classKey = !empty($properties['class_key']) ? $properties['class_key'] : 'modDocument';
     $object = $modx->newObject($classKey);
     $className = 'msCategoryDisableCacheCreateProcessor';
     $processor = new $className($modx, $properties);
     return $processor;
 }
开发者ID:svyatoslavteterin,项目名称:belton.by,代码行数:8,代码来源:createmscategory.class.php


示例11: getInstance

 public static function getInstance(modX &$modx, $className, $properties = array())
 {
     if (isset($properties['data'])) {
         $data = (array) $modx->fromJSON($properties['data']);
         $properties = array_merge($properties, $data);
         unset($properties['data'], $data);
     }
     return parent::getInstance($modx, $className, $properties);
 }
开发者ID:Tramp1357,项目名称:atlasorg,代码行数:9,代码来源:updatefromgrid.class.php


示例12: __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));
     }
 }
开发者ID:BazMaster,项目名称:ecc,代码行数:9,代码来源:eccsystemplugin.class.php


示例13: __construct

 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');
 }
开发者ID:bendasvadim,项目名称:Schedule,代码行数:10,代码来源:schedule.class.php


示例14: 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/');
 }
开发者ID:raadhuis,项目名称:modx-basic,代码行数:10,代码来源:articlesimport.class.php


示例15: __construct

 public function __construct($modx, &$scriptProperties)
 {
     $this->scriptProperties =& $scriptProperties;
     $this->modx = $modx;
     $this->MlmSystem = $this->modx->MlmSystem;
     if (!is_object($this->MlmSystem)) {
         $this->MlmSystem = $this->modx->getService('mlmsystem');
     }
 }
开发者ID:vgrish,项目名称:mlmsystem,代码行数:9,代码来源:mlmsystemeventplugin.class.php


示例16: getList

 /**
  * Get all names of template from provider
  * @return array|\Iterator
  */
 public function getList()
 {
     $c = $this->modx->newQuery('modTemplate');
     $c->select('templatename');
     if ($c->prepare() && $c->stmt->execute()) {
         return $c->stmt->fetchAll(PDO::FETCH_COLUMN);
     }
     return array();
 }
开发者ID:qhuy61,项目名称:pdoTools,代码行数:13,代码来源:ModTemplate.php


示例17: getStats

 function getStats()
 {
     $output = '';
     $q_status = $this->modx->newQuery('msOrderStatus', array('active' => 1));
     $q_status->select('id,name,color');
     if ($q_status->prepare() && $q_status->stmt->execute()) {
         while ($row = $q_status->stmt->fetch(PDO::FETCH_ASSOC)) {
             //$output[$row['id']] = $row;
             $output['total_counts'][$row['id']] = array('name' => $row['name'], 'color' => $row['color'], 'count_orders' => $this->modx->getCount('msOrder', array('status' => $row['id'])));
         }
     }
     $q_stats_month = $this->modx->newQuery('msOrder');
     $q_stats_month->select('status,`createdon`, month(`createdon`) AS `order_month`, count(*) AS `order_count`, SUM(cart_cost) AS order_cost');
     $q_stats_month->groupby('month(`createdon`), status');
     $q_stats_month->sortby('createdon', ASC);
     if ($q_stats_month->prepare() && $q_stats_month->stmt->execute()) {
         $output['cart_cost'] = 0;
         $output['cart_count'] = 0;
         while ($row = $q_stats_month->stmt->fetch(PDO::FETCH_ASSOC)) {
             $date = date_parse($row['createdon']);
             $output['stats_month'][$date['year'] . '-' . $date['month']][$row['status']] = array('total_cost' => $row['order_cost'], 'count_orders' => $row['order_count'], 'status' => $row['status']);
             $output['cart_cost'] += $row['order_cost'];
             $output['cart_count'] += $row['order_count'];
         }
         $output['cart_cost'] = number_format($output['cart_cost'], 2, ',', ' ');
         $output['users_count'] = $this->modx->getCount('modUser', array('active' => 1, 'primary_group' => 0));
     }
     return $output;
 }
开发者ID:bendasvadim,项目名称:shopStats,代码行数:29,代码来源:minishop2.class.php


示例18: success

 /** @inheritdoc} */
 public function success($message = '', $data = array(), $placeholders = array())
 {
     if (!is_object($this->ms2)) {
         $this->ms2 = $this->modx->getService('minishop2');
     }
     return $this->ms2->success($message, $data, $placeholders);
 }
开发者ID:rafull6,项目名称:texno-service,代码行数:8,代码来源:msdeliveryhandler.class.php


示例19: __construct

 /**
  * FenomX constructor.
  *
  * @param pdoTools $pdoTools
  */
 public function __construct(pdoTools $pdoTools)
 {
     if (!class_exists('modChunkProvider')) {
         require dirname(dirname(__FILE__)) . '/fenom/Providers/ModChunk.php';
         require dirname(dirname(__FILE__)) . '/fenom/Providers/ModTemplate.php';
         require dirname(dirname(__FILE__)) . '/fenom/Providers/ModFile.php';
     }
     $provider = new modChunkProvider($pdoTools);
     parent::__construct($provider);
     $this->setCompileDir(rtrim($pdoTools->config['cachePath'], '/') . '/file');
     $this->addProvider('template', new modTemplateProvider($pdoTools));
     $this->addProvider('file', new modFileProvider($pdoTools));
     $default_options = array('disable_cache' => !$pdoTools->config['useFenomCache'], 'force_compile' => !$pdoTools->config['useFenomCache'], 'force_include' => !$pdoTools->config['useFenomCache'], 'auto_reload' => $pdoTools->config['useFenomCache']);
     if ($options = $pdoTools->modx->fromJSON($pdoTools->modx->getOption('pdotools_fenom_options'))) {
         $options = array_merge($default_options, $options);
     } else {
         $options = $default_options;
     }
     if (!$pdoTools->config['useFenomPHP']) {
         $this->removeAccessor('php');
         $options['disable_native_funcs'] = true;
     }
     $this->setOptions($options);
     $this->pdoTools = $pdoTools;
     $this->modx = $pdoTools->modx;
     $this->_addDefaultModifiers();
     $this->modx->invokeEvent('pdoToolsOnFenomInit', array('fenom' => $this, 'config' => $pdoTools->config));
 }
开发者ID:Jako,项目名称:pdoTools,代码行数:33,代码来源:_fenom.php


示例20: 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;
 }
开发者ID:OptimusCrime,项目名称:revolution,代码行数:16,代码来源:modsmarty.class.php



注:本文中的modX类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP mod_forum_post_form类代码示例发布时间:2022-05-23
下一篇:
PHP modResource类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap