X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/0f29eadd474473203a1182f52af1aa82721cecbd..b22765f41bf0b2021b9beb9120ee0ac91fa89292:/wp-links-opml.php diff --git a/wp-links-opml.php b/wp-links-opml.php index 3c2cbf55..ea3a50b4 100644 --- a/wp-links-opml.php +++ b/wp-links-opml.php @@ -1,61 +1,80 @@ -links.link_category = $link_cat"; - $cat_name = $wpdb->get_var("SELECT $wpdb->linkcategories.cat_name FROM $wpdb->linkcategories WHERE $wpdb->linkcategories.cat_id = $link_cat"); - if (!empty($cat_name)) { - $cat_name = ": category $cat_name"; - } - } +header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true); +$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"; ?> - - - - Links for <?php echo get_bloginfo('name').$cat_name ?> - GMT - - -links.link_url, link_rss, $wpdb->links.link_name, $wpdb->links.link_category, $wpdb->linkcategories.cat_name, link_updated -FROM $wpdb->links - INNER JOIN $wpdb->linkcategories on $wpdb->links.link_category = $wpdb->linkcategories.cat_id - AND $wpdb->links.link_visible = 'Y' - $sql_cat - ORDER BY $wpdb->linkcategories.cat_name, $wpdb->links.link_name \n"; - //echo(""); - $prev_cat_id = 0; - $results = $wpdb->get_results($sql); - if ($results) { - foreach ($results as $result) { - if ($result->link_category != $prev_cat_id) { // new category - if ($prev_cat_id != 0) { // not first time + +echo '\n"; ?> - + + + <?php printf( __('Links for %s'), esc_attr(get_bloginfo('name', 'display')) ); ?> + GMT + + + 'link_category', 'hierarchical' => 0)); +else + $cats = get_categories(array('taxonomy' => 'link_category', 'hierarchical' => 0, 'include' => $link_cat)); + +foreach ( (array)$cats as $cat ) : + /** + * Filters 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 ); + ?> - + link_category; - } // end if new category + $bookmarks = get_bookmarks(array("category" => $cat->term_id)); + foreach ( (array)$bookmarks as $bookmark ) : + /** + * Filters 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 ); ?> - + - + - \ No newline at end of file +