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
elementor / includes / settings / settings.php

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

675 lines 22.3 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__( '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' ] );
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( 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 /**
388 * On admin init.
389 *
390 * Preform actions on WordPress admin initialization.
391 *
392 * Fired by `admin_init` action.
393 *
394 * @since 2.0.0
395 * @access public
396 */
397 public function on_admin_init() {
398 $this->handle_external_redirects();
399
400 $this->maybe_remove_all_admin_notices();
401 }
402
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 /**
418 * Update CSS print method.
419 *
420 * Clear post CSS cache.
421 *
422 * Fired by `add_option_elementor_css_print_method` and
423 * `update_option_elementor_css_print_method` actions.
424 *
425 * @since 1.7.5
426 * @access public
427 * @deprecated 3.0.0
428 */
429 public function update_css_print_method() {
430 Plugin::$instance->files_manager->clear_cache();
431 }
432
433 /**
434 * Create tabs.
435 *
436 * Return the settings page tabs, sections and fields.
437 *
438 * @since 1.5.0
439 * @access protected
440 *
441 * @return array An array with the settings page tabs, sections and fields.
442 */
443 protected function create_tabs() {
444 $validations_class_name = __NAMESPACE__ . '\Settings_Validations';
445
446 return [
447 self::TAB_GENERAL => [
448 'label' => esc_html__( 'General', 'elementor' ),
449 'sections' => [
450 'general' => [
451 'fields' => [
452 self::UPDATE_TIME_FIELD => [
453 'full_field_id' => self::UPDATE_TIME_FIELD,
454 'field_args' => [
455 'type' => 'hidden',
456 ],
457 'setting_args' => [ $validations_class_name, 'current_time' ],
458 ],
459 'cpt_support' => [
460 'label' => esc_html__( 'Post Types', 'elementor' ),
461 'field_args' => [
462 'type' => 'checkbox_list_cpt',
463 'std' => [ 'page', 'post' ],
464 'exclude' => [ 'attachment', 'elementor_library' ],
465 ],
466 'setting_args' => [ $validations_class_name, 'checkbox_list' ],
467 ],
468 'disable_color_schemes' => [
469 'label' => esc_html__( 'Disable Default Colors', 'elementor' ),
470 'field_args' => [
471 'type' => 'checkbox',
472 'value' => 'yes',
473 'sub_desc' => esc_html__( 'Checking this box will disable Elementor\'s Default Colors, and make Elementor inherit the colors from your theme.', 'elementor' ),
474 ],
475 ],
476 'disable_typography_schemes' => [
477 'label' => esc_html__( 'Disable Default Fonts', 'elementor' ),
478 'field_args' => [
479 'type' => 'checkbox',
480 'value' => 'yes',
481 'sub_desc' => esc_html__( 'Checking this box will disable Elementor\'s Default Fonts, and make Elementor inherit the fonts from your theme.', 'elementor' ),
482 ],
483 ],
484 ],
485 ],
486 'usage' => [
487 'label' => esc_html__( 'Improve Elementor', 'elementor' ),
488 'fields' => $this->get_usage_fields(),
489 ],
490 ],
491 ],
492 self::TAB_INTEGRATIONS => [
493 'label' => esc_html__( 'Integrations', 'elementor' ),
494 'sections' => [
495 'google_maps' => [
496 'label' => esc_html__( 'Google Maps Embed API', 'elementor' ),
497 'callback' => function() {
498 printf(
499 /* translators: 1: Link open tag, 2: Link close tag */
500 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' ),
501 '<a target="_blank" href="https://developers.google.com/maps/documentation/embed/get-api-key">',
502 '</a>'
503 );
504 },
505 'fields' => [
506 'google_maps_api_key' => [
507 'label' => esc_html__( 'API Key', 'elementor' ),
508 'field_args' => [
509 'class' => 'elementor_google_maps_api_key',
510 'type' => 'text',
511 ],
512 ],
513 ],
514 ],
515 ],
516 ],
517 self::TAB_ADVANCED => [
518 'label' => esc_html__( 'Advanced', 'elementor' ),
519 'sections' => [
520 'advanced' => [
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 ],
535 'editor_break_lines' => [
536 'label' => esc_html__( 'Switch Editor Loader Method', 'elementor' ),
537 'field_args' => [
538 'type' => 'select',
539 'std' => '',
540 'options' => [
541 '' => esc_html__( 'Disable', 'elementor' ),
542 '1' => esc_html__( 'Enable', 'elementor' ),
543 ],
544 'desc' => esc_html__( 'For troubleshooting server configuration conflicts.', 'elementor' ),
545 ],
546 ],
547 'unfiltered_files_upload' => [
548 'label' => esc_html__( 'Enable Unfiltered File Uploads', 'elementor' ),
549 'field_args' => [
550 'type' => 'select',
551 'std' => '',
552 'options' => [
553 '' => esc_html__( 'Disable', 'elementor' ),
554 '1' => esc_html__( 'Enable', 'elementor' ),
555 ],
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' ),
557 ],
558 ],
559 'font_display' => [
560 'label' => esc_html__( 'Google Fonts Load', 'elementor' ),
561 'field_args' => [
562 'type' => 'select',
563 'std' => 'auto',
564 'options' => [
565 'auto' => esc_html__( 'Default', 'elementor' ),
566 'block' => esc_html__( 'Blocking', 'elementor' ),
567 'swap' => esc_html__( 'Swap', 'elementor' ),
568 'fallback' => esc_html__( 'Fallback', 'elementor' ),
569 'optional' => esc_html__( 'Optional', 'elementor' ),
570 ],
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' ),
572 ],
573 ],
574 ],
575 ],
576 ],
577 ],
578 ];
579 }
580
581 /**
582 * Get settings page title.
583 *
584 * Retrieve the title for the settings page.
585 *
586 * @since 1.5.0
587 * @access protected
588 *
589 * @return string Settings page title.
590 */
591 protected function get_page_title() {
592 if ( Plugin::$instance->experiments->is_feature_active( 'admin_menu_rearrangement' ) ) {
593 return __( 'Settings', 'elementor' );
594 }
595
596 return __( 'Elementor', 'elementor' );
597 }
598
599 /**
600 * @since 2.2.0
601 * @access private
602 */
603 private function maybe_remove_all_admin_notices() {
604 $elementor_pages = [
605 'elementor-getting-started',
606 'elementor_custom_fonts',
607 'elementor_custom_icons',
608 'elementor-license',
609 'e-form-submissions',
610 'elementor_custom_custom_code',
611 'popup_templates',
612 ];
613
614 if ( empty( $_GET['page'] ) || ! in_array( $_GET['page'], $elementor_pages, true ) ) {
615 return;
616 }
617
618 remove_all_actions( 'admin_notices' );
619 }
620
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
635 }
636
637 /**
638 * Settings page constructor.
639 *
640 * Initializing Elementor "Settings" page.
641 *
642 * @since 1.0.0
643 * @access public
644 */
645 public function __construct() {
646 parent::__construct();
647
648 add_action( 'admin_init', [ $this, 'on_admin_init' ] );
649
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 );
655
656 add_filter( 'custom_menu_order', '__return_true' );
657 add_filter( 'menu_order', [ $this, 'menu_order' ] );
658 }
659
660 $clear_cache_callback = [ Plugin::$instance->files_manager, 'clear_cache' ];
661
662 // Clear CSS Meta after change css related methods.
663 $css_settings = [
664 'elementor_disable_color_schemes',
665 'elementor_disable_typography_schemes',
666 'elementor_css_print_method',
667 ];
668
669 foreach ( $css_settings as $option_name ) {
670 add_action( "add_option_{$option_name}", $clear_cache_callback );
671 add_action( "update_option_{$option_name}", $clear_cache_callback );
672 }
673 }
674 }
675