WordPress.org

Make WordPress Core

Changeset 16536


Ignore:
Timestamp:
11/22/10 17:17:31 (4 years ago)
Author:
scribu
Message:

Document url_shorten() and use in more places. Props latz for initial patch. Fixes #15540

Location:
trunk/wp-admin/includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-links-list-table.php

    r16182 r16536  
    106106            $link->link_category = wp_get_link_cats( $link->link_id ); 
    107107 
    108             $short_url = str_replace( 'http://', '', $link->link_url ); 
    109             $short_url = preg_replace( '/^www\./i', '', $short_url ); 
    110             if ( '/' == substr( $short_url, -1 ) ) 
    111                 $short_url = substr( $short_url, 0, -1 ); 
    112             if ( strlen( $short_url ) > 35 ) 
    113                 $short_url = substr( $short_url, 0, 32 ).'...'; 
     108            $short_url = url_shorten( $link->link_url ); 
    114109 
    115110            $visible = ( $link->link_visible == 'Y' ) ? __( 'Yes' ) : __( 'No' ); 
  • trunk/wp-admin/includes/class-wp-users-list-table.php

    r16428 r16536  
    172172        $user_object = sanitize_user_object( $user_object, 'display' ); 
    173173        $email = $user_object->user_email; 
    174         $url = $user_object->user_url; 
    175         $short_url = str_replace( 'http://', '', $url ); 
    176         $short_url = str_replace( 'www.', '', $short_url ); 
    177         if ( '/' == substr( $short_url, -1 ) ) 
    178             $short_url = substr( $short_url, 0, -1 ); 
    179         if ( strlen( $short_url ) > 35 ) 
    180             $short_url = substr( $short_url, 0, 32 ).'...'; 
     174 
    181175        $checkbox = ''; 
    182176        // Check if the user for this row is editable 
  • trunk/wp-admin/includes/misc.php

    r16340 r16536  
    213213 
    214214/** 
    215  * {@internal Missing Short Description}} 
    216  * 
    217  * @since unknown 
    218  * 
    219  * @param unknown_type $url 
    220  * @return unknown 
     215 * Shorten an URL, to be used as link text 
     216 * 
     217 * @since 1.2.1 
     218 * 
     219 * @param string $url 
     220 * @return string 
    221221 */ 
    222222function url_shorten( $url ) { 
Note: See TracChangeset for help on using the changeset viewer.