Douglas Douglas  • 01.05.11 9:18

Class.tpl - autoalizada sem erros Empty Class.tpl - autoalizada sem erros 01.05.11 9:18

Reputação da mensagem: 100% (1 votos)
<blockquote><?php
/*=======================================================================
| RotCMS V2.0 - Inovação sem Limites
| #######################################################################
| Copyright (c) 2011, By 'Vinicius Ferrari'
| #######################################################################
| Este programa é software livre: você pode redistribuí-lo e / ou modificar
| Lo sob os termos da GNU General Public License como publicado pela
| A Free Software Foundation, tanto a versão 3 da Licença, ou
| (em sua opção) qualquer versão posterior.
| #######################################################################
| Este programa é distribuído na esperança que possa ser útil,
| mas SEM NENHUMA GARANTIA, nem mesmo a garantia implícita de
| COMERCIALIZAÇÃO ou ADEQUAÇÃO PARA UM DETERMINADO PROPÓSITO. Veja o
| GNU General Public License para mais detalhes.
\======================================================================*/

class uberTpl
{
private $outputData;
private $params = Array();
private $includeFiles = Array();

public function Init()
{
global $core, $users;

$this->SetParam('', 'Rot');
$this->SetParam('body_id', '');
$this->SetParam('page_title', ' ');
$this->SetParam('flash_build', 'flash_63_50');
$this->SetParam('web_build', 'crazzyr1');
$this->SetParam('web_build_str', 'crazzyr1');
$this->SetParam('req_path', WWW);
$this->SetParam('www', WWW);
$this->SetParam('hotel_status_fig', uberCore::GetSystemStatusString(true));
$this->SetParam('hotel_status', uberCore::GetSystemStatusString(false));

if (LOGGED_IN)
{
$this->SetParam('habboLoggedIn', 'true');
$this->SetParam('habboName', USER_NAME);
$this->SetParam('vipbalance', '<b>' .
$users->GetUserVar(USER_ID, 'vip_points') . ' <img src="' . WWW .
'/images/vipcoin.gif" style="vertical-align: middle;"></b>');
}
else
{
$this->SetParam('habboLoggedIn', 'null');
$this->SetParam('habboName', 'null');
}
}

public function AddIncludeSet($set)
{
switch (strtolower($set))
{
case "frontpage":

$this->AddIncludeFile(new IncludeFile('text/javascript',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/static/js/libs2.js'));
$this->AddIncludeFile(new IncludeFile('text/javascript',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/static/js/landing.js'));
$this->AddIncludeFile(new IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/v2/styles/frontpage.css',
'stylesheet'));
break;

case "register":

$this->AddIncludeFile(new IncludeFile('text/javascript',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/static/js/visual.js'));
$this->AddIncludeFile(new IncludeFile('text/javascript',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/static/js/common.js'));

$this->AddIncludeFile(new IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/v2/styles/style.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/v2/styles/buttons.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/v2/styles/boxes.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/v2/styles/tooltips.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/v2/styles/embeddedregistration.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/javascript',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/static/js/simpleregistration.js'));
break;

case "process-template":

$this->AddIncludeFile(new IncludeFile('text/javascript',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/static/js/libs2.js'));
$this->AddIncludeFile(new IncludeFile('text/javascript',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/static/js/visual.js'));
$this->AddIncludeFile(new IncludeFile('text/javascript',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/static/js/libs.js'));
$this->AddIncludeFile(new IncludeFile('text/javascript',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/static/js/common.js'));
$this->AddIncludeFile(new IncludeFile('text/javascript',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/static/js/fullcontent.js'));
$this->AddIncludeFile(new IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/v2/styles/style.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/v2/styles/buttons.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/v2/styles/boxes.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/v2/styles/tooltips.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/v2/styles/process.css',
'stylesheet'));
break;

case 'myhabbo':

$this->AddIncludeFile(new IncludeFile('text/javascript',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/static/js/libs2.js'));
$this->AddIncludeFile(new IncludeFile('text/javascript',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/static/js/visual.js'));
$this->AddIncludeFile(new IncludeFile('text/javascript',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/static/js/libs.js'));
$this->AddIncludeFile(new IncludeFile('text/javascript',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/static/js/common.js'));
$this->AddIncludeFile(new IncludeFile('text/javascript',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/static/js/fullcontent.js'));
$this->AddIncludeFile(new IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/v2/styles/style.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/v2/styles/buttons.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/v2/styles/boxes.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/v2/styles/tooltips.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/styles/myhabbo/myhabbo.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/styles/myhabbo/skins.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/styles/myhabbo/dialogs.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/styles/myhabbo/buttons.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/styles/myhabbo/control.textarea.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/styles/myhabbo/boxes.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/v2/styles/myhabbo.css',
'stylesheet'));
$this->AddIncludeFile(new IncludeFile('text/css', 'http://www.habbo.com/myhabbo/styles/assets.css', 'stylesheet'));
$this->AddIncludeFile(new IncludeFile('text/javascript',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/static/js/homeview.js'));
$this->AddIncludeFile(new IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/v2/styles/lightwindow.css',
'stylesheet'));
break;

case 'default':
default:

$this->AddIncludeFile(new IncludeFile('text/javascript',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/static/js/libs2.js'));
$this->AddIncludeFile(new IncludeFile('text/javascript',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/static/js/visual.js'));
$this->AddIncludeFile(new IncludeFile('text/javascript',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/static/js/libs.js'));
$this->AddIncludeFile(new IncludeFile('text/javascript',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/static/js/common.js'));
$this->AddIncludeFile(new IncludeFile('text/javascript',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/static/js/fullcontent.js'));
$this->AddIncludeFile(new IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/v2/styles/style.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/v2/styles/buttons.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/v2/styles/boxes.css',
'stylesheet'));
$this->AddIncludeFile(new
IncludeFile('text/css',
'http://cms.host.crazzy.com.br/cms/crazzycmsr1.0/web-gallery/v2/styles/tooltips.css',
'stylesheet'));
break;
}
}

public function AddGeneric($tplName)
{
$tpl = new Template($tplName);
$this->outputData .= $tpl->GetHtml();
}

public function AddTemplate($tpl)
{
$this->outputData .= $tpl->GetHtml();
}

public function SetParam($param, $value)
{
$this->params[$param] = is_object($value) ? $value->fetch() : $value;
}

public function UnsetParam($param)
{
unset($this->params[$param]);
}

public function AddIncludeFile($incFile)
{
$this->includeFiles[] = $incFile;
}

public function WriteIncludeFiles()
{
foreach ($this->includeFiles as $f)
{
$this->Write($f->GetHtml() . LB);
}
}

public function Write($str)
{
$this->outputData .= $str;
}

public function FilterParams($str)
{
foreach ($this->params as $param => $value)
{
$str = str_ireplace('%' . $param . '%', $value, $str);
}

return $str;
}

public function Output()
{
global $core;

$this->Write(LB . LB . '<!-- Habbo Client 100% criado e editado por Vinicius Ferrari -->' . LB . LB);

echo $this->FilterParams($this->outputData);
}
}

class Template
{
private $params = Array();
private $tplName = '';

public function Template($tplName)
{
$this->tplName = $tplName;
}

public function GetHtml()
{
global $users;

extract($this->params);

$file = CWD . 'inc/tpl/' . $this->tplName . '.tpl';

if (!file_exists($file))
{
uberCore::SystemError('Modelo de erro do sistema', 'Não foi possível carregar modelo: ' . $this->tplName);
}

ob_start();
include($file);
$data = ob_get_contents();
ob_end_clean();

return $this->FilterParams($data);
}

public function FilterParams($str)
{
foreach ($this->params as $param => $value)
{
if (is_object($value))
{
continue;
}

$str = str_ireplace('%' . $param . '%', $value, $str);
}

return $str;
}

public function SetParam($param, $value)
{
$this->params[$param] = $value;
}

public function UnsetParam($param)
{
unset($this->params[$param]);
}
}

class IncludeFile
{
private $type;
private $src;
private $rel;
private $name;

public function IncludeFile($type, $src, $rel = '', $name = '')
{
global $tpl;

$this->type = $type;
$this->src = $src;
$this->rel = $rel;
$this->name = $name;
}

public function GetHtml()
{
switch ($this->type)
{
case 'application/rss+xml':

return '<link rel="' . $this->rel . '" type="' .
$this->type . '" title="' . $this->name . '" href="' .
$this->src . '" />';

case 'text/javascript':

return '<script src="' . $this->src . '" type="text/javascript"></script>';

case 'text/css':
default:

return '<link rel="' . $this->rel . '" href="' . $this->src . '" type="' . $this->type . '" />';
}
}
}

?>

</blockquote>



==============================================================================================
Aii Galerá éssa é a Class.tpl
Espero que funcionem pra vcs ai. OBRG

Creditos : Vinicius Ferrari E CrazzY
Permissões neste sub-fórum
Não podes responder a tópicos

BH Servers

Recomendamos a BH Servers com proteção DDOS gratuita em Cloud Server de alta performance. Entrega imediata.