Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phame/skins/PhameSkinSpecification.php
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | foreach ($paths as $path) { | ||||
return $spec; | return $spec; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
return null; | return null; | ||||
} | } | ||||
private static function loadSkinSpecification($path) { | private static function loadSkinSpecification($path) { | ||||
$config_path = $path.DIRECTORY_SEPARATOR.'skin.json'; | $config_path = $path.DIRECTORY_SEPARATOR.'skin.json'; | ||||
$config = array(); | $config = array(); | ||||
if (Filesystem::pathExists($config_path)) { | if (Filesystem::pathExists($config_path)) { | ||||
$config = Filesystem::readFile($config_path); | $config = Filesystem::readFile($config_path); | ||||
$config = json_decode($config, true); | try { | ||||
if (!is_array($config)) { | $config = phutil_json_decode($config); | ||||
throw new Exception( | } catch (PhutilJSONParserException $ex) { | ||||
"Skin configuration file '{$config_path}' is not a valid JSON file."); | throw new PhutilProxyException( | ||||
pht( | |||||
"Skin configuration file '%s' is not a valid JSON file.", | |||||
$config_path), | |||||
$ex); | |||||
} | } | ||||
$type = idx($config, 'type', self::TYPE_BASIC); | $type = idx($config, 'type', self::TYPE_BASIC); | ||||
} else { | } else { | ||||
$type = self::TYPE_BASIC; | $type = self::TYPE_BASIC; | ||||
} | } | ||||
$spec = new PhameSkinSpecification(); | $spec = new PhameSkinSpecification(); | ||||
$spec->setRootDirectory($path); | $spec->setRootDirectory($path); | ||||
▲ Show 20 Lines • Show All 78 Lines • Show Last 20 Lines |