From 973c124105a295ed31b07edc9a9edaaa45af7baf Mon Sep 17 00:00:00 2001 From: dd32 Date: Thu, 18 Mar 2010 08:39:01 +0000 Subject: [PATCH] Clean up OPML link export script. git-svn-id: http://svn.automattic.com/wordpress/trunk@13747 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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 8f8040375..069d7a5ff 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); ?> - +