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;
}