is_ajax() public static method

public static is_ajax ( )
コード例 #1
0
ファイル: Headers.php プロジェクト: pfkellogg/hooks_good_one
 public function after_output()
 {
     # flush once, because we're nice
     if (QM_Util::is_ajax() and ob_get_length()) {
         ob_flush();
     }
 }
コード例 #2
0
 public function output()
 {
     if (!QM_Util::is_ajax()) {
         return;
     }
     $data = $this->collector->get_data();
     if (empty($data['errors'])) {
         return;
     }
     $count = 0;
     foreach ($data['errors'] as $type => $errors) {
         foreach ($errors as $key => $error) {
             $count++;
             # @TODO we should calculate the component during process() so we don't need to do it
             # separately in each output.
             $component = $error->trace->get_component();
             $output_error = array('type' => $error->type, 'message' => wp_strip_all_tags($error->message), 'file' => $error->file, 'line' => $error->line, 'stack' => $error->trace->get_stack(), 'component' => $component->name);
             header(sprintf('X-QM-Error-%d: %s', $count, json_encode($output_error)));
         }
     }
     header(sprintf('X-QM-Errors: %d', $count));
 }
コード例 #3
0
ファイル: AJAX.php プロジェクト: rene-hermenau/query-monitor
 public function is_active()
 {
     if (!QM_Util::is_ajax()) {
         return false;
     }
     if (!$this->user_can_view()) {
         return false;
     }
     # If the headers have already been sent then we can't do anything about it
     if (headers_sent()) {
         return false;
     }
     # Don't process if the minimum required actions haven't fired:
     if (is_admin()) {
         if (!did_action('admin_init')) {
             return false;
         }
     } else {
         if (!did_action('wp')) {
             return false;
         }
     }
     return true;
 }