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

git-svn-id: http://svn.automattic.com/wordpress/trunk@16536 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
scribu 2010-11-22 17:17:31 +00:00
parent 69b3167678
commit 0324721ed2
3 changed files with 6 additions and 17 deletions

View File

@ -105,12 +105,7 @@ class WP_Links_List_Table extends WP_List_Table {
$link->link_name = esc_attr( $link->link_name );
$link->link_category = wp_get_link_cats( $link->link_id );
$short_url = str_replace( 'http://', '', $link->link_url );
$short_url = preg_replace( '/^www\./i', '', $short_url );
if ( '/' == substr( $short_url, -1 ) )
$short_url = substr( $short_url, 0, -1 );
if ( strlen( $short_url ) > 35 )
$short_url = substr( $short_url, 0, 32 ).'...';
$short_url = url_shorten( $link->link_url );
$visible = ( $link->link_visible == 'Y' ) ? __( 'Yes' ) : __( 'No' );
$rating = $link->link_rating;

View File

@ -171,13 +171,7 @@ class WP_Users_List_Table extends WP_List_Table {
$user_object = new WP_User( (int) $user_object );
$user_object = sanitize_user_object( $user_object, 'display' );
$email = $user_object->user_email;
$url = $user_object->user_url;
$short_url = str_replace( 'http://', '', $url );
$short_url = str_replace( 'www.', '', $short_url );
if ( '/' == substr( $short_url, -1 ) )
$short_url = substr( $short_url, 0, -1 );
if ( strlen( $short_url ) > 35 )
$short_url = substr( $short_url, 0, 32 ).'...';
$checkbox = '';
// Check if the user for this row is editable
if ( current_user_can( 'list_users' ) ) {

View File

@ -212,12 +212,12 @@ add_action( 'update_option_home', 'update_home_siteurl', 10, 2 );
add_action( 'update_option_siteurl', 'update_home_siteurl', 10, 2 );
/**
* {@internal Missing Short Description}}
* Shorten an URL, to be used as link text
*
* @since unknown
* @since 1.2.1
*
* @param unknown_type $url
* @return unknown
* @param string $url
* @return string
*/
function url_shorten( $url ) {
$short_url = str_replace( 'http://', '', stripslashes( $url ));