Changeset 3193773
- Timestamp:
- 11/21/2024 05:53:01 AM (15 months ago)
- Location:
- ds-cf7-math-captcha
- Files:
-
- 5 edited
-
3.0.1/ds-cf7-math-captcha.php (modified) (5 diffs)
-
ds-cf7-math-captcha.php (modified) (5 diffs)
-
tags/3.0.1/ds-cf7-math-captcha.php (modified) (5 diffs)
-
tags/ds-cf7-math-captcha.php (modified) (5 diffs)
-
trunk/ds-cf7-math-captcha.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ds-cf7-math-captcha/3.0.1/ds-cf7-math-captcha.php
r3187437 r3193773 173 173 if( $tag->type == 'dscf7captcha' ) { 174 174 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 187 176 // Initialize variables for captcha calculation 188 177 $finalCechking = ''; … … 247 236 $actnVal2_escaped = esc_attr($actnVal2); 248 237 $random_actionVal_escaped = esc_attr($random_actionVal); 249 $nonce = wp_create_nonce('ds_cf7_math_captcha'); 250 $nonce_escaped = esc_attr($nonce); 238 251 239 $captcha_icon_url = esc_url(DSCF7_PLUGIN_URL . '/assets/img/icons8-refresh-30.png'); 252 240 $captcha_reload_icon_url = esc_url(DSCF7_PLUGIN_URL . '/assets/img/446bcd468478f5bfb7b4e5c804571392_w200.gif'); … … 272 260 $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>'; 273 261 274 // Nonce field275 $ds_cf7_captcha .= '<input type="hidden" name="_wpnonce_ds_cf7_math_captcha" value="' . $nonce_escaped . '">';276 262 $ds_cf7_captcha .= '</p>'; 277 263 … … 302 288 array( 303 289 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), 304 'nonce' => esc_attr( wp_create_nonce( 'ds_cf7_math_captcha' ) )305 290 ) 306 291 ); … … 414 399 ); 415 400 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 ); 426 402 exit; 427 403 } -
ds-cf7-math-captcha/ds-cf7-math-captcha.php
r3187437 r3193773 173 173 if( $tag->type == 'dscf7captcha' ) { 174 174 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 187 176 // Initialize variables for captcha calculation 188 177 $finalCechking = ''; … … 247 236 $actnVal2_escaped = esc_attr($actnVal2); 248 237 $random_actionVal_escaped = esc_attr($random_actionVal); 249 $nonce = wp_create_nonce('ds_cf7_math_captcha'); 250 $nonce_escaped = esc_attr($nonce); 238 251 239 $captcha_icon_url = esc_url(DSCF7_PLUGIN_URL . '/assets/img/icons8-refresh-30.png'); 252 240 $captcha_reload_icon_url = esc_url(DSCF7_PLUGIN_URL . '/assets/img/446bcd468478f5bfb7b4e5c804571392_w200.gif'); … … 272 260 $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>'; 273 261 274 // Nonce field275 $ds_cf7_captcha .= '<input type="hidden" name="_wpnonce_ds_cf7_math_captcha" value="' . $nonce_escaped . '">';276 262 $ds_cf7_captcha .= '</p>'; 277 263 … … 302 288 array( 303 289 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), 304 'nonce' => esc_attr( wp_create_nonce( 'ds_cf7_math_captcha' ) )305 290 ) 306 291 ); … … 414 399 ); 415 400 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 ); 426 402 exit; 427 403 } -
ds-cf7-math-captcha/tags/3.0.1/ds-cf7-math-captcha.php
r3187493 r3193773 173 173 if( $tag->type == 'dscf7captcha' ) { 174 174 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 187 176 // Initialize variables for captcha calculation 188 177 $finalCechking = ''; … … 247 236 $actnVal2_escaped = esc_attr($actnVal2); 248 237 $random_actionVal_escaped = esc_attr($random_actionVal); 249 $nonce = wp_create_nonce('ds_cf7_math_captcha'); 250 $nonce_escaped = esc_attr($nonce); 238 251 239 $captcha_icon_url = esc_url(DSCF7_PLUGIN_URL . '/assets/img/icons8-refresh-30.png'); 252 240 $captcha_reload_icon_url = esc_url(DSCF7_PLUGIN_URL . '/assets/img/446bcd468478f5bfb7b4e5c804571392_w200.gif'); … … 272 260 $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>'; 273 261 274 // Nonce field275 $ds_cf7_captcha .= '<input type="hidden" name="_wpnonce_ds_cf7_math_captcha" value="' . $nonce_escaped . '">';276 262 $ds_cf7_captcha .= '</p>'; 277 263 … … 302 288 array( 303 289 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), 304 'nonce' => esc_attr( wp_create_nonce( 'ds_cf7_math_captcha' ) )305 290 ) 306 291 ); … … 414 399 ); 415 400 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 ); 426 402 exit; 427 403 } -
ds-cf7-math-captcha/tags/ds-cf7-math-captcha.php
r3187437 r3193773 173 173 if( $tag->type == 'dscf7captcha' ) { 174 174 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 187 176 // Initialize variables for captcha calculation 188 177 $finalCechking = ''; … … 247 236 $actnVal2_escaped = esc_attr($actnVal2); 248 237 $random_actionVal_escaped = esc_attr($random_actionVal); 249 $nonce = wp_create_nonce('ds_cf7_math_captcha'); 250 $nonce_escaped = esc_attr($nonce); 238 251 239 $captcha_icon_url = esc_url(DSCF7_PLUGIN_URL . '/assets/img/icons8-refresh-30.png'); 252 240 $captcha_reload_icon_url = esc_url(DSCF7_PLUGIN_URL . '/assets/img/446bcd468478f5bfb7b4e5c804571392_w200.gif'); … … 272 260 $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>'; 273 261 274 // Nonce field275 $ds_cf7_captcha .= '<input type="hidden" name="_wpnonce_ds_cf7_math_captcha" value="' . $nonce_escaped . '">';276 262 $ds_cf7_captcha .= '</p>'; 277 263 … … 302 288 array( 303 289 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), 304 'nonce' => esc_attr( wp_create_nonce( 'ds_cf7_math_captcha' ) )305 290 ) 306 291 ); … … 414 399 ); 415 400 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 ); 426 402 exit; 427 403 } -
ds-cf7-math-captcha/trunk/ds-cf7-math-captcha.php
r3187437 r3193773 173 173 if( $tag->type == 'dscf7captcha' ) { 174 174 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 187 176 // Initialize variables for captcha calculation 188 177 $finalCechking = ''; … … 247 236 $actnVal2_escaped = esc_attr($actnVal2); 248 237 $random_actionVal_escaped = esc_attr($random_actionVal); 249 $nonce = wp_create_nonce('ds_cf7_math_captcha'); 250 $nonce_escaped = esc_attr($nonce); 238 251 239 $captcha_icon_url = esc_url(DSCF7_PLUGIN_URL . '/assets/img/icons8-refresh-30.png'); 252 240 $captcha_reload_icon_url = esc_url(DSCF7_PLUGIN_URL . '/assets/img/446bcd468478f5bfb7b4e5c804571392_w200.gif'); … … 272 260 $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>'; 273 261 274 // Nonce field275 $ds_cf7_captcha .= '<input type="hidden" name="_wpnonce_ds_cf7_math_captcha" value="' . $nonce_escaped . '">';276 262 $ds_cf7_captcha .= '</p>'; 277 263 … … 302 288 array( 303 289 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), 304 'nonce' => esc_attr( wp_create_nonce( 'ds_cf7_math_captcha' ) )305 290 ) 306 291 ); … … 414 399 ); 415 400 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 ); 426 402 exit; 427 403 }
Note: See TracChangeset
for help on using the changeset viewer.