get_categories() public méthode

Uses , or
public get_categories ( ) : SimplePie_Category[] | null
Résultat SimplePie_Category[] | null List of {@see \SimplePie_Category} objects
 public function getFavIcon(SimplePie_Item $item)
 {
     $shortname = '';
     $categories = $item->get_categories();
     foreach ($categories as $category) {
         $matches = array();
         $matched = preg_match('/short=([a-z-]+)/', $category->get_term(), $matches);
         if ($matched === 1) {
             $shortname = $matches[1];
             break;
         }
     }
     if (array_key_exists($shortname, self::$map)) {
         $favIcon = self::$map[$shortname];
     } else {
         $favIcon = $item->get_feed()->get_favicon();
     }
     return $favIcon;
 }
Exemple #2
0
function filter(SimplePie_Item $item, array $patterns)
{
    foreach ($patterns as $pattern) {
        switch ($pattern["field"]) {
            case "title":
                if (preg_match($pattern["regex"], $item->get_title())) {
                    return false;
                }
                break;
            case "summary":
                if (preg_match($pattern["regex"], $item->get_description())) {
                    return false;
                }
                break;
            case "content":
                if (preg_match($pattern["regex"], $item->get_content())) {
                    return false;
                }
                break;
            case "url":
                if (preg_match($pattern["regex"], $item->get_permalink())) {
                    return false;
                }
                break;
            case "category":
                foreach ($item->get_categories() as $category) {
                    if (preg_match($pattern["regex"], $category->get_term()) || preg_match($pattern["regex"], $category->get_label())) {
                        return false;
                    }
                }
                break;
            default:
                die("Filter not implemented for field " . $pattern["field"]);
        }
    }
    return true;
}
 function get_categories()
 {
     return apply_filters('feedwordpie_item_get_categories', parent::get_categories(), $this);
 }
 /**
  * @param SimplePie_Item $item
  * @return string
  */
 function socialbookmarks_get_tags($item)
 {
     global $serendipity;
     $return = '';
     $taglink = $serendipity['baseURL'] . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . 'plugin/tag/';
     switch ($this->get_config('socialbookmarksService')) {
         case 'del.icio.us':
             // quite easy
             $return .= '<br/><p style="font-size:.7em;margin:0;padding:0" class="serendipity_socialbookmarks_tags">[Tags:';
             $tags = $item->get_categories();
             /** @var SimplePie_Category $tag */
             foreach ($tags as $tag) {
                 $return .= ' <a href="' . $taglink . socialbookmarks_freetag_compat(strtolower($tag->get_term())) . '" rel="tag">' . strtolower($tag->get_term()) . '</a>';
             }
             $return .= ']</p>';
             break;
         case 'ma.gnolia':
             // they've changed this recently
             $return .= '<br/><p style="font-size:.7em;margin:0;padding:0" class="serendipity_socialbookmarks_tags">[Tags:';
             $tags = $item->get_categories();
             //$tags = explode(' ', $tags[0]);
             foreach ($tags as $tag) {
                 $return .= ' <a href="' . $taglink . socialbookmarks_freetag_compat(strtolower($tag)) . '" rel="tag">' . strtolower($tag) . '</a>';
             }
             $return .= ']</p>';
             break;
         case 'furl':
             $return .= '<br/><p style="font-size:.7em;margin:0;padding:0" class="serendipity_socialbookmarks_tags">[Tags:';
             $tags = $item->get_category();
             foreach ($tags as $tag) {
                 $return .= ' <a href="' . $taglink . socialbookmarks_freetag_compat(strtolower($tag)) . '" rel="tag">' . strtolower($tag) . '</a>';
             }
             $return .= ']</p>';
             break;
         case 'misterwong':
         case 'linkroll':
             // services don't provide tags in their RSS feeds (yet)!?
         // services don't provide tags in their RSS feeds (yet)!?
         default:
             break;
     }
     return $return;
 }
        function get_categories() {
            $cats = parent::get_categories();
            $mycats = array();

            if (!is_null($cats)) {
                foreach ($cats as $cat) {
                    $mycats[] = $cat->term;
                }
            }
            return $mycats;
        }