コード例 #1
0
 /**
  * Check if there is an upgrade available
  *
  * @return bool|mixed
  */
 public function has_upgrade()
 {
     // Check if there are upgrades available.
     $path = $this->get_directory() . DIRECTORY_SEPARATOR . sprintf('%s.php', $this->slug);
     if (!is_file($path)) {
         $headers = array('version' => '0.0.0');
     } else {
         $headers = get_file_data($path, array('version' => 'Version'));
     }
     $latest_version = Stencil_Installable_Versions::get($this);
     return version_compare($headers['version'], $latest_version, '<');
 }
コード例 #2
0
 /**
  * Load versions from json file.
  *
  * @return array|bool
  */
 private static function load()
 {
     if (self::$loaded) {
         return;
     }
     self::$loaded = true;
     $filename = 'https://raw.githubusercontent.com/moorscode/stencil/master/config/versions.json';
     $versions_json = file_get_contents($filename);
     if (empty($versions_json)) {
         return;
     }
     $decoded = json_decode($versions_json, true);
     if (is_array($decoded)) {
         self::$versions = $decoded;
     }
 }