From 0c9dd7b5f3d994cd036f1fd78083b60c15ad5ed2 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Thu, 18 Mar 2010 08:39:01 +0000 Subject: [PATCH] Clean up OPML link export script. git-svn-id: https://develop.svn.wordpress.org/trunk@13747 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-links-opml.php | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/wp-links-opml.php b/wp-links-opml.php index 8f80403758..069d7a5ff4 100644 --- a/wp-links-opml.php +++ b/wp-links-opml.php @@ -12,54 +12,51 @@ * @package WordPress */ -if (empty($wp)) { +if ( empty($wp) ) { require_once('./wp-load.php'); wp(); } header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true); -$link_cat = $_GET['link_cat']; -if ((empty ($link_cat)) || ($link_cat == 'all') || ($link_cat == '0')) { - $link_cat = ''; -} else { // be safe - $link_cat = '' . urldecode($link_cat) . ''; - $link_cat = intval($link_cat); +$link_cat = ''; +if ( !empty($_GET['link_cat']) ) { + $link_cat = $_GET['link_cat']; + if ( !in_array($link_cat, array('all', '0')) ) + $link_cat = absint( (string)urldecode($link_cat) ); } -?>\n"; ?> + +echo '\n"; +?> - Links for <?php echo esc_attr(get_bloginfo('name', 'display').$cat_name); ?> + <?php printf( __('Links for %s'), esc_attr(get_bloginfo('name', 'display')) ); ?> GMT 'link', 'hierarchical' => 0)); else $cats = get_categories(array('type' => 'link', 'hierarchical' => 0, 'include' => $link_cat)); -foreach ((array) $cats as $cat) { +foreach ( (array)$cats as $cat ) : $catname = apply_filters('link_category', $cat->name); ?> $cat->term_id)); - foreach ((array) $bookmarks as $bookmark) { - $title = esc_attr(apply_filters('link_title', $bookmark->link_name)); + foreach ( (array)$bookmarks as $bookmark ) : + $title = apply_filters('link_title', $bookmark->link_name); ?> - +