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
Branches
Tags
No related merge requests found
......@@ -352,6 +352,11 @@ class Initializer
$this->resourceContainer->addJs($js);
}
// Select encoding:
if ($encoding = $currentThemeInfo->get('encoding')) {
$this->resourceContainer->setEncoding($encoding);
}
// Select favicon:
if ($favicon = $currentThemeInfo->get('favicon')) {
$this->resourceContainer->setFavicon($favicon);
......
......@@ -41,6 +41,7 @@ class ResourceContainer
protected $css = array();
protected $js = array();
protected $favicon = null;
protected $encoding = 'UTF-8';
/**
* Add a CSS file.
......@@ -98,6 +99,28 @@ class ResourceContainer
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.
*
......
......@@ -49,6 +49,12 @@ class HeadThemeResources extends AbstractHelper
{
$resourceContainer = ThemeTools::getResourceContainer();
// Set up encoding:
$headMeta = $this->getView()->plugin('headmeta');
$headMeta()->appendHttpEquiv(
'Content-Type', 'text/html; charset=' . $resourceContainer->getEncoding()
);
// Load CSS:
$headLink = $this->getView()->plugin('headlink');
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