@@ -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 | } |
@@ -28,162 +28,162 @@ |
||
| 28 | 28 | use OCP\App\AppPathNotFoundException; |
| 29 | 29 | |
| 30 | 30 | class IconBuilder { |
| 31 | - /** @var ThemingDefaults */ |
|
| 32 | - private $themingDefaults; |
|
| 33 | - /** @var Util */ |
|
| 34 | - private $util; |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * IconBuilder constructor. |
|
| 38 | - * |
|
| 39 | - * @param ThemingDefaults $themingDefaults |
|
| 40 | - * @param Util $util |
|
| 41 | - */ |
|
| 42 | - public function __construct( |
|
| 43 | - ThemingDefaults $themingDefaults, |
|
| 44 | - Util $util |
|
| 45 | - ) { |
|
| 46 | - $this->themingDefaults = $themingDefaults; |
|
| 47 | - $this->util = $util; |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * @param $app string app name |
|
| 52 | - * @return string|false image blob |
|
| 53 | - */ |
|
| 54 | - public function getFavicon($app) { |
|
| 55 | - $icon = $this->renderAppIcon($app, 32); |
|
| 56 | - if($icon === false) { |
|
| 57 | - return false; |
|
| 58 | - } |
|
| 59 | - $icon->setImageFormat("png24"); |
|
| 60 | - $data = $icon->getImageBlob(); |
|
| 61 | - $icon->destroy(); |
|
| 62 | - return $data; |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * @param $app string app name |
|
| 67 | - * @return string|false image blob |
|
| 68 | - */ |
|
| 69 | - public function getTouchIcon($app) { |
|
| 70 | - $icon = $this->renderAppIcon($app, 512); |
|
| 71 | - if($icon === false) { |
|
| 72 | - return false; |
|
| 73 | - } |
|
| 74 | - $icon->setImageFormat("png24"); |
|
| 75 | - $data = $icon->getImageBlob(); |
|
| 76 | - $icon->destroy(); |
|
| 77 | - return $data; |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * Render app icon on themed background color |
|
| 82 | - * fallback to logo |
|
| 83 | - * |
|
| 84 | - * @param $app string app name |
|
| 85 | - * @param $size int size of the icon in px |
|
| 86 | - * @return Imagick|false |
|
| 87 | - */ |
|
| 88 | - public function renderAppIcon($app, $size) { |
|
| 89 | - try { |
|
| 90 | - $appIcon = $this->util->getAppIcon($app); |
|
| 91 | - $appIconContent = file_get_contents($appIcon); |
|
| 92 | - } catch (AppPathNotFoundException $e) { |
|
| 93 | - return false; |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - if($appIconContent === false) { |
|
| 97 | - return false; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - $color = $this->themingDefaults->getColorPrimary(); |
|
| 101 | - $mime = mime_content_type($appIcon); |
|
| 102 | - |
|
| 103 | - // generate background image with rounded corners |
|
| 104 | - $background = '<?xml version="1.0" encoding="UTF-8"?>' . |
|
| 105 | - '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:cc="http://creativecommons.org/ns#" width="512" height="512" xmlns:xlink="http://www.w3.org/1999/xlink">' . |
|
| 106 | - '<rect x="0" y="0" rx="100" ry="100" width="512" height="512" style="fill:' . $color . ';" />' . |
|
| 107 | - '</svg>'; |
|
| 108 | - // resize svg magic as this seems broken in Imagemagick |
|
| 109 | - if($mime === "image/svg+xml" || substr($appIconContent, 0, 4) === "<svg") { |
|
| 110 | - if(substr($appIconContent, 0, 5) !== "<?xml") { |
|
| 111 | - $svg = "<?xml version=\"1.0\"?>".$appIconContent; |
|
| 112 | - } else { |
|
| 113 | - $svg = $appIconContent; |
|
| 114 | - } |
|
| 115 | - $tmp = new Imagick(); |
|
| 116 | - $tmp->readImageBlob($svg); |
|
| 117 | - $x = $tmp->getImageWidth(); |
|
| 118 | - $y = $tmp->getImageHeight(); |
|
| 119 | - $res = $tmp->getImageResolution(); |
|
| 120 | - $tmp->destroy(); |
|
| 121 | - |
|
| 122 | - if($x>$y) { |
|
| 123 | - $max = $x; |
|
| 124 | - } else { |
|
| 125 | - $max = $y; |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - // convert svg to resized image |
|
| 129 | - $appIconFile = new Imagick(); |
|
| 130 | - $resX = (int)(512 * $res['x'] / $max * 2.53); |
|
| 131 | - $resY = (int)(512 * $res['y'] / $max * 2.53); |
|
| 132 | - $appIconFile->setResolution($resX, $resY); |
|
| 133 | - $appIconFile->setBackgroundColor(new ImagickPixel('transparent')); |
|
| 134 | - $appIconFile->readImageBlob($svg); |
|
| 135 | - $appIconFile->scaleImage(512, 512, true); |
|
| 136 | - } else { |
|
| 137 | - $appIconFile = new Imagick(); |
|
| 138 | - $appIconFile->setBackgroundColor(new ImagickPixel('transparent')); |
|
| 139 | - $appIconFile->readImageBlob(file_get_contents($appIcon)); |
|
| 140 | - $appIconFile->scaleImage(512, 512, true); |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - // offset for icon positioning |
|
| 144 | - $border_w = (int)($appIconFile->getImageWidth() * 0.05); |
|
| 145 | - $border_h = (int)($appIconFile->getImageHeight() * 0.05); |
|
| 146 | - $innerWidth = (int)($appIconFile->getImageWidth() - $border_w * 2); |
|
| 147 | - $innerHeight = (int)($appIconFile->getImageHeight() - $border_h * 2); |
|
| 148 | - $appIconFile->adaptiveResizeImage($innerWidth, $innerHeight); |
|
| 149 | - // center icon |
|
| 150 | - $offset_w = 512 / 2 - $innerWidth / 2; |
|
| 151 | - $offset_h = 512 / 2 - $innerHeight / 2; |
|
| 152 | - |
|
| 153 | - $appIconFile->setImageFormat("png24"); |
|
| 154 | - |
|
| 155 | - $finalIconFile = new Imagick(); |
|
| 156 | - $finalIconFile->setBackgroundColor(new ImagickPixel('transparent')); |
|
| 157 | - $finalIconFile->readImageBlob($background); |
|
| 158 | - $finalIconFile->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT); |
|
| 159 | - $finalIconFile->setImageArtifact('compose:args', "1,0,-0.5,0.5"); |
|
| 160 | - $finalIconFile->compositeImage($appIconFile, Imagick::COMPOSITE_ATOP, $offset_w, $offset_h); |
|
| 161 | - $finalIconFile->setImageFormat('png24'); |
|
| 162 | - if (defined("Imagick::INTERPOLATE_BICUBIC") === true) { |
|
| 163 | - $filter = Imagick::INTERPOLATE_BICUBIC; |
|
| 164 | - } else { |
|
| 165 | - $filter = Imagick::FILTER_LANCZOS; |
|
| 166 | - } |
|
| 167 | - $finalIconFile->resizeImage($size, $size, $filter, 1, false); |
|
| 168 | - |
|
| 169 | - $appIconFile->destroy(); |
|
| 170 | - return $finalIconFile; |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - public function colorSvg($app, $image) { |
|
| 174 | - try { |
|
| 175 | - $imageFile = $this->util->getAppImage($app, $image); |
|
| 176 | - } catch (AppPathNotFoundException $e) { |
|
| 177 | - return false; |
|
| 178 | - } |
|
| 179 | - $svg = file_get_contents($imageFile); |
|
| 180 | - if ($svg !== false && $svg !== "") { |
|
| 181 | - $color = $this->util->elementColor($this->themingDefaults->getColorPrimary()); |
|
| 182 | - $svg = $this->util->colorizeSvg($svg, $color); |
|
| 183 | - return $svg; |
|
| 184 | - } else { |
|
| 185 | - return false; |
|
| 186 | - } |
|
| 187 | - } |
|
| 31 | + /** @var ThemingDefaults */ |
|
| 32 | + private $themingDefaults; |
|
| 33 | + /** @var Util */ |
|
| 34 | + private $util; |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * IconBuilder constructor. |
|
| 38 | + * |
|
| 39 | + * @param ThemingDefaults $themingDefaults |
|
| 40 | + * @param Util $util |
|
| 41 | + */ |
|
| 42 | + public function __construct( |
|
| 43 | + ThemingDefaults $themingDefaults, |
|
| 44 | + Util $util |
|
| 45 | + ) { |
|
| 46 | + $this->themingDefaults = $themingDefaults; |
|
| 47 | + $this->util = $util; |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * @param $app string app name |
|
| 52 | + * @return string|false image blob |
|
| 53 | + */ |
|
| 54 | + public function getFavicon($app) { |
|
| 55 | + $icon = $this->renderAppIcon($app, 32); |
|
| 56 | + if($icon === false) { |
|
| 57 | + return false; |
|
| 58 | + } |
|
| 59 | + $icon->setImageFormat("png24"); |
|
| 60 | + $data = $icon->getImageBlob(); |
|
| 61 | + $icon->destroy(); |
|
| 62 | + return $data; |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * @param $app string app name |
|
| 67 | + * @return string|false image blob |
|
| 68 | + */ |
|
| 69 | + public function getTouchIcon($app) { |
|
| 70 | + $icon = $this->renderAppIcon($app, 512); |
|
| 71 | + if($icon === false) { |
|
| 72 | + return false; |
|
| 73 | + } |
|
| 74 | + $icon->setImageFormat("png24"); |
|
| 75 | + $data = $icon->getImageBlob(); |
|
| 76 | + $icon->destroy(); |
|
| 77 | + return $data; |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * Render app icon on themed background color |
|
| 82 | + * fallback to logo |
|
| 83 | + * |
|
| 84 | + * @param $app string app name |
|
| 85 | + * @param $size int size of the icon in px |
|
| 86 | + * @return Imagick|false |
|
| 87 | + */ |
|
| 88 | + public function renderAppIcon($app, $size) { |
|
| 89 | + try { |
|
| 90 | + $appIcon = $this->util->getAppIcon($app); |
|
| 91 | + $appIconContent = file_get_contents($appIcon); |
|
| 92 | + } catch (AppPathNotFoundException $e) { |
|
| 93 | + return false; |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + if($appIconContent === false) { |
|
| 97 | + return false; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + $color = $this->themingDefaults->getColorPrimary(); |
|
| 101 | + $mime = mime_content_type($appIcon); |
|
| 102 | + |
|
| 103 | + // generate background image with rounded corners |
|
| 104 | + $background = '<?xml version="1.0" encoding="UTF-8"?>' . |
|
| 105 | + '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:cc="http://creativecommons.org/ns#" width="512" height="512" xmlns:xlink="http://www.w3.org/1999/xlink">' . |
|
| 106 | + '<rect x="0" y="0" rx="100" ry="100" width="512" height="512" style="fill:' . $color . ';" />' . |
|
| 107 | + '</svg>'; |
|
| 108 | + // resize svg magic as this seems broken in Imagemagick |
|
| 109 | + if($mime === "image/svg+xml" || substr($appIconContent, 0, 4) === "<svg") { |
|
| 110 | + if(substr($appIconContent, 0, 5) !== "<?xml") { |
|
| 111 | + $svg = "<?xml version=\"1.0\"?>".$appIconContent; |
|
| 112 | + } else { |
|
| 113 | + $svg = $appIconContent; |
|
| 114 | + } |
|
| 115 | + $tmp = new Imagick(); |
|
| 116 | + $tmp->readImageBlob($svg); |
|
| 117 | + $x = $tmp->getImageWidth(); |
|
| 118 | + $y = $tmp->getImageHeight(); |
|
| 119 | + $res = $tmp->getImageResolution(); |
|
| 120 | + $tmp->destroy(); |
|
| 121 | + |
|
| 122 | + if($x>$y) { |
|
| 123 | + $max = $x; |
|
| 124 | + } else { |
|
| 125 | + $max = $y; |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + // convert svg to resized image |
|
| 129 | + $appIconFile = new Imagick(); |
|
| 130 | + $resX = (int)(512 * $res['x'] / $max * 2.53); |
|
| 131 | + $resY = (int)(512 * $res['y'] / $max * 2.53); |
|
| 132 | + $appIconFile->setResolution($resX, $resY); |
|
| 133 | + $appIconFile->setBackgroundColor(new ImagickPixel('transparent')); |
|
| 134 | + $appIconFile->readImageBlob($svg); |
|
| 135 | + $appIconFile->scaleImage(512, 512, true); |
|
| 136 | + } else { |
|
| 137 | + $appIconFile = new Imagick(); |
|
| 138 | + $appIconFile->setBackgroundColor(new ImagickPixel('transparent')); |
|
| 139 | + $appIconFile->readImageBlob(file_get_contents($appIcon)); |
|
| 140 | + $appIconFile->scaleImage(512, 512, true); |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + // offset for icon positioning |
|
| 144 | + $border_w = (int)($appIconFile->getImageWidth() * 0.05); |
|
| 145 | + $border_h = (int)($appIconFile->getImageHeight() * 0.05); |
|
| 146 | + $innerWidth = (int)($appIconFile->getImageWidth() - $border_w * 2); |
|
| 147 | + $innerHeight = (int)($appIconFile->getImageHeight() - $border_h * 2); |
|
| 148 | + $appIconFile->adaptiveResizeImage($innerWidth, $innerHeight); |
|
| 149 | + // center icon |
|
| 150 | + $offset_w = 512 / 2 - $innerWidth / 2; |
|
| 151 | + $offset_h = 512 / 2 - $innerHeight / 2; |
|
| 152 | + |
|
| 153 | + $appIconFile->setImageFormat("png24"); |
|
| 154 | + |
|
| 155 | + $finalIconFile = new Imagick(); |
|
| 156 | + $finalIconFile->setBackgroundColor(new ImagickPixel('transparent')); |
|
| 157 | + $finalIconFile->readImageBlob($background); |
|
| 158 | + $finalIconFile->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT); |
|
| 159 | + $finalIconFile->setImageArtifact('compose:args', "1,0,-0.5,0.5"); |
|
| 160 | + $finalIconFile->compositeImage($appIconFile, Imagick::COMPOSITE_ATOP, $offset_w, $offset_h); |
|
| 161 | + $finalIconFile->setImageFormat('png24'); |
|
| 162 | + if (defined("Imagick::INTERPOLATE_BICUBIC") === true) { |
|
| 163 | + $filter = Imagick::INTERPOLATE_BICUBIC; |
|
| 164 | + } else { |
|
| 165 | + $filter = Imagick::FILTER_LANCZOS; |
|
| 166 | + } |
|
| 167 | + $finalIconFile->resizeImage($size, $size, $filter, 1, false); |
|
| 168 | + |
|
| 169 | + $appIconFile->destroy(); |
|
| 170 | + return $finalIconFile; |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + public function colorSvg($app, $image) { |
|
| 174 | + try { |
|
| 175 | + $imageFile = $this->util->getAppImage($app, $image); |
|
| 176 | + } catch (AppPathNotFoundException $e) { |
|
| 177 | + return false; |
|
| 178 | + } |
|
| 179 | + $svg = file_get_contents($imageFile); |
|
| 180 | + if ($svg !== false && $svg !== "") { |
|
| 181 | + $color = $this->util->elementColor($this->themingDefaults->getColorPrimary()); |
|
| 182 | + $svg = $this->util->colorizeSvg($svg, $color); |
|
| 183 | + return $svg; |
|
| 184 | + } else { |
|
| 185 | + return false; |
|
| 186 | + } |
|
| 187 | + } |
|
| 188 | 188 | |
| 189 | 189 | } |
@@ -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,262 +31,262 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | class OC_Defaults { |
| 33 | 33 | |
| 34 | - private $theme; |
|
| 35 | - private $l; |
|
| 34 | + private $theme; |
|
| 35 | + private $l; |
|
| 36 | 36 | |
| 37 | - private $defaultEntity; |
|
| 38 | - private $defaultName; |
|
| 39 | - private $defaultTitle; |
|
| 40 | - private $defaultBaseUrl; |
|
| 41 | - private $defaultSyncClientUrl; |
|
| 42 | - private $defaultiOSClientUrl; |
|
| 43 | - private $defaultiTunesAppId; |
|
| 44 | - private $defaultAndroidClientUrl; |
|
| 45 | - private $defaultDocBaseUrl; |
|
| 46 | - private $defaultDocVersion; |
|
| 47 | - private $defaultSlogan; |
|
| 48 | - private $defaultLogoClaim; |
|
| 49 | - private $defaultMailHeaderColor; |
|
| 37 | + private $defaultEntity; |
|
| 38 | + private $defaultName; |
|
| 39 | + private $defaultTitle; |
|
| 40 | + private $defaultBaseUrl; |
|
| 41 | + private $defaultSyncClientUrl; |
|
| 42 | + private $defaultiOSClientUrl; |
|
| 43 | + private $defaultiTunesAppId; |
|
| 44 | + private $defaultAndroidClientUrl; |
|
| 45 | + private $defaultDocBaseUrl; |
|
| 46 | + private $defaultDocVersion; |
|
| 47 | + private $defaultSlogan; |
|
| 48 | + private $defaultLogoClaim; |
|
| 49 | + private $defaultMailHeaderColor; |
|
| 50 | 50 | |
| 51 | - function __construct() { |
|
| 52 | - $this->l = \OC::$server->getL10N('lib'); |
|
| 51 | + function __construct() { |
|
| 52 | + $this->l = \OC::$server->getL10N('lib'); |
|
| 53 | 53 | |
| 54 | - $this->defaultEntity = 'Nextcloud'; /* e.g. company name, used for footers and copyright notices */ |
|
| 55 | - $this->defaultName = 'Nextcloud'; /* short name, used when referring to the software */ |
|
| 56 | - $this->defaultTitle = 'Nextcloud'; /* can be a longer name, for titles */ |
|
| 57 | - $this->defaultBaseUrl = 'https://nextcloud.com'; |
|
| 58 | - $this->defaultSyncClientUrl = 'https://nextcloud.com/install/#install-clients'; |
|
| 59 | - $this->defaultiOSClientUrl = 'https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8'; |
|
| 60 | - $this->defaultiTunesAppId = '1125420102'; |
|
| 61 | - $this->defaultAndroidClientUrl = 'https://play.google.com/store/apps/details?id=com.nextcloud.client'; |
|
| 62 | - $this->defaultDocBaseUrl = 'https://docs.nextcloud.com'; |
|
| 63 | - $this->defaultDocVersion = '11'; // used to generate doc links |
|
| 64 | - $this->defaultSlogan = $this->l->t('a safe home for all your data'); |
|
| 65 | - $this->defaultLogoClaim = ''; |
|
| 66 | - $this->defaultMailHeaderColor = '#0082c9'; /* header color of mail notifications */ |
|
| 54 | + $this->defaultEntity = 'Nextcloud'; /* e.g. company name, used for footers and copyright notices */ |
|
| 55 | + $this->defaultName = 'Nextcloud'; /* short name, used when referring to the software */ |
|
| 56 | + $this->defaultTitle = 'Nextcloud'; /* can be a longer name, for titles */ |
|
| 57 | + $this->defaultBaseUrl = 'https://nextcloud.com'; |
|
| 58 | + $this->defaultSyncClientUrl = 'https://nextcloud.com/install/#install-clients'; |
|
| 59 | + $this->defaultiOSClientUrl = 'https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8'; |
|
| 60 | + $this->defaultiTunesAppId = '1125420102'; |
|
| 61 | + $this->defaultAndroidClientUrl = 'https://play.google.com/store/apps/details?id=com.nextcloud.client'; |
|
| 62 | + $this->defaultDocBaseUrl = 'https://docs.nextcloud.com'; |
|
| 63 | + $this->defaultDocVersion = '11'; // used to generate doc links |
|
| 64 | + $this->defaultSlogan = $this->l->t('a safe home for all your data'); |
|
| 65 | + $this->defaultLogoClaim = ''; |
|
| 66 | + $this->defaultMailHeaderColor = '#0082c9'; /* header color of mail notifications */ |
|
| 67 | 67 | |
| 68 | - $themePath = OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php'; |
|
| 69 | - if (file_exists($themePath)) { |
|
| 70 | - // prevent defaults.php from printing output |
|
| 71 | - ob_start(); |
|
| 72 | - require_once $themePath; |
|
| 73 | - ob_end_clean(); |
|
| 74 | - if (class_exists('OC_Theme')) { |
|
| 75 | - $this->theme = new OC_Theme(); |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - } |
|
| 68 | + $themePath = OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php'; |
|
| 69 | + if (file_exists($themePath)) { |
|
| 70 | + // prevent defaults.php from printing output |
|
| 71 | + ob_start(); |
|
| 72 | + require_once $themePath; |
|
| 73 | + ob_end_clean(); |
|
| 74 | + if (class_exists('OC_Theme')) { |
|
| 75 | + $this->theme = new OC_Theme(); |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * @param string $method |
|
| 82 | - */ |
|
| 83 | - private function themeExist($method) { |
|
| 84 | - if (isset($this->theme) && method_exists($this->theme, $method)) { |
|
| 85 | - return true; |
|
| 86 | - } |
|
| 87 | - return false; |
|
| 88 | - } |
|
| 80 | + /** |
|
| 81 | + * @param string $method |
|
| 82 | + */ |
|
| 83 | + private function themeExist($method) { |
|
| 84 | + if (isset($this->theme) && method_exists($this->theme, $method)) { |
|
| 85 | + return true; |
|
| 86 | + } |
|
| 87 | + return false; |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * Returns the base URL |
|
| 92 | - * @return string URL |
|
| 93 | - */ |
|
| 94 | - public function getBaseUrl() { |
|
| 95 | - if ($this->themeExist('getBaseUrl')) { |
|
| 96 | - return $this->theme->getBaseUrl(); |
|
| 97 | - } else { |
|
| 98 | - return $this->defaultBaseUrl; |
|
| 99 | - } |
|
| 100 | - } |
|
| 90 | + /** |
|
| 91 | + * Returns the base URL |
|
| 92 | + * @return string URL |
|
| 93 | + */ |
|
| 94 | + public function getBaseUrl() { |
|
| 95 | + if ($this->themeExist('getBaseUrl')) { |
|
| 96 | + return $this->theme->getBaseUrl(); |
|
| 97 | + } else { |
|
| 98 | + return $this->defaultBaseUrl; |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - /** |
|
| 103 | - * Returns the URL where the sync clients are listed |
|
| 104 | - * @return string URL |
|
| 105 | - */ |
|
| 106 | - public function getSyncClientUrl() { |
|
| 107 | - if ($this->themeExist('getSyncClientUrl')) { |
|
| 108 | - return $this->theme->getSyncClientUrl(); |
|
| 109 | - } else { |
|
| 110 | - return $this->defaultSyncClientUrl; |
|
| 111 | - } |
|
| 112 | - } |
|
| 102 | + /** |
|
| 103 | + * Returns the URL where the sync clients are listed |
|
| 104 | + * @return string URL |
|
| 105 | + */ |
|
| 106 | + public function getSyncClientUrl() { |
|
| 107 | + if ($this->themeExist('getSyncClientUrl')) { |
|
| 108 | + return $this->theme->getSyncClientUrl(); |
|
| 109 | + } else { |
|
| 110 | + return $this->defaultSyncClientUrl; |
|
| 111 | + } |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - /** |
|
| 115 | - * Returns the URL to the App Store for the iOS Client |
|
| 116 | - * @return string URL |
|
| 117 | - */ |
|
| 118 | - public function getiOSClientUrl() { |
|
| 119 | - if ($this->themeExist('getiOSClientUrl')) { |
|
| 120 | - return $this->theme->getiOSClientUrl(); |
|
| 121 | - } else { |
|
| 122 | - return $this->defaultiOSClientUrl; |
|
| 123 | - } |
|
| 124 | - } |
|
| 114 | + /** |
|
| 115 | + * Returns the URL to the App Store for the iOS Client |
|
| 116 | + * @return string URL |
|
| 117 | + */ |
|
| 118 | + public function getiOSClientUrl() { |
|
| 119 | + if ($this->themeExist('getiOSClientUrl')) { |
|
| 120 | + return $this->theme->getiOSClientUrl(); |
|
| 121 | + } else { |
|
| 122 | + return $this->defaultiOSClientUrl; |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | - /** |
|
| 127 | - * Returns the AppId for the App Store for the iOS Client |
|
| 128 | - * @return string AppId |
|
| 129 | - */ |
|
| 130 | - public function getiTunesAppId() { |
|
| 131 | - if ($this->themeExist('getiTunesAppId')) { |
|
| 132 | - return $this->theme->getiTunesAppId(); |
|
| 133 | - } else { |
|
| 134 | - return $this->defaultiTunesAppId; |
|
| 135 | - } |
|
| 136 | - } |
|
| 126 | + /** |
|
| 127 | + * Returns the AppId for the App Store for the iOS Client |
|
| 128 | + * @return string AppId |
|
| 129 | + */ |
|
| 130 | + public function getiTunesAppId() { |
|
| 131 | + if ($this->themeExist('getiTunesAppId')) { |
|
| 132 | + return $this->theme->getiTunesAppId(); |
|
| 133 | + } else { |
|
| 134 | + return $this->defaultiTunesAppId; |
|
| 135 | + } |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | - /** |
|
| 139 | - * Returns the URL to Google Play for the Android Client |
|
| 140 | - * @return string URL |
|
| 141 | - */ |
|
| 142 | - public function getAndroidClientUrl() { |
|
| 143 | - if ($this->themeExist('getAndroidClientUrl')) { |
|
| 144 | - return $this->theme->getAndroidClientUrl(); |
|
| 145 | - } else { |
|
| 146 | - return $this->defaultAndroidClientUrl; |
|
| 147 | - } |
|
| 148 | - } |
|
| 138 | + /** |
|
| 139 | + * Returns the URL to Google Play for the Android Client |
|
| 140 | + * @return string URL |
|
| 141 | + */ |
|
| 142 | + public function getAndroidClientUrl() { |
|
| 143 | + if ($this->themeExist('getAndroidClientUrl')) { |
|
| 144 | + return $this->theme->getAndroidClientUrl(); |
|
| 145 | + } else { |
|
| 146 | + return $this->defaultAndroidClientUrl; |
|
| 147 | + } |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - /** |
|
| 151 | - * Returns the documentation URL |
|
| 152 | - * @return string URL |
|
| 153 | - */ |
|
| 154 | - public function getDocBaseUrl() { |
|
| 155 | - if ($this->themeExist('getDocBaseUrl')) { |
|
| 156 | - return $this->theme->getDocBaseUrl(); |
|
| 157 | - } else { |
|
| 158 | - return $this->defaultDocBaseUrl; |
|
| 159 | - } |
|
| 160 | - } |
|
| 150 | + /** |
|
| 151 | + * Returns the documentation URL |
|
| 152 | + * @return string URL |
|
| 153 | + */ |
|
| 154 | + public function getDocBaseUrl() { |
|
| 155 | + if ($this->themeExist('getDocBaseUrl')) { |
|
| 156 | + return $this->theme->getDocBaseUrl(); |
|
| 157 | + } else { |
|
| 158 | + return $this->defaultDocBaseUrl; |
|
| 159 | + } |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | - /** |
|
| 163 | - * Returns the title |
|
| 164 | - * @return string title |
|
| 165 | - */ |
|
| 166 | - public function getTitle() { |
|
| 167 | - if ($this->themeExist('getTitle')) { |
|
| 168 | - return $this->theme->getTitle(); |
|
| 169 | - } else { |
|
| 170 | - return $this->defaultTitle; |
|
| 171 | - } |
|
| 172 | - } |
|
| 162 | + /** |
|
| 163 | + * Returns the title |
|
| 164 | + * @return string title |
|
| 165 | + */ |
|
| 166 | + public function getTitle() { |
|
| 167 | + if ($this->themeExist('getTitle')) { |
|
| 168 | + return $this->theme->getTitle(); |
|
| 169 | + } else { |
|
| 170 | + return $this->defaultTitle; |
|
| 171 | + } |
|
| 172 | + } |
|
| 173 | 173 | |
| 174 | - /** |
|
| 175 | - * Returns the short name of the software |
|
| 176 | - * @return string title |
|
| 177 | - */ |
|
| 178 | - public function getName() { |
|
| 179 | - if ($this->themeExist('getName')) { |
|
| 180 | - return $this->theme->getName(); |
|
| 181 | - } else { |
|
| 182 | - return $this->defaultName; |
|
| 183 | - } |
|
| 184 | - } |
|
| 174 | + /** |
|
| 175 | + * Returns the short name of the software |
|
| 176 | + * @return string title |
|
| 177 | + */ |
|
| 178 | + public function getName() { |
|
| 179 | + if ($this->themeExist('getName')) { |
|
| 180 | + return $this->theme->getName(); |
|
| 181 | + } else { |
|
| 182 | + return $this->defaultName; |
|
| 183 | + } |
|
| 184 | + } |
|
| 185 | 185 | |
| 186 | - /** |
|
| 187 | - * Returns the short name of the software containing HTML strings |
|
| 188 | - * @return string title |
|
| 189 | - */ |
|
| 190 | - public function getHTMLName() { |
|
| 191 | - if ($this->themeExist('getHTMLName')) { |
|
| 192 | - return $this->theme->getHTMLName(); |
|
| 193 | - } else { |
|
| 194 | - return $this->defaultName; |
|
| 195 | - } |
|
| 196 | - } |
|
| 186 | + /** |
|
| 187 | + * Returns the short name of the software containing HTML strings |
|
| 188 | + * @return string title |
|
| 189 | + */ |
|
| 190 | + public function getHTMLName() { |
|
| 191 | + if ($this->themeExist('getHTMLName')) { |
|
| 192 | + return $this->theme->getHTMLName(); |
|
| 193 | + } else { |
|
| 194 | + return $this->defaultName; |
|
| 195 | + } |
|
| 196 | + } |
|
| 197 | 197 | |
| 198 | - /** |
|
| 199 | - * Returns entity (e.g. company name) - used for footer, copyright |
|
| 200 | - * @return string entity name |
|
| 201 | - */ |
|
| 202 | - public function getEntity() { |
|
| 203 | - if ($this->themeExist('getEntity')) { |
|
| 204 | - return $this->theme->getEntity(); |
|
| 205 | - } else { |
|
| 206 | - return $this->defaultEntity; |
|
| 207 | - } |
|
| 208 | - } |
|
| 198 | + /** |
|
| 199 | + * Returns entity (e.g. company name) - used for footer, copyright |
|
| 200 | + * @return string entity name |
|
| 201 | + */ |
|
| 202 | + public function getEntity() { |
|
| 203 | + if ($this->themeExist('getEntity')) { |
|
| 204 | + return $this->theme->getEntity(); |
|
| 205 | + } else { |
|
| 206 | + return $this->defaultEntity; |
|
| 207 | + } |
|
| 208 | + } |
|
| 209 | 209 | |
| 210 | - /** |
|
| 211 | - * Returns slogan |
|
| 212 | - * @return string slogan |
|
| 213 | - */ |
|
| 214 | - public function getSlogan() { |
|
| 215 | - if ($this->themeExist('getSlogan')) { |
|
| 216 | - return $this->theme->getSlogan(); |
|
| 217 | - } else { |
|
| 218 | - return $this->defaultSlogan; |
|
| 219 | - } |
|
| 220 | - } |
|
| 210 | + /** |
|
| 211 | + * Returns slogan |
|
| 212 | + * @return string slogan |
|
| 213 | + */ |
|
| 214 | + public function getSlogan() { |
|
| 215 | + if ($this->themeExist('getSlogan')) { |
|
| 216 | + return $this->theme->getSlogan(); |
|
| 217 | + } else { |
|
| 218 | + return $this->defaultSlogan; |
|
| 219 | + } |
|
| 220 | + } |
|
| 221 | 221 | |
| 222 | - /** |
|
| 223 | - * Returns logo claim |
|
| 224 | - * @return string logo claim |
|
| 225 | - */ |
|
| 226 | - public function getLogoClaim() { |
|
| 227 | - if ($this->themeExist('getLogoClaim')) { |
|
| 228 | - return $this->theme->getLogoClaim(); |
|
| 229 | - } else { |
|
| 230 | - return $this->defaultLogoClaim; |
|
| 231 | - } |
|
| 232 | - } |
|
| 222 | + /** |
|
| 223 | + * Returns logo claim |
|
| 224 | + * @return string logo claim |
|
| 225 | + */ |
|
| 226 | + public function getLogoClaim() { |
|
| 227 | + if ($this->themeExist('getLogoClaim')) { |
|
| 228 | + return $this->theme->getLogoClaim(); |
|
| 229 | + } else { |
|
| 230 | + return $this->defaultLogoClaim; |
|
| 231 | + } |
|
| 232 | + } |
|
| 233 | 233 | |
| 234 | - /** |
|
| 235 | - * Returns short version of the footer |
|
| 236 | - * @return string short footer |
|
| 237 | - */ |
|
| 238 | - public function getShortFooter() { |
|
| 239 | - if ($this->themeExist('getShortFooter')) { |
|
| 240 | - $footer = $this->theme->getShortFooter(); |
|
| 241 | - } else { |
|
| 242 | - $footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' . |
|
| 243 | - ' rel="noreferrer">' .$this->getEntity() . '</a>'. |
|
| 244 | - ' – ' . $this->getSlogan(); |
|
| 245 | - } |
|
| 234 | + /** |
|
| 235 | + * Returns short version of the footer |
|
| 236 | + * @return string short footer |
|
| 237 | + */ |
|
| 238 | + public function getShortFooter() { |
|
| 239 | + if ($this->themeExist('getShortFooter')) { |
|
| 240 | + $footer = $this->theme->getShortFooter(); |
|
| 241 | + } else { |
|
| 242 | + $footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' . |
|
| 243 | + ' rel="noreferrer">' .$this->getEntity() . '</a>'. |
|
| 244 | + ' – ' . $this->getSlogan(); |
|
| 245 | + } |
|
| 246 | 246 | |
| 247 | - return $footer; |
|
| 248 | - } |
|
| 247 | + return $footer; |
|
| 248 | + } |
|
| 249 | 249 | |
| 250 | - /** |
|
| 251 | - * Returns long version of the footer |
|
| 252 | - * @return string long footer |
|
| 253 | - */ |
|
| 254 | - public function getLongFooter() { |
|
| 255 | - if ($this->themeExist('getLongFooter')) { |
|
| 256 | - $footer = $this->theme->getLongFooter(); |
|
| 257 | - } else { |
|
| 258 | - $footer = $this->getShortFooter(); |
|
| 259 | - } |
|
| 250 | + /** |
|
| 251 | + * Returns long version of the footer |
|
| 252 | + * @return string long footer |
|
| 253 | + */ |
|
| 254 | + public function getLongFooter() { |
|
| 255 | + if ($this->themeExist('getLongFooter')) { |
|
| 256 | + $footer = $this->theme->getLongFooter(); |
|
| 257 | + } else { |
|
| 258 | + $footer = $this->getShortFooter(); |
|
| 259 | + } |
|
| 260 | 260 | |
| 261 | - return $footer; |
|
| 262 | - } |
|
| 261 | + return $footer; |
|
| 262 | + } |
|
| 263 | 263 | |
| 264 | - /** |
|
| 265 | - * @param string $key |
|
| 266 | - */ |
|
| 267 | - public function buildDocLinkToKey($key) { |
|
| 268 | - if ($this->themeExist('buildDocLinkToKey')) { |
|
| 269 | - return $this->theme->buildDocLinkToKey($key); |
|
| 270 | - } |
|
| 271 | - return $this->getDocBaseUrl() . '/server/' . $this->defaultDocVersion . '/go.php?to=' . $key; |
|
| 272 | - } |
|
| 264 | + /** |
|
| 265 | + * @param string $key |
|
| 266 | + */ |
|
| 267 | + public function buildDocLinkToKey($key) { |
|
| 268 | + if ($this->themeExist('buildDocLinkToKey')) { |
|
| 269 | + return $this->theme->buildDocLinkToKey($key); |
|
| 270 | + } |
|
| 271 | + return $this->getDocBaseUrl() . '/server/' . $this->defaultDocVersion . '/go.php?to=' . $key; |
|
| 272 | + } |
|
| 273 | 273 | |
| 274 | - /** |
|
| 275 | - * Returns mail header color |
|
| 276 | - * @return string |
|
| 277 | - */ |
|
| 278 | - public function getColorPrimary() { |
|
| 274 | + /** |
|
| 275 | + * Returns mail header color |
|
| 276 | + * @return string |
|
| 277 | + */ |
|
| 278 | + public function getColorPrimary() { |
|
| 279 | 279 | |
| 280 | - if ($this->themeExist('getColorPrimary')) { |
|
| 281 | - return $this->theme->getColorPrimary(); |
|
| 282 | - } |
|
| 283 | - if ($this->themeExist('getMailHeaderColor')) { |
|
| 284 | - return $this->theme->getMailHeaderColor(); |
|
| 285 | - } |
|
| 286 | - return $this->defaultMailHeaderColor; |
|
| 287 | - } |
|
| 280 | + if ($this->themeExist('getColorPrimary')) { |
|
| 281 | + return $this->theme->getColorPrimary(); |
|
| 282 | + } |
|
| 283 | + if ($this->themeExist('getMailHeaderColor')) { |
|
| 284 | + return $this->theme->getMailHeaderColor(); |
|
| 285 | + } |
|
| 286 | + return $this->defaultMailHeaderColor; |
|
| 287 | + } |
|
| 288 | 288 | |
| 289 | - public function shouldReplaceIcons() { |
|
| 290 | - return false; |
|
| 291 | - } |
|
| 289 | + public function shouldReplaceIcons() { |
|
| 290 | + return false; |
|
| 291 | + } |
|
| 292 | 292 | } |