The Gitlab instance will be restarted on Monday April 28th at 2AM. There will be a short interruption of service.

Skip to content
Snippets Groups Projects
Commit 535c979a authored by Demian Katz's avatar Demian Katz
Browse files

Created mechanism for configuring character encoding via theme.ini; default to UTF-8.

parent 29f640c0
No related merge requests found
...@@ -352,6 +352,11 @@ class Initializer ...@@ -352,6 +352,11 @@ class Initializer
$this->resourceContainer->addJs($js); $this->resourceContainer->addJs($js);
} }
// Select encoding:
if ($encoding = $currentThemeInfo->get('encoding')) {
$this->resourceContainer->setEncoding($encoding);
}
// Select favicon: // Select favicon:
if ($favicon = $currentThemeInfo->get('favicon')) { if ($favicon = $currentThemeInfo->get('favicon')) {
$this->resourceContainer->setFavicon($favicon); $this->resourceContainer->setFavicon($favicon);
......
...@@ -41,6 +41,7 @@ class ResourceContainer ...@@ -41,6 +41,7 @@ class ResourceContainer
protected $css = array(); protected $css = array();
protected $js = array(); protected $js = array();
protected $favicon = null; protected $favicon = null;
protected $encoding = 'UTF-8';
/** /**
* Add a CSS file. * Add a CSS file.
...@@ -98,6 +99,28 @@ class ResourceContainer ...@@ -98,6 +99,28 @@ class ResourceContainer
return array_unique($this->js); return array_unique($this->js);
} }
/**
* Set the encoding.
*
* @param string $e New encoding
*
* @return void
*/
public function setEncoding($e)
{
$this->encoding = $e;
}
/**
* Get the encoding.
*
* @return void
*/
public function getEncoding()
{
return $this->encoding;
}
/** /**
* Set the favicon. * Set the favicon.
* *
......
...@@ -49,6 +49,12 @@ class HeadThemeResources extends AbstractHelper ...@@ -49,6 +49,12 @@ class HeadThemeResources extends AbstractHelper
{ {
$resourceContainer = ThemeTools::getResourceContainer(); $resourceContainer = ThemeTools::getResourceContainer();
// Set up encoding:
$headMeta = $this->getView()->plugin('headmeta');
$headMeta()->appendHttpEquiv(
'Content-Type', 'text/html; charset=' . $resourceContainer->getEncoding()
);
// Load CSS: // Load CSS:
$headLink = $this->getView()->plugin('headlink'); $headLink = $this->getView()->plugin('headlink');
foreach ($resourceContainer->getCss() as $current) { foreach ($resourceContainer->getCss() as $current) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment