fixed widget + test + split get method in sub router
This commit is contained in:
committed by
marco
parent
703fd17932
commit
d81c4e7aa1
@@ -9,8 +9,9 @@ class Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
if(!is_admin()) {
|
|
||||||
add_action('widgets_init', array($this, 'registerWidget'));
|
add_action('widgets_init', array($this, 'registerWidget'));
|
||||||
|
|
||||||
|
if(!is_admin()) {
|
||||||
add_action('widgets_init', array($this, 'setupActions'));
|
add_action('widgets_init', array($this, 'setupActions'));
|
||||||
add_action('widgets_init', array($this, 'setupDependencies'));
|
add_action('widgets_init', array($this, 'setupDependencies'));
|
||||||
}
|
}
|
||||||
|
@@ -8,9 +8,7 @@ class Subscribers {
|
|||||||
function __construct() {
|
function __construct() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function get() {
|
function get($data = array()) {
|
||||||
if(isset($_POST['data'])) {
|
|
||||||
$data = $_POST['data'];
|
|
||||||
$offset = (isset($data['offset']) ? (int)$data['offset'] : 0);
|
$offset = (isset($data['offset']) ? (int)$data['offset'] : 0);
|
||||||
$limit = (isset($data['limit']) ? (int)$data['limit'] : 50);
|
$limit = (isset($data['limit']) ? (int)$data['limit'] : 50);
|
||||||
$search = (isset($data['search']) ? $data['search'] : null);
|
$search = (isset($data['search']) ? $data['search'] : null);
|
||||||
@@ -26,16 +24,25 @@ class Subscribers {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// filters
|
||||||
|
$filters = array(
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
$collection = array(
|
$collection = array(
|
||||||
'count' => $collection->count(),
|
'count' => $collection->count(),
|
||||||
|
'filters' => $filters,
|
||||||
'items' => $collection
|
'items' => $collection
|
||||||
->offset($offset)
|
->offset($offset)
|
||||||
->limit($limit)
|
->limit($limit)
|
||||||
->find_array()
|
->find_array()
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
$collection = Subscriber::find_array();
|
wp_send_json($collection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getAll() {
|
||||||
|
$collection = Subscriber::find_array();
|
||||||
wp_send_json($collection);
|
wp_send_json($collection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user