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() {
|
||||
if(!is_admin()) {
|
||||
add_action('widgets_init', array($this, 'registerWidget'));
|
||||
|
||||
if(!is_admin()) {
|
||||
add_action('widgets_init', array($this, 'setupActions'));
|
||||
add_action('widgets_init', array($this, 'setupDependencies'));
|
||||
}
|
||||
|
@@ -8,9 +8,7 @@ class Subscribers {
|
||||
function __construct() {
|
||||
}
|
||||
|
||||
function get() {
|
||||
if(isset($_POST['data'])) {
|
||||
$data = $_POST['data'];
|
||||
function get($data = array()) {
|
||||
$offset = (isset($data['offset']) ? (int)$data['offset'] : 0);
|
||||
$limit = (isset($data['limit']) ? (int)$data['limit'] : 50);
|
||||
$search = (isset($data['search']) ? $data['search'] : null);
|
||||
@@ -26,16 +24,25 @@ class Subscribers {
|
||||
);
|
||||
}
|
||||
|
||||
// filters
|
||||
$filters = array(
|
||||
|
||||
);
|
||||
|
||||
$collection = array(
|
||||
'count' => $collection->count(),
|
||||
'filters' => $filters,
|
||||
'items' => $collection
|
||||
->offset($offset)
|
||||
->limit($limit)
|
||||
->find_array()
|
||||
);
|
||||
} else {
|
||||
$collection = Subscriber::find_array();
|
||||
|
||||
wp_send_json($collection);
|
||||
}
|
||||
|
||||
function getAll() {
|
||||
$collection = Subscriber::find_array();
|
||||
wp_send_json($collection);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user