| @@ -12,56 +12,53 @@ | ||
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Files Upload Handler |
| 15 | 15 | * |
| 16 | - * @deprecated 3.5.0 Use `Elementor\Core\Files\Uploads_Manager` class instead. | |
| 16 | + * Deprecated, use Elementor\Core\Files\Uploads_Manager instead. | |
| 17 | + * | |
| 18 | + * @deprecated 3.5.0 | |
| 17 | 19 | */ |
| 18 | 20 | abstract class Files_Upload_Handler { |
| 19 | - | |
| 20 | - /** | |
| 21 | - * @deprecated 3.5.0 | |
| 22 | - */ | |
| 23 | 21 | const OPTION_KEY = 'elementor_unfiltered_files_upload'; |
| 24 | 22 | |
| 25 | - /** | |
| 26 | - * @deprecated 3.5.0 | |
| 27 | - */ | |
| 28 | 23 | abstract public function get_mime_type(); |
| 29 | 24 | |
| 30 | - /** | |
| 31 | - * @deprecated 3.5.0 | |
| 32 | - */ | |
| 33 | 25 | abstract public function get_file_type(); |
| 34 | 26 | |
| 35 | 27 | /** |
| 36 | - * Is Elementor Media Upload | |
| 37 | - * | |
| 38 | - * @deprecated 3.5.0 Use `Elementor\Plugin::$instance->uploads_manager->are_unfiltered_uploads_enabled()` instead. | |
| 39 | - * | |
| 28 | + * is_elementor_media_upload | |
| 29 | + * @deprecated 3.5.0 | |
| 40 | 30 | * @return bool |
| 41 | 31 | */ |
| 42 | 32 | private function is_elementor_media_upload() { |
| 43 | - Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0', 'Elementor\Plugin::$instance->uploads_manager->are_unfiltered_uploads_enabled()' ); | |
| 44 | - | |
| 45 | - return Plugin::$instance->uploads_manager->is_elementor_media_upload(); | |
| 33 | + return isset( $_POST['uploadTypeCaller'] ) && 'elementor-wp-media-upload' === $_POST['uploadTypeCaller']; // phpcs:ignore | |
| 46 | 34 | } |
| 47 | 35 | |
| 48 | 36 | /** |
| 49 | - * Is Enabled | |
| 50 | - * | |
| 51 | - * @deprecated 3.5.0 Use `Elementor\Plugin::$instance->uploads_manager->are_unfiltered_uploads_enabled()` instead. | |
| 52 | - * | |
| 53 | 37 | * @return bool |
| 54 | 38 | */ |
| 55 | 39 | final public static function is_enabled() { |
| 56 | - Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0', 'Elementor\Plugin::$instance->uploads_manager->are_unfiltered_uploads_enabled()' ); | |
| 40 | + $enabled = ! ! get_option( self::OPTION_KEY ) && Svg::file_sanitizer_can_run(); | |
| 57 | 41 | |
| 58 | - return Plugin::$instance->uploads_manager->are_unfiltered_uploads_enabled(); | |
| 42 | + /** | |
| 43 | + * @deprecated 3.0.0 Use `elementor/files/allow_unfiltered_upload` filter instead. | |
| 44 | + */ | |
| 45 | + $enabled = apply_filters( 'elementor/files/svg/enabled', $enabled ); | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * Allow Unfiltered Files Upload. | |
| 49 | + * | |
| 50 | + * Determines whether to enable unfiltered file uploads. | |
| 51 | + * | |
| 52 | + * @since 3.0.0 | |
| 53 | + * | |
| 54 | + * @param bool $enabled Whether upload is enabled or not. | |
| 55 | + */ | |
| 56 | + $enabled = apply_filters( 'elementor/files/allow_unfiltered_upload', $enabled ); | |
| 57 | + | |
| 58 | + return $enabled; | |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - /** | |
| 62 | - * @deprecated 3.5.0 Use `Elementor\Plugin::$instance->uploads_manager->are_unfiltered_uploads_enabled()` instead. | |
| 63 | - */ | |
| 64 | 61 | final public function support_unfiltered_files_upload( $existing_mimes ) { |
| 65 | 62 | Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0', 'Elementor\Plugin::$instance->uploads_manager->support_unfiltered_file_uploads()' ); |
| 66 | 63 | |
| 67 | 64 | return Plugin::$instance->uploads_manager->support_unfiltered_elementor_file_uploads( $existing_mimes ); |
| @@ -67,11 +64,11 @@ | ||
| 67 | 64 | return Plugin::$instance->uploads_manager->support_unfiltered_elementor_file_uploads( $existing_mimes ); |
| 68 | 65 | } |
| 69 | 66 | |
| 70 | 67 | /** |
| 71 | - * Handle_upload_prefilter | |
| 68 | + * handle_upload_prefilter | |
| 72 | 69 | * |
| 73 | - * @deprecated 3.5.0 Use `Elementor\Plugin::$instance->uploads_manager->handle_elementor_wp_media_upload()` instead. | |
| 70 | + * @deprcated 3.5.0 | |
| 74 | 71 | * |
| 75 | 72 | * @param $file |
| 76 | 73 | * |
| 77 | 74 | * @return mixed |
| @@ -82,11 +79,11 @@ | ||
| 82 | 79 | return Plugin::$instance->uploads_manager->handle_elementor_wp_media_upload( $file ); |
| 83 | 80 | } |
| 84 | 81 | |
| 85 | 82 | /** |
| 86 | - * Is_file_should_handled | |
| 83 | + * is_file_should_handled | |
| 87 | 84 | * |
| 88 | - * @deprecated 3.5.0 | |
| 85 | + * @deprcated 3.5.0 | |
| 89 | 86 | * |
| 90 | 87 | * @param $file |
| 91 | 88 | * |
| 92 | 89 | * @return bool |
| @@ -99,11 +96,11 @@ | ||
| 99 | 96 | return $this->is_elementor_media_upload() && $this->get_file_type() === $ext; |
| 100 | 97 | } |
| 101 | 98 | |
| 102 | 99 | /** |
| 103 | - * File_sanitizer_can_run | |
| 100 | + * file_sanitizer_can_run | |
| 104 | 101 | * |
| 105 | - * @deprecated 3.5.0 Use `Elementor\Core\Files\File_Types\Svg::file_sanitizer_can_run()` instead. | |
| 102 | + * @deprcated 3.5.0 | |
| 106 | 103 | * |
| 107 | 104 | * @return bool |
| 108 | 105 | */ |
| 109 | 106 | public static function file_sanitizer_can_run() { |
| @@ -119,9 +116,9 @@ | ||
| 119 | 116 | * with inconsistent reporting behaviour. |
| 120 | 117 | * ref: https://core.trac.wordpress.org/ticket/39550 |
| 121 | 118 | * ref: https://core.trac.wordpress.org/ticket/40175 |
| 122 | 119 | * |
| 123 | - * @deprecated 3.5.0 Use `Elementor\Plugin::$instance->uploads_manager->check_filetype_and_ext()` instead. | |
| 120 | + * @deprcated 3.5.0 | |
| 124 | 121 | * |
| 125 | 122 | * @param $data |
| 126 | 123 | * @param $file |
| 127 | 124 | * @param $filename |