35 public function __construct()
37 $this->registerActions();
46 public function registerActions()
48 $actions = $this->actions();
49 foreach ( $actions as $method => $nopriv ) {
50 add_action(
'wp_ajax_' . $method, array( $this, $method ) );
52 add_action(
'wp_ajax_nopriv_' . $method, array( $this, $method ) );
67 public static function add( $method, $callable, $nopriv =
false )
69 add_action(
'wp_ajax_' . $method, $callable );
71 add_action(
'wp_ajax_nopriv_' . $method, $callable );
83 protected function actions()
112 public $__version =
'1.0.3';
130 public $message =
'';
148 public function __construct()
157 public function json()
159 header(
'Cache-Control: no-cache, must-revalidate' );
160 header(
'Expires: Mon, 26 Jul 1997 05:00:00 GMT' );
161 header(
'Content-Type: application/json' );
163 echo json_encode( $this );
165 if ( defined(
'DOING_AJAX' ) && DOING_AJAX ) {