| @@ -90,16 +90,10 @@ | ||
| 90 | 90 | require_once ULTP_PATH . 'includes/durbin/class-xpo.php'; |
| 91 | 91 | require_once ULTP_PATH . 'includes/deactive/class-deactive.php'; |
| 92 | 92 | require_once ULTP_PATH . 'includes/notice/class-notice.php'; |
| 93 | 93 | require_once ULTP_PATH . 'includes/durbin/class-our-plugins.php'; |
| 94 | - require_once ULTP_PATH . 'includes/notice/class-wow-shipping-promotion.php'; | |
| 95 | - require_once ULTP_PATH . 'includes/notice/class-wow-revenue-promotion.php'; | |
| 96 | - require_once ULTP_PATH . 'includes/notice/class-wow-addons-promotion.php'; | |
| 97 | 94 | new \ULTP\Includes\Deactive\Deactive(); |
| 98 | 95 | new \ULTP\Includes\notice\Notice(); |
| 99 | - new \ULTP\Includes\notice\WowShippingPromotion(); | |
| 100 | - new \ULTP\Includes\notice\WowRevenuePromotion(); | |
| 101 | - new \ULTP\Includes\notice\WowAddonsPromotion(); | |
| 102 | 96 | new \ULTP\Includes\Durbin\OurPlugins(); |
| 103 | 97 | } |
| 104 | 98 | |
| 105 | 99 | /** |
| @@ -162,9 +156,9 @@ | ||
| 162 | 156 | $isEnable = apply_filters( 'ultp_view_cookies', true ); |
| 163 | 157 | // add_filter( 'ultp_view_cookies', '__return_false' ); |
| 164 | 158 | $cookies_disable = ultimate_post()->get_setting( 'disable_view_cookies' ); |
| 165 | 159 | if ( $post_id && $isEnable && $cookies_disable != 'yes' ) { |
| 166 | - $has_cookie = isset( $_COOKIE[ 'ultp_view_' . $post_id ] ) ? sanitize_text_field( $_COOKIE[ 'ultp_view_' . $post_id ] ) : false; | |
| 160 | + $has_cookie = isset( $_COOKIE[ 'ultp_view_' . $post_id ] ) ? sanitize_text_field( wp_unslash( $_COOKIE[ 'ultp_view_' . $post_id ] ) ) : false; | |
| 167 | 161 | if ( ! $has_cookie ) { |
| 168 | 162 | $count = (int) get_post_meta( $post_id, '__post_views_count', true ); |
| 169 | 163 | update_post_meta( $post_id, '__post_views_count', $count ? (int) $count + 1 : 1 ); |
| 170 | 164 | setcookie( 'ultp_view_' . $post_id, 1, time() + 86400, COOKIEPATH ); // 1 days cookies |
| @@ -346,9 +340,9 @@ | ||
| 346 | 340 | if ( wp_doing_ajax() ) { |
| 347 | 341 | return; |
| 348 | 342 | } |
| 349 | 343 | if ( $plugin == 'ultimate-post/ultimate-post.php' ) { |
| 350 | - if ( wp_doing_ajax() || is_network_admin() || isset( $_GET['activate-multi'] ) || isset( $_POST['action'] ) && 'activate-selected' == $_POST['action'] ) { | |
| 344 | + if ( wp_doing_ajax() || is_network_admin() || isset( $_GET['activate-multi'] ) || isset( $_POST['action'] ) && 'activate-selected' == $_POST['action'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.NonceVerification.Missing -- Read-only check for bulk/multi activation. | |
| 351 | 345 | return; |
| 352 | 346 | } |
| 353 | 347 | if ( ultimate_post()->get_setting( 'init_setup' ) != 'yes' ) { |
| 354 | 348 | ultimate_post()->set_setting( 'init_setup', 'yes' ); |
| @@ -365,9 +359,11 @@ | ||
| 365 | 359 | * @since v.1.0.0 |
| 366 | 360 | * @return void No return value. |
| 367 | 361 | */ |
| 368 | 362 | public function register_option_panel_scripts_callback() { |
| 369 | - $is_active = ultimate_post()->is_lc_active(); | |
| 363 | + $is_active = ultimate_post()->is_lc_active(); | |
| 364 | + $is_expired = Xpo::is_lc_expired(); | |
| 365 | + | |
| 370 | 366 | $license_key = Xpo::get_lc_key(); |
| 371 | 367 | $_page = isset($_GET['page']) ? sanitize_text_field($_GET['page']) : ''; // @codingStandardsIgnoreLine |
| 372 | 368 | $post_type = get_post_type(); |
| 373 | 369 | $is_woocommerce_active = class_exists( 'WooCommerce' ) ? true : false; |
| @@ -383,11 +379,12 @@ | ||
| 383 | 379 | array( |
| 384 | 380 | 'url' => ULTP_URL, |
| 385 | 381 | 'version' => ULTP_VER, |
| 386 | 382 | 'active' => $is_active, |
| 387 | - 'security' => wp_create_nonce( 'ultp-nonce' ), | |
| 383 | + 'expierd' => $is_expired, | |
| 384 | + 'security' => wp_create_nonce( 'ultp-admin-nonce' ), | |
| 388 | 385 | 'ajax' => admin_url( 'admin-ajax.php' ), |
| 389 | - 'settings' => ultimate_post()->get_setting(), | |
| 386 | + 'settings' => ultimate_post()->get_client_settings(), | |
| 390 | 387 | 'post_type' => $post_type, |
| 391 | 388 | 'saved_template_url' => admin_url( 'admin.php?page=ultp-settings#saved-templates' ), |
| 392 | 389 | 'woocommerce' => $is_woocommerce_active, |
| 393 | 390 | ) |
| @@ -395,9 +392,10 @@ | ||
| 395 | 392 | |
| 396 | 393 | if ( $post_type == 'ultp_custom_font' ) { |
| 397 | 394 | $font_settings = ultimate_post()->get_setting( 'ultp_custom_font' ); |
| 398 | 395 | if ( $font_settings == 'true' ) { |
| 399 | - wp_enqueue_media(); | |
| 396 | + // Pass the font post so uploads send its ID; Custom_Font allows SVG only for that post. | |
| 397 | + wp_enqueue_media( array( 'post' => get_the_ID() ) ); | |
| 400 | 398 | } |
| 401 | 399 | } |
| 402 | 400 | |
| 403 | 401 | /* === Installation Wizard === */ |
| @@ -430,13 +428,15 @@ | ||
| 430 | 428 | 'ultp_dashboard_pannel', |
| 431 | 429 | array_merge( |
| 432 | 430 | array( |
| 433 | 431 | 'ajax' => admin_url( 'admin-ajax.php' ), |
| 434 | - 'security' => wp_create_nonce( 'ultp-nonce' ), | |
| 432 | + 'security' => wp_create_nonce( 'ultp-admin-nonce' ), | |
| 435 | 433 | 'url' => ULTP_URL, |
| 436 | 434 | 'active' => $is_active, |
| 435 | + 'expierd' => $is_expired, | |
| 437 | 436 | 'license' => $license_key, |
| 438 | - 'settings' => ultimate_post()->get_setting(), | |
| 437 | + // The settings form needs the saved OpenAI key; the menu capability is filterable, so check. | |
| 438 | + 'settings' => current_user_can( 'manage_options' ) ? ultimate_post()->get_setting() : ultimate_post()->get_client_settings(), | |
| 439 | 439 | 'addons_settings' => apply_filters( 'ultp_settings', array() ), |
| 440 | 440 | 'builder_url' => admin_url( 'admin.php?page=ultp-settings#builder' ), |
| 441 | 441 | 'version' => ULTP_VER, |
| 442 | 442 | 'setup_wizard_link' => admin_url( 'admin.php?page=ultp-setup-wizard' ), |
| @@ -464,8 +464,9 @@ | ||
| 464 | 464 | * @return void No return value. |
| 465 | 465 | */ |
| 466 | 466 | public function register_block_scripts_editor_area() { |
| 467 | 467 | ultimate_post()->register_scripts_common(); |
| 468 | + $is_expired = Xpo::is_lc_expired(); | |
| 468 | 469 | global $pagenow; |
| 469 | 470 | $depends = 'wp-editor'; |
| 470 | 471 | if ( $pagenow === 'widgets.php' ) { |
| 471 | 472 | $depends = 'wp-edit-widgets'; |
| @@ -513,15 +514,15 @@ | ||
| 513 | 514 | 'ultp_data', |
| 514 | 515 | array( |
| 515 | 516 | 'url' => ULTP_URL, |
| 516 | 517 | 'ajax' => admin_url( 'admin-ajax.php' ), |
| 517 | - 'security' => wp_create_nonce( 'ultp-nonce' ), | |
| 518 | + 'security' => wp_create_nonce( 'ultp-admin-nonce' ), | |
| 518 | 519 | 'hide_import_btn' => ultimate_post()->get_setting( 'hide_import_btn' ), |
| 519 | 520 | 'premium_link' => Xpo::generate_utm_link(), |
| 520 | 521 | 'license' => $is_active ? Xpo::get_lc_key() : '', |
| 521 | 522 | 'active' => $is_active, |
| 522 | 523 | 'archive' => ultimate_post()->is_archive_builder(), |
| 523 | - 'settings' => ultimate_post()->get_setting(), | |
| 524 | + 'settings' => ultimate_post()->get_client_settings(), | |
| 524 | 525 | 'post_type' => $post_type == 'premade' ? 'ultp_builder' : $post_type, // premade used for ultp.wpxpo.com |
| 525 | 526 | 'date_format' => get_option( 'date_format' ), |
| 526 | 527 | 'time_format' => get_option( 'time_format' ), |
| 527 | 528 | 'blog' => get_current_blog_id(), |
| @@ -530,8 +531,9 @@ | ||
| 530 | 531 | 'disable_image_size' => ultimate_post()->get_setting( 'disable_image_size' ), |
| 531 | 532 | 'dark_logo' => get_option( 'ultp_site_dark_logo' ) ? get_option( 'ultp_site_dark_logo' ) : false, |
| 532 | 533 | 'builder_url' => admin_url( 'admin.php?page=ultp-settings#builder' ), |
| 533 | 534 | 'custom_fonts' => $custom_fonts, |
| 535 | + 'expierd' => $is_expired, | |
| 534 | 536 | ) |
| 535 | 537 | ); |
| 536 | 538 | wp_set_script_translations( 'ultp-blocks-editor-script', 'ultimate-post', ULTP_PATH . 'languages/' ); |
| 537 | 539 | } |