PluginProbe
Elementor Website Builder – more than just a page builder / 3.7.0
Elementor Website Builder – more than just a page builder v3.7.0
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 / includes / settings / settings.php

settings.php in Elementor Website Builder – more than just a page builder 3.7.0, at includes/settings/settings.php

670 lines 21.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor;
3
4 use Elementor\Core\Editor\Editor;
5 use Elementor\TemplateLibrary\Source_Local;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit; // Exit if accessed directly.
9 }
10
11 /**
12 * Elementor "Settings" page in WordPress Dashboard.
13 *
14 * Elementor settings page handler class responsible for creating and displaying
15 * Elementor "Settings" page in WordPress dashboard.
16 *
17 * @since 1.0.0
18 */
19 class Settings extends Settings_Page {
20
21 /**
22 * Settings page ID for Elementor settings.
23 */
24 const PAGE_ID = 'elementor';
25
26 /**
27 * Go Pro menu priority.
28 */
29 const MENU_PRIORITY_GO_PRO = 502;
30
31 /**
32 * Settings page field for update time.
33 */
34 const UPDATE_TIME_FIELD = '_elementor_settings_update_time';
35
36 /**
37 * Settings page general tab slug.
38 */
39 const TAB_GENERAL = 'general';
40
41 /**
42 * Settings page style tab slug.
43 */
44 const TAB_STYLE = 'style';
45
46 /**
47 * Settings page integrations tab slug.
48 */
49 const TAB_INTEGRATIONS = 'integrations';
50
51 /**
52 * Settings page advanced tab slug.
53 */
54 const TAB_ADVANCED = 'advanced';
55
56 /**
57 * Register admin menu.
58 *
59 * Add new Elementor Settings admin menu.
60 *
61 * Fired by `admin_menu` action.
62 *
63 * @since 1.0.0
64 * @access public
65 */
66 public function register_admin_menu() {
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' ) ) {
72 return;
73 }
74
75 add_menu_page(
76 esc_html__( 'Elementor', 'elementor' ),
77 esc_html__( 'Elementor', 'elementor' ),
78 'manage_options',
79 self::PAGE_ID,
80 [ $this, 'display_settings_page' ],
81 '',
82 '58.5'
83 );
84 }
85
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;
121 }
122
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__( 'Upgrade', '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' ] );
184 }
185
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 );
214 }
215
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( 'https://go.elementor.com/pro-admin-menu/' );
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 <a class="elementor-button elementor-button-default elementor-button-go-pro" target="_blank" href="https://go.elementor.com/go-pro-custom-fonts/"><?php echo esc_html__( 'Upgrade Now', 'elementor' ); ?></a>
316 </div>
317 </div><!-- /.wrap -->
318 <?php
319 }
320
321 /**
322 * Display settings page.
323 *
324 * Output the content for the custom icons page.
325 *
326 * @since 2.8.0
327 * @access public
328 */
329 public function elementor_custom_icons() {
330 ?>
331 <div class="wrap">
332 <div class="elementor-blank_state">
333 <img src="<?php Utils::print_unescaped_internal_string( ELEMENTOR_ASSETS_URL . 'images/go-pro-wp-dashboard.svg' ); ?>" />
334 <h2><?php echo esc_html__( 'Add Your Custom Icons', 'elementor' ); ?></h2>
335 <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>
336 <a class="elementor-button elementor-button-default elementor-button-go-pro" target="_blank" href="https://go.elementor.com/go-pro-custom-icons/"><?php echo esc_html__( 'Upgrade Now', 'elementor' ); ?></a>
337 </div>
338 </div><!-- /.wrap -->
339 <?php
340 }
341
342 /**
343 * Display settings page.
344 *
345 * Output the content for the Popups page.
346 *
347 * @since 2.4.0
348 * @access public
349 */
350 public function elementor_popups() {
351 ?>
352 <div class="wrap">
353 <div class="elementor-blank_state">
354 <img src="<?php Utils::print_unescaped_internal_string( ELEMENTOR_ASSETS_URL . 'images/go-pro-wp-dashboard.svg' ); ?>" />
355 <h2><?php echo esc_html__( 'Get Popup Builder', 'elementor' ); ?></h2>
356 <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>
357 <a class="elementor-button elementor-button-default elementor-button-go-pro" target="_blank" href="https://go.elementor.com/go-pro-popup-builder/"><?php echo esc_html__( 'Upgrade Now', 'elementor' ); ?></a>
358 </div>
359 </div><!-- /.wrap -->
360 <?php
361 }
362
363 public function elementor_form_submissions() {
364 ?>
365 <div class="wrap">
366 <div class="elementor-blank_state">
367 <img src="<?php Utils::print_unescaped_internal_string( ELEMENTOR_ASSETS_URL ); ?>images/go-pro-wp-dashboard.svg" />
368 <h2><?php echo esc_html__( 'Collect Your Form Submissions', 'elementor' ); ?></h2>
369 <p>
370 <?php echo esc_html__( 'Save and manage all of your form submissions in one single place.
371 All within a simple, intuitive place.', 'elementor' ); ?>
372 <a href="http://go.elementor.com/wp-dash-submissions" target="_blank" rel="nofollow">
373 <?php echo esc_html__( 'Learn More', 'elementor' ); ?>
374 </a>
375 </p>
376 <a class="elementor-button elementor-button-default elementor-button-go-pro" target="_blank" href="https://go.elementor.com/go-pro-submissions/"><?php echo esc_html__( 'Upgrade Now', 'elementor' ); ?></a>
377 </div>
378 </div><!-- /.wrap -->
379 <?php
380 }
381
382 /**
383 * On admin init.
384 *
385 * Preform actions on WordPress admin initialization.
386 *
387 * Fired by `admin_init` action.
388 *
389 * @since 2.0.0
390 * @access public
391 */
392 public function on_admin_init() {
393 $this->handle_external_redirects();
394
395 $this->maybe_remove_all_admin_notices();
396 }
397
398 /**
399 * Change "Settings" menu name.
400 *
401 * Update the name of the Settings admin menu from "Elementor" to "Settings".
402 *
403 * Fired by `admin_menu` action.
404 *
405 * @since 1.0.0
406 * @access public
407 */
408 public function admin_menu_change_name() {
409 Utils::change_submenu_first_item_label( 'elementor', esc_html__( 'Settings', 'elementor' ) );
410 }
411
412 /**
413 * Update CSS print method.
414 *
415 * Clear post CSS cache.
416 *
417 * Fired by `add_option_elementor_css_print_method` and
418 * `update_option_elementor_css_print_method` actions.
419 *
420 * @since 1.7.5
421 * @access public
422 * @deprecated 3.0.0
423 */
424 public function update_css_print_method() {
425 Plugin::$instance->files_manager->clear_cache();
426 }
427
428 /**
429 * Create tabs.
430 *
431 * Return the settings page tabs, sections and fields.
432 *
433 * @since 1.5.0
434 * @access protected
435 *
436 * @return array An array with the settings page tabs, sections and fields.
437 */
438 protected function create_tabs() {
439 $validations_class_name = __NAMESPACE__ . '\Settings_Validations';
440
441 return [
442 self::TAB_GENERAL => [
443 'label' => esc_html__( 'General', 'elementor' ),
444 'sections' => [
445 'general' => [
446 'fields' => [
447 self::UPDATE_TIME_FIELD => [
448 'full_field_id' => self::UPDATE_TIME_FIELD,
449 'field_args' => [
450 'type' => 'hidden',
451 ],
452 'setting_args' => [ $validations_class_name, 'current_time' ],
453 ],
454 'cpt_support' => [
455 'label' => esc_html__( 'Post Types', 'elementor' ),
456 'field_args' => [
457 'type' => 'checkbox_list_cpt',
458 'std' => [ 'page', 'post' ],
459 'exclude' => [ 'attachment', 'elementor_library' ],
460 ],
461 'setting_args' => [ $validations_class_name, 'checkbox_list' ],
462 ],
463 'disable_color_schemes' => [
464 'label' => esc_html__( 'Disable Default Colors', 'elementor' ),
465 'field_args' => [
466 'type' => 'checkbox',
467 'value' => 'yes',
468 'sub_desc' => esc_html__( 'Checking this box will disable Elementor\'s Default Colors, and make Elementor inherit the colors from your theme.', 'elementor' ),
469 ],
470 ],
471 'disable_typography_schemes' => [
472 'label' => esc_html__( 'Disable Default Fonts', 'elementor' ),
473 'field_args' => [
474 'type' => 'checkbox',
475 'value' => 'yes',
476 'sub_desc' => esc_html__( 'Checking this box will disable Elementor\'s Default Fonts, and make Elementor inherit the fonts from your theme.', 'elementor' ),
477 ],
478 ],
479 ],
480 ],
481 'usage' => [
482 'label' => esc_html__( 'Improve Elementor', 'elementor' ),
483 'fields' => $this->get_usage_fields(),
484 ],
485 ],
486 ],
487 self::TAB_INTEGRATIONS => [
488 'label' => esc_html__( 'Integrations', 'elementor' ),
489 'sections' => [
490 'google_maps' => [
491 'label' => esc_html__( 'Google Maps Embed API', 'elementor' ),
492 'callback' => function() {
493 printf(
494 /* translators: 1: Link open tag, 2: Link close tag */
495 esc_html__( 'Google Maps Embed API is a free service by Google that allows embedding Google Maps in your site. For more details, visit Google Maps\' %1$sUsing API Keys%2$s page.', 'elementor' ),
496 '<a target="_blank" href="https://developers.google.com/maps/documentation/embed/get-api-key">',
497 '</a>'
498 );
499 },
500 'fields' => [
501 'google_maps_api_key' => [
502 'label' => esc_html__( 'API Key', 'elementor' ),
503 'field_args' => [
504 'class' => 'elementor_google_maps_api_key',
505 'type' => 'text',
506 ],
507 ],
508 ],
509 ],
510 ],
511 ],
512 self::TAB_ADVANCED => [
513 'label' => esc_html__( 'Advanced', 'elementor' ),
514 'sections' => [
515 'advanced' => [
516 'fields' => [
517 'css_print_method' => [
518 'label' => esc_html__( 'CSS Print Method', 'elementor' ),
519 'field_args' => [
520 'class' => 'elementor_css_print_method',
521 'type' => 'select',
522 'std' => 'external',
523 'options' => [
524 'external' => esc_html__( 'External File', 'elementor' ),
525 'internal' => esc_html__( 'Internal Embedding', 'elementor' ),
526 ],
527 '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>',
528 ],
529 ],
530 'editor_break_lines' => [
531 'label' => esc_html__( 'Switch Editor Loader Method', 'elementor' ),
532 'field_args' => [
533 'type' => 'select',
534 'std' => '',
535 'options' => [
536 '' => esc_html__( 'Disable', 'elementor' ),
537 '1' => esc_html__( 'Enable', 'elementor' ),
538 ],
539 'desc' => esc_html__( 'For troubleshooting server configuration conflicts.', 'elementor' ),
540 ],
541 ],
542 'unfiltered_files_upload' => [
543 'label' => esc_html__( 'Enable Unfiltered File Uploads', 'elementor' ),
544 'field_args' => [
545 'type' => 'select',
546 'std' => '',
547 'options' => [
548 '' => esc_html__( 'Disable', 'elementor' ),
549 '1' => esc_html__( 'Enable', 'elementor' ),
550 ],
551 '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' ),
552 ],
553 ],
554 'font_display' => [
555 'label' => esc_html__( 'Google Fonts Load', 'elementor' ),
556 'field_args' => [
557 'type' => 'select',
558 'std' => 'auto',
559 'options' => [
560 'auto' => esc_html__( 'Default', 'elementor' ),
561 'block' => esc_html__( 'Blocking', 'elementor' ),
562 'swap' => esc_html__( 'Swap', 'elementor' ),
563 'fallback' => esc_html__( 'Fallback', 'elementor' ),
564 'optional' => esc_html__( 'Optional', 'elementor' ),
565 ],
566 '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' ),
567 ],
568 ],
569 ],
570 ],
571 ],
572 ],
573 ];
574 }
575
576 /**
577 * Get settings page title.
578 *
579 * Retrieve the title for the settings page.
580 *
581 * @since 1.5.0
582 * @access protected
583 *
584 * @return string Settings page title.
585 */
586 protected function get_page_title() {
587 if ( Plugin::$instance->experiments->is_feature_active( 'admin_menu_rearrangement' ) ) {
588 return __( 'Settings', 'elementor' );
589 }
590
591 return __( 'Elementor', 'elementor' );
592 }
593
594 /**
595 * @since 2.2.0
596 * @access private
597 */
598 private function maybe_remove_all_admin_notices() {
599 $elementor_pages = [
600 'elementor-getting-started',
601 'elementor_custom_fonts',
602 'elementor_custom_icons',
603 'elementor-license',
604 'e-form-submissions',
605 'elementor_custom_custom_code',
606 'popup_templates',
607 ];
608
609 if ( empty( $_GET['page'] ) || ! in_array( $_GET['page'], $elementor_pages, true ) ) {
610 return;
611 }
612
613 remove_all_actions( 'admin_notices' );
614 }
615
616 /**
617 * Output the content for custom_code page.
618 */
619 private function elementor_custom_code() {
620 ?>
621 <div class="wrap">
622 <div class="elementor-blank_state">
623 <img src="<?php Utils::print_unescaped_internal_string( ELEMENTOR_ASSETS_URL ); ?>images/go-pro-wp-dashboard.svg" />
624 <h2><?php echo esc_html__( 'Add Your Custom Code', 'elementor' ); ?></h2>
625 <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>
626 <a class="elementor-button elementor-button-default elementor-button-go-pro" target="_blank" href="https://go.elementor.com/go-pro-custom-code/"><?php echo esc_html__( 'Upgrade Now', 'elementor' ); ?></a>
627 </div>
628 </div><!-- /.wrap -->
629 <?php
630 }
631
632 /**
633 * Settings page constructor.
634 *
635 * Initializing Elementor "Settings" page.
636 *
637 * @since 1.0.0
638 * @access public
639 */
640 public function __construct() {
641 parent::__construct();
642
643 add_action( 'admin_init', [ $this, 'on_admin_init' ] );
644
645 if ( ! Plugin::$instance->experiments->is_feature_active( 'admin_menu_rearrangement' ) ) {
646 add_action( 'admin_menu', [ $this, 'register_admin_menu' ], 20 );
647 add_action( 'admin_menu', [ $this, 'admin_menu_change_name' ], 200 );
648 add_action( 'admin_menu', [ $this, 'register_pro_menu' ], self::MENU_PRIORITY_GO_PRO );
649 add_action( 'admin_menu', [ $this, 'register_knowledge_base_menu' ], 501 );
650
651 add_filter( 'custom_menu_order', '__return_true' );
652 add_filter( 'menu_order', [ $this, 'menu_order' ] );
653 }
654
655 $clear_cache_callback = [ Plugin::$instance->files_manager, 'clear_cache' ];
656
657 // Clear CSS Meta after change css related methods.
658 $css_settings = [
659 'elementor_disable_color_schemes',
660 'elementor_disable_typography_schemes',
661 'elementor_css_print_method',
662 ];
663
664 foreach ( $css_settings as $option_name ) {
665 add_action( "add_option_{$option_name}", $clear_cache_callback );
666 add_action( "update_option_{$option_name}", $clear_cache_callback );
667 }
668 }
669 }
670