PluginProbe
Elementor Website Builder – more than just a page builder / 3.18.2
Elementor Website Builder – more than just a page builder v3.18.2
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 / app / modules / import-export / runners / export / templates.php

templates.php in Elementor Website Builder – more than just a page builder 3.18.2, at app/modules/import-export/runners/export/templates.php

67 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\App\Modules\ImportExport\Runners\Export;
4
5 use Elementor\Core\Base\Document;
6 use Elementor\Plugin;
7 use Elementor\TemplateLibrary\Source_Local;
8 use Elementor\Utils;
9
10 class Templates extends Export_Runner_Base {
11
12 public static function get_name() : string {
13 return 'templates';
14 }
15
16 public function should_export( array $data ) {
17 return (
18 Utils::has_pro() &&
19 isset( $data['include'] ) &&
20 in_array( 'templates', $data['include'], true )
21 );
22 }
23
24 public function export( array $data ) {
25 $template_types = array_values( Source_Local::get_template_types() );
26
27 $query_args = [
28 'post_type' => Source_Local::CPT,
29 'post_status' => 'publish',
30 'posts_per_page' => -1,
31 'meta_query' => [
32 [
33 'key' => Document::TYPE_META_KEY,
34 'value' => $template_types,
35 ],
36 ],
37 ];
38
39 $templates_query = new \WP_Query( $query_args );
40
41 $templates_manifest_data = [];
42 $files = [];
43
44 foreach ( $templates_query->posts as $template_post ) {
45 $template_id = $template_post->ID;
46
47 $template_document = Plugin::$instance->documents->get( $template_id );
48
49 $templates_manifest_data[ $template_id ] = $template_document->get_export_summary();
50
51 $files[] = [
52 'path' => 'templates/' . $template_id,
53 'data' => $template_document->get_export_data(),
54 ];
55 }
56
57 $manifest_data['templates'] = $templates_manifest_data;
58
59 return [
60 'files' => $files,
61 'manifest' => [
62 $manifest_data,
63 ],
64 ];
65 }
66 }
67