예제 #1
0
파일: api.php 프로젝트: nyan-cat/easyweb
 function batch($params, $get)
 {
     $result = $this->request('POST', '/batch', $get, $params);
     $array = [];
     foreach ($result as $name => $value) {
         $array[$name] = json\decode(json\encode($value));
         # TODO: Replace with fast solution
     }
     return $array;
 }
예제 #2
0
 private function preprocess(&$params)
 {
     foreach ($this->params as $name => $options) {
         if (isset($options->type)) {
             datatype::assert($options->type, $params[$name]);
         }
         if (isset($options->filter) and $options->filter == 'json') {
             $params[$name] = json\encode($params[$name]);
         }
     }
 }
예제 #3
0
 protected function actionCheckDeleteCron($params)
 {
     if (!GO::modules()->isInstalled('cron')) {
         echo json\encode(array('success' => true, 'data' => array('enabled' => false, 'reason' => 'noCronModule')));
         return;
     }
     $cronJob = GO\Base\Cron\CronJob::model()->findSingleByAttribute('job', 'GO\\Files\\Cron\\DeleteExpiredLinks');
     if (!$cronJob) {
         echo json_encode(array('success' => true, 'data' => array('enabled' => false, 'reason' => 'noCronJob')));
         return;
     }
     echo json_encode(array('success' => true, 'data' => array('enabled' => $cronJob->active)));
 }
예제 #4
0
파일: www.php 프로젝트: nyan-cat/easyweb
 static function encode($object)
 {
     return json\encode($object, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
 }
예제 #5
0
 private static function digest($mixed)
 {
     return hash_hmac(self::$algorithm, json\encode($mixed), self::$salt);
 }