Skip to content

Commit d40be61

Browse files
committed
Prepare for release
1 parent c7a9b16 commit d40be61

File tree

72 files changed

+146
-158
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+146
-158
lines changed

Sources/LightPortal/Block.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @copyright 2019-2020 Bugo
1212
* @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later
1313
*
14-
* @version 1.2
14+
* @version 1.3
1515
*/
1616

1717
if (!defined('SMF'))

Sources/LightPortal/Comment.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @copyright 2019-2020 Bugo
1212
* @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later
1313
*
14-
* @version 1.2
14+
* @version 1.3
1515
*/
1616

1717
if (!defined('SMF'))
@@ -333,7 +333,7 @@ private function makeNotify(string $type, string $action, array $options = [])
333333
}
334334

335335
/**
336-
* Deleting a comment (and all childs)
336+
* Deleting a comment (and all children)
337337
*
338338
* Удаление комментария (и всех дочерних)
339339
*
@@ -433,7 +433,7 @@ public static function getAll(int $page_id = 0)
433433
}
434434

435435
/**
436-
* Get comment tree (parents and childs)
436+
* Get comment tree (parents and children)
437437
*
438438
* Получаем дерево комментариев
439439
*
@@ -447,7 +447,7 @@ private function getTree(array $data)
447447
foreach ($data as $id => &$node) {
448448
empty($node['parent_id'])
449449
? $tree[$id] = &$node
450-
: $data[$node['parent_id']]['childs'][$id] = &$node;
450+
: $data[$node['parent_id']]['children'][$id] = &$node;
451451
}
452452

453453
return $tree;

Sources/LightPortal/Credits.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @copyright 2019-2020 Bugo
1212
* @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later
1313
*
14-
* @version 1.2
14+
* @version 1.3
1515
*/
1616

1717
if (!defined('SMF'))

Sources/LightPortal/Helpers.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* @copyright 2019-2020 Bugo
1818
* @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later
1919
*
20-
* @version 1.2
20+
* @version 1.3
2121
*/
2222

2323
if (!defined('SMF'))
@@ -30,7 +30,7 @@ class Helpers
3030
*
3131
* Получаем данные из кэша или объект класса Cache
3232
*
33-
* @param string $key
33+
* @param string|null $key
3434
* @param string|null $funcName
3535
* @param string $class
3636
* @param int $time (in seconds)
@@ -116,8 +116,8 @@ public static function cleanBbcode(&$data)
116116
*
117117
* Получаем иконку блока
118118
*
119-
* @param null|string $icon
120-
* @param null|string $type
119+
* @param string|null $icon
120+
* @param string|null $type
121121
* @return string
122122
*/
123123
public static function getIcon($icon = null, $type = null)
@@ -161,10 +161,10 @@ public static function doesThisThemeUseFontAwesome()
161161
*
162162
* Получаем заголовок блока превью
163163
*
164-
* @param string $prefix
164+
* @param string|null $prefix
165165
* @return string
166166
*/
167-
public static function getPreviewTitle($prefix = null)
167+
public static function getPreviewTitle(string $prefix = null)
168168
{
169169
global $context, $txt;
170170

@@ -668,7 +668,7 @@ public static function parseContent(string &$content, string $type = 'bbc')
668668
* @param string|array $type
669669
* @return mixed
670670
*/
671-
public static function validate($key, $type = 'string')
671+
public static function validate(string $key, $type = 'string')
672672
{
673673
if (is_array($type)) {
674674
return filter_var($key, FILTER_VALIDATE_REGEXP, $type);

Sources/LightPortal/Integration.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @copyright 2019-2020 Bugo
1212
* @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later
1313
*
14-
* @version 1.2
14+
* @version 1.3
1515
*/
1616

1717
if (!defined('SMF'))
@@ -41,7 +41,7 @@ public static function hooks()
4141
add_integration_function('integrate_load_permissions', __CLASS__ . '::loadPermissions', false, __FILE__);
4242
add_integration_function('integrate_alert_types', __CLASS__ . '::alertTypes', false, __FILE__);
4343
add_integration_function('integrate_fetch_alerts', __CLASS__ . '::fetchAlerts', false, __FILE__);
44-
add_integration_function('integrate_whos_online', __CLASS__ . '::whosOnline', false, __FILE__);
44+
add_integration_function('integrate_whos_online', __CLASS__ . '::whoisOnline', false, __FILE__);
4545
add_integration_function('integrate_credits', __NAMESPACE__ . '\Credits::show', false, '$sourcedir/LightPortal/Credits.php');
4646
add_integration_function('integrate_admin_areas', __NAMESPACE__ . '\Settings::adminAreas', false, '$sourcedir/LightPortal/Settings.php');
4747
add_integration_function('integrate_admin_search', __NAMESPACE__ . '\Settings::adminSearch', false, '$sourcedir/LightPortal/Settings.php');
@@ -80,8 +80,8 @@ public static function userInfo()
8080

8181
$lp_constants = [
8282
'LP_NAME' => 'Light Portal',
83-
'LP_VERSION' => '1.2',
84-
'LP_RELEASE_DATE' => '2020-10-10',
83+
'LP_VERSION' => '1.3',
84+
'LP_RELEASE_DATE' => '2020-11-11',
8585
'LP_DEBUG' => !empty($modSettings['lp_show_debug_info']) && !empty($user_info['is_admin']),
8686
'LP_ADDONS' => $sourcedir . '/LightPortal/addons',
8787
'LP_CACHE_TIME' => $modSettings['lp_cache_update_interval'] ?? 3600,
@@ -137,7 +137,7 @@ public static function loadTheme()
137137
* @param string $setLocation
138138
* @return void
139139
*/
140-
public static function redirect(&$setLocation)
140+
public static function redirect(string &$setLocation)
141141
{
142142
global $modSettings, $scripturl;
143143

@@ -178,22 +178,23 @@ public static function actions(array &$actions)
178178
*
179179
* Обращаемся к странице портала или вызываем метод по умолчанию
180180
*
181-
* @return void
181+
* @return mixed
182182
*/
183183
public static function defaultAction()
184184
{
185185
global $modSettings, $sourcedir;
186186

187187
if (Helpers::request()->filled('page'))
188-
return Page::show();
188+
return call_user_func(array(__NAMESPACE__ . '\Page', 'show'));
189189

190190
if (empty($modSettings['lp_frontpage_mode']) || (!empty($modSettings['lp_standalone_mode']) && !empty($modSettings['lp_standalone_url']))) {
191191
require_once($sourcedir . '/BoardIndex.php');
192-
return BoardIndex();
192+
193+
return call_user_func('BoardIndex');
193194
}
194195

195196
if (!empty($modSettings['lp_frontpage_mode']))
196-
return Front\Article::show();
197+
return call_user_func(array(__NAMESPACE__ . '\Front\Article', 'show'));
197198
}
198199

199200
/**
@@ -476,7 +477,7 @@ public static function fetchAlerts(array &$alerts, array &$formats)
476477
* @param array $actions
477478
* @return string
478479
*/
479-
public static function whosOnline(array $actions)
480+
public static function whoisOnline(array $actions)
480481
{
481482
global $txt, $scripturl, $modSettings, $context;
482483

Sources/LightPortal/ManageBlocks.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @copyright 2019-2020 Bugo
1212
* @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later
1313
*
14-
* @version 1.2
14+
* @version 1.3
1515
*/
1616

1717
if (!defined('SMF'))
@@ -778,7 +778,7 @@ private static function getAreasInfo()
778778
{
779779
global $context, $txt;
780780

781-
$exampe_areas = array(
781+
$example_areas = array(
782782
'all',
783783
'custom_action',
784784
'pages',
@@ -793,7 +793,7 @@ private static function getAreasInfo()
793793
'topic=id3|id7'
794794
);
795795

796-
$context['lp_possible_areas'] = array_combine($exampe_areas, $txt['lp_block_areas_values']);
796+
$context['lp_possible_areas'] = array_combine($example_areas, $txt['lp_block_areas_values']);
797797

798798
ob_start();
799799

@@ -898,6 +898,7 @@ private static function getPriority()
898898
);
899899

900900
[$priority] = $smcFunc['db_fetch_row']($request);
901+
901902
$smcFunc['db_free_result']($request);
902903
$smcFunc['lp_num_queries']++;
903904

@@ -1113,7 +1114,7 @@ private static function setData(int $item = 0)
11131114
*/
11141115
public static function getData(int $item)
11151116
{
1116-
global $smcFunc, $context;
1117+
global $smcFunc;
11171118

11181119
if (empty($item))
11191120
return [];

Sources/LightPortal/ManagePages.php

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @copyright 2019-2020 Bugo
1212
* @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later
1313
*
14-
* @version 1.2
14+
* @version 1.3
1515
*/
1616

1717
if (!defined('SMF'))
@@ -369,6 +369,7 @@ public static function getTotalQuantity(string $query_string = '', array $query_
369369
);
370370

371371
[$num_entries] = $smcFunc['db_fetch_row']($request);
372+
372373
$smcFunc['db_free_result']($request);
373374
$smcFunc['lp_num_queries']++;
374375

@@ -763,25 +764,33 @@ private static function findErrors(array $data)
763764
}
764765

765766
/**
766-
* Adding special fields to the form
767-
*
768-
* Добавляем свои поля для формы
767+
* https://github.com/jshjohnson/Choices
769768
*
770769
* @return void
771770
*/
772-
private static function prepareFormFields()
771+
private static function improveKeywordsField()
773772
{
774-
global $context, $txt, $modSettings, $language;
775-
776-
// Improve keywords field ~ https://github.com/jshjohnson/Choices
777773
loadCssFile('https://cdn.jsdelivr.net/npm/choices.js/public/assets/styles/choices.min.css', array('external' => true));
774+
778775
addInlineCss('
779776
.choices__list {
780777
position: relative;
781778
}
782779
.choices__input {
783780
box-shadow: none;
784781
}');
782+
}
783+
784+
/**
785+
* Adding special fields to the form
786+
*
787+
* Добавляем свои поля для формы
788+
*
789+
* @return void
790+
*/
791+
private static function prepareFormFields()
792+
{
793+
global $context, $txt, $modSettings, $language;
785794

786795
checkSubmitOnce('register');
787796

@@ -853,6 +862,8 @@ private static function prepareFormFields()
853862
'tab' => 'seo'
854863
);
855864

865+
self::improveKeywordsField();
866+
856867
$context['posting_fields']['keywords']['label']['text'] = $txt['lp_page_keywords'];
857868
$context['posting_fields']['keywords']['input'] = array(
858869
'type' => 'text',
@@ -1184,7 +1195,7 @@ private static function setData(int $item = 0)
11841195

11851196
$smcFunc['lp_num_queries']++;
11861197

1187-
Subs::runAddons('onDataSaving', array($item));
1198+
Subs::runAddons('onPageSaving', array($item));
11881199

11891200
if (!empty($context['lp_page']['title'])) {
11901201
$titles = [];

Sources/LightPortal/Notify.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @copyright 2019-2020 Bugo
1212
* @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later
1313
*
14-
* @version 1.2
14+
* @version 1.3
1515
*/
1616

1717
class Notify extends \SMF_BackgroundTask

Sources/LightPortal/Page.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @copyright 2019-2020 Bugo
1212
* @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later
1313
*
14-
* @version 1.2
14+
* @version 1.3
1515
*/
1616

1717
if (!defined('SMF'))

Sources/LightPortal/Settings.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @copyright 2019-2020 Bugo
1212
* @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later
1313
*
14-
* @version 1.2
14+
* @version 1.3
1515
*/
1616

1717
if (!defined('SMF'))
@@ -656,7 +656,7 @@ private static function getPluginTypes($snake_name)
656656
* @param string $name
657657
* @return array
658658
*/
659-
private static function getPluginSettings($config_vars, $name = '')
659+
private static function getPluginSettings(array $config_vars, $name = '')
660660
{
661661
if (empty($config_vars))
662662
return [];
@@ -732,7 +732,7 @@ public static function pageArea()
732732
* Вызывает метод, если он существует; в противном случае вызывается метод по умолчанию
733733
*
734734
* @param array $subActions
735-
* @param string $defaultAction
735+
* @param string|null $defaultAction
736736
* @return void
737737
*/
738738
private static function loadGeneralSettingParameters(array $subActions = [], string $defaultAction = null)

Sources/LightPortal/Subs.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @copyright 2019-2020 Bugo
1212
* @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later
1313
*
14-
* @version 1.2
14+
* @version 1.3
1515
*/
1616

1717
if (!defined('SMF'))
@@ -106,8 +106,7 @@ public static function getActiveBLocks()
106106
'title_class' => $row['title_class'],
107107
'title_style' => $row['title_style'],
108108
'content_class' => $row['content_class'],
109-
'content_style' => $row['content_style'],
110-
'permissions' => $row['permissions']
109+
'content_style' => $row['content_style']
111110
);
112111

113112
$active_blocks[$row['block_id']]['title'][$row['lang']] = $row['title'];

Sources/LightPortal/Tag.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @copyright 2019-2020 Bugo
1212
* @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later
1313
*
14-
* @version 1.2
14+
* @version 1.3
1515
*/
1616

1717
if (!defined('SMF'))
@@ -385,7 +385,7 @@ public static function getAll(int $start, int $items_per_page, string $sort)
385385
*/
386386
public static function getTotalQuantity()
387387
{
388-
global $smcFunc, $context;
388+
global $smcFunc;
389389

390390
$request = $smcFunc['db_query']('', '
391391
SELECT t.page_id, t.value

0 commit comments

Comments
 (0)