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


PHP Reader::arrayUnique方法代碼示例

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


在下文中一共展示了Reader::arrayUnique方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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->getXpath()->query('//dc11:creator');
     if (!$list->length) {
         $list = $this->getXpath()->query('//dc10:creator');
     }
     if (!$list->length) {
         $list = $this->getXpath()->query('//dc11:publisher');
         if (!$list->length) {
             $list = $this->getXpath()->query('//dc10:publisher');
         }
     }
     if ($list->length) {
         foreach ($list as $author) {
             $authors[] = array('name' => $author->nodeValue);
         }
         $authors = new Collection\Author(Reader\Reader::arrayUnique($authors));
     } else {
         $authors = null;
     }
     $this->data['authors'] = $authors;
     return $this->data['authors'];
 }
開發者ID:tillk,項目名稱:vufind,代碼行數:32,代碼來源:Feed.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'];
     }
     $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 Collection\Author(Reader\Reader::arrayUnique($authors));
     }
     $this->_data['authors'] = $authors;
     return $this->_data['authors'];
 }
開發者ID:brikou,項目名稱:zend_feed,代碼行數:34,代碼來源:Entry.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'];
        }

        $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 Collection\Author(
                Reader\Reader::arrayUnique($authors)
            );
        }

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

        return $this->_data['authors'];
    }
開發者ID:niallmccrudden,項目名稱:zf2,代碼行數:36,代碼來源:Feed.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() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\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 Reader\Collection\Author(Reader\Reader::arrayUnique($authors));
     }
     if (count($authors) == 0) {
         $authors = null;
     }
     $this->_data['authors'] = $authors;
     return $this->_data['authors'];
 }
開發者ID:rafalwrzeszcz,項目名稱:zf2,代碼行數:53,代碼來源:Rss.php

示例5: 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();
     $authorsDc = $this->getExtension('DublinCore')->getAuthors();
     if (!empty($authorsDc)) {
         foreach ($authorsDc as $author) {
             $authors[] = array('name' => $author['name']);
         }
     }
     if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) {
         $list = $this->xpath->query($this->xpathQueryRss . '//author');
     } else {
         $list = $this->xpath->query($this->xpathQueryRdf . '//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 Reader\Collection\Author(Reader\Reader::arrayUnique($authors));
     }
     if (count($authors) == 0) {
         $authors = null;
     }
     $this->data['authors'] = $authors;
     return $this->data['authors'];
 }
開發者ID:yakamoz-fang,項目名稱:concrete,代碼行數:49,代碼來源:Rss.php


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