/** * Parse the data into the template */ private function parse() { // get vars $title = \SpoonFilter::ucfirst(FL::msg('BlogAllComments')); $link = SITE_URL . FrontendNavigation::getURLForBlock('Blog'); $detailLink = SITE_URL . FrontendNavigation::getURLForBlock('Blog', 'Detail'); $description = null; // create new rss instance $rss = new FrontendRSS($title, $link, $description); // loop articles foreach ($this->items as $item) { // init vars $title = $item['author'] . ' ' . FL::lbl('On') . ' ' . $item['post_title']; $link = $detailLink . '/' . $item['post_url'] . '/#comment-' . $item['id']; $description = $item['text']; // create new instance $rssItem = new FrontendRSSItem($title, $link, $description); // set item properties $rssItem->setPublicationDate($item['created_on']); $rssItem->setAuthor($item['author']); // add item $rss->addItem($rssItem); } $rss->parse(); }
/** * Load the data, don't forget to validate the incoming data */ private function getData() { // validate incoming parameters if ($this->URL->getParameter(1) === null) { $this->redirect(FrontendNavigation::getURL(404)); } // fetch record $this->record = FrontendTagsModel::get($this->URL->getParameter(1)); // validate record if (empty($this->record)) { $this->redirect(FrontendNavigation::getURL(404)); } // fetch modules $this->modules = FrontendTagsModel::getModulesForTag($this->record['id']); // loop modules foreach ($this->modules as $module) { // get the ids of the items linked to the tag $otherIds = (array) $this->get('database')->getColumn('SELECT other_id FROM modules_tags WHERE module = ? AND tag_id = ?', array($module, $this->record['id'])); // set module class $class = 'Frontend\\Modules\\' . $module . '\\Engine\\Model'; // get the items that are linked to the tags $items = (array) FrontendTagsModel::callFromInterface($module, $class, 'getForTags', $otherIds); // add into results array if (!empty($items)) { $this->results[] = array('name' => $module, 'label' => FL::lbl(\SpoonFilter::ucfirst($module)), 'items' => $items); } } }
/** * Parse the data into the template */ private function parse() { // get vars $title = isset($this->settings['rss_title_' . LANGUAGE]) ? $this->settings['rss_title_' . LANGUAGE] : $this->get('fork.settings')->get('Blog', 'rss_title_' . LANGUAGE, SITE_DEFAULT_TITLE); $link = SITE_URL . FrontendNavigation::getURLForBlock('Blog'); $description = isset($this->settings['rss_description_' . LANGUAGE]) ? $this->settings['rss_description_' . LANGUAGE] : null; // create new rss instance $rss = new FrontendRSS($title, $link, $description); // loop articles foreach ($this->items as $item) { // init vars $title = $item['title']; $link = $item['full_url']; $description = $item['introduction'] != '' ? $item['introduction'] : $item['text']; // meta is wanted if ($this->get('fork.settings')->get('Blog', 'rss_meta_' . LANGUAGE, true)) { // append meta $description .= '<div class="meta">' . "\n"; $description .= ' <p><a href="' . $link . '" title="' . $title . '">' . $title . '</a> ' . sprintf(FL::msg('WrittenBy'), FrontendUser::getBackendUser($item['user_id'])->getSetting('nickname')); $description .= ' ' . FL::lbl('In') . ' <a href="' . $item['category_full_url'] . '" title="' . $item['category_title'] . '">' . $item['category_title'] . '</a>.</p>' . "\n"; // any tags if (isset($item['tags'])) { // append tags-paragraph $description .= ' <p>' . \SpoonFilter::ucfirst(FL::lbl('Tags')) . ': '; $first = true; // loop tags foreach ($item['tags'] as $tag) { // prepend separator if (!$first) { $description .= ', '; } // add $description .= '<a href="' . $tag['full_url'] . '" rel="tag" title="' . $tag['name'] . '">' . $tag['name'] . '</a>'; // reset $first = false; } // end $description .= '.</p>' . "\n"; } // end HTML $description .= '</div>' . "\n"; } // create new instance $rssItem = new FrontendRSSItem($title, $link, $description); // set item properties $rssItem->setPublicationDate($item['publish_on']); $rssItem->addCategory($item['category_title']); $rssItem->setAuthor(FrontendUser::getBackendUser($item['user_id'])->getSetting('nickname')); // add item $rss->addItem($rssItem); } // output $rss->parse(); }
/** * Parse the data into the template */ private function parse() { // get RSS-link $rssTitle = $this->get('fork.settings')->get('Blog', 'rss_title_' . LANGUAGE); $rssLink = FrontendNavigation::getURLForBlock('Blog', 'Rss'); // add RSS-feed $this->header->addRssLink($rssTitle, $rssLink); // add into breadcrumb $this->breadcrumb->addElement(\SpoonFilter::ucfirst(FL::lbl('Category'))); $this->breadcrumb->addElement($this->category['label']); // set pageTitle $this->header->setPageTitle(\SpoonFilter::ucfirst(FL::lbl('Category'))); $this->header->setPageTitle($this->category['label']); // advanced SEO-attributes if (isset($this->category['meta_data']['seo_index'])) { $this->header->addMetaData(array('name' => 'robots', 'content' => $this->category['meta_data']['seo_index'])); } if (isset($this->category['meta_data']['seo_follow'])) { $this->header->addMetaData(array('name' => 'robots', 'content' => $this->category['meta_data']['seo_follow'])); } // assign category $this->tpl->assign('category', $this->category); // assign articles $this->tpl->assign('items', $this->items); // parse the pagination $this->parsePagination(); }
/** * Get a label from the language-file * * @param string $key The key to get. * @param bool $fallback Should we provide a fallback in English? * * @return string */ public static function lbl($key, $fallback = true) { trigger_error('Frontend\\Core\\Engine\\Language is deprecated. It has been moved to Frontend\\Core\\Language\\Language', E_USER_DEPRECATED); return parent::lbl($key, $fallback); }
/** * Parse the data into the template */ private function parse() { // get RSS-link $rssTitle = $this->get('fork.settings')->get('Blog', 'rss_title_' . LANGUAGE); $rssLink = FrontendNavigation::getURLForBlock('Blog', 'Rss'); // add RSS-feed $this->header->addRssLink($rssTitle, $rssLink); // add into breadcrumb $this->breadcrumb->addElement(\SpoonFilter::ucfirst(FL::lbl('Archive'))); $this->breadcrumb->addElement($this->year); if ($this->month !== null) { $this->breadcrumb->addElement(\SpoonDate::getDate('F', $this->startDate, LANGUAGE, true)); } // set pageTitle $this->header->setPageTitle(\SpoonFilter::ucfirst(FL::lbl('Archive'))); $this->header->setPageTitle($this->year); if ($this->month !== null) { $this->header->setPageTitle(\SpoonDate::getDate('F', $this->startDate, LANGUAGE, true)); } // assign category $this->tpl->assign('archive', array('start_date' => $this->startDate, 'end_date' => $this->endDate, 'year' => $this->year, 'month' => $this->month)); // assign items $this->tpl->assign('items', $this->items); // assign allowComments $this->tpl->assign('allowComments', $this->get('fork.settings')->get('Blog', 'allow_comments')); // parse the pagination $this->parsePagination(); }
public function parse() { // more matches to be found than? if ($this->pagination['num_items'] > count($this->items)) { // remove last result (to add this reference) array_pop($this->items); // add reference to full search results page $this->items[] = array('title' => FL::lbl('More'), 'text' => FL::msg('MoreResults'), 'full_url' => FrontendNavigation::getURLForBlock('Search') . '?form=search&q=' . $this->term); } $charset = $this->getContainer()->getParameter('kernel.charset'); // format data foreach ($this->items as &$item) { // format description $item['text'] = !empty($item['text']) ? mb_strlen($item['text']) > $this->length ? mb_substr(strip_tags($item['text']), 0, $this->length, $charset) . '…' : $item['text'] : ''; } // output $this->output(self::OK, $this->items); }
/** * Load the form */ private function loadForm() { $this->frm = new FrontendForm('feedback'); $this->frm->addHidden('question_id', $this->record['id']); $this->frm->addTextarea('message'); $this->frm->addRadiobutton('useful', array(array('label' => FL::lbl('Yes'), 'value' => 'Y'), array('label' => FL::lbl('No'), 'value' => 'N'))); }