PluginProbe
Elementor Website Builder – more than just a page builder / 3.6.4
Elementor Website Builder – more than just a page builder v3.6.4
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
← All changes | includes/settings/settings.php +370 -168 4.2.0-dev23.6.4 View file →
@@ -1,13 +1,9 @@
1 1 <?php
2 2 namespace Elementor;
3 3
4 -use Elementor\Core\Files\Fonts\Google_Font;
5 -use Elementor\Modules\Promotions\Module as Promotions_Module;
4 +use Elementor\Core\Editor\Editor;
6 5 use Elementor\TemplateLibrary\Source_Local;
7 -use Elementor\Modules\EditorOne\Classes\Menu_Data_Provider;
8 -use Elementor\Includes\Settings\AdminMenuItems\Editor_One_Home_Menu;
9 -use Elementor\Includes\Settings\AdminMenuItems\Editor_One_Settings_Menu;
10 6
11 7 if ( ! defined( 'ABSPATH' ) ) {
12 8 exit; // Exit if accessed directly.
13 9 }
@@ -27,9 +23,9 @@
27 23 */
28 24 const PAGE_ID = 'elementor';
29 25
30 26 /**
31 - * Upgrade menu priority.
27 + * Go Pro menu priority.
32 28 */
33 29 const MENU_PRIORITY_GO_PRO = 502;
34 30
35 31 /**
@@ -42,8 +38,13 @@
42 38 */
43 39 const TAB_GENERAL = 'general';
44 40
45 41 /**
42 + * Settings page style tab slug.
43 + */
44 + const TAB_STYLE = 'style';
45 +
46 + /**
46 47 * Settings page integrations tab slug.
47 48 */
48 49 const TAB_INTEGRATIONS = 'integrations';
49 50
@@ -52,17 +53,8 @@
52 53 */
53 54 const TAB_ADVANCED = 'advanced';
54 55
55 56 /**
56 - * Settings page performance tab slug.
57 - */
58 - const TAB_PERFORMANCE = 'performance';
59 -
60 - const ADMIN_MENU_PRIORITY = 10;
61 -
62 - const MENU_CAPABILITY_EDIT_POSTS = 'edit_posts';
63 -
64 - /**
65 57 * Register admin menu.
66 58 *
67 59 * Add new Elementor Settings admin menu.
68 60 *
@@ -71,9 +63,13 @@
71 63 * @since 1.0.0
72 64 * @access public
73 65 */
74 66 public function register_admin_menu() {
75 - if ( ! current_user_can( self::MENU_CAPABILITY_EDIT_POSTS ) ) {
67 + global $menu;
68 +
69 + $menu[] = [ '', 'read', 'separator-elementor', '', 'wp-menu-separator elementor' ]; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
70 +
71 + if ( ! current_user_can( 'manage_options' ) ) {
76 72 return;
77 73 }
78 74
79 75 add_menu_page(
@@ -78,29 +74,318 @@
78 74
79 75 add_menu_page(
80 76 esc_html__( 'Elementor', 'elementor' ),
81 77 esc_html__( 'Elementor', 'elementor' ),
82 - self::MENU_CAPABILITY_EDIT_POSTS,
78 + 'manage_options',
83 79 self::PAGE_ID,
84 - [ $this, 'display_home_screen' ],
80 + [ $this, 'display_settings_page' ],
85 81 '',
86 82 '58.5'
87 83 );
88 84 }
89 85
90 - public function display_home_screen() {
91 - echo '<div id="e-home-screen"></div>';
86 + /**
87 + * Reorder the Elementor menu items in admin.
88 + * Based on WC.
89 + *
90 + * @since 2.4.0
91 + *
92 + * @param array $menu_order Menu order.
93 + * @return array
94 + */
95 + public function menu_order( $menu_order ) {
96 + // Initialize our custom order array.
97 + $elementor_menu_order = [];
98 +
99 + // Get the index of our custom separator.
100 + $elementor_separator = array_search( 'separator-elementor', $menu_order, true );
101 +
102 + // Get index of library menu.
103 + $elementor_library = array_search( Source_Local::ADMIN_MENU_SLUG, $menu_order, true );
104 +
105 + // Loop through menu order and do some rearranging.
106 + foreach ( $menu_order as $index => $item ) {
107 + if ( 'elementor' === $item ) {
108 + $elementor_menu_order[] = 'separator-elementor';
109 + $elementor_menu_order[] = $item;
110 + $elementor_menu_order[] = Source_Local::ADMIN_MENU_SLUG;
111 +
112 + unset( $menu_order[ $elementor_separator ] );
113 + unset( $menu_order[ $elementor_library ] );
114 + } elseif ( ! in_array( $item, [ 'separator-elementor' ], true ) ) {
115 + $elementor_menu_order[] = $item;
116 + }
117 + }
118 +
119 + // Return order.
120 + return $elementor_menu_order;
92 121 }
93 122
94 - private function register_editor_one_settings_menu( Menu_Data_Provider $menu_data_provider ) {
95 - $menu_data_provider->register_menu( new Editor_One_Settings_Menu() );
123 + /**
124 + * Register Elementor Pro sub-menu.
125 + *
126 + * Add new Elementor Pro sub-menu under the main Elementor menu.
127 + *
128 + * Fired by `admin_menu` action.
129 + *
130 + * @since 1.0.0
131 + * @access public
132 + */
133 + public function register_pro_menu() {
134 + add_submenu_page(
135 + self::PAGE_ID,
136 + esc_html__( 'Submissions', 'elementor' ),
137 + esc_html__( 'Submissions', 'elementor' ),
138 + 'manage_options',
139 + 'e-form-submissions',
140 + function() {
141 + $this->elementor_form_submissions();
142 + }
143 + );
144 +
145 + add_submenu_page(
146 + self::PAGE_ID,
147 + esc_html__( 'Custom Fonts', 'elementor' ),
148 + esc_html__( 'Custom Fonts', 'elementor' ),
149 + 'manage_options',
150 + 'elementor_custom_fonts',
151 + [ $this, 'elementor_custom_fonts' ]
152 + );
153 +
154 + add_submenu_page(
155 + self::PAGE_ID,
156 + esc_html__( 'Custom Icons', 'elementor' ),
157 + esc_html__( 'Custom Icons', 'elementor' ),
158 + 'manage_options',
159 + 'elementor_custom_icons',
160 + [ $this, 'elementor_custom_icons' ]
161 + );
162 +
163 + add_submenu_page(
164 + self::PAGE_ID,
165 + __( 'Custom Code', 'elementor' ),
166 + __( 'Custom Code', 'elementor' ),
167 + 'manage_options',
168 + 'elementor_custom_custom_code',
169 + function() {
170 + $this->elementor_custom_code();
171 + }
172 + );
173 +
174 + add_submenu_page(
175 + self::PAGE_ID,
176 + '',
177 + '<span class="dashicons dashicons-star-filled" style="font-size: 17px"></span> ' . esc_html__( 'Go Pro', 'elementor' ),
178 + 'manage_options',
179 + 'go_elementor_pro',
180 + [ $this, 'handle_external_redirects' ]
181 + );
182 +
183 + add_submenu_page( Source_Local::ADMIN_MENU_SLUG, esc_html__( 'Popups', 'elementor' ), esc_html__( 'Popups', 'elementor' ), 'manage_options', 'popup_templates', [ $this, 'elementor_popups' ] );
96 184 }
97 185
98 - private function register_editor_one_home_menu( Menu_Data_Provider $menu_data_provider ) {
99 - $menu_data_provider->register_menu( new Editor_One_Home_Menu() );
186 + /**
187 + * Register Elementor knowledge base sub-menu.
188 + *
189 + * Add new Elementor knowledge base sub-menu under the main Elementor menu.
190 + *
191 + * Fired by `admin_menu` action.
192 + *
193 + * @since 2.0.3
194 + * @access public
195 + */
196 + public function register_knowledge_base_menu() {
197 + add_submenu_page(
198 + self::PAGE_ID,
199 + '',
200 + __( 'Getting Started', 'elementor' ),
201 + 'manage_options',
202 + 'elementor-getting-started',
203 + [ $this, 'elementor_getting_started' ]
204 + );
205 +
206 + add_submenu_page(
207 + self::PAGE_ID,
208 + '',
209 + esc_html__( 'Get Help', 'elementor' ),
210 + 'manage_options',
211 + 'go_knowledge_base_site',
212 + [ $this, 'handle_external_redirects' ]
213 + );
100 214 }
101 215
102 216 /**
217 + * Go Elementor Pro.
218 + *
219 + * Redirect the Elementor Pro page the clicking the Elementor Pro menu link.
220 + *
221 + * Fired by `admin_init` action.
222 + *
223 + * @since 2.0.3
224 + * @access public
225 + */
226 + public function handle_external_redirects() {
227 + if ( empty( $_GET['page'] ) ) {
228 + return;
229 + }
230 +
231 + if ( 'go_elementor_pro' === $_GET['page'] ) {
232 + wp_redirect( Utils::get_pro_link( 'https://elementor.com/pro/?utm_source=wp-menu&utm_campaign=gopro&utm_medium=wp-dash' ) );
233 + die;
234 + }
235 +
236 + if ( 'go_knowledge_base_site' === $_GET['page'] ) {
237 + wp_redirect( 'https://go.elementor.com/docs-admin-menu/' );
238 + die;
239 + }
240 + }
241 +
242 + /**
243 + * Display settings page.
244 + *
245 + * Output the content for the getting started page.
246 + *
247 + * @since 2.2.0
248 + * @access public
249 + */
250 + public function elementor_getting_started() {
251 + if ( User::is_current_user_can_edit_post_type( 'page' ) ) {
252 + $create_new_label = esc_html__( 'Create Your First Page', 'elementor' );
253 + $create_new_cpt = 'page';
254 + } elseif ( User::is_current_user_can_edit_post_type( 'post' ) ) {
255 + $create_new_label = esc_html__( 'Create Your First Post', 'elementor' );
256 + $create_new_cpt = 'post';
257 + }
258 +
259 + ?>
260 + <div class="wrap">
261 + <div class="e-getting-started">
262 + <div class="e-getting-started__box postbox">
263 + <div class="e-getting-started__header">
264 + <div class="e-getting-started__title">
265 + <div class="e-logo-wrapper">
266 + <i class="eicon-elementor"></i>
267 + </div>
268 + <?php echo esc_html__( 'Getting Started', 'elementor' ); ?>
269 + </div>
270 + <a class="e-getting-started__skip" href="<?php echo esc_url( admin_url() ); ?>">
271 + <i class="eicon-close" aria-hidden="true" title="<?php esc_attr_e( 'Skip', 'elementor' ); ?>"></i>
272 + <span class="elementor-screen-only"><?php echo esc_html__( 'Skip', 'elementor' ); ?></span>
273 + </a>
274 + </div>
275 + <div class="e-getting-started__content">
276 + <div class="e-getting-started__content--narrow">
277 + <h2><?php echo esc_html__( 'Welcome to Elementor', 'elementor' ); ?></h2>
278 + <p><?php echo esc_html__( 'Get introduced to Elementor by watching our "Getting Started" video series. It will guide you through the steps needed to create your website. Then click to create your first page.', 'elementor' ); ?></p>
279 + </div>
280 +
281 + <div class="e-getting-started__video">
282 + <iframe width="620" height="350" src="https://www.youtube-nocookie.com/embed/videoseries?v=icTcREd1tAg&amp;list=PLZyp9H25CboE6dhe7MnUxUdp4zU7OsNSe&amp;index=1" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
283 + </div>
284 +
285 + <div class="e-getting-started__actions e-getting-started__content--narrow">
286 + <?php if ( ! empty( $create_new_cpt ) ) : ?>
287 + <a href="<?php echo esc_url( Plugin::$instance->documents->get_create_new_post_url( $create_new_cpt ) ); ?>" class="button button-primary button-hero"><?php echo esc_html( $create_new_label ); ?></a>
288 + <?php endif; ?>
289 +
290 + <a href="https://go.elementor.com/getting-started/" target="_blank" class="button button-secondary button-hero"><?php echo esc_html__( 'Watch the Full Guide', 'elementor' ); ?></a>
291 + </div>
292 + </div>
293 + </div>
294 + </div>
295 + </div><!-- /.wrap -->
296 + <?php
297 + }
298 +
299 + /**
300 + * Display settings page.
301 + *
302 + * Output the content for the custom fonts page.
303 + *
304 + * @since 2.0.0
305 + * @access public
306 + */
307 + public function elementor_custom_fonts() {
308 + ?>
309 + <div class="wrap">
310 + <div class="elementor-blank_state">
311 + <?php // PHPCS - No need to escape an SVG image from the Elementor assets/images folder. ?>
312 + <img src="<?php echo ELEMENTOR_ASSETS_URL . 'images/go-pro-wp-dashboard.svg'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>" />
313 + <h2><?php echo esc_html__( 'Add Your Custom Fonts', 'elementor' ); ?></h2>
314 + <p><?php echo esc_html__( 'Custom Fonts allows you to add your self-hosted fonts and use them on your Elementor projects to create a unique brand language.', 'elementor' ); ?></p>
315 + <?php // PHPCS - No need to escape a URL. The query arg is sanitized. ?>
316 + <a class="elementor-button elementor-button-default elementor-button-go-pro" target="_blank" href="<?php echo Utils::get_pro_link( 'https://elementor.com/pro/?utm_source=wp-custom-fonts&utm_campaign=gopro&utm_medium=wp-dash' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>"><?php echo esc_html__( 'Go Pro', 'elementor' ); ?></a>
317 + </div>
318 + </div><!-- /.wrap -->
319 + <?php
320 + }
321 +
322 + /**
323 + * Display settings page.
324 + *
325 + * Output the content for the custom icons page.
326 + *
327 + * @since 2.8.0
328 + * @access public
329 + */
330 + public function elementor_custom_icons() {
331 + ?>
332 + <div class="wrap">
333 + <div class="elementor-blank_state">
334 + <img src="<?php Utils::print_unescaped_internal_string( ELEMENTOR_ASSETS_URL . 'images/go-pro-wp-dashboard.svg' ); ?>" />
335 + <h2><?php echo esc_html__( 'Add Your Custom Icons', 'elementor' ); ?></h2>
336 + <p><?php echo esc_html__( 'Don\'t rely solely on the FontAwesome icons everyone else is using! Differentiate your website and your style with custom icons you can upload from your favorite icons source.', 'elementor' ); ?></p>
337 + <?php // PHPCS - No need to escape a URL. The query arg is sanitized. ?>
338 + <a class="elementor-button elementor-button-default elementor-button-go-pro" target="_blank" href="<?php echo Utils::get_pro_link( 'https://elementor.com/pro/?utm_source=wp-custom-icons&utm_campaign=gopro&utm_medium=wp-dash' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>"><?php echo esc_html__( 'Go Pro', 'elementor' ); ?></a>
339 + </div>
340 + </div><!-- /.wrap -->
341 + <?php
342 + }
343 +
344 + /**
345 + * Display settings page.
346 + *
347 + * Output the content for the Popups page.
348 + *
349 + * @since 2.4.0
350 + * @access public
351 + */
352 + public function elementor_popups() {
353 + ?>
354 + <div class="wrap">
355 + <div class="elementor-blank_state">
356 + <img src="<?php Utils::print_unescaped_internal_string( ELEMENTOR_ASSETS_URL . 'images/go-pro-wp-dashboard.svg' ); ?>" />
357 + <h2><?php echo esc_html__( 'Get Popup Builder', 'elementor' ); ?></h2>
358 + <p><?php echo esc_html__( 'Popup Builder lets you take advantage of all the amazing features in Elementor, so you can build beautiful & highly converting popups. Go pro and start designing your popups today.', 'elementor' ); ?></p>
359 + <?php // PHPCS - No need to escape a URL. The query arg is sanitized. ?>
360 + <a class="elementor-button elementor-button-default elementor-button-go-pro" target="_blank" href="<?php echo Utils::get_pro_link( 'https://elementor.com/popup-builder/?utm_source=popup-templates&utm_campaign=gopro&utm_medium=wp-dash' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>"><?php echo esc_html__( 'Go Pro', 'elementor' ); ?></a>
361 + </div>
362 + </div><!-- /.wrap -->
363 + <?php
364 + }
365 +
366 + public function elementor_form_submissions() {
367 + ?>
368 + <div class="wrap">
369 + <div class="elementor-blank_state">
370 + <img src="<?php Utils::print_unescaped_internal_string( ELEMENTOR_ASSETS_URL ); ?>images/go-pro-wp-dashboard.svg" />
371 + <h2><?php echo esc_html__( 'Collect Your Form Submissions', 'elementor' ); ?></h2>
372 + <p>
373 + <?php echo esc_html__( 'Save and manage all of your form submissions in one single place.
374 +All within a simple, intuitive place.', 'elementor' ); ?>
375 + <a href="http://go.elementor.com/wp-dash-submissions" target="_blank" rel="nofollow">
376 + <?php echo esc_html__( 'Learn More', 'elementor' ); ?>
377 + </a>
378 + </p>
379 + <a class="elementor-button elementor-button-default elementor-button-go-pro" target="_blank" href="<?php
380 + Utils::print_unescaped_internal_string( Utils::get_pro_link( 'https://go.elementor.com/go-pro-submissions' ) );
381 + ?>"><?php echo esc_html__( 'Go Pro', 'elementor' ); ?></a>
382 + </div>
383 + </div><!-- /.wrap -->
384 + <?php
385 + }
386 +
387 + /**
103 388 * On admin init.
104 389 *
105 390 * Preform actions on WordPress admin initialization.
106 391 *
@@ -109,12 +394,28 @@
109 394 * @since 2.0.0
110 395 * @access public
111 396 */
112 397 public function on_admin_init() {
398 + $this->handle_external_redirects();
399 +
113 400 $this->maybe_remove_all_admin_notices();
114 401 }
115 402
116 403 /**
404 + * Change "Settings" menu name.
405 + *
406 + * Update the name of the Settings admin menu from "Elementor" to "Settings".
407 + *
408 + * Fired by `admin_menu` action.
409 + *
410 + * @since 1.0.0
411 + * @access public
412 + */
413 + public function admin_menu_change_name() {
414 + Utils::change_submenu_first_item_label( 'elementor', esc_html__( 'Settings', 'elementor' ) );
415 + }
416 +
417 + /**
117 418 * Update CSS print method.
118 419 *
119 420 * Clear post CSS cache.
120 421 *
@@ -122,9 +423,9 @@
122 423 * `update_option_elementor_css_print_method` actions.
123 424 *
124 425 * @since 1.7.5
125 426 * @access public
126 - * @deprecated 3.0.0 Use `Plugin::$instance->files_manager->clear_cache()` method instead.
427 + * @deprecated 3.0.0
127 428 */
128 429 public function update_css_print_method() {
129 430 Plugin::$instance->files_manager->clear_cache();
130 431 }
@@ -146,15 +447,8 @@
146 447 self::TAB_GENERAL => [
147 448 'label' => esc_html__( 'General', 'elementor' ),
148 449 'sections' => [
149 450 'general' => [
150 - 'label' => esc_html__( 'General', 'elementor' ),
151 - 'callback' => function() {
152 - printf(
153 - '<p>%s</p><br><hr><br>',
154 - esc_html__( 'Tailor how Elementor enhances your site, from post types to other functions.', 'elementor' )
155 - );
156 - },
157 451 'fields' => [
158 452 self::UPDATE_TIME_FIELD => [
159 453 'full_field_id' => self::UPDATE_TIME_FIELD,
160 454 'field_args' => [
@@ -223,16 +517,22 @@
223 517 self::TAB_ADVANCED => [
224 518 'label' => esc_html__( 'Advanced', 'elementor' ),
225 519 'sections' => [
226 520 'advanced' => [
227 - 'label' => esc_html__( 'Advanced', 'elementor' ),
228 - 'callback' => function() {
229 - printf(
230 - '<p>%s</p><br><hr><br>',
231 - esc_html__( 'Personalize the way Elementor works on your website by choosing the advanced features and how they operate.', 'elementor' )
232 - );
233 - },
234 521 'fields' => [
522 + 'css_print_method' => [
523 + 'label' => esc_html__( 'CSS Print Method', 'elementor' ),
524 + 'field_args' => [
525 + 'class' => 'elementor_css_print_method',
526 + 'type' => 'select',
527 + 'std' => 'external',
528 + 'options' => [
529 + 'external' => esc_html__( 'External File', 'elementor' ),
530 + 'internal' => esc_html__( 'Internal Embedding', 'elementor' ),
531 + ],
532 + 'desc' => '<div class="elementor-css-print-method-description" data-value="external" style="display: none">' . esc_html__( 'Use external CSS files for all generated stylesheets. Choose this setting for better performance (recommended).', 'elementor' ) . '</div><div class="elementor-css-print-method-description" data-value="internal" style="display: none">' . esc_html__( 'Use internal CSS that is embedded in the head of the page. For troubleshooting server configuration conflicts and managing development environments.', 'elementor' ) . '</div>',
533 + ],
534 + ],
235 535 'editor_break_lines' => [
236 536 'label' => esc_html__( 'Switch Editor Loader Method', 'elementor' ),
237 537 'field_args' => [
238 538 'type' => 'select',
@@ -255,25 +555,8 @@
255 555 ],
256 556 'desc' => esc_html__( 'Please note! Allowing uploads of any files (SVG & JSON included) is a potential security risk.', 'elementor' ) . '<br>' . esc_html__( 'Elementor will try to sanitize the unfiltered files, removing potential malicious code and scripts.', 'elementor' ) . '<br>' . esc_html__( 'We recommend you only enable this feature if you understand the security risks involved.', 'elementor' ),
257 557 ],
258 558 ],
259 - 'google_font' => [
260 - 'label' => esc_html__( 'Google Fonts', 'elementor' ),
261 - 'field_args' => [
262 - 'type' => 'select',
263 - 'std' => '1',
264 - 'options' => [
265 - '1' => esc_html__( 'Enable', 'elementor' ),
266 - '0' => esc_html__( 'Disable', 'elementor' ),
267 - ],
268 - 'desc' => sprintf(
269 - /* translators: 1: Link opening tag, 2: Link closing tag */
270 - esc_html__( 'Disable this option if you want to prevent Google Fonts from being loaded. This setting is recommended when loading fonts from a different source (plugin, theme or %1$scustom fonts%2$s).', 'elementor' ),
271 - '<a href="' . admin_url( 'admin.php?page=elementor_custom_fonts' ) . '">',
272 - '</a>'
273 - ),
274 - ],
275 - ],
276 559 'font_display' => [
277 560 'label' => esc_html__( 'Google Fonts Load', 'elementor' ),
278 561 'field_args' => [
279 562 'type' => 'select',
@@ -284,9 +567,9 @@
284 567 'swap' => esc_html__( 'Swap', 'elementor' ),
285 568 'fallback' => esc_html__( 'Fallback', 'elementor' ),
286 569 'optional' => esc_html__( 'Optional', 'elementor' ),
287 570 ],
288 - 'desc' => esc_html__( 'Font-display property defines how font files are loaded and displayed by the browser.', 'elementor' ) . '<br>' . esc_html__( 'Set the way Google Fonts are being loaded by selecting the font-display property (Recommended: Swap).', 'elementor' ),
571 + 'desc' => esc_html__( 'Font-display property defines how font files are loaded and displayed by the browser.', 'elementor' ) . '<br>' . esc_html__( 'Set the way Google Fonts are being loaded by selecting the font-display property (Default: Auto).', 'elementor' ),
289 572 ],
290 573 ],
291 574 ],
292 575 ],
@@ -291,94 +574,8 @@
291 574 ],
292 575 ],
293 576 ],
294 577 ],
295 - self::TAB_PERFORMANCE => [
296 - 'label' => esc_html__( 'Performance', 'elementor' ),
297 - 'sections' => [
298 - 'performance' => [
299 - 'label' => esc_html__( 'Performance', 'elementor' ),
300 - 'callback' => function() {
301 - printf(
302 - '<p>%s</p><br><hr><br>',
303 - esc_html__( 'Improve loading times on your site by selecting the optimization tools that best fit your requirements.', 'elementor' )
304 - );
305 - },
306 - 'fields' => [
307 - 'css_print_method' => [
308 - 'label' => esc_html__( 'CSS Print Method', 'elementor' ),
309 - 'field_args' => [
310 - 'class' => 'elementor_css_print_method',
311 - 'type' => 'select',
312 - 'std' => 'external',
313 - 'options' => [
314 - 'external' => esc_html__( 'External File', 'elementor' ),
315 - 'internal' => esc_html__( 'Internal Embedding', 'elementor' ),
316 - ],
317 - 'desc' => sprintf(
318 - /* translators: %s: <head> tag. */
319 - esc_html__( 'Internal Embedding places all CSS in the %s which works great for troubleshooting, while External File uses external CSS file for better performance (recommended).', 'elementor' ),
320 - '<code>&lt;head&gt;</code>',
321 - ),
322 - ],
323 - ],
324 - 'optimized_image_loading' => [
325 - 'label' => esc_html__( 'Optimized Image Loading', 'elementor' ),
326 - 'field_args' => [
327 - 'type' => 'select',
328 - 'std' => '1',
329 - 'options' => [
330 - '1' => esc_html__( 'Enable', 'elementor' ),
331 - '0' => esc_html__( 'Disable', 'elementor' ),
332 - ],
333 - 'desc' => sprintf(
334 - /* translators: 1: fetchpriority attribute, 2: lazy loading attribute. */
335 - esc_html__( 'Improve performance by applying %1$s on LCP image and %2$s on images below the fold.', 'elementor' ),
336 - '<code>fetchpriority="high"</code>',
337 - '<code>loading="lazy"</code>'
338 - ),
339 - ],
340 - ],
341 - 'optimized_gutenberg_loading' => [
342 - 'label' => esc_html__( 'Optimized Gutenberg Loading', 'elementor' ),
343 - 'field_args' => [
344 - 'type' => 'select',
345 - 'std' => '1',
346 - 'options' => [
347 - '1' => esc_html__( 'Enable', 'elementor' ),
348 - '0' => esc_html__( 'Disable', 'elementor' ),
349 - ],
350 - 'desc' => esc_html__( 'Reduce unnecessary render-blocking loads by dequeuing unused Gutenberg block editor scripts and styles.', 'elementor' ),
351 - ],
352 - ],
353 - 'lazy_load_background_images' => [
354 - 'label' => esc_html__( 'Lazy Load Background Images', 'elementor' ),
355 - 'field_args' => [
356 - 'type' => 'select',
357 - 'std' => '1',
358 - 'options' => [
359 - '1' => esc_html__( 'Enable', 'elementor' ),
360 - '0' => esc_html__( 'Disable', 'elementor' ),
361 - ],
362 - 'desc' => esc_html__( 'Improve initial page load performance by lazy loading all background images except the first one.', 'elementor' ),
363 - ],
364 - ],
365 - 'local_google_fonts' => [
366 - 'label' => esc_html__( 'Load Google Fonts Locally', 'elementor' ),
367 - 'field_args' => [
368 - 'type' => 'select',
369 - 'std' => '0',
370 - 'options' => [
371 - '1' => esc_html__( 'Enable', 'elementor' ),
372 - '0' => esc_html__( 'Disable', 'elementor' ),
373 - ],
374 - 'desc' => esc_html__( 'Load Google fonts locally to benefit from faster performance and ensure GDPR compliance. Fonts will be served from your own server instead of Google’s. Only the very first load (in the editor and on the front end) may take slightly longer.', 'elementor' ),
375 - ],
376 - ],
377 - ],
378 - ],
379 - ],
380 - ],
381 578 ];
382 579 }
383 580
384 581 /**
@@ -391,9 +588,13 @@
391 588 *
392 589 * @return string Settings page title.
393 590 */
394 591 protected function get_page_title() {
395 - return esc_html__( 'Elementor', 'elementor' );
592 + if ( Plugin::$instance->experiments->is_feature_active( 'admin_menu_rearrangement' ) ) {
593 + return __( 'Settings', 'elementor' );
594 + }
595 +
596 + return __( 'Elementor', 'elementor' );
396 597 }
397 598
398 599 /**
399 600 * @since 2.2.0
@@ -400,16 +601,15 @@
400 601 * @access private
401 602 */
402 603 private function maybe_remove_all_admin_notices() {
403 604 $elementor_pages = [
404 - 'elementor-system-info',
405 - 'e-form-submissions',
605 + 'elementor-getting-started',
406 606 'elementor_custom_fonts',
407 607 'elementor_custom_icons',
408 608 'elementor-license',
409 - 'elementor_custom_code',
609 + 'e-form-submissions',
610 + 'elementor_custom_custom_code',
410 611 'popup_templates',
411 - 'elementor-apps',
412 612 ];
413 613
414 614 if ( empty( $_GET['page'] ) || ! in_array( $_GET['page'], $elementor_pages, true ) ) {
415 615 return;
@@ -417,19 +617,22 @@
417 617
418 618 remove_all_actions( 'admin_notices' );
419 619 }
420 620
421 - public function add_generator_tag_settings( $settings ) {
422 - $css_print_method = get_option( 'elementor_css_print_method', 'external' );
423 - $settings[] = 'css_print_method-' . $css_print_method;
424 -
425 - $google_font = Fonts::is_google_fonts_enabled() ? 'enabled' : 'disabled';
426 - $settings[] = 'google_font-' . $google_font;
427 -
428 - $font_display = Fonts::get_font_display_setting();
429 - $settings[] = 'font_display-' . $font_display;
430 -
431 - return $settings;
621 + /**
622 + * Output the content for custom_code page.
623 + */
624 + private function elementor_custom_code() {
625 + ?>
626 + <div class="wrap">
627 + <div class="elementor-blank_state">
628 + <img src="<?php Utils::print_unescaped_internal_string( ELEMENTOR_ASSETS_URL ); ?>images/go-pro-wp-dashboard.svg" />
629 + <h2><?php echo esc_html__( 'Add Your Custom Code', 'elementor' ); ?></h2>
630 + <p><?php echo esc_html__( 'Custom Code is a tool gives you one place where you can insert scripts, rather than dealing with dozens of different plugins and deal with code.', 'elementor' ); ?></p>
631 + <a class="elementor-button elementor-button-default elementor-button-go-pro" target="_blank" href="<?php echo esc_url( Utils::get_pro_link( 'http://go.elementor.com/go-pro-custom-code' ) ); ?>"><?php echo esc_html__( 'Go Pro', 'elementor' ); ?></a>
632 + </div>
633 + </div><!-- /.wrap -->
634 + <?php
432 635 }
433 636
434 637 /**
435 638 * Settings page constructor.
@@ -442,16 +645,18 @@
442 645 public function __construct() {
443 646 parent::__construct();
444 647
445 648 add_action( 'admin_init', [ $this, 'on_admin_init' ] );
446 - add_filter( 'elementor/generator_tag/settings', [ $this, 'add_generator_tag_settings' ] );
447 649
448 - add_action( 'admin_menu', [ $this, 'register_admin_menu' ], 20 );
650 + if ( ! Plugin::$instance->experiments->is_feature_active( 'admin_menu_rearrangement' ) ) {
651 + add_action( 'admin_menu', [ $this, 'register_admin_menu' ], 20 );
652 + add_action( 'admin_menu', [ $this, 'admin_menu_change_name' ], 200 );
653 + add_action( 'admin_menu', [ $this, 'register_pro_menu' ], self::MENU_PRIORITY_GO_PRO );
654 + add_action( 'admin_menu', [ $this, 'register_knowledge_base_menu' ], 501 );
449 655
450 - add_action( 'elementor/editor-one/menu/register', function ( Menu_Data_Provider $menu_data_provider ) {
451 - $this->register_editor_one_settings_menu( $menu_data_provider );
452 - $this->register_editor_one_home_menu( $menu_data_provider );
453 - } );
656 + add_filter( 'custom_menu_order', '__return_true' );
657 + add_filter( 'menu_order', [ $this, 'menu_order' ] );
658 + }
454 659
455 660 $clear_cache_callback = [ Plugin::$instance->files_manager, 'clear_cache' ];
456 661
457 662 // Clear CSS Meta after change css related methods.
@@ -458,9 +663,8 @@
458 663 $css_settings = [
459 664 'elementor_disable_color_schemes',
460 665 'elementor_disable_typography_schemes',
461 666 'elementor_css_print_method',
462 - 'elementor_local_google_fonts',
463 667 ];
464 668
465 669 foreach ( $css_settings as $option_name ) {
466 670 add_action( "add_option_{$option_name}", $clear_cache_callback );
@@ -465,8 +669,6 @@
465 669 foreach ( $css_settings as $option_name ) {
466 670 add_action( "add_option_{$option_name}", $clear_cache_callback );
467 671 add_action( "update_option_{$option_name}", $clear_cache_callback );
468 672 }
469 -
470 - add_action( 'update_option_elementor_font_display', [ Google_Font::class, 'clear_cache' ] );
471 673 }
472 674 }