Skip to content

Commit

Permalink
Prepare for release
Browse files Browse the repository at this point in the history
  • Loading branch information
dragomano committed Nov 10, 2020
1 parent c7a9b16 commit d40be61
Show file tree
Hide file tree
Showing 72 changed files with 146 additions and 158 deletions.
2 changes: 1 addition & 1 deletion 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 Down
8 changes: 4 additions & 4 deletions Sources/LightPortal/Comment.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 Down Expand Up @@ -333,7 +333,7 @@ private function makeNotify(string $type, string $action, array $options = [])
}

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

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

return $tree;
Expand Down
2 changes: 1 addition & 1 deletion Sources/LightPortal/Credits.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 Down
14 changes: 7 additions & 7 deletions Sources/LightPortal/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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 @@ -30,7 +30,7 @@ class Helpers
*
* Получаем данные из кэша или объект класса Cache
*
* @param string $key
* @param string|null $key
* @param string|null $funcName
* @param string $class
* @param int $time (in seconds)
Expand Down Expand Up @@ -116,8 +116,8 @@ public static function cleanBbcode(&$data)
*
* Получаем иконку блока
*
* @param null|string $icon
* @param null|string $type
* @param string|null $icon
* @param string|null $type
* @return string
*/
public static function getIcon($icon = null, $type = null)
Expand Down Expand Up @@ -161,10 +161,10 @@ public static function doesThisThemeUseFontAwesome()
*
* Получаем заголовок блока превью
*
* @param string $prefix
* @param string|null $prefix
* @return string
*/
public static function getPreviewTitle($prefix = null)
public static function getPreviewTitle(string $prefix = null)
{
global $context, $txt;

Expand Down Expand Up @@ -668,7 +668,7 @@ public static function parseContent(string &$content, string $type = 'bbc')
* @param string|array $type
* @return mixed
*/
public static function validate($key, $type = 'string')
public static function validate(string $key, $type = 'string')
{
if (is_array($type)) {
return filter_var($key, FILTER_VALIDATE_REGEXP, $type);
Expand Down
21 changes: 11 additions & 10 deletions Sources/LightPortal/Integration.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 Down Expand Up @@ -41,7 +41,7 @@ public static function hooks()
add_integration_function('integrate_load_permissions', __CLASS__ . '::loadPermissions', false, __FILE__);
add_integration_function('integrate_alert_types', __CLASS__ . '::alertTypes', false, __FILE__);
add_integration_function('integrate_fetch_alerts', __CLASS__ . '::fetchAlerts', false, __FILE__);
add_integration_function('integrate_whos_online', __CLASS__ . '::whosOnline', false, __FILE__);
add_integration_function('integrate_whos_online', __CLASS__ . '::whoisOnline', false, __FILE__);
add_integration_function('integrate_credits', __NAMESPACE__ . '\Credits::show', false, '$sourcedir/LightPortal/Credits.php');
add_integration_function('integrate_admin_areas', __NAMESPACE__ . '\Settings::adminAreas', false, '$sourcedir/LightPortal/Settings.php');
add_integration_function('integrate_admin_search', __NAMESPACE__ . '\Settings::adminSearch', false, '$sourcedir/LightPortal/Settings.php');
Expand Down Expand Up @@ -80,8 +80,8 @@ public static function userInfo()

$lp_constants = [
'LP_NAME' => 'Light Portal',
'LP_VERSION' => '1.2',
'LP_RELEASE_DATE' => '2020-10-10',
'LP_VERSION' => '1.3',
'LP_RELEASE_DATE' => '2020-11-11',
'LP_DEBUG' => !empty($modSettings['lp_show_debug_info']) && !empty($user_info['is_admin']),
'LP_ADDONS' => $sourcedir . '/LightPortal/addons',
'LP_CACHE_TIME' => $modSettings['lp_cache_update_interval'] ?? 3600,
Expand Down Expand Up @@ -137,7 +137,7 @@ public static function loadTheme()
* @param string $setLocation
* @return void
*/
public static function redirect(&$setLocation)
public static function redirect(string &$setLocation)
{
global $modSettings, $scripturl;

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

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

if (empty($modSettings['lp_frontpage_mode']) || (!empty($modSettings['lp_standalone_mode']) && !empty($modSettings['lp_standalone_url']))) {
require_once($sourcedir . '/BoardIndex.php');
return BoardIndex();

return call_user_func('BoardIndex');
}

if (!empty($modSettings['lp_frontpage_mode']))
return Front\Article::show();
return call_user_func(array(__NAMESPACE__ . '\Front\Article', 'show'));
}

/**
Expand Down Expand Up @@ -476,7 +477,7 @@ public static function fetchAlerts(array &$alerts, array &$formats)
* @param array $actions
* @return string
*/
public static function whosOnline(array $actions)
public static function whoisOnline(array $actions)
{
global $txt, $scripturl, $modSettings, $context;

Expand Down
9 changes: 5 additions & 4 deletions Sources/LightPortal/ManageBlocks.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 Down Expand Up @@ -778,7 +778,7 @@ private static function getAreasInfo()
{
global $context, $txt;

$exampe_areas = array(
$example_areas = array(
'all',
'custom_action',
'pages',
Expand All @@ -793,7 +793,7 @@ private static function getAreasInfo()
'topic=id3|id7'
);

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

ob_start();

Expand Down Expand Up @@ -898,6 +898,7 @@ private static function getPriority()
);

[$priority] = $smcFunc['db_fetch_row']($request);

$smcFunc['db_free_result']($request);
$smcFunc['lp_num_queries']++;

Expand Down Expand Up @@ -1113,7 +1114,7 @@ private static function setData(int $item = 0)
*/
public static function getData(int $item)
{
global $smcFunc, $context;
global $smcFunc;

if (empty($item))
return [];
Expand Down
29 changes: 20 additions & 9 deletions Sources/LightPortal/ManagePages.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 Down Expand Up @@ -369,6 +369,7 @@ public static function getTotalQuantity(string $query_string = '', array $query_
);

[$num_entries] = $smcFunc['db_fetch_row']($request);

$smcFunc['db_free_result']($request);
$smcFunc['lp_num_queries']++;

Expand Down Expand Up @@ -763,25 +764,33 @@ private static function findErrors(array $data)
}

/**
* Adding special fields to the form
*
* Добавляем свои поля для формы
* https://github.com/jshjohnson/Choices
*
* @return void
*/
private static function prepareFormFields()
private static function improveKeywordsField()
{
global $context, $txt, $modSettings, $language;

// Improve keywords field ~ https://github.com/jshjohnson/Choices
loadCssFile('https://cdn.jsdelivr.net/npm/choices.js/public/assets/styles/choices.min.css', array('external' => true));

addInlineCss('
.choices__list {
position: relative;
}
.choices__input {
box-shadow: none;
}');
}

/**
* Adding special fields to the form
*
* Добавляем свои поля для формы
*
* @return void
*/
private static function prepareFormFields()
{
global $context, $txt, $modSettings, $language;

checkSubmitOnce('register');

Expand Down Expand Up @@ -853,6 +862,8 @@ private static function prepareFormFields()
'tab' => 'seo'
);

self::improveKeywordsField();

$context['posting_fields']['keywords']['label']['text'] = $txt['lp_page_keywords'];
$context['posting_fields']['keywords']['input'] = array(
'type' => 'text',
Expand Down Expand Up @@ -1184,7 +1195,7 @@ private static function setData(int $item = 0)

$smcFunc['lp_num_queries']++;

Subs::runAddons('onDataSaving', array($item));
Subs::runAddons('onPageSaving', array($item));

if (!empty($context['lp_page']['title'])) {
$titles = [];
Expand Down
2 changes: 1 addition & 1 deletion Sources/LightPortal/Notify.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
*/

class Notify extends \SMF_BackgroundTask
Expand Down
2 changes: 1 addition & 1 deletion Sources/LightPortal/Page.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 Down
6 changes: 3 additions & 3 deletions Sources/LightPortal/Settings.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 Down Expand Up @@ -656,7 +656,7 @@ private static function getPluginTypes($snake_name)
* @param string $name
* @return array
*/
private static function getPluginSettings($config_vars, $name = '')
private static function getPluginSettings(array $config_vars, $name = '')
{
if (empty($config_vars))
return [];
Expand Down Expand Up @@ -732,7 +732,7 @@ public static function pageArea()
* Вызывает метод, если он существует; в противном случае вызывается метод по умолчанию
*
* @param array $subActions
* @param string $defaultAction
* @param string|null $defaultAction
* @return void
*/
private static function loadGeneralSettingParameters(array $subActions = [], string $defaultAction = null)
Expand Down
5 changes: 2 additions & 3 deletions Sources/LightPortal/Subs.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 Down Expand Up @@ -106,8 +106,7 @@ public static function getActiveBLocks()
'title_class' => $row['title_class'],
'title_style' => $row['title_style'],
'content_class' => $row['content_class'],
'content_style' => $row['content_style'],
'permissions' => $row['permissions']
'content_style' => $row['content_style']
);

$active_blocks[$row['block_id']]['title'][$row['lang']] = $row['title'];
Expand Down
4 changes: 2 additions & 2 deletions Sources/LightPortal/Tag.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 Down Expand Up @@ -385,7 +385,7 @@ public static function getAll(int $start, int $items_per_page, string $sort)
*/
public static function getTotalQuantity()
{
global $smcFunc, $context;
global $smcFunc;

$request = $smcFunc['db_query']('', '
SELECT t.page_id, t.value
Expand Down
Loading

0 comments on commit d40be61

Please sign in to comment.