Link filters from jhodgdon. fixes #3595

git-svn-id: https://develop.svn.wordpress.org/trunk@5011 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2007-03-10 01:13:49 +00:00
parent c79783485f
commit 0018169c02
4 changed files with 15 additions and 11 deletions

View File

@ -48,7 +48,7 @@ switch ($step) {
$categories = get_categories('hide_empty=0'); $categories = get_categories('hide_empty=0');
foreach ($categories as $category) { foreach ($categories as $category) {
?> ?>
<option value="<?php echo $category->cat_ID; ?>"><?php echo wp_specialchars($category->cat_name); ?></option> <option value="<?php echo $category->cat_ID; ?>"><?php echo wp_specialchars(apply_filters('link_category', $category->cat_name)); ?></option>
<?php <?php
} // end foreach } // end foreach
?> ?>

View File

@ -80,7 +80,7 @@ $categories = get_categories("hide_empty=1&type=link");
$select_cat = "<select name=\"cat_id\">\n"; $select_cat = "<select name=\"cat_id\">\n";
$select_cat .= '<option value="all"' . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('All') . "</option>\n"; $select_cat .= '<option value="all"' . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('All') . "</option>\n";
foreach ((array) $categories as $cat) foreach ((array) $categories as $cat)
$select_cat .= '<option value="' . $cat->cat_ID . '"' . (($cat->cat_ID == $cat_id) ? " selected='selected'" : '') . '>' . wp_specialchars($cat->cat_name) . "</option>\n"; $select_cat .= '<option value="' . $cat->cat_ID . '"' . (($cat->cat_ID == $cat_id) ? " selected='selected'" : '') . '>' . wp_specialchars(apply_filters('link_category', $cat->cat_name)) . "</option>\n";
$select_cat .= "</select>\n"; $select_cat .= "</select>\n";
$select_order = "<select name=\"order_by\">\n"; $select_order = "<select name=\"order_by\">\n";
@ -131,8 +131,8 @@ if ( $links ) {
<tbody id="the-list"> <tbody id="the-list">
<?php <?php
foreach ($links as $link) { foreach ($links as $link) {
$link->link_name = attribute_escape($link->link_name); $link->link_name = attribute_escape(apply_filters('link_title', $link->link_name));
$link->link_description = wp_specialchars($link->link_description); $link->link_description = wp_specialchars(apply_filters('link_description', $link->link_description));
$link->link_url = attribute_escape($link->link_url); $link->link_url = attribute_escape($link->link_url);
$link->link_category = wp_get_link_cats($link->link_id); $link->link_category = wp_get_link_cats($link->link_id);
$short_url = str_replace('http://', '', $link->link_url); $short_url = str_replace('http://', '', $link->link_url);
@ -160,7 +160,7 @@ if ( $links ) {
$cat_names = array(); $cat_names = array();
foreach ($link->link_category as $category) { foreach ($link->link_category as $category) {
$cat_name = get_the_category_by_ID($category); $cat_name = get_the_category_by_ID($category);
$cat_name = wp_specialchars($cat_name); $cat_name = wp_specialchars(apply_filters('link_category', $cat_name));
if ( $cat_id != $category ) if ( $cat_id != $category )
$cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>"; $cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>";
$cat_names[] = $cat_name; $cat_names[] = $cat_name;

View File

@ -266,9 +266,9 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
if ( '' != $rel ) if ( '' != $rel )
$rel = ' rel="' . $rel . '"'; $rel = ' rel="' . $rel . '"';
$desc = attribute_escape($bookmark->link_description); $desc = attribute_escape(apply_filters('link_description', $bookmark->link_description));
$name = attribute_escape($bookmark->link_name); $name = attribute_escape(apply_filters('link_title', $bookmark->link_name));
$title = $desc; $title = $desc;
if ( $show_updated ) if ( $show_updated )
if ( '00' != substr($bookmark->link_updated_f, 0, 2) ) { if ( '00' != substr($bookmark->link_updated_f, 0, 2) ) {
@ -336,7 +336,8 @@ function wp_list_bookmarks($args = '') {
if ( empty($bookmarks) ) if ( empty($bookmarks) )
continue; continue;
$output .= str_replace(array('%id', '%class'), array("linkcat-$cat->cat_ID", $class), $category_before); $output .= str_replace(array('%id', '%class'), array("linkcat-$cat->cat_ID", $class), $category_before);
$output .= "$title_before$cat->cat_name$title_after\n\t<ul>\n"; $catname = apply_filters( "link_category", $cat->cat_name );
$output .= "$title_before$catname$title_after\n\t<ul>\n";
$output .= _walk_bookmarks($bookmarks, $r); $output .= _walk_bookmarks($bookmarks, $r);
$output .= "\n\t</ul>\n$category_after\n"; $output .= "\n\t</ul>\n$category_after\n";
} }

View File

@ -29,14 +29,17 @@ else
$cats = array (get_category($link_cat)); $cats = array (get_category($link_cat));
foreach ((array) $cats as $cat) { foreach ((array) $cats as $cat) {
$catname = apply_filters('link_category', $cat->cat_name);
?> ?>
<outline type="category" title="<?php echo attribute_escape($cat->cat_name); ?>"> <outline type="category" title="<?php echo attribute_escape($catname); ?>">
<?php <?php
$bookmarks = get_bookmarks("category={$cat->cat_ID}"); $bookmarks = get_bookmarks("category={$cat->cat_ID}");
foreach ((array) $bookmarks as $bookmark) { foreach ((array) $bookmarks as $bookmark) {
$title = attribute_escape(apply_filters('link_title', $bookmark->link_name));
?> ?>
<outline text="<?php echo attribute_escape($bookmark->link_name); ?>" type="link" xmlUrl="<?php echo attribute_escape($bookmark->link_rss); ?>" htmlUrl="<?php echo attribute_escape($bookmark->link_url); ?>" updated="<?php if ('0000-00-00 00:00:00' != $bookmark->link_updated) echo $bookmark->link_updated; ?>" /> <outline text="<?php echo $title; ?>" type="link" xmlUrl="<?php echo attribute_escape($bookmark->link_rss); ?>" htmlUrl="<?php echo attribute_escape($bookmark->link_url); ?>" updated="<?php if ('0000-00-00 00:00:00' != $bookmark->link_updated) echo $bookmark->link_updated; ?>" />
<?php <?php
} }