summaryrefslogtreecommitdiffstats
path: root/wp-includes/functions.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-08-13 15:13:05 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-08-13 15:13:05 +0000
commitbfa3b629e0d67016ec83050c5db762479af40609 (patch)
tree4c9ae204172d0fad3ae056ccc65ffe9ea91134d2 /wp-includes/functions.php
parent7258ea2d7eeedb439607b72a1f74dee98e4b9d12 (diff)
downloadwordpress-mu-bfa3b629e0d67016ec83050c5db762479af40609.tar.gz
wordpress-mu-bfa3b629e0d67016ec83050c5db762479af40609.tar.xz
wordpress-mu-bfa3b629e0d67016ec83050c5db762479af40609.zip
Merge with WP revision 8635
git-svn-id: http://svn.automattic.com/wordpress-mu/branches/2.6@1421 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/functions.php')
-rw-r--r--wp-includes/functions.php29
1 files changed, 18 insertions, 11 deletions
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index 332f831..261097e 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -620,12 +620,12 @@ function delete_option( $name ) {
* @return mixed A scalar data
*/
function maybe_serialize( $data ) {
- if ( is_string( $data ) )
- return $data;
- elseif ( is_array( $data ) || is_object( $data ) )
+ if ( is_array( $data ) || is_object( $data ) )
return serialize( $data );
+
if ( is_serialized( $data ) )
return serialize( $data );
+
return $data;
}
@@ -1473,15 +1473,21 @@ function path_join( $base, $path ) {
function wp_upload_dir( $time = NULL ) {
$siteurl = get_option( 'siteurl' );
$upload_path = get_option( 'upload_path' );
- if ( trim($upload_path) === '' )
- $upload_path = WP_CONTENT_DIR . '/uploads';
- $dir = $upload_path;
+ $upload_path = trim($upload_path);
+ if ( empty($upload_path) )
+ $dir = WP_CONTENT_DIR . '/uploads';
+ else
+ $dir = $upload_path;
// $dir is absolute, $path is (maybe) relative to ABSPATH
- $dir = path_join( ABSPATH, $upload_path );
-
- if ( !$url = get_option( 'upload_url_path' ) )
- $url = WP_CONTENT_URL . '/uploads';
+ $dir = path_join( ABSPATH, $dir );
+
+ if ( !$url = get_option( 'upload_url_path' ) ) {
+ if ( empty($upload_path) or ( $upload_path == $dir ) )
+ $url = WP_CONTENT_URL . '/uploads';
+ else
+ $url = trailingslashit( $siteurl ) . $upload_path;
+ }
if ( defined('UPLOADS') ) {
$dir = ABSPATH . UPLOADS;
@@ -1509,8 +1515,9 @@ function wp_upload_dir( $time = NULL ) {
$message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $dir );
return array( 'error' => $message );
}
-
+
$uploads = array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $bdir, 'baseurl' => $burl, 'error' => false );
+
return apply_filters( 'upload_dir', $uploads );
}