Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/elementor/core/files/assets/svg/svg-handler.php

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
1 + <?php
2 + namespace Elementor\Core\Files\Assets\Svg;
3 +
4 + use Elementor\Core\Files\Assets\Files_Upload_Handler;
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 + * SVG Handler
15 + *
16 + * @deprecated 3.5.0 Use `Elementor\Core\Files\File_Types\Svg` instead, accessed by calling: `Plugin::$instance->uploads_manager->get_file_type_handlers( 'svg' );`
17 + */
18 + class Svg_Handler extends Files_Upload_Handler {
19 +
20 + /**
21 + * Inline svg attachment meta key
22 + *
23 + * @deprecated 3.5.0
24 + */
25 + const META_KEY = '_elementor_inline_svg';
26 +
27 + /**
28 + * @deprecated 3.5.0
29 + */
30 + const SCRIPT_REGEX = '/(?:\w+script|data):/xi';
31 +
32 + /**
33 + * Attachment ID.
34 + *
35 + * Holds the current attachment ID.
36 + *
37 + * @deprecated 3.5.0
38 + *
39 + * @var int
40 + */
41 + private $attachment_id;
42 +
43 + /**
44 + * @deprecated 3.5.0
45 + */
46 + public static function get_name() {
47 + return 'svg-handler';
48 + }
49 +
50 + /**
51 + * Get meta
52 + *
53 + * @deprecated 3.5.0
54 + *
55 + * @return mixed
56 + */
57 + protected function get_meta() {
58 + Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0' );
59 +
60 + return get_post_meta( $this->attachment_id, self::META_KEY, true );
61 + }
62 +
63 + /**
64 + * Update meta
65 + *
66 + * @deprecated 3.5.0
67 + *
68 + * @param $meta
69 + */
70 + protected function update_meta( $meta ) {
71 + Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0' );
72 +
73 + update_post_meta( $this->attachment_id, self::META_KEY, $meta );
74 + }
75 +
76 + /**
77 + * Delete meta
78 + *
79 + * @deprecated 3.5.0
80 + */
81 + protected function delete_meta() {
82 + Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0' );
83 +
84 + delete_post_meta( $this->attachment_id, self::META_KEY );
85 + }
86 +
87 + /**
88 + * Get mime type
89 + *
90 + * @deprecated 3.5.0
91 + */
92 + public function get_mime_type() {
93 + return 'image/svg+xml';
94 + }
95 +
96 + /**
97 + * Get file type
98 + *
99 + * @deprecated 3.5.0
100 + */
101 + public function get_file_type() {
102 + return 'svg';
103 + }
104 +
105 + /**
106 + * Delete meta cache
107 + *
108 + * @deprecated 3.5.0 Use `Plugin::$instance->uploads_manager->get_file_type_handlers( 'svg' )->delete_meta_cache()` instead.
109 + */
110 + public function delete_meta_cache() {
111 + Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0', 'Plugin::$instance->uploads_manager->get_file_type_handlers( \'svg\' )->delete_meta_cache()' );
112 +
113 + /** @var Svg $svg_handler */
114 + $svg_handler = Plugin::$instance->uploads_manager->get_file_type_handlers( 'svg' );
115 +
116 + $svg_handler->delete_meta_cache();
117 + }
118 +
119 + /**
120 + * Get inline svg
121 + *
122 + * @deprecated 3.5.0 Use `Elementor\Core\Files\File_Types\Svg::get_inline_svg()` instead.
123 + *
124 + * @param $attachment_id
125 + *
126 + * @return bool|mixed|string
127 + */
128 + public static function get_inline_svg( $attachment_id ) {
129 + Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0', 'Elementor\Core\Files\File_Types\Svg::get_inline_svg()' );
130 +
131 + return Svg::get_inline_svg( $attachment_id );
132 + }
133 +
134 + /**
135 + * Sanitize svg
136 + *
137 + * @deprecated 3.5.0 Use `Plugin::$instance->uploads_manager->get_file_type_handlers( 'svg' )->delete_meta_cache()->sanitize_svg()` instead.
138 + *
139 + * @param $filename
140 + *
141 + * @return bool
142 + */
143 + public function sanitize_svg( $filename ) {
144 + Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0', 'Plugin::$instance->uploads_manager->get_file_type_handlers( \'svg\' )->delete_meta_cache()->sanitize_svg()' );
145 +
146 + /** @var Svg $svg_handler */
147 + $svg_handler = Plugin::$instance->uploads_manager->get_file_type_handlers( 'svg' );
148 +
149 + return $svg_handler->sanitize_svg( $filename );
150 + }
151 +
152 + /**
153 + * Sanitizer
154 + *
155 + * @deprecated 3.5.0 Use `Plugin::$instance->uploads_manager->get_file_type_handlers( 'svg' )->sanitizer()` instead.
156 + *
157 + * @param $content
158 + *
159 + * @return bool|string
160 + */
161 + public function sanitizer( $content ) {
162 + Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0', 'Plugin::$instance->uploads_manager->get_file_type_handlers( \'svg\' )->sanitizer()' );
163 +
164 + /** @var Svg $svg_handler */
165 + $svg_handler = Plugin::$instance->uploads_manager->get_file_type_handlers( 'svg' );
166 +
167 + return $svg_handler->sanitizer( $content );
168 + }
169 +
170 + /**
171 + * Prepare attachment for js
172 + *
173 + * @deprecated 3.5.0 Use `Plugin::$instance->uploads_manager->get_file_type_handlers( 'svg' )->wp_prepare_attachment_for_js()` instead.
174 + *
175 + * @param $attachment_data
176 + * @param $attachment
177 + * @param $meta
178 + *
179 + * @return mixed
180 + */
181 + public function wp_prepare_attachment_for_js( $attachment_data, $attachment, $meta ) {
182 + Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0', 'Plugin::$instance->uploads_manager->get_file_type_handlers( \'svg\' )->wp_prepare_attachment_for_js()' );
183 +
184 + /** @var Svg $svg_handler */
185 + $svg_handler = Plugin::$instance->uploads_manager->get_file_type_handlers( 'svg' );
186 +
187 + return $svg_handler->wp_prepare_attachment_for_js( $attachment_data, $attachment, $meta );
188 + }
189 +
190 + /**
191 + * Set attachment id
192 + *
193 + * @deprecated 3.5.0
194 + *
195 + * @param $attachment_id
196 + *
197 + * @return int
198 + */
199 + public function set_attachment_id( $attachment_id ) {
200 + Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0' );
201 +
202 + $this->attachment_id = $attachment_id;
203 + return $this->attachment_id;
204 + }
205 +
206 + /**
207 + * Get attachment id
208 + *
209 + * @deprecated 3.5.0
210 + *
211 + * @return int
212 + */
213 + public function get_attachment_id() {
214 + Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0' );
215 +
216 + return $this->attachment_id;
217 + }
218 +
219 + /**
220 + * Set svg meta data
221 + *
222 + * @deprecated 3.5.0 Use `Plugin::$instance->uploads_manager->get_file_type_handlers( 'svg' )->set_svg_meta_data()` instead.
223 + *
224 + * @return mixed
225 + */
226 + public function set_svg_meta_data( $data, $id ) {
227 + Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0', 'Plugin::$instance->uploads_manager->get_file_type_handlers( \'svg\' )->set_svg_meta_data()' );
228 +
229 + /** @var Svg $svg_handler */
230 + $svg_handler = Plugin::$instance->uploads_manager->get_file_type_handlers( 'svg' );
231 +
232 + return $svg_handler->set_svg_meta_data( $data, $id );
233 + }
234 +
235 + /**
236 + * Handle upload prefilter
237 + *
238 + * @deprecated 3.5.0 Use `Elementor\Plugin::$instance->uploads_manager->handle_elementor_wp_media_upload()` instead.
239 + *
240 + * @param $file
241 + *
242 + * @return mixed
243 + */
244 + public function handle_upload_prefilter( $file ) {
245 + 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()' );
246 +
247 + return Plugin::$instance->uploads_manager->handle_elementor_wp_media_upload( $file );
248 + }
249 + }
250 +