diff --git a/CHANGELOG.md b/CHANGELOG.md index 33768fb..deb579d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,13 @@ -0.0.2 +0.2 -dev - [ ] add global config for file size limit - [ ] add function to summarize by action what was done -- [x] use _requires_ or dc_min in _fixdcstore_ -- [x] fix unwanted translation of module name in _fixdcstore_ -- [x] add modifier _first upper case_ : _\u_ in _fixphpheader_ -- [x] fix whitespace and newline for bloc content in _fixphpheader_ +- [ ] add module to check depracated Dotclear function +- [ ] add module to check deprecated PHP function +- [ ] add module to check directory structure +- [ ] add DA badge to module _gitshields_ -0.0.1 +0.1 - 2021.09.11 +- First release + +0.0.1 - 2021.09.11 - First pre-release \ No newline at end of file diff --git a/README.md b/README.md index 5bff4d2..df27090 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,9 @@ [![Release](https://img.shields.io/github/v/release/JcDenis/improve)](https://github.com/JcDenis/improve/releases) [![Date](https://img.shields.io/github/release-date/JcDenis/improve)](https://github.com/JcDenis/improve/releases) -[![Issue](https://img.shields.io/github/issues/JcDenis/improve)](https://github.com/JcDenis/improve/issues) +[![Issues](https://img.shields.io/github/issues/JcDenis/improve)](https://github.com/JcDenis/improve/issues) [![Dotclear](https://img.shields.io/badge/dotclear-v2.19-blue.svg)](https://fr.dotclear.org/download) +[![Dotclear](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/improve) [![License](https://img.shields.io/github/license/JcDenis/improve)](https://github.com/JcDenis/improve/blob/master/LICENSE) ## WHAT IS IMPROVE ? diff --git a/_define.php b/_define.php index 8f7deca..0d42b6d 100644 --- a/_define.php +++ b/_define.php @@ -19,7 +19,7 @@ $this->registerModule( 'improve', 'Tiny tools to fix things for module devs', 'Jean-Christian Denis and contributors', - '0.0.1', + '0.1', [ 'requires' => [['core', '2.19']], 'permissions' => null, diff --git a/dcstore.xml b/dcstore.xml index 93b2798..137ac1e 100644 --- a/dcstore.xml +++ b/dcstore.xml @@ -1,10 +1,10 @@ improve -0.0.1 +0.1 Jean-Christian Denis and contributors Tiny tools to fix things for module devs -https://github.com/JcDenis/improve/releases/download/v0.0.1/plugin-improve.zip +https://github.com/JcDenis/improve/releases/download/v0.1/plugin-improve.zip 2.19 https://github.com/JcDenis/improve https://github.com/JcDenis/improve diff --git a/inc/lib.improve.action.gitshields.php b/inc/lib.improve.action.gitshields.php index 6383650..48ec485 100644 --- a/inc/lib.improve.action.gitshields.php +++ b/inc/lib.improve.action.gitshields.php @@ -19,11 +19,12 @@ class ImproveActionGitshields extends ImproveAction 'target' => '/^([^\n]+)[\r\n|\n]{1,}/ms' ]; protected $bloc_content = [ - '[![Release](https://img.shields.io/github/v/release/%username%/%module%)](https://github.com/%username%/%module%/releases)', - '[![Date](https://img.shields.io/github/release-date/%username%/%module%)](https://github.com/%username%/%module%/releases)', - '[![Issue](https://img.shields.io/github/issues/%username%/%module%)](https://github.com/%username%/%module%/issues)', - '[![Dotclear](https://img.shields.io/badge/dotclear-v%dotclear%-blue.svg)](https://fr.dotclear.org/download)', - '[![License](https://img.shields.io/github/license/%username%/%module%)](https://github.com/%username%/%module%/blob/master/LICENSE)' + 'release' => '[![Release](https://img.shields.io/github/v/release/%username%/%module%)](https://github.com/%username%/%module%/releases)', + 'date' => '[![Date](https://img.shields.io/github/release-date/%username%/%module%)](https://github.com/%username%/%module%/releases)', + 'issues' => '[![Issues](https://img.shields.io/github/issues/%username%/%module%)](https://github.com/%username%/%module%/issues)', + 'dotclear' => '[![Dotclear](https://img.shields.io/badge/dotclear-v%dotclear%-blue.svg)](https://fr.dotclear.org/download)', + 'dotaddict' => '[![Dotclear](https://img.shields.io/badge/dotaddict-official-green.svg)](https://%type%s.dotaddict.org/dc2/details/%module%)', + 'license' => '[![License](https://img.shields.io/github/license/%username%/%module%)](https://github.com/%username%/%module%/blob/master/LICENSE)' ]; protected function init(): bool @@ -48,15 +49,23 @@ class ImproveActionGitshields extends ImproveAction public function configure($url): ?string { if (!empty($_POST['save']) && !empty($_POST['username'])) { - $this->setPreferences('username', (string) $_POST['username']); + $this->setPreferences([ + 'username' => (string) $_POST['username'], + 'dotaddict' => !empty($_POST['dotaddict']) + ]); $this->redirect($url); } return ' -

' . +

' . form::field('username', 60, 100, $this->getPreference('username')) . '

' . __('Used in your Github URL: http://github.com/username/module_id.') . '
' . - __('If you have badges not created by this tool in the README.md file you should remove them manually.') . '

'; + __('If you have badges not created by this tool in the README.md file you should remove them manually.') . '

+ +

+

' . __('If your plugin or theme is on Dotaddict, you can add a badge to link to its details in Dotaddict.') . '

'; } public function openModule(string $module_type, array $module_info): ?bool @@ -83,22 +92,19 @@ class ImproveActionGitshields extends ImproveAction private function replaceInfo() { - $bloc = $this->bloc_content; - - if (empty($bloc)) { - self::notice(__('bloc is empty'), false); - - return null; - } - $username = $this->getPreference('username'); $module = $this->module['id']; + $type = $this->module['type']; $dotclear = $this->getDotclearVersion(); - foreach($bloc as $k => $v) { + $bloc = []; + foreach($this->bloc_content as $k => $v) { + if ($k == 'dotaddict' && empty($this->getPreference('dotaddict'))) { + continue; + } $bloc[$k] = trim(str_replace( - ['%username%', '%module%', '%dotclear%', "\r\n", "\n"], - [$username, $module, $dotclear, '', ''], + ['%username%', '%module%', '%dotclear%', '%type%', "\r\n", "\n"], + [$username, $module, $dotclear, $type, '', ''], $v )); } diff --git a/locales/fr/main.lang.php b/locales/fr/main.lang.php index 242db5d..5a18019 100644 --- a/locales/fr/main.lang.php +++ b/locales/fr/main.lang.php @@ -1,7 +1,7 @@