diff --git a/CHANGELOG.md b/CHANGELOG.md index eaaa2bb..e9e58d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ -0.5 - 2022.11.12 -- require Dotclear 2.24 +0.5 - 2022.11.20 +- fix compatibility with Dotclear 2.24 (required) 0.4 - 2021.09.02 - clean up code diff --git a/README.md b/README.md index 9edf8df..59ab575 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,12 @@ # README +[![Release](https://img.shields.io/github/v/release/JcDenis/tinyPacker)](https://github.com/JcDenis/tinyPacker/releases) +[![Date](https://img.shields.io/github/release-date/JcDenis/tinyPacker)](https://github.com/JcDenis/tinyPacker/releases) +[![Issues](https://img.shields.io/github/issues/JcDenis/tinyPacker)](https://github.com/JcDenis/tinyPacker/issues) +[![Dotclear](https://img.shields.io/badge/dotclear-v2.24-blue.svg)](https://fr.dotclear.org/download) +[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/tinyPacker) +[![License](https://img.shields.io/github/license/JcDenis/tinyPacker)](https://github.com/JcDenis/tinyPacker/blob/master/LICENSE) + ## WHAT IS tinyPacker ? _tinyPacker_ is a plugin for the open-source @@ -13,7 +20,7 @@ direct from Dotclear blog manager. _tinyPacker_ requires: * Super administrator permissions - * Dotclear 2.18 + * Dotclear 2.24 * A writable public directory. ## USAGE @@ -29,4 +36,10 @@ and it's pack into current blog public directory. * License : GNU GPL v2 * Source & contribution : [GitHub Page](https://github.com/JcDenis/tinyPacker) - * Packages & details: [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/tinyPacker) \ No newline at end of file + * Packages & details : [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/tinyPacker) + +## CONTRIBUTORS + + * Jean-Christian Denis + + You are welcome to contribute to this code. \ No newline at end of file diff --git a/_admin.php b/_admin.php index 0dc4b0b..ae252ed 100644 --- a/_admin.php +++ b/_admin.php @@ -1,16 +1,15 @@ getList() != 'plugin-activate' + if ($list->getList() != 'plugin-activate' && $list->getList() != 'theme-activate') { return null; } - return + return ''; } @@ -71,19 +70,21 @@ class tinyPacker public static function adminModulesDoActions($list, $modules, $type) { # Pack action - if (empty($_POST['tinypacker']) + if (empty($_POST['tinypacker']) || !is_array($_POST['tinypacker'])) { return null; } $modules = array_keys($_POST['tinypacker']); - $id = $modules[0]; + $id = $modules[0]; # Repository directory - if (($root = self::repositoryDir($list->core)) === false) { + if (($root = self::repositoryDir()) === false) { throw new Exception( - __('Destination directory is not writable.' - )); + __( + 'Destination directory is not writable.' + ) + ); } # Module to pack @@ -93,7 +94,7 @@ class tinyPacker $module = $list->modules->getModules($id); # Excluded files and dirs - $exclude = array( + $exclude = [ '\.', '\.\.', '__MACOSX', @@ -103,26 +104,25 @@ class tinyPacker 'CVS', '\.directory', '\.DS_Store', - 'Thumbs\.db' - ); + 'Thumbs\.db', + ]; # Packages names - $files = array( + $files = [ $type . '-' . $id . '.zip', - $type . '-' . $id . '-' . $module['version'] . '.zip' - ); + $type . '-' . $id . '-' . $module['version'] . '.zip', + ]; # Create zip - foreach($files as $f) { - + foreach ($files as $f) { @set_time_limit(300); $fp = fopen($root . '/' . $f, 'wb'); $zip = new fileZip($fp); - foreach($exclude AS $e) { + foreach ($exclude as $e) { $zip->addExclusion(sprintf( - '#(^|/)(%s)(/|$)#', + '#(^|/)(%s)(/|$)#', $e )); } @@ -146,7 +146,7 @@ class tinyPacker public static function repositoryDir() { $dir = path::real( - dcCore::app()->blog->public_path . '/' . tinyPacker::$sub_dir, + dcCore::app()->blog->public_path . '/' . tinyPacker::$sub_dir, false ); @@ -155,12 +155,11 @@ class tinyPacker files::makeDir($dir, true); } if (is_writable($dir)) { - return $dir; } + } catch(Exception $e) { } - catch(Exception $e) {} return false; } -} \ No newline at end of file +} diff --git a/_define.php b/_define.php index e8ec1ee..ae2b2bd 100644 --- a/_define.php +++ b/_define.php @@ -1,16 +1,15 @@ registerModule( 'Jean-Christian Denis', '0.5', [ - 'requires' => [['core', '2.24']], + 'requires' => [['core', '2.24']], 'permissions' => null, - 'type' => 'plugin', - 'support' => 'https://github.com/JcDenis/tinyPacker', - 'details' => 'https://plugins.dotaddict.org/dc2/details/tinyPacker', - 'repository' => 'https://raw.githubudsfsfdsfsercontent.com/JcDenis/tinyPacker/master/dcstore.xml' + 'type' => 'plugin', + 'support' => 'https://github.com/JcDenis/tinyPacker', + 'details' => 'https://plugins.dotaddict.org/dc2/details/tinyPacker', + 'repository' => 'https://raw.githubudsfsfdsfsercontent.com/JcDenis/tinyPacker/master/dcstore.xml', ] -); \ No newline at end of file +); diff --git a/dcstore.xml b/dcstore.xml index eaf9d86..13b5078 100644 --- a/dcstore.xml +++ b/dcstore.xml @@ -1,11 +1,13 @@ + - -Tiny packer -0.4 -Jean-Christian Denis -Quick pack theme or plugin into public dir -https://github.com/JcDenis/tinyPacker/releases/download/v0.4/plugin-tinyPacker.zip -https://plugins.dotaddict.org/dc2/details/tinyPacker -https://github.com/JcDenis/tinyPacker - - \ No newline at end of file + + Tiny packer + 0.5 + Jean-Christian Denis + Quick pack theme or plugin into public dir + https://github.com/JcDenis/tinyPacker/releases/download/v0.5/plugin-tinyPacker.zip + 2.24 + https://plugins.dotaddict.org/dc2/details/tinyPacker + https://github.com/JcDenis/tinyPacker + +