PluginProbe
FeedWordPress / 2013.0504
FeedWordPress v2013.0504
trunk 0.8 0.9 0.91 0.95 0.96 0.97 0.98 0.981 0.99 0.991 0.992 0.993 2008.1030 2008.1101 2008.1105 2008.1214 2009.0612 2009.0613 2009.0618 2009.0707 2009.1111 2009.1112 2010.0127 2010.0528 All 65 releases
feedwordpress / categories-page.php

categories-page.php in FeedWordPress 2013.0504, at categories-page.php

614 lines 21.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 require_once(dirname(__FILE__) . '/admin-ui.php');
3
4 class FeedWordPressCategoriesPage extends FeedWordPressAdminPage {
5 function FeedWordPressCategoriesPage ($link = -1) {
6 if (is_numeric($link) and -1 == $link) :
7 $link = $this->submitted_link();
8 endif;
9
10 FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpresscategories', $link);
11 $this->dispatch = 'feedwordpress_admin_page_categories';
12 $this->pagenames = array(
13 'default' => 'Categories & Tags',
14 'settings-update' => 'Syndicated Categories & Tags',
15 'open-sheet' => 'Categories & Tags',
16 );
17 $this->filename = __FILE__;
18 }
19
20 function unfamiliar_category_label ($name) {
21 if (preg_match('/^create:(.*)$/', $name, $refs)) :
22 $tax = get_taxonomy($refs[1]);
23 $name = sprintf(__('Create new %s to match them'), $tax->labels->name);
24 endif;
25 return $name;
26 }
27
28
29 function feed_categories_box ($page, $box = NULL) {
30 $link = $page->link;
31
32 $globalPostType = get_option('feedwordpress_syndicated_post_type', 'post');
33 if ($this->for_feed_settings()) :
34 $post_type = $link->setting('syndicated post type', 'syndicated_post_type', 'post');
35 else :
36 $post_type = $globalPostType;
37 endif;
38 $taxonomies = get_object_taxonomies(array('object_type' => $post_type), 'names');
39
40 $unmatched = array('category' => array(), 'post_tag' => array());
41 $matchUl = array('cats' => array(), 'tags' => array(), 'filter' => array());
42 $tagLikeTaxonomies = array();
43 foreach ($taxonomies as $tax) :
44 $taxonomy = get_taxonomy($tax);
45
46 if (!$taxonomy->hierarchical) :
47 $tagLikeTaxonomies[] = $tax;
48 endif;
49
50 $name = 'create:'.$tax;
51 foreach (array('category', 'post_tag') as $what) :
52 $unmatched[$what][$name] = array(
53 'label' => $this->unfamiliar_category_label($name),
54 );
55 $unmatchedRadio[$what][$name] = '';
56 endforeach;
57
58 foreach (array('cats', 'tags', 'filter') as $what) :
59 $matchUl[$what][$tax] = array(
60 'checked' => '',
61 'labels' => $taxonomy->labels,
62 );
63 endforeach;
64 endforeach;
65
66 foreach ($unmatched as $what => $um) :
67 $unmatched[$what]['null'] = array('label' => __('Don\'t create any matching terms'));
68 $unmatchedRadio[$what]['null'] = '';
69 endforeach;
70
71 $globalUnmatched = array(
72 'category' => FeedWordPress::on_unfamiliar('category'),
73 'post_tag' => FeedWordPress::on_unfamiliar('post_tag'),
74 );
75 foreach ($globalUnmatched as $what => $value) :
76 if ($value=='create') : $value = 'create:category'; endif;
77 if ($value=='tag') : $value = 'create:post_tag'; endif;
78 $globalUnmatched[$what] = $value;
79 endforeach;
80
81 $globalMatch['cats'] = get_option('feedwordpress_match_cats', $taxonomies);
82 $globalMatch['tags'] = get_option('feedwordpress_match_tags', $tagLikeTaxonomies);
83 $globalMatch['filter'] = get_option('feedwordpress_match_filter', array());
84
85 $globalMatchLabels = array();
86 $nothingDoing = array('cats' => "won't try to match", 'tags' => "won't try to match", "filter" => "won't filter");
87
88 foreach ($globalMatch as $what => $domain) :
89 $labels = array(); $domain = array_filter($domain, 'remove_dummy_zero');
90 foreach ($domain as $tax) :
91 $tax = get_taxonomy($tax);
92 $labels[] = $tax->labels->name;
93 endforeach;
94
95 if (count($labels) > 0) :
96 $globalMatchLabels[$what] = implode(", ", $labels);
97 else :
98 $globalMatchLabels[$what] = $nothingDoing[$what];
99 endif;
100 endforeach;
101
102 if ($this->for_feed_settings()) :
103 $href = $this->admin_page_href(basename(__FILE__));
104
105 foreach ($unmatched as $what => $um) :
106 // Is the global default setting appropriate to this post type?
107 $GUC = $globalUnmatched[$what];
108 if (isset($um[$GUC])) :
109 // Yup. Let's add a site-default option
110 $currently = $um[$GUC]['label'];
111 $defaultLi = array(
112 'site-default' => array(
113 'label' => sprintf(
114 __('Use the <a href="%s">site-wide setting</a> <span class="current-setting">Currently: <strong>%s</strong></span>'),
115 $href,
116 $currently
117 ),
118 ), );
119 $unmatchedColumns[$what] = array(
120 $defaultLi,
121 );
122 $unmatchedDefault[$what] = 'site-default';
123 $unmatchedRadio[$what]['site-default'] = '';
124 else :
125 $opts = array_keys($unmatched[$what]);
126 $unmatchedDefault[$what] = $opts[0];
127 $unmatchedColumns[$what] = array();
128 endif;
129
130 $ucKey[$what] = $link->setting("unfamiliar $what", NULL, NULL);
131 endforeach;
132
133 $match['cats'] = $this->link->setting('match/cats', NULL, NULL);
134 $match['tags'] = $this->link->setting('match/tags', NULL, NULL);
135 $match['filter'] = $this->link->setting('match/filter', NULL, NULL);
136 else :
137 foreach ($unmatched as $what => $um) :
138 $ucKey[$what] = FeedWordPress::on_unfamiliar($what);
139 endforeach;
140
141 $match = $globalMatch;
142 endif;
143
144 foreach ($ucKey as $what => $uck) :
145 if ($uck == 'tag') : $uck = 'create:post_tag'; endif;
146 if ($uck == 'create') : $uck = 'create:category'; endif;
147
148 if (!is_string($uck)) :
149 $uck = $unmatchedDefault[$what];
150 endif;
151 $ucKey[$what] = $uck;
152
153 if (!array_key_exists($uck, $unmatchedRadio[$what])) :
154 $obsoleteLi = array(
155 $uck => array(
156 'label' => ' <span style="font-style: italic; color: #777;">'.$this->unfamiliar_category_label($uck).'</span> <span style="background-color: #ffff90; color: black;">(This setting is no longer applicable to the type of post syndicated from this feed!)</span><p>Please change this one of the following settings:</p>',
157 ),
158 );
159 $unmatched[$what] = array_merge($obsoleteLi, $unmatched[$what]);
160 $unmatchedRadio[$what][$uck] = ' disabled="disabled"';
161 endif;
162
163 $unmatchedRadio[$what][$uck] .= ' checked="checked"';
164
165 $unmatchedColumns[$what][] = $unmatched[$what];
166 endforeach;
167
168 $defaulted = array();
169 foreach ($match as $what => $set) :
170 $defaulted[$what] = false;
171 if (is_null($set) or (count($set) < 1)) :
172 $defaulted[$what] = true;
173 if ($this->for_feed_settings()) :
174 $set = $globalMatch[$what];
175 $match[$what] = $globalMatch[$what];
176 endif;
177 endif;
178
179 if (!$defaulted[$what] or $this->for_feed_settings()) :
180 foreach ($set as $against) :
181 if (array_key_exists($against, $matchUl[$what])) :
182 $matchUl[$what][$against]['checked'] = ' checked="checked"';
183 endif;
184 endforeach;
185 endif;
186 endforeach;
187
188 // Hey ho, let's go...
189 $offerSiteWideSettings = ($page->for_feed_settings() and ($post_type==$globalPostType));
190 ?>
191 <table class="edit-form narrow">
192 <tr>
193 <th scope="row">Match feed categories:</th>
194 <td><input type="hidden" name="match_categories[cats][]" value="0" />
195 <?php if ($offerSiteWideSettings) : ?>
196 <table class="twofer">
197 <tbody>
198 <tr><td class="equals first <?php if ($defaulted['cats']) : ?>active<?php else: ?>inactive<?php endif; ?>"><p><label><input type="radio" name="match_default[cats]"
199 value="yes" <?php if ($defaulted['cats']) : ?> checked="checked"<?php endif; ?> />
200 Use the <a href="<?php print $href; ?>">site-wide setting</a>
201 <span class="current-setting">Currently: <strong><?php print $globalMatchLabels['cats']; ?></strong></span></label></p></td>
202 <td class="equals second <?php if ($defaulted['cats']) : ?>inactive<?php else: ?>active<?php endif; ?>"><p><label><input type="radio" name="match_default[cats]"
203 value="no" <?php if (!$defaulted['cats']) : ?> checked="checked"<?php endif; ?> />
204 Do something different with this feed.</label>
205 <?php else : ?>
206 <p>
207 <?php endif; ?>
208 When a feed provides categories for a post, try to match those categories
209 locally with:</p>
210 <ul class="options compact">
211 <?php foreach ($matchUl['cats'] as $name => $li) : ?>
212 <li><label><input type="checkbox"
213 name="match_categories[cats][]" value="<?php print $name; ?>"
214 <?php print $li['checked']; ?> /> <?php $l = $li['labels']; print $l->name; ?></label></li>
215 <?php endforeach; ?>
216 </ul>
217 <?php if ($offerSiteWideSettings) : ?>
218 </td></tr>
219 </tbody>
220 </table>
221 <?php endif; ?>
222 </td>
223 </tr>
224
225 <tr>
226 <th scope="row">Unmatched categories:</th>
227 <td><p>When <?php print $this->these_posts_phrase(); ?> have categories on
228 the feed that don't have any local matches yet...</p>
229
230 <?php if (count($unmatchedColumns['category']) > 1) : ?>
231 <table class="twofer">
232 <?php else : ?>
233 <table style="width: 100%">
234 <?php endif; ?>
235 <tbody>
236 <tr>
237 <?php foreach ($unmatchedColumns['category'] as $index => $column) : ?>
238 <td class="equals <?php print (($index == 0) ? 'first' : 'second'); ?> inactive"><ul class="options">
239 <?php foreach ($column as $name => $li) : ?>
240 <li><label><input type="radio" name="unfamiliar_category" value="<?php print $name; ?>"<?php print $unmatchedRadio['category'][$name]; ?> /> <?php print $li['label']; ?></label></li>
241 <?php endforeach; ?>
242 </ul></td>
243 <?php endforeach; ?>
244 </tr>
245 </tbody>
246 </table>
247 </td></tr>
248
249 <tr>
250 <th scope="row">Match inline tags:
251 <p class="setting-description">Applies only to inline tags marked
252 as links in the text of syndicated posts, using the
253 <code>&lt;a rel="tag"&gt;...&lt;/a&gt;</code> microformat.
254 Most feeds with "tags" just treat them as normal feed categories,
255 like those handled above.</p>
256 </th>
257 <td><input type="hidden" name="match_categories[tags][]" value="0" />
258 <?php if ($offerSiteWideSettings) : ?>
259 <table class="twofer">
260 <tbody>
261 <tr><td class="equals first <?php if ($defaulted['tags']) : ?>active<?php else: ?>inactive<?php endif; ?>"><p><label><input type="radio" name="match_default[tags]"
262 value="yes" <?php if ($defaulted['tags']) : ?> checked="checked"<?php endif; ?> />
263 Use the <a href="<?php print $href; ?>">site-wide setting</a>
264 <span class="current-setting">Currently: <strong><?php print $globalMatchLabels['tags']; ?></strong></span></label></p>
265 </td>
266 <td class="equals second <?php if ($defaulted['tags']) : ?>inactive<?php else: ?>active<?php endif; ?>"><p><label><input type="radio" name="match_default[tags]"
267 value="no" <?php if (!$defaulted['tags']) : ?> checked="checked"<?php endif; ?> />
268 Do something different with this feed.</label>
269 <?php else : ?>
270 <p>
271 <?php endif; ?>
272 When a feed provides tags inline in a post, try to match those tags
273 locally with:</p>
274 <ul class="options compact">
275 <?php foreach ($matchUl['tags'] as $name => $li) : ?>
276 <li><label><input type="checkbox"
277 name="match_categories[tags][]" value="<?php print $name; ?>"
278 <?php print $li['checked']; ?> /> <?php $l = $li['labels']; print $l->name; ?></label></li>
279 <?php endforeach; ?>
280 </ul>
281 <?php if ($offerSiteWideSettings) : ?>
282 </td></tr>
283 </tbody>
284 </table>
285 <?php endif; ?>
286 </td>
287 </tr>
288
289 <tr>
290 <th scope="row">Unmatched inline tags:</th>
291 <td><p>When the text of <?php print $this->these_posts_phrase(); ?> contains
292 inline tags that don't have any local matches yet...</p>
293
294 <?php if (count($unmatchedColumns['post_tag']) > 1) : ?>
295 <table class="twofer">
296 <?php else : ?>
297 <table style="width: 100%">
298 <?php endif; ?>
299 <tbody>
300 <tr>
301 <?php foreach ($unmatchedColumns['post_tag'] as $index => $column) : ?>
302 <td class="equals <?php print (($index == 0) ? 'first' : 'second'); ?> inactive"><ul class="options">
303 <?php foreach ($column as $name => $li) : ?>
304 <li><label><input type="radio" name="unfamiliar_post_tag" value="<?php print $name; ?>"<?php print $unmatchedRadio['post_tag'][$name]; ?> /> <?php print $li['label']; ?></label></li>
305 <?php endforeach; ?>
306 </ul></td>
307 <?php endforeach; ?>
308 </tr>
309 </tbody>
310 </table>
311
312 </td></tr>
313
314 <tr>
315 <th scope="row">Filter:</th>
316 <td><input type="hidden" name="match_categories[filter][]" value="0" />
317 <?php if ($offerSiteWideSettings) : ?>
318 <table class="twofer">
319 <tbody>
320 <tr>
321 <td class="equals first <?php if ($defaulted['filter']) : ?>active<?php else: ?>inactive<?php endif; ?>">
322 <p><label><input type="radio" name="match_default[filter]"
323 value="yes" <?php if ($defaulted['filter']) : ?> checked="checked"<?php endif; ?> />
324 Use the <a href="<?php print $href; ?>">site-wide setting</a>
325 <span class="current-setting">Currently: <strong><?php print $globalMatchLabels['filter']; ?></strong></span></label></p>
326 </td>
327 <td class="equals second <?php if ($defaulted['filter']) : ?>inactive<?php else: ?>active<?php endif; ?>">
328 <p><label><input type="radio" name="match_default[filter]"
329 value="no" <?php if (!$defaulted['filter']) : ?> checked="checked"<?php endif; ?> />
330 Do something different with this feed:</label></p>
331 <div style="margin-left: 3.0em;">
332 <?php endif; ?>
333
334 <ul class="options">
335 <?php foreach ($matchUl['filter'] as $tax => $li) : ?>
336 <li><label><input type="checkbox" name="match_categories[filter][]" value="<?php print $tax; ?>"
337 <?php print $li['checked']; ?> /> Don't syndicate posts unless they match at
338 least one local <strong><?php $l = $li['labels']; print $l->singular_name; ?></strong></label></li>
339 <?php endforeach; ?>
340 </ul>
341
342 <?php if ($offerSiteWideSettings) : ?>
343 </div>
344 </td></tr>
345 </tbody>
346 </table>
347 <?php endif; ?>
348 </td>
349 </tr>
350 <?php if ($page->for_feed_settings()) : ?>
351 <tr>
352 <th scope="row">Multiple categories:</th>
353 <td>
354 <input type="text" size="20" id="cat_split" name="cat_split" value="<?php if (isset($link->settings['cat_split'])) : echo htmlspecialchars($link->settings['cat_split']); endif; ?>" />
355 <p class="setting-description">Enter a <a href="http://us.php.net/manual/en/reference.pcre.pattern.syntax.php">Perl-compatible regular expression</a> here if the feed provides multiple
356 categories in a single category element. The regular expression should match
357 the characters used to separate one category from the next. If the feed uses
358 spaces (like <a href="http://del.icio.us/">del.icio.us</a>), use the pattern "\s".
359 If the feed does not provide multiple categories in a single element, leave this
360 blank.</p></td>
361 </tr>
362 <?php endif; ?>
363 </table>
364 <?php
365 } /* FeedWordPressCategoriesPage::feed_categories_box() */
366
367 function term_option_map () {
368 return array(
369 'category' => 'feedwordpress_syndication_cats',
370 'post_tag' => 'feedwordpress_syndication_tags',
371 );
372 }
373 function term_setting_map () {
374 return array(
375 'category' => 'cats',
376 'post_tag' => 'tags',
377 );
378 }
379
380 function categories_box ($page, $box = NULL) {
381 $link = $page->link;
382
383 if ($this->for_feed_settings()) :
384 $post_type = $link->setting('syndicated post type', 'syndicated_post_type', 'post');
385 else :
386 $post_type = get_option('feedwordpress_syndicated_post_type', 'post');
387 endif;
388 $taxonomies = get_object_taxonomies(array('object_type' => $post_type), 'names');
389
390 $option_map = $this->term_option_map();
391 $setting_map = $this->term_setting_map();
392 $globalTax = get_option('feedwordpress_syndication_terms', array());
393 if ($page->for_feed_settings()) :
394 $terms = $link->setting('terms', NULL, array());
395 endif;
396
397 ?>
398 <table class="edit-form narrow">
399 <tbody>
400 <?php
401 foreach ($taxonomies as $tax) :
402 $taxonomy = get_taxonomy($tax);
403 ?>
404 <tr><th><?php print $taxonomy->labels->name; ?></th>
405 <td><?php
406 if (isset($option_map[$tax])) :
407 $option = $option_map[$tax];
408 $globalCats = preg_split(FEEDWORDPRESS_CAT_SEPARATOR_PATTERN, get_option($option));
409 elseif (isset($globalTax[$tax])) :
410 $globalCats = $globalTax[$tax];
411 else :
412 $globalCats = array();
413 endif;
414 $globalCats = array_map('trim', $globalCats);
415
416 if ($page->for_feed_settings()) :
417 $add_global_categories = $link->setting("add/$tax", NULL, 'yes');
418 $checked = array('yes' => '', 'no' => '');
419 $checked[$add_global_categories] = ' checked="checked"';
420
421 if (isset($setting_map[$tax])) :
422 $setting = $setting_map[$tax];
423 $cats = $link->setting($setting, NULL, NULL);
424 if (is_null($cats)) : $cats = array(); endif;
425 elseif (isset($terms[$tax])) :
426 $cats = $terms[$tax];
427 else :
428 $cats = array();
429 endif;
430 else :
431 $cats = $globalCats;
432 endif;
433
434 if ($page->for_feed_settings()) :
435 ?>
436 <table class="twofer">
437 <tbody>
438 <tr>
439 <td class="primary">
440 <?php
441 endif;
442
443 $dogs = SyndicatedPost::category_ids($cats, /*unfamiliar=*/ NULL, /*taxonomies=*/ array($tax));
444
445 if ($taxonomy->hierarchical) : // Use a category-style checkbox
446 fwp_category_box($dogs, 'all '.$page->these_posts_phrase(), /*tags=*/ array(), /*params=*/ array('taxonomy' => $tax));
447 else : // Use a tag-style edit box
448 fwp_tags_box($cats, 'all '.$page->these_posts_phrase(), /*params=*/ array('taxonomy' => $tax));
449 endif;
450
451 $globalDogs = SyndicatedPost::category_ids($globalCats, /*unfamiliar=*/ 'create:'.$tax, /*taxonomies=*/ array($tax));
452
453 $siteWideHref = $this->admin_page_href(basename(__FILE__));
454
455 if ($page->for_feed_settings()) :
456 ?>
457 </td>
458 <td class="secondary">
459 <h4>Site-wide <?php print $taxonomy->labels->name; ?></h4>
460 <?php if (count($globalCats) > 0) : ?>
461 <ul class="current-setting">
462 <?php foreach ($globalDogs as $dog) : ?>
463 <li><?php $cat = get_term($dog, $tax); print $cat->name; ?></li>
464 <?php endforeach; ?>
465 </ul>
466 </div>
467 <p>
468 <?php else : ?>
469 <p>Site-wide settings may also assign categories to syndicated
470 posts.
471 <?php endif; ?>
472 Should <?php print $page->these_posts_phrase(); ?> be assigned
473 these <?php print $taxonomy->labels->name; ?> from the <a href="<?php print esc_html($siteWideHref); ?>">site-wide settings</a>, in
474 addition to the feed-specific <?php print $taxonomy->labels->name; ?> you set up here?</p>
475
476 <ul class="settings">
477 <li><p><label><input type="radio" name="add_global[<?php print $tax; ?>]" value="yes" <?php print $checked['yes']; ?> /> Yes. Place <?php print $page->these_posts_phrase(); ?> under all these categories.</label></p></li>
478 <li><p><label><input type="radio" name="add_global[<?php print $tax; ?>]" value="no" <?php print $checked['no']; ?> /> No. Only use the categories I set up on the left. Do not use the global defaults for <?php print $page->these_posts_phrase(); ?></label></p></li>
479 </ul>
480 </td>
481 </tr>
482 </tbody>
483 </table>
484 <?php
485 endif;
486 ?>
487 </td>
488 </tr>
489 <?php
490 endforeach;
491 ?>
492 </tbody>
493 </table>
494 <?php
495 } /* FeedWordPressCategoriesPage::categories_box () */
496
497 function save_settings ($post) {
498 if (isset($post['match_categories'])) :
499 foreach ($post['match_categories'] as $what => $set) :
500 // Defaulting is controlled by a separate radio button
501 if ($this->for_feed_settings()
502 and isset($post['match_default'])
503 and isset($post['match_default'][$what])
504 and $post['match_default'][$what]=='yes') :
505 $set = NULL; // Defaulted!
506 endif;
507
508 $this->update_setting("match/$what", $set, NULL);
509 endforeach;
510 endif;
511 $optionMap = $this->term_option_map();
512 $settingMap = $this->term_setting_map();
513
514 $saveTerms = array(); $separateSaveTerms = array('category' => array(), 'post_tag' => array());
515
516 if (!isset($post['tax_input'])) : $post['tax_input'] = array(); endif;
517
518 // Merge in data from older-notation category check boxes
519 if (isset($post['post_category'])) :
520 // Just merging in for processing below.
521 $post['tax_input']['category'] = array_merge(
522 (isset($post['tax_input']['category']) ? $post['tax_input']['category'] : array()),
523 $post['post_category']
524 );
525 endif;
526
527 // Process data from term tag boxes and check boxes
528 foreach ($post['tax_input'] as $tax => $terms) :
529 $saveTerms[$tax] = array();
530 if (is_array($terms)) : // Numeric IDs from checklist
531 foreach ($terms as $term) :
532 if ($term) :
533 $saveTerms[$tax][] = '{'.$tax.'#'.$term.'}';
534 endif;
535 endforeach;
536 else : // String from tag input
537 $saveTerms[$tax] = explode(",", $terms);
538 endif;
539 $saveTerms[$tax] = array_map('trim', $saveTerms[$tax]);
540
541 if (isset($optionMap[$tax])) :
542 $separateSaveTerms[$tax] = $saveTerms[$tax];
543 unset($saveTerms[$tax]);
544 endif;
545 endforeach;
546
547 if (isset($post['post_category'])) :
548 foreach ($post['post_category'] as $cat) :
549 $separateSaveTerms['category'][] = '{category#'.$cat.'}';
550 endforeach;
551 endif;
552
553 // Unmatched categories and tags
554 foreach (array('category', 'post_tag') as $what) :
555 if (isset($post["unfamiliar_{$what}"])) :
556 $this->update_setting(
557 "unfamiliar {$what}",
558 $post["unfamiliar_{$what}"],
559 'site-default'
560 );
561 endif;
562 endforeach;
563
564 // Categories and Tags
565 foreach ($separateSaveTerms as $tax => $terms) :
566 if ($this->for_feed_settings()) :
567 $this->link->update_setting($settingMap[$tax], $terms, array());
568 else :
569 if (!empty($terms)) :
570 update_option($optionMap[$tax], implode(FEEDWORDPRESS_CAT_SEPARATOR, $terms));
571 else :
572 delete_option($optionMap[$tax]);
573 endif;
574 endif;
575 endforeach;
576
577 // Other terms
578 $this->update_setting(array('feed'=>'terms', 'global'=>'syndication_terms'), $saveTerms, array());
579
580 if ($this->for_feed_settings()) :
581 // Category splitting regex
582 if (isset($post['cat_split'])) :
583 $this->link->update_setting('cat_split', trim($post['cat_split']), '');
584 endif;
585
586 // Treat global terms (cats, tags, etc.) as additional,
587 // or as defaults to be overridden and replaced?
588 if (isset($post['add_global'])) :
589 foreach ($post['add_global'] as $what => $value) :
590 $this->link->update_setting("add/$what", $value);
591 endforeach;
592 endif;
593 endif;
594 parent::save_settings($post);
595 } /* FeedWordPressCategoriesPage::save_settings() */
596
597 function display () {
598 ////////////////////////////////////////////////
599 // Display settings boxes //////////////////////
600 ////////////////////////////////////////////////
601
602 $this->boxes_by_methods = array(
603 'feed_categories_box' => __('Feed Categories & Tags'),
604 'categories_box' => array('title' => __('Categories'), 'id' => 'categorydiv'),
605 );
606
607 parent::display();
608 }
609 }
610
611 $categoriesPage = new FeedWordPressCategoriesPage;
612 $categoriesPage->display();
613
614