Document url_shorten() and use in more places. Props latz for initial patch. Fixes #15540
git-svn-id: https://develop.svn.wordpress.org/trunk@16536 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e8dd42ce2a
commit
ef9b5fb1ec
@ -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;
|
||||
|
@ -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' ) ) {
|
||||
|
@ -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 ));
|
||||
|
Loading…
Reference in New Issue
Block a user