| @@ -2,9 +2,8 @@ | ||
| 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; | |
| 7 | 6 | use Elementor\Modules\WebCli\Module as WebCLIModule; |
| 8 | 7 | use Elementor\Core\Base\App as BaseApp; |
| 9 | 8 | use Elementor\Core\Settings\Manager as SettingsManager; |
| 10 | 9 | use Elementor\Plugin; |
| @@ -10,22 +9,9 @@ | ||
| 10 | 9 | use Elementor\Plugin; |
| 11 | 10 | use Elementor\TemplateLibrary\Source_Local; |
| 12 | 11 | use Elementor\User; |
| 13 | 12 | 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 | 13 | |
| 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\SiteBuilder\Module as SiteBuilderModule; | |
| 27 | - | |
| 28 | 14 | if ( ! defined( 'ABSPATH' ) ) { |
| 29 | 15 | exit; // Exit if accessed directly. |
| 30 | 16 | } |
| 31 | 17 | |
| @@ -50,10 +36,10 @@ | ||
| 50 | 36 | public function get_base_url() { |
| 51 | 37 | return admin_url( 'admin.php?page=' . self::PAGE_ID . '&ver=' . ELEMENTOR_VERSION ); |
| 52 | 38 | } |
| 53 | 39 | |
| 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() ); | |
| 40 | + private function register_admin_menu( Admin_Menu_Manager $admin_menu ) { | |
| 41 | + $admin_menu->register( static::PAGE_ID, new Theme_Builder_Menu_Item() ); | |
| 56 | 42 | } |
| 57 | 43 | |
| 58 | 44 | public function fix_submenu( $menu ) { |
| 59 | 45 | global $submenu; |
| @@ -93,10 +79,8 @@ | ||
| 93 | 79 | ] ); |
| 94 | 80 | |
| 95 | 81 | $this->enqueue_assets(); |
| 96 | 82 | |
| 97 | - remove_action( 'wp_print_styles', 'print_emoji_styles' ); | |
| 98 | - | |
| 99 | 83 | // Setup default heartbeat options |
| 100 | 84 | // TODO: Enable heartbeat. |
| 101 | 85 | add_filter( 'heartbeat_settings', function( $settings ) { |
| 102 | 86 | $settings['interval'] = 15; |
| @@ -118,14 +102,8 @@ | ||
| 118 | 102 | 'hasPro' => Utils::has_pro(), |
| 119 | 103 | 'admin_url' => admin_url(), |
| 120 | 104 | 'login_url' => wp_login_url(), |
| 121 | 105 | '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 | 106 | ]; |
| 129 | 107 | } |
| 130 | 108 | |
| 131 | 109 | private function render() { |
| @@ -132,16 +110,16 @@ | ||
| 132 | 110 | require __DIR__ . '/view.php'; |
| 133 | 111 | } |
| 134 | 112 | |
| 135 | 113 | /** |
| 136 | - * Get Elementor editor theme color preference. | |
| 114 | + * Get Elementor UI theme preference. | |
| 137 | 115 | * |
| 138 | - * Retrieve the user theme color preference as defined by editor preferences manager. | |
| 116 | + * Retrieve the user UI theme preference as defined by editor preferences manager. | |
| 139 | 117 | * |
| 140 | 118 | * @since 3.0.0 |
| 141 | 119 | * @access private |
| 142 | 120 | * |
| 143 | - * @return string Preferred editor theme. | |
| 121 | + * @return string Preferred UI theme. | |
| 144 | 122 | */ |
| 145 | 123 | private function get_elementor_ui_theme_preference() { |
| 146 | 124 | $editor_preferences = SettingsManager::get_settings_managers( 'editorPreferences' ); |
| 147 | 125 | |
| @@ -163,38 +141,11 @@ | ||
| 163 | 141 | { document.body.classList.add( `eps-theme-dark` ); }' ); |
| 164 | 142 | } |
| 165 | 143 | } |
| 166 | 144 | |
| 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', 'site-builder' ] ) | |
| 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 | 145 | private function enqueue_assets() { |
| 193 | 146 | Plugin::$instance->init_common(); |
| 194 | 147 | |
| 195 | - $this->register_packages(); | |
| 196 | - | |
| 197 | 148 | /** @var WebCLIModule $web_cli */ |
| 198 | 149 | $web_cli = Plugin::$instance->modules_manager->get_modules( 'web-cli' ); |
| 199 | 150 | $web_cli->register_scripts(); |
| 200 | 151 | |
| @@ -254,12 +205,8 @@ | ||
| 254 | 205 | $this->get_js_assets_url( 'app' ), |
| 255 | 206 | [ |
| 256 | 207 | 'wp-url', |
| 257 | 208 | 'wp-i18n', |
| 258 | - 'elementor-v2-ui', | |
| 259 | - 'elementor-v2-icons', | |
| 260 | - 'elementor-v2-onboarding', | |
| 261 | - 'elementor-v2-site-builder', | |
| 262 | 209 | 'react', |
| 263 | 210 | 'react-dom', |
| 264 | 211 | 'select2', |
| 265 | 212 | ], |
| @@ -268,9 +215,10 @@ | ||
| 268 | 215 | ); |
| 269 | 216 | |
| 270 | 217 | $this->enqueue_dark_theme_detection_script(); |
| 271 | 218 | |
| 272 | - Assets_Translation_Loader::for_handles( [ 'elementor-app-packages', 'elementor-app' ], 'elementor' ); | |
| 219 | + wp_set_script_translations( 'elementor-app-packages', 'elementor' ); | |
| 220 | + wp_set_script_translations( 'elementor-app', 'elementor' ); | |
| 273 | 221 | |
| 274 | 222 | $this->print_config(); |
| 275 | 223 | } |
| 276 | 224 | |
| @@ -287,42 +235,23 @@ | ||
| 287 | 235 | |
| 288 | 236 | $this->print_config( 'elementor-app-loader' ); |
| 289 | 237 | } |
| 290 | 238 | |
| 291 | - private function register_import_export_customization_experiment() { | |
| 292 | - Plugin::$instance->experiments->add_feature( [ | |
| 293 | - 'name' => 'import-export-customization', | |
| 294 | - 'title' => esc_html__( 'Import/Export Customization', 'elementor' ), | |
| 295 | - 'description' => esc_html__( 'Enhanced import/export for website templates. Selectively include site content, templates, and settings with advanced granular control.', 'elementor' ), | |
| 296 | - 'release_status' => ExperimentsManager::RELEASE_STATUS_BETA, | |
| 297 | - 'default' => ExperimentsManager::STATE_ACTIVE, | |
| 298 | - 'hidden' => true, | |
| 299 | - 'mutable' => false, | |
| 300 | - ] ); | |
| 301 | - } | |
| 302 | - | |
| 303 | 239 | public function __construct() { |
| 304 | - $this->register_import_export_customization_experiment(); | |
| 240 | + $this->add_component( 'site-editor', new Modules\SiteEditor\Module() ); | |
| 305 | 241 | |
| 306 | - $this->add_component( 'site-editor', new SiteEditorModule() ); | |
| 307 | - $this->add_component( 'site-builder', new SiteBuilderModule() ); | |
| 308 | - | |
| 309 | 242 | if ( current_user_can( 'manage_options' ) || Utils::is_wp_cli() ) { |
| 310 | - $this->add_component( 'import-export', new ImportExportModule() ); | |
| 243 | + $this->add_component( 'import-export', new Modules\ImportExport\Module() ); | |
| 311 | 244 | |
| 312 | - if ( Plugin::$instance->experiments->is_feature_active( 'import-export-customization' ) ) { | |
| 313 | - $this->add_component( 'import-export-customization', new ImportExportCustomizationModule() ); | |
| 314 | - } | |
| 315 | - | |
| 316 | 245 | // Kit library is depended on import-export |
| 317 | - $this->add_component( 'kit-library', new KitLibraryModule() ); | |
| 246 | + $this->add_component( 'kit-library', new Modules\KitLibrary\Module() ); | |
| 318 | 247 | } |
| 319 | 248 | |
| 320 | - $this->add_component( 'onboarding', new OnboardingModule() ); | |
| 249 | + $this->add_component( 'onboarding', new Modules\Onboarding\Module() ); | |
| 321 | 250 | |
| 322 | - add_action( 'elementor/editor-one/menu/register', function ( Menu_Data_Provider $menu_data_provider ) { | |
| 323 | - $this->register_editor_one_menu( $menu_data_provider ); | |
| 324 | - } ); | |
| 251 | + add_action( 'elementor/admin/menu/register', function ( Admin_Menu_Manager $admin_menu ) { | |
| 252 | + $this->register_admin_menu( $admin_menu ); | |
| 253 | + }, Source_Local::ADMIN_MENU_PRIORITY + 10 ); | |
| 325 | 254 | |
| 326 | 255 | // Happens after WP plugin page validation. |
| 327 | 256 | add_filter( 'add_menu_classes', [ $this, 'fix_submenu' ] ); |
| 328 | 257 | |