← All changes
|
app/modules/import-export-customization/processes/export.php
+5
-28
4.2.2
→
3.32.0-dev3
View file →
| @@ -123,14 +123,8 @@ | ||
| 123 | 123 | 'selected_plugins' => $this->settings_selected_plugins, |
| 124 | 124 | 'selected_custom_post_types' => $this->settings_selected_custom_post_types, |
| 125 | 125 | ]; |
| 126 | 126 | |
| 127 | - $media_collector = null; | |
| 128 | - if ( $this->should_collect_media( $data ) ) { | |
| 129 | - $media_collector = new \Elementor\TemplateLibrary\Classes\Media_Collector(); | |
| 130 | - $media_collector->start_collection(); | |
| 131 | - } | |
| 132 | - | |
| 133 | 127 | foreach ( $this->runners as $runner ) { |
| 134 | 128 | if ( $runner->should_export( $data ) ) { |
| 135 | 129 | $export_result = $runner->export( $data ); |
| 136 | 130 | $this->handle_export_result( $export_result ); |
| @@ -136,13 +130,8 @@ | ||
| 136 | 130 | $this->handle_export_result( $export_result ); |
| 137 | 131 | } |
| 138 | 132 | } |
| 139 | 133 | |
| 140 | - $media_urls = null; | |
| 141 | - if ( $media_collector ) { | |
| 142 | - $media_urls = $media_collector->get_collected_urls(); | |
| 143 | - } | |
| 144 | - | |
| 145 | 134 | $this->add_json_file( 'manifest', $this->manifest_data ); |
| 146 | 135 | |
| 147 | 136 | $zip_file_name = $this->zip->filename; |
| 148 | 137 | $this->zip->close(); |
| @@ -149,9 +138,8 @@ | ||
| 149 | 138 | |
| 150 | 139 | return [ |
| 151 | 140 | 'manifest' => $this->manifest_data, |
| 152 | 141 | 'file_name' => $zip_file_name, |
| 153 | - 'media_urls' => $media_urls, | |
| 154 | 142 | ]; |
| 155 | 143 | } |
| 156 | 144 | |
| 157 | 145 | /** |
| @@ -178,10 +166,10 @@ | ||
| 178 | 166 | $this->settings_customization( $this->get_default_settings_customization() ); |
| 179 | 167 | } |
| 180 | 168 | } |
| 181 | 169 | |
| 182 | - public function settings_include( $settings_include ) { | |
| 183 | - $this->settings_include = $settings_include; | |
| 170 | + public function settings_include( $include ) { | |
| 171 | + $this->settings_include = $include; | |
| 184 | 172 | } |
| 185 | 173 | |
| 186 | 174 | public function get_settings_include() { |
| 187 | 175 | return $this->settings_include; |
| @@ -265,11 +253,9 @@ | ||
| 265 | 253 | private function get_default_settings_customization() { |
| 266 | 254 | return [ |
| 267 | 255 | 'settings' => null, |
| 268 | 256 | 'templates' => null, |
| 269 | - 'content' => [ | |
| 270 | - 'mediaFormat' => 'link', | |
| 271 | - ], | |
| 257 | + 'content' => null, | |
| 272 | 258 | 'plugins' => null, |
| 273 | 259 | ]; |
| 274 | 260 | } |
| 275 | 261 | |
| @@ -284,10 +270,8 @@ | ||
| 284 | 270 | } |
| 285 | 271 | |
| 286 | 272 | /** |
| 287 | 273 | * Init the zip archive. |
| 288 | - * | |
| 289 | - * @throws \Error If export process fails, file creation errors occur, or data serialization fails. | |
| 290 | 274 | */ |
| 291 | 275 | private function init_zip_archive() { |
| 292 | 276 | if ( ! class_exists( '\ZipArchive' ) ) { |
| 293 | 277 | throw new \Error( static::ZIP_ARCHIVE_MODULE_MISSING ); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped |
| @@ -360,10 +344,10 @@ | ||
| 360 | 344 | /** |
| 361 | 345 | * Add json file to the zip archive. |
| 362 | 346 | * |
| 363 | 347 | * @param string $path The relative path to the file. |
| 364 | - * @param array $content The content of the file. | |
| 365 | - * @param int $json_flags | |
| 348 | + * @param array $content The content of the file. | |
| 349 | + * @param int $json_flags | |
| 366 | 350 | */ |
| 367 | 351 | private function add_json_file( $path, array $content, $json_flags = 0 ) { |
| 368 | 352 | if ( ! Str::ends_with( $path, '.json' ) ) { |
| 369 | 353 | $path .= '.json'; |
| @@ -379,13 +363,6 @@ | ||
| 379 | 363 | * @param string $content The content of the file. |
| 380 | 364 | */ |
| 381 | 365 | private function add_file( $file, $content ) { |
| 382 | 366 | $this->zip->addFromString( $file, $content ); |
| 383 | - } | |
| 384 | - | |
| 385 | - private function should_collect_media( $data ) { | |
| 386 | - return ( | |
| 387 | - isset( $data['customization']['content']['mediaFormat'] ) && | |
| 388 | - 'cloud' === $data['customization']['content']['mediaFormat'] | |
| 389 | - ); | |
| 390 | 367 | } |
| 391 | 368 | } |