Use untrailingslashit in url_shorten() and recurse_dirsize(). Remove unnecessary camelCase variables. see #18592.

git-svn-id: http://svn.automattic.com/wordpress/trunk@18637 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2011-09-05 16:53:19 +00:00
parent fb970629fb
commit a4c18fc053
2 changed files with 5 additions and 9 deletions

View File

@ -223,10 +223,9 @@ add_action( 'update_option_siteurl', 'update_home_siteurl', 10, 2 );
function url_shorten( $url ) {
$short_url = str_replace( 'http://', '', stripslashes( $url ));
$short_url = str_replace( 'www.', '', $short_url );
if ('/' == substr( $short_url, -1 ))
$short_url = substr( $short_url, 0, -1 );
$short_url = untrailingslashit( $short_url );
if ( strlen( $short_url ) > 35 )
$short_url = substr( $short_url, 0, 32 ).'...';
$short_url = substr( $short_url, 0, 32 ) . '...';
return $short_url;
}

View File

@ -1521,8 +1521,7 @@ function get_dirsize( $directory ) {
function recurse_dirsize( $directory ) {
$size = 0;
if ( substr( $directory, -1 ) == '/' )
$directory = substr($directory,0,-1);
$directory = untrailingslashit( $directory );
if ( !file_exists($directory) || !is_dir( $directory ) || !is_readable( $directory ) )
return false;
@ -1565,8 +1564,7 @@ function upload_is_user_over_quota( $echo = true ) {
if ( empty( $spaceAllowed ) || !is_numeric( $spaceAllowed ) )
$spaceAllowed = 10; // Default space allowed is 10 MB
$dirName = BLOGUPLOADDIR;
$size = get_dirsize($dirName) / 1024 / 1024;
$size = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024;
if ( ($spaceAllowed-$size) < 0 ) {
if ( $echo )
@ -1647,8 +1645,7 @@ function fix_import_form_size( $size ) {
return 0;
$spaceAllowed = 1024 * 1024 * get_space_allowed();
$dirName = BLOGUPLOADDIR;
$dirsize = get_dirsize($dirName) ;
$dirsize = get_dirsize( BLOGUPLOADDIR );
if ( $size > $spaceAllowed - $dirsize )
return $spaceAllowed - $dirsize; // remaining space
else