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


PHP Zend_Feed_Reader::arrayUnique方法代码示例

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


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

示例1: getAuthors

 /**
  * Get an array with feed authors
  *
  * @return array
  */
 public function getAuthors()
 {
     if (array_key_exists('authors', $this->_data)) {
         return $this->_data['authors'];
     }
     $authors = array();
     $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc11:creator');
     if (!$list->length) {
         $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc10:creator');
     }
     if (!$list->length) {
         $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc11:publisher');
         if (!$list->length) {
             $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc10:publisher');
         }
     }
     if ($list->length) {
         foreach ($list as $author) {
             $authors[] = array('name' => $author->nodeValue);
         }
         $authors = new Zend_Feed_Reader_Collection_Author(Zend_Feed_Reader::arrayUnique($authors));
     } else {
         $authors = null;
     }
     $this->_data['authors'] = $authors;
     return $this->_data['authors'];
 }
开发者ID:siite,项目名称:choose-sa-cloud,代码行数:32,代码来源:Entry.php

示例2: getAuthors

 /**
  * Get an array with feed authors
  *
  * @return array
  */
 public function getAuthors()
 {
     if (array_key_exists('authors', $this->_data)) {
         return $this->_data['authors'];
     }
     $list = $this->_xpath->query('//atom:author');
     $authors = array();
     if ($list->length) {
         foreach ($list as $author) {
             $author = $this->_getAuthor($author);
             if (!empty($author)) {
                 $authors[] = $author;
             }
         }
     }
     if (count($authors) == 0) {
         $authors = null;
     } else {
         $authors = new Zend_Feed_Reader_Collection_Author(Zend_Feed_Reader::arrayUnique($authors));
     }
     $this->_data['authors'] = $authors;
     return $this->_data['authors'];
 }
开发者ID:par-orillonsoft,项目名称:Magento,代码行数:28,代码来源:Feed.php

示例3: getAuthors

 /**
  * Get an array with feed authors
  *
  * @return array
  */
 public function getAuthors()
 {
     if (array_key_exists('authors', $this->_data)) {
         return $this->_data['authors'];
     }
     $authors = array();
     $list = $this->getXpath()->query($this->getXpathPrefix() . '//atom:author');
     if (!$list->length) {
         /**
          * TODO: Limit query to feed level els only!
          */
         $list = $this->getXpath()->query('//atom:author');
     }
     if ($list->length) {
         foreach ($list as $author) {
             $author = $this->_getAuthor($author);
             if (!empty($author)) {
                 $authors[] = $author;
             }
         }
     }
     if (count($authors) == 0) {
         $authors = null;
     } else {
         $authors = new Zend_Feed_Reader_Collection_Author(Zend_Feed_Reader::arrayUnique($authors));
     }
     $this->_data['authors'] = $authors;
     return $this->_data['authors'];
 }
开发者ID:ramonornela,项目名称:Zebra,代码行数:34,代码来源:Entry.php

示例4: getAuthors

    /**
     * Get an array with feed authors
     *
     * @return array
     */
    public function getAuthors()
    {
        if (array_key_exists('authors', $this->_data)) {
            return $this->_data['authors'];
        }

        $authors = array();
        $authors_dc = $this->getExtension('DublinCore')->getAuthors();
        if (!empty($authors_dc)) {
            foreach ($authors_dc as $author) {
                $authors[] = array(
                    'name' => $author['name']
                );
            }
        }

        /**
         * Technically RSS doesn't specific author element use at the feed level
         * but it's supported on a "just in case" basis.
         */
        if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10
        && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) {
            $list = $this->_xpath->query('//author');
        } else {
            $list = $this->_xpath->query('//rss:author');
        }
        if ($list->length) {
            foreach ($list as $author) {
                $string = trim($author->nodeValue);
                $email = null;
                $name = null;
                $data = array();
                // Pretty rough parsing - but it's a catchall
                if (preg_match("/^.*@[^ ]*/", $string, $matches)) {
                    $data['email'] = trim($matches[0]);
                    if (preg_match("/\((.*)\)$/", $string, $matches)) {
                        $data['name'] = $matches[1];
                    }
                    $authors[] = $data;
                }
            }
        }

        if (count($authors) == 0) {
            $authors = $this->getExtension('Atom')->getAuthors();
        } else {
            $authors = new Zend_Feed_Reader_Collection_Author(
                Zend_Feed_Reader::arrayUnique($authors)
            );
        }

        if (count($authors) == 0) {
            $authors = null;
        }

        $this->_data['authors'] = $authors;

        return $this->_data['authors'];
    }
开发者ID:nhp,项目名称:shopware-4,代码行数:64,代码来源:Rss.php


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