Plugin Directory

Changeset 3384756


Ignore:
Timestamp:
10/26/2025 02:32:14 PM (7 weeks ago)
Author:
seedprod
Message:

Staging 6.19.4

Location:
coming-soon/trunk/admin
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • coming-soon/trunk/admin/includes/review-functions.php

    r3381273 r3384756  
    2121 */
    2222function seedprod_lite_v2_init_review_request() {
     23    // Temporarily disabled - will be converted to trigger-based system
     24    return;
     25
    2326    // Only show for Lite builds
    2427    if ( 'lite' !== SEEDPROD_BUILD ) {
     
    2629    }
    2730
     31    // Enqueue review notice JavaScript
     32    add_action( 'admin_enqueue_scripts', 'seedprod_lite_v2_enqueue_review_scripts' );
     33
    2834    // Admin notice requesting review
    2935    add_action( 'admin_notices', 'seedprod_lite_v2_review_request' );
     
    3339}
    3440add_action( 'admin_init', 'seedprod_lite_v2_init_review_request' );
     41
     42/**
     43 * Enqueue review notice JavaScript
     44 *
     45 * Only loads on pages where review notice might display.
     46 *
     47 * @since 7.0.0
     48 */
     49function seedprod_lite_v2_enqueue_review_scripts() {
     50    // Only enqueue for super admins (same check as review display)
     51    if ( ! is_super_admin() ) {
     52        return;
     53    }
     54
     55    // Don't load on SeedProd pages (review notice doesn't show there)
     56    $screen = get_current_screen();
     57    if ( $screen && strpos( $screen->id, 'seedprod' ) !== false ) {
     58        return;
     59    }
     60
     61    // Enqueue the review notice handler
     62    wp_enqueue_script(
     63        'seedprod-review-notice',
     64        plugin_dir_url( dirname( __FILE__ ) ) . 'js/review-notice.js',
     65        array( 'jquery' ),
     66        SEEDPROD_VERSION,
     67        true
     68    );
     69
     70    // Localize script with nonce for AJAX security
     71    wp_localize_script(
     72        'seedprod-review-notice',
     73        'seedprodReviewNotice',
     74        array(
     75            'nonce' => wp_create_nonce( 'seedprod_review_dismiss' ),
     76        )
     77    );
     78}
    3579
    3680/**
     
    180224 */
    181225function seedprod_lite_v2_review_dismiss() {
    182     // Security check
     226    // Verify nonce for security
     227    check_ajax_referer( 'seedprod_review_dismiss', 'nonce' );
     228
     229    // Security check - verify user capability
    183230    if ( ! current_user_can( 'manage_options' ) ) {
    184231        wp_die();
    185232    }
    186233
    187     // Check if this is a permanent dismissal
    188     $permanent = isset( $_POST['permanent'] ) && $_POST['permanent'] === 'true';
     234    // Check if this is a permanent dismissal (sanitize input)
     235    $permanent = isset( $_POST['permanent'] ) && sanitize_text_field( wp_unslash( $_POST['permanent'] ) ) === 'true';
    189236
    190237    if ( $permanent ) {
Note: See TracChangeset for help on using the changeset viewer.