PluginProbe
FeedWordPress / 2022.0222
FeedWordPress v2022.0222
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
← All changes | posts-page.php +58 -61 trunk2022.0222 View file →
@@ -19,9 +19,9 @@
19 19 parent::__construct('feedwordpresspostspage', $link);
20 20 $this->dispatch = 'feedwordpress_admin_page_posts';
21 21 $this->filename = __FILE__;
22 22 $this->updatedPosts = new UpdatedPostsControl($this);
23 -
23 +
24 24 $this->pagenames = array(
25 25 'default' => 'Posts',
26 26 'settings-update' => 'Syndicated posts',
27 27 'open-sheet' => 'Syndicated Posts & Links',
@@ -51,9 +51,9 @@
51 51 endforeach;
52 52
53 53 $this->updatedPosts->accept_POST();
54 54 if ($this->for_feed_settings()) :
55 - // $alter = array(); // this appears elsewhere, too, also unused, and possibly removed as well (gwyneth 20230920)
55 + $alter = array ();
56 56
57 57 $this->link->settings['postmeta'] = serialize($custom_settings);
58 58
59 59 if ( ! is_null( FeedWordPress::post( 'resolve_relative', null ) ) ) :
@@ -77,9 +77,9 @@
77 77 $this->link->settings[ $afield ] = FeedWordPress::post( $sfield, null, 'text' );
78 78 endif;
79 79 endif;
80 80 endforeach;
81 -
81 +
82 82 if ( ! is_null( FeedWordPress::post('syndicated_post_type', null, 'text' ) ) ) :
83 83 if ( FeedWordPress::post( 'syndicated_post_type', null, 'text' ) == 'default' ) :
84 84 unset($this->link->settings['syndicated post type']);
85 85 else :
@@ -91,13 +91,13 @@
91 91 // update_option ...
92 92 if ( ! is_null( FeedWordPress::post( 'feed_post_status', null ) ) ) :
93 93
94 94 update_option('feedwordpress_syndicated_post_status', FeedWordPress::post( 'feed_post_status', null, 'text' ) );
95 -
95 +
96 96 endif;
97 97
98 98 update_option('feedwordpress_custom_settings', serialize($custom_settings));
99 -
99 +
100 100 $sMungePermalink = FeedWordPress::post('munge_permalink', null, 'text' );
101 101 $sUseAggregatorSourceData = FeedWordPress::post( 'use_aggregator_source_data', null, 'text' );
102 102 $sFormattingFilters = FeedWordPress::post('formatting_filters', null, 'text' );
103 103 $sFeedCommentStatus = FeedWordPress::post( 'feed_comment_status', '', 'text' );
@@ -115,9 +115,9 @@
115 115 endif;
116 116 if ( ! is_null( $sMungeCommentsFeedLinks ) ) :
117 117 update_option('feedwordpress_munge_comments_feed_links', $sMungeCommentsFeedLinks );
118 118 endif;
119 -
119 +
120 120 if ( $sFeedCommentStatus == 'open' ) :
121 121 update_option('feedwordpress_syndicated_comment_status', 'open');
122 122 else :
123 123 update_option('feedwordpress_syndicated_comment_status', 'closed');
@@ -169,9 +169,9 @@
169 169 *
170 170 * @uses FeedWordPressPostsPage::these_posts_phrase()
171 171 * @uses FeedWordPress::syndicated_status()
172 172 * @uses SyndicatedLink::syndicated_status()
173 - */
173 + */
174 174 /*static*/ function publication_box ($page, $box = NULL) {
175 175 $thesePosts = $page->these_posts_phrase();
176 176 $postSelector = array(
177 177 'publish' => "Publish %s immediately",
@@ -183,9 +183,9 @@
183 183 foreach ($postSelector as $index => $value) :
184 184 $postSelector[$index] = sprintf(__($value), $thesePosts);
185 185 $labels[$index] = __(str_replace(' %s', '', strtolower(strtok($value, ';'))));
186 186 endforeach;
187 -
187 +
188 188 $params = array(
189 189 'input-name' => 'feed_post_status',
190 190 'setting-default' => NULL,
191 191 'global-setting-default' => 'publish',
@@ -194,9 +194,9 @@
194 194
195 195 // Hey ho, let's go...
196 196 ?>
197 197 <table id="syndicated-publication-form" class="edit-form narrow">
198 - <tr><th scope="row"><?php esc_html_e('New posts:'); ?></th>
198 + <tr><th scope="row"><?php _e('New posts:'); ?></th>
199 199 <td><?php
200 200 $this->setting_radio_control(
201 201 'post status', 'syndicated_post_status',
202 202 $postSelector, $params
@@ -205,23 +205,23 @@
205 205 </td></tr>
206 206
207 207 <?php $page->updatedPosts->display(); ?>
208 208 </table>
209 -
209 +
210 210 <?php
211 211 } /* FeedWordPressPostsPage::publication_box () */
212 -
212 +
213 213 /**
214 214 * Outputs "Formatting" settings box
215 215 *
216 216 * @since 2009.0713
217 - * @param FeedWordPressPostsPage $page of class FeedWordPressPostsPage tells us whether this is
218 - * a page for one feed's settings or for global defaults
217 + * @param object $page of class FeedWordPressPostsPage tells us whether this is
218 + * a page for one feed's settings or for global defaults
219 219 * @param array $box
220 220 *
221 - */
222 - function formatting_box( $page, $box = NULL ) {
223 - $thesePosts = $page->these_posts_phrase(); // result unused, why? (gwyneth 20230920)
221 + */
222 + function formatting_box ($page, $box = NULL) {
223 + $thesePosts = $page->these_posts_phrase();
224 224
225 225 if ($page->for_feed_settings()) :
226 226 $formatting_filters = null;
227 227 $url = preg_replace('|/+$|', '', $page->link->homepage());
@@ -230,9 +230,9 @@
230 230 $url = 'http://example.com';
231 231 endif;
232 232 ?>
233 233 <table class="edit-form narrow">
234 - <?php if ( !is_null($formatting_filters)) : ?>
234 + <?php if (!is_null($formatting_filters)) : ?>
235 235
236 236 <tr><th scope="row">Formatting filters:</th>
237 237 <td><select name="formatting_filters" size="1">
238 238 <option value="no"<?php echo ($formatting_filters!='yes')?' selected="selected"':''; ?>>Protect syndicated posts from formatting filters</option>
@@ -244,9 +244,9 @@
244 244 problem.</p>
245 245 </td></tr>
246 246
247 247 <?php endif; ?>
248 -
248 +
249 249 <tr><th scope="row">Relative URIs:</th>
250 250 <td><p>If link or image in a syndicated post from <code><?php print esc_html($url); ?></code>
251 251 refers to a partial URI like <code>/about</code>, where should
252 252 the syndicated copy point to?</p>
@@ -269,15 +269,15 @@
269 269 $this->setting_radio_control(
270 270 'resolve relative', 'resolve_relative',
271 271 $options, $params
272 272 );
273 - ?>
273 + ?>
274 274 </td></tr>
275 275
276 276 </table>
277 277 <?php
278 278 } /* FeedWordPressPostsPage::formatting_box() */
279 -
279 +
280 280 /**
281 281 * Output "Links" settings box
282 282 *
283 283 * @since 2009.0713
@@ -293,9 +293,9 @@
293 293 'no' => __('The local copy on this website'),
294 294 ),
295 295 );
296 296
297 - if ( ! $page->for_feed_settings()) :
297 + if (!$page->for_feed_settings()) :
298 298 $use_aggregator_source_data = get_option('feedwordpress_use_aggregator_source_data');
299 299 endif;
300 300 ?>
301 301 <table class="edit-form narrow">
@@ -300,9 +300,9 @@
300 300 ?>
301 301 <table class="edit-form narrow">
302 302 <tr><th scope="row">Permalinks point to:</th>
303 303 <td><?php
304 -
304 +
305 305 $params = array(
306 306 'setting-default' => 'default',
307 307 'global-setting-default' => 'yes',
308 308 'default-input-value' => 'default',
@@ -313,10 +313,10 @@
313 313 );
314 314 ?>
315 315
316 316 </td></tr>
317 -
318 - <?php if ( ! $page->for_feed_settings()) : ?>
317 +
318 + <?php if (!$page->for_feed_settings()) : ?>
319 319 <tr><th scope="row">Posts from aggregator feeds:</th>
320 320 <td><ul class="options">
321 321 <li><label><input type="radio" name="use_aggregator_source_data" value="no"<?php echo ($use_aggregator_source_data!="yes")?' checked="checked"':''; ?>> Give the aggregator itself as the source of posts from an aggregator feed.</label></li>
322 322 <li><label><input type="radio" name="use_aggregator_source_data" value="yes"<?php echo ($use_aggregator_source_data=="yes")?' checked="checked"':''; ?>> Give the original source of the post as the source, not the aggregator.</label></li>
@@ -345,9 +345,9 @@
345 345 'comment' => array('label' => __('Comments'), 'accept' => 'Allow comments'),
346 346 'ping' => array('label' => __('Pings'), 'accept' => 'Accept pings'),
347 347 );
348 348 $onThesePosts = 'on '.$page->these_posts_phrase();
349 -
349 +
350 350 $mcflSettings = array(
351 351 "yes" => __('Point to comment feeds from the original website (when provided by the syndicated feed)'),
352 352 "no" => __('Point to local comment feeds on this website'),
353 353 );
@@ -370,9 +370,9 @@
370 370 'open' => sprintf(__("{$how['accept']} %s"), __($onThesePosts)),
371 371 'closed' => sprintf(__("Don't ".strtolower($how['accept'])." %s"), __($onThesePosts)),
372 372 );
373 373 $params[$what] = array(
374 - 'input-name' => "feed_{$what}_status",
374 + 'input-name' => "feed_${what}_status",
375 375 'setting-default' => NULL,
376 376 'global-setting-default' => FeedWordPress::syndicated_status($what, /*default=*/ 'closed'),
377 377 'labels' => array(
378 378 'open' => strtolower(__($how['accept'])),
@@ -384,20 +384,20 @@
384 384 // Hey ho, let's go...
385 385 ?>
386 386 <table class="edit-form narrow">
387 387 <?php foreach ($whatsits as $what => $how) : ?>
388 -
388 +
389 389 <tr><th scope="row"><?php print esc_html($how['label']); ?>:</th>
390 390 <td><?php
391 391 $this->setting_radio_control(
392 - "$what status", "syndicated_{$what}_status",
392 + "$what status", "syndicated_${what}_status",
393 393 $settings[$what], $params[$what]
394 394 );
395 395 ?></td></tr>
396 -
396 +
397 397 <?php endforeach; ?>
398 -
399 - <tr><th scope="row"><?php esc_html_e('Comment feeds'); ?></th>
398 +
399 + <tr><th scope="row"><?php _e('Comment feeds'); ?></th>
400 400 <td><p>When WordPress feeds and templates link to comments
401 401 feeds for <?php print esc_html($page->these_posts_phrase()); ?>, the
402 402 URLs for the feeds should...</p>
403 403 <?php
@@ -409,9 +409,9 @@
409 409 </table>
410 410
411 411 <?php
412 412 } /* FeedWordPressPostsPage::comments_and_pings_box() */
413 -
413 +
414 414 /*static*/ function custom_post_settings ($page = NULL) {
415 415 if (is_null($page)) :
416 416 $page = $this;
417 417 endif;
@@ -424,23 +424,15 @@
424 424
425 425 if ($custom_settings and !is_array($custom_settings)) :
426 426 $custom_settings = unserialize($custom_settings);
427 427 endif;
428 -
429 - if ( !is_array($custom_settings)) :
428 +
429 + if (!is_array($custom_settings)) :
430 430 $custom_settings = array();
431 431 endif;
432 432
433 433 return $custom_settings;
434 434 } /* FeedWordPressPostsPage::custom_post_settings() */
435 -
436 - /*static*/ function custom_post_settings_box_tester_button ( $id, $page, $box = NULL ) {
437 -
438 - ?>
439 - <br/><button id="<?php print esc_attr( sprintf( 'xpath-test-%d', $id ) ); ?>" class="xpath-test">test expression</button>
440 - <?php
441 -
442 - }
443 435
444 436 /**
445 437 * Output "Custom Post Settings" settings box
446 438 *
@@ -462,15 +454,18 @@
462 454 </tr>
463 455
464 456 <?php
465 457 $i = 0;
466 - foreach ($custom_settings as $key => $value) :
458 + $testerButton = '<br/><button id="xpath-test-%d"'
459 + .'class="xpath-test"'
460 + .'>test expression</button>';
461 + foreach ($custom_settings as $key => $value) :
467 462 ?>
468 463 <tr style="vertical-align:top">
469 464 <th width="30%" scope="row"><input type="hidden" name="notes[<?php echo esc_attr($i); ?>][key0]" value="<?php echo esc_html($key); ?>" />
470 465 <input id="notes-<?php echo esc_attr( $i ); ?>-key" name="notes[<?php echo esc_attr( $i ); ?>][key1]" value="<?php echo esc_html($key); ?>" /></th>
471 466 <td width="60%"><textarea rows="2" cols="40" id="notes-<?php echo esc_attr($i); ?>-value" name="notes[<?php echo esc_attr($i); ?>][value]"><?php echo esc_html($value); ?></textarea>
472 - <?php self::custom_post_settings_box_tester_button($i, $page, $box); ?></td>
467 + <?php print sprintf($testerButton, esc_attr($i) ); ?></td>
473 468 <td width="10%"><select name="notes[<?php echo esc_attr($i); ?>][action]">
474 469 <option value="update">save changes</option>
475 470 <option value="delete">delete this setting</option>
476 471 </select></td>
@@ -482,9 +477,9 @@
482 477 ?>
483 478
484 479 <tr style="vertical-align: top">
485 480 <th scope="row"><input type="text" size="10" name="notes[<?php echo esc_attr($i); ?>][key1]" value="" /></th>
486 - <td><textarea name="notes[<?php echo esc_attr($i); ?>][value]" rows="2" cols="40"></textarea><?php self::custom_post_settings_box_tester_button( $i, $page, $box ); ?>
481 + <td><textarea name="notes[<?php echo esc_attr($i); ?>][value]" rows="2" cols="40"></textarea><?php print sprintf($testerButton, esc_attr($i)); ?>
487 482 <p>Enter a text value, or a path to a data element from the syndicated item.<br/>
488 483 For data elements, you can use an XPath-like syntax wrapped in <code>$( ... )</code>.<br/>
489 484 <code>hello</code> = the text value <code><span style="background-color: #30FFA0;">hello</span></code><br/>
490 485 <code>$(author/email)</code> = the contents of <code>&lt;author&gt;&lt;email&gt;<span style="background-color: #30FFA0">...</span>&lt;/email&gt;&lt;/author&gt;</code><br/>
@@ -498,12 +493,14 @@
498 493 <?php
499 494 } /* FeedWordPressPostsPage::custom_post_settings_box() */
500 495
501 496 function custom_post_types_box ($page, $box = NULL) {
502 - // local: syndicated post type // default NULL
497 + global $fwp_path;
498 +
499 + // local: syndicated post type // default NULL
503 500 // global: syndicated_post_type // default 'post'
504 501 // default-input-value => 'default'
505 -
502 +
506 503 // Get all custom post types
507 504 $post_types = get_post_types(array(
508 505 '_builtin' => false,
509 506 ), 'objects');
@@ -512,19 +509,19 @@
512 509 $ul['post'] = __('Normal WordPress posts');
513 510 foreach ($post_types as $post_type) :
514 511 $ul[$post_type->name] = __($post_type->labels->name);
515 512 endforeach;
516 -
513 +
517 514 $params = array(
518 515 'global-setting-default' => 'post',
519 516 'default-input-value' => 'default',
520 517 );
521 -
518 +
522 519 // Hey, ho, let's go...
523 520 ?>
524 521 <table class="edit-form narrow">
525 522 <tbody>
526 - <tr><th><?php esc_html_e('Custom Post Types:'); ?></th>
523 + <tr><th><?php _e('Custom Post Types:'); ?></th>
527 524 <td><p>Incoming syndicated posts should be stored in the
528 525 posts database as...</p>
529 526 <?php
530 527 $this->setting_radio_control(
@@ -536,9 +533,9 @@
536 533 </tbody>
537 534 </table>
538 535 <?php
539 536 } /* FeedWordPressPostsPage::custom_post_types_box() */
540 -
537 +
541 538 public function boilerplate_box ($page, $box = NULL) {
542 539 if ($page->for_feed_settings()) :
543 540 $attrib = isset($page->link->settings['boilerplate rules'])
544 541 ? unserialize($page->link->settings['boilerplate rules'])
@@ -549,9 +546,9 @@
549 546 $syndicatedPosts = 'syndicated posts';
550 547 endif;
551 548 $hookOrder = intval($page->setting('boilerplate hook order', FEEDWORDPRESS_BOILERPLATE_DEFAULT_HOOK_ORDER));
552 549 ?>
553 - <style type="text/css">
550 + <style type="text/css">
554 551 .boilerplate-help-box {
555 552 float: right;
556 553 width: 300px;
557 554 border: 1px dotted #777;
@@ -577,9 +574,9 @@
577 574 padding-bottom: 5px;
578 575 margin-bottom: 5px;
579 576 border-bottom: 1px dotted black;
580 577 }
581 -
578 +
582 579 </style>
583 580
584 581 <div class="boilerplate-help-box">
585 582 <p style="border-bottom: 1px dotted #777;">To remove boilerplate, just blank out the text box and leave it empty.</p>
@@ -597,9 +594,9 @@
597 594
598 595 <dt><code>[original-link]text[/original-link]</code></dt>
599 596 <dd>A link to the <em>original post</em> back on the source website,
600 597 using <code>text</code> as the link text.</dd>
601 -
598 +
602 599 <dt><code>[original-url]</code></dt>
603 600 <dd>URL of the <em>original post</em> back on the source website</dd>
604 601
605 602 <dt><code>[author]</code></dt>
@@ -606,9 +603,9 @@
606 603 <dd>A link with the name of the author who wrote the post, linking to other posts by the same author</dd>
607 604
608 605 <dt><code>[author-name]</code></dt>
609 606 <dd>Name of the author who wrote the post</dd>
610 -
607 +
611 608 <dt><code>[feed-setting key="setting-name"]</code></dt>
612 609 <dd>Value of a custom feed setting (named <code>setting-name</code>) for the feed</dd>
613 610 </dl>
614 611 </div>
@@ -614,9 +611,9 @@
614 611 </div>
615 612
616 613 <?php
617 614 print "<ul>\n";
618 - if ( !is_array($attrib)) : $attrib = array(); endif;
615 + if (!is_array($attrib)) : $attrib = array(); endif;
619 616
620 617 print '<input type="hidden" id="next-boilerplate-rule-index" name="next_boilerplate_rule_index" value="'.count($attrib).'" />';
621 618
622 619 // In AJAX environment, this is a dummy rule that stays hidden. In a
@@ -635,9 +632,9 @@
635 632 $selected['title'] = (($line['element']=='title') ? ' selected="selected"' : '');
636 633 $selected['post'] = (($line['element']=='post') ? ' selected="selected"' : '');
637 634 $selected['excerpt'] = (($line['element']=='excerpt') ? ' selected="selected"' : '');
638 635
639 - if ( !isset($line['class'])) : $line['class'] = array(); endif;
636 + if (!isset($line['class'])) : $line['class'] = array(); endif;
640 637 $line['class'][] = 'boilerplate-li';
641 638 ?>
642 639
643 640 <li id="boilerplate-<?php print esc_attr($index); ?>-li" class="<?php print esc_attr(implode(' ', $line['class'])); ?>">&raquo; <strong>Add</strong> <select id="boilerplate-<?php print esc_attr($index); ?>-placement" name="boilerplate[<?php print esc_attr($index); ?>][placement]" style="width: 8.0em">
@@ -646,9 +643,9 @@
646 643 </select> the <select style="width: 8.0em" id="boilerplate-<?php print esc_attr($index); ?>-element" name="boilerplate[<?php print esc_attr($index); ?>][element]">
647 644 <option value="title"<?php fwp_selected_flag($selected, 'title' ); ?>>title</option>
648 645 <option value="post"<?php fwp_selected_flag( $selected, 'post' ); ?>>content</option>
649 646 <option value="excerpt"<?php fwp_selected_flag( $selected, 'excerpt' ); ?>>excerpt</option>
650 -</select> of
647 +</select> of
651 648 <?php print esc_html($syndicatedPosts); ?>: <textarea style="vertical-align: top; width: 40%;" rows="2" cols="30" class="boilerplate-template" id="boilerplate-<?php print esc_attr($index); ?>-template" name="boilerplate[<?php print esc_attr($index); ?>][template]"><?php print esc_html($line['template']); ?></textarea></li>
652 649 <?php
653 650 endif;
654 651 endforeach;
@@ -689,9 +686,9 @@
689 686 };
690 687 dummy[element]['el'].attr('id', newIdPrefix+'-'+element);
691 688 dummy[element]['el'].attr('name', newNamePrefix+'['+element+']');
692 689 }
693 -
690 +
694 691 var newLi = $('#'+newIdPrefix+'-li').clone(/*events=*/ true);
695 692 //newLi.attr('id', null);
696 693 newLi.removeClass('hide-if-js');
697 694 newLi.addClass('boilerplate-li');
@@ -717,9 +714,9 @@
717 714 ?>
718 715 <h3>Advanced Settings</h3>
719 716 <table class="edit-form narrow">
720 717 <tbody>
721 - <tr><th scope="row"><?php esc_html_e("Hook Order:") ?></th>
718 + <tr><th scope="row"><?php _e("Hook Order:") ?></th>
722 719 <td><input type="number" name="boilerplate_hook_order" value="<?php print esc_attr($hookOrder); ?>" /></td></tr>
723 720 </tbody>
724 721 </table>
725 722 <?php
@@ -735,9 +732,9 @@
735 732 'comments_and_pings_box' => __('Comments & Pings'),
736 733 'custom_post_settings_box' => __('Custom Post Settings (to apply to each syndicated post)'),
737 734 'custom_post_types_box' => ('Custom Post Types (advanced database settings)'),
738 735 );
739 -
736 +
740 737 parent::display();
741 738 } /* FeedWordPressPostsPage::display () */
742 739
743 740