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


PHP SimpleXmlElement::getNamespaces方法代码示例

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


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

示例1: parse

 public function parse()
 {
     $sXML = new \SimpleXmlElement($this->xml);
     $ns = $sXML->getNamespaces(true);
     foreach ((array) $sXML->channel as $k => $v) {
         if ($k == 'item') {
             continue;
         }
         if (!is_string($v) && !is_array($v)) {
             $v = (array) $v;
         }
         $this->meta[$k] = $v;
     }
     foreach ($sXML->channel->item as $item) {
         $i = (array) $item;
         foreach ($ns as $space => $val) {
             $children = $item->children($val);
             if ($children) {
                 foreach ($children as $c => $a) {
                     $i[$c] = (string) $a;
                 }
             }
         }
         $this->items[] = $i;
     }
 }
开发者ID:sketchmedia,项目名称:sketchguild,代码行数:26,代码来源:Rss.php

示例2: get

 public function get($count = -1, $rating = null, $filter = null)
 {
     if ($count == 0 || !is_numeric($count)) {
         $count = -1;
     }
     $url = sprintf(self::BACKEND_URL, $this->username) . ($filter == -1 ? '+in%3Ascraps' : '') . ($filter > 0 ? '%2F' . $filter : '');
     $this->data = $this->request($url);
     $xml = new SimpleXmlElement($this->data);
     $ns = $xml->getNamespaces(true);
     $items = null;
     foreach ($xml->channel->item as $item) {
         $media = $item->children($ns['media']);
         if (!(empty($this->rating) || $this->rating == 'all') && $media->rating != $this->rating) {
             continue;
         }
         if ($media->text) {
             continue;
         }
         if ($media->text) {
             continue;
         }
         if ($media->text) {
             continue;
         }
         $items .= sprintf('<li><a href="%1$s" title="%2$s - %3$s"><img src="%4$s" alt="%2$s - %3$s"/></a></li>', $item->link, $media->title, $media->copyright, $media->content->attributes()->url);
         --$count;
         if ($count > -1 && $count == 0) {
             break;
         }
     }
     return sprintf('<ul class="da-widgets gallery">%s</ul>', $items);
 }
开发者ID:aegypius,项目名称:wp-da-widgets,代码行数:32,代码来源:Gallery.php

示例3: get

 public function get($count = -1)
 {
     $xml = new SimpleXmlElement($this->data);
     $ns = $xml->getNamespaces(true);
     $items = null;
     foreach ($xml->channel->item as $item) {
         $items .= sprintf('<dt><a href="%2$s">%1$s</a></dt>' . '<dd>' . '<p>%3$s</p>' . '</dd>', $item->title, $item->link, $item->description);
         --$count;
         if ($count > -1 && $count == 0) {
             break;
         }
     }
     return sprintf('<dl>%s</dl>', $items);
 }
开发者ID:Honigkuchenwolf,项目名称:wp-da-widgets,代码行数:14,代码来源:Log.php

示例4: get

 public function get($count = -1)
 {
     $xml = new SimpleXmlElement($this->data);
     $ns = $xml->getNamespaces(true);
     $items = null;
     foreach ($xml->channel->item as $item) {
         $media = $item->children($ns['media']);
         if (!(is_null($this->rating) || $this->rating == 'all') && $media->rating != $this->rating) {
             continue;
         }
         $items .= sprintf('<li><a href="%1$s" title="%2$s - %3$s"><img src="%4$s" alt="%2$s - %3$s"/></a></li>', $item->link, $media->title, $media->copyright, $media->content->attributes()->url);
         --$count;
         if ($count > -1 && $count == 0) {
             break;
         }
     }
     return sprintf('<ul class="da-widgets favourite">%s</ul>', $items);
 }
开发者ID:Honigkuchenwolf,项目名称:wp-da-widgets,代码行数:18,代码来源:Favourite.php

示例5: get

 public function get($count = -1, $format = 1)
 {
     if ($count == 0 || !is_numeric($count)) {
         $count = -1;
     }
     $url = sprintf(self::BACKEND_URL, $this->username, $format);
     $this->data = $this->request($url);
     $xml = new SimpleXmlElement($this->data);
     $ns = $xml->getNamespaces(true);
     $items = null;
     foreach ($xml->channel->item as $item) {
         $items .= sprintf('<dt><a href="%2$s">%1$s</a></dt>' . '<dd>' . '<p>%3$s</p>' . '</dd>', $item->title, $item->link, $item->description);
         --$count;
         if ($count > -1 && $count == 0) {
             break;
         }
     }
     return sprintf('<dl class="da-widgets log">%s</dl>', $items);
 }
开发者ID:aegypius,项目名称:wp-da-widgets,代码行数:19,代码来源:Log.php


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