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


PHP modX::protect方法代码示例

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


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

示例1: __construct

 /**
  * Construct a new modX instance.
  *
  * @param string $configPath An absolute filesystem path to look for the config file.
  * @param array $options Options that can be passed to the instance.
  * @return modX A new modX instance.
  */
 public function __construct($configPath = '', array $options = array())
 {
     global $database_type, $database_server, $dbase, $database_user, $database_password, $database_connection_charset, $table_prefix;
     modX::protect();
     if (empty($configPath)) {
         $configPath = MODX_CORE_PATH . 'config/';
     }
     if (@(include $configPath . MODX_CONFIG_KEY . '.inc.php')) {
         $cachePath = MODX_CORE_PATH . 'cache/';
         if (MODX_CONFIG_KEY !== 'config') {
             $cachePath .= MODX_CONFIG_KEY . '/';
         }
         $options = array_merge(array(xPDO::OPT_CACHE_PATH => $cachePath, xPDO::OPT_TABLE_PREFIX => $table_prefix, xPDO::OPT_HYDRATE_FIELDS => true, xPDO::OPT_HYDRATE_RELATED_OBJECTS => true, xPDO::OPT_HYDRATE_ADHOC_FIELDS => true, xPDO::OPT_LOADER_CLASSES => array('modAccessibleObject'), xPDO::OPT_VALIDATOR_CLASS => 'validation.modValidator', xPDO::OPT_VALIDATE_ON_SAVE => true, 'cache_system_settings' => true), $options);
         parent::__construct($database_type . ':host=' . $database_server . ';dbname=' . trim($dbase, '`') . ';charset=' . $database_connection_charset, $database_user, $database_password, $options, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_SILENT, PDO::ATTR_PERSISTENT => false, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true));
         $this->setPackage('modx', MODX_CORE_PATH . 'model/', $table_prefix);
         $this->setLogTarget($this->getOption('log_target', null, 'FILE'));
         if (!empty($site_id)) {
             $this->site_id = $site_id;
         }
     } else {
         $this->sendError($this->getOption('error_type', null, 'unavailable'), $options);
     }
 }
开发者ID:JoeBlow,项目名称:revolution,代码行数:30,代码来源:modx.class.php

示例2: __construct

 /**
  * Construct a new modX instance.
  *
  * @param string $configPath An absolute filesystem path to look for the config file.
  * @param array $options Options that can be passed to the instance.
  * @return modX A new modX instance.
  */
 public function __construct($configPath = '', array $options = array())
 {
     global $database_dsn, $database_user, $database_password, $config_options, $table_prefix, $site_id, $uuid;
     modX::protect();
     if (empty($configPath)) {
         $configPath = MODX_CORE_PATH . 'config/';
     }
     if (@(include $configPath . MODX_CONFIG_KEY . '.inc.php')) {
         $cachePath = MODX_CORE_PATH . 'cache/';
         if (MODX_CONFIG_KEY !== 'config') {
             $cachePath .= MODX_CONFIG_KEY . '/';
         }
         $options = array_merge(array(xPDO::OPT_CACHE_KEY => 'default', xPDO::OPT_CACHE_HANDLER => 'xPDOFileCache', xPDO::OPT_CACHE_PATH => $cachePath, xPDO::OPT_TABLE_PREFIX => $table_prefix, xPDO::OPT_HYDRATE_FIELDS => true, xPDO::OPT_HYDRATE_RELATED_OBJECTS => true, xPDO::OPT_HYDRATE_ADHOC_FIELDS => true, xPDO::OPT_LOADER_CLASSES => array('modAccessibleObject'), xPDO::OPT_VALIDATOR_CLASS => 'validation.modValidator', xPDO::OPT_VALIDATE_ON_SAVE => true, 'cache_system_settings' => true, 'cache_system_settings_key' => 'system_settings'), $config_options, $options);
         parent::__construct($database_dsn, $database_user, $database_password, $options, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_SILENT, PDO::ATTR_PERSISTENT => false));
         $this->setPackage('modx', MODX_CORE_PATH . 'model/', $table_prefix);
         $this->setLogTarget($this->getOption('log_target', null, 'FILE'));
         if (!empty($site_id)) {
             $this->site_id = $site_id;
         }
         if (!empty($uuid)) {
             $this->uuid = $uuid;
         }
     } else {
         $this->sendError($this->getOption('error_type', null, 'unavailable'), $options);
     }
 }
开发者ID:hanlray,项目名称:revolution,代码行数:33,代码来源:modx.class.php

示例3: loadConfig

 /**
  * Load the modX configuration when creating an instance of modX.
  *
  * @param string $configPath An absolute path location to search for the modX config file.
  * @param array $data Data provided to initialize the instance with, overriding config file entries.
  * @param null $driverOptions Driver options for the primary connection.
  * @return array The merged config data ready for use by the modX::__construct() method.
  */
 protected function loadConfig($configPath = '', $data = array(), $driverOptions = null)
 {
     if (!is_array($data)) {
         $data = array();
     }
     modX::protect();
     if (!defined('MODX_CONFIG_KEY')) {
         define('MODX_CONFIG_KEY', 'config');
     }
     if (empty($configPath)) {
         $configPath = MODX_CORE_PATH . 'config/';
     }
     global $database_dsn, $database_user, $database_password, $config_options, $driver_options, $table_prefix, $site_id, $uuid;
     if (file_exists($configPath . MODX_CONFIG_KEY . '.inc.php') && (include $configPath . MODX_CONFIG_KEY . '.inc.php')) {
         $cachePath = MODX_CORE_PATH . 'cache/';
         if (MODX_CONFIG_KEY !== 'config') {
             $cachePath .= MODX_CONFIG_KEY . '/';
         }
         if (!is_array($config_options)) {
             $config_options = array();
         }
         if (!is_array($driver_options)) {
             $driver_options = array();
         }
         $data = array_merge(array(xPDO::OPT_CACHE_KEY => 'default', xPDO::OPT_CACHE_HANDLER => 'xPDOFileCache', xPDO::OPT_CACHE_PATH => $cachePath, xPDO::OPT_TABLE_PREFIX => $table_prefix, xPDO::OPT_HYDRATE_FIELDS => true, xPDO::OPT_HYDRATE_RELATED_OBJECTS => true, xPDO::OPT_HYDRATE_ADHOC_FIELDS => true, xPDO::OPT_VALIDATOR_CLASS => 'validation.modValidator', xPDO::OPT_VALIDATE_ON_SAVE => true, 'cache_system_settings' => true, 'cache_system_settings_key' => 'system_settings'), $config_options, $data);
         $primaryConnection = array('dsn' => $database_dsn, 'username' => $database_user, 'password' => $database_password, 'options' => array(xPDO::OPT_CONN_MUTABLE => isset($data[xPDO::OPT_CONN_MUTABLE]) ? (bool) $data[xPDO::OPT_CONN_MUTABLE] : true), 'driverOptions' => $driver_options);
         if (!array_key_exists(xPDO::OPT_CONNECTIONS, $data) || !is_array($data[xPDO::OPT_CONNECTIONS])) {
             $data[xPDO::OPT_CONNECTIONS] = array();
         }
         array_unshift($data[xPDO::OPT_CONNECTIONS], $primaryConnection);
         if (!empty($site_id)) {
             $this->site_id = $site_id;
         }
         if (!empty($uuid)) {
             $this->uuid = $uuid;
         }
     } else {
         throw new xPDOException("Could not load MODX config file.");
     }
     return $data;
 }
开发者ID:sergeiforward,项目名称:gl,代码行数:49,代码来源:modx.class.php

示例4: __construct

 /**
  * Construct a new modX instance.
  *
  * @param string $configPath An absolute filesystem path to look for the config file.
  * @param array $options Options that can be passed to the instance.
  * @return modX A new modX instance.
  */
 public function __construct($configPath = '', array $options = array())
 {
     global $database_dsn, $database_user, $database_password, $config_options, $table_prefix, $site_id, $uuid;
     modX::protect();
     if (!defined('MODX_CONFIG_KEY')) {
         define('MODX_CONFIG_KEY', 'config');
     }
     if (empty($configPath)) {
         $configPath = MODX_CORE_PATH . 'config/';
     }
     if (@(include $configPath . MODX_CONFIG_KEY . '.inc.php')) {
         $cachePath = MODX_CORE_PATH . 'cache/';
         if (MODX_CONFIG_KEY !== 'config') {
             $cachePath .= MODX_CONFIG_KEY . '/';
         }
         $options = array_merge(array(xPDO::OPT_CACHE_KEY => 'default', xPDO::OPT_CACHE_HANDLER => 'xPDOFileCache', xPDO::OPT_CACHE_PATH => $cachePath, xPDO::OPT_TABLE_PREFIX => $table_prefix, xPDO::OPT_HYDRATE_FIELDS => true, xPDO::OPT_HYDRATE_RELATED_OBJECTS => true, xPDO::OPT_HYDRATE_ADHOC_FIELDS => true, xPDO::OPT_VALIDATOR_CLASS => 'validation.modValidator', xPDO::OPT_VALIDATE_ON_SAVE => true, 'cache_system_settings' => true, 'cache_system_settings_key' => 'system_settings'), $config_options, $options);
         parent::__construct($database_dsn, $database_user, $database_password, $options, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_SILENT, PDO::ATTR_PERSISTENT => false));
         $this->setLogLevel($this->getOption('log_level', null, xPDO::LOG_LEVEL_ERROR));
         $this->setLogTarget($this->getOption('log_target', null, 'FILE'));
         $debug = $this->getOption('debug');
         switch ($debug) {
             case null:
             case '':
                 break;
             case true:
             case 1:
             case '1':
                 $this->setDebug(true);
                 break;
             case false:
             case 0:
             case '0':
                 $this->setDebug(false);
                 break;
             default:
                 if ((int) $debug > 1) {
                     $this->setDebug($debug);
                 }
                 break;
         }
         $this->setPackage('modx', MODX_CORE_PATH . 'model/', $table_prefix);
         if (!empty($site_id)) {
             $this->site_id = $site_id;
         }
         if (!empty($uuid)) {
             $this->uuid = $uuid;
         }
     } else {
         $this->sendError($this->getOption('error_type', null, 'unavailable'), $options);
     }
 }
开发者ID:rosstimson,项目名称:revolution,代码行数:58,代码来源:modx.class.php


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