diff --git a/app/Http/Home/Views/partials/footer.volt b/app/Http/Home/Views/partials/footer.volt
index 0091c574..ddd34157 100644
--- a/app/Http/Home/Views/partials/footer.volt
+++ b/app/Http/Home/Views/partials/footer.volt
@@ -38,11 +38,11 @@
{% endif %}
{% if contact_info.weibo %}
{% set link_url = 'https://weibo.com/u/%s'|format(contact_info.weibo) %}
-
+
{% endif %}
{% if contact_info.zhihu %}
{% set link_url = 'https://www.zhihu.com/people/%s'|format(contact_info.zhihu) %}
-
+
{% endif %}
{% if contact_info.email %}
{% set link_url = 'mailto:%s'|format(contact_info.email) %}
@@ -53,8 +53,8 @@
{% endif %}
{% if contact_info.address %}
{% set link_url = 'https://map.baidu.com/search/%s?querytype=s&wd=%s'|format(contact_info.address,contact_info.address) %}
-
+
{% endif %}
{% endif %}
-
\ No newline at end of file
+
diff --git a/app/Library/CsrfToken.php b/app/Library/CsrfToken.php
index fe09c600..25fd24c8 100644
--- a/app/Library/CsrfToken.php
+++ b/app/Library/CsrfToken.php
@@ -70,9 +70,9 @@ class CsrfToken
*/
$config = Di::getDefault()->getShared('config');
- $lifetime = $config->path('csrf_token.lifetime') ?: $this->lifetime;
+ $lifetime = $config->path('csrf_token.lifetime', $this->lifetime);
return $lifetime + time();
}
-}
\ No newline at end of file
+}
diff --git a/app/Library/Logger.php b/app/Library/Logger.php
index 0b7cc17b..645d5719 100644
--- a/app/Library/Logger.php
+++ b/app/Library/Logger.php
@@ -19,15 +19,13 @@ class Logger
* @param string $channel
* @return FileLogger
*/
- public function getInstance($channel = null)
+ public function getInstance($channel = 'common')
{
/**
* @var Config $config
*/
$config = Di::getDefault()->getShared('config');
- $channel = $channel ? $channel : 'common';
-
$filename = sprintf('%s-%s.log', $channel, date('Y-m-d'));
$path = log_path($filename);
diff --git a/app/Services/Logic/Chapter/ChapterUserTrait.php b/app/Services/Logic/Chapter/ChapterUserTrait.php
index ff84fbee..6a30056f 100644
--- a/app/Services/Logic/Chapter/ChapterUserTrait.php
+++ b/app/Services/Logic/Chapter/ChapterUserTrait.php
@@ -9,7 +9,6 @@ namespace App\Services\Logic\Chapter;
use App\Models\Chapter as ChapterModel;
use App\Models\ChapterUser as ChapterUserModel;
-use App\Models\CourseUser as CourseUserModel;
use App\Models\User as UserModel;
use App\Repos\ChapterUser as ChapterUserRepo;
@@ -37,9 +36,6 @@ trait ChapterUserTrait
$chapterUser = null;
- /**
- * @var CourseUserModel $courseUser
- */
$courseUser = $this->courseUser;
if ($courseUser) {
diff --git a/bootstrap/ConsoleKernel.php b/bootstrap/ConsoleKernel.php
index d44470d0..63546f64 100644
--- a/bootstrap/ConsoleKernel.php
+++ b/bootstrap/ConsoleKernel.php
@@ -31,10 +31,9 @@ class ConsoleKernel extends Kernel
$this->loader = new Loader();
$this->initAppEnv();
- $this->initAppConfig();
- $this->initAppSetting();
$this->registerLoaders();
$this->registerServices();
+ $this->registerSettings();
$this->registerErrorHandler();
}
diff --git a/bootstrap/HttpKernel.php b/bootstrap/HttpKernel.php
index 06aa8ba4..7ab1a463 100644
--- a/bootstrap/HttpKernel.php
+++ b/bootstrap/HttpKernel.php
@@ -40,11 +40,10 @@ class HttpKernel extends Kernel
$this->loader = new Loader();
$this->initAppEnv();
- $this->initAppConfig();
- $this->initAppSetting();
$this->registerLoaders();
$this->registerServices();
$this->registerModules();
+ $this->registerSettings();
$this->registerErrorHandler();
}
diff --git a/bootstrap/Kernel.php b/bootstrap/Kernel.php
index e4650f57..fe84b175 100644
--- a/bootstrap/Kernel.php
+++ b/bootstrap/Kernel.php
@@ -8,6 +8,7 @@
namespace Bootstrap;
use Phalcon\Application;
+use Phalcon\Config;
use Phalcon\Di;
use Phalcon\Loader;
@@ -29,36 +30,21 @@ abstract class Kernel
*/
protected $loader;
- /**
- * @var array
- */
- protected $config = [];
-
- public function getApp()
- {
- return $this->app;
- }
-
- public function getDI()
- {
- return $this->di;
- }
-
protected function initAppEnv()
{
require __DIR__ . '/Helper.php';
}
- protected function initAppConfig()
+ protected function registerSettings()
{
- $this->config = require config_path('config.php');
- }
+ /**
+ * @var Config $config
+ */
+ $config = $this->di->getShared('config');
- protected function initAppSetting()
- {
- ini_set('date.timezone', $this->config['timezone']);
+ ini_set('date.timezone', $config->get('timezone'));
- if ($this->config['env'] == ENV_DEV) {
+ if ($config->get('env') == ENV_DEV) {
ini_set('display_errors', 1);
error_reporting(E_ALL);
} else {