Skip to content

Commit

Permalink
3.0 (#1663)
Browse files Browse the repository at this point in the history
* Fixed fatal error, closes #1656

* Support usage of external database tools

* fix: fixed issue with URLs behind a proxy, closes #1661

* feat: re-added tag cloud on several pages, closes #1660

- added on startpage
- added on category overviews
- added on FAQ pages
  • Loading branch information
thorsten committed Mar 15, 2020
1 parent 406f68a commit 9b6a046
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 90 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Version 3.1.0-dev
- removed REST API v1 (Thorsten)

Version 3.0.1 - 2020-03
- re-added tag cloud on several pages (Thorsten)
- fixed minor bugs (Thorsten)
- fixed update issues for PostgreSQL (Thorsten)

Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/assets/themes/default/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
<section id="wrapper" class="mt-3">
<div class="container">
<div class="row">
{{ mainPageContent }}
{{ mainPageContent }} {{ sidebar }}
</div>
</div>
</section>
Expand Down

This file was deleted.

14 changes: 5 additions & 9 deletions phpmyfaq/assets/themes/default/templates/sidebar-tagcloud.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<section class="pmf-aside-widget">
<header>
<h3>{{ writeTagCloudHeader }}</h3>
</header>
<div class="pmf-aside-widget-body clearfix">
<ul class="pmf-tags">
{{ writeTags }}
</ul>
<div class="card mb-3">
<div class="card-body">
<h5 class="card-title">{{ writeTagCloudHeader }}</h5>
<p class="card-text pmf-tag-cloud">{{ writeTags }}</p>
</div>
</section>
</div>
52 changes: 13 additions & 39 deletions phpmyfaq/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,8 @@
//
// Set right column
//
if (($action === 'faq') || ($action === 'show')) {
$sidebarTemplate = $action === 'faq' ? 'sidebar-categories-tags.html' : 'sidebar-tagcloud.html';
} else {
$sidebarTemplate = 'sidebar-categories-tags.html';
if (($action === 'faq') || ($action === 'show') || ($action === 'main')) {
$sidebarTemplate = 'sidebar-tagcloud.html';
}

//
Expand Down Expand Up @@ -666,40 +664,15 @@
);
}

if ('faq' == $action || 'show' == $action || is_numeric($solutionId)) {

// We need some Links from social networks
$faqServices = new Services($faqConfig);
$faqServices->setCategoryId($cat);
$faqServices->setFaqId($id);
$faqServices->setLanguage($lang);
$faqServices->setQuestion($faq->getRecordTitle($id));

$faqHelper = new HelperFaq($faqConfig);
$faqHelper->setSsl((isset($_SERVER['HTTPS']) && is_null($_SERVER['HTTPS']) ? false : true));

$template->parseBlock(
'index',
'socialLinks',
[
'baseHref' => $faqSystem->getSystemUri($faqConfig),
'msgPdf' => $PMF_LANG['msgPDF'],
'msgPrintFaq' => $PMF_LANG['msgPrintArticle'],
'sendToFriend' => $faqHelper->renderSendToFriend($faqServices->getSuggestLink()),
'shareOnTwitter' => $faqHelper->renderTwitterShareLink($faqServices->getShareOnTwitterLink()),
'linkToPdf' => $faqServices->getPdfLink()
]
);
}

$tplHeaders = [
'writeTopTenHeader' => $PMF_LANG['msgTopTen'],
'writeNewestHeader' => $PMF_LANG['msgLatestArticles'],
'writeTagCloudHeader' => $PMF_LANG['msg_tags'],
'writeTags' => $oTag->renderTagCloud(),
'msgAllCatArticles' => $PMF_LANG['msgAllCatArticles'],
'allCatArticles' => $faq->getRecordsWithoutPagingByCategoryId($cat)
];
$template->parse(
'sidebar',
[
'writeTagCloudHeader' => $PMF_LANG['msg_tags'],
'writeTags' => $oTag->renderTagCloud(),
'msgAllCatArticles' => $PMF_LANG['msgAllCatArticles'],
'allCatArticles' => $faq->getRecordsWithoutPagingByCategoryId($cat)
]
);

if (DEBUG) {
$template->parseBlock(
Expand Down Expand Up @@ -736,7 +709,8 @@
//
// Get main template, set main variables
//
$template->parse('index', array_merge($tplMainPage, $tplNavigation, $tplHeaders));
$template->parse('index', array_merge($tplMainPage, $tplNavigation));
$template->merge('sidebar', 'index');
$template->merge('mainPageContent', 'index');

//
Expand Down
4 changes: 2 additions & 2 deletions phpmyfaq/src/phpMyFAQ/Tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,15 +427,15 @@ public function renderTagCloud()
$i = 0;
foreach ($tags as $tag) {
++$i;
$html .= '<li>';
$title = Strings::htmlspecialchars($tag['name'] . ' (' . $tag['count'] . ')', ENT_QUOTES, 'utf-8');
$url = sprintf('%s?action=search&amp;tagging_id=%d', $this->config->getDefaultUrl(), $tag['id']);
$oLink = new Link($url, $this->config);
$oLink->itemTitle = $tag['name'];
$oLink->text = $tag['name'];
$oLink->tooltip = $title;
$oLink->class = 'btn btn-primary m-1';
$html .= $oLink->toHtmlAnchor();
$html .= (count($tags) == $i ? '' : ' ') . '</li>';
$html .= (count($tags) == $i ? '' : ' ');
}

return $html;
Expand Down

0 comments on commit 9b6a046

Please sign in to comment.