PluginProbe
Elementor Website Builder – more than just a page builder / 3.35.0-dev4
Elementor Website Builder – more than just a page builder v3.35.0-dev4
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-customization / runners / export / plugins.php

plugins.php in Elementor Website Builder – more than just a page builder 3.35.0-dev4, at app/modules/import-export-customization/runners/export/plugins.php

44 lines 1.0 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\ImportExportCustomization\Runners\Export;
4
5 use Elementor\Core\Utils\Collection;
6
7 class Plugins extends Export_Runner_Base {
8
9 public static function get_name(): string {
10 return 'plugins';
11 }
12
13 public function should_export( array $data ) {
14 return (
15 isset( $data['include'] ) &&
16 in_array( 'plugins', $data['include'], true ) &&
17 is_array( $data['selected_plugins'] )
18 );
19 }
20
21 public function export( array $data ) {
22 $customization = $data['customization']['plugins'] ?? null;
23
24 if ( $customization ) {
25 $enabled_plugin_keys = Collection::make( $customization )->filter()->keys();
26
27 $plugins = Collection::make( $data['selected_plugins'] )
28 ->filter( function( $plugin_data, $plugin_key ) use ( $enabled_plugin_keys ) {
29 return $enabled_plugin_keys->contains( $plugin_key );
30 } )
31 ->all();
32 } else {
33 $plugins = $data['selected_plugins'];
34 }
35
36 return [
37 'manifest' => [
38 [ 'plugins' => array_values( $plugins ) ],
39 ],
40 'files' => [],
41 ];
42 }
43 }
44