Ticket #9196: 9196.diff
File 9196.diff, 6.0 KB (added by , 16 years ago) |
---|
-
wp-includes/bookmark-template.php
72 72 if ( !empty($bookmark->link_url) ) 73 73 $the_link = clean_url($bookmark->link_url); 74 74 75 $rel = $bookmark->link_rel;76 if ( '' != $rel )77 $rel = ' rel="' . $rel . '"';78 79 75 $desc = attribute_escape(sanitize_bookmark_field('link_description', $bookmark->link_description, $bookmark->link_id, 'display')); 80 76 $name = attribute_escape(sanitize_bookmark_field('link_name', $bookmark->link_name, $bookmark->link_id, 'display')); 81 77 $title = $desc; … … 87 83 $title .= ')'; 88 84 } 89 85 86 $alt = ' alt="' . $name . ( $show_description ? ' ' . $title : '' ) . '"'; 87 90 88 if ( '' != $title ) 91 89 $title = ' title="' . $title . '"'; 92 90 93 $alt = ' alt="' . $name . '"'; 91 $rel = $bookmark->link_rel; 92 if ( '' != $rel ) 93 $rel = ' rel="' . $rel . '"'; 94 94 95 95 $target = $bookmark->link_target; 96 96 if ( '' != $target ) 97 97 $target = ' target="' . $target . '"'; 98 98 99 $output .= '<a href="' . $the_link . '"' . $rel . $title . $target . '>';99 $output .= '<a href="' . $the_link . '"' . $rel . $title . $target . '>'; 100 100 101 101 $output .= $link_before; 102 102 103 103 if ( $bookmark->link_image != null && $show_images ) { 104 if ( strpos($bookmark->link_image, 'http') !== false)104 if ( strpos($bookmark->link_image, 'http') === 0 ) 105 105 $output .= "<img src=\"$bookmark->link_image\" $alt $title />"; 106 106 else // If it's a relative path 107 107 $output .= "<img src=\"" . get_option('siteurl') . "$bookmark->link_image\" $alt $title />"; … … 121 121 if ( $show_description && '' != $desc ) 122 122 $output .= $between . $desc; 123 123 124 if ( $show_rating) {124 if ( $show_rating ) 125 125 $output .= $between . sanitize_bookmark_field('link_rating', $bookmark->link_rating, $bookmark->link_id, 'display'); 126 }127 126 128 127 $output .= "$after\n"; 129 128 } // end while -
wp-includes/widgets.php
747 747 */ 748 748 function wp_widget_links($args) { 749 749 extract($args, EXTR_SKIP); 750 751 $link_options = get_option('widget_links'); 752 $show_description = isset($link_options['description']) ? $link_options['description'] : false; 753 $show_name = isset($link_options['name']) ? $link_options['name'] : false; 754 $show_rating = isset($link_options['rating']) ? $link_options['rating'] : false; 755 $show_images = isset($link_options['images']) ? $link_options['images'] : true; 756 $between = isset($link_options['sep']) ? $link_options['sep'] : "\n"; 750 757 751 758 $before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget); 752 759 wp_list_bookmarks(apply_filters('widget_links_args', array( 753 760 'title_before' => $before_title, 'title_after' => $after_title, 754 761 'category_before' => $before_widget, 'category_after' => $after_widget, 755 'show_images' => true, 'class' => 'linkcat widget' 762 'show_images' => $show_images, 'show_description' => $show_description, 763 'show_name' => $show_name, 'show_rating' => $show_rating, 764 'between' => $between, 'class' => 'linkcat widget' 756 765 ))); 757 766 } 758 767 759 768 /** 769 * Display and process links widget options form. 770 * 771 * @since 2.8.0 772 */ 773 function wp_widget_links_control() { 774 $options = $newoptions = get_option('widget_links'); 775 776 //Defaults 777 if ( ! $newoptions ) 778 $newoptions = array( 'images' => true, 'name' => true, 'description' => false, 'rating' => false, 'updated' => false, 'sep' => '<br />'); 779 780 if ( isset($_POST['links-submit']) ) { 781 $newoptions['description'] = isset($_POST['links-description']); 782 $newoptions['name'] = isset($_POST['links-name']); 783 $newoptions['rating'] = isset($_POST['links-rating']); 784 $newoptions['images'] = isset($_POST['links-images']); 785 $newoptions['updated'] = isset($_POST['links-updated']); 786 $newoptions['sep'] = isset($_POST['links-sep']) ? stripslashes($_POST['links-sep']) : ''; 787 } 788 if ( $options != $newoptions ) { 789 $options = $newoptions; 790 update_option('widget_links', $options); 791 } 792 ?> 793 <p> 794 <label for="links-images"><input class="checkbox" type="checkbox" <?php checked($options['images'], true) ?> id="links-images" name="links-images" /> <?php _e('Show Link Image'); ?></label> 795 <br /> 796 <label for="links-name"><input class="checkbox" type="checkbox" <?php checked($options['name'], true) ?> id="links-name" name="links-name" /> <?php _e('Show Link Name'); ?></label> 797 <br /> 798 <label for="links-description"><input class="checkbox" type="checkbox" <?php checked($options['description'], true) ?> id="links-description" name="links-description" /> <?php _e('Show Link Description'); ?></label> 799 <br /> 800 <label for="links-rating"><input class="checkbox" type="checkbox" <?php checked($options['rating'], true) ?> id="links-rating" name="links-rating" /> <?php _e('Show Link Rating'); ?></label> 801 <br /> 802 <label for="links-updated"><input class="checkbox" type="checkbox" <?php checked($options['updated'], true) ?> id="links-updated" name="links-updated" /> <?php _e('Show Link Last updated time'); ?></label> 803 </p> 804 <p><label for="links-sep"><?php _e('Separator to use between fields:'); ?> <input class="widefat" id="links-sep" name="links-sep" type="text" value="<?php echo attribute_escape($options['sep']) ?>" /></label></p> 805 <input type="hidden" id="links-submit" name="links-submit" value="1" /> 806 <?php 807 } 808 809 810 /** 760 811 * Display search widget. 761 812 * 762 813 * @since 2.2.0 … … 1928 1979 1929 1980 $widget_ops = array('classname' => 'widget_links', 'description' => __( "Your blogroll") ); 1930 1981 wp_register_sidebar_widget('links', __('Links'), 'wp_widget_links', $widget_ops); 1982 wp_register_widget_control('links', __('Links'), 'wp_widget_links_control' ); 1931 1983 1932 1984 $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") ); 1933 1985 wp_register_sidebar_widget('meta', __('Meta'), 'wp_widget_meta', $widget_ops);