PluginProbe
Elementor Website Builder – more than just a page builder / 3.17.2
Elementor Website Builder – more than just a page builder v3.17.2
4.3.2 4.3.1 4.3.0 4.3.0-beta3 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 All 455 releases
← All changes | app/app.php +15 -105 4.3.2 → 3.17.2 View file →
@@ -2,9 +2,9 @@
2 2 namespace Elementor\App;
3 3
4 4 use Elementor\App\AdminMenuItems\Theme_Builder_Menu_Item;
5 5 use Elementor\Core\Admin\Menu\Admin_Menu_Manager;
6 -use Elementor\Core\Experiments\Manager as ExperimentsManager;
6 +use Elementor\Icons_Manager;
7 7 use Elementor\Modules\WebCli\Module as WebCLIModule;
8 8 use Elementor\Core\Base\App as BaseApp;
9 9 use Elementor\Core\Settings\Manager as SettingsManager;
10 10 use Elementor\Plugin;
@@ -10,22 +10,9 @@
10 10 use Elementor\Plugin;
11 11 use Elementor\TemplateLibrary\Source_Local;
12 12 use Elementor\User;
13 13 use Elementor\Utils;
14 -use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
15 -use Elementor\Core\Utils\Assets_Config_Provider;
16 -use Elementor\Core\Utils\Collection;
17 -use Elementor\Core\Utils\Assets_Translation_Loader;
18 -use Elementor\Modules\EditorOne\Classes\Menu_Data_Provider;
19 -use Elementor\App\AdminMenuItems\Editor_One_Theme_Builder_Menu;
20 14
21 -use Elementor\App\Modules\ImportExport\Module as ImportExportModule;
22 -use Elementor\App\Modules\KitLibrary\Module as KitLibraryModule;
23 -use Elementor\App\Modules\ImportExportCustomization\Module as ImportExportCustomizationModule;
24 -use Elementor\App\Modules\SiteEditor\Module as SiteEditorModule;
25 -use Elementor\App\Modules\Onboarding\Module as OnboardingModule;
26 -use Elementor\App\Modules\OnboardingNew\Module as OnboardingNewModule;
27 -
28 15 if ( ! defined( 'ABSPATH' ) ) {
29 16 exit; // Exit if accessed directly.
30 17 }
31 18
@@ -50,10 +37,10 @@
50 37 public function get_base_url() {
51 38 return admin_url( 'admin.php?page=' . self::PAGE_ID . '&ver=' . ELEMENTOR_VERSION );
52 39 }
53 40
54 - private function register_editor_one_menu( Menu_Data_Provider $menu_data_provider ) {
55 - $menu_data_provider->register_menu( new Editor_One_Theme_Builder_Menu() );
41 + private function register_admin_menu( Admin_Menu_Manager $admin_menu ) {
42 + $admin_menu->register( static::PAGE_ID, new Theme_Builder_Menu_Item() );
56 43 }
57 44
58 45 public function fix_submenu( $menu ) {
59 46 global $submenu;
@@ -87,16 +74,12 @@
87 74
88 75 // Add the introduction and user settings only when it is needed (when loading the app and not in the editor or admin pages)
89 76 $this->set_settings( 'user', [
90 77 'introduction' => (object) User::get_introduction_meta(),
91 - 'is_administrator' => current_user_can( 'manage_options' ),
92 - 'restrictions' => Plugin::$instance->role_manager->get_user_restrictions_array(),
93 78 ] );
94 79
95 80 $this->enqueue_assets();
96 81
97 - remove_action( 'wp_print_styles', 'print_emoji_styles' );
98 -
99 82 // Setup default heartbeat options
100 83 // TODO: Enable heartbeat.
101 84 add_filter( 'heartbeat_settings', function( $settings ) {
102 85 $settings['interval'] = 15;
@@ -118,14 +101,8 @@
118 101 'hasPro' => Utils::has_pro(),
119 102 'admin_url' => admin_url(),
120 103 'login_url' => wp_login_url(),
121 104 'base_url' => $this->get_base_url(),
122 - 'home_url' => home_url(),
123 - 'promotion' => Filtered_Promotions_Manager::get_filtered_promotion_data(
124 - [ 'upgrade_url' => 'https://go.elementor.com/go-pro-theme-builder/' ],
125 - 'elementor/site-editor/promotion',
126 - 'upgrade_url'
127 - ),
128 105 ];
129 106 }
130 107
131 108 private function render() {
@@ -132,16 +109,16 @@
132 109 require __DIR__ . '/view.php';
133 110 }
134 111
135 112 /**
136 - * Get Elementor editor theme color preference.
113 + * Get Elementor UI theme preference.
137 114 *
138 - * Retrieve the user theme color preference as defined by editor preferences manager.
115 + * Retrieve the user UI theme preference as defined by editor preferences manager.
139 116 *
140 117 * @since 3.0.0
141 118 * @access private
142 119 *
143 - * @return string Preferred editor theme.
120 + * @return string Preferred UI theme.
144 121 */
145 122 private function get_elementor_ui_theme_preference() {
146 123 $editor_preferences = SettingsManager::get_settings_managers( 'editorPreferences' );
147 124
@@ -163,38 +140,11 @@
163 140 { document.body.classList.add( `eps-theme-dark` ); }' );
164 141 }
165 142 }
166 143
167 - private function register_packages() {
168 - $assets_config_provider = ( new Assets_Config_Provider() )
169 - ->set_path_resolver( function ( $name ) {
170 - return ELEMENTOR_ASSETS_PATH . "js/packages/{$name}/{$name}.asset.php";
171 - } );
172 -
173 - Collection::make( [ 'ui', 'icons', 'store', 'query', 'utils', 'events', 'onboarding', 'schema' ] )
174 - ->each( function( $package ) use ( $assets_config_provider ) {
175 - $suffix = Utils::is_script_debug() ? '' : '.min';
176 - $config = $assets_config_provider->load( $package )->get( $package );
177 -
178 - if ( ! $config ) {
179 - return;
180 - }
181 -
182 - wp_register_script(
183 - $config['handle'],
184 - ELEMENTOR_ASSETS_URL . "js/packages/{$package}/{$package}{$suffix}.js",
185 - $config['deps'],
186 - ELEMENTOR_VERSION,
187 - true
188 - );
189 - } );
190 - }
191 -
192 144 private function enqueue_assets() {
193 145 Plugin::$instance->init_common();
194 146
195 - $this->register_packages();
196 -
197 147 /** @var WebCLIModule $web_cli */
198 148 $web_cli = Plugin::$instance->modules_manager->get_modules( 'web-cli' );
199 149 $web_cli->register_scripts();
200 150
@@ -254,11 +204,8 @@
254 204 $this->get_js_assets_url( 'app' ),
255 205 [
256 206 'wp-url',
257 207 'wp-i18n',
258 - 'elementor-v2-ui',
259 - 'elementor-v2-icons',
260 - 'elementor-v2-onboarding',
261 208 'react',
262 209 'react-dom',
263 210 'select2',
264 211 ],
@@ -267,9 +214,10 @@
267 214 );
268 215
269 216 $this->enqueue_dark_theme_detection_script();
270 217
271 - Assets_Translation_Loader::for_handles( [ 'elementor-app-packages', 'elementor-app' ], 'elementor' );
218 + wp_set_script_translations( 'elementor-app-packages', 'elementor' );
219 + wp_set_script_translations( 'elementor-app', 'elementor' );
272 220
273 221 $this->print_config();
274 222 }
275 223
@@ -286,61 +234,23 @@
286 234
287 235 $this->print_config( 'elementor-app-loader' );
288 236 }
289 237
290 - private function register_import_export_customization_experiment() {
291 - Plugin::$instance->experiments->add_feature( [
292 - 'name' => 'import-export-customization',
293 - 'title' => esc_html__( 'Import/Export Customization', 'elementor' ),
294 - 'description' => esc_html__( 'Enhanced import/export for website templates. Selectively include site content, templates, and settings with advanced granular control.', 'elementor' ),
295 - 'release_status' => ExperimentsManager::RELEASE_STATUS_BETA,
296 - 'default' => ExperimentsManager::STATE_ACTIVE,
297 - 'hidden' => true,
298 - 'mutable' => false,
299 - ] );
300 - }
301 -
302 - private function register_e_onboarding_experiment() {
303 - Plugin::$instance->experiments->add_feature( [
304 - 'name' => 'e_onboarding',
305 - 'title' => esc_html__( 'New Onboarding', 'elementor' ),
306 - 'hidden' => true,
307 - 'default' => ExperimentsManager::STATE_INACTIVE,
308 - 'release_status' => ExperimentsManager::RELEASE_STATUS_DEV,
309 - ] );
310 - }
311 -
312 - private function is_e_onboarding_active(): bool {
313 - return Plugin::$instance->experiments->is_feature_active( 'e_onboarding' );
314 - }
315 -
316 238 public function __construct() {
317 - $this->register_import_export_customization_experiment();
239 + $this->add_component( 'site-editor', new Modules\SiteEditor\Module() );
318 240
319 - $this->add_component( 'site-editor', new SiteEditorModule() );
320 -
321 241 if ( current_user_can( 'manage_options' ) || Utils::is_wp_cli() ) {
322 - $this->add_component( 'import-export', new ImportExportModule() );
242 + $this->add_component( 'import-export', new Modules\ImportExport\Module() );
323 243
324 - if ( Plugin::$instance->experiments->is_feature_active( 'import-export-customization' ) ) {
325 - $this->add_component( 'import-export-customization', new ImportExportCustomizationModule() );
326 - }
327 -
328 244 // Kit library is depended on import-export
329 - $this->add_component( 'kit-library', new KitLibraryModule() );
245 + $this->add_component( 'kit-library', new Modules\KitLibrary\Module() );
330 246 }
331 247
332 - $this->register_e_onboarding_experiment();
248 + $this->add_component( 'onboarding', new Modules\Onboarding\Module() );
333 249
334 - if ( $this->is_e_onboarding_active() ) {
335 - $this->add_component( 'onboarding', new OnboardingNewModule() );
336 - } else {
337 - $this->add_component( 'onboarding', new OnboardingModule() );
338 - }
339 -
340 - add_action( 'elementor/editor-one/menu/register', function ( Menu_Data_Provider $menu_data_provider ) {
341 - $this->register_editor_one_menu( $menu_data_provider );
342 - } );
250 + add_action( 'elementor/admin/menu/register', function ( Admin_Menu_Manager $admin_menu ) {
251 + $this->register_admin_menu( $admin_menu );
252 + }, Source_Local::ADMIN_MENU_PRIORITY + 10 );
343 253
344 254 // Happens after WP plugin page validation.
345 255 add_filter( 'add_menu_classes', [ $this, 'fix_submenu' ] );
346 256