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


PHP xPDO::__construct方法代码示例

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


在下文中一共展示了xPDO::__construct方法的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: __construct

 /**
  * Construct a new modX instance.
  *
  * @param string $configPath An absolute filesystem path to look for the config file.
  * @param array $options xPDO options that can be passed to the instance.
  * @param array $driverOptions PDO driver options that can be passed to the instance.
  * @return modX A new modX instance.
  */
 public function __construct($configPath = '', $options = null, $driverOptions = null)
 {
     try {
         $options = $this->loadConfig($configPath, $options, $driverOptions);
         parent::__construct(null, null, null, $options, null);
         $this->setLogLevel($this->getOption('log_level', null, xPDO::LOG_LEVEL_ERROR));
         $this->setLogTarget($this->getOption('log_target', null, 'FILE'));
         $debug = $this->getOption('debug');
         if (!is_null($debug) && $debug !== '') {
             $this->setDebug($debug);
         }
         $this->setPackage('modx', MODX_CORE_PATH . 'model/');
         $this->loadClass('modAccess');
         $this->loadClass('modAccessibleObject');
         $this->loadClass('modAccessibleSimpleObject');
         $this->loadClass('modResource');
         $this->loadClass('modElement');
         $this->loadClass('modScript');
         $this->loadClass('modPrincipal');
         $this->loadClass('modUser');
         $this->loadClass('sources.modMediaSource');
     } catch (xPDOException $xe) {
         $this->sendError('unavailable', array('error_message' => $xe->getMessage()));
     } catch (Exception $e) {
         $this->sendError('unavailable', array('error_message' => $e->getMessage()));
     }
 }
开发者ID:sergeiforward,项目名称:gl,代码行数:35,代码来源: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


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