示例#1
0
 public static function getConfig()
 {
     if (!isset(static::$json)) {
         $resources = new Resources();
         $configPath = $resources->getPath('config');
         static::$json = json_decode(file_get_contents($configPath . 'packages.json'), true);
     }
     return static::$json;
 }
示例#2
0
 protected static function _getAPI()
 {
     $slug = static::$slug;
     $url = Core::$API_HOST . "data/{$slug}";
     $site = Core::$sSite;
     $curl = $site->curl;
     $url = Core::urlAddKey($url);
     $curl->get($url);
     $json = $curl->response;
     $save = array('slug' => $slug, 'lastUpdate' => time(), 'json' => $json);
     $query = "INSERT INTO " . $site->pdo->TP . "wowCache (slug, lastUpdate, json) VALUES " . "(:slug, :lastUpdate, :json) " . " ON DUPLICATE KEY UPDATE " . "lastUpdate = :lastUpdate, json = :json";
     $site->pdo->query($query, $save);
     static::$json = $json;
     static::$array = json_decode($json, true);
     return true;
 }
示例#3
0
 /**
  * Get the JSON payload for the request.
  *
  * @return object
  */
 public static function json()
 {
     if (!is_null(static::$json)) {
         return static::$json;
     }
     return static::$json = json_decode(Request::foundation()->getContent());
 }