X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/9c40b4d36daed9e28e48a5fe9205c32557195a4b..6d3aa5fe58b2f91735fe04e94a2c12b7dd9adb09:/wp-links-opml.php diff --git a/wp-links-opml.php b/wp-links-opml.php index b9170528..b196f736 100644 --- a/wp-links-opml.php +++ b/wp-links-opml.php @@ -12,54 +12,69 @@ * @package WordPress */ -if (empty($wp)) { - require_once('./wp-load.php'); - wp(); -} +require_once( dirname( __FILE__ ) . '/wp-load.php' ); 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_category', 'hierarchical' => 0)); else - $cats = get_categories('type=link&hierarchical=0&include='.$link_cat); + $cats = get_categories(array('taxonomy' => 'link_category', 'hierarchical' => 0, 'include' => $link_cat)); -foreach ((array) $cats as $cat) { - $catname = apply_filters('link_category', $cat->name); +foreach ( (array)$cats as $cat ) : + /** + * Filter the OPML outline link category name. + * + * @since 2.2.0 + * + * @param string $catname The OPML outline category name. + */ + $catname = apply_filters( 'link_category', $cat->name ); ?> term_id}"); - foreach ((array) $bookmarks as $bookmark) { - $title = esc_attr(apply_filters('link_title', $bookmark->link_name)); + $bookmarks = get_bookmarks(array("category" => $cat->term_id)); + foreach ( (array)$bookmarks as $bookmark ) : + /** + * Filter the OPML outline link title text. + * + * @since 2.2.0 + * + * @param string $title The OPML outline title text. + */ + $title = apply_filters( 'link_title', $bookmark->link_name ); ?> - +