当前位置: 首页>>代码示例>>PHP>>正文


PHP modX::loadClass方法代码示例

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


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

示例1: __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);
     if ($pdoClass = $modx->loadClass($fqn, '', false, true)) {
         $this->pdoTools = new $pdoClass($modx, $config);
     } elseif ($pdoClass = $modx->loadClass($fqn, MODX_CORE_PATH . 'components/pdotools/model/', false, true)) {
         $this->pdoTools = new $pdoClass($modx, $config);
     } else {
         $this->modx->log(modX::LOG_LEVEL_ERROR, 'Could not load pdoFetch from "MODX_CORE_PATH/components/pdotools/model/".');
         return false;
     }
     if ($config['hereId'] && ($currentResource = $this->pdoTools->getObject('modResource', $config['hereId']))) {
         $tmp = $modx->getParentIds($currentResource['id'], 100, array('context' => $currentResource['context_key']));
         $tmp[] = $config['hereId'];
         $this->parentTree = array_flip($tmp);
     }
     $modx->lexicon->load('pdotools:pdomenu');
     return true;
 }
开发者ID:bendasvadim,项目名称:pdoTools,代码行数:31,代码来源:pdomenu.class.php

示例2: __construct

 /**
  * @param modX $modx
  * @param array $config
  */
 public function __construct(modX &$modx, $config = array())
 {
     $this->modx =& $modx;
     $fqn = $modx->getOption('pdoTools.class', null, 'pdotools.pdotools', true);
     if ($pdoClass = $modx->loadClass($fqn, '', false, true)) {
         $this->pdoTools = new $pdoClass($modx, $config);
     } elseif ($pdoClass = $modx->loadClass($fqn, MODX_CORE_PATH . 'components/pdotools/model/', false, true)) {
         $this->pdoTools = new $pdoClass($modx, $config);
     } else {
         $this->modx->log(modX::LOG_LEVEL_ERROR, 'Could not load pdoTools from "MODX_CORE_PATH/components/pdotools/model/".');
         return false;
     }
     $modx->lexicon->load('pdotools:pdopage');
     return true;
 }
开发者ID:Piterden,项目名称:modx_testfloor,代码行数:19,代码来源:pdopage.class.php

示例3: loadDictionary

 /**
  * Load the dictionary storage mechanism
  * @return null|fiDictionary
  */
 public function loadDictionary()
 {
     if ($this->modx->loadClass('formit.fiDictionary', $this->formit->config['modelPath'], true, true)) {
         $this->dictionary = new fiDictionary($this->formit, $this->config);
     } else {
         $this->modx->log(modX::LOG_LEVEL_ERROR, '[FormIt] Could not load Dictionary class.');
     }
     return $this->dictionary;
 }
开发者ID:MobiTeam,项目名称:mirfoto,代码行数:13,代码来源:firequest.class.php

示例4: loadErrorHandler

 /**
  * Loads the error handling class for the request.
  *
  * @param string $class The class to use as the error handler.
  */
 public function loadErrorHandler($class = 'modError')
 {
     if ($className = $this->modx->loadClass('error.' . $class, '', false, true)) {
         $this->modx->error = new $className($this->modx);
     } else {
         $this->modx->log(modX::LOG_LEVEL_FATAL, 'Error handling class could not be loaded: ' . $class);
     }
 }
开发者ID:semencov-com,项目名称:affiliate,代码行数:13,代码来源:modrequest.class.php

示例5: getConnection

    /**
     * Get the connection class for the client. Defaults to cURL, then
     * fsockopen. If neither exists, returns false.
     *
     * @access public
     * @return boolean True if a connection can be made.
     */
    public function getConnection() {
        if (function_exists('curl_init')) {
            $className = $this->modx->loadClass('rest.modRestCurlClient','',false,true);
        } else if (function_exists('fsockopen')) {
            $className = $this->modx->loadClass('rest.modRestSockClient','',false,true);
        }

        if ($className) {
            $this->conn = new $className($this->modx,$this->config);
        }
        return is_object($this->conn);
    }
开发者ID:ncrossland,项目名称:revolution,代码行数:19,代码来源:modrestclient.class.php

示例6: __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/');
 }
开发者ID:sebastian-marinescu,项目名称:Scheduler,代码行数:16,代码来源:scheduler.class.php

示例7: initialize

    /**
     * Initializes mSearch2 into different contexts.
     *
     * @access public
     * @param string $ctx The context to load. Defaults to web.
     *
     * @return boolean
     */
    public function initialize($ctx = 'web', $scriptProperties = array())
    {
        switch ($ctx) {
            case 'mgr':
                if (!$this->modx->loadClass('msearch2.request.mSearch2ControllerRequest', $this->config['modelPath'], true, true)) {
                    return 'Could not load controller request handler.';
                }
                $this->request = new mSearch2ControllerRequest($this);
                return $this->request->handleRequest();
                break;
            default:
                $this->config = array_merge($this->config, $scriptProperties);
                $this->config['ctx'] = $ctx;
                if (!empty($this->initialized[$ctx])) {
                    return true;
                }
                if (!defined('MODX_API_MODE') || !MODX_API_MODE) {
                    $config = $this->makePlaceholders($this->config);
                    if ($css = $this->modx->getOption('mse2_frontend_css')) {
                        $this->modx->regClientCSS(str_replace($config['pl'], $config['vl'], $css));
                    }
                    if ($js = trim($this->modx->getOption('mse2_frontend_js'))) {
                        $this->modx->regClientStartupScript(str_replace('					', '', '
						<script type="text/javascript">
						mSearch2Config = {
							cssUrl: "' . $this->config['cssUrl'] . 'web/"
							,jsUrl: "' . $this->config['jsUrl'] . 'web/"
							,actionUrl: "' . $this->config['actionUrl'] . '"
							,pageId: ' . $this->modx->resource->id . '
							,filter_delimeter: "' . $this->config['filter_delimeter'] . '"
							,method_delimeter: "' . $this->config['method_delimeter'] . '"
							,values_delimeter: "' . $this->config['values_delimeter'] . '"
						};
						</script>
					'), true);
                        if (!empty($js) && preg_match('/\\.js$/i', $js)) {
                            $this->modx->regClientScript(str_replace('							', '', '
							<script type="text/javascript">
							if(typeof jQuery == "undefined") {
								document.write("<script src=\\"' . $this->config['jsUrl'] . 'web/lib/jquery.min.js\\" type=\\"text/javascript\\"><\\/script>");
							}
							</script>
							'), true);
                            $this->modx->regClientScript(str_replace($config['pl'], $config['vl'], $js));
                        }
                    }
                }
                $this->initialized[$ctx] = true;
        }
        return true;
    }
开发者ID:bendasvadim,项目名称:mSearch2,代码行数:59,代码来源:msearch2.class.php

示例8: prepareOutput

 /**
  * Prepare the output in this method to allow processing of this without depending on the actual render of the output
  * @param string $value
  * @param integer $resourceId The id of the resource; 0 defaults to the
  * current resource.
  * @return string
  */
 public function prepareOutput($value, $resourceId = 0)
 {
     /* Allow custom source types to manipulate the output URL for image/file tvs */
     $mTypes = $this->xpdo->getOption('manipulatable_url_tv_output_types', null, 'image,file');
     $mTypes = explode(',', $mTypes);
     if (!empty($value) && in_array($this->get('type'), $mTypes)) {
         $context = !empty($resourceId) ? $this->xpdo->getObject('modResource', $resourceId)->get('context_key') : $this->xpdo->context->get('key');
         $sourceCache = $this->getSourceCache($context);
         if (!empty($sourceCache) && !empty($sourceCache['class_key'])) {
             $coreSourceClasses = $this->xpdo->getOption('core_media_sources', null, 'modFileMediaSource,modS3MediaSource');
             $coreSourceClasses = explode(',', $coreSourceClasses);
             $classKey = in_array($sourceCache['class_key'], $coreSourceClasses) ? 'sources.' . $sourceCache['class_key'] : $sourceCache['class_key'];
             if ($this->xpdo->loadClass($classKey)) {
                 /** @var modMediaSource $source */
                 $source = $this->xpdo->newObject($classKey);
                 if ($source) {
                     $source->fromArray($sourceCache, '', true, true);
                     $source->initialize();
                     $isAbsolute = strpos($value, 'http://') === 0 || strpos($value, 'https://') === 0 || strpos($value, 'ftp://') === 0;
                     if (!$isAbsolute) {
                         $value = $source->prepareOutputUrl($value);
                     }
                 }
             }
         }
     }
     return $value;
 }
开发者ID:ChrstnMgcn,项目名称:revolution,代码行数:35,代码来源:modtemplatevar.class.php

示例9: _initRegister

 /**
  * Initialize a register within the registry.
  *
  * @access protected
  * @param string $key The key of the registry
  * @param string $class The class of the modRegister implementation to
  * initialize.
  * @param array $options An optional array of register options.
  * @return modRegister The register instance.
  */
 protected function _initRegister($key, $class, array $options = array()) {
     $register = null;
     if ($className = $this->modx->loadClass($class, '', false, true)) {
         $register = new $className($this->modx, $key, $options);
     }
     return $register;
 }
开发者ID:raf3600,项目名称:revolution,代码行数:17,代码来源:modregistry.class.php

示例10: __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');
 }
开发者ID:Jako,项目名称:pdoTools,代码行数:31,代码来源:pdomenu.class.php

示例11: initialize

 /**
  * Initializes mSearch2 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())
 {
     switch ($ctx) {
         case 'mgr':
             if (!$this->modx->loadClass('msearch2.request.mSearch2ControllerRequest', $this->config['modelPath'], true, true)) {
                 return 'Could not load controller request handler.';
             }
             $this->request = new mSearch2ControllerRequest($this);
             return $this->request->handleRequest();
             break;
         default:
             $this->config = array_merge($this->config, $scriptProperties);
             $this->config['ctx'] = $ctx;
             if (!defined('MODX_API_MODE') || !MODX_API_MODE) {
                 $config = $this->makePlaceholders($this->config);
                 if ($css = trim($this->modx->getOption('mse2_frontend_css'))) {
                     $this->modx->regClientCSS(str_replace($config['pl'], $config['vl'], $css));
                 }
                 if ($js = trim($this->modx->getOption('mse2_frontend_js'))) {
                     $this->modx->regClientScript(str_replace($config['pl'], $config['vl'], $js));
                 }
             }
     }
     return true;
 }
开发者ID:svyatoslavteterin,项目名称:belton.by,代码行数:33,代码来源:msearch2.class.php

示例12: loadHooks

 /**
  * Loads the Hooks class.
  *
  * @access public
  * @param string $type The name of the Hooks service to load
  * @param array $config array An array of configuration parameters for the
  * hooks class
  * @return LoginHooks An instance of the fiHooks class.
  */
 public function loadHooks($type, $config = array())
 {
     if (!$this->modx->loadClass('login.LoginHooks', $this->config['modelPath'], true, true)) {
         $this->modx->log(modX::LOG_LEVEL_ERROR, '[Login] Could not load Hooks class.');
         return false;
     }
     $this->{$type} = new LoginHooks($this->login, $this, $config);
     return $this->{$type};
 }
开发者ID:DeFi-ManriquezLuis,项目名称:MTLTransfer,代码行数:18,代码来源:logincontroller.class.php

示例13: initPDF

 /**
  * Initialize the modPDF class
  *
  * @param array $options
  */
 public function initPDF($options)
 {
     // Autoload composer classes
     require $this->getOption('corePath') . 'vendor/autoload.php';
     if (!$this->modx->loadClass('modpdf.modpdf', $this->options['modelPath'], true, true)) {
         $this->modx->log(modX::LOG_LEVEL_ERROR, 'Could not load modPDF class.');
         return;
     }
     $this->pdf = new modPDF($this->modx, array('mode' => $this->getOption('mode', $options), 'format' => $this->getOption('format', $options), 'defaultFontSize' => $this->getOption('defaultFontSize', $options), 'defaultFont' => $this->getOption('defaultFont', $options), 'mgl' => $this->getOption('mgl', $options), 'mgr' => $this->getOption('mgr', $options), 'mgt' => $this->getOption('mgt', $options), 'mgb' => $this->getOption('mgb', $options), 'mgh' => $this->getOption('mgh', $options), 'mgf' => $this->getOption('mgf', $options), 'orientation' => $this->getOption('orientation', $options), 'customFonts' => $this->getOption('customFonts', $options)));
 }
开发者ID:Jako,项目名称:PDFResource,代码行数:15,代码来源:pdfresource.class.php

示例14: loadHooks

 /**
  * Loads the Hooks class.
  *
  * @access public
  * @param $type string The type of hook to load.
  * @param $config array An array of configuration parameters for the
  * hooks class
  * @return fiHooks An instance of the fiHooks class.
  */
 public function loadHooks($type = 'post', $config = array())
 {
     if (!$this->modx->loadClass('formit.fiHooks', $this->config['modelPath'], true, true)) {
         $this->modx->log(modX::LOG_LEVEL_ERROR, '[FormIt] Could not load Hooks class.');
         return false;
     }
     $typeVar = $type . 'Hooks';
     $this->{$typeVar} = new fiHooks($this, $config, $type);
     return $this->{$typeVar};
 }
开发者ID:svyatoslavteterin,项目名称:belton.by,代码行数:19,代码来源:formit.class.php

示例15: loadHooks

 /**
  * Loads the Hooks class.
  *
  * @access public
  * @param string $type The type of hook to load.
  * @param array $config An array of configuration parameters for the
  * hooks class
  * @return siHooks An instance of the fiHooks class.
  */
 public function loadHooks($type = 'post', $config = array())
 {
     if (!$this->modx->loadClass('simplesearch.siHooks', $this->config['modelPath'], true, true)) {
         $this->modx->log(modX::LOG_LEVEL_ERROR, '[SimpleSearch] Could not load Hooks class.');
         return false;
     }
     $type = $type . 'Hooks';
     $this->{$type} = new siHooks($this, $config);
     return $this->{$type};
 }
开发者ID:Tramp1357,项目名称:atlasorg,代码行数:19,代码来源:simplesearch.class.php


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