Skip to content

Commit

Permalink
Link filters from jhodgdon. fixes #3595
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.automattic.com/wordpress/trunk@5011 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
ryan committed Mar 10, 2007
1 parent 2051c80 commit 328afed
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion wp-admin/link-import.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
$categories = get_categories('hide_empty=0');
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
} // end foreach
?>
Expand Down
8 changes: 4 additions & 4 deletions wp-admin/link-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function checkAll(form)
$select_cat = "<select name=\"cat_id\">\n";
$select_cat .= '<option value="all"' . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('All') . "</option>\n";
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_order = "<select name=\"order_by\">\n";
Expand Down Expand Up @@ -131,8 +131,8 @@ function checkAll(form)
<tbody id="the-list">
<?php
foreach ($links as $link) {
$link->link_name = attribute_escape($link->link_name);
$link->link_description = wp_specialchars($link->link_description);
$link->link_name = attribute_escape(apply_filters('link_title', $link->link_name));
$link->link_description = wp_specialchars(apply_filters('link_description', $link->link_description));
$link->link_url = attribute_escape($link->link_url);
$link->link_category = wp_get_link_cats($link->link_id);
$short_url = str_replace('http://', '', $link->link_url);
Expand Down Expand Up @@ -160,7 +160,7 @@ function checkAll(form)
$cat_names = array();
foreach ($link->link_category as $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 )
$cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>";
$cat_names[] = $cat_name;
Expand Down
9 changes: 5 additions & 4 deletions wp-includes/bookmark-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
if ( '' != $rel )
$rel = ' rel="' . $rel . '"';

$desc = attribute_escape($bookmark->link_description);
$name = attribute_escape($bookmark->link_name);
$title = $desc;
$desc = attribute_escape(apply_filters('link_description', $bookmark->link_description));
$name = attribute_escape(apply_filters('link_title', $bookmark->link_name));
$title = $desc;

if ( $show_updated )
if ( '00' != substr($bookmark->link_updated_f, 0, 2) ) {
Expand Down Expand Up @@ -336,7 +336,8 @@ function wp_list_bookmarks($args = '') {
if ( empty($bookmarks) )
continue;
$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 .= "\n\t</ul>\n$category_after\n";
}
Expand Down
7 changes: 5 additions & 2 deletions wp-links-opml.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@
$cats = array (get_category($link_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

$bookmarks = get_bookmarks("category={$cat->cat_ID}");
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

}
Expand Down

0 comments on commit 328afed

Please sign in to comment.