33
0
mirror of https://github.com/joomla-extensions/patchtester.git synced 2024-11-14 01:04:07 +00:00
patchtester/administrator/components/com_patchtester/PatchTester/View/DefaultHtmlView.php
Michael Babker cbd5fcc1dc Less else
2015-02-22 19:07:05 -05:00

61 lines
1.4 KiB
PHP

<?php
/**
* Patch testing component for the Joomla! CMS
*
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later
*/
namespace PatchTester\View;
/**
* Default HTML view class.
*
* @since 2.0
*/
class DefaultHtmlView extends \JViewHtml
{
/**
* Load a template file -- first look in the templates folder for an override
*
* @param string $tpl The name of the template source file; automatically searches the template paths and compiles as needed.
*
* @return string The output of the the template script.
*
* @since 2.0
* @throws \RuntimeException
*/
public function loadTemplate($tpl = null)
{
// Get the path to the file
$file = isset($tpl) ? $this->getLayout() . '_' . $tpl : $this->getLayout();
$path = $this->getPath($file);
if (!$path)
{
throw new \RuntimeException(\JText::sprintf('JLIB_APPLICATION_ERROR_LAYOUTFILE_NOT_FOUND', $file), 500);
}
// Unset so as not to introduce into template scope
unset($tpl);
unset($file);
// Never allow a 'this' property
if (isset($this->this))
{
unset($this->this);
}
// Start an output buffer.
ob_start();
// Load the template.
include $path;
// Get the layout contents.
$output = ob_get_clean();
return $output;
}
}