You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
808 B
38 lines
808 B
11 years ago
|
<?php
|
||
|
|
||
|
class RSSThemes extends Model {
|
||
|
private static $themes_dir = '/themes';
|
||
|
|
||
|
private static $list = array();
|
||
|
|
||
|
public static function init() {
|
||
|
$basedir = PUBLIC_PATH . self::$themes_dir;
|
||
|
|
||
|
$themes_list = array_diff(
|
||
|
scandir($basedir),
|
||
|
array('..', '.')
|
||
|
);
|
||
|
|
||
|
foreach ($themes_list as $theme_dir) {
|
||
|
$json_filename = $basedir . '/' . $theme_dir . '/metadata.json';
|
||
|
if(file_exists($json_filename)) {
|
||
|
$content = file_get_contents($json_filename);
|
||
|
$res = json_decode($content, true);
|
||
|
|
||
|
if($res &&
|
||
|
isset($res['name']) &&
|
||
|
isset($res['author']) &&
|
||
|
isset($res['description']) &&
|
||
|
isset($res['version'])) {
|
||
|
$theme = $res;
|
||
|
$theme['path'] = $theme_dir;
|
||
|
self::$list[] = $theme;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static function get() {
|
||
|
return self::$list;
|
||
|
}
|
||
|
}
|