Changeset 9874 for trunk/src/bp-core/classes/class-bp-attachment.php
- Timestamp:
- 05/17/2015 11:14:39 AM (11 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-core/classes/class-bp-attachment.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/classes/class-bp-attachment.php
r9831 r9874 197 197 * @param array $file The appropriate entry the from $_FILES superglobal. 198 198 * @param string $upload_dir_filter A specific filter to be applied to 'upload_dir' (optional). 199 * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null. 199 200 * @uses wp_handle_upload() To upload the file 200 201 * @uses add_filter() To temporarly overrides WordPress uploads data … … 206 207 * (eg: array( 'error' => $message ) ) 207 208 */ 208 public function upload( $file, $upload_dir_filter = '' ) {209 public function upload( $file, $upload_dir_filter = '', $time = null ) { 209 210 /** 210 211 * Upload action and the file input name are required parameters … … 265 266 266 267 // Make sure the file will be uploaded in the attachment directory 267 add_filter( 'upload_dir', $upload_dir_filter, 10, 0 ); 268 if ( ! empty( $upload_dir_filter ) ) { 269 add_filter( 'upload_dir', $upload_dir_filter, 10, 0 ); 270 } 268 271 269 272 // Upload the attachment 270 $this->attachment = wp_handle_upload( $file[ $this->file_input ], $overrides );273 $this->attachment = wp_handle_upload( $file[ $this->file_input ], $overrides, $time ); 271 274 272 275 // Restore WordPress Uploads data 273 remove_filter( 'upload_dir', $upload_dir_filter, 10, 0 ); 276 if ( ! empty( $upload_dir_filter ) ) { 277 remove_filter( 'upload_dir', $upload_dir_filter, 10, 0 ); 278 } 274 279 275 280 // Remove the pre WordPress 4.0 static filter
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)