This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_ajax_nopriv_ajax_submit_form', 'ajax_submit_form' ); | |
add_action( 'wp_ajax_ajax_submit_form', 'ajax_submit_form' ); | |
function ajax_submit_form() { | |
// verifico che il nonce sia valido | |
if ( ! wp_verify_nonce( $_POST['nonce'], 'submit_form' ) ) { | |
wp_send_json_error( 'Nonce non valido' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function detect_device() { | |
$tablet_browser = 0; | |
$mobile_browser = 0; | |
if (preg_match('/(tablet|ipad|playbook)|(android(?!.*(mobi|opera mini)))/i', strtolower($_SERVER['HTTP_USER_AGENT']))) { | |
$tablet_browser++; | |
} |