/** * Renders the content as html markup * * @httpMethod POST * @path / * @nickname doRender * @responseClass PSX_Data_ResultSet */ public function doRender() { if ($this->user->hasRight('content_page_preview')) { try { $oembed = $this->get->oembed('boolean'); $markdown = $this->get->markdown('boolean'); $input = Base::getRawInput(); $filter = new Filter\Html($this->registry, $this->user, $oembed); if ($markdown) { $input = Markdown::decode($input); } header('Content-Type: text/html'); echo $filter->apply($input); exit; } catch (\Exception $e) { $msg = new Message($e->getMessage(), false); $this->setResponse($msg); } } else { $msg = new Message('Access not allowed', false); $this->setResponse($msg, null, $this->user->isAnonymous() ? 401 : 403); } }
public function setText($text) { $text = Markdown::decode($text); $text = $this->_validate->apply($text, 'string', array(new Filter\Length(3, 4096), new AmunFilter\Html($this->_registry, $this->_user)), 'text', 'Text'); if (!$this->_validate->hasError()) { $this->text = $text; } else { throw new Exception($this->_validate->getLastError()); } }
public function process($file) { return \PSX\Util\Markdown::decode(file_get_contents($file)); }
public function setSummary($summary) { $summary = Markdown::decode($summary); $summary = $this->_validate->apply($summary, 'string', array(new Filter\Length(3, 4096), new AmunFilter\Html($this->_registry, $this->_user, true)), 'summary', 'Summary'); if (!$this->_validate->hasError()) { $this->summary = $summary; } else { throw new Exception($this->_validate->getLastError()); } }