| 1 |
<?php |
| 2 |
namespace Elementor; |
| 3 |
|
| 4 |
use Elementor\Core\Admin\Menu\Admin_Menu_Manager; |
| 5 |
use Elementor\Core\Settings\Manager as SettingsManager; |
| 6 |
use Elementor\Includes\Settings\AdminMenuItems\Admin_Menu_Item; |
| 7 |
use Elementor\Includes\Settings\AdminMenuItems\Get_Help_Menu_Item; |
| 8 |
use Elementor\Includes\Settings\AdminMenuItems\Getting_Started_Menu_Item; |
| 9 |
use Elementor\Modules\Promotions\Module as Promotions_Module; |
| 10 |
use Elementor\TemplateLibrary\Source_Local; |
| 11 |
use Elementor\Modules\Home\Module as Home_Module; |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) { |
| 14 |
exit; // Exit if accessed directly. |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* Elementor "Settings" page in WordPress Dashboard. |
| 19 |
* |
| 20 |
* Elementor settings page handler class responsible for creating and displaying |
| 21 |
* Elementor "Settings" page in WordPress dashboard. |
| 22 |
* |
| 23 |
* @since 1.0.0 |
| 24 |
*/ |
| 25 |
class Settings extends Settings_Page { |
| 26 |
|
| 27 |
/** |
| 28 |
* Settings page ID for Elementor settings. |
| 29 |
*/ |
| 30 |
const PAGE_ID = 'elementor'; |
| 31 |
|
| 32 |
/** |
| 33 |
* Upgrade menu priority. |
| 34 |
*/ |
| 35 |
const MENU_PRIORITY_GO_PRO = 502; |
| 36 |
|
| 37 |
/** |
| 38 |
* Settings page field for update time. |
| 39 |
*/ |
| 40 |
const UPDATE_TIME_FIELD = '_elementor_settings_update_time'; |
| 41 |
|
| 42 |
/** |
| 43 |
* Settings page general tab slug. |
| 44 |
*/ |
| 45 |
const TAB_GENERAL = 'general'; |
| 46 |
|
| 47 |
/** |
| 48 |
* Settings page style tab slug. |
| 49 |
*/ |
| 50 |
const TAB_STYLE = 'style'; |
| 51 |
|
| 52 |
/** |
| 53 |
* Settings page integrations tab slug. |
| 54 |
*/ |
| 55 |
const TAB_INTEGRATIONS = 'integrations'; |
| 56 |
|
| 57 |
/** |
| 58 |
* Settings page advanced tab slug. |
| 59 |
*/ |
| 60 |
const TAB_ADVANCED = 'advanced'; |
| 61 |
|
| 62 |
/** |
| 63 |
* Settings page performance tab slug. |
| 64 |
*/ |
| 65 |
const TAB_PERFORMANCE = 'performance'; |
| 66 |
|
| 67 |
const ADMIN_MENU_PRIORITY = 10; |
| 68 |
|
| 69 |
public Home_Module $home_module; |
| 70 |
|
| 71 |
/** |
| 72 |
* Register admin menu. |
| 73 |
* |
| 74 |
* Add new Elementor Settings admin menu. |
| 75 |
* |
| 76 |
* Fired by `admin_menu` action. |
| 77 |
* |
| 78 |
* @since 1.0.0 |
| 79 |
* @access public |
| 80 |
*/ |
| 81 |
public function register_admin_menu() { |
| 82 |
global $menu; |
| 83 |
|
| 84 |
$menu[] = [ '', 'read', 'separator-elementor', '', 'wp-menu-separator elementor' ]; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
| 85 |
|
| 86 |
if ( ! current_user_can( 'manage_options' ) ) { |
| 87 |
return; |
| 88 |
} |
| 89 |
|
| 90 |
add_menu_page( |
| 91 |
esc_html__( 'Elementor', 'elementor' ), |
| 92 |
esc_html__( 'Elementor', 'elementor' ), |
| 93 |
'manage_options', |
| 94 |
self::PAGE_ID, |
| 95 |
[ |
| 96 |
$this, |
| 97 |
$this->home_module->is_experiment_active() ? 'display_home_screen' : 'display_settings_page', |
| 98 |
], |
| 99 |
'', |
| 100 |
'58.5' |
| 101 |
); |
| 102 |
|
| 103 |
if ( $this->home_module->is_experiment_active() ) { |
| 104 |
add_action( 'elementor/admin/menu/register', function( Admin_Menu_Manager $admin_menu ) { |
| 105 |
$admin_menu->register( 'elementor-settings', new Admin_Menu_Item( $this ) ); |
| 106 |
}, 0 ); |
| 107 |
} |
| 108 |
} |
| 109 |
|
| 110 |
public function display_home_screen() { |
| 111 |
echo '<div id="e-home-screen"></div>'; |
| 112 |
} |
| 113 |
|
| 114 |
/** |
| 115 |
* Reorder the Elementor menu items in admin. |
| 116 |
* Based on WC. |
| 117 |
* |
| 118 |
* @since 2.4.0 |
| 119 |
* |
| 120 |
* @param array $menu_order Menu order. |
| 121 |
* @return array |
| 122 |
*/ |
| 123 |
public function menu_order( $menu_order ) { |
| 124 |
// Initialize our custom order array. |
| 125 |
$elementor_menu_order = []; |
| 126 |
|
| 127 |
// Get the index of our custom separator. |
| 128 |
$elementor_separator = array_search( 'separator-elementor', $menu_order, true ); |
| 129 |
|
| 130 |
// Get index of library menu. |
| 131 |
$elementor_library = array_search( Source_Local::ADMIN_MENU_SLUG, $menu_order, true ); |
| 132 |
|
| 133 |
// Loop through menu order and do some rearranging. |
| 134 |
foreach ( $menu_order as $index => $item ) { |
| 135 |
if ( 'elementor' === $item ) { |
| 136 |
$elementor_menu_order[] = 'separator-elementor'; |
| 137 |
$elementor_menu_order[] = $item; |
| 138 |
$elementor_menu_order[] = Source_Local::ADMIN_MENU_SLUG; |
| 139 |
|
| 140 |
unset( $menu_order[ $elementor_separator ] ); |
| 141 |
unset( $menu_order[ $elementor_library ] ); |
| 142 |
} elseif ( ! in_array( $item, [ 'separator-elementor' ], true ) ) { |
| 143 |
$elementor_menu_order[] = $item; |
| 144 |
} |
| 145 |
} |
| 146 |
|
| 147 |
// Return order. |
| 148 |
return $elementor_menu_order; |
| 149 |
} |
| 150 |
|
| 151 |
/** |
| 152 |
* Register Elementor knowledge base sub-menu. |
| 153 |
* |
| 154 |
* Add new Elementor knowledge base sub-menu under the main Elementor menu. |
| 155 |
* |
| 156 |
* Fired by `admin_menu` action. |
| 157 |
* |
| 158 |
* @since 2.0.3 |
| 159 |
* @access private |
| 160 |
*/ |
| 161 |
private function register_knowledge_base_menu( Admin_Menu_Manager $admin_menu ) { |
| 162 |
$admin_menu->register( 'elementor-getting-started', new Getting_Started_Menu_Item() ); |
| 163 |
$admin_menu->register( 'go_knowledge_base_site', new Get_Help_Menu_Item() ); |
| 164 |
} |
| 165 |
|
| 166 |
/** |
| 167 |
* Go Elementor Pro. |
| 168 |
* |
| 169 |
* Redirect the Elementor Pro page the clicking the Elementor Pro menu link. |
| 170 |
* |
| 171 |
* Fired by `admin_init` action. |
| 172 |
* |
| 173 |
* @since 2.0.3 |
| 174 |
* @access public |
| 175 |
*/ |
| 176 |
public function handle_external_redirects() { |
| 177 |
if ( empty( $_GET['page'] ) ) { |
| 178 |
return; |
| 179 |
} |
| 180 |
|
| 181 |
if ( 'go_knowledge_base_site' === $_GET['page'] ) { |
| 182 |
wp_redirect( Get_Help_Menu_Item::URL ); |
| 183 |
die; |
| 184 |
} |
| 185 |
} |
| 186 |
|
| 187 |
/** |
| 188 |
* On admin init. |
| 189 |
* |
| 190 |
* Preform actions on WordPress admin initialization. |
| 191 |
* |
| 192 |
* Fired by `admin_init` action. |
| 193 |
* |
| 194 |
* @since 2.0.0 |
| 195 |
* @access public |
| 196 |
*/ |
| 197 |
public function on_admin_init() { |
| 198 |
$this->handle_external_redirects(); |
| 199 |
|
| 200 |
$this->maybe_remove_all_admin_notices(); |
| 201 |
} |
| 202 |
|
| 203 |
/** |
| 204 |
* Change "Settings" menu name. |
| 205 |
* |
| 206 |
* Update the name of the Settings admin menu from "Elementor" to "Settings". |
| 207 |
* |
| 208 |
* Fired by `admin_menu` action. |
| 209 |
* |
| 210 |
* @since 1.0.0 |
| 211 |
* @access public |
| 212 |
*/ |
| 213 |
public function admin_menu_change_name() { |
| 214 |
$menu_name = $this->home_module->is_experiment_active() |
| 215 |
? esc_html__( 'Home', 'elementor' ) |
| 216 |
: esc_html__( 'Settings', 'elementor' ); |
| 217 |
|
| 218 |
Utils::change_submenu_first_item_label( 'elementor', $menu_name ); |
| 219 |
} |
| 220 |
|
| 221 |
/** |
| 222 |
* Update CSS print method. |
| 223 |
* |
| 224 |
* Clear post CSS cache. |
| 225 |
* |
| 226 |
* Fired by `add_option_elementor_css_print_method` and |
| 227 |
* `update_option_elementor_css_print_method` actions. |
| 228 |
* |
| 229 |
* @since 1.7.5 |
| 230 |
* @access public |
| 231 |
* @deprecated 3.0.0 Use `Plugin::$instance->files_manager->clear_cache()` method instead. |
| 232 |
*/ |
| 233 |
public function update_css_print_method() { |
| 234 |
Plugin::$instance->files_manager->clear_cache(); |
| 235 |
} |
| 236 |
|
| 237 |
/** |
| 238 |
* Create tabs. |
| 239 |
* |
| 240 |
* Return the settings page tabs, sections and fields. |
| 241 |
* |
| 242 |
* @since 1.5.0 |
| 243 |
* @access protected |
| 244 |
* |
| 245 |
* @return array An array with the settings page tabs, sections and fields. |
| 246 |
*/ |
| 247 |
protected function create_tabs() { |
| 248 |
$validations_class_name = __NAMESPACE__ . '\Settings_Validations'; |
| 249 |
|
| 250 |
return [ |
| 251 |
self::TAB_GENERAL => [ |
| 252 |
'label' => esc_html__( 'General', 'elementor' ), |
| 253 |
'sections' => [ |
| 254 |
'general' => [ |
| 255 |
'fields' => [ |
| 256 |
self::UPDATE_TIME_FIELD => [ |
| 257 |
'full_field_id' => self::UPDATE_TIME_FIELD, |
| 258 |
'field_args' => [ |
| 259 |
'type' => 'hidden', |
| 260 |
], |
| 261 |
'setting_args' => [ $validations_class_name, 'current_time' ], |
| 262 |
], |
| 263 |
'cpt_support' => [ |
| 264 |
'label' => esc_html__( 'Post Types', 'elementor' ), |
| 265 |
'field_args' => [ |
| 266 |
'type' => 'checkbox_list_cpt', |
| 267 |
'std' => [ 'page', 'post' ], |
| 268 |
'exclude' => [ 'attachment', 'elementor_library' ], |
| 269 |
], |
| 270 |
'setting_args' => [ $validations_class_name, 'checkbox_list' ], |
| 271 |
], |
| 272 |
'disable_color_schemes' => [ |
| 273 |
'label' => esc_html__( 'Disable Default Colors', 'elementor' ), |
| 274 |
'field_args' => [ |
| 275 |
'type' => 'checkbox', |
| 276 |
'value' => 'yes', |
| 277 |
'sub_desc' => esc_html__( 'Checking this box will disable Elementor\'s Default Colors, and make Elementor inherit the colors from your theme.', 'elementor' ), |
| 278 |
], |
| 279 |
], |
| 280 |
'disable_typography_schemes' => [ |
| 281 |
'label' => esc_html__( 'Disable Default Fonts', 'elementor' ), |
| 282 |
'field_args' => [ |
| 283 |
'type' => 'checkbox', |
| 284 |
'value' => 'yes', |
| 285 |
'sub_desc' => esc_html__( 'Checking this box will disable Elementor\'s Default Fonts, and make Elementor inherit the fonts from your theme.', 'elementor' ), |
| 286 |
], |
| 287 |
], |
| 288 |
], |
| 289 |
], |
| 290 |
'usage' => [ |
| 291 |
'label' => esc_html__( 'Improve Elementor', 'elementor' ), |
| 292 |
'fields' => $this->get_usage_fields(), |
| 293 |
], |
| 294 |
], |
| 295 |
], |
| 296 |
self::TAB_INTEGRATIONS => [ |
| 297 |
'label' => esc_html__( 'Integrations', 'elementor' ), |
| 298 |
'sections' => [ |
| 299 |
'google_maps' => [ |
| 300 |
'label' => esc_html__( 'Google Maps Embed API', 'elementor' ), |
| 301 |
'callback' => function() { |
| 302 |
printf( |
| 303 |
/* translators: 1: Link open tag, 2: Link close tag */ |
| 304 |
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' ), |
| 305 |
'<a target="_blank" href="https://developers.google.com/maps/documentation/embed/get-api-key">', |
| 306 |
'</a>' |
| 307 |
); |
| 308 |
}, |
| 309 |
'fields' => [ |
| 310 |
'google_maps_api_key' => [ |
| 311 |
'label' => esc_html__( 'API Key', 'elementor' ), |
| 312 |
'field_args' => [ |
| 313 |
'class' => 'elementor_google_maps_api_key', |
| 314 |
'type' => 'text', |
| 315 |
], |
| 316 |
], |
| 317 |
], |
| 318 |
], |
| 319 |
], |
| 320 |
], |
| 321 |
self::TAB_ADVANCED => [ |
| 322 |
'label' => esc_html__( 'Advanced', 'elementor' ), |
| 323 |
'sections' => [ |
| 324 |
'advanced' => [ |
| 325 |
'fields' => [ |
| 326 |
'editor_break_lines' => [ |
| 327 |
'label' => esc_html__( 'Switch Editor Loader Method', 'elementor' ), |
| 328 |
'field_args' => [ |
| 329 |
'type' => 'select', |
| 330 |
'std' => '', |
| 331 |
'options' => [ |
| 332 |
'' => esc_html__( 'Disable', 'elementor' ), |
| 333 |
'1' => esc_html__( 'Enable', 'elementor' ), |
| 334 |
], |
| 335 |
'desc' => esc_html__( 'For troubleshooting server configuration conflicts.', 'elementor' ), |
| 336 |
], |
| 337 |
], |
| 338 |
'unfiltered_files_upload' => [ |
| 339 |
'label' => esc_html__( 'Enable Unfiltered File Uploads', 'elementor' ), |
| 340 |
'field_args' => [ |
| 341 |
'type' => 'select', |
| 342 |
'std' => '', |
| 343 |
'options' => [ |
| 344 |
'' => esc_html__( 'Disable', 'elementor' ), |
| 345 |
'1' => esc_html__( 'Enable', 'elementor' ), |
| 346 |
], |
| 347 |
'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' ), |
| 348 |
], |
| 349 |
], |
| 350 |
'google_font' => [ |
| 351 |
'label' => esc_html__( 'Google Fonts', 'elementor' ), |
| 352 |
'field_args' => [ |
| 353 |
'type' => 'select', |
| 354 |
'std' => '1', |
| 355 |
'options' => [ |
| 356 |
'1' => esc_html__( 'Enable', 'elementor' ), |
| 357 |
'0' => esc_html__( 'Disable', 'elementor' ), |
| 358 |
], |
| 359 |
'desc' => sprintf( |
| 360 |
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' ), |
| 361 |
'<a href="' . admin_url( 'admin.php?page=elementor_custom_fonts' ) . '">', |
| 362 |
'</a>' |
| 363 |
), |
| 364 |
], |
| 365 |
], |
| 366 |
'font_display' => [ |
| 367 |
'label' => esc_html__( 'Google Fonts Load', 'elementor' ), |
| 368 |
'field_args' => [ |
| 369 |
'type' => 'select', |
| 370 |
'std' => 'auto', |
| 371 |
'options' => [ |
| 372 |
'auto' => esc_html__( 'Default', 'elementor' ), |
| 373 |
'block' => esc_html__( 'Blocking', 'elementor' ), |
| 374 |
'swap' => esc_html__( 'Swap', 'elementor' ), |
| 375 |
'fallback' => esc_html__( 'Fallback', 'elementor' ), |
| 376 |
'optional' => esc_html__( 'Optional', 'elementor' ), |
| 377 |
], |
| 378 |
'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' ), |
| 379 |
], |
| 380 |
], |
| 381 |
], |
| 382 |
], |
| 383 |
], |
| 384 |
], |
| 385 |
self::TAB_PERFORMANCE => [ |
| 386 |
'label' => esc_html__( 'Performance', 'elementor' ), |
| 387 |
'sections' => [ |
| 388 |
'performance' => [ |
| 389 |
'label' => esc_html__( 'Performance', 'elementor' ), |
| 390 |
'callback' => function() { |
| 391 |
printf( |
| 392 |
'<p>%s</p><br><hr><br>', |
| 393 |
esc_html__( 'Improve loading times on your site by selecting the optimization tools that best fit your requirements. ', 'elementor' ) |
| 394 |
); |
| 395 |
}, |
| 396 |
'fields' => [ |
| 397 |
'css_print_method' => [ |
| 398 |
'label' => esc_html__( 'CSS Print Method', 'elementor' ), |
| 399 |
'field_args' => [ |
| 400 |
'class' => 'elementor_css_print_method', |
| 401 |
'type' => 'select', |
| 402 |
'std' => 'external', |
| 403 |
'options' => [ |
| 404 |
'external' => esc_html__( 'External File', 'elementor' ), |
| 405 |
'internal' => esc_html__( 'Internal Embedding', 'elementor' ), |
| 406 |
], |
| 407 |
'desc' => '<div class="description elementor-css-print-method-description" data-value="external" style="display: none">' |
| 408 |
. esc_html__( 'Use external CSS files for all generated stylesheets. Choose this setting for better performance (recommended).', 'elementor' ) |
| 409 |
. '</div><div class="description elementor-css-print-method-description" data-value="internal" style="display: none">' |
| 410 |
. esc_html__( 'Use internal CSS that is embedded in the head of the page. For troubleshooting server configuration conflicts and managing development environments.', 'elementor' ) |
| 411 |
. '</div>', |
| 412 |
], |
| 413 |
], |
| 414 |
'optimized_image_loading' => [ |
| 415 |
'label' => esc_html__( 'Optimized Image Loading', 'elementor' ), |
| 416 |
'field_args' => [ |
| 417 |
'type' => 'select', |
| 418 |
'std' => '1', |
| 419 |
'options' => [ |
| 420 |
'1' => esc_html__( 'Enable', 'elementor' ), |
| 421 |
'0' => esc_html__( 'Disable', 'elementor' ), |
| 422 |
], |
| 423 |
'desc' => sprintf( |
| 424 |
/* translators: 1: fetchpriority attribute, 2: lazy loading attribute. */ |
| 425 |
esc_html__( 'Improve performance by applying %1$s on LCP image and %2$s on images below the fold.', 'elementor' ), |
| 426 |
'<code>fetchpriority="high"</code>', |
| 427 |
'<code>loading="lazy"</code>' |
| 428 |
), |
| 429 |
], |
| 430 |
], |
| 431 |
'optimized_gutenberg_loading' => [ |
| 432 |
'label' => esc_html__( 'Optimized Gutenberg Loading', 'elementor' ), |
| 433 |
'field_args' => [ |
| 434 |
'type' => 'select', |
| 435 |
'std' => '1', |
| 436 |
'options' => [ |
| 437 |
'1' => esc_html__( 'Enable', 'elementor' ), |
| 438 |
'0' => esc_html__( 'Disable', 'elementor' ), |
| 439 |
], |
| 440 |
'desc' => esc_html__( 'Reduce unnecessary render-blocking loads by dequeuing unused Gutenberg block editor scripts and styles.', 'elementor' ), |
| 441 |
], |
| 442 |
], |
| 443 |
], |
| 444 |
], |
| 445 |
], |
| 446 |
], |
| 447 |
]; |
| 448 |
} |
| 449 |
|
| 450 |
/** |
| 451 |
* Get settings page title. |
| 452 |
* |
| 453 |
* Retrieve the title for the settings page. |
| 454 |
* |
| 455 |
* @since 1.5.0 |
| 456 |
* @access protected |
| 457 |
* |
| 458 |
* @return string Settings page title. |
| 459 |
*/ |
| 460 |
protected function get_page_title() { |
| 461 |
return esc_html__( 'Elementor', 'elementor' ); |
| 462 |
} |
| 463 |
|
| 464 |
/** |
| 465 |
* @since 2.2.0 |
| 466 |
* @access private |
| 467 |
*/ |
| 468 |
private function maybe_remove_all_admin_notices() { |
| 469 |
$elementor_pages = [ |
| 470 |
'elementor-getting-started', |
| 471 |
'elementor-system-info', |
| 472 |
'e-form-submissions', |
| 473 |
'elementor_custom_fonts', |
| 474 |
'elementor_custom_icons', |
| 475 |
'elementor-license', |
| 476 |
'elementor_custom_code', |
| 477 |
'popup_templates', |
| 478 |
'elementor-apps', |
| 479 |
]; |
| 480 |
|
| 481 |
if ( empty( $_GET['page'] ) || ! in_array( $_GET['page'], $elementor_pages, true ) ) { |
| 482 |
return; |
| 483 |
} |
| 484 |
|
| 485 |
remove_all_actions( 'admin_notices' ); |
| 486 |
} |
| 487 |
|
| 488 |
public function add_generator_tag_settings( $settings ) { |
| 489 |
$css_print_method = get_option( 'elementor_css_print_method', 'external' ); |
| 490 |
$settings[] = 'css_print_method-' . $css_print_method; |
| 491 |
|
| 492 |
$google_font = Fonts::is_google_fonts_enabled() ? 'enabled' : 'disabled'; |
| 493 |
$settings[] = 'google_font-' . $google_font; |
| 494 |
|
| 495 |
$font_display = Fonts::get_font_display_setting(); |
| 496 |
$settings[] = 'font_display-' . $font_display; |
| 497 |
|
| 498 |
return $settings; |
| 499 |
} |
| 500 |
|
| 501 |
/** |
| 502 |
* Settings page constructor. |
| 503 |
* |
| 504 |
* Initializing Elementor "Settings" page. |
| 505 |
* |
| 506 |
* @since 1.0.0 |
| 507 |
* @access public |
| 508 |
*/ |
| 509 |
public function __construct() { |
| 510 |
parent::__construct(); |
| 511 |
|
| 512 |
$this->home_module = new Home_Module(); |
| 513 |
|
| 514 |
add_action( 'admin_init', [ $this, 'on_admin_init' ] ); |
| 515 |
add_filter( 'elementor/generator_tag/settings', [ $this, 'add_generator_tag_settings' ] ); |
| 516 |
|
| 517 |
add_action( 'admin_menu', [ $this, 'register_admin_menu' ], 20 ); |
| 518 |
|
| 519 |
add_action( 'elementor/admin/menu/register', function ( Admin_Menu_Manager $admin_menu ) { |
| 520 |
$this->register_knowledge_base_menu( $admin_menu ); |
| 521 |
}, Promotions_Module::ADMIN_MENU_PRIORITY - 1 ); |
| 522 |
|
| 523 |
add_action( 'admin_menu', [ $this, 'admin_menu_change_name' ], 200 ); |
| 524 |
|
| 525 |
add_filter( 'custom_menu_order', '__return_true' ); |
| 526 |
add_filter( 'menu_order', [ $this, 'menu_order' ] ); |
| 527 |
|
| 528 |
$clear_cache_callback = [ Plugin::$instance->files_manager, 'clear_cache' ]; |
| 529 |
|
| 530 |
// Clear CSS Meta after change css related methods. |
| 531 |
$css_settings = [ |
| 532 |
'elementor_disable_color_schemes', |
| 533 |
'elementor_disable_typography_schemes', |
| 534 |
'elementor_css_print_method', |
| 535 |
]; |
| 536 |
|
| 537 |
foreach ( $css_settings as $option_name ) { |
| 538 |
add_action( "add_option_{$option_name}", $clear_cache_callback ); |
| 539 |
add_action( "update_option_{$option_name}", $clear_cache_callback ); |
| 540 |
} |
| 541 |
} |
| 542 |
} |
| 543 |
|