/** * Kommentar-Formular initialisieren * @return string */ protected function assignCommentFormData() { if (!$this->config->system_comments_enabled || !$this->article->getComments()) { return ''; } $id = $this->session->exists() ? $this->session->getUserId() : null; $author = new \fpcm\model\users\author($id); if (!$this->buttonClicked('sendComment') && is_null($this->getRequestVar('newcomment')) && $this->session->exists()) { $this->newComment->setName($author->getDisplayname()); $this->newComment->setEmail($author->getEmail()); $this->newComment->setWebsite(\fpcm\classes\http::getHttpHost()); } $replacementTags = array('{{formHeadline}}' => $this->lang->translate('COMMENTS_PUBLIC_FORMHEADLINE'), '{{submitUrl}}' => $this->article->getArticleLink(), '{{nameDescription}}' => $this->lang->translate('COMMMENT_AUTHOR'), '{{nameField}}' => '<input type="text" class="fpcm-pub-textinput" name="newcomment[name]" value="' . $this->newComment->getName() . '">', '{{emailDescription}}' => $this->lang->translate('GLOBAL_EMAIL'), '{{emailField}}' => '<input type="text" class="fpcm-pub-textinput" name="newcomment[email]" value="' . $this->newComment->getEmail() . '">', '{{websiteDescription}}' => $this->lang->translate('COMMMENT_WEBSITE'), '{{websiteField}}' => '<input type="text" class="fpcm-pub-textinput" name="newcomment[website]" value="' . $this->newComment->getWebsite() . '">', '{{textfield}}' => '<textarea class="fpcm-pub-textarea" id="newcommenttext" name="newcomment[text]">' . $this->newComment->getText() . '</textarea>', '{{smileysDescription}}' => $this->lang->translate('HL_OPTIONS_SMILEYS'), '{{smileys}}' => $this->getSmileyList(), '{{tags}}' => htmlentities(\fpcm\model\comments\comment::COMMENT_TEXT_HTMLTAGS_FORM), '{{spampluginQuestion}}' => $this->captcha->createPluginText(), '{{spampluginField}}' => $this->captcha->createPluginInput(), '{{privateCheckbox}}' => '<input type="checkbox" class="fpcm-pub-checkboxinput" name="newcomment[private]" value="1">', '{{submitButton}}' => '<button type="submit" name="btnSendComment">' . $this->lang->translate('GLOBAL_SUBMIT') . '</button>', '{{resetButton}}' => '<button type="reset">' . $this->lang->translate('GLOBAL_RESET') . '</button>'); $this->commentFormTemplate->setReplacementTags($replacementTags); $parsed = $this->commentFormTemplate->parse(); if (!$this->isUtf8) { $parsed = utf8_decode($parsed); } return $parsed; }
/** * * @param \fpcm\model\articles\article $article * @return string */ protected function assignData(\fpcm\model\articles\article $article) { /** * @var \fpcm\model\pubtemplates\article */ $tpl = $this->template; $replacements = array('{{headline}}' => $article->getTitle(), '{{author}}' => isset($this->users[$article->getCreateuser()]) ? $this->users[$article->getCreateuser()] : $this->lang->translate('GLOBAL_NOTFOUND'), '{{date}}' => date($this->config->system_dtmask, $article->getCreatetime()), '{{permaLink}}:{{/permaLink}}' => $article->getArticleLink(), '{{commentLink}}:{{/commentLink}}' => $article->getArticleLink() . '#comments'); $tpl->setReplacementTags($replacements); return $tpl->parse(); }
/** * * @param \fpcm\model\articles\article $article * @return string */ protected function assignData(\fpcm\model\articles\article $article) { /** * @var \fpcm\model\pubtemplates\article */ $tpl = $this->template; $categoryTexts = array(); $categoryIcons = array(); foreach ($article->getCategories() as $categoryId) { /** * @var \fpcm\model\categories\category */ $category = isset($this->categories[$categoryId]) ? $this->categories[$categoryId] : false; if (!$category) { continue; } $categoryTexts[] = '<span class="fpcm-pub-category-text">' . $category->getName() . '</span>'; if (!$category->getIconPath()) { continue; } $categoryIcons[] = $category->getCategoryImage(); } $shareButtonParser = new \fpcm\model\pubtemplates\sharebuttons($article->getArticleLink(), $article->getTitle()); $commentCount = $this->config->system_comments_enabled && $article->getComments() ? isset($this->commentCounts[$article->getId()]) ? (int) $this->commentCounts[$article->getId()] : 0 : ''; $tpl->setCommentsEnabled($this->config->system_comments_enabled && $article->getComments()); if (isset($this->usersEmails[$article->getCreateuser()])) { $emailAddress = '<a href="mailto:' . $this->usersEmails[$article->getCreateuser()] . '">' . $this->users[$article->getCreateuser()] . '</a>'; } else { $emailAddress = ''; } $replacements = array('{{headline}}' => $article->getTitle(), '{{text}}' => $article->getContent(), '{{author}}' => isset($this->users[$article->getCreateuser()]) ? $this->users[$article->getCreateuser()] : $this->lang->translate('GLOBAL_NOTFOUND'), '{{authorEmail}}' => $emailAddress, '{{date}}' => date($this->config->system_dtmask, $article->getCreatetime()), '{{changeDate}}' => date($this->config->system_dtmask, $article->getChangetime()), '{{changeUser}}' => isset($this->users[$article->getChangeuser()]) ? $this->users[$article->getChangeuser()] : $this->lang->translate('GLOBAL_NOTFOUND'), '{{statusPinned}}' => $article->getPinned() ? $this->lang->translate('PUBLIC_ARTICLE_PINNED') : '', '{{shareButtons}}' => $shareButtonParser->parse(), '{{categoryIcons}}' => implode(PHP_EOL, $categoryIcons), '{{categoryTexts}}' => implode(PHP_EOL, $categoryTexts), '{{commentCount}}' => $commentCount, '{{permaLink}}:{{/permaLink}}' => $article->getArticleLink(), '{{commentLink}}:{{/commentLink}}' => $article->getArticleLink() . '#comments', '<readmore>:</readmore>' => $article->getMd5path(), '{{articleImage}}' => $article->getArticleImage(), '{{sources}}' => $article->getSources()); $tpl->setReplacementTags($replacements); $parsed = $tpl->parse(); if ($this->session->exists()) { $html = array(); $html[] = '<div class="fpcm-pub-articletoolbar-article fpcm-pub-articletoolbar-article' . $article->getId() . '">'; $html[] = '<a href="' . $article->getEditLink() . '">' . $this->lang->translate('HL_ARTICLE_EDIT') . '</a>'; $html[] = '</div>'; $parsed = implode(PHP_EOL, $html) . $parsed; } return $parsed; }