PluginProbe
Elementor Website Builder – more than just a page builder / 3.5.0-dev9
Elementor Website Builder – more than just a page builder v3.5.0-dev9
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.5.0-dev9, at includes/settings/settings.php

689 lines 22.8 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\TemplateLibrary\Source_Local;
5
6 if ( ! defined( 'ABSPATH' ) ) {
7 exit; // Exit if accessed directly.
8 }
9
10 /**
11 * Elementor "Settings" page in WordPress Dashboard.
12 *
13 * Elementor settings page handler class responsible for creating and displaying
14 * Elementor "Settings" page in WordPress dashboard.
15 *
16 * @since 1.0.0
17 */
18 class Settings extends Settings_Page {
19
20 /**
21 * Settings page ID for Elementor settings.
22 */
23 const PAGE_ID = 'elementor';
24
25 /**
26 * Go Pro menu priority.
27 */
28 const MENU_PRIORITY_GO_PRO = 502;
29
30 /**
31 * Settings page field for update time.
32 */
33 const UPDATE_TIME_FIELD = '_elementor_settings_update_time';
34
35 /**
36 * Settings page general tab slug.
37 */
38 const TAB_GENERAL = 'general';
39
40 /**
41 * Settings page style tab slug.
42 */
43 const TAB_STYLE = 'style';
44
45 /**
46 * Settings page integrations tab slug.
47 */
48 const TAB_INTEGRATIONS = 'integrations';
49
50 /**
51 * Settings page advanced tab slug.
52 */
53 const TAB_ADVANCED = 'advanced';
54
55 /**
56 * Register admin menu.
57 *
58 * Add new Elementor Settings admin menu.
59 *
60 * Fired by `admin_menu` action.
61 *
62 * @since 1.0.0
63 * @access public
64 */
65 public function register_admin_menu() {
66 global $menu;
67
68 $menu[] = [ '', 'read', 'separator-elementor', '', 'wp-menu-separator elementor' ]; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
69
70 if ( ! current_user_can( 'manage_options' ) ) {
71 return;
72 }
73
74 add_menu_page(
75 __( 'Elementor', 'elementor' ),
76 __( 'Elementor', 'elementor' ),
77 'manage_options',
78 self::PAGE_ID,
79 [ $this, 'display_settings_page' ],
80 '',
81 '58.5'
82 );
83 }
84
85 /**
86 * Reorder the Elementor menu items in admin.
87 * Based on WC.
88 *
89 * @since 2.4.0
90 *
91 * @param array $menu_order Menu order.
92 * @return array
93 */
94 public function menu_order( $menu_order ) {
95 // Initialize our custom order array.
96 $elementor_menu_order = [];
97
98 // Get the index of our custom separator.
99 $elementor_separator = array_search( 'separator-elementor', $menu_order, true );
100
101 // Get index of library menu.
102 $elementor_library = array_search( Source_Local::ADMIN_MENU_SLUG, $menu_order, true );
103
104 // Loop through menu order and do some rearranging.
105 foreach ( $menu_order as $index => $item ) {
106 if ( 'elementor' === $item ) {
107 $elementor_menu_order[] = 'separator-elementor';
108 $elementor_menu_order[] = $item;
109 $elementor_menu_order[] = Source_Local::ADMIN_MENU_SLUG;
110
111 unset( $menu_order[ $elementor_separator ] );
112 unset( $menu_order[ $elementor_library ] );
113 } elseif ( ! in_array( $item, [ 'separator-elementor' ], true ) ) {
114 $elementor_menu_order[] = $item;
115 }
116 }
117
118 // Return order.
119 return $elementor_menu_order;
120 }
121
122 /**
123 * Register Elementor Pro sub-menu.
124 *
125 * Add new Elementor Pro sub-menu under the main Elementor menu.
126 *
127 * Fired by `admin_menu` action.
128 *
129 * @since 1.0.0
130 * @access public
131 */
132 public function register_pro_menu() {
133 add_submenu_page(
134 self::PAGE_ID,
135 __( 'Submissions', 'elementor' ),
136 __( 'Submissions', 'elementor' ),
137 'manage_options',
138 'e-form-submissions',
139 function() {
140 $this->elementor_form_submissions();
141 }
142 );
143
144 add_submenu_page(
145 self::PAGE_ID,
146 __( 'Custom Fonts', 'elementor' ),
147 __( 'Custom Fonts', 'elementor' ),
148 'manage_options',
149 'elementor_custom_fonts',
150 [ $this, 'elementor_custom_fonts' ]
151 );
152
153 add_submenu_page(
154 self::PAGE_ID,
155 __( 'Custom Icons', 'elementor' ),
156 __( 'Custom Icons', 'elementor' ),
157 'manage_options',
158 'elementor_custom_icons',
159 [ $this, 'elementor_custom_icons' ]
160 );
161
162 add_submenu_page(
163 self::PAGE_ID,
164 __( 'Custom Code', 'elementor' ),
165 __( 'Custom Code', 'elementor' ),
166 'manage_options',
167 'elementor_custom_custom_code',
168 function() {
169 $this->elementor_custom_code();
170 }
171 );
172
173 add_submenu_page(
174 self::PAGE_ID,
175 '',
176 '<span class="dashicons dashicons-star-filled" style="font-size: 17px"></span> ' . esc_html__( 'Go Pro', 'elementor' ),
177 'manage_options',
178 'go_elementor_pro',
179 [ $this, 'handle_external_redirects' ]
180 );
181
182 add_submenu_page( Source_Local::ADMIN_MENU_SLUG, esc_html__( 'Popups', 'elementor' ), esc_html__( 'Popups', 'elementor' ), 'manage_options', 'popup_templates', [ $this, 'elementor_popups' ] );
183 }
184
185 /**
186 * Register Elementor knowledge base sub-menu.
187 *
188 * Add new Elementor knowledge base sub-menu under the main Elementor menu.
189 *
190 * Fired by `admin_menu` action.
191 *
192 * @since 2.0.3
193 * @access public
194 */
195 public function register_knowledge_base_menu() {
196 add_submenu_page(
197 self::PAGE_ID,
198 '',
199 __( 'Getting Started', 'elementor' ),
200 'manage_options',
201 'elementor-getting-started',
202 [ $this, 'elementor_getting_started' ]
203 );
204
205 add_submenu_page(
206 self::PAGE_ID,
207 '',
208 __( 'Get Help', 'elementor' ),
209 'manage_options',
210 'go_knowledge_base_site',
211 [ $this, 'handle_external_redirects' ]
212 );
213 }
214
215 /**
216 * Go Elementor Pro.
217 *
218 * Redirect the Elementor Pro page the clicking the Elementor Pro menu link.
219 *
220 * Fired by `admin_init` action.
221 *
222 * @since 2.0.3
223 * @access public
224 */
225 public function handle_external_redirects() {
226 if ( empty( $_GET['page'] ) ) {
227 return;
228 }
229
230 if ( 'go_elementor_pro' === $_GET['page'] ) {
231 wp_redirect( Utils::get_pro_link( 'https://elementor.com/pro/?utm_source=wp-menu&utm_campaign=gopro&utm_medium=wp-dash' ) );
232 die;
233 }
234
235 if ( 'go_knowledge_base_site' === $_GET['page'] ) {
236 wp_redirect( 'https://go.elementor.com/docs-admin-menu/' );
237 die;
238 }
239 }
240
241 /**
242 * Display settings page.
243 *
244 * Output the content for the getting started page.
245 *
246 * @since 2.2.0
247 * @access public
248 */
249 public function elementor_getting_started() {
250 if ( User::is_current_user_can_edit_post_type( 'page' ) ) {
251 $create_new_label = esc_html__( 'Create Your First Page', 'elementor' );
252 $create_new_cpt = 'page';
253 } elseif ( User::is_current_user_can_edit_post_type( 'post' ) ) {
254 $create_new_label = esc_html__( 'Create Your First Post', 'elementor' );
255 $create_new_cpt = 'post';
256 }
257
258 ?>
259 <div class="wrap">
260 <div class="e-getting-started">
261 <div class="e-getting-started__box postbox">
262 <div class="e-getting-started__header">
263 <div class="e-getting-started__title">
264 <div class="e-logo-wrapper">
265 <i class="eicon-elementor"></i>
266 </div>
267 <?php echo esc_html__( 'Getting Started', 'elementor' ); ?>
268 </div>
269 <a class="e-getting-started__skip" href="<?php echo esc_url( admin_url() ); ?>">
270 <i class="eicon-close" aria-hidden="true" title="<?php esc_attr_e( 'Skip', 'elementor' ); ?>"></i>
271 <span class="elementor-screen-only"><?php echo esc_html__( 'Skip', 'elementor' ); ?></span>
272 </a>
273 </div>
274 <div class="e-getting-started__content">
275 <div class="e-getting-started__content--narrow">
276 <h2><?php echo esc_html__( 'Welcome to Elementor', 'elementor' ); ?></h2>
277 <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>
278 </div>
279
280 <div class="e-getting-started__video">
281 <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>
282 </div>
283
284 <div class="e-getting-started__actions e-getting-started__content--narrow">
285 <?php if ( ! empty( $create_new_cpt ) ) : ?>
286 <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>
287 <?php endif; ?>
288
289 <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>
290 </div>
291 </div>
292 </div>
293 </div>
294 </div><!-- /.wrap -->
295 <?php
296 }
297
298 /**
299 * Display settings page.
300 *
301 * Output the content for the custom fonts page.
302 *
303 * @since 2.0.0
304 * @access public
305 */
306 public function elementor_custom_fonts() {
307 ?>
308 <div class="wrap">
309 <div class="elementor-blank_state">
310 <?php // PHPCS - No need to escape an SVG image from the Elementor assets/images folder. ?>
311 <img src="<?php echo ELEMENTOR_ASSETS_URL . 'images/go-pro-wp-dashboard.svg'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>" />
312 <h2><?php echo esc_html__( 'Add Your Custom Fonts', 'elementor' ); ?></h2>
313 <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>
314 <?php // PHPCS - No need to escape a URL. The query arg is sanitized. ?>
315 <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>
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 <?php // PHPCS - No need to escape a URL. The query arg is sanitized. ?>
337 <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>
338 </div>
339 </div><!-- /.wrap -->
340 <?php
341 }
342
343 /**
344 * Display settings page.
345 *
346 * Output the content for the Popups page.
347 *
348 * @since 2.4.0
349 * @access public
350 */
351 public function elementor_popups() {
352 ?>
353 <div class="wrap">
354 <div class="elementor-blank_state">
355 <img src="<?php Utils::print_unescaped_internal_string( ELEMENTOR_ASSETS_URL . 'images/go-pro-wp-dashboard.svg' ); ?>" />
356 <h2><?php echo esc_html__( 'Get Popup Builder', 'elementor' ); ?></h2>
357 <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>
358 <?php // PHPCS - No need to escape a URL. The query arg is sanitized. ?>
359 <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>
360 </div>
361 </div><!-- /.wrap -->
362 <?php
363 }
364
365 public function elementor_form_submissions() {
366 ?>
367 <div class="wrap">
368 <div class="elementor-blank_state">
369 <img src="<?php Utils::print_unescaped_internal_string( ELEMENTOR_ASSETS_URL ); ?>images/go-pro-wp-dashboard.svg" />
370 <h2><?php echo esc_html__( 'Collect Your Form Submissions', 'elementor' ); ?></h2>
371 <p>
372 <?php echo esc_html__( 'Save and manage all of your form submissions in one single place.
373 All within a simple, intuitive place.', 'elementor' ); ?>
374 <a href="http://go.elementor.com/wp-dash-submissions" target="_blank" rel="nofollow">
375 <?php echo esc_html__( 'Learn More', 'elementor' ); ?>
376 </a>
377 </p>
378 <a class="elementor-button elementor-button-default elementor-button-go-pro" target="_blank" href="<?php
379 Utils::print_unescaped_internal_string( Utils::get_pro_link( 'https://go.elementor.com/go-pro-submissions' ) );
380 ?>"><?php echo esc_html__( 'Go Pro', 'elementor' ); ?></a>
381 </div>
382 </div><!-- /.wrap -->
383 <?php
384 }
385
386 /**
387 * On admin init.
388 *
389 * Preform actions on WordPress admin initialization.
390 *
391 * Fired by `admin_init` action.
392 *
393 * @since 2.0.0
394 * @access public
395 */
396 public function on_admin_init() {
397 $this->handle_external_redirects();
398
399 $this->maybe_remove_all_admin_notices();
400 }
401
402 /**
403 * Change "Settings" menu name.
404 *
405 * Update the name of the Settings admin menu from "Elementor" to "Settings".
406 *
407 * Fired by `admin_menu` action.
408 *
409 * @since 1.0.0
410 * @access public
411 */
412 public function admin_menu_change_name() {
413 Utils::change_submenu_first_item_label( 'elementor', esc_html__( 'Settings', 'elementor' ) );
414 }
415
416 /**
417 * Update CSS print method.
418 *
419 * Clear post CSS cache.
420 *
421 * Fired by `add_option_elementor_css_print_method` and
422 * `update_option_elementor_css_print_method` actions.
423 *
424 * @since 1.7.5
425 * @access public
426 * @deprecated 3.0.0
427 */
428 public function update_css_print_method() {
429 Plugin::$instance->files_manager->clear_cache();
430 }
431
432 /**
433 * Create tabs.
434 *
435 * Return the settings page tabs, sections and fields.
436 *
437 * @since 1.5.0
438 * @access protected
439 *
440 * @return array An array with the settings page tabs, sections and fields.
441 */
442 protected function create_tabs() {
443 $validations_class_name = __NAMESPACE__ . '\Settings_Validations';
444
445 return [
446 self::TAB_GENERAL => [
447 'label' => esc_html__( 'General', 'elementor' ),
448 'sections' => [
449 'general' => [
450 'fields' => [
451 self::UPDATE_TIME_FIELD => [
452 'full_field_id' => self::UPDATE_TIME_FIELD,
453 'field_args' => [
454 'type' => 'hidden',
455 ],
456 'setting_args' => [ $validations_class_name, 'current_time' ],
457 ],
458 'cpt_support' => [
459 'label' => esc_html__( 'Post Types', 'elementor' ),
460 'field_args' => [
461 'type' => 'checkbox_list_cpt',
462 'std' => [ 'page', 'post' ],
463 'exclude' => [ 'attachment', 'elementor_library' ],
464 ],
465 'setting_args' => [ $validations_class_name, 'checkbox_list' ],
466 ],
467 'disable_color_schemes' => [
468 'label' => esc_html__( 'Disable Default Colors', 'elementor' ),
469 'field_args' => [
470 'type' => 'checkbox',
471 'value' => 'yes',
472 'sub_desc' => esc_html__( 'Checking this box will disable Elementor\'s Default Colors, and make Elementor inherit the colors from your theme.', 'elementor' ),
473 ],
474 ],
475 'disable_typography_schemes' => [
476 'label' => esc_html__( 'Disable Default Fonts', 'elementor' ),
477 'field_args' => [
478 'type' => 'checkbox',
479 'value' => 'yes',
480 'sub_desc' => esc_html__( 'Checking this box will disable Elementor\'s Default Fonts, and make Elementor inherit the fonts from your theme.', 'elementor' ),
481 ],
482 ],
483 ],
484 ],
485 'usage' => [
486 'label' => esc_html__( 'Improve Elementor', 'elementor' ),
487 'fields' => $this->get_usage_fields(),
488 ],
489 ],
490 ],
491 self::TAB_STYLE => [
492 'label' => esc_html__( 'Style', 'elementor' ),
493 'sections' => [
494 'style' => [
495 'fields' => [
496 'notice' => [
497 'label' => esc_html__( 'Looking for the Style settings?', 'elementor' ),
498 'field_args' => [
499 'type' => 'raw_html',
500 'html' => sprintf(
501 /* translators: 1: Bold open tag, 2: Bold close tag */
502 esc_html__( 'The Style settings changed its location and can now be found within Elementor Editor\'s %1$sPanel > Hamburger Menu > Site Settings%2$s.', 'elementor' ),
503 '<strong>',
504 '</strong>'
505 ) .
506 '<br>' .
507 esc_html__( 'You can use the Site Settings to make changes and see them live!', 'elementor' ) .
508 sprintf( ' <a target="_blank" href="http://go.elementor.com/panel-layout-settings">%s</a>', esc_html__( 'Learn More', 'elementor' ) ),
509 ],
510 ],
511 ],
512 ],
513 ],
514 ],
515 self::TAB_INTEGRATIONS => [
516 'label' => esc_html__( 'Integrations', 'elementor' ),
517 'sections' => [
518 'google_maps' => [
519 'label' => esc_html__( 'Google Maps Embed API', 'elementor' ),
520 'callback' => function() {
521 printf(
522 /* translators: 1: Link open tag, 2: Link close tag */
523 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' ),
524 '<a target="_blank" href="https://developers.google.com/maps/documentation/embed/get-api-key">',
525 '</a>'
526 );
527 },
528 'fields' => [
529 'google_maps_api_key' => [
530 'label' => esc_html__( 'API Key', 'elementor' ),
531 'field_args' => [
532 'class' => 'elementor_google_maps_api_key',
533 'type' => 'text',
534 ],
535 ],
536 ],
537 ],
538 ],
539 ],
540 self::TAB_ADVANCED => [
541 'label' => esc_html__( 'Advanced', 'elementor' ),
542 'sections' => [
543 'advanced' => [
544 'fields' => [
545 'css_print_method' => [
546 'label' => esc_html__( 'CSS Print Method', 'elementor' ),
547 'field_args' => [
548 'class' => 'elementor_css_print_method',
549 'type' => 'select',
550 'std' => 'internal',
551 'options' => [
552 'external' => esc_html__( 'External File', 'elementor' ),
553 'internal' => esc_html__( 'Internal Embedding', 'elementor' ),
554 ],
555 '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>',
556 ],
557 ],
558 'editor_break_lines' => [
559 'label' => esc_html__( 'Switch Editor Loader Method', 'elementor' ),
560 'field_args' => [
561 'type' => 'select',
562 'std' => '',
563 'options' => [
564 '' => esc_html__( 'Disable', 'elementor' ),
565 '1' => esc_html__( 'Enable', 'elementor' ),
566 ],
567 'desc' => esc_html__( 'For troubleshooting server configuration conflicts.', 'elementor' ),
568 ],
569 ],
570 'unfiltered_files_upload' => [
571 'label' => esc_html__( 'Enable Unfiltered File Uploads', 'elementor' ),
572 'field_args' => [
573 'type' => 'select',
574 'std' => '',
575 'options' => [
576 '' => esc_html__( 'Disable', 'elementor' ),
577 '1' => esc_html__( 'Enable', 'elementor' ),
578 ],
579 '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' ),
580 ],
581 ],
582 'font_display' => [
583 'label' => esc_html__( 'Google Fonts Load', 'elementor' ),
584 'field_args' => [
585 'type' => 'select',
586 'std' => 'auto',
587 'options' => [
588 'auto' => esc_html__( 'Default', 'elementor' ),
589 'block' => esc_html__( 'Blocking', 'elementor' ),
590 'swap' => esc_html__( 'Swap', 'elementor' ),
591 'fallback' => esc_html__( 'Fallback', 'elementor' ),
592 'optional' => esc_html__( 'Optional', 'elementor' ),
593 ],
594 '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' ),
595 ],
596 ],
597 ],
598 ],
599 ],
600 ],
601 ];
602 }
603
604 /**
605 * Get settings page title.
606 *
607 * Retrieve the title for the settings page.
608 *
609 * @since 1.5.0
610 * @access protected
611 *
612 * @return string Settings page title.
613 */
614 protected function get_page_title() {
615 return __( 'Elementor', 'elementor' );
616 }
617
618 /**
619 * @since 2.2.0
620 * @access private
621 */
622 private function maybe_remove_all_admin_notices() {
623 $elementor_pages = [
624 'elementor-getting-started',
625 'elementor_custom_fonts',
626 'elementor_custom_icons',
627 'elementor-license',
628 'popup_templates',
629 ];
630
631 if ( empty( $_GET['page'] ) || ! in_array( $_GET['page'], $elementor_pages, true ) ) {
632 return;
633 }
634
635 remove_all_actions( 'admin_notices' );
636 }
637
638 /**
639 * Output the content for custom_code page.
640 */
641 private function elementor_custom_code() {
642 ?>
643 <div class="wrap">
644 <div class="elementor-blank_state">
645 <img src="<?php esc_url( ELEMENTOR_ASSETS_URL . 'images/go-pro-wp-dashboard.svg' ); ?>" alt="go-pro-wp-dashboard" />
646 <h2><?php echo esc_html__( 'Add Your Custom Code', 'elementor' ); ?></h2>
647 <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>
648 <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>
649 </div>
650 </div><!-- /.wrap -->
651 <?php
652 }
653
654 /**
655 * Settings page constructor.
656 *
657 * Initializing Elementor "Settings" page.
658 *
659 * @since 1.0.0
660 * @access public
661 */
662 public function __construct() {
663 parent::__construct();
664
665 add_action( 'admin_init', [ $this, 'on_admin_init' ] );
666 add_action( 'admin_menu', [ $this, 'register_admin_menu' ], 20 );
667 add_action( 'admin_menu', [ $this, 'admin_menu_change_name' ], 200 );
668 add_action( 'admin_menu', [ $this, 'register_pro_menu' ], self::MENU_PRIORITY_GO_PRO );
669 add_action( 'admin_menu', [ $this, 'register_knowledge_base_menu' ], 501 );
670
671 $clear_cache_callback = [ Plugin::$instance->files_manager, 'clear_cache' ];
672
673 // Clear CSS Meta after change css related methods.
674 $css_settings = [
675 'elementor_disable_color_schemes',
676 'elementor_disable_typography_schemes',
677 'elementor_css_print_method',
678 ];
679
680 foreach ( $css_settings as $option_name ) {
681 add_action( "add_option_{$option_name}", $clear_cache_callback );
682 add_action( "update_option_{$option_name}", $clear_cache_callback );
683 }
684
685 add_filter( 'custom_menu_order', '__return_true' );
686 add_filter( 'menu_order', [ $this, 'menu_order' ] );
687 }
688 }
689