PluginProbe
Elementor Website Builder – more than just a page builder / 3.28.0-dev2
Elementor Website Builder – more than just a page builder v3.28.0-dev2
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / core / files / assets / files-upload-handler.php

files-upload-handler.php in Elementor Website Builder – more than just a page builder 3.28.0-dev2, at core/files/assets/files-upload-handler.php

138 lines 4.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\Core\Files\Assets;
4
5 use Elementor\Core\Files\File_Types\Svg;
6 use Elementor\Core\Files\Uploads_Manager;
7 use Elementor\Plugin;
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly.
11 }
12
13 /**
14 * Files Upload Handler
15 *
16 * @deprecated 3.5.0 Use `Elementor\Core\Files\Uploads_Manager` class instead.
17 */
18 abstract class Files_Upload_Handler {
19
20 /**
21 * @deprecated 3.5.0
22 */
23 const OPTION_KEY = 'elementor_unfiltered_files_upload';
24
25 /**
26 * @deprecated 3.5.0
27 */
28 abstract public function get_mime_type();
29
30 /**
31 * @deprecated 3.5.0
32 */
33 abstract public function get_file_type();
34
35 /**
36 * Is Elementor Media Upload
37 *
38 * @deprecated 3.5.0 Use `Elementor\Plugin::$instance->uploads_manager->are_unfiltered_uploads_enabled()` instead.
39 *
40 * @return bool
41 */
42 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();
46 }
47
48 /**
49 * Is Enabled
50 *
51 * @deprecated 3.5.0 Use `Elementor\Plugin::$instance->uploads_manager->are_unfiltered_uploads_enabled()` instead.
52 *
53 * @return bool
54 */
55 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()' );
57
58 return Plugin::$instance->uploads_manager->are_unfiltered_uploads_enabled();
59 }
60
61 /**
62 * @deprecated 3.5.0 Use `Elementor\Plugin::$instance->uploads_manager->are_unfiltered_uploads_enabled()` instead.
63 */
64 final public function support_unfiltered_files_upload( $existing_mimes ) {
65 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
67 return Plugin::$instance->uploads_manager->support_unfiltered_elementor_file_uploads( $existing_mimes );
68 }
69
70 /**
71 * Handle_upload_prefilter
72 *
73 * @deprecated 3.5.0 Use `Elementor\Plugin::$instance->uploads_manager->handle_elementor_wp_media_upload()` instead.
74 *
75 * @param $file
76 *
77 * @return mixed
78 */
79 public function handle_upload_prefilter( $file ) {
80 Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0', 'Elementor\Plugin::$instance->uploads_manager->handle_elementor_wp_media_upload()' );
81
82 return Plugin::$instance->uploads_manager->handle_elementor_wp_media_upload( $file );
83 }
84
85 /**
86 * Is_file_should_handled
87 *
88 * @deprecated 3.5.0
89 *
90 * @param $file
91 *
92 * @return bool
93 */
94 protected function is_file_should_handled( $file ) {
95 Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0' );
96
97 $ext = pathinfo( $file['name'], PATHINFO_EXTENSION );
98
99 return $this->is_elementor_media_upload() && $this->get_file_type() === $ext;
100 }
101
102 /**
103 * File_sanitizer_can_run
104 *
105 * @deprecated 3.5.0 Use `Elementor\Core\Files\File_Types\Svg::file_sanitizer_can_run()` instead.
106 *
107 * @return bool
108 */
109 public static function file_sanitizer_can_run() {
110 Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0', 'Elementor\Core\Files\File_Types\Svg::file_sanitizer_can_run()' );
111
112 return Svg::file_sanitizer_can_run();
113 }
114
115 /**
116 * Check filetype and ext
117 *
118 * A workaround for upload validation which relies on a PHP extension (fileinfo)
119 * with inconsistent reporting behaviour.
120 * ref: https://core.trac.wordpress.org/ticket/39550
121 * ref: https://core.trac.wordpress.org/ticket/40175
122 *
123 * @deprecated 3.5.0 Use `Elementor\Plugin::$instance->uploads_manager->check_filetype_and_ext()` instead.
124 *
125 * @param $data
126 * @param $file
127 * @param $filename
128 * @param $mimes
129 *
130 * @return mixed
131 */
132 public function check_filetype_and_ext( $data, $file, $filename, $mimes ) {
133 Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0', 'Elementor\Plugin::$instance->uploads_manager->check_filetype_and_ext()' );
134
135 Plugin::$instance->uploads_manager->check_filetype_and_ext( $data, $file, $filename, $mimes );
136 }
137 }
138