2015-05-08 20:37:07 +02:00
|
|
|
<?php namespace Flarum;
|
|
|
|
|
|
|
|
class Core
|
|
|
|
{
|
|
|
|
public static function isInstalled()
|
|
|
|
{
|
2015-06-30 23:29:52 +02:00
|
|
|
return app()->bound('flarum.config');
|
2015-05-08 20:37:07 +02:00
|
|
|
}
|
2015-05-19 10:59:57 +09:30
|
|
|
|
2015-06-20 20:38:44 +02:00
|
|
|
public static function inDebugMode()
|
|
|
|
{
|
2015-07-02 23:14:25 +02:00
|
|
|
return static::isInstalled() && app('flarum.config')['debug'];
|
2015-06-20 20:38:44 +02:00
|
|
|
}
|
|
|
|
|
2015-05-19 10:59:57 +09:30
|
|
|
public static function config($key, $default = null)
|
|
|
|
{
|
2015-05-27 16:25:44 +09:30
|
|
|
if (! static::isInstalled()) {
|
|
|
|
return $default;
|
|
|
|
}
|
|
|
|
|
2015-06-30 23:29:52 +02:00
|
|
|
if (is_null($value = app('flarum.db')->table('config')->where('key', $key)->pluck('value'))) {
|
2015-05-19 10:59:57 +09:30
|
|
|
$value = $default;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $value;
|
|
|
|
}
|
2015-05-08 20:37:07 +02:00
|
|
|
}
|