Exemplo n.º 1
0
 protected function beforeAction($actionName)
 {
     if (isset($_POST['MarkdownPreview'])) {
         // only needed when using markdown
         echo Markdown::processText(htmlentities($_POST['text']));
         return false;
     }
     return parent::beforeAction($actionName);
 }
Exemplo n.º 2
0
 /**
  * @param bool $full
  * @return string
  */
 public function getContent($full = true)
 {
     if (!$this->translation) {
         $this->translation = self::getDb()->table(BlogConfig::get()->tablesPrefix . 'posts_translations')->where("post_id = :id AND language = :lang", [':id' => $this->id, ':lang' => BlogConfig::get()->getActiveLanguage()])->first();
     }
     $content = $this->translation['content'];
     if (!$full) {
         $content = explode(BlogConfig::get()->introductionSeparator, $content, 2);
         $content = $content[0];
     } else {
         $content = str_replace(BlogConfig::get()->introductionSeparator, "", $content);
     }
     return Markdown::processText($content) . Html::get()->scriptFile(WebApp::get()->request()->getWebRoot() . 'main/highlight/highlight.pack.js') . Html::get()->cssFile(WebApp::get()->request()->getWebRoot() . 'main/highlight/styles/github.css') . Html::get()->script('hljs.tabReplace = \'    \';hljs.initHighlightingOnLoad();');
 }
Exemplo n.º 3
0
 public function getContent()
 {
     if (Config::value("FORUM_TEXT_PARSER_CALLBACK") && is_callable(Config::value("FORUM_TEXT_PARSER_CALLBACK"))) {
         $text = call_user_func(Config::value("FORUM_TEXT_PARSER_CALLBACK"), $this->content);
     } else {
         $text = Markdown::processText($this->content);
     }
     return $text . Html::get()->scriptFile(WebApp::get()->request()->getWebRoot() . 'main/highlight/highlight.pack.js') . Html::get()->cssFile(WebApp::get()->request()->getWebRoot() . 'main/highlight/styles/github.css') . Html::get()->script('hljs.tabReplace = \'    \';hljs.initHighlightingOnLoad();');
 }
Exemplo n.º 4
0
 public function getContent()
 {
     if ($this->deleted) {
         if ($this->deleted_user_id != $this->user_id) {
             return Html::get()->tag("div", Translator::get()->translate("[DELETED BY MODERATOR]"), ['class' => "forum-reply-deleted-message"]);
         } else {
             return Html::get()->tag("div", Translator::get()->translate("[DELETED]"), ['class' => "forum-reply-deleted-message"]);
         }
     }
     if (Config::value("FORUM_TEXT_PARSER_CALLBACK") && is_callable(Config::value("FORUM_TEXT_PARSER_CALLBACK"))) {
         $text = call_user_func(Config::value("FORUM_TEXT_PARSER_CALLBACK"), $this->content);
     } else {
         $text = Markdown::processText($this->content);
     }
     return $text . Html::get()->scriptFile(WebApp::get()->request()->getWebRoot() . 'main/highlight/highlight.pack.js') . Html::get()->cssFile(WebApp::get()->request()->getWebRoot() . 'main/highlight/styles/github.css') . Html::get()->script('hljs.tabReplace = \'    \';hljs.initHighlightingOnLoad();');
 }