From a4c18fc05318e58605c9d401267ead95d09a7442 Mon Sep 17 00:00:00 2001 From: nacin Date: Mon, 5 Sep 2011 16:53:19 +0000 Subject: [PATCH] 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 --- wp-admin/includes/misc.php | 5 ++--- wp-includes/ms-functions.php | 9 +++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php index a0db0ad054..ef5050c874 100644 --- a/wp-admin/includes/misc.php +++ b/wp-admin/includes/misc.php @@ -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; } diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php index df088e18f7..785ede974b 100644 --- a/wp-includes/ms-functions.php +++ b/wp-includes/ms-functions.php @@ -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