| @@ -300,9 +300,9 @@ | ||
| 300 | 300 | * @return STRING |
| 301 | 301 | */ |
| 302 | 302 | public function disable_google_font_callback() { |
| 303 | 303 | if ( ! ( isset( $_REQUEST['wpnonce'] ) && |
| 304 | - wp_verify_nonce( sanitize_key( wp_unslash( $_REQUEST['wpnonce'] ) ), 'ultp-nonce' ) ) | |
| 304 | + wp_verify_nonce( sanitize_key( wp_unslash( $_REQUEST['wpnonce'] ) ), 'ultp-admin-nonce' ) ) | |
| 305 | 305 | ) { |
| 306 | 306 | return; |
| 307 | 307 | } |
| 308 | 308 | if ( ! ultimate_post()->permission_check_for_restapi() ) { |
| @@ -415,9 +415,9 @@ | ||
| 415 | 415 | $ultpPresetColors = get_option( 'ultpPresetColors', array() ); |
| 416 | 416 | |
| 417 | 417 | $rootCSS = ( isset( $ultpPresetColors['rootCSS'] ) && $ultpPresetColors['rootCSS'] ) ? $ultpPresetColors['rootCSS'] : ':root { --postx_preset_Base_1_color: #f4f4ff; --postx_preset_Base_2_color: #dddff8; --postx_preset_Base_3_color: #B4B4D6; --postx_preset_Primary_color: #3323f0; --postx_preset_Secondary_color: #4a5fff; --postx_preset_Tertiary_color: #FFFFFF; --postx_preset_Contrast_3_color: #545472; --postx_preset_Contrast_2_color: #262657; --postx_preset_Contrast_1_color: #10102e; --postx_preset_Over_Primary_color: #ffffff; }'; |
| 418 | 418 | $savedDLMode = ( isset( $global['enableDark'] ) && $global['enableDark'] ) ? 'ultpdark' : 'ultplight'; |
| 419 | - $localDLMode = isset( $_COOKIE['ultplocalDLMode'] ) ? $_COOKIE['ultplocalDLMode'] : $savedDLMode; | |
| 419 | + $localDLMode = isset( $_COOKIE['ultplocalDLMode'] ) ? sanitize_key( wp_unslash( $_COOKIE['ultplocalDLMode'] ) ) : $savedDLMode; | |
| 420 | 420 | |
| 421 | 421 | if ( $localDLMode == 'ultplight' && $savedDLMode == 'ultpdark' ) { |
| 422 | 422 | $rootCSS = $this->handle_dark_light_color_switcher( $rootCSS ); |
| 423 | 423 | } elseif ( $localDLMode == 'ultpdark' ) { |
| @@ -453,9 +453,9 @@ | ||
| 453 | 453 | */ |
| 454 | 454 | public function enqueue_postx_block_css() { |
| 455 | 455 | $this->postx_global_css_callback(); |
| 456 | 456 | if ( apply_filters( 'postx_common_script', false ) || |
| 457 | - isset( $_GET['et_fb'] ) // divi theme issue. | |
| 457 | + isset( $_GET['et_fb'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only Divi editor detection (divi theme issue). | |
| 458 | 458 | ) { |
| 459 | 459 | ultimate_post()->register_scripts_common(); |
| 460 | 460 | } |
| 461 | 461 | if ( is_admin() ) { |
| @@ -556,11 +556,17 @@ | ||
| 556 | 556 | } |
| 557 | 557 | } |
| 558 | 558 | } |
| 559 | 559 | } |
| 560 | + /** | |
| 561 | + * Whether the Mega Menu block renders. PostX Pro provides it; PostX alone does not. | |
| 562 | + * | |
| 563 | + * @param bool $render Whether to output the block. False by default. | |
| 564 | + * @param array $block The block being rendered. | |
| 565 | + */ | |
| 560 | 566 | if ( |
| 561 | - $block['blockName'] == 'ultimate-post/mega-menu' && | |
| 562 | - ! ultimate_post()->is_lc_active() | |
| 567 | + 'ultimate-post/mega-menu' === $block['blockName'] && | |
| 568 | + ! apply_filters( 'ultp_mega_menu_render', false, $block ) | |
| 563 | 569 | ) { |
| 564 | 570 | return ''; |
| 565 | 571 | } |
| 566 | 572 | } |
| @@ -637,9 +643,9 @@ | ||
| 637 | 643 | } |
| 638 | 644 | } |
| 639 | 645 | if ( $css ) { |
| 640 | 646 | ultimate_post()->register_scripts_common(); |
| 641 | - wp_register_style( "ultp-post-{$post_id}", false ); | |
| 647 | + wp_register_style( "ultp-post-{$post_id}", false, array(), ULTP_VER ); | |
| 642 | 648 | wp_enqueue_style( "ultp-post-{$post_id}" ); |
| 643 | 649 | wp_add_inline_style( "ultp-post-{$post_id}", $css ); |
| 644 | 650 | } |
| 645 | 651 | } |
| @@ -655,9 +661,9 @@ | ||
| 655 | 661 | public function handle_fse_template_parts_css() { |
| 656 | 662 | $parts = get_posts( |
| 657 | 663 | array( |
| 658 | 664 | 'post_type' => 'wp_template_part', |
| 659 | - 'meta_query' => array( | |
| 665 | + 'meta_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query -- Finds the few template parts that use PostX blocks; sites have only a handful of wp_template_part posts. | |
| 660 | 666 | array( |
| 661 | 667 | 'key' => '_ultp_active', |
| 662 | 668 | 'value' => 'yes', |
| 663 | 669 | ), |