| @@ -4,17 +4,11 @@ | ||
| 4 | 4 | ################################################################################ |
| 5 | 5 | ## ADMIN MENU ADD-ONS: implement Dashboard management pages #################### |
| 6 | 6 | ################################################################################ |
| 7 | 7 | |
| 8 | -if (fwp_test_wp_version(0, FWP_SCHEMA_25)) : | |
| 9 | - define('FWP_UPDATE_CHECKED', 'Update Checked Links'); | |
| 10 | - define('FWP_UNSUB_CHECKED', 'Unsubscribe from Checked Links'); | |
| 11 | - define('FWP_SYNDICATE_NEW', 'Syndicate ...'); | |
| 12 | -else : | |
| 13 | - define('FWP_UPDATE_CHECKED', 'Update Checked'); | |
| 14 | - define('FWP_UNSUB_CHECKED', 'Unsubscribe'); | |
| 15 | - define('FWP_SYNDICATE_NEW', 'Syndicate ...'); | |
| 16 | -endif; | |
| 8 | +define('FWP_UPDATE_CHECKED', 'Update Checked'); | |
| 9 | +define('FWP_UNSUB_CHECKED', 'Unsubscribe'); | |
| 10 | +define('FWP_SYNDICATE_NEW', 'Syndicate ...'); | |
| 17 | 11 | |
| 18 | 12 | class FeedWordPressSyndicationPage extends FeedWordPressAdminPage { |
| 19 | 13 | function FeedWordPressSyndicationPage () { |
| 20 | 14 | FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpresssyndication', /*link=*/ NULL); |
| @@ -228,9 +222,9 @@ | ||
| 228 | 222 | endif; |
| 229 | 223 | |
| 230 | 224 | shuffle($update_set); // randomize order for load balancing purposes... |
| 231 | 225 | if ($fwp_update_invoke != 'get' and count($update_set) > 0) : // Only do things with side-effects for HTTP POST or command line |
| 232 | - $feedwordpress =& new FeedWordPress; | |
| 226 | + $feedwordpress = new FeedWordPress; | |
| 233 | 227 | add_action('feedwordpress_check_feed', 'update_feeds_mention'); |
| 234 | 228 | add_action('feedwordpress_check_feed_complete', 'update_feeds_finish', 10, 3); |
| 235 | 229 | |
| 236 | 230 | $crash_dt = (int) get_option('feedwordpress_update_time_limit'); |
| @@ -342,13 +336,9 @@ | ||
| 342 | 336 | ?> |
| 343 | 337 | |
| 344 | 338 | <div class="submit"><input type="hidden" name="update_uri" value="*" /><input class="button-primary" type="submit" name="update" value="Update" /></div> |
| 345 | 339 | |
| 346 | - <?php if (fwp_test_wp_version(FWP_SCHEMA_27)) : ?> | |
| 347 | - <br style="clear: both" /> | |
| 348 | - <?php /* elseif (fwp_test_wp_version(FWP_SCHEMA_25, FWP_SCHEMA_27)) : | |
| 349 | - </div> <!-- id="rightnow" --> | |
| 350 | - <?php */ endif; ?> | |
| 340 | + <br style="clear: both" /> | |
| 351 | 341 | </form> |
| 352 | 342 | <?php |
| 353 | 343 | } /* function fwp_syndication_manage_page_update_box () */ |
| 354 | 344 | |
| @@ -408,9 +398,9 @@ | ||
| 408 | 398 | $caption=__('Find Feed'); |
| 409 | 399 | endif; |
| 410 | 400 | ?> |
| 411 | 401 | <td> |
| 412 | -<strong><a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/feeds-page.php&link_id=<?php echo $link->link_id; ?>"><?php echo wp_specialchars($link->link_name, 'both'); ?></a></strong> | |
| 402 | +<strong><a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/feeds-page.php&link_id=<?php echo $link->link_id; ?>"><?php echo esc_html($link->link_name); ?></a></strong> | |
| 413 | 403 | <div class="row-actions"><div><strong>Settings ></strong> |
| 414 | 404 | <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/feeds-page.php&link_id=<?php echo $link->link_id; ?>"><?php _e('Feed'); ?></a> |
| 415 | 405 | | <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/posts-page.php&link_id=<?php echo $link->link_id; ?>"><?php _e('Posts'); ?></a> |
| 416 | 406 | | <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/authors-page.php&link_id=<?php echo $link->link_id; ?>"><?php _e('Authors'); ?></a> |
| @@ -417,24 +407,13 @@ | ||
| 417 | 407 | | <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/categories-page.php&link_id=<?php echo $link->link_id; ?>"><?php print htmlspecialchars(__('Categories'.FEEDWORDPRESS_AND_TAGS)); ?></a></div> |
| 418 | 408 | <div><strong>Actions ></strong> |
| 419 | 409 | <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>&link_id=<?php echo $link->link_id; ?>&action=feedfinder"><?php echo $caption; ?></a> |
| 420 | 410 | | <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>&link_id=<?php echo $link->link_id; ?>&action=Unsubscribe"><?php _e('Unsubscribe'); ?></a> |
| 421 | -| <a href="<?php echo wp_specialchars($link->link_url, 'both'); ?>"><?php _e('View')?></a></div> | |
| 411 | +| <a href="<?php echo esc_html($link->link_url); ?>"><?php _e('View')?></a></div> | |
| 422 | 412 | </div> |
| 423 | 413 | </td> |
| 424 | -<?php | |
| 425 | - if (strlen($link->link_rss) > 0): | |
| 426 | - $uri_bits = parse_url($link->link_rss); | |
| 427 | - $uri_bits['host'] = preg_replace('/^www\./i', '', $uri_bits['host']); | |
| 428 | - $display_uri = | |
| 429 | - (isset($uri_bits['user'])?$uri_bits['user'].'@':'') | |
| 430 | - .(isset($uri_bits['host'])?$uri_bits['host']:'') | |
| 431 | - .(isset($uri_bits['port'])?':'.$uri_bits['port']:'') | |
| 432 | - .(isset($uri_bits['path'])?$uri_bits['path']:'') | |
| 433 | - .(isset($uri_bits['query'])?'?'.$uri_bits['query']:''); | |
| 434 | - if (strlen($display_uri) > 32) : $display_uri = substr($display_uri, 0, 32).'…'; endif; | |
| 435 | -?> | |
| 436 | - <td><a href="<?php echo wp_specialchars($link->link_rss, 'both'); ?>"><?php echo wp_specialchars($display_uri, 'both'); ?></a></td> | |
| 414 | + <?php if (strlen($link->link_rss) > 0): ?> | |
| 415 | + <td><a href="<?php echo esc_html($link->link_rss); ?>"><?php echo esc_html(feedwordpress_display_url($link->link_rss, 32)); ?></a></td> | |
| 437 | 416 | <?php else: ?> |
| 438 | 417 | <td style="background-color:#FFFFD0"><p><strong>no |
| 439 | 418 | feed assigned</strong></p></td> |
| 440 | 419 | <?php endif; ?> |
| @@ -439,9 +418,9 @@ | ||
| 439 | 418 | feed assigned</strong></p></td> |
| 440 | 419 | <?php endif; ?> |
| 441 | 420 | |
| 442 | 421 | <td><?php |
| 443 | - $sLink =& new SyndicatedLink($link->link_id); | |
| 422 | + $sLink = new SyndicatedLink($link->link_id); | |
| 444 | 423 | if (isset($sLink->settings['update/last'])) : |
| 445 | 424 | print fwp_time_elapsed($sLink->settings['update/last']); |
| 446 | 425 | else : |
| 447 | 426 | _e('None yet'); |
| @@ -458,8 +437,9 @@ | ||
| 458 | 437 | endif; |
| 459 | 438 | else: |
| 460 | 439 | echo "as soon as possible"; |
| 461 | 440 | endif; |
| 441 | + unset($sLink); | |
| 462 | 442 | print "</div>"; |
| 463 | 443 | ?> |
| 464 | 444 | </td> |
| 465 | 445 | </tr> |
| @@ -505,15 +485,17 @@ | ||
| 505 | 485 | if (!isset($fwp_post['Cancel'])): |
| 506 | 486 | if (isset($fwp_post['save_link_id']) and ($fwp_post['save_link_id']=='*')) : |
| 507 | 487 | $changed = true; |
| 508 | 488 | $link_id = FeedWordPress::syndicate_link($fwp_post['feed_title'], $fwp_post['feed_link'], $fwp_post['feed']); |
| 509 | - if ($link_id): ?> | |
| 510 | -<div class="updated"><p><a href="<?php print $fwp_post['feed_link']; ?>"><?php print wp_specialchars($fwp_post['feed_title'], 'both'); ?></a> | |
| 489 | + if ($link_id): | |
| 490 | + $existingLink = new SyndicatedLink($link_id); | |
| 491 | + ?> | |
| 492 | +<div class="updated"><p><a href="<?php print $fwp_post['feed_link']; ?>"><?php print esc_html($fwp_post['feed_title']); ?></a> | |
| 511 | 493 | has been added as a contributing site, using the feed at |
| 512 | -<<a href="<?php print $fwp_post['feed']; ?>"><?php print wp_specialchars($fwp_post['feed'], 'both'); ?></a>>. | |
| 494 | +<<a href="<?php print $fwp_post['feed']; ?>"><?php print esc_html($fwp_post['feed']); ?></a>>. | |
| 513 | 495 | | <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/feeds-page.php&link_id=<?php print $link_id; ?>">Configure settings</a>.</p></div> |
| 514 | 496 | <?php else: ?> |
| 515 | -<div class="updated"><p>There was a problem adding the feed. [SQL: <?php echo wp_specialchars(mysql_error(), 'both'); ?>]</p></div> | |
| 497 | +<div class="updated"><p>There was a problem adding the feed. [SQL: <?php echo esc_html(mysql_error()); ?>]</p></div> | |
| 516 | 498 | <?php endif; |
| 517 | 499 | elseif (isset($fwp_post['save_link_id'])): |
| 518 | 500 | $existingLink = new SyndicatedLink($fwp_post['save_link_id']); |
| 519 | 501 | $changed = $existingLink->set_uri($fwp_post['feed']); |
| @@ -521,15 +503,19 @@ | ||
| 521 | 503 | if ($changed): |
| 522 | 504 | $home = $existingLink->homepage(/*from feed=*/ false); |
| 523 | 505 | $name = $existingLink->name(/*from feed=*/ false); |
| 524 | 506 | ?> |
| 525 | -<div class="updated"><p>Feed for <a href="<?php echo wp_specialchars($home, 'both'); ?>"><?php echo wp_specialchars($name, 'both'); ?></a> | |
| 526 | -updated to <<a href="<?php echo wp_specialchars($fwp_post['feed'], 'both'); ?>"><?php echo wp_specialchars($fwp_post['feed'], 'both'); ?></a>>.</p></div> | |
| 507 | +<div class="updated"><p>Feed for <a href="<?php echo esc_html($home); ?>"><?php echo esc_html($name); ?></a> | |
| 508 | +updated to <<a href="<?php echo esc_html($fwp_post['feed']); ?>"><?php echo esc_html($fwp_post['feed']); ?></a>>.</p></div> | |
| 527 | 509 | <?php |
| 528 | 510 | endif; |
| 529 | 511 | endif; |
| 530 | 512 | endif; |
| 531 | 513 | |
| 514 | + if (isset($existingLink)) : | |
| 515 | + do_action('feedwordpress_admin_switchfeed', $fwp_post['feed'], $existingLink); | |
| 516 | + endif; | |
| 517 | + | |
| 532 | 518 | if (!$changed) : |
| 533 | 519 | ?> |
| 534 | 520 | <div class="updated"><p>Nothing was changed.</p></div> |
| 535 | 521 | <?php |
| @@ -640,12 +626,12 @@ | ||
| 640 | 626 | <input type="hidden" name="confirm" value="Delete" /> |
| 641 | 627 | |
| 642 | 628 | <h2>Unsubscribe from Syndicated Links:</h2> |
| 643 | 629 | <?php foreach ($targets as $link) : |
| 644 | - $link_url = wp_specialchars($link->link_url, 1); | |
| 645 | - $link_name = wp_specialchars($link->link_name, 1); | |
| 646 | - $link_description = wp_specialchars($link->link_description, 'both'); | |
| 647 | - $link_rss = wp_specialchars($link->link_rss, 'both'); | |
| 630 | + $link_url = esc_html($link->link_url); | |
| 631 | + $link_name = esc_html($link->link_name); | |
| 632 | + $link_description = esc_html($link->link_description); | |
| 633 | + $link_rss = esc_html($link->link_rss); | |
| 648 | 634 | ?> |
| 649 | 635 | <fieldset> |
| 650 | 636 | <legend><?php echo $link_name; ?></legend> |
| 651 | 637 | <table class="editform" width="100%" cellspacing="2" cellpadding="5"> |