Changeset 10012 for trunk/src/bp-core/classes/class-bp-attachment.php
- Timestamp:
- 07/12/2015 12:49:36 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/classes/class-bp-attachment.php
r9874 r10012 11 11 12 12 /** 13 * BP Attachment class 13 * BP Attachment class. 14 14 * 15 15 * Extend it to manage your component's uploads. … … 22 22 23 23 /** 24 * The file being uploaded 24 * The file being uploaded. 25 25 * 26 26 * @var array … … 30 30 /** 31 31 * The default args to be merged with the 32 * ones passed by the child class 32 * ones passed by the child class. 33 33 * 34 34 * @var array … … 45 45 46 46 /** 47 * Construct Upload parameters 48 * 49 * @since BuddyPress (2.3.0) 50 * 51 * @param array $args {47 * Construct Upload parameters. 48 * 49 * @since BuddyPress (2.3.0) 50 * 51 * @param array|string $args { 52 52 * @type int $original_max_filesize Maximum file size in kilobytes. Defaults to php.ini settings. 53 53 * @type array $allowed_mime_types List of allowed file extensions (eg: array( 'jpg', 'gif', 'png' ) ). 54 * Defaults to WordPress allowed mime types 55 * @type string $base_dir Component's upload base directory. Defaults to WordPress 'uploads' 54 * Defaults to WordPress allowed mime types. 55 * @type string $base_dir Component's upload base directory. Defaults to WordPress 'uploads'. 56 56 * @type string $action The upload action used when uploading a file, $_POST['action'] must be set 57 * and its value must equal $action {@link wp_handle_upload()} (required) 58 * @type string $file_input The name attribute used in the file input. (required) 57 * and its value must equal $action {@link wp_handle_upload()} (required). 58 * @type string $file_input The name attribute used in the file input. (required). 59 59 * @type array $upload_error_strings A list of specific error messages (optional). 60 * @type array $required_wp_files The list of required WordPress core files. Default: array( 'file' ) ;60 * @type array $required_wp_files The list of required WordPress core files. Default: array( 'file' ). 61 61 * } 62 62 * @uses sanitize_key() … … 107 107 * @since BuddyPress (2.3.0) 108 108 * 109 * @uses 109 * @uses bp_upload_dir() 110 110 */ 111 111 public function set_upload_dir() { … … 140 140 141 141 /** 142 * Set Upload error messages 142 * Set Upload error messages. 143 143 * 144 144 * Used into the $overrides argument of BP_Attachment->upload() … … 146 146 * @since BuddyPress (2.3.0) 147 147 * 148 * @param array $param a list of error messages to add to BuddyPress core ones 148 * @param array $param A list of error messages to add to BuddyPress core ones. 149 * 149 150 * @return array the list of upload errors 150 151 */ … … 176 177 177 178 /** 178 * Include the WordPress core needed files 179 * Include the WordPress core needed files. 179 180 * 180 181 * @since BuddyPress (2.3.0) … … 191 192 192 193 /** 193 * Upload the attachment 194 * 195 * @since BuddyPress (2.3.0) 196 * 197 * @param array $file The appropriate entry the from $_FILES superglobal. 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. 194 * Upload the attachment. 195 * 196 * @since BuddyPress (2.3.0) 197 * 198 * @param array $file The appropriate entry the from $_FILES superglobal. 199 * @param string $upload_dir_filter A specific filter to be applied to 'upload_dir' (optional). 200 * @param string|null $time Optional. Time formatted in 'yyyy/mm'. Default null. 201 * 200 202 * @uses wp_handle_upload() To upload the file 201 203 * @uses add_filter() To temporarly overrides WordPress uploads data … … 247 249 248 250 /** 249 * If you need to add some overrides we haven't thought of 251 * If you need to add some overrides we haven't thought of. 250 252 * 251 * @ var array $overrides the wp_handle_upload overrides253 * @param array $overrides The wp_handle_upload overrides 252 254 */ 253 255 $overrides = apply_filters( 'bp_attachment_upload_overrides', $overrides ); … … 286 288 287 289 /** 288 * Validate the allowed mime types using WordPress allowed mime types 290 * Validate the allowed mime types using WordPress allowed mime types. 289 291 * 290 292 * In case of a multisite, the mime types are already restricted by … … 312 314 313 315 /** 314 * Specific upload rules 316 * Specific upload rules. 315 317 * 316 318 * Override this function from your child class to build your specific rules … … 322 324 * @since BuddyPress (2.3.0) 323 325 * 324 * @param array $file the temporary file attributes (before it has been moved) 325 * @return array the file 326 * @param array $file The temporary file attributes (before it has been moved). 327 * 328 * @return array The file. 326 329 */ 327 330 public function validate_upload( $file = array() ) { … … 340 343 341 344 /** 342 * Default filter to save the attachments 343 * 344 * @since BuddyPress (2.3.0) 345 * 346 * @uses apply_filters() call 'bp_attachment_upload_dir' to eventually override the upload location 347 * regarding to context 348 * @return array the upload directory data 345 * Default filter to save the attachments. 346 * 347 * @since BuddyPress (2.3.0) 348 * 349 * @uses apply_filters() call 'bp_attachment_upload_dir' to eventually override the upload location 350 * regarding to context 351 * 352 * @return array The upload directory data. 349 353 */ 350 354 public function upload_dir_filter() { 355 351 356 /** 352 357 * Filters the component's upload directory. … … 367 372 368 373 /** 369 * Create the custom base directory for the component uploads 370 * 371 * Override this function in your child class to run specific actions 374 * Create the custom base directory for the component uploads. 375 * 376 * Override this function in your child class to run specific actions. 372 377 * (eg: add an .htaccess file) 373 378 * 374 379 * @since BuddyPress (2.3.0) 375 380 * 376 * @uses 381 * @uses wp_mkdir_p() 377 382 */ 378 383 public function create_dir() { … … 396 401 397 402 /** 398 * Crop an image file 403 * Crop an image file. 399 404 * 400 405 * @since BuddyPress (2.3.0) … … 402 407 * @param array $args { 403 408 * @type string $original_file The source file (absolute path) for the Attachment. 404 * @type int $crop_x The start x position to crop from.405 * @type int $crop_y The start y position to crop from.406 * @type int $crop_w The width to crop.407 * @type int $crop_h The height to crop.408 * @type int $dst_w The destination width.409 * @type int $dst_h The destination height.410 * @type int $src_abs Optional. If the source crop points are absolute.411 * @type string $dst_file Optional. The destination file to write to.409 * @type int $crop_x The start x position to crop from. 410 * @type int $crop_y The start y position to crop from. 411 * @type int $crop_w The width to crop. 412 * @type int $crop_h The height to crop. 413 * @type int $dst_w The destination width. 414 * @type int $dst_h The destination height. 415 * @type int $src_abs Optional. If the source crop points are absolute. 416 * @type string $dst_file Optional. The destination file to write to. 412 417 * } 413 418 * @uses wp_crop_image() 419 * 414 420 * @return string|WP_Error New filepath on success, WP_Error on failure. 415 421 */ … … 495 501 496 502 /** 497 * Build script datas for the Uploader UI 498 * 499 * Override this method from your child class to build the script datas 500 * 501 * @since BuddyPress (2.3.0) 502 * 503 * @return array the javascript localization data503 * Build script datas for the Uploader UI. 504 * 505 * Override this method from your child class to build the script datas. 506 * 507 * @since BuddyPress (2.3.0) 508 * 509 * @return array The javascript localization data. 504 510 */ 505 511 public function script_data() {
Note: See TracChangeset
for help on using the changeset viewer.