diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-02-03 07:47:27 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-02-03 07:47:27 +0400 |
commit | 883ecc81b96336d3a61fb193af51ecd3fb9b6d91 (patch) | |
tree | 46b04484dbe42dc3afdb7767e1bfe3c1ab17d1ed /plugins/CoreAdminHome/CustomLogo.php | |
parent | 3332750e51f995044cb25260bc3a61d454d02f26 (diff) |
refs #4563 moved custom logo from config to database
Diffstat (limited to 'plugins/CoreAdminHome/CustomLogo.php')
-rw-r--r-- | plugins/CoreAdminHome/CustomLogo.php | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/plugins/CoreAdminHome/CustomLogo.php b/plugins/CoreAdminHome/CustomLogo.php index 8e1dfc58dd..bc1f1da055 100644 --- a/plugins/CoreAdminHome/CustomLogo.php +++ b/plugins/CoreAdminHome/CustomLogo.php @@ -10,6 +10,7 @@ namespace Piwik\Plugins\CoreAdminHome; use Piwik\Config; use Piwik\Filesystem; +use Piwik\Option; use Piwik\SettingsPiwik; class CustomLogo @@ -42,14 +43,29 @@ class CustomLogo return $svg; } + public function isEnabled() + { + return (bool) Option::get('branding_use_custom_logo'); + } + + public function enable() + { + Option::set('branding_use_custom_logo', '1', true); + } + + public function disable() + { + Option::set('branding_use_custom_logo', '0', true); + } + public function hasSVGLogo() { - if (Config::getInstance()->branding['use_custom_logo'] == 0) { + if (!$this->isEnabled()) { /* We always have our application logo */ return true; } - if (Config::getInstance()->branding['use_custom_logo'] == 1 + if ($this->isEnabled() && file_exists(Filesystem::getPathToPiwikRoot() . '/' . CustomLogo::getPathUserSvgLogo()) ) { return true; @@ -93,7 +109,7 @@ class CustomLogo if (file_exists($pathToPiwikRoot . '/' . $themeLogo)) { $logo = $themeLogo; } - if (Config::getInstance()->branding['use_custom_logo'] == 1 + if ($this->isEnabled() && file_exists($pathToPiwikRoot . '/' . $customLogo) ) { $logo = $customLogo; |