diff --git a/wp-includes/bookmark-template.php b/wp-includes/bookmark-template.php index 844f664f7..51bf0cbb3 100644 --- a/wp-includes/bookmark-template.php +++ b/wp-includes/bookmark-template.php @@ -72,10 +72,6 @@ function _walk_bookmarks($bookmarks, $args = '' ) { if ( !empty($bookmark->link_url) ) $the_link = clean_url($bookmark->link_url); - $rel = $bookmark->link_rel; - if ( '' != $rel ) - $rel = ' rel="' . $rel . '"'; - $desc = attribute_escape(sanitize_bookmark_field('link_description', $bookmark->link_description, $bookmark->link_id, 'display')); $name = attribute_escape(sanitize_bookmark_field('link_name', $bookmark->link_name, $bookmark->link_id, 'display')); $title = $desc; @@ -87,21 +83,25 @@ function _walk_bookmarks($bookmarks, $args = '' ) { $title .= ')'; } + $alt = ' alt="' . $name . ( $show_description ? ' ' . $title : '' ) . '"'; + if ( '' != $title ) $title = ' title="' . $title . '"'; - $alt = ' alt="' . $name . '"'; + $rel = $bookmark->link_rel; + if ( '' != $rel ) + $rel = ' rel="' . $rel . '"'; $target = $bookmark->link_target; if ( '' != $target ) $target = ' target="' . $target . '"'; - $output .= ''; + $output .= ''; $output .= $link_before; if ( $bookmark->link_image != null && $show_images ) { - if ( strpos($bookmark->link_image, 'http') !== false ) + if ( strpos($bookmark->link_image, 'http') === 0 ) $output .= "link_image\" $alt $title />"; else // If it's a relative path $output .= "link_image\" $alt $title />"; @@ -121,9 +121,8 @@ function _walk_bookmarks($bookmarks, $args = '' ) { if ( $show_description && '' != $desc ) $output .= $between . $desc; - if ($show_rating) { + if ( $show_rating ) $output .= $between . sanitize_bookmark_field('link_rating', $bookmark->link_rating, $bookmark->link_id, 'display'); - } $output .= "$after\n"; } // end while diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index 1bb8522ae..408279712 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -748,14 +748,59 @@ function wp_widget_pages_control() { function wp_widget_links($args) { extract($args, EXTR_SKIP); + $link_options = get_option('widget_links'); + $show_description = isset($link_options['description']) ? $link_options['description'] : false; + $show_name = isset($link_options['name']) ? $link_options['name'] : false; + $show_rating = isset($link_options['rating']) ? $link_options['rating'] : false; + $show_images = isset($link_options['images']) ? $link_options['images'] : true; + $before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget); wp_list_bookmarks(apply_filters('widget_links_args', array( 'title_before' => $before_title, 'title_after' => $after_title, 'category_before' => $before_widget, 'category_after' => $after_widget, - 'show_images' => true, 'class' => 'linkcat widget' + 'show_images' => $show_images, 'show_description' => $show_description, + 'show_name' => $show_name, 'show_rating' => $show_rating, + 'class' => 'linkcat widget' ))); } +/** + * Display and process links widget options form. + * + * @since 2.8.0 + */ +function wp_widget_links_control() { + $options = $newoptions = get_option('widget_links'); + + //Defaults + if ( ! $newoptions ) + $newoptions = array( 'images' => true, 'name' => true, 'description' => false, 'rating' => false); + + if ( isset($_POST['links-submit']) ) { + $newoptions['description'] = isset($_POST['links-description']); + $newoptions['name'] = isset($_POST['links-name']); + $newoptions['rating'] = isset($_POST['links-rating']); + $newoptions['images'] = isset($_POST['links-images']); + } + if ( $options != $newoptions ) { + $options = $newoptions; + update_option('widget_links', $options); + } +?> +

+ +
+ +
+ +
+ +

+ + 'widget_links', 'description' => __( "Your blogroll") ); wp_register_sidebar_widget('links', __('Links'), 'wp_widget_links', $widget_ops); + wp_register_widget_control('links', __('Links'), 'wp_widget_links_control' ); $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") ); wp_register_sidebar_widget('meta', __('Meta'), 'wp_widget_meta', $widget_ops);