wp/wp-links-opml.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 19 3d72ae0968f4
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
    10  * up that this file exists.
    10  * up that this file exists.
    11  *
    11  *
    12  * @package WordPress
    12  * @package WordPress
    13  */
    13  */
    14 
    14 
    15 require_once( dirname( __FILE__ ) . '/wp-load.php' );
    15 require_once __DIR__ . '/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 $link_cat = '';
    18 $link_cat = '';
    19 if ( ! empty( $_GET['link_cat'] ) ) {
    19 if ( ! empty( $_GET['link_cat'] ) ) {
    20 	$link_cat = $_GET['link_cat'];
    20 	$link_cat = $_GET['link_cat'];
    21 	if ( ! in_array( $link_cat, array( 'all', '0' ) ) ) {
    21 	if ( ! in_array( $link_cat, array( 'all', '0' ), true ) ) {
    22 		$link_cat = absint( (string) urldecode( $link_cat ) );
    22 		$link_cat = absint( (string) urldecode( $link_cat ) );
    23 	}
    23 	}
    24 }
    24 }
    25 
    25 
    26 echo '<?xml version="1.0"?' . ">\n";
    26 echo '<?xml version="1.0"?' . ">\n";
    27 ?>
    27 ?>
    28 <opml version="1.0">
    28 <opml version="1.0">
    29 	<head>
    29 	<head>
    30 		<title>
    30 		<title>
    31 		<?php
    31 		<?php
    32 			/* translators: %s: site name */
    32 			/* translators: %s: Site title. */
    33 			printf( __( 'Links for %s' ), esc_attr( get_bloginfo( 'name', 'display' ) ) );
    33 			printf( __( 'Links for %s' ), esc_attr( get_bloginfo( 'name', 'display' ) ) );
    34 		?>
    34 		?>
    35 		</title>
    35 		</title>
    36 		<dateCreated><?php echo gmdate( 'D, d M Y H:i:s' ); ?> GMT</dateCreated>
    36 		<dateCreated><?php echo gmdate( 'D, d M Y H:i:s' ); ?> GMT</dateCreated>
    37 		<?php
    37 		<?php
    80 		 */
    80 		 */
    81 		$title = apply_filters( 'link_title', $bookmark->link_name );
    81 		$title = apply_filters( 'link_title', $bookmark->link_name );
    82 		?>
    82 		?>
    83 <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="
    83 <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="
    84 							<?php
    84 							<?php
    85 							if ( '0000-00-00 00:00:00' != $bookmark->link_updated ) {
    85 							if ( '0000-00-00 00:00:00' !== $bookmark->link_updated ) {
    86 								echo $bookmark->link_updated;}
    86 								echo $bookmark->link_updated;}
    87 							?>
    87 							?>
    88 " />
    88 " />
    89 		<?php
    89 		<?php
    90 	endforeach; // $bookmarks
    90 	endforeach; // $bookmarks