@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | <tr><td> |
| 3 | 3 | <table cellspacing="0" cellpadding="0" border="0" width="600px"> |
| 4 | 4 | <tr> |
| 5 | -<td colspan="2" bgcolor="<?php p($theme->getColorPrimary());?>"> |
|
| 5 | +<td colspan="2" bgcolor="<?php p($theme->getColorPrimary()); ?>"> |
|
| 6 | 6 | <img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL(image_path('', 'logo-mail.png'))); ?>" alt="<?php p($theme->getName()); ?>"/> |
| 7 | 7 | </td> |
| 8 | 8 | </tr> |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | <td style="font-weight:normal; font-size:0.8em; line-height:1.2em; font-family:verdana,'arial',sans;"> |
| 13 | 13 | <?php |
| 14 | 14 | print_unescaped($l->t('Hey there,<br><br>just letting you know that %s shared <strong>%s</strong> with you.<br><a href="%s">View it!</a><br><br>', array($_['user_displayname'], $_['filename'], $_['link']))); |
| 15 | -if ( isset($_['expiration']) ) { |
|
| 15 | +if (isset($_['expiration'])) { |
|
| 16 | 16 | p($l->t("The share will expire on %s.", array($_['expiration']))); |
| 17 | 17 | print_unescaped('<br><br>'); |
| 18 | 18 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | <td style="font-weight:normal; font-size:0.8em; line-height:1.2em; font-family:verdana,'arial',sans;">--<br> |
| 28 | 28 | <?php p($theme->getName()); ?> - |
| 29 | 29 | <?php p($theme->getSlogan()); ?> |
| 30 | -<br><a href="<?php p($theme->getBaseUrl()); ?>"><?php p($theme->getBaseUrl());?></a> |
|
| 30 | +<br><a href="<?php p($theme->getBaseUrl()); ?>"><?php p($theme->getBaseUrl()); ?></a> |
|
| 31 | 31 | </td> |
| 32 | 32 | </tr> |
| 33 | 33 | <tr> |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | <tr><td> |
| 3 | 3 | <table cellspacing="0" cellpadding="0" border="0" width="600px"> |
| 4 | 4 | <tr> |
| 5 | - <td colspan="2" bgcolor="<?php p($theme->getColorPrimary());?>" bordercolor="<?php p($theme->getColorPrimary());?>" border> |
|
| 5 | + <td colspan="2" bgcolor="<?php p($theme->getColorPrimary()); ?>" bordercolor="<?php p($theme->getColorPrimary()); ?>" border> |
|
| 6 | 6 | <img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL(image_path('', 'logo-mail.png'))); ?>" alt="<?php p($theme->getName()); ?>"/> |
| 7 | 7 | </td> |
| 8 | 8 | </tr> |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | <td style="font-weight:normal; font-size:0.8em; line-height:1.2em; font-family:verdana,'arial',sans;">--<br> |
| 25 | 25 | <?php p($theme->getName()); ?> - |
| 26 | 26 | <?php p($theme->getSlogan()); ?> |
| 27 | - <br><a href="<?php p($theme->getBaseUrl()); ?>"><?php p($theme->getBaseUrl());?></a> |
|
| 27 | + <br><a href="<?php p($theme->getBaseUrl()); ?>"><?php p($theme->getBaseUrl()); ?></a> |
|
| 28 | 28 | </td> |
| 29 | 29 | </tr> |
| 30 | 30 | <tr> |
@@ -20,135 +20,135 @@ |
||
| 20 | 20 | |
| 21 | 21 | class OC_Theme { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Returns the base URL |
|
| 25 | - * @return string URL |
|
| 26 | - */ |
|
| 27 | - public function getBaseUrl() { |
|
| 28 | - return 'https://nextcloud.com'; |
|
| 29 | - } |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * Returns the URL where the sync clients are listed |
|
| 33 | - * @return string URL |
|
| 34 | - */ |
|
| 35 | - public function getSyncClientUrl() { |
|
| 36 | - return 'https://nextcloud.com/install/#install-clients'; |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * Returns the URL to the App Store for the iOS Client |
|
| 41 | - * @return string URL |
|
| 42 | - */ |
|
| 43 | - public function getiOSClientUrl() { |
|
| 44 | - return 'https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8'; |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * Returns the AppId for the App Store for the iOS Client |
|
| 49 | - * @return string AppId |
|
| 50 | - */ |
|
| 51 | - public function getiTunesAppId() { |
|
| 52 | - return '1125420102'; |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * Returns the URL to Google Play for the Android Client |
|
| 57 | - * @return string URL |
|
| 58 | - */ |
|
| 59 | - public function getAndroidClientUrl() { |
|
| 60 | - return 'https://play.google.com/store/apps/details?id=com.nextcloud.client'; |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Returns the documentation URL |
|
| 65 | - * @return string URL |
|
| 66 | - */ |
|
| 67 | - public function getDocBaseUrl() { |
|
| 68 | - return 'https://docs.nextcloud.com'; |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * Returns the title |
|
| 73 | - * @return string title |
|
| 74 | - */ |
|
| 75 | - public function getTitle() { |
|
| 76 | - return 'Custom Cloud'; |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * Returns the short name of the software |
|
| 81 | - * @return string title |
|
| 82 | - */ |
|
| 83 | - public function getName() { |
|
| 84 | - return 'Custom Cloud'; |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * Returns the short name of the software containing HTML strings |
|
| 89 | - * @return string title |
|
| 90 | - */ |
|
| 91 | - public function getHTMLName() { |
|
| 92 | - return 'Custom Cloud'; |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * Returns entity (e.g. company name) - used for footer, copyright |
|
| 97 | - * @return string entity name |
|
| 98 | - */ |
|
| 99 | - public function getEntity() { |
|
| 100 | - return 'Custom Cloud Co.'; |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * Returns slogan |
|
| 105 | - * @return string slogan |
|
| 106 | - */ |
|
| 107 | - public function getSlogan() { |
|
| 108 | - return 'Your custom cloud, personalized for you!'; |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - /** |
|
| 112 | - * Returns logo claim |
|
| 113 | - * @return string logo claim |
|
| 114 | - */ |
|
| 115 | - public function getLogoClaim() { |
|
| 116 | - return ''; |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - /** |
|
| 120 | - * Returns short version of the footer |
|
| 121 | - * @return string short footer |
|
| 122 | - */ |
|
| 123 | - public function getShortFooter() { |
|
| 124 | - $footer = '© 2016 <a href="'.$this->getBaseUrl().'" target="_blank\">'.$this->getEntity().'</a>'. |
|
| 125 | - '<br/>' . $this->getSlogan(); |
|
| 126 | - |
|
| 127 | - return $footer; |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - /** |
|
| 131 | - * Returns long version of the footer |
|
| 132 | - * @return string long footer |
|
| 133 | - */ |
|
| 134 | - public function getLongFooter() { |
|
| 135 | - $footer = '© 2016 <a href="'.$this->getBaseUrl().'" target="_blank\">'.$this->getEntity().'</a>'. |
|
| 136 | - '<br/>' . $this->getSlogan(); |
|
| 137 | - |
|
| 138 | - return $footer; |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - public function buildDocLinkToKey($key) { |
|
| 142 | - return $this->getDocBaseUrl() . '/server/11/go.php?to=' . $key; |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * Returns mail header color |
|
| 148 | - * @return string |
|
| 149 | - */ |
|
| 150 | - public function getColorPrimary() { |
|
| 151 | - return '#745bca'; |
|
| 152 | - } |
|
| 23 | + /** |
|
| 24 | + * Returns the base URL |
|
| 25 | + * @return string URL |
|
| 26 | + */ |
|
| 27 | + public function getBaseUrl() { |
|
| 28 | + return 'https://nextcloud.com'; |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * Returns the URL where the sync clients are listed |
|
| 33 | + * @return string URL |
|
| 34 | + */ |
|
| 35 | + public function getSyncClientUrl() { |
|
| 36 | + return 'https://nextcloud.com/install/#install-clients'; |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * Returns the URL to the App Store for the iOS Client |
|
| 41 | + * @return string URL |
|
| 42 | + */ |
|
| 43 | + public function getiOSClientUrl() { |
|
| 44 | + return 'https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8'; |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * Returns the AppId for the App Store for the iOS Client |
|
| 49 | + * @return string AppId |
|
| 50 | + */ |
|
| 51 | + public function getiTunesAppId() { |
|
| 52 | + return '1125420102'; |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * Returns the URL to Google Play for the Android Client |
|
| 57 | + * @return string URL |
|
| 58 | + */ |
|
| 59 | + public function getAndroidClientUrl() { |
|
| 60 | + return 'https://play.google.com/store/apps/details?id=com.nextcloud.client'; |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Returns the documentation URL |
|
| 65 | + * @return string URL |
|
| 66 | + */ |
|
| 67 | + public function getDocBaseUrl() { |
|
| 68 | + return 'https://docs.nextcloud.com'; |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * Returns the title |
|
| 73 | + * @return string title |
|
| 74 | + */ |
|
| 75 | + public function getTitle() { |
|
| 76 | + return 'Custom Cloud'; |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * Returns the short name of the software |
|
| 81 | + * @return string title |
|
| 82 | + */ |
|
| 83 | + public function getName() { |
|
| 84 | + return 'Custom Cloud'; |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * Returns the short name of the software containing HTML strings |
|
| 89 | + * @return string title |
|
| 90 | + */ |
|
| 91 | + public function getHTMLName() { |
|
| 92 | + return 'Custom Cloud'; |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * Returns entity (e.g. company name) - used for footer, copyright |
|
| 97 | + * @return string entity name |
|
| 98 | + */ |
|
| 99 | + public function getEntity() { |
|
| 100 | + return 'Custom Cloud Co.'; |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * Returns slogan |
|
| 105 | + * @return string slogan |
|
| 106 | + */ |
|
| 107 | + public function getSlogan() { |
|
| 108 | + return 'Your custom cloud, personalized for you!'; |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + /** |
|
| 112 | + * Returns logo claim |
|
| 113 | + * @return string logo claim |
|
| 114 | + */ |
|
| 115 | + public function getLogoClaim() { |
|
| 116 | + return ''; |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * Returns short version of the footer |
|
| 121 | + * @return string short footer |
|
| 122 | + */ |
|
| 123 | + public function getShortFooter() { |
|
| 124 | + $footer = '© 2016 <a href="'.$this->getBaseUrl().'" target="_blank\">'.$this->getEntity().'</a>'. |
|
| 125 | + '<br/>' . $this->getSlogan(); |
|
| 126 | + |
|
| 127 | + return $footer; |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + /** |
|
| 131 | + * Returns long version of the footer |
|
| 132 | + * @return string long footer |
|
| 133 | + */ |
|
| 134 | + public function getLongFooter() { |
|
| 135 | + $footer = '© 2016 <a href="'.$this->getBaseUrl().'" target="_blank\">'.$this->getEntity().'</a>'. |
|
| 136 | + '<br/>' . $this->getSlogan(); |
|
| 137 | + |
|
| 138 | + return $footer; |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + public function buildDocLinkToKey($key) { |
|
| 142 | + return $this->getDocBaseUrl() . '/server/11/go.php?to=' . $key; |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * Returns mail header color |
|
| 148 | + * @return string |
|
| 149 | + */ |
|
| 150 | + public function getColorPrimary() { |
|
| 151 | + return '#745bca'; |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | 154 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $isIE8 = false; |
| 36 | 36 | preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches); |
| 37 | 37 | if (count($matches) > 0 && $matches[1] <= 9) { |
| 38 | - $isIE8 = true; |
|
| 38 | + $isIE8 = true; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $cloudID = \OC::$server->getUserSession()->getUser()->getCloudId(); |
@@ -45,15 +45,15 @@ discard block |
||
| 45 | 45 | $color = $theme->getColorPrimary(); |
| 46 | 46 | $textColor = "#ffffff"; |
| 47 | 47 | if(\OC::$server->getAppManager()->isEnabledForUser("theming")) { |
| 48 | - $logoPath = $theme->getLogo(); |
|
| 49 | - try { |
|
| 50 | - $util = \OC::$server->query("\OCA\Theming\Util"); |
|
| 51 | - if($util->invertTextColor($color)) { |
|
| 52 | - $textColor = "#000000"; |
|
| 53 | - } |
|
| 54 | - } catch (OCP\AppFramework\QueryException $e) { |
|
| 48 | + $logoPath = $theme->getLogo(); |
|
| 49 | + try { |
|
| 50 | + $util = \OC::$server->query("\OCA\Theming\Util"); |
|
| 51 | + if($util->invertTextColor($color)) { |
|
| 52 | + $textColor = "#000000"; |
|
| 53 | + } |
|
| 54 | + } catch (OCP\AppFramework\QueryException $e) { |
|
| 55 | 55 | |
| 56 | - } |
|
| 56 | + } |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | |
@@ -39,16 +39,16 @@ |
||
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $cloudID = \OC::$server->getUserSession()->getUser()->getCloudId(); |
| 42 | -$url = 'https://nextcloud.com/federation#' . $cloudID; |
|
| 42 | +$url = 'https://nextcloud.com/federation#'.$cloudID; |
|
| 43 | 43 | $logoPath = \OC::$server->getURLGenerator()->imagePath('core', 'logo-icon.svg'); |
| 44 | 44 | $theme = \OC::$server->getThemingDefaults(); |
| 45 | 45 | $color = $theme->getColorPrimary(); |
| 46 | 46 | $textColor = "#ffffff"; |
| 47 | -if(\OC::$server->getAppManager()->isEnabledForUser("theming")) { |
|
| 47 | +if (\OC::$server->getAppManager()->isEnabledForUser("theming")) { |
|
| 48 | 48 | $logoPath = $theme->getLogo(); |
| 49 | 49 | try { |
| 50 | 50 | $util = \OC::$server->query("\OCA\Theming\Util"); |
| 51 | - if($util->invertTextColor($color)) { |
|
| 51 | + if ($util->invertTextColor($color)) { |
|
| 52 | 52 | $textColor = "#000000"; |
| 53 | 53 | } |
| 54 | 54 | } catch (OCP\AppFramework\QueryException $e) { |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | <tr><td> |
| 28 | 28 | <table cellspacing="0" cellpadding="0" border="0" width="600px"> |
| 29 | 29 | <tr> |
| 30 | - <td colspan="2" bgcolor="<?php p($theme->getColorPrimary());?>"> |
|
| 30 | + <td colspan="2" bgcolor="<?php p($theme->getColorPrimary()); ?>"> |
|
| 31 | 31 | <img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL(image_path('', 'logo-mail.png'))); ?>" alt="<?php p($theme->getName()); ?>"/> |
| 32 | 32 | </td> |
| 33 | 33 | </tr> |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | <td style="font-weight:normal; font-size:0.8em; line-height:1.2em; font-family:verdana,'arial',sans;">--<br> |
| 53 | 53 | <?php p($theme->getName()); ?> - |
| 54 | 54 | <?php p($theme->getSlogan()); ?> |
| 55 | - <br><a href="<?php p($theme->getBaseUrl()); ?>"><?php p($theme->getBaseUrl());?></a> |
|
| 55 | + <br><a href="<?php p($theme->getBaseUrl()); ?>"><?php p($theme->getBaseUrl()); ?></a> |
|
| 56 | 56 | </td> |
| 57 | 57 | </tr> |
| 58 | 58 | <tr> |
@@ -31,72 +31,72 @@ |
||
| 31 | 31 | use OCP\Settings\ISettings; |
| 32 | 32 | |
| 33 | 33 | class Admin implements ISettings { |
| 34 | - /** @var IConfig */ |
|
| 35 | - private $config; |
|
| 36 | - /** @var IL10N */ |
|
| 37 | - private $l; |
|
| 38 | - /** @var ThemingDefaults */ |
|
| 39 | - private $themingDefaults; |
|
| 40 | - /** @var IURLGenerator */ |
|
| 41 | - private $urlGenerator; |
|
| 34 | + /** @var IConfig */ |
|
| 35 | + private $config; |
|
| 36 | + /** @var IL10N */ |
|
| 37 | + private $l; |
|
| 38 | + /** @var ThemingDefaults */ |
|
| 39 | + private $themingDefaults; |
|
| 40 | + /** @var IURLGenerator */ |
|
| 41 | + private $urlGenerator; |
|
| 42 | 42 | |
| 43 | - public function __construct(IConfig $config, |
|
| 44 | - IL10N $l, |
|
| 45 | - ThemingDefaults $themingDefaults, |
|
| 46 | - IURLGenerator $urlGenerator) { |
|
| 47 | - $this->config = $config; |
|
| 48 | - $this->l = $l; |
|
| 49 | - $this->themingDefaults = $themingDefaults; |
|
| 50 | - $this->urlGenerator = $urlGenerator; |
|
| 51 | - } |
|
| 43 | + public function __construct(IConfig $config, |
|
| 44 | + IL10N $l, |
|
| 45 | + ThemingDefaults $themingDefaults, |
|
| 46 | + IURLGenerator $urlGenerator) { |
|
| 47 | + $this->config = $config; |
|
| 48 | + $this->l = $l; |
|
| 49 | + $this->themingDefaults = $themingDefaults; |
|
| 50 | + $this->urlGenerator = $urlGenerator; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * @return TemplateResponse |
|
| 55 | - */ |
|
| 56 | - public function getForm() { |
|
| 57 | - $path = $this->urlGenerator->linkToRoute('theming.Theming.updateLogo'); |
|
| 53 | + /** |
|
| 54 | + * @return TemplateResponse |
|
| 55 | + */ |
|
| 56 | + public function getForm() { |
|
| 57 | + $path = $this->urlGenerator->linkToRoute('theming.Theming.updateLogo'); |
|
| 58 | 58 | |
| 59 | - $themable = true; |
|
| 60 | - $errorMessage = ''; |
|
| 61 | - $theme = $this->config->getSystemValue('theme', ''); |
|
| 62 | - if ($theme !== '') { |
|
| 63 | - $themable = false; |
|
| 64 | - $errorMessage = $this->l->t('You are already using a custom theme'); |
|
| 65 | - } |
|
| 59 | + $themable = true; |
|
| 60 | + $errorMessage = ''; |
|
| 61 | + $theme = $this->config->getSystemValue('theme', ''); |
|
| 62 | + if ($theme !== '') { |
|
| 63 | + $themable = false; |
|
| 64 | + $errorMessage = $this->l->t('You are already using a custom theme'); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - $parameters = [ |
|
| 68 | - 'themable' => $themable, |
|
| 69 | - 'errorMessage' => $errorMessage, |
|
| 70 | - 'name' => $this->themingDefaults->getEntity(), |
|
| 71 | - 'url' => $this->themingDefaults->getBaseUrl(), |
|
| 72 | - 'slogan' => $this->themingDefaults->getSlogan(), |
|
| 73 | - 'color' => $this->themingDefaults->getColorPrimary(), |
|
| 74 | - 'logo' => $this->themingDefaults->getLogo(), |
|
| 75 | - 'logoMime' => $this->config->getAppValue('theming', 'logoMime', ''), |
|
| 76 | - 'background' => $this->themingDefaults->getBackground(), |
|
| 77 | - 'backgroundMime' => $this->config->getAppValue('theming', 'backgroundMime', ''), |
|
| 78 | - 'uploadLogoRoute' => $path, |
|
| 79 | - ]; |
|
| 67 | + $parameters = [ |
|
| 68 | + 'themable' => $themable, |
|
| 69 | + 'errorMessage' => $errorMessage, |
|
| 70 | + 'name' => $this->themingDefaults->getEntity(), |
|
| 71 | + 'url' => $this->themingDefaults->getBaseUrl(), |
|
| 72 | + 'slogan' => $this->themingDefaults->getSlogan(), |
|
| 73 | + 'color' => $this->themingDefaults->getColorPrimary(), |
|
| 74 | + 'logo' => $this->themingDefaults->getLogo(), |
|
| 75 | + 'logoMime' => $this->config->getAppValue('theming', 'logoMime', ''), |
|
| 76 | + 'background' => $this->themingDefaults->getBackground(), |
|
| 77 | + 'backgroundMime' => $this->config->getAppValue('theming', 'backgroundMime', ''), |
|
| 78 | + 'uploadLogoRoute' => $path, |
|
| 79 | + ]; |
|
| 80 | 80 | |
| 81 | - return new TemplateResponse('theming', 'settings-admin', $parameters, ''); |
|
| 82 | - } |
|
| 81 | + return new TemplateResponse('theming', 'settings-admin', $parameters, ''); |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * @return string the section ID, e.g. 'sharing' |
|
| 86 | - */ |
|
| 87 | - public function getSection() { |
|
| 88 | - return 'theming'; |
|
| 89 | - } |
|
| 84 | + /** |
|
| 85 | + * @return string the section ID, e.g. 'sharing' |
|
| 86 | + */ |
|
| 87 | + public function getSection() { |
|
| 88 | + return 'theming'; |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * @return int whether the form should be rather on the top or bottom of |
|
| 93 | - * the admin section. The forms are arranged in ascending order of the |
|
| 94 | - * priority values. It is required to return a value between 0 and 100. |
|
| 95 | - * |
|
| 96 | - * E.g.: 70 |
|
| 97 | - */ |
|
| 98 | - public function getPriority() { |
|
| 99 | - return 5; |
|
| 100 | - } |
|
| 91 | + /** |
|
| 92 | + * @return int whether the form should be rather on the top or bottom of |
|
| 93 | + * the admin section. The forms are arranged in ascending order of the |
|
| 94 | + * priority values. It is required to return a value between 0 and 100. |
|
| 95 | + * |
|
| 96 | + * E.g.: 70 |
|
| 97 | + */ |
|
| 98 | + public function getPriority() { |
|
| 99 | + return 5; |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | 102 | } |
@@ -191,16 +191,16 @@ discard block |
||
| 191 | 191 | $folder = $this->appData->newFolder('images'); |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - if(!empty($newLogo)) { |
|
| 194 | + if (!empty($newLogo)) { |
|
| 195 | 195 | $target = $folder->newFile('logo'); |
| 196 | 196 | $target->putContent(file_get_contents($newLogo['tmp_name'], 'r')); |
| 197 | 197 | $this->template->set('logoMime', $newLogo['type']); |
| 198 | 198 | $name = $newLogo['name']; |
| 199 | 199 | } |
| 200 | - if(!empty($newBackgroundLogo)) { |
|
| 200 | + if (!empty($newBackgroundLogo)) { |
|
| 201 | 201 | $target = $folder->newFile('background'); |
| 202 | 202 | $image = @imagecreatefromstring(file_get_contents($newBackgroundLogo['tmp_name'], 'r')); |
| 203 | - if($image === false) { |
|
| 203 | + if ($image === false) { |
|
| 204 | 204 | return new DataResponse( |
| 205 | 205 | [ |
| 206 | 206 | 'data' => [ |
@@ -215,10 +215,10 @@ discard block |
||
| 215 | 215 | // Optimize the image since some people may upload images that will be |
| 216 | 216 | // either to big or are not progressive rendering. |
| 217 | 217 | $tmpFile = $this->tempManager->getTemporaryFile(); |
| 218 | - if(function_exists('imagescale')) { |
|
| 218 | + if (function_exists('imagescale')) { |
|
| 219 | 219 | // FIXME: Once PHP 5.5.0 is a requirement the above check can be removed |
| 220 | 220 | // Workaround for https://bugs.php.net/bug.php?id=65171 |
| 221 | - $newHeight = imagesy($image)/(imagesx($image)/1920); |
|
| 221 | + $newHeight = imagesy($image) / (imagesx($image) / 1920); |
|
| 222 | 222 | $image = imagescale($image, 1920, $newHeight); |
| 223 | 223 | } |
| 224 | 224 | imageinterlace($image, 1); |
@@ -324,112 +324,112 @@ discard block |
||
| 324 | 324 | $color = $this->config->getAppValue($this->appName, 'color'); |
| 325 | 325 | $elementColor = $this->util->elementColor($color); |
| 326 | 326 | |
| 327 | - if($this->util->invertTextColor($color)) { |
|
| 327 | + if ($this->util->invertTextColor($color)) { |
|
| 328 | 328 | $textColor = '#000000'; |
| 329 | 329 | } else { |
| 330 | 330 | $textColor = '#ffffff'; |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | - if($color !== '') { |
|
| 333 | + if ($color !== '') { |
|
| 334 | 334 | $responseCss .= sprintf( |
| 335 | - '#body-user #header,#body-settings #header,#body-public #header,#body-login,.searchbox input[type="search"]:focus,.searchbox input[type="search"]:active,.searchbox input[type="search"]:valid {background-color: %s}' . "\n", |
|
| 335 | + '#body-user #header,#body-settings #header,#body-public #header,#body-login,.searchbox input[type="search"]:focus,.searchbox input[type="search"]:active,.searchbox input[type="search"]:valid {background-color: %s}'."\n", |
|
| 336 | 336 | $color |
| 337 | 337 | ); |
| 338 | - $responseCss .= sprintf('input[type="checkbox"].checkbox:checked:enabled:not(.checkbox--white) + label:before {' . |
|
| 339 | - 'background-image:url(\'%s/core/img/actions/checkmark-white.svg\');' . |
|
| 340 | - 'background-color: %s; background-position: center center; background-size:contain;' . |
|
| 341 | - 'width:12px; height:12px; padding:0; margin:2px 6px 6px 2px; border-radius:1px;' . |
|
| 338 | + $responseCss .= sprintf('input[type="checkbox"].checkbox:checked:enabled:not(.checkbox--white) + label:before {'. |
|
| 339 | + 'background-image:url(\'%s/core/img/actions/checkmark-white.svg\');'. |
|
| 340 | + 'background-color: %s; background-position: center center; background-size:contain;'. |
|
| 341 | + 'width:12px; height:12px; padding:0; margin:2px 6px 6px 2px; border-radius:1px;'. |
|
| 342 | 342 | "}\n", |
| 343 | 343 | \OC::$WEBROOT, |
| 344 | 344 | $elementColor |
| 345 | 345 | ); |
| 346 | - $responseCss .= 'input[type="radio"].radio:checked:not(.radio--white):not(:disabled) + label:before {' . |
|
| 347 | - 'background-image: url(\'data:image/svg+xml;base64,'.$this->util->generateRadioButton($elementColor).'\');' . |
|
| 346 | + $responseCss .= 'input[type="radio"].radio:checked:not(.radio--white):not(:disabled) + label:before {'. |
|
| 347 | + 'background-image: url(\'data:image/svg+xml;base64,'.$this->util->generateRadioButton($elementColor).'\');'. |
|
| 348 | 348 | "}\n"; |
| 349 | - $responseCss .= '.primary, input[type="submit"].primary, input[type="button"].primary, button.primary, .button.primary,' . |
|
| 350 | - '.primary:active, input[type="submit"].primary:active, input[type="button"].primary:active, button.primary:active, .button.primary:active {' . |
|
| 349 | + $responseCss .= '.primary, input[type="submit"].primary, input[type="button"].primary, button.primary, .button.primary,'. |
|
| 350 | + '.primary:active, input[type="submit"].primary:active, input[type="button"].primary:active, button.primary:active, .button.primary:active {'. |
|
| 351 | 351 | 'border: 1px solid '.$elementColor.';'. |
| 352 | 352 | 'background-color: '.$elementColor.';'. |
| 353 | - 'color: ' . $textColor . ';'. |
|
| 354 | - "}\n" . |
|
| 355 | - '.primary:hover, input[type="submit"].primary:hover, input[type="button"].primary:hover, button.primary:hover, .button.primary:hover,' . |
|
| 356 | - '.primary:focus, input[type="submit"].primary:focus, input[type="button"].primary:focus, button.primary:focus, .button.primary:focus {' . |
|
| 353 | + 'color: '.$textColor.';'. |
|
| 354 | + "}\n". |
|
| 355 | + '.primary:hover, input[type="submit"].primary:hover, input[type="button"].primary:hover, button.primary:hover, .button.primary:hover,'. |
|
| 356 | + '.primary:focus, input[type="submit"].primary:focus, input[type="button"].primary:focus, button.primary:focus, .button.primary:focus {'. |
|
| 357 | 357 | 'border: 1px solid '.$elementColor.';'. |
| 358 | 358 | 'background-color: '.$elementColor.';'. |
| 359 | - 'color: ' . $textColor . ';'. |
|
| 360 | - "}\n" . |
|
| 361 | - '.primary:disabled, input[type="submit"].primary:disabled, input[type="button"].primary:disabled, button.primary:disabled, .button.primary:disabled,' . |
|
| 362 | - '.primary:disabled:hover, input[type="submit"].primary:disabled:hover, input[type="button"].primary:disabled:hover, button.primary:disabled:hover, .button.primary:disabled:hover,' . |
|
| 363 | - '.primary:disabled:focus, input[type="submit"].primary:disabled:focus, input[type="button"].primary:disabled:focus, button.primary:disabled:focus, .button.primary:disabled:focus {' . |
|
| 359 | + 'color: '.$textColor.';'. |
|
| 360 | + "}\n". |
|
| 361 | + '.primary:disabled, input[type="submit"].primary:disabled, input[type="button"].primary:disabled, button.primary:disabled, .button.primary:disabled,'. |
|
| 362 | + '.primary:disabled:hover, input[type="submit"].primary:disabled:hover, input[type="button"].primary:disabled:hover, button.primary:disabled:hover, .button.primary:disabled:hover,'. |
|
| 363 | + '.primary:disabled:focus, input[type="submit"].primary:disabled:focus, input[type="button"].primary:disabled:focus, button.primary:disabled:focus, .button.primary:disabled:focus {'. |
|
| 364 | 364 | 'border: 1px solid '.$elementColor.';'. |
| 365 | 365 | 'background-color: '.$elementColor.';'. |
| 366 | - 'opacity: 0.4;' . |
|
| 366 | + 'opacity: 0.4;'. |
|
| 367 | 367 | 'color: '.$textColor.';'. |
| 368 | 368 | "}\n"; |
| 369 | - $responseCss .= '.ui-widget-header { border: 1px solid ' . $color . '; background: '. $color . '; color: #ffffff;' . "}\n"; |
|
| 370 | - $responseCss .= '.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active {' . |
|
| 371 | - 'border: 1px solid ' . $color . ';' . |
|
| 372 | - 'color: ' . $elementColor . ';' . |
|
| 369 | + $responseCss .= '.ui-widget-header { border: 1px solid '.$color.'; background: '.$color.'; color: #ffffff;'."}\n"; |
|
| 370 | + $responseCss .= '.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active {'. |
|
| 371 | + 'border: 1px solid '.$color.';'. |
|
| 372 | + 'color: '.$elementColor.';'. |
|
| 373 | 373 | "}\n"; |
| 374 | - $responseCss .= '.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited {' . |
|
| 375 | - 'color: ' . $elementColor . ';' . |
|
| 374 | + $responseCss .= '.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited {'. |
|
| 375 | + 'color: '.$elementColor.';'. |
|
| 376 | 376 | "}\n"; |
| 377 | 377 | $responseCss .= ' |
| 378 | 378 | #firstrunwizard .firstrunwizard-header { |
| 379 | - background-color: ' . $color . '; |
|
| 379 | + background-color: ' . $color.'; |
|
| 380 | 380 | } |
| 381 | 381 | #firstrunwizard p a { |
| 382 | - color: ' . $color . '; |
|
| 382 | + color: ' . $color.'; |
|
| 383 | 383 | } |
| 384 | 384 | '; |
| 385 | - $responseCss .= sprintf('.nc-theming-main-background {background-color: %s}' . "\n", $color); |
|
| 386 | - $responseCss .= sprintf('.nc-theming-main-text {color: %s}' . "\n", $color); |
|
| 387 | - $responseCss .= sprintf('#app-navigation li:hover > a, #app-navigation li:focus > a, #app-navigation a:focus, #app-navigation .selected, #app-navigation .selected a, #app-navigation .active, #app-navigation .active a {box-shadow: inset 2px 0 %s}' . "\n", $color); |
|
| 385 | + $responseCss .= sprintf('.nc-theming-main-background {background-color: %s}'."\n", $color); |
|
| 386 | + $responseCss .= sprintf('.nc-theming-main-text {color: %s}'."\n", $color); |
|
| 387 | + $responseCss .= sprintf('#app-navigation li:hover > a, #app-navigation li:focus > a, #app-navigation a:focus, #app-navigation .selected, #app-navigation .selected a, #app-navigation .active, #app-navigation .active a {box-shadow: inset 2px 0 %s}'."\n", $color); |
|
| 388 | 388 | |
| 389 | 389 | } |
| 390 | 390 | $logo = $this->config->getAppValue($this->appName, 'logoMime'); |
| 391 | - if($logo !== '') { |
|
| 391 | + if ($logo !== '') { |
|
| 392 | 392 | $responseCss .= sprintf( |
| 393 | - '#header .logo {' . |
|
| 394 | - 'background-image: url(\'./logo?v='.$cacheBusterValue.'\');' . |
|
| 395 | - 'background-size: contain;' . |
|
| 396 | - '}' . "\n" . |
|
| 397 | - '#header .logo-icon {' . |
|
| 398 | - 'background-image: url(\'./logo?v='.$cacheBusterValue.'\');' . |
|
| 399 | - 'background-size: contain;' . |
|
| 400 | - '}' . "\n" . |
|
| 401 | - '#firstrunwizard .firstrunwizard-header .logo {' . |
|
| 402 | - 'background-image: url(\'./logo?v='.$cacheBusterValue.'\');' . |
|
| 403 | - 'background-size: contain;' . |
|
| 404 | - '}' . "\n" |
|
| 393 | + '#header .logo {'. |
|
| 394 | + 'background-image: url(\'./logo?v='.$cacheBusterValue.'\');'. |
|
| 395 | + 'background-size: contain;'. |
|
| 396 | + '}'."\n". |
|
| 397 | + '#header .logo-icon {'. |
|
| 398 | + 'background-image: url(\'./logo?v='.$cacheBusterValue.'\');'. |
|
| 399 | + 'background-size: contain;'. |
|
| 400 | + '}'."\n". |
|
| 401 | + '#firstrunwizard .firstrunwizard-header .logo {'. |
|
| 402 | + 'background-image: url(\'./logo?v='.$cacheBusterValue.'\');'. |
|
| 403 | + 'background-size: contain;'. |
|
| 404 | + '}'."\n" |
|
| 405 | 405 | ); |
| 406 | 406 | } |
| 407 | 407 | $backgroundLogo = $this->config->getAppValue($this->appName, 'backgroundMime'); |
| 408 | - if($backgroundLogo !== '') { |
|
| 409 | - $responseCss .= '#body-login {background-image: url(\'./loginbackground?v='.$cacheBusterValue.'\');}' . "\n"; |
|
| 410 | - $responseCss .= '#firstrunwizard .firstrunwizard-header {' . |
|
| 411 | - 'background-image: url(\'./loginbackground?v='.$cacheBusterValue.'\');' . |
|
| 412 | - '}' . "\n"; |
|
| 408 | + if ($backgroundLogo !== '') { |
|
| 409 | + $responseCss .= '#body-login {background-image: url(\'./loginbackground?v='.$cacheBusterValue.'\');}'."\n"; |
|
| 410 | + $responseCss .= '#firstrunwizard .firstrunwizard-header {'. |
|
| 411 | + 'background-image: url(\'./loginbackground?v='.$cacheBusterValue.'\');'. |
|
| 412 | + '}'."\n"; |
|
| 413 | 413 | } |
| 414 | - if($this->util->invertTextColor($color)) { |
|
| 415 | - $responseCss .= '#header .header-appname, #expandDisplayName { color: #000000; }' . "\n"; |
|
| 416 | - $responseCss .= '#header .icon-caret { background-image: url(\'' . \OC::$WEBROOT . '/core/img/actions/caret-dark.svg\'); }' . "\n"; |
|
| 417 | - $responseCss .= '.searchbox input[type="search"] { background: transparent url(\'' . \OC::$WEBROOT . '/core/img/actions/search.svg\') no-repeat 6px center; color: #000; }' . "\n"; |
|
| 418 | - $responseCss .= '.searchbox input[type="search"]:focus,.searchbox input[type="search"]:active,.searchbox input[type="search"]:valid { color: #000; border: 1px solid rgba(0, 0, 0, .5); }' . "\n"; |
|
| 419 | - $responseCss .= '#body-login input.login { background-image: url(\'' . \OC::$WEBROOT . '/core/img/actions/confirm.svg?v=2\'); }' . "\n"; |
|
| 420 | - $responseCss .= '.nc-theming-contrast {color: #000000}' . "\n"; |
|
| 421 | - $responseCss .= '.ui-widget-header { color: #000000; }' . "\n"; |
|
| 414 | + if ($this->util->invertTextColor($color)) { |
|
| 415 | + $responseCss .= '#header .header-appname, #expandDisplayName { color: #000000; }'."\n"; |
|
| 416 | + $responseCss .= '#header .icon-caret { background-image: url(\''.\OC::$WEBROOT.'/core/img/actions/caret-dark.svg\'); }'."\n"; |
|
| 417 | + $responseCss .= '.searchbox input[type="search"] { background: transparent url(\''.\OC::$WEBROOT.'/core/img/actions/search.svg\') no-repeat 6px center; color: #000; }'."\n"; |
|
| 418 | + $responseCss .= '.searchbox input[type="search"]:focus,.searchbox input[type="search"]:active,.searchbox input[type="search"]:valid { color: #000; border: 1px solid rgba(0, 0, 0, .5); }'."\n"; |
|
| 419 | + $responseCss .= '#body-login input.login { background-image: url(\''.\OC::$WEBROOT.'/core/img/actions/confirm.svg?v=2\'); }'."\n"; |
|
| 420 | + $responseCss .= '.nc-theming-contrast {color: #000000}'."\n"; |
|
| 421 | + $responseCss .= '.ui-widget-header { color: #000000; }'."\n"; |
|
| 422 | 422 | } else { |
| 423 | - $responseCss .= '.nc-theming-contrast {color: #ffffff}' . "\n"; |
|
| 423 | + $responseCss .= '.nc-theming-contrast {color: #ffffff}'."\n"; |
|
| 424 | 424 | } |
| 425 | 425 | |
| 426 | - if($logo !== '' or $color !== '') { |
|
| 427 | - $responseCss .= '.icon-file,.icon-filetype-text {' . |
|
| 428 | - 'background-image: url(\'./img/core/filetypes/text.svg?v='.$cacheBusterValue.'\');' . "}\n" . |
|
| 429 | - '.icon-folder, .icon-filetype-folder {' . |
|
| 430 | - 'background-image: url(\'./img/core/filetypes/folder.svg?v='.$cacheBusterValue.'\');' . "}\n" . |
|
| 431 | - '.icon-filetype-folder-drag-accept {' . |
|
| 432 | - 'background-image: url(\'./img/core/filetypes/folder-drag-accept.svg?v='.$cacheBusterValue.'\')!important;' . "}\n"; |
|
| 426 | + if ($logo !== '' or $color !== '') { |
|
| 427 | + $responseCss .= '.icon-file,.icon-filetype-text {'. |
|
| 428 | + 'background-image: url(\'./img/core/filetypes/text.svg?v='.$cacheBusterValue.'\');'."}\n". |
|
| 429 | + '.icon-folder, .icon-filetype-folder {'. |
|
| 430 | + 'background-image: url(\'./img/core/filetypes/folder.svg?v='.$cacheBusterValue.'\');'."}\n". |
|
| 431 | + '.icon-filetype-folder-drag-accept {'. |
|
| 432 | + 'background-image: url(\'./img/core/filetypes/folder-drag-accept.svg?v='.$cacheBusterValue.'\')!important;'."}\n"; |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | $response = new DataDownloadResponse($responseCss, 'style', 'text/css'); |
@@ -448,12 +448,12 @@ discard block |
||
| 448 | 448 | $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0'); |
| 449 | 449 | $responseJS = '(function() { |
| 450 | 450 | OCA.Theming = { |
| 451 | - name: ' . json_encode($this->template->getName()) . ', |
|
| 452 | - url: ' . json_encode($this->template->getBaseUrl()) . ', |
|
| 453 | - slogan: ' . json_encode($this->template->getSlogan()) . ', |
|
| 454 | - color: ' . json_encode($this->template->getColorPrimary()) . ', |
|
| 455 | - inverted: ' . json_encode($this->util->invertTextColor($this->template->getColorPrimary())) . ', |
|
| 456 | - cacheBuster: ' . json_encode($cacheBusterValue). ' |
|
| 451 | + name: ' . json_encode($this->template->getName()).', |
|
| 452 | + url: ' . json_encode($this->template->getBaseUrl()).', |
|
| 453 | + slogan: ' . json_encode($this->template->getSlogan()).', |
|
| 454 | + color: ' . json_encode($this->template->getColorPrimary()).', |
|
| 455 | + inverted: ' . json_encode($this->util->invertTextColor($this->template->getColorPrimary())).', |
|
| 456 | + cacheBuster: ' . json_encode($cacheBusterValue).' |
|
| 457 | 457 | }; |
| 458 | 458 | })();'; |
| 459 | 459 | $response = new DataDownloadResponse($responseJS, 'javascript', 'text/javascript'); |
@@ -32,196 +32,196 @@ |
||
| 32 | 32 | |
| 33 | 33 | class ThemingDefaults extends \OC_Defaults { |
| 34 | 34 | |
| 35 | - /** @var IConfig */ |
|
| 36 | - private $config; |
|
| 37 | - /** @var IL10N */ |
|
| 38 | - private $l; |
|
| 39 | - /** @var IURLGenerator */ |
|
| 40 | - private $urlGenerator; |
|
| 41 | - /** @var IRootFolder */ |
|
| 42 | - private $rootFolder; |
|
| 43 | - /** @var ICacheFactory */ |
|
| 44 | - private $cacheFactory; |
|
| 45 | - /** @var string */ |
|
| 46 | - private $name; |
|
| 47 | - /** @var string */ |
|
| 48 | - private $url; |
|
| 49 | - /** @var string */ |
|
| 50 | - private $slogan; |
|
| 51 | - /** @var string */ |
|
| 52 | - private $color; |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * ThemingDefaults constructor. |
|
| 56 | - * |
|
| 57 | - * @param IConfig $config |
|
| 58 | - * @param IL10N $l |
|
| 59 | - * @param IURLGenerator $urlGenerator |
|
| 60 | - * @param \OC_Defaults $defaults |
|
| 61 | - * @param IRootFolder $rootFolder |
|
| 62 | - * @param ICacheFactory $cacheFactory |
|
| 63 | - */ |
|
| 64 | - public function __construct(IConfig $config, |
|
| 65 | - IL10N $l, |
|
| 66 | - IURLGenerator $urlGenerator, |
|
| 67 | - \OC_Defaults $defaults, |
|
| 68 | - IRootFolder $rootFolder, |
|
| 69 | - ICacheFactory $cacheFactory |
|
| 70 | - ) { |
|
| 71 | - parent::__construct(); |
|
| 72 | - $this->config = $config; |
|
| 73 | - $this->l = $l; |
|
| 74 | - $this->urlGenerator = $urlGenerator; |
|
| 75 | - $this->rootFolder = $rootFolder; |
|
| 76 | - $this->cacheFactory = $cacheFactory; |
|
| 77 | - |
|
| 78 | - $this->name = $defaults->getName(); |
|
| 79 | - $this->url = $defaults->getBaseUrl(); |
|
| 80 | - $this->slogan = $defaults->getSlogan(); |
|
| 81 | - $this->color = $defaults->getColorPrimary(); |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - public function getName() { |
|
| 85 | - return strip_tags($this->config->getAppValue('theming', 'name', $this->name)); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - public function getHTMLName() { |
|
| 89 | - return $this->config->getAppValue('theming', 'name', $this->name); |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - public function getTitle() { |
|
| 93 | - return $this->getName(); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - public function getEntity() { |
|
| 97 | - return $this->getName(); |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - public function getBaseUrl() { |
|
| 101 | - return $this->config->getAppValue('theming', 'url', $this->url); |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - public function getSlogan() { |
|
| 105 | - return Util::sanitizeHTML($this->config->getAppValue('theming', 'slogan', $this->slogan)); |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - public function getShortFooter() { |
|
| 109 | - $slogan = $this->getSlogan(); |
|
| 110 | - $footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' . |
|
| 111 | - ' rel="noreferrer">' .$this->getEntity() . '</a>'. |
|
| 112 | - ($slogan !== '' ? ' – ' . $slogan : ''); |
|
| 113 | - |
|
| 114 | - return $footer; |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - /** |
|
| 118 | - * Color that is used for the header as well as for mail headers |
|
| 119 | - * |
|
| 120 | - * @return string |
|
| 121 | - */ |
|
| 122 | - public function getColorPrimary() { |
|
| 123 | - return $this->config->getAppValue('theming', 'color', $this->color); |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * Themed logo url |
|
| 128 | - * |
|
| 129 | - * @return string |
|
| 130 | - */ |
|
| 131 | - public function getLogo() { |
|
| 132 | - $logo = $this->config->getAppValue('theming', 'logoMime'); |
|
| 133 | - if(!$logo || !$this->rootFolder->nodeExists('/themedinstancelogo')) { |
|
| 134 | - return $this->urlGenerator->imagePath('core','logo.svg'); |
|
| 135 | - } else { |
|
| 136 | - return $this->urlGenerator->linkToRoute('theming.Theming.getLogo'); |
|
| 137 | - } |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - /** |
|
| 141 | - * Themed background image url |
|
| 142 | - * |
|
| 143 | - * @return string |
|
| 144 | - */ |
|
| 145 | - public function getBackground() { |
|
| 146 | - $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime'); |
|
| 147 | - if(!$backgroundLogo || !$this->rootFolder->nodeExists('/themedbackgroundlogo')) { |
|
| 148 | - return $this->urlGenerator->imagePath('core','background.jpg'); |
|
| 149 | - } else { |
|
| 150 | - return $this->urlGenerator->linkToRoute('theming.Theming.getLoginBackground'); |
|
| 151 | - } |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * Check if Imagemagick is enabled and if SVG is supported |
|
| 156 | - * otherwise we can't render custom icons |
|
| 157 | - * |
|
| 158 | - * @return bool |
|
| 159 | - */ |
|
| 160 | - public function shouldReplaceIcons() { |
|
| 161 | - $cache = $this->cacheFactory->create('theming'); |
|
| 162 | - if($value = $cache->get('shouldReplaceIcons')) { |
|
| 163 | - return (bool)$value; |
|
| 164 | - } |
|
| 165 | - $value = false; |
|
| 166 | - if(extension_loaded('imagick')) { |
|
| 167 | - $checkImagick = new \Imagick(); |
|
| 168 | - if (count($checkImagick->queryFormats('SVG')) >= 1) { |
|
| 169 | - $value = true; |
|
| 170 | - } |
|
| 171 | - $checkImagick->clear(); |
|
| 172 | - } |
|
| 173 | - $cache->set('shouldReplaceIcons', $value); |
|
| 174 | - return $value; |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - /** |
|
| 178 | - * Increases the cache buster key |
|
| 179 | - */ |
|
| 180 | - private function increaseCacheBuster() { |
|
| 181 | - $cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 182 | - $this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1); |
|
| 183 | - } |
|
| 184 | - |
|
| 185 | - /** |
|
| 186 | - * Update setting in the database |
|
| 187 | - * |
|
| 188 | - * @param string $setting |
|
| 189 | - * @param string $value |
|
| 190 | - */ |
|
| 191 | - public function set($setting, $value) { |
|
| 192 | - $this->config->setAppValue('theming', $setting, $value); |
|
| 193 | - $this->increaseCacheBuster(); |
|
| 194 | - } |
|
| 195 | - |
|
| 196 | - /** |
|
| 197 | - * Revert settings to the default value |
|
| 198 | - * |
|
| 199 | - * @param string $setting setting which should be reverted |
|
| 200 | - * @return string default value |
|
| 201 | - */ |
|
| 202 | - public function undo($setting) { |
|
| 203 | - $this->config->deleteAppValue('theming', $setting); |
|
| 204 | - $this->increaseCacheBuster(); |
|
| 205 | - |
|
| 206 | - switch ($setting) { |
|
| 207 | - case 'name': |
|
| 208 | - $returnValue = $this->getEntity(); |
|
| 209 | - break; |
|
| 210 | - case 'url': |
|
| 211 | - $returnValue = $this->getBaseUrl(); |
|
| 212 | - break; |
|
| 213 | - case 'slogan': |
|
| 214 | - $returnValue = $this->getSlogan(); |
|
| 215 | - break; |
|
| 216 | - case 'color': |
|
| 217 | - $returnValue = $this->getColorPrimary(); |
|
| 218 | - break; |
|
| 219 | - default: |
|
| 220 | - $returnValue = ''; |
|
| 221 | - break; |
|
| 222 | - } |
|
| 223 | - |
|
| 224 | - return $returnValue; |
|
| 225 | - } |
|
| 35 | + /** @var IConfig */ |
|
| 36 | + private $config; |
|
| 37 | + /** @var IL10N */ |
|
| 38 | + private $l; |
|
| 39 | + /** @var IURLGenerator */ |
|
| 40 | + private $urlGenerator; |
|
| 41 | + /** @var IRootFolder */ |
|
| 42 | + private $rootFolder; |
|
| 43 | + /** @var ICacheFactory */ |
|
| 44 | + private $cacheFactory; |
|
| 45 | + /** @var string */ |
|
| 46 | + private $name; |
|
| 47 | + /** @var string */ |
|
| 48 | + private $url; |
|
| 49 | + /** @var string */ |
|
| 50 | + private $slogan; |
|
| 51 | + /** @var string */ |
|
| 52 | + private $color; |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * ThemingDefaults constructor. |
|
| 56 | + * |
|
| 57 | + * @param IConfig $config |
|
| 58 | + * @param IL10N $l |
|
| 59 | + * @param IURLGenerator $urlGenerator |
|
| 60 | + * @param \OC_Defaults $defaults |
|
| 61 | + * @param IRootFolder $rootFolder |
|
| 62 | + * @param ICacheFactory $cacheFactory |
|
| 63 | + */ |
|
| 64 | + public function __construct(IConfig $config, |
|
| 65 | + IL10N $l, |
|
| 66 | + IURLGenerator $urlGenerator, |
|
| 67 | + \OC_Defaults $defaults, |
|
| 68 | + IRootFolder $rootFolder, |
|
| 69 | + ICacheFactory $cacheFactory |
|
| 70 | + ) { |
|
| 71 | + parent::__construct(); |
|
| 72 | + $this->config = $config; |
|
| 73 | + $this->l = $l; |
|
| 74 | + $this->urlGenerator = $urlGenerator; |
|
| 75 | + $this->rootFolder = $rootFolder; |
|
| 76 | + $this->cacheFactory = $cacheFactory; |
|
| 77 | + |
|
| 78 | + $this->name = $defaults->getName(); |
|
| 79 | + $this->url = $defaults->getBaseUrl(); |
|
| 80 | + $this->slogan = $defaults->getSlogan(); |
|
| 81 | + $this->color = $defaults->getColorPrimary(); |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + public function getName() { |
|
| 85 | + return strip_tags($this->config->getAppValue('theming', 'name', $this->name)); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + public function getHTMLName() { |
|
| 89 | + return $this->config->getAppValue('theming', 'name', $this->name); |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + public function getTitle() { |
|
| 93 | + return $this->getName(); |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + public function getEntity() { |
|
| 97 | + return $this->getName(); |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + public function getBaseUrl() { |
|
| 101 | + return $this->config->getAppValue('theming', 'url', $this->url); |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + public function getSlogan() { |
|
| 105 | + return Util::sanitizeHTML($this->config->getAppValue('theming', 'slogan', $this->slogan)); |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + public function getShortFooter() { |
|
| 109 | + $slogan = $this->getSlogan(); |
|
| 110 | + $footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' . |
|
| 111 | + ' rel="noreferrer">' .$this->getEntity() . '</a>'. |
|
| 112 | + ($slogan !== '' ? ' – ' . $slogan : ''); |
|
| 113 | + |
|
| 114 | + return $footer; |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + /** |
|
| 118 | + * Color that is used for the header as well as for mail headers |
|
| 119 | + * |
|
| 120 | + * @return string |
|
| 121 | + */ |
|
| 122 | + public function getColorPrimary() { |
|
| 123 | + return $this->config->getAppValue('theming', 'color', $this->color); |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * Themed logo url |
|
| 128 | + * |
|
| 129 | + * @return string |
|
| 130 | + */ |
|
| 131 | + public function getLogo() { |
|
| 132 | + $logo = $this->config->getAppValue('theming', 'logoMime'); |
|
| 133 | + if(!$logo || !$this->rootFolder->nodeExists('/themedinstancelogo')) { |
|
| 134 | + return $this->urlGenerator->imagePath('core','logo.svg'); |
|
| 135 | + } else { |
|
| 136 | + return $this->urlGenerator->linkToRoute('theming.Theming.getLogo'); |
|
| 137 | + } |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + /** |
|
| 141 | + * Themed background image url |
|
| 142 | + * |
|
| 143 | + * @return string |
|
| 144 | + */ |
|
| 145 | + public function getBackground() { |
|
| 146 | + $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime'); |
|
| 147 | + if(!$backgroundLogo || !$this->rootFolder->nodeExists('/themedbackgroundlogo')) { |
|
| 148 | + return $this->urlGenerator->imagePath('core','background.jpg'); |
|
| 149 | + } else { |
|
| 150 | + return $this->urlGenerator->linkToRoute('theming.Theming.getLoginBackground'); |
|
| 151 | + } |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * Check if Imagemagick is enabled and if SVG is supported |
|
| 156 | + * otherwise we can't render custom icons |
|
| 157 | + * |
|
| 158 | + * @return bool |
|
| 159 | + */ |
|
| 160 | + public function shouldReplaceIcons() { |
|
| 161 | + $cache = $this->cacheFactory->create('theming'); |
|
| 162 | + if($value = $cache->get('shouldReplaceIcons')) { |
|
| 163 | + return (bool)$value; |
|
| 164 | + } |
|
| 165 | + $value = false; |
|
| 166 | + if(extension_loaded('imagick')) { |
|
| 167 | + $checkImagick = new \Imagick(); |
|
| 168 | + if (count($checkImagick->queryFormats('SVG')) >= 1) { |
|
| 169 | + $value = true; |
|
| 170 | + } |
|
| 171 | + $checkImagick->clear(); |
|
| 172 | + } |
|
| 173 | + $cache->set('shouldReplaceIcons', $value); |
|
| 174 | + return $value; |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + /** |
|
| 178 | + * Increases the cache buster key |
|
| 179 | + */ |
|
| 180 | + private function increaseCacheBuster() { |
|
| 181 | + $cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 182 | + $this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1); |
|
| 183 | + } |
|
| 184 | + |
|
| 185 | + /** |
|
| 186 | + * Update setting in the database |
|
| 187 | + * |
|
| 188 | + * @param string $setting |
|
| 189 | + * @param string $value |
|
| 190 | + */ |
|
| 191 | + public function set($setting, $value) { |
|
| 192 | + $this->config->setAppValue('theming', $setting, $value); |
|
| 193 | + $this->increaseCacheBuster(); |
|
| 194 | + } |
|
| 195 | + |
|
| 196 | + /** |
|
| 197 | + * Revert settings to the default value |
|
| 198 | + * |
|
| 199 | + * @param string $setting setting which should be reverted |
|
| 200 | + * @return string default value |
|
| 201 | + */ |
|
| 202 | + public function undo($setting) { |
|
| 203 | + $this->config->deleteAppValue('theming', $setting); |
|
| 204 | + $this->increaseCacheBuster(); |
|
| 205 | + |
|
| 206 | + switch ($setting) { |
|
| 207 | + case 'name': |
|
| 208 | + $returnValue = $this->getEntity(); |
|
| 209 | + break; |
|
| 210 | + case 'url': |
|
| 211 | + $returnValue = $this->getBaseUrl(); |
|
| 212 | + break; |
|
| 213 | + case 'slogan': |
|
| 214 | + $returnValue = $this->getSlogan(); |
|
| 215 | + break; |
|
| 216 | + case 'color': |
|
| 217 | + $returnValue = $this->getColorPrimary(); |
|
| 218 | + break; |
|
| 219 | + default: |
|
| 220 | + $returnValue = ''; |
|
| 221 | + break; |
|
| 222 | + } |
|
| 223 | + |
|
| 224 | + return $returnValue; |
|
| 225 | + } |
|
| 226 | 226 | |
| 227 | 227 | } |
@@ -33,37 +33,37 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | class Capabilities implements ICapability { |
| 35 | 35 | |
| 36 | - /** @var ThemingDefaults */ |
|
| 37 | - protected $theming; |
|
| 36 | + /** @var ThemingDefaults */ |
|
| 37 | + protected $theming; |
|
| 38 | 38 | |
| 39 | 39 | |
| 40 | - /** @var IURLGenerator */ |
|
| 41 | - protected $url; |
|
| 40 | + /** @var IURLGenerator */ |
|
| 41 | + protected $url; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * @param ThemingDefaults $theming |
|
| 45 | - * @param IURLGenerator $url |
|
| 46 | - */ |
|
| 47 | - public function __construct(ThemingDefaults $theming, IURLGenerator $url) { |
|
| 48 | - $this->theming = $theming; |
|
| 49 | - $this->url = $url; |
|
| 50 | - } |
|
| 43 | + /** |
|
| 44 | + * @param ThemingDefaults $theming |
|
| 45 | + * @param IURLGenerator $url |
|
| 46 | + */ |
|
| 47 | + public function __construct(ThemingDefaults $theming, IURLGenerator $url) { |
|
| 48 | + $this->theming = $theming; |
|
| 49 | + $this->url = $url; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Return this classes capabilities |
|
| 54 | - * |
|
| 55 | - * @return array |
|
| 56 | - */ |
|
| 57 | - public function getCapabilities() { |
|
| 58 | - return [ |
|
| 59 | - 'theming' => [ |
|
| 60 | - 'name' => $this->theming->getName(), |
|
| 61 | - 'url' => $this->theming->getBaseUrl(), |
|
| 62 | - 'slogan' => $this->theming->getSlogan(), |
|
| 63 | - 'color' => $this->theming->getColorPrimary(), |
|
| 64 | - 'logo' => $this->url->getAbsoluteURL($this->theming->getLogo()), |
|
| 65 | - 'background' => $this->url->getAbsoluteURL($this->theming->getBackground()), |
|
| 66 | - ], |
|
| 67 | - ]; |
|
| 68 | - } |
|
| 52 | + /** |
|
| 53 | + * Return this classes capabilities |
|
| 54 | + * |
|
| 55 | + * @return array |
|
| 56 | + */ |
|
| 57 | + public function getCapabilities() { |
|
| 58 | + return [ |
|
| 59 | + 'theming' => [ |
|
| 60 | + 'name' => $this->theming->getName(), |
|
| 61 | + 'url' => $this->theming->getBaseUrl(), |
|
| 62 | + 'slogan' => $this->theming->getSlogan(), |
|
| 63 | + 'color' => $this->theming->getColorPrimary(), |
|
| 64 | + 'logo' => $this->url->getAbsoluteURL($this->theming->getLogo()), |
|
| 65 | + 'background' => $this->url->getAbsoluteURL($this->theming->getBackground()), |
|
| 66 | + ], |
|
| 67 | + ]; |
|
| 68 | + } |
|
| 69 | 69 | } |