getChannel() public method

Return the channel.xml from the server.
public getChannel ( ) : string
return string The content of the channel.xml file.
コード例 #1
0
ファイル: Environment.php プロジェクト: raz0rsdge/horde
 /**
  * Add a channel within the install location.
  *
  * @param string $channel The channel name.
  * @param array  $options Install options.
  * @param string $reason  Optional reason for adding the channel.
  *
  * @return NULL
  */
 public function addChannel($channel, $options = array(), $reason = '')
 {
     $static = $this->_channel_directory . '/' . $channel . '.channel.xml';
     if (!file_exists($static)) {
         if (empty($options['allow_remote'])) {
             throw new Components_Exception(sprintf('Cannot add channel "%s". Remote access has been disabled (activate with --allow-remote)!', $channel));
         }
         if (!empty($this->_channel_directory)) {
             $remote = new Horde_Pear_Remote($channel);
             file_put_contents($static, $remote->getChannel());
             $this->_output->warn(sprintf('Downloaded channel %s via network to %s.', $channel, $static));
         }
     }
     $channel_handler = new PEAR_Command_Channels(new PEAR_Frontend_CLI(), $this->getPearConfig());
     $this->_output->ok(sprintf('About to add channel %s%s', $channel, $reason));
     if (file_exists($static)) {
         ob_start();
         Components_Exception_Pear::catchError($channel_handler->doAdd('channel-add', array(), array($static)));
         $this->_output->pear(ob_get_clean());
     } else {
         $this->_output->warn(sprintf('Adding channel %s via network.', $channel));
         ob_start();
         Components_Exception_Pear::catchError($channel_handler->doDiscover('channel-discover', array(), array($channel)));
         $this->_output->pear(ob_get_clean());
     }
     $this->_output->ok(sprintf('Successfully added channel %s%s', $channel, $reason));
 }
コード例 #2
0
ファイル: remote.php プロジェクト: jubinpatel/horde
 * A sample script for accessing pear.horde.org.
 *
 * PHP version 5
 *
 * @category Horde
 * @package  Horde_Pear
 * @author   Gunnar Wrobel <*****@*****.**>
 * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 * @link     http://www.horde.org/libraries/Horde_Pear
 */
/**
 * The Autoloader allows us to omit "require/include" statements.
 */
require_once 'Horde/Autoloader/Default.php';
$pear = new Horde_Pear_Remote();
print $pear->getChannel();
print "\n\n";
print join("\n", $pear->listPackages());
print "\n\n";
print $pear->getLatestRelease('Horde_Core');
print "\n\n";
print $pear->getLatestDownloadUri('Horde_Core');
print "\n\n";
print_r($pear->getLatestDetails('Horde_Core'));
print "\n\n";
print $pear->releaseExists('Horde_Core', '1.7.0');
print "\n\n";
print count($pear->getDependencies('Horde_Exception', '1.0.0'));
print "\n\n";
print $pear->getPackageXml('Horde_Exception', '1.0.0')->getName();
print "\n\n";