Permalink
Browse files

Link filters from jhodgdon. fixes #3595

git-svn-id: http://svn.automattic.com/wordpress/trunk@5011 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
1 parent 2051c80 commit 328afedc07983de9fde4d52bc2da0462b4fbe09d ryan committed Mar 10, 2007
Showing with 15 additions and 11 deletions.
  1. +1 −1 wp-admin/link-import.php
  2. +4 −4 wp-admin/link-manager.php
  3. +5 −4 wp-includes/bookmark-template.php
  4. +5 −2 wp-links-opml.php
View
@@ -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
?>
@@ -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";
@@ -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);
@@ -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;
@@ -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) ) {
@@ -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";
}
View
@@ -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
}

0 comments on commit 328afed

Please sign in to comment.