Plugin Directory

Changeset 3193773


Ignore:
Timestamp:
11/21/2024 05:53:01 AM (15 months ago)
Author:
dotsvijay
Message:

Bugs fix

Location:
ds-cf7-math-captcha
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • ds-cf7-math-captcha/3.0.1/ds-cf7-math-captcha.php

    r3187437 r3193773  
    173173    if( $tag->type == 'dscf7captcha' ) {
    174174       
    175         if ( isset( $_POST['_wpnonce_ds_cf7_math_captcha'] ) ) {
    176             // Remove slashes first
    177             $nonce = sanitize_text_field(wp_unslash( $_POST['_wpnonce_ds_cf7_math_captcha'] ));
    178        
    179             // Verify nonce after unslashing
    180             if (  wp_verify_nonce( $nonce, 'ds_cf7_math_captcha' ) ) {
    181                 // You can use this message or any custom message here
    182                 $result->invalidate( $tag, esc_html__( 'Nonce verification failed. Please try again.', 'ds-cf7-math-captcha' ) );
    183                 return $result; // Stop further processing if nonce is invalid
    184             }
    185         }
    186        
     175             
    187176        // Initialize variables for captcha calculation
    188177        $finalCechking = '';
     
    247236    $actnVal2_escaped = esc_attr($actnVal2);
    248237    $random_actionVal_escaped = esc_attr($random_actionVal);
    249     $nonce = wp_create_nonce('ds_cf7_math_captcha');
    250     $nonce_escaped = esc_attr($nonce);
     238
    251239    $captcha_icon_url = esc_url(DSCF7_PLUGIN_URL . '/assets/img/icons8-refresh-30.png');
    252240    $captcha_reload_icon_url = esc_url(DSCF7_PLUGIN_URL . '/assets/img/446bcd468478f5bfb7b4e5c804571392_w200.gif');
     
    272260    $ds_cf7_captcha .= '<input type="text" aria-invalid="false" aria-required="true" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" size="5" value="" name="' . esc_attr($tag->name) . '" placeholder="' . esc_attr__('Type your answer', 'ds-cf7-math-captcha') . '" style="width:200px; margin-bottom:10px;" oninput="this.value = this.value.replace(/[^0-9.]/g, \'\').replace(/(\..*)\./g, \'$1\');"></span>';
    273261   
    274     // Nonce field
    275     $ds_cf7_captcha .= '<input type="hidden" name="_wpnonce_ds_cf7_math_captcha" value="' . $nonce_escaped . '">';
    276262    $ds_cf7_captcha .= '</p>';
    277263
     
    302288            array(
    303289                'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ),
    304                 'nonce' => esc_attr( wp_create_nonce( 'ds_cf7_math_captcha' ) )
    305290            )
    306291        );
     
    414399    );
    415400
    416     // Check nonce for security
    417     if ( isset( $_POST['_wpnonce_ds_cf7_math_captcha'] ) ) {
    418         $nonce = sanitize_text_field(wp_unslash($_POST['_wpnonce_ds_cf7_math_captcha']));
    419 
    420         // Verify nonce after unslashing
    421         if ( wp_verify_nonce( $nonce, 'ds_cf7_math_captcha' ) ) {
    422             echo wp_kses( $ds_cf7_captcha, $allowed_html );
    423         }
    424     }
    425 
     401    echo wp_kses( $ds_cf7_captcha, $allowed_html );
    426402    exit;
    427403}
  • ds-cf7-math-captcha/ds-cf7-math-captcha.php

    r3187437 r3193773  
    173173    if( $tag->type == 'dscf7captcha' ) {
    174174       
    175         if ( isset( $_POST['_wpnonce_ds_cf7_math_captcha'] ) ) {
    176             // Remove slashes first
    177             $nonce = sanitize_text_field(wp_unslash( $_POST['_wpnonce_ds_cf7_math_captcha'] ));
    178        
    179             // Verify nonce after unslashing
    180             if (  wp_verify_nonce( $nonce, 'ds_cf7_math_captcha' ) ) {
    181                 // You can use this message or any custom message here
    182                 $result->invalidate( $tag, esc_html__( 'Nonce verification failed. Please try again.', 'ds-cf7-math-captcha' ) );
    183                 return $result; // Stop further processing if nonce is invalid
    184             }
    185         }
    186        
     175             
    187176        // Initialize variables for captcha calculation
    188177        $finalCechking = '';
     
    247236    $actnVal2_escaped = esc_attr($actnVal2);
    248237    $random_actionVal_escaped = esc_attr($random_actionVal);
    249     $nonce = wp_create_nonce('ds_cf7_math_captcha');
    250     $nonce_escaped = esc_attr($nonce);
     238
    251239    $captcha_icon_url = esc_url(DSCF7_PLUGIN_URL . '/assets/img/icons8-refresh-30.png');
    252240    $captcha_reload_icon_url = esc_url(DSCF7_PLUGIN_URL . '/assets/img/446bcd468478f5bfb7b4e5c804571392_w200.gif');
     
    272260    $ds_cf7_captcha .= '<input type="text" aria-invalid="false" aria-required="true" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" size="5" value="" name="' . esc_attr($tag->name) . '" placeholder="' . esc_attr__('Type your answer', 'ds-cf7-math-captcha') . '" style="width:200px; margin-bottom:10px;" oninput="this.value = this.value.replace(/[^0-9.]/g, \'\').replace(/(\..*)\./g, \'$1\');"></span>';
    273261   
    274     // Nonce field
    275     $ds_cf7_captcha .= '<input type="hidden" name="_wpnonce_ds_cf7_math_captcha" value="' . $nonce_escaped . '">';
    276262    $ds_cf7_captcha .= '</p>';
    277263
     
    302288            array(
    303289                'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ),
    304                 'nonce' => esc_attr( wp_create_nonce( 'ds_cf7_math_captcha' ) )
    305290            )
    306291        );
     
    414399    );
    415400
    416     // Check nonce for security
    417     if ( isset( $_POST['_wpnonce_ds_cf7_math_captcha'] ) ) {
    418         $nonce = sanitize_text_field(wp_unslash($_POST['_wpnonce_ds_cf7_math_captcha']));
    419 
    420         // Verify nonce after unslashing
    421         if ( wp_verify_nonce( $nonce, 'ds_cf7_math_captcha' ) ) {
    422             echo wp_kses( $ds_cf7_captcha, $allowed_html );
    423         }
    424     }
    425 
     401    echo wp_kses( $ds_cf7_captcha, $allowed_html );
    426402    exit;
    427403}
  • ds-cf7-math-captcha/tags/3.0.1/ds-cf7-math-captcha.php

    r3187493 r3193773  
    173173    if( $tag->type == 'dscf7captcha' ) {
    174174       
    175         if ( isset( $_POST['_wpnonce_ds_cf7_math_captcha'] ) ) {
    176             // Remove slashes first
    177             $nonce = sanitize_text_field(wp_unslash( $_POST['_wpnonce_ds_cf7_math_captcha'] ));
    178        
    179             // Verify nonce after unslashing
    180             if (  wp_verify_nonce( $nonce, 'ds_cf7_math_captcha' ) ) {
    181                 // You can use this message or any custom message here
    182                 $result->invalidate( $tag, esc_html__( 'Nonce verification failed. Please try again.', 'ds-cf7-math-captcha' ) );
    183                 return $result; // Stop further processing if nonce is invalid
    184             }
    185         }
    186        
     175             
    187176        // Initialize variables for captcha calculation
    188177        $finalCechking = '';
     
    247236    $actnVal2_escaped = esc_attr($actnVal2);
    248237    $random_actionVal_escaped = esc_attr($random_actionVal);
    249     $nonce = wp_create_nonce('ds_cf7_math_captcha');
    250     $nonce_escaped = esc_attr($nonce);
     238
    251239    $captcha_icon_url = esc_url(DSCF7_PLUGIN_URL . '/assets/img/icons8-refresh-30.png');
    252240    $captcha_reload_icon_url = esc_url(DSCF7_PLUGIN_URL . '/assets/img/446bcd468478f5bfb7b4e5c804571392_w200.gif');
     
    272260    $ds_cf7_captcha .= '<input type="text" aria-invalid="false" aria-required="true" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" size="5" value="" name="' . esc_attr($tag->name) . '" placeholder="' . esc_attr__('Type your answer', 'ds-cf7-math-captcha') . '" style="width:200px; margin-bottom:10px;" oninput="this.value = this.value.replace(/[^0-9.]/g, \'\').replace(/(\..*)\./g, \'$1\');"></span>';
    273261   
    274     // Nonce field
    275     $ds_cf7_captcha .= '<input type="hidden" name="_wpnonce_ds_cf7_math_captcha" value="' . $nonce_escaped . '">';
    276262    $ds_cf7_captcha .= '</p>';
    277263
     
    302288            array(
    303289                'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ),
    304                 'nonce' => esc_attr( wp_create_nonce( 'ds_cf7_math_captcha' ) )
    305290            )
    306291        );
     
    414399    );
    415400
    416     // Check nonce for security
    417     if ( isset( $_POST['_wpnonce_ds_cf7_math_captcha'] ) ) {
    418         $nonce = sanitize_text_field(wp_unslash($_POST['_wpnonce_ds_cf7_math_captcha']));
    419 
    420         // Verify nonce after unslashing
    421         if ( wp_verify_nonce( $nonce, 'ds_cf7_math_captcha' ) ) {
    422             echo wp_kses( $ds_cf7_captcha, $allowed_html );
    423         }
    424     }
    425 
     401    echo wp_kses( $ds_cf7_captcha, $allowed_html );
    426402    exit;
    427403}
  • ds-cf7-math-captcha/tags/ds-cf7-math-captcha.php

    r3187437 r3193773  
    173173    if( $tag->type == 'dscf7captcha' ) {
    174174       
    175         if ( isset( $_POST['_wpnonce_ds_cf7_math_captcha'] ) ) {
    176             // Remove slashes first
    177             $nonce = sanitize_text_field(wp_unslash( $_POST['_wpnonce_ds_cf7_math_captcha'] ));
    178        
    179             // Verify nonce after unslashing
    180             if (  wp_verify_nonce( $nonce, 'ds_cf7_math_captcha' ) ) {
    181                 // You can use this message or any custom message here
    182                 $result->invalidate( $tag, esc_html__( 'Nonce verification failed. Please try again.', 'ds-cf7-math-captcha' ) );
    183                 return $result; // Stop further processing if nonce is invalid
    184             }
    185         }
    186        
     175             
    187176        // Initialize variables for captcha calculation
    188177        $finalCechking = '';
     
    247236    $actnVal2_escaped = esc_attr($actnVal2);
    248237    $random_actionVal_escaped = esc_attr($random_actionVal);
    249     $nonce = wp_create_nonce('ds_cf7_math_captcha');
    250     $nonce_escaped = esc_attr($nonce);
     238
    251239    $captcha_icon_url = esc_url(DSCF7_PLUGIN_URL . '/assets/img/icons8-refresh-30.png');
    252240    $captcha_reload_icon_url = esc_url(DSCF7_PLUGIN_URL . '/assets/img/446bcd468478f5bfb7b4e5c804571392_w200.gif');
     
    272260    $ds_cf7_captcha .= '<input type="text" aria-invalid="false" aria-required="true" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" size="5" value="" name="' . esc_attr($tag->name) . '" placeholder="' . esc_attr__('Type your answer', 'ds-cf7-math-captcha') . '" style="width:200px; margin-bottom:10px;" oninput="this.value = this.value.replace(/[^0-9.]/g, \'\').replace(/(\..*)\./g, \'$1\');"></span>';
    273261   
    274     // Nonce field
    275     $ds_cf7_captcha .= '<input type="hidden" name="_wpnonce_ds_cf7_math_captcha" value="' . $nonce_escaped . '">';
    276262    $ds_cf7_captcha .= '</p>';
    277263
     
    302288            array(
    303289                'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ),
    304                 'nonce' => esc_attr( wp_create_nonce( 'ds_cf7_math_captcha' ) )
    305290            )
    306291        );
     
    414399    );
    415400
    416     // Check nonce for security
    417     if ( isset( $_POST['_wpnonce_ds_cf7_math_captcha'] ) ) {
    418         $nonce = sanitize_text_field(wp_unslash($_POST['_wpnonce_ds_cf7_math_captcha']));
    419 
    420         // Verify nonce after unslashing
    421         if ( wp_verify_nonce( $nonce, 'ds_cf7_math_captcha' ) ) {
    422             echo wp_kses( $ds_cf7_captcha, $allowed_html );
    423         }
    424     }
    425 
     401    echo wp_kses( $ds_cf7_captcha, $allowed_html );
    426402    exit;
    427403}
  • ds-cf7-math-captcha/trunk/ds-cf7-math-captcha.php

    r3187437 r3193773  
    173173    if( $tag->type == 'dscf7captcha' ) {
    174174       
    175         if ( isset( $_POST['_wpnonce_ds_cf7_math_captcha'] ) ) {
    176             // Remove slashes first
    177             $nonce = sanitize_text_field(wp_unslash( $_POST['_wpnonce_ds_cf7_math_captcha'] ));
    178        
    179             // Verify nonce after unslashing
    180             if (  wp_verify_nonce( $nonce, 'ds_cf7_math_captcha' ) ) {
    181                 // You can use this message or any custom message here
    182                 $result->invalidate( $tag, esc_html__( 'Nonce verification failed. Please try again.', 'ds-cf7-math-captcha' ) );
    183                 return $result; // Stop further processing if nonce is invalid
    184             }
    185         }
    186        
     175             
    187176        // Initialize variables for captcha calculation
    188177        $finalCechking = '';
     
    247236    $actnVal2_escaped = esc_attr($actnVal2);
    248237    $random_actionVal_escaped = esc_attr($random_actionVal);
    249     $nonce = wp_create_nonce('ds_cf7_math_captcha');
    250     $nonce_escaped = esc_attr($nonce);
     238
    251239    $captcha_icon_url = esc_url(DSCF7_PLUGIN_URL . '/assets/img/icons8-refresh-30.png');
    252240    $captcha_reload_icon_url = esc_url(DSCF7_PLUGIN_URL . '/assets/img/446bcd468478f5bfb7b4e5c804571392_w200.gif');
     
    272260    $ds_cf7_captcha .= '<input type="text" aria-invalid="false" aria-required="true" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" size="5" value="" name="' . esc_attr($tag->name) . '" placeholder="' . esc_attr__('Type your answer', 'ds-cf7-math-captcha') . '" style="width:200px; margin-bottom:10px;" oninput="this.value = this.value.replace(/[^0-9.]/g, \'\').replace(/(\..*)\./g, \'$1\');"></span>';
    273261   
    274     // Nonce field
    275     $ds_cf7_captcha .= '<input type="hidden" name="_wpnonce_ds_cf7_math_captcha" value="' . $nonce_escaped . '">';
    276262    $ds_cf7_captcha .= '</p>';
    277263
     
    302288            array(
    303289                'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ),
    304                 'nonce' => esc_attr( wp_create_nonce( 'ds_cf7_math_captcha' ) )
    305290            )
    306291        );
     
    414399    );
    415400
    416     // Check nonce for security
    417     if ( isset( $_POST['_wpnonce_ds_cf7_math_captcha'] ) ) {
    418         $nonce = sanitize_text_field(wp_unslash($_POST['_wpnonce_ds_cf7_math_captcha']));
    419 
    420         // Verify nonce after unslashing
    421         if ( wp_verify_nonce( $nonce, 'ds_cf7_math_captcha' ) ) {
    422             echo wp_kses( $ds_cf7_captcha, $allowed_html );
    423         }
    424     }
    425 
     401    echo wp_kses( $ds_cf7_captcha, $allowed_html );
    426402    exit;
    427403}
Note: See TracChangeset for help on using the changeset viewer.