bp_attachments_get_plupload_default_settings

Get the BuddyPress Plupload settings.

Description

(array) bp_attachments_get_plupload_default_settings(); 

Returns (array)

List of BuddyPress Plupload settings.


Usage

  1. if ( !function_exists( 'bp_attachments_get_plupload_default_settings' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-attachments.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_attachments_get_plupload_default_settings(); 
  7.  

Defined (1)

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

/bp-core/bp-core-attachments.php  
  1. function bp_attachments_get_plupload_default_settings() { 
  2.  
  3. $max_upload_size = wp_max_upload_size(); 
  4.  
  5. if ( ! $max_upload_size ) { 
  6. $max_upload_size = 0; 
  7.  
  8. $defaults = array( 
  9. 'runtimes' => 'html5, flash, silverlight, html4',  
  10. 'file_data_name' => 'file',  
  11. 'multipart_params' => array( 
  12. 'action' => 'bp_upload_attachment',  
  13. '_wpnonce' => wp_create_nonce( 'bp-uploader' ),  
  14. ),  
  15. 'url' => admin_url( 'admin-ajax.php', 'relative' ),  
  16. 'flash_swf_url' => includes_url( 'js/plupload/plupload.flash.swf' ),  
  17. 'silverlight_xap_url' => includes_url( 'js/plupload/plupload.silverlight.xap' ),  
  18. 'filters' => array( 
  19. 'max_file_size' => $max_upload_size . 'b',  
  20. ),  
  21. 'multipart' => true,  
  22. 'urlstream_upload' => true,  
  23. ); 
  24.  
  25. // WordPress is not allowing multi selection for iOs 7 device.. See #29602. 
  26. if ( wp_is_mobile() && strpos( $_SERVER['HTTP_USER_AGENT'], 'OS 7_' ) !== false && 
  27. strpos( $_SERVER['HTTP_USER_AGENT'], 'like Mac OS X' ) !== false ) { 
  28.  
  29. $defaults['multi_selection'] = false; 
  30.  
  31. $settings = array( 
  32. 'defaults' => $defaults,  
  33. 'browser' => array( 
  34. 'mobile' => wp_is_mobile(),  
  35. 'supported' => _device_can_upload(),  
  36. ),  
  37. 'limitExceeded' => is_multisite() && ! is_upload_space_available(),  
  38. ); 
  39.  
  40. /** 
  41. * Filter the BuddyPress Plupload default settings. 
  42. * @since 2.3.0 
  43. * @param array $settings Default Plupload parameters array. 
  44. */