Edit File by line
/home/zeestwma/richards...
File: wp-links-opml.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Outputs the OPML XML format for getting the links defined in the link
[2] Fix | Delete
* administration. This can be used to export links from one blog over to
[3] Fix | Delete
* another. Links aren't exported by the WordPress export, so this file handles
[4] Fix | Delete
* that.
[5] Fix | Delete
*
[6] Fix | Delete
* This file is not added by default to WordPress theme pages when outputting
[7] Fix | Delete
* feed links. It will have to be added manually for browsers and users to pick
[8] Fix | Delete
* up that this file exists.
[9] Fix | Delete
*
[10] Fix | Delete
* @package WordPress
[11] Fix | Delete
*/
[12] Fix | Delete
[13] Fix | Delete
require_once __DIR__ . '/wp-load.php';
[14] Fix | Delete
[15] Fix | Delete
header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
[16] Fix | Delete
$link_cat = '';
[17] Fix | Delete
if ( ! empty( $_GET['link_cat'] ) ) {
[18] Fix | Delete
$link_cat = $_GET['link_cat'];
[19] Fix | Delete
if ( ! in_array( $link_cat, array( 'all', '0' ), true ) ) {
[20] Fix | Delete
$link_cat = absint( (string) urldecode( $link_cat ) );
[21] Fix | Delete
}
[22] Fix | Delete
}
[23] Fix | Delete
[24] Fix | Delete
echo '<?xml version="1.0"?' . ">\n";
[25] Fix | Delete
?>
[26] Fix | Delete
<opml version="1.0">
[27] Fix | Delete
<head>
[28] Fix | Delete
<title>
[29] Fix | Delete
<?php
[30] Fix | Delete
/* translators: %s: Site title. */
[31] Fix | Delete
printf( __( 'Links for %s' ), esc_attr( get_bloginfo( 'name', 'display' ) ) );
[32] Fix | Delete
?>
[33] Fix | Delete
</title>
[34] Fix | Delete
<dateCreated><?php echo gmdate( 'D, d M Y H:i:s' ); ?> GMT</dateCreated>
[35] Fix | Delete
<?php
[36] Fix | Delete
/**
[37] Fix | Delete
* Fires in the OPML header.
[38] Fix | Delete
*
[39] Fix | Delete
* @since 3.0.0
[40] Fix | Delete
*/
[41] Fix | Delete
do_action( 'opml_head' );
[42] Fix | Delete
?>
[43] Fix | Delete
</head>
[44] Fix | Delete
<body>
[45] Fix | Delete
<?php
[46] Fix | Delete
if ( empty( $link_cat ) ) {
[47] Fix | Delete
$cats = get_categories(
[48] Fix | Delete
array(
[49] Fix | Delete
'taxonomy' => 'link_category',
[50] Fix | Delete
'hierarchical' => 0,
[51] Fix | Delete
)
[52] Fix | Delete
);
[53] Fix | Delete
} else {
[54] Fix | Delete
$cats = get_categories(
[55] Fix | Delete
array(
[56] Fix | Delete
'taxonomy' => 'link_category',
[57] Fix | Delete
'hierarchical' => 0,
[58] Fix | Delete
'include' => $link_cat,
[59] Fix | Delete
)
[60] Fix | Delete
);
[61] Fix | Delete
}
[62] Fix | Delete
[63] Fix | Delete
foreach ( (array) $cats as $cat ) :
[64] Fix | Delete
/** This filter is documented in wp-includes/bookmark-template.php */
[65] Fix | Delete
$catname = apply_filters( 'link_category', $cat->name );
[66] Fix | Delete
[67] Fix | Delete
?>
[68] Fix | Delete
<outline type="category" title="<?php echo esc_attr( $catname ); ?>">
[69] Fix | Delete
<?php
[70] Fix | Delete
$bookmarks = get_bookmarks( array( 'category' => $cat->term_id ) );
[71] Fix | Delete
foreach ( (array) $bookmarks as $bookmark ) :
[72] Fix | Delete
/**
[73] Fix | Delete
* Filters the OPML outline link title text.
[74] Fix | Delete
*
[75] Fix | Delete
* @since 2.2.0
[76] Fix | Delete
*
[77] Fix | Delete
* @param string $title The OPML outline title text.
[78] Fix | Delete
*/
[79] Fix | Delete
$title = apply_filters( 'link_title', $bookmark->link_name );
[80] Fix | Delete
?>
[81] Fix | Delete
<outline text="<?php echo esc_attr( $title ); ?>" type="link" xmlUrl="<?php echo esc_url( $bookmark->link_rss ); ?>" htmlUrl="<?php echo esc_url( $bookmark->link_url ); ?>" updated="
[82] Fix | Delete
<?php
[83] Fix | Delete
if ( '0000-00-00 00:00:00' !== $bookmark->link_updated ) {
[84] Fix | Delete
echo $bookmark->link_updated;
[85] Fix | Delete
}
[86] Fix | Delete
?>
[87] Fix | Delete
" />
[88] Fix | Delete
<?php
[89] Fix | Delete
endforeach; // $bookmarks
[90] Fix | Delete
?>
[91] Fix | Delete
</outline>
[92] Fix | Delete
<?php
[93] Fix | Delete
endforeach; // $cats
[94] Fix | Delete
?>
[95] Fix | Delete
</body>
[96] Fix | Delete
</opml>
[97] Fix | Delete
[98] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function