Make WordPress Core


Ignore:
Timestamp:
10/21/2015 03:47:23 AM (10 years ago)
Author:
wonderboymusic
Message:

Formatting: move url_shorten() from wp-admin/includes/misc.php to wp-includes/formatting.php for more global access.

Adds unit tests.

Props mulvane, chriscct7.
Fixes #20166.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/misc.php

    r35267 r35314  
    289289}
    290290
    291 /**
    292  * Shorten an URL, to be used as link text
    293  *
    294  * @since 1.2.0
    295  *
    296  * @param string $url
    297  * @return string
    298  */
    299 function url_shorten( $url ) {
    300     $short_url = str_replace( array( 'http://', 'www.' ), '', $url );
    301     $short_url = untrailingslashit( $short_url );
    302     if ( strlen( $short_url ) > 35 )
    303         $short_url = substr( $short_url, 0, 32 ) . '…';
    304     return $short_url;
    305 }
    306291
    307292/**
Note: See TracChangeset for help on using the changeset viewer.