Changeset 13747
- Timestamp:
- 03/18/2010 08:39:01 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-links-opml.php
r13113 r13747 13 13 */ 14 14 15 if ( empty($wp)) {15 if ( empty($wp) ) { 16 16 require_once('./wp-load.php'); 17 17 wp(); … … 19 19 20 20 header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true); 21 $link_cat = $_GET['link_cat']; 22 if ((empty ($link_cat)) || ($link_cat == 'all') || ($link_cat == '0')) { 23 $link_cat = ''; 24 } else { // be safe 25 $link_cat = '' . urldecode($link_cat) . ''; 26 $link_cat = intval($link_cat); 21 $link_cat = ''; 22 if ( !empty($_GET['link_cat']) ) { 23 $link_cat = $_GET['link_cat']; 24 if ( !in_array($link_cat, array('all', '0')) ) 25 $link_cat = absint( (string)urldecode($link_cat) ); 27 26 } 28 ?><?php echo '<?xml version="1.0"?'.">\n"; ?> 27 28 echo '<?xml version="1.0"?'.">\n"; 29 ?> 29 30 <opml version="1.0"> 30 31 <head> 31 <title> Links for <?php echo esc_attr(get_bloginfo('name', 'display').$cat_name); ?></title>32 <title><?php printf( __('Links for %s'), esc_attr(get_bloginfo('name', 'display')) ); ?></title> 32 33 <dateCreated><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</dateCreated> 33 34 <?php do_action('opml_head'); ?> … … 35 36 <body> 36 37 <?php 37 38 if (empty ($link_cat)) 38 if ( empty($link_cat) ) 39 39 $cats = get_categories(array('type' => 'link', 'hierarchical' => 0)); 40 40 else 41 41 $cats = get_categories(array('type' => 'link', 'hierarchical' => 0, 'include' => $link_cat)); 42 42 43 foreach ( (array) $cats as $cat) {43 foreach ( (array)$cats as $cat ) : 44 44 $catname = apply_filters('link_category', $cat->name); 45 45 … … 47 47 <outline type="category" title="<?php echo esc_attr($catname); ?>"> 48 48 <?php 49 50 49 $bookmarks = get_bookmarks(array("category" => $cat->term_id)); 51 foreach ( (array) $bookmarks as $bookmark) {52 $title = esc_attr(apply_filters('link_title', $bookmark->link_name));50 foreach ( (array)$bookmarks as $bookmark ) : 51 $title = apply_filters('link_title', $bookmark->link_name); 53 52 ?> 54 <outline text="<?php echo $title; ?>" type="link" xmlUrl="<?php echo esc_attr($bookmark->link_rss); ?>" htmlUrl="<?php echo esc_attr($bookmark->link_url); ?>" updated="<?php if ('0000-00-00 00:00:00' != $bookmark->link_updated) echo $bookmark->link_updated; ?>" />53 <outline text="<?php echo esc_attr($title); ?>" type="link" xmlUrl="<?php echo esc_attr($bookmark->link_rss); ?>" htmlUrl="<?php echo esc_attr($bookmark->link_url); ?>" updated="<?php if ('0000-00-00 00:00:00' != $bookmark->link_updated) echo $bookmark->link_updated; ?>" /> 55 54 <?php 56 57 } 55 endforeach; // $bookmarks 58 56 ?> 59 57 </outline> 60 58 <?php 61 62 } 59 endforeach; // $cats 63 60 ?> 64 61 </body>
Note: See TracChangeset
for help on using the changeset viewer.