submitted_link(); endif; parent::__construct('feedwordpresscategories', $link); $this->dispatch = 'feedwordpress_admin_page_categories'; $this->pagenames = array( 'default' => 'Categories & Tags', 'settings-update' => 'Syndicated Categories & Tags', 'open-sheet' => 'Categories & Tags', ); $this->filename = __FILE__; } function unfamiliar_category_label ($name) { if (preg_match('/^create:(.*)$/', $name, $refs)) : $tax = get_taxonomy($refs[1]); $name = sprintf(__('Create new %s to match them'), $tax->labels->name); endif; return $name; } public function setting_radio_label( $li ) { if ( is_array($li['label'] ) ) : list( $a_href, $s_currently ) = $li['label']; printf( 'Use the site-wide setting Currently: %s', esc_url( $a_href ), esc_html( $s_currently ) ); else : print esc_html( $li['label'] ); endif; } function feed_categories_box ($page, $box = NULL) { $link = $page->link; $globalPostType = get_option('feedwordpress_syndicated_post_type', 'post'); if ($this->for_feed_settings()) : $post_type = $link->setting('syndicated post type', 'syndicated_post_type', 'post'); else : $post_type = $globalPostType; endif; $taxonomies = get_object_taxonomies(array('object_type' => $post_type), 'names'); $unmatched = array('category' => array(), 'post_tag' => array()); $matchUl = array('cats' => array(), 'tags' => array(), 'filter' => array()); $tagLikeTaxonomies = array(); foreach ($taxonomies as $tax) : $taxonomy = get_taxonomy($tax); if ( ! $taxonomy->hierarchical) : $tagLikeTaxonomies[] = $tax; endif; $name = 'create:'.$tax; foreach (array('category', 'post_tag') as $what) : $unmatched[$what][$name] = array( 'label' => $this->unfamiliar_category_label($name), ); $unmatchedRadio[$what][$name] = ''; endforeach; foreach (array('cats', 'tags', 'filter') as $what) : $matchUl[$what][$tax] = array( 'checked' => '', 'labels' => $taxonomy->labels, ); endforeach; endforeach; foreach ($unmatched as $what => $um) : $unmatched[$what]['null'] = array('label' => __('Don\'t create any matching terms')); $unmatchedRadio[$what]['null'] = ''; endforeach; $globalUnmatched = array( 'category' => FeedWordPress::on_unfamiliar('category'), 'post_tag' => FeedWordPress::on_unfamiliar('post_tag'), ); foreach ($globalUnmatched as $what => $value) : if ($value=='create') : $value = 'create:category'; endif; if ($value=='tag') : $value = 'create:post_tag'; endif; $globalUnmatched[$what] = $value; endforeach; $globalMatch['cats'] = get_option('feedwordpress_match_cats', $taxonomies); $globalMatch['tags'] = get_option('feedwordpress_match_tags', $tagLikeTaxonomies); $globalMatch['filter'] = get_option('feedwordpress_match_filter', array()); $globalMatchLabels = array(); $nothingDoing = array('cats' => "won't try to match", 'tags' => "won't try to match", "filter" => "won't filter"); foreach ($globalMatch as $what => $domain) : $labels = array(); $domain = array_filter($domain, 'remove_dummy_zero'); foreach ($domain as $tax) : $tax = get_taxonomy($tax); $labels[] = $tax->labels->name; endforeach; if (count($labels) > 0) : $globalMatchLabels[$what] = implode(", ", $labels); else : $globalMatchLabels[$what] = $nothingDoing[$what]; endif; endforeach; if ($this->for_feed_settings()) : $href = $this->admin_page_href(basename(__FILE__)); foreach ($unmatched as $what => $um) : // Is the global default setting appropriate to this post type? $GUC = $globalUnmatched[$what]; if (isset($um[$GUC])) : // Yup. Let's add a site-default option $currently = $um[$GUC]['label']; $defaultLi = array( 'site-default' => array( 'label' => [ $href, $currently ], ), ); $unmatchedColumns[$what] = array( $defaultLi, ); $unmatchedDefault[$what] = 'site-default'; $unmatchedRadio[$what]['site-default'] = ''; else : $opts = array_keys($unmatched[$what]); $unmatchedDefault[$what] = $opts[0]; $unmatchedColumns[$what] = array(); endif; $ucKey[$what] = $link->setting("unfamiliar $what", NULL, NULL); endforeach; $match['cats'] = $this->link->setting('match/cats', NULL, NULL); $match['tags'] = $this->link->setting('match/tags', NULL, NULL); $match['filter'] = $this->link->setting('match/filter', NULL, NULL); else : foreach ($unmatched as $what => $um) : $ucKey[$what] = FeedWordPress::on_unfamiliar($what); endforeach; $match = $globalMatch; endif; foreach ($ucKey as $what => $uck) : if ($uck == 'tag') : $uck = 'create:post_tag'; endif; if ($uck == 'create') : $uck = 'create:category'; endif; if ( !is_string($uck)) : $uck = $unmatchedDefault[$what]; endif; $ucKey[$what] = $uck; if ( !array_key_exists($uck, $unmatchedRadio[$what])) : $obsoleteLi = array( $uck => array( 'label' => ' '.$this->unfamiliar_category_label($uck).' (This setting is no longer applicable to the type of post syndicated from this feed!)
Please change this one of the following settings:
', ), ); $unmatched[$what] = array_merge($obsoleteLi, $unmatched[$what]); $unmatchedRadio[$what][$uck] = ' disabled="disabled"'; endif; $unmatchedRadio[$what][$uck] .= ' checked="checked"'; $unmatchedColumns[$what][] = $unmatched[$what]; endforeach; $defaulted = array(); foreach ($match as $what => $set) : $defaulted[$what] = false; if (is_null($set) or (count($set) < 1)) : $defaulted[$what] = true; if ($this->for_feed_settings()) : $set = $globalMatch[$what]; $match[$what] = $globalMatch[$what]; endif; endif; if ( ! $defaulted[$what] or $this->for_feed_settings()) : foreach ($set as $against) : if (array_key_exists($against, $matchUl[$what])) : $matchUl[$what][$against]['checked'] = ' checked="checked"'; endif; endforeach; endif; endforeach; // Hey ho, let's go... $offerSiteWideSettings = ($page->for_feed_settings() and ($post_type==$globalPostType)); ?>| Match feed categories: |
|
||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Unmatched categories: | When these_posts_phrase() ); ?> have categories on the feed that don't have any local matches yet... 1) : ?>Match inline tags:
|
Applies only to inline tags marked
as links in the text of syndicated posts, using the
|
Unmatched inline tags: |
When the text of these_posts_phrase() ); ?> contains inline tags that don't have any local matches yet... 1) : ?>Filter: |
|
Multiple categories: |
|
Enter a Perl-compatible regular expression here if the feed provides multiple categories in a single category element. The regular expression should match the characters used to separate one category from the next. If the feed uses spaces (like del.icio.us), use the pattern "\s". If the feed does not provide multiple categories in a single element, leave this blank.
|