SyndicatedPost::get_terms_from_settings PHP Méthode

get_terms_from_settings() public méthode

SyndicatedPost::get_terms_from_settings(): Return an array of terms to associate with the incoming post based on the Categories, Tags, and other terms associated with each new post by the user's settings (global and feed-specific).
Since: 2016.0331
public get_terms_from_settings ( ) : array
Résultat array of lists, each element has the taxonomy for a key ('category', 'post_tag', etc.), and a list of term codes (either alphanumeric names, or ID numbers encoded in a format that SyndicatedLink::category_ids() can understand) within that taxonomy
    public function get_terms_from_settings()
    {
        // Categories: start with default categories, if any.
        $cats = array();
        if ('no' != $this->link->setting('add/category', NULL, 'yes')) {
            $fc = get_option("feedwordpress_syndication_cats");
            if ($fc) {
                $cats = array_merge($cats, explode("\n", $fc));
            }
        }
        $fc = $this->link->setting('cats', NULL, array());
        if (is_array($fc)) {
            $cats = array_merge($cats, $fc);
        }
        $preset_terms['category'] = $cats;
        // Tags: start with default tags, if any
        $tags = array();
        if ('no' != $this->link->setting('add/post_tag', NULL, 'yes')) {
            $ft = get_option("feedwordpress_syndication_tags", NULL);
            $tags = is_null($ft) ? array() : explode(FEEDWORDPRESS_CAT_SEPARATOR, $ft);
        }
        $ft = $this->link->setting('tags', NULL, array());
        if (is_array($ft)) {
            $tags = array_merge($tags, $ft);
        }
        $preset_terms['post_tag'] = $tags;
        $taxonomies = $this->link->taxonomies();
        $feedTerms = $this->link->setting('terms', NULL, array());
        $globalTerms = get_option('feedwordpress_syndication_terms', array());
        $specials = array('category' => 'cats', 'post_tag' => 'tags');
        foreach ($taxonomies as $tax) {
            // category and tag settings have already previously been handled
            // but if this is from another taxonomy, then...
            if (!isset($specials[$tax])) {
                $terms = array();
                // See if we should get the globals
                if ('no' != $this->link->setting("add/{$tax}", NULL, 'yes')) {
                    if (isset($globalTerms[$tax])) {
                        $terms = $globalTerms[$tax];
                    }
                }
                // Now merge in the locals
                if (isset($feedTerms[$tax])) {
                    $terms = array_merge($terms, $feedTerms[$tax]);
                }
                // That's all, folks.
                $preset_terms[$tax] = $terms;
            }
        }
        return $preset_terms;
    }