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


PHP PEAR_ChannelFile::getName方法代码示例

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


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

示例1: preExecute

 public function preExecute()
 {
     error_reporting(error_reporting() & ~(E_STRICT | E_DEPRECATED));
     foreach (array('channel_name', 'summary', 'suggestedalias') as $v) {
         $this->{$v} = Doctrine::getTable('SnsConfig')->get(opPluginChannelServerPluginConfiguration::CONFIG_KEY_PREFIX . $v, str_replace(':80', '', $this->getRequest()->getHost()));
     }
     require_once 'PEAR.php';
     require_once 'PEAR/Common.php';
     require_once 'PEAR/ChannelFile.php';
     $baseUrl = 'http://' . $this->channel_name . 'pluginRest/';
     $channel = new PEAR_ChannelFile();
     $channel->setName($this->channel_name);
     $channel->setSummary($this->summary);
     $channel->setAlias($this->suggestedalias);
     $channel->setBaseURL('REST1.0', $baseUrl);
     $channel->setBaseURL('REST1.1', $baseUrl);
     $channel->setBaseURL('REST1.2', $baseUrl);
     $channel->setBaseURL('REST1.3', $baseUrl);
     $registry = new PEAR_Registry(sfConfig::get('sf_cache_dir'), $channel);
     $this->pear = new PEAR_Common();
     $this->pear->config->setRegistry($registry);
     if (!$registry->channelExists($channel->getName())) {
         $registry->addChannel($channel);
     } else {
         $registry->updateChannel($channel);
     }
 }
开发者ID:balibali,项目名称:opPluginChannelServerPlugin,代码行数:27,代码来源:actions.class.php

示例2: registerPearChannel

 public static function registerPearChannel(PEAR_ChannelFile $channel, $cacheDir = null)
 {
     error_reporting(error_reporting() & ~(E_STRICT | E_DEPRECATED));
     require_once 'PEAR.php';
     require_once 'PEAR/Common.php';
     require_once 'PEAR/ChannelFile.php';
     if (null === $cacheDir) {
         $cacheDir = sfConfig::get('sf_cache_dir');
     }
     $registry = new PEAR_Registry($cacheDir, $channel);
     $pear = new PEAR_Common();
     $pear->config->setRegistry($registry);
     if (!$registry->channelExists($channel->getName())) {
         $registry->addChannel($channel);
     } else {
         $registry->updateChannel($channel);
     }
     return $pear;
 }
开发者ID:balibali,项目名称:opPluginChannelServerPlugin,代码行数:19,代码来源:opPluginChannelServerToolkit.class.php

示例3: doUpdate

 function doUpdate($command, $options, $params)
 {
     $tmpdir = $this->config->get('temp_dir');
     if (!file_exists($tmpdir)) {
         require_once 'System.php';
         PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
         $err = System::mkdir(array('-p', $tmpdir));
         PEAR::staticPopErrorHandling();
         if (PEAR::isError($err)) {
             return $this->raiseError('channel-add: temp_dir does not exist: "' . $tmpdir . '" - You can change this location with "pear config-set temp_dir"');
         }
     }
     if (!is_writable($tmpdir)) {
         return $this->raiseError('channel-add: temp_dir is not writable: "' . $tmpdir . '" - You can change this location with "pear config-set temp_dir"');
     }
     $reg =& $this->config->getRegistry();
     if (sizeof($params) != 1) {
         return $this->raiseError("No channel file specified");
     }
     $lastmodified = false;
     if ((!file_exists($params[0]) || is_dir($params[0])) && $reg->channelExists(strtolower($params[0]))) {
         $c = $reg->getChannel(strtolower($params[0]));
         if (PEAR::isError($c)) {
             return $this->raiseError($c);
         }
         $this->ui->outputData("Updating channel \"{$params['0']}\"", $command);
         $dl =& $this->getDownloader(array());
         // if force is specified, use a timestamp of "1" to force retrieval
         $lastmodified = isset($options['force']) ? false : $c->lastModified();
         PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
         $contents = $dl->downloadHttp('http://' . $c->getName() . '/channel.xml', $this->ui, $tmpdir, null, $lastmodified);
         PEAR::staticPopErrorHandling();
         if (PEAR::isError($contents)) {
             return $this->raiseError('Cannot retrieve channel.xml for channel "' . $c->getName() . '" (' . $contents->getMessage() . ')');
         }
         list($contents, $lastmodified) = $contents;
         if (!$contents) {
             $this->ui->outputData("Channel \"{$params['0']}\" is up to date");
             return;
         }
         $contents = implode('', file($contents));
         if (!class_exists('PEAR_ChannelFile')) {
             require_once 'PEAR/ChannelFile.php';
         }
         $channel = new PEAR_ChannelFile();
         $channel->fromXmlString($contents);
         if (!$channel->getErrors()) {
             // security check: is the downloaded file for the channel we got it from?
             if (strtolower($channel->getName()) != strtolower($c->getName())) {
                 if (isset($options['force'])) {
                     $this->ui->log(0, 'WARNING: downloaded channel definition file' . ' for channel "' . $channel->getName() . '" from channel "' . strtolower($c->getName()) . '"');
                 } else {
                     return $this->raiseError('ERROR: downloaded channel definition file' . ' for channel "' . $channel->getName() . '" from channel "' . strtolower($c->getName()) . '"');
                 }
             }
         }
     } else {
         if (strpos($params[0], '://')) {
             $dl =& $this->getDownloader();
             PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
             $loc = $dl->downloadHttp($params[0], $this->ui, $tmpdir, null, $lastmodified);
             PEAR::staticPopErrorHandling();
             if (PEAR::isError($loc)) {
                 return $this->raiseError("Cannot open " . $params[0] . ' (' . $loc->getMessage() . ')');
             } else {
                 list($loc, $lastmodified) = $loc;
                 $contents = implode('', file($loc));
             }
         } else {
             $fp = false;
             if (file_exists($params[0])) {
                 $fp = fopen($params[0], 'r');
             }
             if (!$fp) {
                 return $this->raiseError("Cannot open " . $params[0]);
             }
             $contents = '';
             while (!feof($fp)) {
                 $contents .= fread($fp, 1024);
             }
             fclose($fp);
         }
         if (!class_exists('PEAR_ChannelFile')) {
             require_once 'PEAR/ChannelFile.php';
         }
         $channel = new PEAR_ChannelFile();
         $channel->fromXmlString($contents);
     }
     $exit = false;
     if (count($errors = $channel->getErrors(true))) {
         foreach ($errors as $error) {
             $this->ui->outputData(ucfirst($error['level'] . ': ' . $error['message']));
             if (!$exit) {
                 $exit = $error['level'] == 'error' ? true : false;
             }
         }
         if ($exit) {
             return $this->raiseError('Invalid channel.xml file');
         }
     }
//.........这里部分代码省略.........
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:101,代码来源:Channels.php

示例4:

 /**
  * Set the output macros based on a channel source
  */
 function _doMakeRPMFromChannel($source_file, $options, $params)
 {
     // Set the name of the template spec file to use by default
     $this->_template_spec_name = 'template-channel.spec';
     // Create a PEAR_ChannelFile object
     if (!class_exists('PEAR_ChannelFile')) {
         require_once 'PEAR/ChannelFile.php';
     }
     $cf = new PEAR_ChannelFile();
     // Load in the channel.xml file from the source XML
     $cf->fromXmlFile($source_file);
     // Set the output macros
     $this->_output['channel_alias'] = $cf->getAlias();
     $this->_output['master_server'] = $cf->getName();
     $this->_output['possible_channel'] = $cf->getName();
     $this->_output['rpm_package'] = $this->_getRPMName(null, $cf->getName(), $cf->getAlias(), 'chan');
     $rpmdep = $this->_getRPMName(null, $cf->getName(), $cf->getAlias(), 'chandep');
     if (!empty($rpmdep) && $rpmdep != $this->_output['rpm_package']) {
         $this->_output['extra_headers'] = $this->_formatRpmHeader('Provides', "{$rpmdep}") . "\n";
     }
     // Channels don't really have version numbers; this will need to be
     // hand-maintained in the spec
     $this->_output['version'] = '1.0';
 }
开发者ID:cmooony,项目名称:d4d-studio,代码行数:27,代码来源:Packaging.php


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