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 | admin-ui.php +64 -76 trunk2022.0222 View file →
@@ -14,10 +14,10 @@
14 14 * @package FeedWordPress
15 15 */
16 16
17 17 $dir = dirname( __FILE__ );
18 -require_once "{$dir}/feedwordpressadminpage.class.php";
19 -require_once "{$dir}/feedwordpresssettingsui.class.php";
18 +require_once "${dir}/feedwordpressadminpage.class.php";
19 +require_once "${dir}/feedwordpresssettingsui.class.php";
20 20
21 21 /**
22 22 * Prints the class="..." attribute (if any) for an HTML form element
23 23 *
@@ -90,9 +90,8 @@
90 90 function fwp_checked_flag( /* mixed */ $arg = null, $key = null ) {
91 91 fwp_selected_flag( $arg, $key, 'checked' );
92 92 } /* fwp_checked_flag() */
93 93
94 -if ( ! function_exists( '_s' ) ) :
95 94 /**
96 95 * Retrieves a plural or singular form of a string based on the supplied number.
97 96 *
98 97 * Used when you want to use the appropriate form of a string based on whether
@@ -99,11 +98,8 @@
99 98 * a number is singular or plural. Very similar to WordPress l10n.php _n(),
100 99 * but designed for a nice short form in the
101 100 * default case (provide "s" when plural, "" otherwise).
102 101 *
103 - * @note This function *may* have been defined elsewhere; also, consider
104 - * using WordPress's own `_n()` function and derivatives. (gwyneth 20230920)
105 - *
106 102 * @param int $n The counter to determine singular or plural form.
107 103 * @param string $plural The text to use if the counter is plural.
108 104 * @param string $singular The text to use if the counter is singular.
109 105 *
@@ -111,10 +107,9 @@
111 107 */
112 108 function _s( $n = 0, $plural = 's', $singular = '' ) {
113 109 $is_singular = ( is_numeric( $n ) && intval( $n ) === 1 );
114 110 return ( $is_singular ? $singular : $plural );
115 -} /* _s() */
116 -endif;
111 +}
117 112
118 113 /**
119 114 * Outputs a status message for the aggregate results of polling a set of feeds.
120 115 *
@@ -148,14 +143,14 @@
148 143 if ( ! is_null( $joiner ) ) :
149 144 $mesg = implode( $joiner, $mesg );
150 145 endif;
151 146 return $mesg;
152 -} /* function fwp_update_set_results_message() */
147 +} /* function fwp_update_set_results_message () */
153 148
154 149 /**
155 150 * Outputs the HTML template for a "Submit" button on FWP admin pages.
156 151 *
157 - * @param mixed $link The syndicated link, if any, that we are viewing settings for. (Unused)
152 + * @param mixed $link The syndicated link, if any, that we are viewing settings for.
158 153 */
159 154 function fwp_authors_single_submit( $link = null ) {
160 155 ?>
161 156 <div class="submitbox" id="submitlink">
@@ -168,9 +163,9 @@
168 163 <input type="submit" name="save" value="<?php esc_html_e( 'Save' ); ?>" />
169 164 </p>
170 165 </div>
171 166 <?php
172 -} /* function fwp_authors_single_submit() */
167 +}
173 168
174 169 /**
175 170 * Outputs the HTML template for a Tags (or similar taxonomy) add / remove box in FeedWordPress admin UI pages.
176 171 *
@@ -204,22 +199,22 @@
204 199 if ( is_null( $params['textarea_name'] ) ) :
205 200 $params['textarea_name'] = "tax_input[$tax_name]";
206 201 endif;
207 202 if ( is_null( $params['textarea_id'] ) ) :
208 - $params['textarea_id'] = "tax-input-{$tax_name}";
203 + $params['textarea_id'] = "tax-input-${tax_name}";
209 204 endif;
210 205 if ( is_null( $params['input_id'] ) ) :
211 - $params['input_id'] = "new-tag-{$tax_name}";
206 + $params['input_id'] = "new-tag-${tax_name}";
212 207 endif;
213 208 if ( is_null( $params['input_name'] ) ) :
214 209 $params['input_name'] = "newtag[$tax_name]";
215 210 endif;
211 +
216 212 if ( is_null( $params['id'] ) ) :
217 213 $params['id'] = $tax_name;
218 214 endif;
219 215
220 - printf( /* $desc = */ '<p style="font-size:smaller;font-style:bold;margin:0\">' . esc_html__( 'Tag' ) . ' %s '
221 - . esc_html__( 'as' ) . '...</p>', esc_html( $object ) );
216 + printf( /* $desc = */ '<p style="font-size:smaller;font-style:bold;margin:0\">Tag %s as...</p>', esc_html( $object ) );
222 217 $helps = __( 'Separate tags with commas.' );
223 218 $box['title'] = __( 'Tags' );
224 219 ?>
225 220 <div class="tagsdiv" id="<?php echo esc_attr( $params['id'] ); ?>">
@@ -252,18 +247,16 @@
252 247
253 248 /**
254 249 * Outputs the HTML template for a Category (or similar taxonomy) add / remove box in FeedWordPress admin UI pages.
255 250 *
256 - * @param array $checked An array of cats already applied to the object.
257 - * @param string $object The human-readable description of the objects to be tagged ("post", "posts from this feed", etc.).
258 - * @param array $tags Not used.
259 - * @param array $params An array of optional parameters (to be parsed with wp_parse_args).
260 - *
261 - * @uses wp_parse_args()
262 - * @uses get_taxonomy()
263 - * @uses get_taxonomy_labels()
251 + * @param array $checked An array of cats already applied to the object.
252 + * @param string $object The human-readable description of the objects to be tagged ("post", "posts from this feed", etc.).
253 + * @param array $tags Not used.
254 + * @param array $params An array of optional parameters.
264 255 */
265 256 function fwp_category_box( $checked, $object, $tags = array(), $params = array() ) {
257 + global $wp_db_version;
258 +
266 259 if ( is_string( $params ) ) :
267 260 $prefix = $params;
268 261 $taxonomy = 'category';
269 262 elseif ( is_array( $params ) ) :
@@ -287,9 +280,9 @@
287 280 endif;
288 281
289 282 $id_prefix = $prefix . '-';
290 283 $id_suffix = '-' . $prefix;
291 - $name_prefix = $prefix . '_'; // unused? (gwyneth 20230918)
284 + $name_prefix = $prefix . '_';
292 285
293 286 $box_div_id = sanitize_html_class( $id_prefix . 'taxonomy-' . $taxonomy );
294 287 $tabs_ul_id = sanitize_html_class( $id_prefix . $taxonomy . '-tabs' );
295 288 $all_tab_id = sanitize_html_class( $id_prefix . $taxonomy . '-all' );
@@ -303,9 +296,9 @@
303 296 ?>
304 297 <div id="<?php print esc_attr( $box_div_id ); ?>" class="feedwordpress-category-div">
305 298 <ul id="<?php print esc_attr( $tabs_ul_id ); ?>" class="category-tabs">
306 299 <li class="ui-tabs-selected tabs"><a href="#<?php print esc_attr( $all_tab_id ); ?>" tabindex="3"><?php esc_html_e( 'All posts' ); ?></a>
307 - <p style="font-size:smaller;font-style:bold;margin:0"><?php esc_html_e( 'Give' ); ?> <?php print esc_html( $object ); ?> <?php esc_html_e( 'these' ); ?> <?php print esc_html( $o_tax_labels->name ); ?></p>
300 + <p style="font-size:smaller;font-style:bold;margin:0">Give <?php print esc_html( $object ); ?> these <?php print esc_html( $o_tax_labels->name ); ?></p>
308 301 </li>
309 302 </ul>
310 303
311 304 <div id="<?php print esc_attr( $all_tab_id ); ?>" class="tabs-panel">
@@ -315,9 +308,9 @@
315 308 </ul>
316 309 </div>
317 310
318 311 <div id="<?php print esc_attr( $add_tax_id ); ?>" class="<?php print esc_attr( $taxonomy ); ?>-adder wp-hidden-children">
319 - <h4><a id="<?php print esc_attr( $add_tog_id ); ?>" class="category-add-toggle" href="#<?php print esc_attr( $add_cat_id ); ?>" class="hide-if-no-js" tabindex="3"><span class="dashicons dashicons-plus fwp-no-underline"></span> <?php esc_html_e( 'Add New Category' ); ?></a></h4>.
312 + <h4><a id="<?php print esc_attr( $add_tog_id ); ?>" class="category-add-toggle" href="#<?php print esc_attr( $add_cat_id ); ?>" class="hide-if-no-js" tabindex="3"><?php esc_html_e( '+ Add New Category' ); ?></a></h4>.
320 313 <p id="<?php print esc_attr( $add_cat_id ); ?>" class="category-add wp-hidden-child">
321 314 <?php
322 315 $newcat = 'new' . $taxonomy;
323 316 ?>
@@ -329,9 +322,9 @@
329 322 tabindex="3"
330 323 type="text" name="<?php print esc_attr( $newcat ); ?>"
331 324 value="<?php esc_attr_e( 'New category name' ); ?>"
332 325 />
333 - <label class="screen-reader-text" for="<?php print esc_attr( $new_tax_id ); ?>-parent"><?php esc_html_e( 'Parent Category' ); ?>:</label>
326 + <label class="screen-reader-text" for="<?php print esc_attr( $new_tax_id ); ?>-parent"><?php esc_html_e( 'Parent Category:' ); ?></label>
334 327 <?php
335 328 wp_dropdown_categories(
336 329 array(
337 330 'taxonomy' => $taxonomy,
@@ -366,20 +359,20 @@
366 359 * @param array $feed An associative array containing meta-data about the feed being polled.
367 360 */
368 361 function update_feeds_mention( $feed ) {
369 362 printf(
370 - '<li>' . esc_html__( 'Updating' ) . ' <cite>%s</cite> ' . esc_html__( 'from' ) . ' &lt;<a href="%s">%s</a>&gt; ...',
363 + '<li>Updating <cite>%s</cite> from &lt;<a href="%s">%s</a>&gt; ...',
371 364 esc_html( $feed['link/name'] ),
372 - esc_url( $feed['link/uri'] ),
365 + esc_url( $feed['link/uri'] ),
373 366 esc_html( $feed['link/uri'] )
374 367 );
375 368 flush();
376 -} /* update_feeds_mention() */
369 +}
377 370
378 371 /**
379 372 * Outputs a text/html status message indicating that FWP has completed polling a feed.
380 373 *
381 - * @param array $feed An associative array containing meta-data about the feed being polled (unused).
374 + * @param array $feed An associative array containing meta-data about the feed being polled.
382 375 * @param mixed $added a WP_Error object with error codes and messages, if there was an error in polling.
383 376 * @param int $dt seconds it took to complete the poll.
384 377 */
385 378 function update_feeds_finish( $feed, $added, $dt ) {
@@ -385,16 +378,16 @@
385 378 function update_feeds_finish( $feed, $added, $dt ) {
386 379 if ( is_wp_error( $added ) ) :
387 380 $mesgs = $added->get_error_messages();
388 381 foreach ( $mesgs as $mesg ) :
389 - printf( '<br/><strong>%s:</strong> <code>%s</code>', esc_html__( 'Feed error' ), esc_html( $mesg ) );
382 + printf( '<br/><strong>Feed error:</strong> <code>%s</code>', esc_html( $mesg ) );
390 383 endforeach;
391 384 echo "</li>\n";
392 385 else :
393 - printf( esc_html__(" completed in %d second%s") . "</li>\n", esc_html( $dt ), esc_html( _s( $dt ) ) );
386 + printf( " completed in %d second%s</li>\n", esc_html( $dt ), esc_html( _s( $dt ) ) );
394 387 endif;
395 388 flush();
396 -} /* update_feeds_finish() */
389 +}
397 390
398 391 /**
399 392 * Retrieves a list of users via the WordPress API.
400 393 *
@@ -400,8 +393,9 @@
400 393 *
401 394 * @return array List of users, by numeric ID => display_name
402 395 */
403 396 function fwp_author_list() {
397 + global $wpdb;
404 398 $ret = array();
405 399
406 400 $users = get_users();
407 401 if ( is_array( $users ) ) :
@@ -414,17 +408,19 @@
414 408 endif;
415 409 endforeach;
416 410 endif;
417 411 return $ret;
418 -} /* fwp_author_list() */
412 +}
419 413
420 414 /**
421 415 * Insert a new user into the WordPress database, with some FeedWordPress-specific default behaviors.
422 416 *
423 - * @param string $newuser_name The "Display Name" for the new user; user logins and the like will be determined by a formula.
424 - * @return int|WP_Error Either a numeric ID or a WP_Error object.
417 + * @param string $newuser_name The "Display Name" for the new user; user logins and the like will be determined by a formula.
418 + * @return mixed Either a numeric ID or a WP_Error object.
425 419 */
426 420 function fwp_insert_new_user( $newuser_name ) {
421 + global $wpdb;
422 +
427 423 $ret = null;
428 424 if ( strlen( $newuser_name ) > 0 ) :
429 425 $userdata = array();
430 426 $userdata['ID'] = null;
@@ -476,13 +472,13 @@
476 472 <?php
477 473 foreach ( $fwp_syndicated_sources_columns as $col ) :
478 474 printf( "\t<th scope='col'>%s</th>\n", esc_html( $col ) );
479 475 endforeach;
480 - ?>
481 - </tr>
482 - </thead>
483 - <tbody>
484 - <?php
476 + print "</tr>\n";
477 + print "</thead>\n";
478 + print "\n";
479 + print "<tbody>\n";
480 +
485 481 $alt_row = true;
486 482 if ( count( $links ) > 0 ) :
487 483 foreach ( $links as $link ) :
488 484 $tr_class = array();
@@ -521,9 +517,9 @@
521 517 <?php
522 518 if ( $subscribed ) :
523 519 $page->display_feed_settings_page_links(
524 520 array(
525 - 'before' => '<div><strong> ' . __( 'Settings' ) . ' &gt;</strong> ',
521 + 'before' => '<div><strong>Settings &gt;</strong> ',
526 522 'after' => '</div>',
527 523 'subscription' => $link,
528 524 )
529 525 );
@@ -529,9 +525,9 @@
529 525 );
530 526 endif;
531 527 ?>
532 528
533 - <div><strong><?php esc_html_e( 'Actions' ); ?> &gt;</strong>
529 + <div><strong>Actions &gt;</strong>
534 530 <?php if ( $subscribed ) : ?>
535 531 <a href="<?php print esc_url( $page->admin_page_href( 'syndication.php', array( 'action' => 'feedfinder' ), $link ) ); ?>"><?php echo esc_html( $caption ); ?></a>
536 532 <?php else : ?>
537 533 <a href="<?php print esc_url( $page->admin_page_href( 'syndication.php', array( 'action' => FWP_RESUB_CHECKED ), $link ) ); ?>"><?php esc_html_e( 'Re-subscribe' ); ?></a>
@@ -550,9 +546,9 @@
550 546 </td>
551 547 <?php if ( strlen( $link->link_rss ) > 0 ) : ?>
552 548 <td><div><a href="<?php echo esc_html( $link->link_rss ); ?>"><?php echo esc_html( feedwordpress_display_url( $link->link_rss, 32 ) ); ?></a></div></td>
553 549 <?php else : ?>
554 - <td class="feed-missing"><p><strong><?php esc_html_e( 'no feed assigned' ); ?></strong></p></td>
550 + <td class="feed-missing"><p><strong>no feed assigned</strong></p></td>
555 551 <?php endif; ?>
556 552
557 553 <td><div style="float: right; padding-left: 10px">
558 554 <input type="submit" class="button" name="update_uri[<?php print esc_html( $link->link_rss ); ?>]" value="<?php esc_html_e( 'Update Now' ); ?>" />
@@ -570,15 +566,20 @@
570 566
571 567 endforeach;
572 568 else :
573 569 ?>
574 - <tr><td colspan="4"><p><?php esc_html_e( 'There are no websites currently listed for syndication.' ); ?></p></td></tr>
570 +<tr><td colspan="4"><p>There are no websites currently listed for syndication.</p></td></tr>
575 571 <?php
572 +
576 573 endif;
574 +
577 575 ?>
578 - </tbody>
579 - </table> <!-- <?php print esc_attr( $table_classes ); ?> -->
576 +
577 +</tbody>
578 +</table>
579 +
580 580 <?php
581 +
581 582 endif;
582 583 } /* function fwp_syndication_manage_page_links_table_rows ( ) */
583 584
584 585 /**
@@ -593,10 +594,10 @@
593 594 $s_elapsed = fwp_time_elapsed( $the_error['since'] );
594 595 $s_recent = fwp_time_elapsed( $the_error['ts'] );
595 596 ?>
596 597
597 -<div class="returning-errors"><p><strong><?php esc_html_e( 'Returning errors' ); ?></strong> <?php esc_html_e( 'since' ); ?> <?php print esc_html( $s_elapsed ); ?></p>
598 -<p><?php esc_html_e( 'Most recent' ); ?> (<?php print esc_html( $s_recent ); ?>):
598 +<div class="returning-errors"><p><strong>Returning errors</strong> since <?php print esc_html( $s_elapsed ); ?></p>
599 +<p>Most recent (<?php print esc_html( $s_recent ); ?>):
599 600 <?php
600 601 foreach ( $the_error['object']->get_error_messages() as $mesg ) :
601 602 printf( '<br/><code>%s</code>', esc_html( $mesg ) );
602 603 endforeach;
@@ -614,11 +615,11 @@
614 615 * @param SyndicatedLink $o_s_link The SyndicatedLink object representing the feed displayed on this row.
615 616 */
616 617 function fwp_links_table_rows_last_updated( $o_s_link ) {
617 618 if ( ! is_null( $o_s_link->setting( 'update/last' ) ) ) :
618 - print esc_html__( 'Last checked ') . esc_html( fwp_time_elapsed( $o_s_link->setting( 'update/last' ) ) );
619 + print esc_html( 'Last checked ' . fwp_time_elapsed( $o_s_link->setting( 'update/last' ) ) );
619 620 else :
620 - print esc_html__( 'None yet' );
621 + esc_html_e( 'None yet' );
621 622 endif;
622 623
623 624 $ttl = $o_s_link->setting( 'update/ttl' );
624 625 if ( is_numeric( $ttl ) ) :
@@ -625,9 +626,9 @@
625 626 $next = $o_s_link->setting( 'update/last' ) + $o_s_link->setting( 'update/fudge' ) + ( (int) $ttl * 60 );
626 627
627 628 if ( 'automatically' !== $o_s_link->setting( 'update/timed' ) ) :
628 629
629 - print ' &middot; ' . esc_html__( 'Next') . ' ';
630 + print ' &middot; Next ';
630 631 print esc_html( fwp_relative_time_string( $next ) );
631 632
632 633 endif;
633 634 endif;
@@ -644,9 +645,9 @@
644 645
645 646 $dt = ( $ts - time() );
646 647
647 648 if ( $dt < 0 && ! $ago ) :
648 - $ret = __( 'ASAP' );
649 + $ret = 'ASAP';
649 650 elseif ( $dt < 60 * 60 ) :
650 651 $ret = fwp_time_elapsed( $ts );
651 652 elseif ( $dt < 60 * 60 * 24 ) :
652 653 $ret = wp_date( 'g:ia', $ts );
@@ -677,22 +678,11 @@
677 678
678 679 if ( is_null( $o_s_link->setting( 'update/error' ) ) ) :
679 680
680 681 if ( ! is_null( $o_s_link->setting( 'link/filesize' ) ) ) :
681 - // size_format() _can_ return false, so we check for that first (gwyneth 20230918)
682 - $formatted_bytes = size_format( $o_s_link->setting( 'link/filesize' ) );
683 - if ( $formatted_bytes ) :
684 - $mesg_file_size_lines[] = $formatted_bytes . '&nbsp;' . __( 'total' );
685 - else:
686 - $mesg_file_size_lines[] = __( '(invalid number of bytes)' );
687 - endif;
688 - FeedWordPress::diagnostic( 'link/filesize', 'File size for this link was reported as being `' . $o_s_link->setting( 'link/filesize' ) . '\'' );
689 - else :
690 - $mesg_file_size_lines[] = __( '(unknown bytes)' );
691 - FeedWordPress::diagnostic( 'link/filesize', 'No error, but link/filesize reported NULL bytes.' );
682 + $mesg_file_size_lines[] = size_format( $o_s_link->setting( 'link/filesize' ) ) . ' total';
692 683 endif;
693 684
694 -
695 685 endif;
696 686
697 687 if ( count( $mesg_file_size_lines ) > 0 ) :
698 688
@@ -722,35 +712,33 @@
722 712 if ( is_numeric( $ttl ) ) :
723 713 $next = $o_s_link->setting( 'update/last' ) + $o_s_link->setting( 'update/fudge' ) + ( (int) $ttl * 60 );
724 714 if ( 'automatically' === $o_s_link->setting( 'update/timed' ) ) :
725 715 if ( $next < time() ) :
726 - esc_html_e( 'Ready and waiting to be updated since ' );
716 + print 'Ready and waiting to be updated since ';
727 717 else :
728 - esc_html_e( 'Scheduled for next update ' );
718 + print 'Scheduled for next update ';
729 719 endif;
730 720
731 721 print esc_html( fwp_time_elapsed( $next ) );
732 722 if ( FEEDWORDPRESS_DEBUG ) :
733 723 $interval = ( ( $next - time() ) / 60 );
734 - printf( ' [%d %s%s]', intval( $interval ), esc_html__( 'minute' ), esc_html( _s( $interval ) ) );
724 + printf( ' [%d minute%s]', intval( $interval ), esc_html( _s( $interval ) ) );
735 725 endif;
736 726 else :
737 - printf( esc_html__( 'Scheduled to be checked for updates every ' ) . '%d %s%s.',
738 - intval( $ttl ),
739 - esc_html__( 'minute' ),
740 - esc_html( _s( $ttl ) ) );
727 + printf( '. Scheduled to be checked for updates every %d minute%s', intval( $ttl ), esc_html( _s( $ttl ) ) );
741 728 ?>
742 729 </div>
743 730
744 - <div style="size:0.9em; margin-top: 0.5em"><?php esc_html_e( 'This update schedule was requested by the feed provider' ); ?>
731 + <div style="size:0.9em; margin-top: 0.5em">This update schedule was requested by the feed provider
745 732 <?php
746 733 if ( $o_s_link->setting( 'update/xml' ) ) :
747 734 ?>
748 - <?php esc_html_e( 'using a standard' ); ?> <code style="font-size: inherit; padding: 0; background: transparent">&lt;<?php print esc_html( $o_s_link->setting( 'update/xml' ) ); ?>&gt;</code> <?php esc_html_e( 'element' ); // Note: the tricky php tags placed here try to avoid a space before the period. (gwyneth 20230918)
735 + using a standard <code style="font-size: inherit; padding: 0; background: transparent">&lt;<?php print esc_html( $o_s_link->setting( 'update/xml' ) ); ?>&gt;</code> element
736 + <?php
749 737 endif;
750 738 endif;
751 739 else :
752 - esc_html_e( 'Scheduled for update as soon as possible' );
740 + print 'Scheduled for update as soon as possible';
753 741 endif;
754 742 print '.';
755 743 ?>
756 744 </div></div>