| Server IP : 104.21.80.248 / Your IP : 162.159.115.41 Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586 User : SYSTEM ( 0) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Inetpub/www/news/system/includes/output/ |
Upload File : |
<?php
/**
* basic output functions
*
* PHP version 5
*
* @category PHP
* @package PSI_Output
* @author Damien Roth <[email protected]>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.Output.inc.php 315 2009-09-02 15:48:31Z bigmichi1 $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* basic output functions for all output formats
*
* @category PHP
* @package PSI_Output
* @author Damien Roth <[email protected]>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class Template
{
/**
* Vars used in the template
*
* @var array
*/
private $_vars;
/**
* Template file
*
* @var string
*/
private $_file;
/**
* Constructor
*
* @param String $file the template file name
*/
public function __construct($file=null)
{
$this->_file = $file;
$this->_vars = array();
}
/**
* Set a template variable.
*
* @param string $name variable name
* @param string|array|Template $value variable value
*/
public function set($name, $value)
{
$this->_vars[$name] = is_object($value) ? $value->fetch() : $value;
}
/**
* Open, parse, and return the template file.
*
* @param string $file
*
* @return string
*/
public function fetch($file=null)
{
if (!$file) {
$file = $this->_file;
}
// Extract the vars to local namespace
extract($this->_vars);
// Start output buffering
ob_start();
include(PSI_APP_ROOT.$file);
// Get the contents of the buffer
$contents = ob_get_contents();
// End buffering and discard
ob_end_clean();
return $contents;
}
}