ajax( str_replace( '/' . AJAXFLOW_TAG . '/', '', $_REQUEST['q'] ) ); } } function template_redirect() { $action = get_query_var( AJAXFLOW_TAG ); if ( ! empty( $action ) ) { $this->ajax( $action ); exit; } } function register_activation_hook() { $this->init(); flush_rewrite_rules(); } function ajax( $action ) { define( 'DOING_AJAX', true ); if ( empty( $action ) ) return; ini_set( 'html_errors', 0 ); if ( AJAXFLOW_NONCE ) { if ( ! wp_verify_nonce( $action, $_REQUEST['_wpnonce'] ) ) { wp_die( 'Security check didn“t pass, please check _wpnonce!', AJAXFLOW_TAG ); } } $shortinit = apply_filters( AJAXFLOW_TAG . '_shortinit', false, $action ); if ( $shortinit || ( isset( $_REQUEST['shortinit'] ) && $_REQUEST['shortinit'] ) ) { define( 'SHORTINIT', true ); } require_once( ABSPATH . '/wp-load.php' ); header( 'Content-Type: text/html' ); send_nosniff_header(); header( 'Cache-Control: no-cache' ); header( 'Pragma: no-cache' ); do_action( AJAXFLOW_TAG . '_shortinit_load' ); if ( is_user_logged_in() ) { do_action( AJAXFLOW_TAG . '_' . $action ); } else do_action( AJAXFLOW_TAG . '_nopriv_' . $action ); wp_die( 'Your ' . AJAXFLOW_TAG . ' call does not exists or exit is missing in action!', AJAXFLOW_TAG ); exit; } } $_ajaxflow = new AjaxFlow();