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


PHP Zend_Feed_Element::setParent方法代碼示例

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


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

示例1: __get

 /**
  * Map variable access onto the underlying entry representation.
  *
  * Get-style access returns a Zend_Feed_Element representing the
  * child element accessed. To get string values, use method syntax
  * with the __call() overriding.
  *
  * @param  string $var The property to access.
  * @return mixed
  */
 public function __get($var)
 {
     $nodes = $this->_children($var);
     $length = count($nodes);
     if ($length == 1) {
         return new Zend_Feed_Element($nodes[0]);
     } elseif ($length > 1) {
         return array_map(create_function('$e', 'return new Zend_Feed_Element($e);'), $nodes);
     } else {
         // When creating anonymous nodes for __set chaining, don't
         // call appendChild() on them. Instead we pass the current
         // element to them as an extra reference; the child is
         // then responsible for appending itself when it is
         // actually set. This way "if ($foo->bar)" doesn't create
         // a phantom "bar" element in our tree.
         if (strpos($var, ':') !== false) {
             list($ns, $elt) = explode(':', $var, 2);
             $node = $this->_element->ownerDocument->createElementNS(Zend_Feed::lookupNamespace($ns), $elt);
         } else {
             $node = $this->_element->ownerDocument->createElement($var);
         }
         $node = new Zend_Feed_Element($node);
         $node->setParent($this);
         return $node;
     }
 }
開發者ID:vojtajina,項目名稱:sitellite,代碼行數:36,代碼來源:Element.php


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