Skip to content

Commit

Permalink
Merge pull request #18 from dragomano/develop
Browse files Browse the repository at this point in the history
Update to 1.3
  • Loading branch information
dragomano authored Nov 11, 2020
2 parents c30ecbd + d40be61 commit 7c7d053
Show file tree
Hide file tree
Showing 112 changed files with 3,588 additions and 2,459 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
patreon: bugo
ko_fi: dragomano
custom: ["https://paypal.me/bugo", "https://yasobe.ru/na/light_portal_development"]
custom: ["https://boosty.to/bugo"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* **Author:** Bugo [dragomano.ru](https://dragomano.ru/mods/light-portal)
* **License:** [GNU GPLv3](https://github.com/dragomano/Light-Portal/blob/master/LICENSE)
* **Compatible with:** SMF 2.1 RC2+ / PHP 7.2+
* **Tested on:** PHP 7.3.22, 7.4.10 / MySQL 5.7.25 / MariaDB 5.5.67, 10.4.13 / PostgreSQL 9.6.18
* **Tested on:** PHP 7.4.12 / MySQL 5.7.25 / MariaDB 10.5.6 / PostgreSQL 9.6.18
* **Hooks only:** Yes
* **Languages:** Spanish, Ukrainian, Polish, English, Russian

Expand Down
16 changes: 8 additions & 8 deletions Sources/LightPortal/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @copyright 2019-2020 Bugo
* @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later
*
* @version 1.2
* @version 1.3
*/

if (!defined('SMF'))
Expand All @@ -33,7 +33,7 @@ public static function show()
{
global $context, $modSettings;

if (empty($context['template_layers']) || empty($context['lp_active_blocks']))
if (empty($context['allow_light_portal_view']) || empty($context['template_layers']) || empty($context['lp_active_blocks']))
return;

$blocks = self::getFilteredByAreas();
Expand All @@ -47,13 +47,13 @@ public static function show()
continue;

empty($data['content'])
? Subs::prepareContent($data['content'], $data['type'], $data['id'], LP_CACHE_TIME)
: Subs::parseContent($data['content'], $data['type']);
? Helpers::prepareContent($data['content'], $data['type'], $data['id'], LP_CACHE_TIME)
: Helpers::parseContent($data['content'], $data['type']);

if (empty($data['title'][$context['user']['language']]))
$data['title'][$context['user']['language']] = $context['lp_active_blocks'][$data['id']]['title'][$context['user']['language']] ?? '';

if (empty($title = Helpers::getPublicTitle($data)))
if (empty($title = Helpers::getTitle($data)))
$data['title_class'] = '';

$context['lp_blocks'][$data['placement']][$item] = $data;
Expand Down Expand Up @@ -91,14 +91,14 @@ private static function getFilteredByAreas()
$area = $context['current_action'] ?: (!empty($modSettings['lp_frontpage_mode']) ? 'portal' : 'forum');

if (!empty($modSettings['lp_standalone_mode']) && !empty($modSettings['lp_standalone_url'])) {
if (!empty($_SERVER['REQUEST_URL']) && $modSettings['lp_standalone_url'] == $_SERVER['REQUEST_URL']) {
if (Helpers::server()->filled('REQUEST_URL') && $modSettings['lp_standalone_url'] == Helpers::server('REQUEST_URL')) {
$area = 'portal';
} elseif (empty($context['current_action'])) {
$area = 'forum';
}
}

if (!empty($context['current_board']))
if (!empty($context['current_board']) || !empty($context['lp_page']))
$area = '';

return array_filter($context['lp_active_blocks'], function($block) use ($context, $area) {
Expand All @@ -108,7 +108,7 @@ private static function getFilteredByAreas()
if (isset($block['areas']['all']) || isset($block['areas'][$area]))
return true;

if (empty($context['current_action']) && !empty($_GET['page']) && (isset($block['areas']['page=' . (string) $_GET['page']]) || isset($block['areas']['pages'])))
if (empty($context['current_action']) && Helpers::request()->filled('page') && (isset($block['areas']['page=' . Helpers::request('page')]) || isset($block['areas']['pages'])))
return true;

if (empty($context['current_board']))
Expand Down
Loading

0 comments on commit 7c7d053

Please sign in to comment.