* @license PHP License * @package WB * @subpackage content */ /** * Load base class */ WBClass::load( 'WBContent' ); /** * Content component: Static * * @version 0.1.1 * @package WB * @subpackage content */ class WBContent_Static extends WBContent { /** * my parameter list * @var array */ protected $config = array( 'tmpl' => 'blank', 'string' => '', 'responsestatus'=> 200, 'requiredgroup' => parent::GROUP_ANON, 'deniedtmpl' => 'accessDenied', ); /** * static string * @var string */ protected $string = ''; /** * HTTP-Status * @var int */ private $responseStatus = 200; /** * run * * run component * * @return array parameter list */ public function run() { $this->responseStatus = intval($this->config['responsestatus']); if (!empty($this->config['string'])) { $this->string = $this->config['string']; return $this->config; } $tmpl = $this->config['tmpl']; if (!$this->isUserInGroup($this->config['requiredgroup'])) { $tmpl = $this->config['deniedtmpl']; $this->responseStatus = 401; } $this->loadTemplates($tmpl); $this->addConfigAsGlobalVars(); $this->string = $this->tmpl->getParsedTemplate(); return $this->config; } /** * receive output * * fetch output of this content component * * @return string */ public function getString() { return $this->string; } /** * Get response status code * * @return int */ public function getStatusCode() { return $this->responseStatus; } }