| Server IP : 180.180.241.3 / Your IP : 216.73.216.35 Web Server : Microsoft-IIS/7.5 System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /AppServ/www/app/webroot/news/tmp/install_5320fcc93572d/admin/helpers/ |
Upload File : |
<?php
/**
* @package Widgetkit
* @author YOOtheme http://www.yootheme.com
* @copyright Copyright (C) YOOtheme GmbH
* @license http://www.gnu.org/licenses/gpl.html GNU/GPL
*/
/*
Class: TemplateWidgetkitHelper
Template helper class, render layouts
*/
class TemplateWidgetkitHelper extends WidgetkitHelper {
/* slots */
protected $_slots = array();
/*
Function: render
Render a layout file
Parameters:
$name - Layout name
$args - Array of arguments
Returns:
String
*/
function render($name, $args = array()) {
$path = $this->widgetkit["path"];
if (strpos($name, ':')===false) {
$name = 'layouts:'.$name;
}
// load layout
$__layout = $path->path($name.'.php');
// render layout
if ($__layout != false) {
// import vars and get content
extract($args);
ob_start();
include($__layout);
return ob_get_clean();
}
trigger_error('<b>'.$name.'</b> not found in paths: ['.implode(', ',$path->getPaths('layouts')).']');
return null;
}
/*
Function: has
Slot exists ?
Parameters:
$name - Slot name
Returns:
Boolean
*/
function has($name) {
return isset($this->_slots[$name]);
}
/*
Function: get
Retrieve a slot
Parameters:
$name - Slot name
$default - Default content
Returns:
Mixed
*/
function get($name, $default = false) {
return isset($this->_slots[$name]) ? $this->slots[$name] : $default;
}
/*
Function: set
Set a slot
Parameters:
$name - Slot name
$content - Content
Returns:
Void
*/
function set($name, $content) {
$this->_slots[$name] = $content;
}
/*
Function: output
Outputs slot content
Parameters:
$name - Slot name
$default - Default content
Returns:
Boolean
*/
function output($name, $default = false) {
if (!isset($this->_slots[$name])) {
if (false !== $default) {
echo $default;
return true;
}
return false;
}
echo $this->_slots[$name];
return true;
}
}