Skip to content

Commit

Permalink
Правки
Browse files Browse the repository at this point in the history
  • Loading branch information
Gokujo committed May 25, 2022
1 parent 0e57835 commit 20e3f23
Show file tree
Hide file tree
Showing 29 changed files with 829 additions and 139 deletions.
5 changes: 1 addition & 4 deletions upload/engine/inc/maharder.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@

$modInfo = [
'module_name' => 'MaHarder Assets',
'module_version' => '2.0.3',
'module_version' => '2.0.4',
'module_description' => 'Административная панель для моих разработок',
'module_code' => 'maharder',
'module_icon' => 'fad fa-robot',
'site_link' => 'https://devcraft.club/downloads/maharder-assets.4/',
'docs_link' => 'https://devcraft.club/articles/maharder-assets.10/',
'dle_config' => $config,
'dle_login_hash' => $dle_login_hash,
'_get' => filter_input_array(INPUT_GET),
'_post' => filter_input_array(INPUT_POST)
];

// Подключаем классы, функции и основные переменные
Expand Down
1 change: 1 addition & 0 deletions upload/engine/inc/maharder/_includes/assets.json

Large diffs are not rendered by default.

48 changes: 36 additions & 12 deletions upload/engine/inc/maharder/_includes/classes/AdminUrlExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,61 @@ protected static function getServerData()
return $_SERVER;
}

protected static function getUserHash()
: string {
global $dle_login_hash;

return $dle_login_hash;
}

protected static function getDleConfig()
: array {
global $config;

return $config;
}

protected static function getGetParams()
: ?array {
return filter_input_array(INPUT_GET);
}

protected static function getPostParams()
: ?array {
return filter_input_array(INPUT_POST);
}

protected static function getThisSelf() {
return $_SERVER['PHP_SELF'];
return self::getServerData()['PHP_SELF'];
}

protected static function getThisHost() {
return $_SERVER['HTTP_HOST'];
return self::getServerData()['HTTP_HOST'];
}

protected static function getThisRoot() {
return $_SERVER['DOCUMENT_ROOT'];
return self::getServerData()['DOCUMENT_ROOT'];
}

protected static function getAssetsUrl() {
return (isset($_SERVER['HTTPS']) && 'on' === $_SERVER['HTTPS'] ? 'https' : 'http') . '://' . self::getThisHost()
. '/engine/inc';
return (isset(self::getServerData()['HTTPS']) && 'on' === self::getServerData()['HTTPS'] ? 'https' : 'http')
. '://' . self::getThisHost() . '/engine/inc';
}

protected static function getModulesUrl() {
return (!empty($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER']
: ((!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI']
: self::getThisSelf() . "?{$_SERVER['QUERY_STRING']}");
return (!empty(self::getServerData()['HTTP_REFERER']))
? self::getServerData()['HTTP_REFERER']
: ((!empty(self::getServerData()['REQUEST_URI'])) ? self::getServerData()['REQUEST_URI']
: self::getThisSelf() . "?{self::getServerData()['QUERY_STRING']}");
}

public function getGlobals()
: array {

return [
'assets_url' => self::getAssetsUrl(), '_server' => self::getServerData(),
'this_self' => self::getThisSelf(), 'this_host' => self::getThisHost(),
'plugin_url' => self::getModulesUrl(),
'document_root' => self::getThisRoot(),
'assets_url' => self::getAssetsUrl(), 'plugin_url' => self::getModulesUrl(),
'dle_login_hash' => self::getUserHash(), 'dle_config' => self::getDleConfig(),
'_server' => self::getServerData(), '_get' => self::getGetParams(), '_post' => self::getPostParams(),
];
}
}
28 changes: 18 additions & 10 deletions upload/engine/inc/maharder/_includes/classes/DeclineExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,25 @@
class DeclineExtension extends AbstractExtension {


public function getFunctions()
{
return array(
new TwigFunction('decline', array($this, 'decline'))
);
public function getFunctions() {
return [
new TwigFunction('decline', [$this, 'decline'])
];
}

public function decline($number, $titles)

{
$cases = [2, 0, 1, 1, 1, 2];
return $titles[ ($number%100>4 && $number%100<20)? 2 : $cases[($number%10<5)?$number%10:5] ];
/**
* @link https://gist.github.com/realmyst/1262561?permalink_comment_id=2032406#gistcomment-2032406
*
* @param $number
* @param $titles
*
* @return mixed
*/
public function decline($number, $titles) {
return $titles[($number % 10 === 1 && $number % 100 !== 11)
? 0
: ($number % 10 >= 2 && $number % 10 <= 4
&& ($number % 100 < 10
|| $number % 100 >= 20) ? 1 : 2)];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ $modInfo = [
'module_code' => '%latin%',
'module_icon' => '%icon%',
'site_link' => '%link%',
'docs_link' => '%docs%',
'dle_config' => $config,
'dle_login_hash' => $dle_login_hash,
'_get' => filter_input_array(INPUT_GET),
'_post' => filter_input_array(INPUT_POST)
'docs_link' => '%docs%'
];

// Подключаем классы, функции и основные переменные
Expand Down
47 changes: 0 additions & 47 deletions upload/engine/inc/maharder/admin/assets/css/fa_fix.css

This file was deleted.

6 changes: 0 additions & 6 deletions upload/engine/inc/maharder/admin/assets/css/fa_old.css

This file was deleted.

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions upload/engine/inc/maharder/admin/assets/js/jquery-confirm.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion upload/engine/inc/maharder/admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
bindtextdomain("MHAdmin", $localDir);
textdomain("MHAdmin");

$debug = true;
$debug = false;

$twigConfigDebug = [
'cache' => false,
Expand Down
37 changes: 37 additions & 0 deletions upload/engine/inc/maharder/admin/modules/custom-favorites/main.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

//=== === === === === === === === === === === === === === === === === === === === ===
// Mod: Свои закладки
// File: main.php
// Path: D:\OpenServer\domains\dle150.local/engine/inc/maharder/admin/modules/custom-favorites/main.php
// === === === === === === === === === === === === === === === === === === === === =
// Author: Maxim Harder <[email protected]> (c) 2022
// Website: https://devcraft.club
// Telegram: http://t.me/MaHarder
// === === === === === === === === === === === === === === === === === === === === =
// Do not change anything!
//=== === === === === === === === === === === === === === === === === === === === ===

// Как добавить свои стили?
// 1. Вариант
// добавляем дополнительные стили в существующий массив: $variables['css'][] = htmlStatic( 'путь/к/стилям.css' );
// тем самым добавив новый стиль к существующим
//
// 2. Вариант
// создаём новый массив с новыми стилями и перезаписываем переменную для рендера
// $variables['css'] = htmlStatic( $newCssArray );

// Как добавить свои скрипты?
// 1. Вариант
// добавляем дополнительные скрипты в существующий массив: $variables['js'][] = htmlStatic( 'путь/к/скриптам.js', 'html', 'js' );
// тем самым добавив новый скрипт к существующим
//
// 2. Вариант
// создаём новый массив с новыми скриптами и перезаписываем переменную для рендера
// $variables['js'] = htmlStatic( $newJssArray, 'js' );

$modVars = [
'title' => 'Настройки модуля',
];

$htmlTemplate = 'modules/custom-favorites/main.html';
27 changes: 27 additions & 0 deletions upload/engine/inc/maharder/admin/modules/myshows/changelog.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

$logs = [
'2.0.0' => [
'[NEW|PAID] Вывод списка серий',
'[NEW|PAID] Добавлен парсер информации',
'[UPDATE] Работа с MyShows API 2.0',
'[UPDATE] Обновление до DLE 15.1',
'[UPDATE] Обновление функционала и совместимость с последней версией MHAdmin (2.0.3)',
],
'1.0.2.3' => [
'Бесплатная и устаревшая версия модуля MyStatus',
]
];

$modVars = [
'title' => 'История изменений',
'module_icon' => 'fad fa-robot',
'logs' => $logs,
];

$breadcrumbs[] = [
'name' => $modVars['title'],
'url' => $links['changelog']['href'],
];

$htmlTemplate = 'modules/admin/changelog.html';
36 changes: 36 additions & 0 deletions upload/engine/inc/maharder/admin/modules/myshows/countries.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

global $mh, $mh_config, $modInfo;

require_once DLEPlugins::Check(MH_ROOT . '/mystatus/Models/Country.php');

$countries = new Country();

$cur_page = $modInfo['_get']['page'] ?? 1;
$total_pages = @ceil($countries->count() / $mh_config['list_count']);
$start = isset($modInfo['_get']['page']) ? ($modInfo['_get']['page'] * $mh_config['list_count']) + 1 : 0;
$end = isset($modInfo['_get']['page']) ? (($modInfo['_get']['page'] + 1) * $mh_config['list_count']) : $mh_config['list_count'];

$modVars = [
'title' => 'Настройка стран',
'countries' => $countries->getAll(['limit' => "{$start},{$end}"]),
'page' => $cur_page,
'total_pages' => $total_pages,
'search_fields' => [
'sfields' => $mh->generate_link(
_('Где искать?'), '#', 'dropdown', [
$mh->generate_link(_('Везде'), '#', 'data', [], 'all'),
$mh->generate_link(_('Оригинальное название'), '#', 'data', [], 'original'),
$mh->generate_link(_('Аббревиатура'), '#', 'data', [], 'abbr'),
$mh->generate_link(_('Перевод'), '#', 'data', [], 'translate'),
], 'search'
)
]
];

$breadcrumbs[] = [
'name' => $modVars['title'],
'url' => $links['countries']['href'],
];

$htmlTemplate = 'modules/myshows/countries.html';
20 changes: 20 additions & 0 deletions upload/engine/inc/maharder/admin/modules/myshows/main.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

//=== === === === === === === === === === === === === === === === === === === === ===
// Mod: MyStatus
// File: main.php
// Path: /engine/inc/maharder/admin/modules/mystatus/main.php
// === === === === === === === === === === === === === === === === === === === === =
// Author: Maxim Harder <[email protected]> (c) 2022
// Website: https://devcraft.club
// Telegram: http://t.me/MaHarder
// === === === === === === === === === === === === === === === === === === === === =
// Do not change anything!
//=== === === === === === === === === === === === === === === === === === === === ===


$modVars = [
'title' => 'Главная страница',
];

$htmlTemplate = 'modules/myshows/main.html';
32 changes: 32 additions & 0 deletions upload/engine/inc/maharder/admin/modules/myshows/settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

//=== === === === === === === === === === === === === === === === === === === === ===
// Mod: MyStatus
// File: main.php
// Path: /engine/inc/maharder/admin/modules/mystatus/main.php
// === === === === === === === === === === === === === === === === === === === === =
// Author: Maxim Harder <[email protected]> (c) 2022
// Website: https://devcraft.club
// Telegram: http://t.me/MaHarder
// === === === === === === === === === === === === === === === === === === === === =
// Do not change anything!
//=== === === === === === === === === === === === === === === === === === === === ===

global $mh, $config;

$mh_config = $mh->getConfig('maharder');
$mystatus_cfg = $mh->getConfig('mystatus');

$modVars = [
'title' => 'Настройки модуля',
'settings' => $mystatus_cfg,
'xfields' => $mh->loadXfields(),
'users' => $mh->getUsers()
];

$breadcrumbs[] = [
'name' => $modVars['title'],
'url' => $links['settings']['href'],
];

$htmlTemplate = 'modules/myshows/settings.html';
18 changes: 18 additions & 0 deletions upload/engine/inc/maharder/admin/modules/myshows/templates.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

global $mh;

$mh->setCss(URL . '/maharder/admin/assets/css/bootstrap-suggest.css');
$mh->setJs(URL . '/maharder/admin/assets/js/bootstrap-suggest.min.js');

$modVars = [
'title' => 'Настройка шаблонов',
'template_data' => $mh->getConfig('mystatus_templates')
];

$breadcrumbs[] = [
'name' => $modVars['title'],
'url' => $links['templates']['href'],
];

$htmlTemplate = 'modules/myshows/templates.html';
Loading

0 comments on commit 20e3f23

Please sign in to comment.