QM_Util::is_async PHP Method

is_async() public static method

public static is_async ( )
        public static function is_async()
        {
            if (self::is_ajax()) {
                return true;
            }
            if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) and 'xmlhttprequest' === strtolower($_SERVER['HTTP_X_REQUESTED_WITH'])) {
                return true;
            }
            return false;
        }

Usage Example

 public function process()
 {
     global $wp_rewrite;
     if (is_admin() or QM_Util::is_async()) {
         return;
     }
     if (!($request = QM_Collectors::get('request'))) {
         return;
     }
     if (empty($wp_rewrite->rules)) {
         return;
     }
     $req = $request->data['request']['request'];
     $matching = array();
     foreach ($wp_rewrite->rules as $match => $query) {
         if (preg_match("#^{$match}#", $req)) {
             $matching[$match] = $query;
         }
     }
     $this->data['matching'] = $matching;
 }
All Usage Examples Of QM_Util::is_async