* @license PHP License * @package WB * @subpackage content */ /** * Load base class */ WBClass::load('WBContent'); /** * Content component: Static * * @version 0.3.0 * @package WB * @subpackage content */ class WBContent_WXml extends WBContent { /** * parameter list * * - id string to generate md5-content id * - string default string for non existing content * - path URL path if not extracted from current URL * * @var array */ protected $config = array( 'id' => '', 'string' => 'empty', 'path' => '', 'class' => '', 'requiredgroup' => '', 'requirededitorgroup' => '' ); /** * Wombat XML editable content * @var WBMarkup_Wxml */ private $wxml; /** * run * * run component * * @return array parameter list */ public function run() { if (!empty($this->config['requiredgroup']) && !$this->isUserInGroup($this->config['requiredgroup'])) { $this->loadTemplates('Wxml/accessdenied', false); return $this->config; } if (empty($this->config['path'])) { $req = WBClass::create('WBRequest'); $this->config['path'] = $req->path; } $this->wxml = WBClass::create('WBMarkup_Wxml'); $cs = md5($this->config['id']); $content = $this->config['string']; $this->wxml->load($cs, $content); $this->wxml->setEditorGroup($this->config['requirededitorgroup']); $this->wxml->setClassName($this->config['class']); WBClass::load('WBString'); $url = WBString::replaceSuperPlaceholders('[[SELF]][[PATH]]', $this->config['path']); $this->wxml->setUrl($url); return $this->config; } /** * receive output * * Ask WBMarkup_Wxml for current HTML. * * @return string */ public function getString() { if ($this->wxml) { return $this->wxml->getHtml(); } return $this->tmpl->getParsedTemplate('snippet'); } } ?>