From 55ae5e1eb50ac0922fbd2201b941a3b6774f43f4 Mon Sep 17 00:00:00 2001 From: MaHarder Date: Wed, 7 Sep 2022 18:27:42 +0200 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=81=D0=BE=D0=B2=D0=BC=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D0=B8=D0=BC=D0=BE=D1=81=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manifest.json | 2 +- upload/engine/ajax/maharder.php | 2 +- upload/engine/inc/maharder.php | 2 +- .../classes/{Ajax.php => MhAjax.php} | 2 +- .../maharder/_includes/extras/autoloader.php | 124 ------------------ .../extras/{loader.php => mhLoader.php} | 13 +- .../inc/maharder/_includes/extras/paths.php | 40 +++--- .../maharder/_includes/traits/DataLoader.php | 16 ++- .../inc/maharder/admin/assets/css/fa_fix.css | 89 ------------- .../inc/maharder/admin/assets/css/fa_old.css | 6 - .../admin/modules/admin/changelog.php | 6 - upload/install.xml | 33 +++-- 12 files changed, 69 insertions(+), 266 deletions(-) rename upload/engine/inc/maharder/_includes/classes/{Ajax.php => MhAjax.php} (97%) delete mode 100644 upload/engine/inc/maharder/_includes/extras/autoloader.php rename upload/engine/inc/maharder/_includes/extras/{loader.php => mhLoader.php} (80%) delete mode 100644 upload/engine/inc/maharder/admin/assets/css/fa_fix.css delete mode 100644 upload/engine/inc/maharder/admin/assets/css/fa_old.css diff --git a/manifest.json b/manifest.json index f6cc089..2dda86b 100644 --- a/manifest.json +++ b/manifest.json @@ -1,5 +1,5 @@ { - "version": "2.0.7.2", + "version": "2.0.8", "status": "dev", "dle": [ "15.x" diff --git a/upload/engine/ajax/maharder.php b/upload/engine/ajax/maharder.php index dd92bd9..e2cb9de 100644 --- a/upload/engine/ajax/maharder.php +++ b/upload/engine/ajax/maharder.php @@ -34,7 +34,7 @@ include_once(DLEPlugins::Check(ENGINE_DIR . '/inc/maharder/_includes/extras/paths.php')); -$mh_admin = new Ajax(); +$mh_admin = new MhAjax(); if (file_exists(DLEPlugins::Check(ENGINE_DIR . '/ajax/maharder/' . $module . '/' . $mod_file . '.php'))) { diff --git a/upload/engine/inc/maharder.php b/upload/engine/inc/maharder.php index 3167eba..f97a02d 100644 --- a/upload/engine/inc/maharder.php +++ b/upload/engine/inc/maharder.php @@ -5,7 +5,7 @@ $modInfo = [ 'module_name' => 'MaHarder Assets', - 'module_version' => '2.0.7.2', + 'module_version' => '2.0.7', 'module_description' => 'Административная панель для моих разработок', 'module_code' => 'maharder', 'module_id' => 4, diff --git a/upload/engine/inc/maharder/_includes/classes/Ajax.php b/upload/engine/inc/maharder/_includes/classes/MhAjax.php similarity index 97% rename from upload/engine/inc/maharder/_includes/classes/Ajax.php rename to upload/engine/inc/maharder/_includes/classes/MhAjax.php index 81373dd..a5cbfe4 100644 --- a/upload/engine/inc/maharder/_includes/classes/Ajax.php +++ b/upload/engine/inc/maharder/_includes/classes/MhAjax.php @@ -3,7 +3,7 @@ require_once DLEPlugins::Check(ENGINE_DIR . '/inc/maharder/_includes/extras/paths.php'); -class Ajax { +class MhAjax { use DataLoader; use AssetsChecker; use UpdatesChecker; diff --git a/upload/engine/inc/maharder/_includes/extras/autoloader.php b/upload/engine/inc/maharder/_includes/extras/autoloader.php deleted file mode 100644 index b2b203f..0000000 --- a/upload/engine/inc/maharder/_includes/extras/autoloader.php +++ /dev/null @@ -1,124 +0,0 @@ - - */ -class Autoloader -{ - /** - * File extension as a string. Defaults to ".php". - */ - protected static $fileExt = '.php'; - - /** - * The topmost directory where recursion should begin. Defaults to the current - * directory. - */ - protected static $pathTop = __DIR__; - - /** - * A placeholder to hold the file iterator so that directory traversal is only - * performed once. - */ - protected static $fileIterator = null; - - /** - * Autoload function for registration with spl_autoload_register - * - * Looks recursively through project directory and loads class files based on - * filename match. - * - * @param string $className - */ - public static function loader($className) - { - $classesDir = new RecursiveDirectoryIterator(dirname(static::$pathTop) . '/classes', RecursiveDirectoryIterator::SKIP_DOTS); - $traitsDir = new RecursiveDirectoryIterator(dirname(static::$pathTop) . '/traits', RecursiveDirectoryIterator::SKIP_DOTS); - $directory = new RecursiveDirectoryIterator(static::$pathTop, RecursiveDirectoryIterator::SKIP_DOTS); - - $directory = array_merge($directory, $traitsDir, $classesDir); - - if (is_null(static::$fileIterator)) { - - static::$fileIterator = new RecursiveIteratorIterator($directory, RecursiveIteratorIterator::LEAVES_ONLY); - - } - - $filename = $className . static::$fileExt; - - foreach (static::$fileIterator as $file) { - - if (strtolower($file->getFilename()) === strtolower($filename)) { - - if ($file->isReadable()) { - - include_once $file->getPathname(); - - } - break; - - } - - } - - } - - /** - * Sets the $fileExt property - * - * @param string $fileExt The file extension used for class files. Default is "php". - */ - public static function setFileExt($fileExt) - { - static::$fileExt = $fileExt; - } - - /** - * Sets the $path property - * - * @param string $path The path representing the top level where recursion should - * begin. Defaults to the current directory. - */ - public static function setPath($path) - { - static::$pathTop = $path; - } - -} - -Autoloader::setFileExt('.php'); -spl_autoload_register('Autoloader::loader'); - -// EOF \ No newline at end of file diff --git a/upload/engine/inc/maharder/_includes/extras/loader.php b/upload/engine/inc/maharder/_includes/extras/mhLoader.php similarity index 80% rename from upload/engine/inc/maharder/_includes/extras/loader.php rename to upload/engine/inc/maharder/_includes/extras/mhLoader.php index 4a4193f..973703a 100644 --- a/upload/engine/inc/maharder/_includes/extras/loader.php +++ b/upload/engine/inc/maharder/_includes/extras/mhLoader.php @@ -4,10 +4,8 @@ @ini_set('pcre.backtrack_limit', 10000000 ); @ini_set('pcre.jit', false); - - if (!function_exists('dirToArray')) { - function dirToArray($dir) { + function dirToArray($dir, ...$except) { $result = []; $xcpt = [ @@ -15,6 +13,9 @@ function dirToArray($dir) { '..', '.htaccess', ]; + if ($except) { + foreach ($except as $ex) $xcpt = array_merge_recursive($xcpt, $ex); + } foreach (scandir($dir, SCANDIR_SORT_NONE) as $key => $value) { if ( ! in_array($value, $xcpt, true)) { @@ -31,11 +32,11 @@ function dirToArray($dir) { } spl_autoload_register(function ($class_name) { - global $loader_paths; + global $mh_loader_paths; $found = false; - foreach ($loader_paths as $path) { + foreach ($mh_loader_paths as $path) { $dir_data = dirToArray($path); foreach ($dir_data as $data) { if ($class_name === str_replace('.php', '', $data)) { @@ -47,4 +48,4 @@ function dirToArray($dir) { if ($found) break; } - }); \ No newline at end of file + }); diff --git a/upload/engine/inc/maharder/_includes/extras/paths.php b/upload/engine/inc/maharder/_includes/extras/paths.php index 3286354..2d0db74 100644 --- a/upload/engine/inc/maharder/_includes/extras/paths.php +++ b/upload/engine/inc/maharder/_includes/extras/paths.php @@ -1,21 +1,31 @@ $value) { - if ( ! in_array($value, $xcpt, true)) { - if (is_dir($dir.DIRECTORY_SEPARATOR.$value)) { - $result[$value] = self::dirToArray($dir.DIRECTORY_SEPARATOR.$value); - } else { - $result[] = $value; + $dir = str_replace(ENGINE_DIR, ROOT . DIRECTORY_SEPARATOR . 'engine', $dir); + + if (is_dir($dir)) { + foreach (scandir($dir, SCANDIR_SORT_NONE) as $key => $value) { + if ( ! in_array($value, $xcpt, true)) { + if (is_dir($dir.DIRECTORY_SEPARATOR.$value)) { + $result[$value] = self::dirToArray($dir.DIRECTORY_SEPARATOR.$value); + } else { + $result[] = $value; + } } } } diff --git a/upload/engine/inc/maharder/admin/assets/css/fa_fix.css b/upload/engine/inc/maharder/admin/assets/css/fa_fix.css deleted file mode 100644 index 61d5412..0000000 --- a/upload/engine/inc/maharder/admin/assets/css/fa_fix.css +++ /dev/null @@ -1,89 +0,0 @@ -@font-face{font-family:"FontAwesome";font-style:normal;font-weight:300;src:url(../webfonts/fa-light-300.eot);src:url(../webfonts/fa-light-300.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-light-300.woff2) format("woff2"),url(../webfonts/fa-light-300.woff) format("woff"),url(../webfonts/fa-light-300.ttf) format("truetype"),url(../webfonts/fa-light-300.svg#fontawesome) format("svg")} -@font-face{font-family:"Icons";font-style:normal;font-weight:900;src:url(../webfonts/fa-light-300.eot);src:url(../webfonts/fa-light-300.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-light-300.woff2) format("woff2"),url(../webfonts/fa-light-300.woff) format("woff"),url(../webfonts/fa-light-300.ttf) format("truetype"),url(../webfonts/fa-light-300.svg#fontawesome) format("svg")} - -.fa { - font-family: "FontAwesome", "Font Awesome 6 Pro" !important; - font-weight: 300 !important; -} - -.fa-file-text-o:before { - content: "\f15c"; -} - -.fa-commenting-o:before { - content: "\f4ad"; -} - -.fa-envelope-o:before { - content: "\f0e0"; -} - -.fa-user-circle-o:before { - content: "\f2bd"; -} - -.fa-picture-o:before { - content: "\f302"; -} - -.fa-floppy-o:before { - content: "\f0c7"; -} - -.fa-trash-o:before { - content: "\f2ed"; -} - -.fa-pencil-square-o:before { - content: "\f14b"; -} - -.fa-file-code-o:before { - content: "\f1c9"; -} - -.a-paper-plane-o:before { - content: "\f1d8"; -} - -.fa-comment-o:before { - content: "\f4ad"; -} - -.fa-google { - font-family: "Font Awesome 6 Brands" !important; - font-weight: 400 !important; -} - -.fa-google:before { - content: "\f1a0"; -} - -.fa-play-circle-o { - font-weight: 300 !important; -} - -.fa-play-circle-o:before { - content: "\f144"; -} - -.fa-lightbulb-o:before { - content: "\f672"; -} - -.fa-id-card-o:before { - content: "\f2c2"; -} - -.fa-facebook-official { - font-family: "Font Awesome 6 Brands" !important; - font-weight: 400 !important; -} - -.fa-facebook-official:before { - content: "\f09a"; -} - -.fa-file-image-o:before { - content: "\f1c5"; -} \ No newline at end of file diff --git a/upload/engine/inc/maharder/admin/assets/css/fa_old.css b/upload/engine/inc/maharder/admin/assets/css/fa_old.css deleted file mode 100644 index a99efcd..0000000 --- a/upload/engine/inc/maharder/admin/assets/css/fa_old.css +++ /dev/null @@ -1,6 +0,0 @@ -/*! - * Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com - * License - https://fontawesome.com/license (Commercial License) - * Copyright 2022 Fonticons, Inc. - */ -@font-face{font-family:"FontAwesome";font-display:block;src:url(../webfonts/fa-solid-900.woff2) format("woff2"),url(../webfonts/fa-solid-900.ttf) format("truetype")}@font-face{font-family:"FontAwesome";font-display:block;src:url(../webfonts/fa-brands-400.woff2) format("woff2"),url(../webfonts/fa-brands-400.ttf) format("truetype")}@font-face{font-family:"FontAwesome";font-display:block;src:url(../webfonts/fa-regular-400.woff2) format("woff2"),url(../webfonts/fa-regular-400.ttf) format("truetype");unicode-range:u+f003,u+f006,u+f014,u+f016-f017,u+f01a-f01b,u+f01d,u+f022,u+f03e,u+f044,u+f046,u+f05c-f05d,u+f06e,u+f070,u+f087-f088,u+f08a,u+f094,u+f096-f097,u+f09d,u+f0a0,u+f0a2,u+f0a4-f0a7,u+f0c5,u+f0c7,u+f0e5-f0e6,u+f0eb,u+f0f6-f0f8,u+f10c,u+f114-f115,u+f118-f11a,u+f11c-f11d,u+f133,u+f147,u+f14e,u+f150-f152,u+f185-f186,u+f18e,u+f190-f192,u+f196,u+f1c1-f1c9,u+f1d9,u+f1db,u+f1e3,u+f1ea,u+f1f7,u+f1f9,u+f20a,u+f247-f248,u+f24a,u+f24d,u+f255-f25b,u+f25d,u+f271-f274,u+f278,u+f27b,u+f28c,u+f28e,u+f29c,u+f2b5,u+f2b7,u+f2ba,u+f2bc,u+f2be,u+f2c0-f2c1,u+f2c3,u+f2d0,u+f2d2,u+f2d4,u+f2dc}@font-face{font-family:"FontAwesome";font-display:block;src:url(../webfonts/fa-v4compatibility.woff2) format("woff2"),url(../webfonts/fa-v4compatibility.ttf) format("truetype");unicode-range:u+f041,u+f047,u+f065-f066,u+f07d-f07e,u+f080,u+f08b,u+f08e,u+f090,u+f09a,u+f0ac,u+f0ae,u+f0b2,u+f0d0,u+f0d6,u+f0e4,u+f0ec,u+f10a-f10b,u+f123,u+f13e,u+f148-f149,u+f14c,u+f156,u+f15e,u+f160-f161,u+f163,u+f175-f178,u+f195,u+f1f8,u+f219,u+f250,u+f252,u+f27a} \ No newline at end of file diff --git a/upload/engine/inc/maharder/admin/modules/admin/changelog.php b/upload/engine/inc/maharder/admin/modules/admin/changelog.php index 2d2db6d..d9995e4 100644 --- a/upload/engine/inc/maharder/admin/modules/admin/changelog.php +++ b/upload/engine/inc/maharder/admin/modules/admin/changelog.php @@ -2,12 +2,6 @@ $logs = [ - '2.0.7.2' => [ - '[FIX] Исправлен установщик v2', - ], - '2.0.7.1' => [ - '[FIX] Исправлен установщик', - ], '2.0.7' => [ '[NEW] Добавлен функционал проверки обновления плагина', '[UPDATE] Изменён подход к некоторым классам', diff --git a/upload/install.xml b/upload/install.xml index b71a784..35404fb 100644 --- a/upload/install.xml +++ b/upload/install.xml @@ -3,7 +3,7 @@ MH Admin Универсальная административная панель для модификаций от MaHarder - 2.0.7.2 + 2.0.8 13 greater @@ -12,15 +12,19 @@ 0 +VALUES('maharder', 'MH Admin v2.0.8', 'Настройка административной панели от MaHarder', DEFAULT, '1, 2') +ON DUPLICATE KEY UPDATE title = 'MH Admin v2.0.8';]]> +VALUES('maharder', 'MH Admin v2.0.8', 'Настройка административной панели от MaHarder', DEFAULT, '1, 2') +ON DUPLICATE KEY UPDATE title = 'MH Admin v2.0.8';]]> - - + + @@ -46,7 +50,7 @@ ON DUPLICATE KEY UPDATE title = 'MH Admin v2.0.7.2';]]> clear_cache($data);]]> 1 @@ -163,16 +167,25 @@ JS; clear_cache($data);]]> 1 + + + + 1 + - + 1