add modifier \u in phpheader

This commit is contained in:
Jean-Christian Denis 2021-09-02 10:55:42 +02:00
parent ae12e53215
commit f9ba34adc1
3 changed files with 21 additions and 15 deletions

View file

@ -1,5 +1,6 @@
0.0.2
- [ ] add global config for file size limit
- [x] add modifier _first upper case_ : _\u_ in bloc content
0.0.1
- First pre-release

View file

@ -5,7 +5,7 @@
**improve** is a plugin for the open-source
web publishing software called Dotclear.
It helps dev to clean up his plugin or theme before publishing its code.
It helps dev to clean up plugin or theme before publishing code.
* Open to third party plugin
* Easy and fast to use

View file

@ -156,20 +156,25 @@ class ImproveActionPhpheader extends ImproveAction
}
try {
$this->bloc = str_replace(
$this->bloc_wildcards,
[
date('Y'),
$this->module['id'],
$this->module['name'],
$this->module['author'],
$this->module['type'],
$this->core->auth->getInfo('user_cn'),
$this->core->auth->getinfo('user_name'),
$this->core->auth->getInfo('user_email'),
$this->core->auth->getInfo('user_url')
],
$bloc
$this->bloc = preg_replace_callback(
// use \u in bloc content for first_upper_case
'/(\\\u([a-z]{1}))/',
function($str) { return ucfirst($str[2]); },
str_replace(
$this->bloc_wildcards,
[
date('Y'),
$this->module['id'],
$this->module['name'],
$this->module['author'],
$this->module['type'],
$this->core->auth->getInfo('user_cn'),
$this->core->auth->getinfo('user_name'),
$this->core->auth->getInfo('user_email'),
$this->core->auth->getInfo('user_url')
],
$bloc
)
);
} catch (Exception $e) {
self::notice(__('failed to parse bloc'));