コード例 #1
0
ファイル: he-ib.php プロジェクト: hungtran0203/he-ib
 public static function ajaxProcess()
 {
     $res = new HEIBResponse();
     $res = HEIBApp::processEndpoint($res);
     echo $res->toJson();
     exit;
 }
コード例 #2
0
ファイル: endpoints.php プロジェクト: hungtran0203/he-ib
add_filter('heib_process_endpoint__batch', function ($res) {
    //sanity box data
    $query = $res->query();
    if (!isset($query['batch'])) {
        $res->error = 2;
        $res->errMsg = 'No data provided';
    } else {
        $batchData = $query['batch'];
        if (!is_array($batchData)) {
            $res->error = 2;
            $res->errMsg = 'Invalid batch query';
        } else {
            $data = array_map(function ($batch) use($query) {
                $batchQuery = array_merge($query, $batch);
                $res = new HEIBResponse($batchQuery);
                $res = HEIBApp::processEndpoint($res);
                return $res->toObject();
            }, $batchData);
            $res->data = $data;
        }
    }
    return $res;
});
/* 
	get box pattern
*/
add_filter('heib_process_endpoint__box.permalinks.get', function ($res) {
    $permalinks = new stdClass();
    $boxLab = get_option('heib_boxes_data');
    if (isset($boxLab['boxes']) && is_array($boxLab['boxes'])) {
        foreach ($boxLab['boxes'] as $box) {