IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
2602 | 2602 | /** |
2603 | 2603 | * Determines the maximum upload size allowed in php.ini. |
2604 | 2604 | * |
| 2605 | * The optional arguments should be supplied only for testing |
| 2606 | * the function. |
| 2607 | * |
2605 | 2608 | * @since 2.5.0 |
2606 | 2609 | * |
| 2610 | * @param int $upl_max_filesize_bytes A value for upload_max_filesize. |
| 2611 | * @param int $post_max_size_bytes A value for post_max_size. |
| 2612 | * |
2607 | 2613 | * @return int Allowed upload size. |
2608 | 2614 | */ |
2609 | | function wp_max_upload_size() { |
2610 | | $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) ); |
2611 | | $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) ); |
| 2615 | function wp_max_upload_size( $upl_max_filesize_bytes = null, $post_max_size_bytes = null ) { |
2612 | 2616 | |
2613 | 2617 | /** |
| 2618 | * Initialize the values, if none are provided by the tests. |
| 2619 | */ |
| 2620 | if (!$upl_max_filesize_bytes) { |
| 2621 | $upl_max_filesize_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) ); |
| 2622 | } |
| 2623 | |
| 2624 | if (!$post_max_size_bytes) { |
| 2625 | $post_max_size_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) ); |
| 2626 | } |
| 2627 | |
| 2628 | /** |
| 2629 | * Get an accurate max upload size. |
| 2630 | * |
| 2631 | * If one of the limits is set to 0, but the other one isn't |
| 2632 | * this value will be wrong. |
| 2633 | * PHP treats 0 values as "unlimited", so actually the limit |
| 2634 | * is the larger value in this case. |
| 2635 | * |
| 2636 | * This is handled here, to make sure the proper limit is returned. |
| 2637 | * |
| 2638 | */ |
| 2639 | |
| 2640 | // get the lower limit |
| 2641 | $upload_size_limit_bytes = min( $upl_max_filesize_bytes, $post_max_size_bytes ); |
| 2642 | |
| 2643 | // if the limit is 0, make sure to get the correct one |
| 2644 | if ( 0 === $upload_size_limit_bytes ) { |
| 2645 | $upload_size_limit_bytes = max( $upl_max_filesize_bytes, $post_max_size_bytes ); |
| 2646 | } |
| 2647 | |
| 2648 | /** |
2614 | 2649 | * Filter the maximum upload size allowed in php.ini. |
2615 | 2650 | * |
2616 | 2651 | * @since 2.5.0 |
2617 | 2652 | * |
2618 | 2653 | * @param int $size Max upload size limit in bytes. |
2619 | | * @param int $u_bytes Maximum upload filesize in bytes. |
2620 | | * @param int $p_bytes Maximum size of POST data in bytes. |
| 2654 | * @param int $upl_max_filesize_bytes Maximum upload filesize in bytes. |
| 2655 | * @param int $post_max_size_bytes Maximum size of POST data in bytes. |
2621 | 2656 | */ |
2622 | | return apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes ); |
| 2657 | return apply_filters( 'upload_size_limit', $upload_size_limit_bytes, $upl_max_filesize_bytes, $post_max_size_bytes ); |
2623 | 2658 | } |
2624 | 2659 | |
2625 | 2660 | /** |