membership_wp_upload_dir

The Membership 2 membership wp upload dir function.

Description

membership_wp_upload_dir(); 

Usage

  1. if ( !function_exists( 'membership_wp_upload_dir' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'membership-2/app_old/membershipincludes/includes/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = membership_wp_upload_dir(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/app_old/membershipincludes/includes/functions.php  
  1. function membership_wp_upload_dir() { 
  2. global $switched; 
  3.  
  4. $siteurl = get_option( 'siteurl' ); 
  5. $upload_path = get_option( 'upload_path' ); 
  6. $upload_path = trim($upload_path); 
  7.  
  8. $main_override = is_multisite() && defined( 'MULTISITE' ) && is_main_site(); 
  9.  
  10. if ( empty($upload_path) ) { 
  11. $dir = WP_CONTENT_DIR . '/uploads'; 
  12. } else { 
  13. $dir = $upload_path; 
  14. if ( 'wp-content/uploads' == $upload_path ) { 
  15. $dir = WP_CONTENT_DIR . '/uploads'; 
  16. } elseif ( 0 !== strpos($dir, ABSPATH) ) { 
  17. // $dir is absolute, $upload_path is (maybe) relative to ABSPATH 
  18. $dir = path_join( ABSPATH, $dir ); 
  19.  
  20. if ( !$url = get_option( 'upload_url_path' ) ) { 
  21. if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) ) 
  22. $url = WP_CONTENT_URL . '/uploads'; 
  23. else 
  24. $url = trailingslashit( $siteurl ) . $upload_path; 
  25.  
  26. if ( defined('UPLOADS') && !$main_override && ( !isset( $switched ) || $switched === false ) ) { 
  27. $dir = ABSPATH . UPLOADS; 
  28. $url = trailingslashit( $siteurl ) . UPLOADS; 
  29.  
  30. if ( is_multisite() && !$main_override && ( !isset( $switched ) || $switched === false ) ) { 
  31. if ( defined( 'BLOGUPLOADDIR' ) ) 
  32. $dir = untrailingslashit(BLOGUPLOADDIR); 
  33. $url = str_replace( UPLOADS, 'files', $url ); 
  34.  
  35. $bdir = $dir; 
  36. $burl = $url; 
  37.  
  38. return trailingslashit($bdir);