Changeset 35314 for trunk/src/wp-includes/formatting.php
- Timestamp:
- 10/21/2015 03:47:23 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r35284 r35314 4770 4770 return $mail; 4771 4771 } 4772 4773 /** 4774 * Shorten an URL, to be used as link text 4775 * 4776 * @since 1.2.0 4777 * @since 4.4.0 Moved to wp-includes/formatting.php from wp-admin/includes/misc.php and added $length param 4778 * 4779 * @param string $url URL to shorten 4780 * @param int $length Maxiumum length of url to return 4781 * @return string 4782 */ 4783 function url_shorten( $url, $length = 35 ) { 4784 $stripped = str_replace( array( 'https://', 'http://', 'www.' ), '', $url ); 4785 $short_url = untrailingslashit( $stripped ); 4786 4787 if ( strlen( $short_url ) > $length ) { 4788 $short_url = substr( $short_url, 0, $length - 3 ) . '…'; 4789 } 4790 return $short_url; 4791 }
Note: See TracChangeset
for help on using the changeset viewer.