| @@ -51,9 +51,9 @@ | ||
| 51 | 51 | |
| 52 | 52 | /*static*/ function submitted_link () { |
| 53 | 53 | $link_id = FeedWordPressAdminPage::submitted_link_id(); |
| 54 | 54 | if (is_numeric($link_id) and $link_id) : |
| 55 | - $link =& new SyndicatedLink($link_id); | |
| 55 | + $link = new SyndicatedLink($link_id); | |
| 56 | 56 | else : |
| 57 | 57 | $link = NULL; |
| 58 | 58 | endif; |
| 59 | 59 | return $link; |
| @@ -61,9 +61,9 @@ | ||
| 61 | 61 | |
| 62 | 62 | function stamp_link_id ($field = null) { |
| 63 | 63 | if (is_null($field)) : $field = 'save_link_id'; endif; |
| 64 | 64 | ?> |
| 65 | - <input type="hidden" name="<?php print wp_specialchars($field, 'both'); ?>" value="<?php print ($this->for_feed_settings() ? $this->link->id : '*'); ?>" /> | |
| 65 | + <input type="hidden" name="<?php print esc_html($field); ?>" value="<?php print ($this->for_feed_settings() ? $this->link->id : '*'); ?>" /> | |
| 66 | 66 | <?php |
| 67 | 67 | } /* FeedWordPressAdminPage::stamp_link_id () */ |
| 68 | 68 | |
| 69 | 69 | function these_posts_phrase () { |
| @@ -122,65 +122,14 @@ | ||
| 122 | 122 | } /* FeedWordPressAdminPage::ajax_interface_js () */ |
| 123 | 123 | |
| 124 | 124 | function display_feed_select_dropdown() { |
| 125 | 125 | $links = FeedWordPress::syndicated_links(); |
| 126 | - if (fwp_test_wp_version(FWP_SCHEMA_27)) : | |
| 127 | - ?> | |
| 128 | - <style type="text/css"> | |
| 129 | - #post-search { | |
| 130 | - float: right; | |
| 131 | - margin:11px 12px 0; | |
| 132 | - min-width: 130px; | |
| 133 | - position:relative; | |
| 134 | - } | |
| 135 | - .fwpfs { | |
| 136 | - color: #dddddd; | |
| 137 | - background:#797979 url(<?php bloginfo('home') ?>/wp-admin/images/fav.png) repeat-x scroll left center; | |
| 138 | - border-color:#777777 #777777 #666666 !important; -moz-border-radius-bottomleft:12px; | |
| 139 | - -moz-border-radius-bottomright:12px; | |
| 140 | - -moz-border-radius-topleft:12px; | |
| 141 | - -moz-border-radius-topright:12px; | |
| 142 | - border-style:solid; | |
| 143 | - border-width:1px; | |
| 144 | - line-height:15px; | |
| 145 | - padding:3px 30px 4px 12px; | |
| 146 | - } | |
| 147 | - .fwpfs.slide-down { | |
| 148 | - border-bottom-color: #626262; | |
| 149 | - -moz-border-radius-bottomleft:0; | |
| 150 | - -moz-border-radius-bottomright:0; | |
| 151 | - -moz-border-radius-topleft:12px; | |
| 152 | - -moz-border-radius-topright:12px; | |
| 153 | - background-image:url(<?php bloginfo('home') ?>/wp-admin/images/fav-top.png); | |
| 154 | - background-position:0 top; | |
| 155 | - background-repeat:repeat-x; | |
| 156 | - border-bottom-style:solid; | |
| 157 | - border-bottom-width:1px; | |
| 158 | - } | |
| 159 | - </style> | |
| 160 | - | |
| 161 | - <script type="text/javascript"> | |
| 162 | - jQuery(document).ready(function($){ | |
| 163 | - $('.fwpfs').toggle( | |
| 164 | - function(){$('.fwpfs').removeClass('slideUp').addClass('slideDown'); setTimeout(function(){if ( $('.fwpfs').hasClass('slideDown') ) { $('.fwpfs').addClass('slide-down'); }}, 10) }, | |
| 165 | - function(){$('.fwpfs').removeClass('slideDown').addClass('slideUp'); setTimeout(function(){if ( $('.fwpfs').hasClass('slideUp') ) { $('.fwpfs').removeClass('slide-down'); }}, 10) } | |
| 166 | - ); | |
| 167 | - $('.fwpfs').bind( | |
| 168 | - 'change', | |
| 169 | - function () { this.form.submit(); } | |
| 170 | - ); | |
| 171 | - $('#post-search .button').css( 'display', 'none' ); | |
| 172 | - }); | |
| 173 | - </script> | |
| 174 | - <?php | |
| 175 | - endif; | |
| 176 | - | |
| 177 | 126 | ?> |
| 178 | 127 | <p id="post-search"> |
| 179 | 128 | <select name="link_id" class="fwpfs" style="max-width: 20.0em;"> |
| 180 | 129 | <option value="*"<?php if ($this->for_default_settings()) : ?> selected="selected"<?php endif; ?>>- defaults for all feeds -</option> |
| 181 | 130 | <?php if ($links) : foreach ($links as $ddlink) : ?> |
| 182 | - <option value="<?php print (int) $ddlink->link_id; ?>"<?php if (!is_null($this->link) and ($this->link->id==$ddlink->link_id)) : ?> selected="selected"<?php endif; ?>><?php print wp_specialchars($ddlink->link_name, 1); ?></option> | |
| 131 | + <option value="<?php print (int) $ddlink->link_id; ?>"<?php if (!is_null($this->link) and ($this->link->id==$ddlink->link_id)) : ?> selected="selected"<?php endif; ?>><?php print esc_html($ddlink->link_name); ?></option> | |
| 183 | 132 | <?php endforeach; endif; ?> |
| 184 | 133 | </select> |
| 185 | 134 | <input class="button" type="submit" name="go" value="<?php _e('Go') ?> »" /> |
| 186 | 135 | </p> |
| @@ -189,14 +138,14 @@ | ||
| 189 | 138 | |
| 190 | 139 | function display_sheet_header ($pagename = 'Syndication', $all = false) { |
| 191 | 140 | if (FeedWordPressCompatibility::test_version(FWP_SCHEMA_27)) : |
| 192 | 141 | ?> |
| 193 | - <div class="icon32"><img src="<?php print wp_specialchars(WP_PLUGIN_URL.'/'.$GLOBALS['fwp_path'].'/feedwordpress.png', 1); ?>" alt="" /></div> | |
| 142 | + <div class="icon32"><img src="<?php print esc_html(WP_PLUGIN_URL.'/'.$GLOBALS['fwp_path'].'/feedwordpress.png'); ?>" alt="" /></div> | |
| 194 | 143 | <?php |
| 195 | 144 | endif; |
| 196 | 145 | ?> |
| 197 | 146 | |
| 198 | - <h2><?php print wp_specialchars(__($pagename.($all ? '' : ' Settings')), 1); ?><?php if ($this->for_feed_settings()) : ?>: <?php echo wp_specialchars($this->link->link->link_name, 1); ?><?php endif; ?></h2> | |
| 147 | + <h2><?php print esc_html(__($pagename.($all ? '' : ' Settings'))); ?><?php if ($this->for_feed_settings()) : ?>: <?php echo esc_html($this->link->link->link_name); ?><?php endif; ?></h2> | |
| 199 | 148 | <?php |
| 200 | 149 | } |
| 201 | 150 | |
| 202 | 151 | function display_update_notice_if_updated ($pagename = 'Syndication', $mesg = NULL) { |
| @@ -210,9 +159,9 @@ | ||
| 210 | 159 | |
| 211 | 160 | if (!is_null($mesg)) : |
| 212 | 161 | ?> |
| 213 | 162 | <div class="updated"> |
| 214 | - <p><?php print wp_specialchars($mesg, 1); ?></p> | |
| 163 | + <p><?php print esc_html($mesg); ?></p> | |
| 215 | 164 | </div> |
| 216 | 165 | <?php |
| 217 | 166 | endif; |
| 218 | 167 | } /* FeedWordPressAdminPage::display_update_notice_if_updated() */ |
| @@ -220,9 +169,9 @@ | ||
| 220 | 169 | function display_settings_scope_message () { |
| 221 | 170 | if ($this->for_feed_settings()) : |
| 222 | 171 | ?> |
| 223 | 172 | <p>These settings only affect posts syndicated from |
| 224 | - <strong><?php echo wp_specialchars($this->link->link->link_name, 1); ?></strong>.</p> | |
| 173 | + <strong><?php echo esc_html($this->link->link->link_name); ?></strong>.</p> | |
| 225 | 174 | <?php |
| 226 | 175 | else : |
| 227 | 176 | ?> |
| 228 | 177 | <p>These settings affect posts syndicated from any feed unless they are overridden |
| @@ -388,12 +337,35 @@ | ||
| 388 | 337 | if (!is_array($tags)) : $tags = array(); endif; |
| 389 | 338 | |
| 390 | 339 | $desc = "<p style=\"font-size:smaller;font-style:bold;margin:0\">Tag $object as...</p>"; |
| 391 | 340 | |
| 392 | - if (fwp_test_wp_version(FWP_SCHEMA_28)) : // WordPress 2.8+ | |
| 341 | + if (fwp_test_wp_version(FWP_SCHEMA_29)) : // WordPress 2.9+ | |
| 342 | + print $desc; | |
| 343 | + $tax_name = 'post_tag'; | |
| 344 | + $helps = __('Separate tags with commas.'); | |
| 345 | + $box['title'] = __('Tags'); | |
| 346 | + ?> | |
| 347 | + <div class="tagsdiv" id="<?php echo $tax_name; ?>"> | |
| 348 | + <div class="jaxtag"> | |
| 349 | + <div class="nojs-tags hide-if-js"> | |
| 350 | + <p><?php _e('Add or remove tags'); ?></p> | |
| 351 | + <textarea name="<?php echo "tax_input[$tax_name]"; ?>" class="the-tags" id="tax-input[<?php echo $tax_name; ?>]"><?php echo esc_attr(implode(",", $tags)); ?></textarea></div> | |
| 352 | + | |
| 353 | + <div class="ajaxtag hide-if-no-js"> | |
| 354 | + <label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label> | |
| 355 | + <div class="taghint"><?php _e('Add new tag'); ?></div> | |
| 356 | + <input type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="" /> | |
| 357 | + <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" tabindex="3" /> | |
| 358 | + </div></div> | |
| 359 | + <p class="howto"><?php echo $helps; ?></p> | |
| 360 | + <div class="tagchecklist"></div> | |
| 361 | + </div> | |
| 362 | + <p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php printf( __('Choose from the most used tags in %s'), $box['title'] ); ?></a></p> | |
| 363 | +<?php | |
| 364 | + elseif (fwp_test_wp_version(FWP_SCHEMA_28)) : // WordPress 2.8+ | |
| 393 | 365 | ?> |
| 394 | - <?php print $desc; ?> | |
| 395 | - <div class="tagsdiv" id="post_tag"> | |
| 366 | + <?php print $desc; ?> | |
| 367 | + <div class="tagsdiv" id="post_tag"> | |
| 396 | 368 | <div class="jaxtag"> |
| 397 | 369 | <div class="nojs-tags hide-if-js"> |
| 398 | 370 | <p><?php _e('Add or remove tags'); ?></p> |
| 399 | 371 | <textarea name="tax_input[post_tag]" class="the-tags" id="tax-input[post_tag]"><?php echo implode(",", $tags); ?></textarea> |
| @@ -422,62 +394,68 @@ | ||
| 422 | 394 | <?php |
| 423 | 395 | endif; |
| 424 | 396 | } |
| 425 | 397 | |
| 426 | -function fwp_category_box ($checked, $object, $tags = array()) { | |
| 398 | +function fwp_category_box ($checked, $object, $tags = array(), $prefix = '') { | |
| 427 | 399 | global $wp_db_version; |
| 428 | 400 | |
| 429 | - if (fwp_test_wp_version(FWP_SCHEMA_25)) : // WordPress 2.5.x | |
| 401 | + if (strlen($prefix) > 0) : | |
| 402 | + $idPrefix = $prefix.'-'; | |
| 403 | + $idSuffix = "-".$prefix; | |
| 404 | + $namePrefix = $prefix . '_'; | |
| 405 | + else : | |
| 406 | + $idPrefix = 'feedwordpress-'; | |
| 407 | + $idSuffix = "-feedwordpress"; | |
| 408 | + $namePrefix = 'feedwordpress_'; | |
| 409 | + endif; | |
| 410 | + | |
| 430 | 411 | ?> |
| 431 | -<div id="category-adder" class="wp-hidden-children"> | |
| 432 | - <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4> | |
| 433 | - <p id="category-add" class="wp-hidden-child"> | |
| 434 | - <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" /> | |
| 435 | - <?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?> | |
| 436 | - <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" /> | |
| 437 | - <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?> | |
| 438 | - <span id="category-ajax-response"></span> | |
| 412 | +<div id="<?php print $idPrefix; ?>taxonomy-category" class="feedwordpress-category-div"> | |
| 413 | + <ul id="<?php print $idPrefix; ?>category-tabs" class="category-tabs"> | |
| 414 | + <li class="ui-tabs-selected tabs"><a href="#<?php print $idPrefix; ?>categories-all" tabindex="3"><?php _e( 'All posts' ); ?></a> | |
| 415 | + <p style="font-size:smaller;font-style:bold;margin:0">Give <?php print $object; ?> these categories</p> | |
| 416 | + </li> | |
| 417 | + </ul> | |
| 418 | + | |
| 419 | +<div id="<?php print $idPrefix; ?>categories-all" class="tabs-panel"> | |
| 420 | + <ul id="<?php print $idPrefix; ?>categorychecklist" class="list:category categorychecklist form-no-clear"> | |
| 421 | + <?php fwp_category_checklist(NULL, false, $checked, $prefix) ?> | |
| 422 | + </ul> | |
| 423 | +</div> | |
| 424 | + | |
| 425 | +<div id="<?php print $idPrefix; ?>category-adder" class="category-adder wp-hidden-children"> | |
| 426 | + <h4><a id="<?php print $idPrefix; ?>category-add-toggle" class="category-add-toggle" href="#<?php print $idPrefix; ?>category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4> | |
| 427 | + <p id="<?php print $idPrefix; ?>category-add" class="wp-hidden-child"> | |
| 428 | + <?php | |
| 429 | + if (FeedWordPressCompatibility::test_version(FWP_SCHEMA_30)) : | |
| 430 | + $newcat = 'newcategory'; // Well, thank God they added "egory" before WP 3.0 came out. | |
| 431 | + else : | |
| 432 | + $newcat = 'newcat'; | |
| 433 | + endif; | |
| 434 | + ?> | |
| 435 | + | |
| 436 | + <input type="text" name="<?php print $newcat; ?>" id="<?php print $idPrefix; ?>newcategory" class="newcategory form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" /> | |
| 437 | + <label class="screen-reader-text" for="<?php print $idPrefix; ?>newcategory-parent"><?php _e('Parent Category:'); ?></label> | |
| 438 | + <?php wp_dropdown_categories( array( | |
| 439 | + 'hide_empty' => 0, | |
| 440 | + 'id' => $idPrefix.'newcategory-parent', | |
| 441 | + 'class' => 'newcategory-parent', | |
| 442 | + 'name' => $newcat.'_parent', | |
| 443 | + 'orderby' => 'name', | |
| 444 | + 'hierarchical' => 1, | |
| 445 | + 'show_option_none' => __('Parent category'), | |
| 446 | + 'tab_index' => 3, | |
| 447 | + ) ); ?> | |
| 448 | + <input type="button" id="<?php print $idPrefix; ?>category-add-sumbit" class="add:<?php print $idPrefix; ?>categorychecklist:category-add add-categorychecklist-category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" /> | |
| 449 | + <?php /* wp_nonce_field currently doesn't let us set an id different from name, but we need a non-unique name and a unique id */ ?> | |
| 450 | + <input type="hidden" id="_ajax_nonce<?php print esc_html($idSuffix); ?>" name="_ajax_nonce" value="<?php print wp_create_nonce('add-category'); ?>" /> | |
| 451 | + <input type="hidden" id="_ajax_nonce-add-category<?php print esc_html($idSuffix); ?>" name="_ajax_nonce-add-category" value="<?php print wp_create_nonce('add-category'); ?>" /> | |
| 452 | + <span id="<?php print $idPrefix; ?>category-ajax-response" class="category-ajax-response"></span> | |
| 439 | 453 | </p> |
| 440 | 454 | </div> |
| 441 | 455 | |
| 442 | -<ul id="category-tabs"> | |
| 443 | - <?php /* ui-tabs-selected in WP 2.7 CSS = tabs in WP 2.8 CSS. Thank you, o brilliant wordsmiths of the WordPress 2.8 stylesheet... */ ?> | |
| 444 | - <li class="ui-tabs-selected tabs"><a href="#categories-all" tabindex="3"><?php _e( 'All posts' ); ?></a> | |
| 445 | - <p style="font-size:smaller;font-style:bold;margin:0">Give <?php print $object; ?> these categories</p> | |
| 446 | -</li> | |
| 447 | -</ul> | |
| 448 | - | |
| 449 | -<?php /* ui-tabs-panel in WP 2.7 CSS = tabs-panel in WP 2.8 CSS. Thank you, o brilliant wordsmiths of the WordPress 2.8 stylesheet... */ ?> | |
| 450 | -<div id="categories-all" class="ui-tabs-panel tabs-panel"> | |
| 451 | - <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> | |
| 452 | - <?php fwp_category_checklist(NULL, false, $checked) ?> | |
| 453 | - </ul> | |
| 454 | 456 | </div> |
| 455 | 457 | <?php |
| 456 | - elseif (fwp_test_wp_version(FWP_SCHEMA_20)) : // WordPress 2.x | |
| 457 | -?> | |
| 458 | - <div id="moremeta" style="position: relative; right: auto"> | |
| 459 | - <div id="grabit" class="dbx-group"> | |
| 460 | - <fieldset id="categorydiv" class="dbx-box"> | |
| 461 | - <h3 class="dbx-handle"><?php _e('Categories') ?></h3> | |
| 462 | - <div class="dbx-content"> | |
| 463 | - <p style="font-size:smaller;font-style:bold;margin:0">Place <?php print $object; ?> under...</p> | |
| 464 | - <p id="jaxcat"></p> | |
| 465 | - <div id="categorychecklist"><?php fwp_category_checklist(NULL, false, $checked); ?></div> | |
| 466 | - </div> | |
| 467 | - </fieldset> | |
| 468 | - </div> | |
| 469 | - </div> | |
| 470 | -<?php | |
| 471 | - else : // WordPress 1.5 | |
| 472 | -?> | |
| 473 | - <fieldset style="width: 60%;"> | |
| 474 | - <legend><?php _e('Categories') ?></legend> | |
| 475 | - <p style="font-size:smaller;font-style:bold;margin:0">Place <?php print $object; ?> under...</p> | |
| 476 | - <div style="height: 10em; overflow: scroll;"><?php fwp_category_checklist(NULL, false, $checked); ?></div> | |
| 477 | - </fieldset> | |
| 478 | -<?php | |
| 479 | - endif; | |
| 480 | 458 | } |
| 481 | 459 | |
| 482 | 460 | function update_feeds_mention ($feed) { |
| 483 | 461 | echo "<li>Updating <cite>".$feed['link/name']."</cite> from <<a href=\"" |
| @@ -484,9 +462,17 @@ | ||
| 484 | 462 | .$feed['link/uri']."\">".$feed['link/uri']."</a>> ..."; |
| 485 | 463 | flush(); |
| 486 | 464 | } |
| 487 | 465 | function update_feeds_finish ($feed, $added, $dt) { |
| 488 | - echo " completed in $dt second".(($dt==1)?'':'s')."</li>\n"; | |
| 466 | + if (is_wp_error($added)) : | |
| 467 | + $mesgs = $added->get_error_messages(); | |
| 468 | + foreach ($mesgs as $mesg) : | |
| 469 | + echo "<br/><strong>Feed error:</strong> <code>$mesg</code>"; | |
| 470 | + endforeach; | |
| 471 | + echo "</li>\n"; | |
| 472 | + else : | |
| 473 | + echo " completed in $dt second".(($dt==1)?'':'s')."</li>\n"; | |
| 474 | + endif; | |
| 489 | 475 | } |
| 490 | 476 | |
| 491 | 477 | function fwp_author_list () { |
| 492 | 478 | global $wpdb; |
| @@ -580,8 +566,13 @@ | ||
| 580 | 566 | /*static*/ function fix_toggles_js ($context) { |
| 581 | 567 | ?> |
| 582 | 568 | <script type="text/javascript"> |
| 583 | 569 | jQuery(document).ready( function($) { |
| 570 | + <?php if (FeedWordPressCompatibility::test_version(FWP_SCHEMA_29)) : ?> | |
| 571 | + if ( $('#post_tag').length ) { | |
| 572 | + tagBox.init(); | |
| 573 | + } | |
| 574 | + <?php endif; ?> | |
| 584 | 575 | <?php if (FeedWordPressCompatibility::test_version(FWP_SCHEMA_25, FWP_SCHEMA_27)) : ?> |
| 585 | 576 | // In case someone got here first... |
| 586 | 577 | jQuery('.postbox h3').unbind('click'); |
| 587 | 578 | |