示例#1
0
 /**
  * Constructor.
  *
  * @param resource|string $xml The XML document received from the server.
  */
 public function __construct($xml)
 {
     if (is_resource($xml)) {
         rewind($xml);
         $xml = stream_get_contents($xml);
     }
     parent::registerNamespace('xlink', 'http://www.w3.org/1999/xlink');
     parent::__construct($xml);
     $this->_packages = $this->_buildPackageList();
 }
示例#2
0
文件: Base.php 项目: horde/horde
 /**
  * Feed constructor
  *
  * The Horde_Feed_Base constructor takes the URI of a feed or a
  * feed represented as a string and loads it as XML.
  *
  * @throws Horde_Feed_Exception If loading the feed failed.
  *
  * @param mixed $xml The feed as a string, a DOMElement, or null.
  * @param string $uri The full URI of the feed, or null if unknown.
  */
 public function __construct($xml = null, $uri = null, Horde_Http_Client $httpClient = null)
 {
     $this->_uri = $uri;
     if (is_null($httpClient)) {
         $httpClient = new Horde_Http_Client();
     }
     $this->_httpClient = $httpClient;
     try {
         parent::__construct($xml);
     } catch (Horde_Xml_Element_Exception $e) {
         throw new Horde_Feed_Exception('Unable to load feed: ' . $e->getMessage());
     }
 }