PluginProbe
Elementor Website Builder – more than just a page builder / 3.8.0-beta1
Elementor Website Builder – more than just a page builder v3.8.0-beta1
4.3.4 4.3.3 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 All 457 releases
← All changes | app/app.php +36 -96 4.3.1 → 3.8.0-beta1 View file →
@@ -1,30 +1,15 @@
1 1 <?php
2 2 namespace Elementor\App;
3 3
4 -use Elementor\App\AdminMenuItems\Theme_Builder_Menu_Item;
5 -use Elementor\Core\Admin\Menu\Admin_Menu_Manager;
6 -use Elementor\Core\Experiments\Manager as ExperimentsManager;
4 +use Elementor\Icons_Manager;
7 5 use Elementor\Modules\WebCli\Module as WebCLIModule;
8 6 use Elementor\Core\Base\App as BaseApp;
9 7 use Elementor\Core\Settings\Manager as SettingsManager;
10 8 use Elementor\Plugin;
11 9 use Elementor\TemplateLibrary\Source_Local;
12 -use Elementor\User;
13 10 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 11
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 -
27 12 if ( ! defined( 'ABSPATH' ) ) {
28 13 exit; // Exit if accessed directly.
29 14 }
30 15
@@ -49,10 +34,16 @@
49 34 public function get_base_url() {
50 35 return admin_url( 'admin.php?page=' . self::PAGE_ID . '&ver=' . ELEMENTOR_VERSION );
51 36 }
52 37
53 - private function register_editor_one_menu( Menu_Data_Provider $menu_data_provider ) {
54 - $menu_data_provider->register_menu( new Editor_One_Theme_Builder_Menu() );
38 + public function register_admin_menu() {
39 + add_submenu_page(
40 + Source_Local::ADMIN_MENU_SLUG,
41 + esc_html__( 'Theme Builder', 'elementor' ),
42 + esc_html__( 'Theme Builder', 'elementor' ),
43 + 'manage_options',
44 + self::PAGE_ID
45 + );
55 46 }
56 47
57 48 public function fix_submenu( $menu ) {
58 49 global $submenu;
@@ -83,19 +74,10 @@
83 74
84 75 public function admin_init() {
85 76 do_action( 'elementor/app/init', $this );
86 77
87 - // Add the introduction and user settings only when it is needed (when loading the app and not in the editor or admin pages)
88 - $this->set_settings( 'user', [
89 - 'introduction' => (object) User::get_introduction_meta(),
90 - 'is_administrator' => current_user_can( 'manage_options' ),
91 - 'restrictions' => Plugin::$instance->role_manager->get_user_restrictions_array(),
92 - ] );
93 -
94 78 $this->enqueue_assets();
95 79
96 - remove_action( 'wp_print_styles', 'print_emoji_styles' );
97 -
98 80 // Setup default heartbeat options
99 81 // TODO: Enable heartbeat.
100 82 add_filter( 'heartbeat_settings', function( $settings ) {
101 83 $settings['interval'] = 15;
@@ -111,20 +93,13 @@
111 93
112 94 return [
113 95 'menu_url' => $this->get_base_url() . '#site-editor/promotion',
114 96 'assets_url' => ELEMENTOR_ASSETS_URL,
115 - 'pages_url' => admin_url( 'edit.php?post_type=page' ),
116 97 'return_url' => $referer ? $referer : admin_url(),
117 98 'hasPro' => Utils::has_pro(),
118 99 'admin_url' => admin_url(),
119 100 'login_url' => wp_login_url(),
120 101 'base_url' => $this->get_base_url(),
121 - 'home_url' => home_url(),
122 - 'promotion' => Filtered_Promotions_Manager::get_filtered_promotion_data(
123 - [ 'upgrade_url' => 'https://go.elementor.com/go-pro-theme-builder/' ],
124 - 'elementor/site-editor/promotion',
125 - 'upgrade_url'
126 - ),
127 102 ];
128 103 }
129 104
130 105 private function render() {
@@ -131,16 +106,16 @@
131 106 require __DIR__ . '/view.php';
132 107 }
133 108
134 109 /**
135 - * Get Elementor editor theme color preference.
110 + * Get Elementor UI theme preference.
136 111 *
137 - * Retrieve the user theme color preference as defined by editor preferences manager.
112 + * Retrieve the user UI theme preference as defined by editor preferences manager.
138 113 *
139 114 * @since 3.0.0
140 115 * @access private
141 116 *
142 - * @return string Preferred editor theme.
117 + * @return string Preferred UI theme.
143 118 */
144 119 private function get_elementor_ui_theme_preference() {
145 120 $editor_preferences = SettingsManager::get_settings_managers( 'editorPreferences' );
146 121
@@ -162,38 +137,11 @@
162 137 { document.body.classList.add( `eps-theme-dark` ); }' );
163 138 }
164 139 }
165 140
166 - private function register_packages() {
167 - $assets_config_provider = ( new Assets_Config_Provider() )
168 - ->set_path_resolver( function ( $name ) {
169 - return ELEMENTOR_ASSETS_PATH . "js/packages/{$name}/{$name}.asset.php";
170 - } );
171 -
172 - Collection::make( [ 'ui', 'icons', 'store', 'query', 'utils', 'events', 'onboarding', 'schema' ] )
173 - ->each( function( $package ) use ( $assets_config_provider ) {
174 - $suffix = Utils::is_script_debug() ? '' : '.min';
175 - $config = $assets_config_provider->load( $package )->get( $package );
176 -
177 - if ( ! $config ) {
178 - return;
179 - }
180 -
181 - wp_register_script(
182 - $config['handle'],
183 - ELEMENTOR_ASSETS_URL . "js/packages/{$package}/{$package}{$suffix}.js",
184 - $config['deps'],
185 - ELEMENTOR_VERSION,
186 - true
187 - );
188 - } );
189 - }
190 -
191 141 private function enqueue_assets() {
192 142 Plugin::$instance->init_common();
193 143
194 - $this->register_packages();
195 -
196 144 /** @var WebCLIModule $web_cli */
197 145 $web_cli = Plugin::$instance->modules_manager->get_modules( 'web-cli' );
198 146 $web_cli->register_scripts();
199 147
@@ -205,11 +153,23 @@
205 153 [],
206 154 '4.0.6-rc.1'
207 155 );
208 156
209 - Plugin::$instance->common->register_styles();
157 + wp_register_style(
158 + 'elementor-icons',
159 + $this->get_css_assets_url( 'elementor-icons', 'assets/lib/eicons/css/' ),
160 + [],
161 + Icons_Manager::ELEMENTOR_ICONS_VERSION
162 + );
210 163
211 164 wp_register_style(
165 + 'elementor-common',
166 + $this->get_css_assets_url( 'common', null, 'default', true ),
167 + [],
168 + ELEMENTOR_VERSION
169 + );
170 +
171 + wp_register_style(
212 172 'select2',
213 173 ELEMENTOR_ASSETS_URL . 'lib/e-select2/css/e-select2.css',
214 174 [],
215 175 '4.0.6-rc.1'
@@ -253,11 +213,8 @@
253 213 $this->get_js_assets_url( 'app' ),
254 214 [
255 215 'wp-url',
256 216 'wp-i18n',
257 - 'elementor-v2-ui',
258 - 'elementor-v2-icons',
259 - 'elementor-v2-onboarding',
260 217 'react',
261 218 'react-dom',
262 219 'select2',
263 220 ],
@@ -264,11 +221,14 @@
264 221 ELEMENTOR_VERSION,
265 222 true
266 223 );
267 224
268 - $this->enqueue_dark_theme_detection_script();
225 + if ( ! $this->get_settings( 'disable_dark_theme' ) ) {
226 + $this->enqueue_dark_theme_detection_script();
227 + }
269 228
270 - Assets_Translation_Loader::for_handles( [ 'elementor-app-packages', 'elementor-app' ], 'elementor' );
229 + wp_set_script_translations( 'elementor-app-packages', 'elementor' );
230 + wp_set_script_translations( 'elementor-app', 'elementor' );
271 231
272 232 $this->print_config();
273 233 }
274 234
@@ -285,41 +245,21 @@
285 245
286 246 $this->print_config( 'elementor-app-loader' );
287 247 }
288 248
289 - private function register_import_export_customization_experiment() {
290 - Plugin::$instance->experiments->add_feature( [
291 - 'name' => 'import-export-customization',
292 - 'title' => esc_html__( 'Import/Export Customization', 'elementor' ),
293 - 'description' => esc_html__( 'Enhanced import/export for website templates. Selectively include site content, templates, and settings with advanced granular control.', 'elementor' ),
294 - 'release_status' => ExperimentsManager::RELEASE_STATUS_BETA,
295 - 'default' => ExperimentsManager::STATE_ACTIVE,
296 - 'hidden' => true,
297 - 'mutable' => false,
298 - ] );
299 - }
300 -
301 249 public function __construct() {
302 - $this->register_import_export_customization_experiment();
250 + $this->add_component( 'site-editor', new Modules\SiteEditor\Module() );
303 251
304 - $this->add_component( 'site-editor', new SiteEditorModule() );
252 + if ( current_user_can( 'manage_options' ) && Plugin::$instance->experiments->is_feature_active( 'e_import_export' ) || Utils::is_wp_cli() ) {
253 + $this->add_component( 'import-export', new Modules\ImportExport\Module() );
305 254
306 - if ( current_user_can( 'manage_options' ) || Utils::is_wp_cli() ) {
307 - $this->add_component( 'import-export', new ImportExportModule() );
308 -
309 - if ( Plugin::$instance->experiments->is_feature_active( 'import-export-customization' ) ) {
310 - $this->add_component( 'import-export-customization', new ImportExportCustomizationModule() );
311 - }
312 -
313 255 // Kit library is depended on import-export
314 - $this->add_component( 'kit-library', new KitLibraryModule() );
256 + $this->add_component( 'kit-library', new Modules\KitLibrary\Module() );
315 257 }
316 258
317 - $this->add_component( 'onboarding', new OnboardingModule() );
259 + $this->add_component( 'onboarding', new Modules\Onboarding\Module() );
318 260
319 - add_action( 'elementor/editor-one/menu/register', function ( Menu_Data_Provider $menu_data_provider ) {
320 - $this->register_editor_one_menu( $menu_data_provider );
321 - } );
261 + add_action( 'admin_menu', [ $this, 'register_admin_menu' ], 21 /* after Elementor page */ );
322 262
323 263 // Happens after WP plugin page validation.
324 264 add_filter( 'add_menu_classes', [ $this, 'fix_submenu' ] );
325 265