Changeset 42343 for trunk/src/wp-links-opml.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-links-opml.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-links-opml.php
r42201 r42343 15 15 require_once( dirname( __FILE__ ) . '/wp-load.php' ); 16 16 17 header( 'Content-Type: text/xml; charset=' . get_option('blog_charset'), true);17 header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true ); 18 18 $link_cat = ''; 19 if ( ! empty($_GET['link_cat']) ) {19 if ( ! empty( $_GET['link_cat'] ) ) { 20 20 $link_cat = $_GET['link_cat']; 21 if ( !in_array($link_cat, array('all', '0')) ) 22 $link_cat = absint( (string)urldecode($link_cat) ); 21 if ( ! in_array( $link_cat, array( 'all', '0' ) ) ) { 22 $link_cat = absint( (string) urldecode( $link_cat ) ); 23 } 23 24 } 24 25 25 echo '<?xml version="1.0"?' .">\n";26 echo '<?xml version="1.0"?' . ">\n"; 26 27 ?> 27 28 <opml version="1.0"> 28 29 <head> 29 <title><?php 30 <title> 31 <?php 30 32 /* translators: 1: Site name */ 31 printf( __('Links for %s'), esc_attr(get_bloginfo('name', 'display')) ); 32 ?></title> 33 <dateCreated><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</dateCreated> 33 printf( __( 'Links for %s' ), esc_attr( get_bloginfo( 'name', 'display' ) ) ); 34 ?> 35 </title> 36 <dateCreated><?php echo gmdate( 'D, d M Y H:i:s' ); ?> GMT</dateCreated> 34 37 <?php 35 38 /** … … 43 46 <body> 44 47 <?php 45 if ( empty($link_cat) ) 46 $cats = get_categories(array('taxonomy' => 'link_category', 'hierarchical' => 0)); 47 else 48 $cats = get_categories(array('taxonomy' => 'link_category', 'hierarchical' => 0, 'include' => $link_cat)); 48 if ( empty( $link_cat ) ) { 49 $cats = get_categories( 50 array( 51 'taxonomy' => 'link_category', 52 'hierarchical' => 0, 53 ) 54 ); 55 } else { 56 $cats = get_categories( 57 array( 58 'taxonomy' => 'link_category', 59 'hierarchical' => 0, 60 'include' => $link_cat, 61 ) 62 ); 63 } 49 64 50 foreach ( (array) $cats as $cat ) :65 foreach ( (array) $cats as $cat ) : 51 66 /** 52 67 * Filters the OPML outline link category name. … … 59 74 60 75 ?> 61 <outline type="category" title="<?php echo esc_attr( $catname); ?>">76 <outline type="category" title="<?php echo esc_attr( $catname ); ?>"> 62 77 <?php 63 $bookmarks = get_bookmarks( array("category" => $cat->term_id));64 foreach ( (array)$bookmarks as $bookmark ) :65 /**66 * Filters the OPML outline link title text.67 *68 * @since 2.2.069 *70 * @param string $title The OPML outline title text.71 */72 $title = apply_filters( 'link_title', $bookmark->link_name );78 $bookmarks = get_bookmarks( array( 'category' => $cat->term_id ) ); 79 foreach ( (array) $bookmarks as $bookmark ) : 80 /** 81 * Filters the OPML outline link title text. 82 * 83 * @since 2.2.0 84 * 85 * @param string $title The OPML outline title text. 86 */ 87 $title = apply_filters( 'link_title', $bookmark->link_name ); 73 88 ?> 74 <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; ?>" /> 89 <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=" 90 <?php 91 if ( '0000-00-00 00:00:00' != $bookmark->link_updated ) { 92 echo $bookmark->link_updated;} 93 ?> 94 " /> 75 95 <?php 76 96 endforeach; // $bookmarks
Note: See TracChangeset
for help on using the changeset viewer.