Skip to content

Commit

Permalink
Templates are in the scope of JDocument. Fixes #10847
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Babker authored and wilsonge committed Sep 3, 2016
1 parent a905a01 commit 09fe795
Show file tree
Hide file tree
Showing 23 changed files with 105 additions and 96 deletions.
2 changes: 2 additions & 0 deletions administrator/templates/hathor/component.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

defined('_JEXEC') or die;

/** @var JDocumentHtml $this */

// Get additional language strings prefixed with TPL_HATHOR
// @todo: Do we realy need this?
$lang = JFactory::getLanguage();
Expand Down
2 changes: 2 additions & 0 deletions administrator/templates/hathor/cpanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

defined('_JEXEC') or die;

/** @var JDocumentHtml $this */

$app = JFactory::getApplication();
$lang = JFactory::getLanguage();

Expand Down
2 changes: 2 additions & 0 deletions administrator/templates/hathor/error.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

defined('_JEXEC') or die;

/** @var JDocumentError $this */

$app = JFactory::getApplication();
?>
<!DOCTYPE html>
Expand Down
2 changes: 2 additions & 0 deletions administrator/templates/hathor/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

defined('_JEXEC') or die;

/** @var JDocumentHtml $this */

$app = JFactory::getApplication();
$lang = JFactory::getLanguage();

Expand Down
2 changes: 2 additions & 0 deletions administrator/templates/hathor/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

defined('_JEXEC') or die;

/** @var JDocumentHtml $this */

$app = JFactory::getApplication();
$lang = JFactory::getLanguage();

Expand Down
21 changes: 10 additions & 11 deletions administrator/templates/isis/component.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,21 @@

defined('_JEXEC') or die;

$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$lang = JFactory::getLanguage();
$this->language = $doc->language;
$this->direction = $doc->direction;
/** @var JDocumentHtml $this */

$app = JFactory::getApplication();
$lang = JFactory::getLanguage();

// Output as HTML5
$doc->setHtml5(true);
$this->setHtml5(true);

// Add JavaScript Frameworks
JHtml::_('bootstrap.framework');

$doc->addScriptVersion($this->baseurl . '/templates/' . $this->template . '/js/template.js');
$this->addScriptVersion($this->baseurl . '/templates/' . $this->template . '/js/template.js');

// Add Stylesheets
$doc->addStyleSheetVersion($this->baseurl . '/templates/' . $this->template . '/css/template.css');
$this->addStyleSheetVersion($this->baseurl . '/templates/' . $this->template . '/css/template.css');

// Load optional RTL Bootstrap CSS
JHtml::_('bootstrap.loadCss', false, $this->direction);
Expand All @@ -34,21 +33,21 @@

if (is_file($file))
{
$doc->addStyleSheet($file);
$this->addStyleSheet($file);
}

// Load custom.css
$file = 'templates/' . $this->template . '/css/custom.css';

if (is_file($file))
{
$doc->addStyleSheetVersion($file);
$this->addStyleSheetVersion($file);
}

// Link color
if ($this->params->get('linkColor'))
{
$doc->addStyleDeclaration('a { color: ' . $this->params->get('linkColor') . '; }');
$this->addStyleDeclaration('a { color: ' . $this->params->get('linkColor') . '; }');
}
?>
<!DOCTYPE html>
Expand Down
19 changes: 6 additions & 13 deletions administrator/templates/isis/error.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,15 @@

use Joomla\Registry\Registry;

/** @var JDocumentError $this */

// Getting params from template
$params = JFactory::getApplication()->getTemplate(true)->params;

$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$lang = JFactory::getLanguage();
$this->language = $doc->language;
$this->direction = $doc->direction;
$input = $app->input;
$user = JFactory::getUser();

// Output document as HTML5.
if (is_callable(array($doc, 'setHtml5')))
{
$doc->setHtml5(true);
}
$app = JFactory::getApplication();
$lang = JFactory::getLanguage();
$input = $app->input;
$user = JFactory::getUser();

// Gets the FrontEnd Main page Uri
$frontEndUri = JUri::getInstance(JUri::root());
Expand Down
31 changes: 15 additions & 16 deletions administrator/templates/isis/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@

defined('_JEXEC') or die;

$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$lang = JFactory::getLanguage();
$this->language = $doc->language;
$this->direction = $doc->direction;
$input = $app->input;
$user = JFactory::getUser();
/** @var JDocumentHtml $this */

$app = JFactory::getApplication();
$lang = JFactory::getLanguage();
$input = $app->input;
$user = JFactory::getUser();

// Output as HTML5
$doc->setHtml5(true);
$this->setHtml5(true);

// Gets the FrontEnd Main page Uri
$frontEndUri = JUri::getInstance(JUri::root());
Expand All @@ -28,25 +27,25 @@
// Add JavaScript Frameworks
JHtml::_('bootstrap.framework');

$doc->addScriptVersion($this->baseurl . '/templates/' . $this->template . '/js/template.js');
$this->addScriptVersion($this->baseurl . '/templates/' . $this->template . '/js/template.js');

// Add Stylesheets
$doc->addStyleSheetVersion($this->baseurl . '/templates/' . $this->template . '/css/template' . ($this->direction == 'rtl' ? '-rtl' : '') . '.css');
$this->addStyleSheetVersion($this->baseurl . '/templates/' . $this->template . '/css/template' . ($this->direction == 'rtl' ? '-rtl' : '') . '.css');

// Load specific language related CSS
$languageCss = 'language/' . $lang->getTag() . '/' . $lang->getTag() . '.css';

if (file_exists($languageCss) && filesize($languageCss) > 0)
{
$doc->addStyleSheetVersion($languageCss);
$this->addStyleSheetVersion($languageCss);
}

// Load custom.css
$customCss = 'templates/' . $this->template . '/css/custom.css';

if (file_exists($customCss) && filesize($customCss) > 0)
{
$doc->addStyleSheetVersion($customCss);
$this->addStyleSheetVersion($customCss);
}

// Detecting Active Variables
Expand Down Expand Up @@ -126,7 +125,7 @@ function colorIsLight($color)
// Template color
if ($navbar_color)
{
$doc->addStyleDeclaration("
$this->addStyleDeclaration("
.navbar-inner,
.navbar-inverse .navbar-inner,
.dropdown-menu li > a:hover,
Expand All @@ -143,7 +142,7 @@ function colorIsLight($color)
// Template header color
if ($header_color)
{
$doc->addStyleDeclaration("
$this->addStyleDeclaration("
.header {
background: " . $header_color . ";
}");
Expand All @@ -152,7 +151,7 @@ function colorIsLight($color)
// Sidebar background color
if ($this->params->get('sidebarColor'))
{
$doc->addStyleDeclaration("
$this->addStyleDeclaration("
.nav-list > .active > a,
.nav-list > .active > a:hover {
background: " . $this->params->get('sidebarColor') . ";
Expand All @@ -162,7 +161,7 @@ function colorIsLight($color)
// Link color
if ($this->params->get('linkColor'))
{
$doc->addStyleDeclaration("
$this->addStyleDeclaration("
a,
.j-toggle-sidebar-button {
color: " . $this->params->get('linkColor') . ";
Expand Down
17 changes: 9 additions & 8 deletions administrator/templates/isis/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@

defined('_JEXEC') or die;

/** @var JDocumentHtml $this */

$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$lang = JFactory::getLanguage();

// Output as HTML5
$doc->setHtml5(true);
$this->setHtml5(true);

// Gets the FrontEnd Main page Uri
$frontEndUri = JUri::getInstance(JUri::root());
Expand All @@ -29,7 +30,7 @@
JHtml::_('bootstrap.tooltip');

// Add Stylesheets
$doc->addStyleSheetVersion($this->baseurl . '/templates/' . $this->template . '/css/template' . ($this->direction == 'rtl' ? '-rtl' : '') . '.css');
$this->addStyleSheetVersion($this->baseurl . '/templates/' . $this->template . '/css/template' . ($this->direction == 'rtl' ? '-rtl' : '') . '.css');

// Load optional RTL Bootstrap CSS
JHtml::_('bootstrap.loadCss', false, $this->direction);
Expand All @@ -39,15 +40,15 @@

if (is_file($file))
{
$doc->addStyleSheet($file);
$this->addStyleSheet($file);
}

// Load custom.css
$file = 'templates/' . $this->template . '/css/custom.css';

if (is_file($file))
{
$doc->addStyleSheetVersion($file);
$this->addStyleSheetVersion($file);
}

// Detecting Active Variables
Expand All @@ -71,14 +72,14 @@ function colorIsLight($color)
// Background color
if ($background_color)
{
$doc->addStyleDeclaration("
$this->addStyleDeclaration("
.view-login {
background-color: " . $background_color . ";
}");
}

// Responsive Styles
$doc->addStyleDeclaration("
$this->addStyleDeclaration("
@media (max-width: 480px) {
.view-login .container {
margin-top: -170px;
Expand All @@ -92,7 +93,7 @@ function colorIsLight($color)
// Check if debug is on
if (JPluginHelper::isEnabled('system', 'debug') && ($app->get('debug_lang', 0) || $app->get('debug', 0)))
{
$doc->addStyleDeclaration("
$this->addStyleDeclaration("
.view-login .container {
position: static;
margin-top: 20px;
Expand Down
2 changes: 2 additions & 0 deletions administrator/templates/system/component.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

defined('_JEXEC') or die;

/** @var JDocumentHtml $this */

// Output as HTML5
$this->setHtml5(true);
?>
Expand Down
3 changes: 3 additions & 0 deletions administrator/templates/system/error.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
*/

defined('_JEXEC') or die;

/** @var JDocumentError $this */

?>
<!DOCTYPE html>
<html lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
Expand Down
5 changes: 3 additions & 2 deletions installation/template/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

defined('_JEXEC') or die;

/** @var JDocumentHtml $this */

// Add Stylesheets
JHtml::_('bootstrap.loadCss', true, $this->direction);
JHtml::_('stylesheet', 'installation/template/css/template.css');
Expand All @@ -19,7 +21,6 @@
JHtml::_('behavior.formvalidator');
JHtml::_('script', 'installation/template/js/installation.js');


// Load JavaScript message titles
JText::script('ERROR');
JText::script('WARNING');
Expand Down Expand Up @@ -54,7 +55,7 @@
});
</script>
</head>
<body data-basepath="<?php echo JURI::root(true); ?>">
<body data-basepath="<?php echo JUri::root(true); ?>">
<!-- Header -->
<div class="header">
<img src="<?php echo $this->baseurl ?>/template/images/joomla.png" alt="Joomla" />
Expand Down
2 changes: 1 addition & 1 deletion libraries/joomla/document/document.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ public function getType()
/**
* Get the contents of the document buffer
*
* @return The contents of the document buffer
* @return mixed
*
* @since 11.1
*/
Expand Down
2 changes: 2 additions & 0 deletions templates/beez3/component.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

defined('_JEXEC') or die;

/** @var JDocumentHtml $this */

$color = $this->params->get('templatecolor');

// Output as HTML5
Expand Down
2 changes: 2 additions & 0 deletions templates/beez3/error.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

defined('_JEXEC') or die;

/** @var JDocumentError $this */

$showRightColumn = 0;
$showleft = 0;
$showbottom = 0;
Expand Down
2 changes: 2 additions & 0 deletions templates/beez3/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
// No direct access.
defined('_JEXEC') or die;

/** @var JDocumentHtml $this */

JLoader::import('joomla.filesystem.file');

// Check modules
Expand Down
11 changes: 5 additions & 6 deletions templates/protostar/component.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@

defined('_JEXEC') or die;

$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$this->language = $doc->language;
$this->direction = $doc->direction;
/** @var JDocumentHtml $this */

$app = JFactory::getApplication();

// Output as HTML5
$doc->setHtml5(true);
$this->setHtml5(true);

// Add JavaScript Frameworks
JHtml::_('bootstrap.framework');

// Add Stylesheets
$doc->addStyleSheetVersion($this->baseurl . '/templates/' . $this->template . '/css/template.css');
$this->addStyleSheetVersion($this->baseurl . '/templates/' . $this->template . '/css/template.css');

// Load optional rtl Bootstrap css and Bootstrap bugfixes
JHtmlBootstrap::loadCss($includeMaincss = false, $this->direction);
Expand Down
Loading

0 comments on commit 09fe795

Please sign in to comment.