| @@ -1,5 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 3 | +use Imagify\User\User; | |
| 4 | + | |
| 2 | 5 | defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' ); |
| 3 | 6 | |
| 4 | 7 | /** |
| 5 | 8 | * Class used to check that Imagify has everything it needs. |
| @@ -15,9 +18,9 @@ | ||
| 15 | 18 | * @access protected |
| 16 | 19 | * @since 1.7.1 |
| 17 | 20 | * @author Grégory Viguier |
| 18 | 21 | */ |
| 19 | - protected static $supports = array(); | |
| 22 | + protected static $supports = []; | |
| 20 | 23 | |
| 21 | 24 | |
| 22 | 25 | /** ----------------------------------------------------------------------------------------- */ |
| 23 | 26 | /** SERVER ================================================================================== */ |
| @@ -63,24 +66,24 @@ | ||
| 63 | 66 | require_once ABSPATH . WPINC . '/class-wp-image-editor-imagick.php'; |
| 64 | 67 | |
| 65 | 68 | self::$supports['image_editor'] = false; |
| 66 | 69 | |
| 67 | - $args = array( | |
| 70 | + $args = [ | |
| 68 | 71 | 'path' => IMAGIFY_PATH . 'assets/images/imagify-logo.png', |
| 69 | 72 | 'mime_types' => imagify_get_mime_types( 'image' ), |
| 70 | 73 | 'methods' => Imagify_Attachment::get_editor_methods(), |
| 71 | - ); | |
| 74 | + ]; | |
| 72 | 75 | |
| 73 | 76 | /** This filter is documented in /wp-includes/media.php. */ |
| 74 | - $implementations = apply_filters( 'wp_image_editors', array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ) ); | |
| 77 | + $implementations = apply_filters( 'wp_image_editors', [ 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ] ); | |
| 75 | 78 | |
| 76 | 79 | foreach ( $implementations as $implementation ) { |
| 77 | - if ( ! call_user_func( array( $implementation, 'test' ), $args ) ) { | |
| 80 | + if ( ! call_user_func( [ $implementation, 'test' ], $args ) ) { | |
| 78 | 81 | continue; |
| 79 | 82 | } |
| 80 | 83 | |
| 81 | 84 | foreach ( $args['mime_types'] as $mime_type ) { |
| 82 | - if ( ! call_user_func( array( $implementation, 'supports_mime_type' ), $mime_type ) ) { | |
| 85 | + if ( ! call_user_func( [ $implementation, 'supports_mime_type' ], $mime_type ) ) { | |
| 83 | 86 | continue 2; |
| 84 | 87 | } |
| 85 | 88 | } |
| 86 | 89 | |
| @@ -94,13 +97,8 @@ | ||
| 94 | 97 | |
| 95 | 98 | return self::$supports['image_editor']; |
| 96 | 99 | } |
| 97 | 100 | |
| 98 | - | |
| 99 | - /** ----------------------------------------------------------------------------------------- */ | |
| 100 | - /** WORDPRESS =============================================================================== */ | |
| 101 | - /** ----------------------------------------------------------------------------------------- */ | |
| 102 | - | |
| 103 | 101 | /** |
| 104 | 102 | * Test for the uploads directory. |
| 105 | 103 | * |
| 106 | 104 | * @since 1.7.1 |
| @@ -302,9 +300,9 @@ | ||
| 302 | 300 | if ( ! $reset_cache && isset( self::$supports['over_quota'] ) ) { |
| 303 | 301 | return self::$supports['over_quota']; |
| 304 | 302 | } |
| 305 | 303 | |
| 306 | - $user = new Imagify_User(); | |
| 304 | + $user = new User(); | |
| 307 | 305 | |
| 308 | 306 | self::$supports['over_quota'] = $user->get_error() ? false : $user->is_over_quota(); |
| 309 | 307 | |
| 310 | 308 | return self::$supports['over_quota']; |
| @@ -326,12 +324,12 @@ | ||
| 326 | 324 | */ |
| 327 | 325 | public static function reset_cache( $cache_key ) { |
| 328 | 326 | unset( self::$supports[ $cache_key ] ); |
| 329 | 327 | |
| 330 | - $transients = array( | |
| 328 | + $transients = [ | |
| 331 | 329 | 'api_up' => 'imagify_check_api_version', |
| 332 | 330 | 'api_key_valid' => 'imagify_check_licence_1', |
| 333 | - ); | |
| 331 | + ]; | |
| 334 | 332 | |
| 335 | 333 | if ( isset( $transients[ $cache_key ] ) && get_site_transient( $transients[ $cache_key ] ) ) { |
| 336 | 334 | delete_site_transient( $transients[ $cache_key ] ); |
| 337 | 335 | } |