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


PHP PEAR_Config类代码示例

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


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

示例1: load

 /**
  * @param  string  $suiteClassName
  * @param  string  $suiteClassFile
  * @return ReflectionClass
  * @throws Exception
  * @access public
  */
 public function load($suiteClassName, $suiteClassFile = '')
 {
     $suiteClassName = str_replace('.php', '', $suiteClassName);
     $suiteClassFile = !empty($suiteClassFile) ? $suiteClassFile : str_replace('_', '/', $suiteClassName) . '.php';
     if (!class_exists($suiteClassName)) {
         if (!file_exists($suiteClassFile)) {
             $config = new PEAR_Config();
             $includePaths = explode(PATH_SEPARATOR, get_include_path());
             $includePaths[] = $config->get('test_dir');
             foreach ($includePaths as $includePath) {
                 $file = $includePath . DIRECTORY_SEPARATOR . $suiteClassFile;
                 if (file_exists($file)) {
                     $suiteClassFile = $file;
                     break;
                 }
             }
         }
         PHPUnit2_Util_Fileloader::checkAndLoad($suiteClassFile);
     }
     if (class_exists($suiteClassName)) {
         return new ReflectionClass($suiteClassName);
     } else {
         throw new Exception(sprintf('Class %s could not be found in %s.', $suiteClassName, $suiteClassFile));
     }
 }
开发者ID:altesien,项目名称:FinalProject,代码行数:32,代码来源:StandardTestSuiteLoader.php

示例2: init

 /**
  * Initialize Task.
  * This method includes any necessary PHPUnit2 libraries and triggers
  * appropriate error if they cannot be found.  This is not done in header
  * because we may want this class to be loaded w/o triggering an error.
  */
 function init()
 {
     if (version_compare(PHP_VERSION, '5.0.3') < 0) {
         throw new BuildException("PHPUnit2Task requires PHP version >= 5.0.3.", $this->getLocation());
     }
     /**
      * Ugly hack to get PHPUnit version number
      */
     $config = new PEAR_Config();
     $registry = new PEAR_Registry($config->get('php_dir'));
     $pkg_info = $registry->_packageInfo("PHPUnit", null, "pear.phpunit.de");
     if ($pkg_info != NULL) {
         if (version_compare($pkg_info['version']['api'], "3.0.0") >= 0) {
             PHPUnitUtil::$installedVersion = 3;
         } else {
             PHPUnitUtil::$installedVersion = 2;
         }
     } else {
         /**
          * Try to find PHPUnit2
          */
         require_once 'PHPUnit2/Util/Filter.php';
         if (!class_exists('PHPUnit2_Util_Filter')) {
             throw new BuildException("PHPUnit2Task depends on PEAR PHPUnit2 package being installed.", $this->getLocation());
         }
         PHPUnitUtil::$installedVersion = 2;
     }
     // other dependencies that should only be loaded when class is actually used.
     require_once 'phing/tasks/ext/phpunit/PHPUnitTestRunner.php';
     require_once 'phing/tasks/ext/phpunit/BatchTest.php';
     require_once 'phing/tasks/ext/phpunit/FormatterElement.php';
     //require_once 'phing/tasks/ext/phpunit/SummaryPHPUnit2ResultFormatter.php';
     // add some defaults to the PHPUnit filter
     if (PHPUnitUtil::$installedVersion == 3) {
         require_once 'PHPUnit/Util/Filter.php';
         // point PHPUnit_MAIN_METHOD define to non-existing method
         define('PHPUnit_MAIN_METHOD', 'PHPUnitTask::undefined');
         PHPUnit_Util_Filter::addFileToFilter('PHPUnitTask.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('PHPUnitTestRunner.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('phing/Task.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('phing/Target.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('phing/Project.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('phing/Phing.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('phing.php', 'PHING');
     } else {
         require_once 'PHPUnit2/Util/Filter.php';
         PHPUnit2_Util_Filter::addFileToFilter('PHPUnitTask.php');
         PHPUnit2_Util_Filter::addFileToFilter('PHPUnitTestRunner.php');
         PHPUnit2_Util_Filter::addFileToFilter('phing/Task.php');
         PHPUnit2_Util_Filter::addFileToFilter('phing/Target.php');
         PHPUnit2_Util_Filter::addFileToFilter('phing/Project.php');
         PHPUnit2_Util_Filter::addFileToFilter('phing/Phing.php');
         PHPUnit2_Util_Filter::addFileToFilter('phing.php');
     }
 }
开发者ID:nmicht,项目名称:tlalokes-in-acst,代码行数:61,代码来源:PHPUnitTask.php

示例3: 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

示例4: 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

示例5: __construct

 /**
  * Constructor.
  *
  * Searches all installed applications and libraries for migration
  * directories and builds lists of migrateable modules and directories.
  *
  * @param string $basedir   Base directory of a Git checkout. If provided
  *                          a framework/ sub directory is searched for
  *                          migration scripts too.
  * @param string $pearconf  Path to a PEAR configuration file.
  */
 public function __construct($basedir = null, $pearconf = null)
 {
     // Loop through all applications.
     foreach ($GLOBALS['registry']->listAllApps() as $app) {
         $dir = $GLOBALS['registry']->get('fileroot', $app) . '/migration';
         if (is_dir($dir)) {
             $this->apps[] = $app;
             $this->_lower[] = Horde_String::lower($app);
             $this->dirs[] = realpath($dir);
         }
     }
     // Silence PEAR errors.
     $old_error_reporting = error_reporting();
     error_reporting($old_error_reporting & ~E_DEPRECATED);
     $pear = new PEAR_Config($pearconf);
     // Loop through local framework checkout.
     if ($basedir) {
         $packageFile = new PEAR_PackageFile($pear);
         foreach (glob($basedir . '/framework/*/migration') as $dir) {
             $package = $packageFile->fromPackageFile(dirname($dir) . '/package.xml', PEAR_VALIDATE_NORMAL);
             if ($package instanceof PEAR_Error) {
                 Horde::log(sprintf('%s: %s', $package->getMessage(), print_r($package->getUserInfo(), true)), Horde_Log::ERR);
                 continue;
             }
             $this->apps[] = $package->getName();
             $this->_lower[] = Horde_String::lower($package->getName());
             $this->dirs[] = realpath($dir);
         }
     }
     // Loop through installed PEAR packages.
     $registry = $pear->getRegistry();
     foreach (glob($pear->get('data_dir') . '/*/migration') as $dir) {
         $package = $registry->getPackage(basename(dirname($dir)), 'pear.horde.org');
         if ($package == false) {
             Horde::log("Ignoring package in directory {$dir}", Horde_Log::WARN);
             continue;
         }
         $app = $package->getName();
         if (!in_array($app, $this->apps)) {
             $this->apps[] = $app;
             $this->_lower[] = Horde_String::lower($app);
             $this->dirs[] = realpath($dir);
         }
     }
     error_reporting($old_error_reporting);
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:57,代码来源:Migration.php

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: __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

示例11: 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

示例12: _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

示例13: 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

示例14: processInstallation

 /**
  * This is called for each file to set up the directories and files
  * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
  * @param array attributes from the <file> tag
  * @param string file name
  * @return array an array consisting of:
  *
  *    1 the original, pre-baseinstalldir installation directory
  *    2 the final installation directory
  *    3 the full path to the final location of the file
  *    4 the location of the pre-installation file
  */
 function processInstallation($pkg, $atts, $file, $tmp_path, $layer = null)
 {
     if (!$this->_setup['locationconfig']) {
         return false;
     }
     if ($this->_setup['honorsbaseinstall']) {
         $dest_dir = $save_destdir = $this->config->get($this->_setup['locationconfig'], $layer, $pkg->getChannel());
         if (!empty($atts['baseinstalldir'])) {
             $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
         }
     } elseif ($this->_setup['unusualbaseinstall']) {
         $dest_dir = $save_destdir = $this->config->get($this->_setup['locationconfig'], null, $pkg->getChannel()) . DIRECTORY_SEPARATOR . $pkg->getPackage();
         if (!empty($atts['baseinstalldir'])) {
             $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
         }
     } else {
         $dest_dir = $save_destdir = $this->config->get($this->_setup['locationconfig'], null, $pkg->getChannel()) . DIRECTORY_SEPARATOR . $pkg->getPackage();
     }
     if (dirname($file) != '.' && empty($atts['install-as'])) {
         $dest_dir .= DIRECTORY_SEPARATOR . dirname($file);
     }
     if (empty($atts['install-as'])) {
         $dest_file = $dest_dir . DIRECTORY_SEPARATOR . basename($file);
     } else {
         $dest_file = $dest_dir . DIRECTORY_SEPARATOR . $atts['install-as'];
     }
     $orig_file = $tmp_path . DIRECTORY_SEPARATOR . $file;
     // Clean up the DIRECTORY_SEPARATOR mess
     $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
     list($dest_dir, $dest_file, $orig_file) = preg_replace(array('!\\\\+!', '!/!', "!{$ds2}+!"), array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), array($dest_dir, $dest_file, $orig_file));
     return array($save_destdir, $dest_dir, $dest_file, $orig_file);
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:44,代码来源:Common.php

示例15: run

 /**
  * Run task after prompt.
  *
  * @param array $info   Parameter array.
  * @param string $name  Postinstall phase.
  */
 public function run($info, $phase)
 {
     if ($phase !== 'first') {
         return;
     }
     if (!$this->_config->set('horde_dir', $info['horde_dir'], 'user', 'pear.horde.org')) {
         print "Could not save horde_dir configuration value to PEAR config.\n";
         return;
     }
     $res = $this->_config->writeConfigFile();
     if ($res instanceof PEAR_Error) {
         print 'ERROR: ' . $res->getMessage() . "\n";
         exit;
     }
     print "Configuration successfully saved to PEAR config.\n";
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:22,代码来源:Role.php


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