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


PHP PEAR_Config::singleton方法代码示例

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


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

示例1: getConfig

 public function getConfig()
 {
     if (!$this->_config) {
         $pear_dir = $this->getPearDir();
         $config = PEAR_Config::singleton($pear_dir . DS . 'pear.ini', '-');
         $config->set('auto_discover', 1);
         $config->set('cache_ttl', 60);
         #$config->set('preferred_state', 'beta');
         $config->set('bin_dir', $pear_dir);
         $config->set('php_dir', $pear_dir . DS . 'php');
         $config->set('download_dir', $pear_dir . DS . 'download');
         $config->set('temp_dir', $pear_dir . DS . 'temp');
         $config->set('data_dir', $pear_dir . DS . 'data');
         $config->set('cache_dir', $pear_dir . DS . 'cache');
         $config->set('test_dir', $pear_dir . DS . 'tests');
         $config->set('doc_dir', $pear_dir . DS . 'docs');
         foreach ($config->getKeys() as $key) {
             if (!(substr($key, 0, 5) === 'mage_' && substr($key, -4) === '_dir')) {
                 continue;
             }
             $config->set($key, preg_replace('#^\\.#', $this->getBaseDir(), $config->get($key)));
             #echo $key.' : '.$config->get($key).'<br>';
         }
         $reg = $this->getRegistry();
         $config->setRegistry($reg);
         PEAR_DependencyDB::singleton($config, $pear_dir . DS . 'php' . DS . '.depdb');
         PEAR_Frontend::setFrontendObject($this->getFrontend());
         #PEAR_Command::registerCommands(false, $pear_dir.DS.'php'.DS.'PEAR'.DS.'Command'.DS);
         $this->_config = $config;
     }
     return $this->_config;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:32,代码来源:Pear.php

示例2: setup

 function setup(&$installer, $pkg, $atts, $file)
 {
     /* Check for proper setup. */
     $pear_config = PEAR_Config::singleton();
     if (!$pear_config->get('horde_dir')) {
         return PEAR::raiseError('Missing "horde_dir" configuration in PEAR.');
     }
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:8,代码来源:Horde.php

示例3: renderTxt

 function renderTxt()
 {
     $date = date('Y-m-d');
     if ($this->query('date')) {
         $post = $this->query();
         $date = $post['date']['Y'] . '-' . $post['date']['M'] . '-' . $post['date']['d'];
     }
     // Ensures that PEAR uses correct config file.
     PEAR_Config::singleton(PATH_ROOT . '.pearrc');
     $this->db->query("SELECT tilmelding.id, tilmelding.dato_slut\n            FROM langtkursus_tilmelding tilmelding\n                INNER JOIN langtkursus ON langtkursus.id = tilmelding.kursus_id\n                INNER JOIN adresse ON tilmelding.adresse_id = adresse.id\n            WHERE\n                ((tilmelding.dato_slut > langtkursus.dato_slut AND tilmelding.dato_start < DATE_ADD('{$date}', INTERVAL 3 DAY) AND tilmelding.dato_slut > NOW())\n                OR (tilmelding.dato_slut <= langtkursus.dato_slut AND tilmelding.dato_start < DATE_ADD('{$date}', INTERVAL 3 DAY) AND tilmelding.dato_slut > '{$date}')\n                OR (tilmelding.dato_slut = '0000-00-00' AND langtkursus.dato_start < DATE_ADD('{$date}', INTERVAL 3 DAY) AND langtkursus.dato_slut > '{$date}'))\n                AND tilmelding.active = 1\n            ORDER BY adresse.fornavn ASC, adresse.efternavn ASC");
     $list = array();
     $i = 0;
     while ($this->db->nextRecord()) {
         $t = new VIH_Model_LangtKursus_Tilmelding($this->db->f('id'));
         // strange way to do it, but only way to get the header match data!
         $list[$i][3] = $t->get('navn');
         $list[$i][5] = $t->get('email');
         $list[$i][6] = $t->get('adresse');
         $list[$i][7] = $t->get('postby');
         $list[$i][8] = $t->get('postnr');
         $list[$i][11] = $t->get('telefon');
         // $list[$i][10] = $t->get('nationalitet');
         $list[$i][13] = $t->get('mobil');
         $i++;
     }
     $address_book = new Contact_AddressBook();
     $csv_builder = $address_book->createBuilder('csv_wab');
     if (PEAR::isError($csv_builder)) {
         throw new Exception('CSV_builder error: ' . $csv_builder->getUserInfo());
     }
     $result = $csv_builder->setData($list);
     if (PEAR::isError($result)) {
         throw new Exception('CSV_builder data error: ' . $result->getUserInfo());
     }
     // @todo some error in the build. It has been traced back to getConfig();
     $result = $csv_builder->build();
     if (PEAR::isError($result)) {
         throw new Exception('CSV_builder build error: ' . $result->getUserInfo());
     }
     // This could be nice, but there is an error in the method!
     // echo $csv_builder->download('holdliste');
     // instead the following should do the job!
     if (headers_sent()) {
         throw new Exception('Cannot process headers, headers already sent');
     }
     $filename = 'holdliste.csv';
     if (Net_UserAgent_Detect::isIE()) {
         // IE need specific headers
         header('Content-Disposition: inline; filename="' . $filename . '"');
         header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
         header('Pragma: public');
     } else {
         header('Content-Disposition: attachment; filename="' . $filename . '"');
         header('Pragma: no-cache');
     }
     header('Content-Type: ' . $csv_builder->mime);
     return $csv_builder->result;
 }
开发者ID:vih,项目名称:intranet.vih.dk,代码行数:58,代码来源:ExportCSV.php

示例4: getConfigDir

 public static function getConfigDir()
 {
     $er = error_reporting();
     error_reporting(0);
     require_once 'PEAR/Config.php';
     $global_config_dir = \PEAR_Config::singleton()->get('cfg_dir');
     error_reporting($er);
     return $global_config_dir;
 }
开发者ID:mikejw,项目名称:empathy,代码行数:9,代码来源:Pear.php

示例5: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     self::$_migrationDir = __DIR__ . '/../../../../migration/Horde/Lock';
     if (!is_dir(self::$_migrationDir)) {
         error_reporting(E_ALL & ~E_DEPRECATED);
         self::$_migrationDir = PEAR_Config::singleton()->get('data_dir', null, 'pear.horde.org') . '/Horde_Lock/migration';
         error_reporting(E_ALL | E_STRICT);
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:9,代码来源:SqlTest.php

示例6: __construct

 /**
  * Constructor for the data repository
  */
 private function __construct()
 {
     $pearDataDir = PEAR_Config::singleton()->get('data_dir') . DIRECTORY_SEPARATOR . 'Xinc';
     $customInstallDataDir = dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'data';
     if (is_dir($pearDataDir)) {
         $this->baseDir = $pearDataDir;
     } else {
         if (is_dir($customInstallDataDir)) {
             $this->baseDir = $customInstallDataDir;
         }
     }
 }
开发者ID:google-code-backups,项目名称:xinc,代码行数:15,代码来源:Repository.php

示例7: PEAR_RunTest

 /**
  * An object that supports the PEAR_Common->log() signature, or null
  * @param PEAR_Common|null
  */
 function PEAR_RunTest($logger = null, $options = array())
 {
     $this->ini_overwrites[] = 'error_reporting=' . E_ALL;
     if (is_null($logger)) {
         require_once 'PEAR/Common.php';
         $logger = new PEAR_Common();
     }
     $this->_logger = $logger;
     $this->_options = $options;
     $conf =& PEAR_Config::singleton();
     $this->_php = $conf->get('php_bin');
 }
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:16,代码来源:RunTest.php

示例8: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     self::$logger = new Horde_Log_Logger(new Horde_Log_Handler_Cli());
     //self::$db->setLogger(self::$logger);
     self::$dir = __DIR__ . '/../../../../migration/Horde/History';
     if (!is_dir(self::$dir)) {
         error_reporting(E_ALL & ~E_DEPRECATED);
         self::$dir = PEAR_Config::singleton()->get('data_dir', null, 'pear.horde.org') . '/Horde_History/migration';
         error_reporting(E_ALL | E_STRICT);
     }
     self::$history = new Horde_History_Sql('test_user', self::$db);
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:13,代码来源:Base.php

示例9: _getCache

 protected function _getCache($params = array())
 {
     $logger = new Horde_Log_Logger(new Horde_Log_Handler_Cli());
     //$this->db->setLogger($logger);
     $dir = __DIR__ . '/../../../../migration/Horde/Cache';
     if (!is_dir($dir)) {
         error_reporting(E_ALL & ~E_DEPRECATED);
         $dir = PEAR_Config::singleton()->get('data_dir', null, 'pear.horde.org') . '/Horde_Cache/migration';
         error_reporting(E_ALL | E_STRICT);
     }
     $this->migrator = new Horde_Db_Migration_Migrator($this->db, null, array('migrationsPath' => $dir, 'schemaTableName' => 'horde_cache_schema_info'));
     $this->migrator->up();
     return new Horde_Cache(new Horde_Cache_Storage_File(array_merge(array('db' => $this->db), $params)));
 }
开发者ID:horde,项目名称:horde,代码行数:14,代码来源:Base.php

示例10: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $logger = new Horde_Log_Logger(new Horde_Log_Handler_Cli());
     //self::$db->setLogger($logger);
     $dir = __DIR__ . '/../../../../../migration/Horde/Alarm';
     if (!is_dir($dir)) {
         error_reporting(E_ALL & ~E_DEPRECATED);
         $dir = PEAR_Config::singleton()->get('data_dir', null, 'pear.horde.org') . '/Horde_Alarm/migration';
         error_reporting(E_ALL | E_STRICT);
     }
     self::$migrator = new Horde_Db_Migration_Migrator(self::$db, null, array('migrationsPath' => $dir, 'schemaTableName' => 'horde_alarm_test_schema'));
     self::$migrator->up();
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:14,代码来源:Base.php

示例11: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $logger = new Horde_Log_Logger(new Horde_Log_Handler_Cli());
     //self::$db->setLogger($logger);
     $dir = dirname(__FILE__) . '/../../../../../migration/Horde/SessionHandler';
     if (!is_dir($dir)) {
         error_reporting(E_ALL & ~E_DEPRECATED);
         $dir = PEAR_Config::singleton()->get('data_dir', null, 'pear.horde.org') . '/Horde_SessionHandler/migration';
         error_reporting(E_ALL | E_STRICT);
     }
     self::$migrator = new Horde_Db_Migration_Migrator(self::$db, null, array('migrationsPath' => $dir, 'schemaTableName' => 'horde_sessionhandler_schema_info'));
     self::$migrator->up();
     self::$handler = new Horde_SessionHandler_Storage_Sql(array('db' => self::$db));
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:15,代码来源:Base.php

示例12: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     //$logger = new Horde_Log_Logger(new Horde_Log_Handler_Cli());
     //self::$db->setLogger($logger);
     $dir = __DIR__ . '/../../../../../../migration/Horde/Prefs';
     if (!is_dir($dir)) {
         error_reporting(E_ALL & ~E_DEPRECATED);
         $dir = PEAR_Config::singleton()->get('data_dir', null, 'pear.horde.org') . '/Horde_Prefs/migration';
         error_reporting(E_ALL | E_STRICT);
     }
     self::$migrator = new Horde_Db_Migration_Migrator(self::$db, null, array('migrationsPath' => $dir, 'schemaTableName' => 'horde_prefs_schema_info'));
     self::$migrator->up();
     self::$db->insert('INSERT INTO horde_prefs (pref_uid, pref_scope, pref_name, pref_value) VALUES (?, ?, ?, ?)', array('joe', 'horde', 'theme', new Horde_Db_Value_Binary('silver')));
     self::$prefs = new Horde_Prefs_Storage_Sql('joe', array('db' => self::$db));
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:15,代码来源:Base.php

示例13: infoFromTgzFile

 /**
  * Returns information about a package file.  Expects the name of
  * a gzipped tar file as input.
  *
  * @param string  $file  name of .tgz file
  *
  * @return array  array with package information
  *
  * @access public
  * @deprecated use PEAR_PackageFile->fromTgzFile() instead
  *
  */
 function infoFromTgzFile($file)
 {
     $config =& PEAR_Config::singleton();
     $packagefile = new PEAR_PackageFile($config);
     $pf =& $packagefile->fromTgzFile($file, PEAR_VALIDATE_NORMAL);
     if (PEAR::isError($pf)) {
         $errs = $pf->getUserinfo();
         if (is_array($errs)) {
             foreach ($errs as $error) {
                 $e = $this->raiseError($error['message'], $error['code'], null, null, $error);
             }
         }
         return $pf;
     }
     return $this->_postProcessValidPackagexml($pf);
 }
开发者ID:stof,项目名称:pearweb,代码行数:28,代码来源:apidoc-queue.php

示例14: __construct

 public function __construct()
 {
     // Create the local PEAR config.
     if (!@(include_once 'PEAR/Config.php') || !@(include_once 'PEAR/PackageFile.php')) {
         throw new Exception('PEAR libraries are not in the PHP include_path.');
     }
     /* We are heavily relying on the PEAR libraries which are not clean
      * with regard to E_STRICT. */
     if (defined('E_DEPRECATED')) {
         error_reporting(E_ALL & ~E_STRICT & ~E_DEPRECATED);
     } else {
         error_reporting(E_ALL & ~E_STRICT);
     }
     $pear_config = PEAR_Config::singleton();
     $this->pear_pkg = new PEAR_PackageFile($pear_config);
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:16,代码来源:pear_package_parse.php

示例15: PEAR_RunTest

 /**
  * An object that supports the PEAR_Common->log() signature, or null
  * @param PEAR_Common|null
  */
 function PEAR_RunTest($logger = null, $options = array())
 {
     if (!defined('E_DEPRECATED')) {
         define('E_DEPRECATED', 0);
     }
     if (!defined('E_STRICT')) {
         define('E_STRICT', 0);
     }
     $this->ini_overwrites[] = 'error_reporting=' . (E_ALL & ~(E_DEPRECATED | E_STRICT));
     if (is_null($logger)) {
         $logger = new PEAR_Common();
     }
     $this->_logger = $logger;
     $this->_options = $options;
     $conf =& PEAR_Config::singleton();
     $this->_php = $conf->get('php_bin');
 }
开发者ID:rjsmelo,项目名称:tiki,代码行数:21,代码来源:RunTest.php


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