當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Feed_Element::__construct方法代碼示例

本文整理匯總了PHP中Zend_Feed_Element::__construct方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Feed_Element::__construct方法的具體用法?PHP Zend_Feed_Element::__construct怎麽用?PHP Zend_Feed_Element::__construct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Feed_Element的用法示例。


在下文中一共展示了Zend_Feed_Element::__construct方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * The Zend_Feed_EntryAbstract constructor takes the URI of the feed the entry
  * is part of, and optionally an XML construct (usually a
  * SimpleXMLElement, but it can be an XML string or a DOMNode as
  * well) that contains the contents of the entry.
  */
 public function __construct($uri = null, $element = null)
 {
     $this->_uri = $uri;
     if (!$element instanceof DOMElement) {
         if ($element) {
             // Load the feed as an XML DOMDocument object
             @ini_set('track_errors', 1);
             $doc = new DOMDocument();
             $success = @$feedDOMDocument->loadXML($element);
             @ini_restore('track_errors');
             if (!$success) {
                 throw new Zend_Feed_Exception("DOMDocument cannot parse XML: {$php_errormsg}");
             }
             $element = $doc->getElementsByTagName($this->_rootElement)->item(0);
             if (!$element) {
                 throw new Zend_Feed_Exception('No root <' . $this->_rootElement . '> element found, cannot parse feed.');
             }
         } else {
             $doc = new DOMDocument('1.0', 'utf-8');
             if ($this->_rootNamespace !== null) {
                 $element = $doc->createElementNS(Zend_Feed::lookupNamespace($this->_rootNamespace), $this->_rootElement);
             } else {
                 $element = $doc->createElement($this->_rootElement);
             }
         }
     }
     parent::__construct($element);
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:34,代碼來源:EntryAbstract.php

示例2: __construct

 /**
  * Zend_Feed_Entry_Abstract constructor
  *
  * The Zend_Feed_Entry_Abstract constructor takes the URI of the feed the entry
  * is part of, and optionally an XML construct (usually a
  * SimpleXMLElement, but it can be an XML string or a DOMNode as
  * well) that contains the contents of the entry.
  *
  * @param  string $uri
  * @param  SimpleXMLElement|DOMNode|string  $element
  * @return void
  * @throws Zend_Feed_Exception
  */
 public function __construct($uri = null, $element = null)
 {
     if (!$element instanceof DOMElement) {
         if ($element) {
             // Load the feed as an XML DOMDocument object
             @ini_set('track_errors', 1);
             $doc = new DOMDocument();
             $doc = @Zend_Xml_Security::scan($element, $doc);
             @ini_restore('track_errors');
             if (!$doc) {
                 // prevent the class to generate an undefined variable notice (ZF-2590)
                 if (!isset($php_errormsg)) {
                     if (function_exists('xdebug_is_enabled')) {
                         $php_errormsg = '(error message not available, when XDebug is running)';
                     } else {
                         $php_errormsg = '(error message not available)';
                     }
                 }
                 /**
                  * @see Zend_Feed_Exception
                  */
                 throw new Zend_Feed_Exception("DOMDocument cannot parse XML: {$php_errormsg}");
             }
             $element = $doc->getElementsByTagName($this->_rootElement)->item(0);
             if (!$element) {
                 /**
                  * @see Zend_Feed_Exception
                  */
                 throw new Zend_Feed_Exception('No root <' . $this->_rootElement . '> element found, cannot parse feed.');
             }
         } else {
             $doc = new DOMDocument('1.0', 'utf-8');
             if ($this->_rootNamespace !== null) {
                 $element = $doc->createElementNS(Zend_Feed::lookupNamespace($this->_rootNamespace), $this->_rootElement);
             } else {
                 $element = $doc->createElement($this->_rootElement);
             }
         }
     }
     parent::__construct($element);
 }
開發者ID:trigoesrodrigo,項目名稱:icingaweb2,代碼行數:54,代碼來源:Abstract.php


注:本文中的Zend_Feed_Element::__construct方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。