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


PHP SimplePie_Misc::array_unique方法代码示例

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


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

示例1: get_enclosures

 /**
  * Grabs all available enclosures (podcasts, etc.)
  *
  * Supports the <enclosure> RSS tag, as well as Media RSS and iTunes RSS.
  *
  * At this point, we're pretty much assuming that all enclosures for an item are the same content.  Anything else is too complicated to properly support.
  *
  * @todo Add support for end-user defined sorting of enclosures by type/handler (so we can prefer the faster-loading FLV over MP4).
  * @todo If an element exists at a level, but it's value is empty, we should fall back to the value from the parent (if it exists).
  */
 public function get_enclosures()
 {
     if (!isset($this->data['enclosures'])) {
         $this->data['enclosures'] = array();
         // Elements
         $captions_parent = null;
         $categories_parent = null;
         $copyrights_parent = null;
         $credits_parent = null;
         $description_parent = null;
         $duration_parent = null;
         $hashes_parent = null;
         $keywords_parent = null;
         $player_parent = null;
         $ratings_parent = null;
         $restrictions_parent = null;
         $thumbnails_parent = null;
         $title_parent = null;
         // Let's do the channel and item-level ones first, and just re-use them if we need to.
         $parent = $this->get_feed();
         // CAPTIONS
         if ($captions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text')) {
             foreach ($captions as $caption) {
                 $caption_type = null;
                 $caption_lang = null;
                 $caption_startTime = null;
                 $caption_endTime = null;
                 $caption_text = null;
                 if (isset($caption['attribs']['']['type'])) {
                     $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
                 }
                 if (isset($caption['attribs']['']['lang'])) {
                     $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
                 }
                 if (isset($caption['attribs']['']['start'])) {
                     $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
                 }
                 if (isset($caption['attribs']['']['end'])) {
                     $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
                 }
                 if (isset($caption['data'])) {
                     $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                 }
                 $captions_parent[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
             }
         } elseif ($captions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text')) {
             foreach ($captions as $caption) {
                 $caption_type = null;
                 $caption_lang = null;
                 $caption_startTime = null;
                 $caption_endTime = null;
                 $caption_text = null;
                 if (isset($caption['attribs']['']['type'])) {
                     $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
                 }
                 if (isset($caption['attribs']['']['lang'])) {
                     $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
                 }
                 if (isset($caption['attribs']['']['start'])) {
                     $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
                 }
                 if (isset($caption['attribs']['']['end'])) {
                     $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
                 }
                 if (isset($caption['data'])) {
                     $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                 }
                 $captions_parent[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
             }
         }
         if (is_array($captions_parent)) {
             $captions_parent = array_values(SimplePie_Misc::array_unique($captions_parent));
         }
         // CATEGORIES
         foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category) {
             $term = null;
             $scheme = null;
             $label = null;
             if (isset($category['data'])) {
                 $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
             }
             if (isset($category['attribs']['']['scheme'])) {
                 $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
             } else {
                 $scheme = 'http://search.yahoo.com/mrss/category_schema';
             }
             if (isset($category['attribs']['']['label'])) {
                 $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
             }
             $categories_parent[] = new $this->feed->category_class($term, $scheme, $label);
//.........这里部分代码省略.........
开发者ID:oxmcvusd,项目名称:full-text-rss-1,代码行数:101,代码来源:Item.php

示例2: get_contributors

 function get_contributors()
 {
     $contributors = array();
     foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor) {
         $name = null;
         $uri = null;
         $email = null;
         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) {
             $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
         }
         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) {
             $uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
         }
         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) {
             $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
         }
         if ($name !== null || $email !== null || $uri !== null) {
             $contributors[] =& new $this->item->feed->author_class($name, $uri, $email);
         }
     }
     foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor) {
         $name = null;
         $url = null;
         $email = null;
         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) {
             $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
         }
         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) {
             $url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
         }
         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) {
             $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
         }
         if ($name !== null || $email !== null || $url !== null) {
             $contributors[] =& new $this->item->feed->author_class($name, $url, $email);
         }
     }
     if (!empty($contributors)) {
         return SimplePie_Misc::array_unique($contributors);
     } else {
         return null;
     }
 }
开发者ID:jojospaghettio,项目名称:wicketpixie,代码行数:43,代码来源:simplepie.php


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