add report, change preference for setting, less functions args, less interface text

master
Jean-Christian Paul Denis 2021-09-15 23:48:58 +02:00
parent bb3966b189
commit 346b59b5bb
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
13 changed files with 994 additions and 418 deletions

View File

@ -1,10 +1,16 @@
0.2 -dev
- [ ] add global config for file size limit
- [ ] add function to summarize by action what was done
- [ ] 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_
- [ ] write documentation of php class
0.1.2
- add logs / report systeme
- add DA badge to module _gitshields_
- change function args, less is better
- change interface, lighter names
- add function to summarize by action what was done
0.1.1
- fix php < 8.0

View File

@ -19,7 +19,7 @@ $this->registerModule(
'improve',
'Tiny tools to fix things for module devs',
'Jean-Christian Denis and contributors',
'0.1.1',
'0.1.2',
[
'requires' => [['core', '2.19']],
'permissions' => null,

View File

@ -11,24 +11,33 @@
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
/**
* This is the absract action class.
*
* @brief Plugin improve action class
*
* Action class must extends class ImproveAction.
* Call 'create' function with child class name through behavior,
* If your class signature is myClass extends ImproveAction, do
* $core->addBehavior('ImproveAddAction'), ['myClass', 'create']);
* If your class signature is myActionClass extends ImproveAction,
* do $core->addBehavior('ImproveAddAction'), ['myClass', 'create']);
* yoru action class is automatically created,
* then function init() of your class wil be called.
* One class must manage only one action.
*
* @package Plugin_improve
* @subpackage Action
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0-only
*/
abstract class ImproveAction
{
protected $core;
protected $type = '';
protected $module = [];
protected $path_full = '';
protected $path_extension = '';
protected $path_is_dir = null;
private static $notice = [];
private $preferences = [];
private $logs = ['success' => [], 'warning' => [], 'error' => []];
private $settings = [];
private $properties = [
'id' => '',
'name' => '',
@ -38,14 +47,17 @@ abstract class ImproveAction
'types' => ['plugin']
];
/**
* ImproveAction constructor inits properpties and settings of a child class.
*
* @param string $core dcCore instance
*/
final public function __construct(dcCore $core)
{
$this->core = $core;
self::$notice[get_called_class()] = ['error' => [], 'warning' => []];
$pref = @unserialize($core->blog->settings->improve->get('preferences_' . get_called_class()));
$this->preferences = is_array($pref) ? $pref : [];
$settings = @unserialize($core->blog->settings->improve->get('settings_' . get_called_class()));
$this->settings = is_array($settings) ? $settings : [];
$this->init();
@ -55,33 +67,64 @@ abstract class ImproveAction
}
}
final protected static function notice(string $message, bool $is_error = true)
/**
* Helper to create an instance of a ImproveAction child class.
*
* @param string $o ArrayObject of actions list
* @param string $core dcCore instance
*/
public static function create(arrayObject $o, dcCore $core)
{
if (!empty($message)) {
self::$notice[get_called_class()][$is_error ? 'error' : 'warning'][] = $message;
}
$c = get_called_class();
$o->append(new $c($core));
}
final public static function hasNotice(bool $error = true): bool
{
return !empty(self::$notice[get_called_class()][$error ? 'error' : 'warning']);
}
final public static function getNotice(bool $error = true): array
{
return self::$notice[get_called_class()][$error ? 'error' : 'warning'];
}
/**
* Action initialisation function.
*
* It's called when an instance of ImproveAction child class is created.
* Usefull to setup action class.
*
* @return bool True if initialisation is ok.
*/
abstract protected function init(): bool;
/// @name Properties methods
//@{
/**
* @see getProperty();
*/
final public function __get(string $property)
{
return $this->getProperty($property);
}
/**
* Get a definition property of action class
*
* @return mixed A property of action definition.
*/
final public function getProperty(string $property)
{
return $this->properties[$property] ?? null;
}
/**
* Set a definition property of action class
*
* Property can be:
* - id : action id
* - name : action short name
* - desc : action short description,
* - priority : order of execution of this action
* - config : as configuration gui, false = none, true = internal, string = ext url
* - types : array of supported type of module, can : be plugins and/or themes
*
* @param mixed $property one or more definition
* @param dtring $value value for a single property
*
* @return mixed A property of action definition.
*/
final protected function setProperties($property, $value = null): bool
{
$properties = is_array($property) ? $property : [$property => $value];
@ -95,26 +138,51 @@ abstract class ImproveAction
}
return true;
}
//@}
final protected function getPreference(string $preference)
/// @name Settings methods
//@{
/**
* Get a settings of action class
*
* @param string $setting a settings id
*
* @return mixed A setting of action.
*/
final protected function getSetting(string $setting)
{
return $this->preferences[$preference] ?? null;
return $this->settings[$setting] ?? null;
}
final protected function setPreferences($preference, $value = null)
/**
* Set one or more setting of action class
*
* @param mixed $settings one or more settings
* @param string $value value for a single setting
*
* @return mixed A setting of action.
*/
final protected function setSettings($settings, $value = null)
{
$preferences = is_array($preference) ? $preference : [$preference => $value];
foreach($preferences as $k => $v) {
$this->preferences[$k] = $v;
$settings = is_array($settings) ? $settings : [$setting => $value];
foreach($settings as $k => $v) {
$this->settings[$k] = $v;
}
return true;
}
/**
* Redirection after settings update
*
* This save settings update before redirect.
*
* @param string $url redirect url after settings update
*/
final protected function redirect(string $url)
{
$this->core->blog->settings->improve->put(
'preferences_' . get_called_class(),
serialize($this->preferences),
'settings_' . get_called_class(),
serialize($this->settings),
'string',
null,
true,
@ -125,51 +193,240 @@ abstract class ImproveAction
http::redirect($url);
}
abstract protected function init(): bool;
/**
* Check if action class is well configured
*
* @return boolean True if class action is well configured
*/
abstract public function isConfigured(): bool;
public static function create(arrayObject $o, dcCore $core)
/**
* Get configuraton gui
*
* If action class uses internal configuration,
* it must share here html form content of its settings.
* It must not use enclose bloc "form" nor button "save".
* This function is also called to redirect form
* after validation with $this->redirect($url);
*
* @param string $url post form redirect url
*
* @return mixed A setting of action.
*/
public function configure(string $url): ?string
{
$c = get_called_class();
$o->append(new $c($core));
return null;
}
//@}
/**
* Set in class var current module definitions.
*
* @see Improve::sanitizeModule()
*
* @param array $module Full array of module definitons
*/
final public function setModule(array $module)
{
$this->module = $module;
}
public function configure(string $redirect_url): ?string
/**
* Set in class var current path definitons.
*
* @param string $path_full Full path
* @param string $path_extension Path extension (if it is a file)
* @param string $path_is_dir True if path is a directory
*/
final public function setPath(string $path_full, string $path_extension, bool $path_is_dir)
{
$this->path_full = $path_full;
$this->path_extension = $path_extension;
$this->path_is_dir = $path_is_dir;
}
/// @name Fix methods
//@{
/**
* Called when starting to fix module.
*/
public function openModule(): ?bool
{
return null;
}
public function openModule(string $module_type, array $module_info): ?bool
{
$this->type = $module_type;
$this->module = $module_info;
return null;
}
public function openDirectory(string $path): ?bool
/**
* Called when open a directory to fix.
*/
public function openDirectory(): ?bool
{
return null;
}
public function openFile(string $path, string $extension): ?bool
/**
* Called when open a file to fix.
*/
public function openFile(): ?bool
{
return null;
}
public function readFile(string $path, string $extension, string &$content): ?bool
/**
* Called when read content of a file to fix.
*
* Content is shared from action to another.
* If an action erase content, fix is stopped.
* If you want to erase a content you must erase
* the file on action openDirectory.
*
* @param string $content File content
*/
public function readFile(string &$content): ?bool
{
return null;
}
public function closeFile(string $path, string $extension): ?bool
/**
* Called when close a file to fix.
*/
public function closeFile(): ?bool
{
return null;
}
public function closeModule(string $module_type, array $module_info): ?bool
/**
* Called when close a module to fix.
*/
public function closeModule(): ?bool
{
return null;
}
//@}
/// @name Logs methods
//@{
/**
* Set an action log.
*
* Log must be use every time an action something happen.
*
* @param string $type type of message, can be error, warning, succes
* @param string $message message to log
*
* @return boolean True if message is logged.
*/
final public function setLog(string $type, string $message): bool
{
if (empty($this->path_full) || !array_key_exists($type, $this->logs)) {
return false;
}
$this->logs[$type][$this->path_full][] = $message;
return true;
}
/**
* Check if action class has log of given type.
*
* @param string $type type of message, can be error, warning, succes
*
* @return boolean True if messages exist.
*/
final public function hasLog(string $type): bool
{
return array_key_exists($type, $this->logs) && !empty($this->logs[$type]);
}
/**
* Get action logs.
*
* @param mixed $type type of message, can be error, warning, succes
*
* @return array Arry of given type of log or all if type is null
*/
final public function getLogs($type = null): array
{
if (null === $type) {
return $this->logs;
}
if (empty($this->path_full)
|| !array_key_exists($type, $this->logs)
|| !array_key_exists($this->path_full, $this->logs[$type])
) {
return [];
}
return $this->logs[$type][$this->path_full];
}
/**
* Set a log of type error.
*/
final public function setError(string $message)
{
$this->setLog('error', $message);
}
/**
* Check logs of type error exists.
*/
final public function hasError(): bool
{
return !empty($this->getLogs('error'));
}
/**
* Get logs of type error.
*/
final public function getErrors(): array
{
return $this->getLogs('error');
}
/**
* Set a log of type warning.
*/
final public function setWarning(string $message)
{
$this->setLog('warning', $message);
}
/**
* Check logs of type error warnings.
*/
final public function hasWarning(): bool
{
return !empty($this->getLogs('warning'));
}
/**
* Get logs of type warning.
*/
final public function getWarnings(): array
{
return $this->getLogs('warning');
}
/**
* Set a log of type success.
*/
final public function setSuccess(string $message)
{
$this->setLog('success', $message);
}
/**
* Check logs of type error success.
*/
final public function hasSuccess(): bool
{
return !empty($this->getLogs('success'));
}
/**
* Get logs of type success.
*/
final public function getSuccess(): array
{
return $this->getLogs('success');
}
//@}
}

View File

@ -21,6 +21,8 @@ class Improve
];
private $core;
private $actions = [];
private $logs = [];
private $has_log = ['success' => false, 'warning' => false, 'error' => false];
public function __construct(dcCore $core)
{
@ -42,6 +44,72 @@ class Improve
uasort($this->actions, [$this, 'sortModules']);
}
public function getLogs(): array
{
return $this->logs;
}
public function hasLog(string $type): bool
{
return array_key_exists($type, $this->has_log) && $this->has_log[$type];
}
public function writeLogs(): string
{
if (empty($this->logs)) {
return '';
}
$cur = $this->core->con->openCursor($this->core->prefix . 'log');
$cur->log_msg = serialize($this->logs);
$cur->log_table = 'improve';
$id = $this->core->log->addLog($cur);
return $id;
}
public function readLogs(int $id ): array
{
$rs = $this->core->log->getLogs(['log_table' => 'improve', 'log_id' => $id, 'limit' => 1]);
if ($rs->isEmpty()) {
return [];
}
$this->core->log->delLogs($rs->log_id);
return unserialize($rs->log_msg);
}
public function parselogs(int $id): array
{
$logs = $this->readLogs($id);
if (empty($logs)) {
return [];
}
$lines = [];
foreach($logs['improve'] as $path => $tools) {
$l_types = [];
foreach(['success', 'warning', 'error'] as $type) {
$l_tools = [];
foreach($tools as $tool) {
$l_msg = [];
if (!empty($logs[$tool][$type][$path])) {
foreach($logs[$tool][$type][$path] as $msg) {
$l_msg[] = $msg;
}
}
if (!empty($l_msg)) {
$l_tools[$tool] = $l_msg;
}
}
if (!empty($l_tools)) {
$l_types[$type] = $l_tools;
}
}
if (!empty($l_types)) {
$lines[$path] = $l_types;
}
}
return $lines;
}
public function module(string $id): ?ImproveAction
{
if (empty($id)) {
@ -58,9 +126,10 @@ class Improve
return $this->actions[$id] ?? null;
}
public function fix(string $type, string $id, array $module, array $actions): int
public function fixModule(string $type, string $id, array $properties, array $actions): float
{
$module = ImproveDefinition::clean($id, $module);
$time_start = microtime(true);
$module = ImproveDefinition::clean($type, $id, $properties);
$workers = [];
foreach($actions as $action) {
@ -69,9 +138,13 @@ class Improve
}
}
foreach($workers as $action) {
// action:
// open module
$action->openModule($type, $module);
// trace all path and action in logs
$this->logs['improve'][__('Begin')][] = $action->id;
// info: set current module
$action->setModule($module);
$action->setPath(__('Begin'), '', true);
// action: open module
$action->openModule();
}
if (!isset($module['sroot']) || !$module['root_writable'] || !is_writable($module['sroot'])) {
throw new Exception(__('Module path is not writable'));
@ -81,25 +154,28 @@ class Improve
if (!file_exists($file[0])) {
continue;
}
foreach($workers as $action) {
// trace all path and action in logs
$this->logs['improve'][$file[0]][] = $action->id;
// info: set current path
$action->setPath($file[0], $file[1], $file[2]);
}
if (!$file[2]) {
foreach($workers as $action) {
// action:
// open a directory. full path
$action->openDirectory($file[0]);
// action: open a directory. full path
$action->openDirectory();
}
} else {
foreach($workers as $action) {
// action:
// before openning a file. full path, extension
$action->openFile($file[0], $file[1]);
// action: before openning a file. full path, extension
$action->openFile();
}
if (in_array($file[1], self::$readfile_extensions)) {
if (false !== ($content = file_get_contents($file[0]))) {
$no_content = empty($content);
foreach($workers as $action) {
// action:
// read a file content. full path, extension, content
$action->readFile($file[0], $file[1], $content);
// action: read a file content. full path, extension, content
$action->readFile($content);
if (empty($content) && !$no_content) {
throw new Exception(sprintf(
__('File content has been removed: %s by %s'), $file[0], $action->name
@ -109,29 +185,31 @@ class Improve
files::putContent($file[0], $content);
}
foreach($workers as $action) {
// action:
// after closing a file. full path, extension
$action->closeFile($file[0], $file[1]);
// action: after closing a file. full path, extension
$action->closeFile();
}
}
}
}
// action:
// close module
foreach($workers as $action) {
$action->closeModule($type, $module);
// trace all path and action in logs
$this->logs['improve'][__('End')][] = $action->id;
// info: set current module
$action->setPath(__('End'), '', true);
// action: close module
$action->closeModule();
}
// info: get acions reports
foreach($workers as $action) {
if ($action->hasNotice()) {
dcPage::addErrorNotice($action->name . ' : ' . implode(', ', $action->getNotice()));
$this->logs[$action->id] = $action->getLogs();
foreach($this->has_log as $type => $v) {
if ($action->hasLog($type)) {
$this->has_log[$type] = true;
}
}
}
foreach($workers as $action) {
if ($action->hasNotice(false)) {
dcPage::addWarningNotice($action->name . ' : ' . implode(', ', $action->getNotice(false)));
}
}
return count($tree);
return substr(microtime(true) - $time_start, 0, 5);
}
private static function getModuleFiles(string $path, string $dir = '', array $res = []): array
@ -164,7 +242,7 @@ class Improve
public function getURL(array $params = []): string
{
return $this->core->adminurl->get('admin.plugin.improve', $params);
return $this->core->adminurl->get('admin.plugin.improve', $params, '&');
}
public static function cleanExtensions($in): array
@ -197,11 +275,11 @@ class ImproveDefinition
{
private $properties = [];
public function __construct(string $id, array $properties = [])
public function __construct(string $type, string $id, array $properties = [])
{
$this->loadDefine($id, $properties['root']);
$this->properties = array_merge($this->properties, self::sanitizeModule($id, $properties));
$this->properties = array_merge($this->properties, self::sanitizeModule($type, $id, $properties));
}
public function get()
@ -209,9 +287,9 @@ class ImproveDefinition
return $this->properties;
}
public static function clean($id, $properties)
public static function clean(string $type, string $id, array $properties): array
{
$p = new self($id, $properties);
$p = new self($type, $id, $properties);
return $p->get();
}
@ -255,7 +333,7 @@ class ImproveDefinition
}
# adapt from lib.moduleslist.php
public static function sanitizeModule(string $id, array $properties): array
public static function sanitizeModule(string $type, string $id, array $properties): array
{
$label = empty($properties['label']) ? $id : $properties['label'];
$name = __(empty($properties['name']) ? $label : $properties['name']);
@ -292,6 +370,7 @@ class ImproveDefinition
[
'id' => $id,
'sid' => self::sanitizeString($id),
'type' => $type,
'label' => $label,
'name' => $name,
'oname' => $oname,

View File

@ -17,7 +17,7 @@ class ImproveActionDcstore extends ImproveAction
{
$this->setProperties([
'id' => 'dcstore',
'name' => __('Fix dcstore.xml'),
'name' => __('Store file'),
'desc' => __('Re-create dcstore.xml file according to _define.php variables'),
'priority' => 420,
'config' => true,
@ -29,13 +29,13 @@ class ImproveActionDcstore extends ImproveAction
public function isConfigured(): bool
{
return !empty($this->getPreference('pattern'));
return !empty($this->getSetting('pattern'));
}
public function configure($url): ?string
{
if (!empty($_POST['save']) && !empty($_POST['dcstore_pattern'])) {
$this->setPreferences('pattern', (string) $_POST['dcstore_pattern']);
$this->setSettings('pattern', (string) $_POST['dcstore_pattern']);
$this->redirect($url);
}
@ -43,7 +43,7 @@ class ImproveActionDcstore extends ImproveAction
'<p class="info">' . __('File will be overwritten if it exists') . '</p>' .
'<p><label class="classic" for="dcstore_pattern">' .
__('Predictable URL to zip file on the external repository') . '<br />' .
form::field('dcstore_pattern', 160, 255, $this->getPreference('pattern')) . '</label>' .
form::field('dcstore_pattern', 160, 255, $this->getSetting('pattern')) . '</label>' .
'</p>' .
'<p class="form-note">' .
sprintf(__('You can use wildcards %s'), '%author%, %type%, %id%, %version%.') .
@ -54,20 +54,17 @@ class ImproveActionDcstore extends ImproveAction
</p>';
}
public function openModule($module_type, $module_info): ?bool
public function openModule(): ?bool
{
$this->type = $module_type;
$this->module = $module_info;
$content = self::generateXML($module_info['id'], $module_info, $this->getPreference('pattern'));
if (self::hasNotice()) {
$content = $this->generateXML();
if ($this->hasError()) {
return false;
}
try {
files::putContent($module_info['sroot'] . '/dcstore.xml', $content);
files::putContent($this->module['sroot'] . '/dcstore.xml', $content);
$this->setSuccess(__('Write dcstore.xml file.'));
} catch(Exception $e) {
self::notice(__('Failed to write dcstore.xml file'));
$this->setError(__('Failed to write dcstore.xml file'));
return false;
}
@ -75,97 +72,93 @@ class ImproveActionDcstore extends ImproveAction
return true;
}
public static function generateXML($id, $module, $file_pattern)
public function generateXML()
{
if (!is_array($module) || empty($module)) {
return false;
}
$xml = ['<modules xmlns:da="http://dotaddict.org/da/">'];
# id
if (empty($module['id'])) {
self::notice(__('unkow module id'));
if (empty($this->module['id'])) {
$this->setError(__('unkow module id'));
}
$xml[] = sprintf('<module id="%s">', html::escapeHTML($module['id']));
$xml[] = sprintf('<module id="%s">', html::escapeHTML($this->module['id']));
# name
if (empty($module['oname'])) {
self::notice(__('unknow module name'));
if (empty($this->module['oname'])) {
$this->setError(__('unknow module name'));
}
$xml[] = sprintf('<name>%s</name>', html::escapeHTML($module['name']));
$xml[] = sprintf('<name>%s</name>', html::escapeHTML($this->module['name']));
# version
if (empty($module['version'])) {
self::notice(__('unknow module version'));
if (empty($this->module['version'])) {
$this->setError(__('unknow module version'));
}
$xml[] = sprintf('<version>%s</version>', html::escapeHTML($module['version']));
$xml[] = sprintf('<version>%s</version>', html::escapeHTML($this->module['version']));
# author
if (empty($module['author'])) {
self::notice(__('unknow module author'));
if (empty($this->module['author'])) {
$this->setError(__('unknow module author'));
}
$xml[] = sprintf('<author>%s</author>', html::escapeHTML($module['author']));
$xml[] = sprintf('<author>%s</author>', html::escapeHTML($this->module['author']));
# desc
if (empty($module['desc'])) {
self::notice(__('unknow module description'));
if (empty($this->module['desc'])) {
$this->setError(__('unknow module description'));
}
$xml[] = sprintf('<desc>%s</desc>', html::escapeHTML($module['desc']));
$xml[] = sprintf('<desc>%s</desc>', html::escapeHTML($this->module['desc']));
# repository
if (empty($module['repository'])) {
self::notice(__('no repository set in _define.php'));
if (empty($this->module['repository'])) {
$this->setError(__('no repository set in _define.php'));
}
# file
$file_pattern = self::parseFilePattern($module, $file_pattern);
$file_pattern = $this->parseFilePattern();
if (empty($file_pattern)) {
self::notice(__('no zip file pattern set in configuration'));
$this->setError(__('no zip file pattern set in configuration'));
}
$xml[] = sprintf('<file>%s</file>', html::escapeHTML($file_pattern));
# da dc_min or requires core
if (!empty($module['requires']) && is_array($module['requires'])) {
foreach ($module['requires'] as $req) {
if (!empty($this->module['requires']) && is_array($this->module['requires'])) {
foreach ($this->module['requires'] as $req) {
if (!is_array($req)) {
$req = [$req];
}
if ($req[0] == 'core') {
$module['dc_min'] = $req[1];
$this->module['dc_min'] = $req[1];
break;
}
}
}
if (empty($module['dc_min'])) {
self::notice(__('no minimum dotclear version'), false);
if (empty($this->module['dc_min'])) {
$this->setWarning(__('no minimum dotclear version'));
} else {
$xml[] = sprintf('<da:dcmin>%s</da:dcmin>', html::escapeHTML($module['dc_min']));
$xml[] = sprintf('<da:dcmin>%s</da:dcmin>', html::escapeHTML($this->module['dc_min']));
}
# da details
if (empty($module['details'])) {
self::notice(__('no details URL'), false);
if (empty($this->module['details'])) {
$this->setWarning(__('no details URL'));
} else {
$xml[] = sprintf('<da:details>%s</da:details>', html::escapeHTML($module['details']));
$xml[] = sprintf('<da:details>%s</da:details>', html::escapeHTML($this->module['details']));
}
# da sshot
//$xml[] = sprintf('<da:sshot>%s</da:sshot>', html::escapeHTML($module['sshot']));
//$xml[] = sprintf('<da:sshot>%s</da:sshot>', html::escapeHTML($this->module['sshot']));
# da section
//$xml[] = sprintf('<da:section>%s</da:section>', html::escapeHTML($module['section']));
//$xml[] = sprintf('<da:section>%s</da:section>', html::escapeHTML($this->module['section']));
# da support
if (empty($module['support'])) {
self::notice(__('no support URL'), false);
if (empty($this->module['support'])) {
$this->setWarning(__('no support URL'));
} else {
$xml[] = sprintf('<da:support>%s</da:support>', html::escapeHTML($module['support']));
$xml[] = sprintf('<da:support>%s</da:support>', html::escapeHTML($this->module['support']));
}
# da tags
//$xml[] = sprintf('<da:tags>%s</da:tags>', html::escapeHTML($module['tags']));
//$xml[] = sprintf('<da:tags>%s</da:tags>', html::escapeHTML($this->module['tags']));
$xml[] = '</module>';
$xml[] = '</modules>';
@ -173,7 +166,7 @@ class ImproveActionDcstore extends ImproveAction
return implode("\n", $xml);
}
private static function parseFilePattern($module, $file_pattern)
private function parseFilePattern()
{
return text::tidyURL(str_replace(
[
@ -183,12 +176,12 @@ class ImproveActionDcstore extends ImproveAction
'%author%'
],
[
$module['type'],
$module['id'],
$module['version'],
$module['author']
$this->module['type'],
$this->module['id'],
$this->module['version'],
$this->module['author']
],
$file_pattern
$this->getSetting('pattern')
));
}
}

View File

@ -31,7 +31,7 @@ class ImproveActionGitshields extends ImproveAction
{
$this->setProperties([
'id' => 'gitshields',
'name' => __('Fix shields badges'),
'name' => __('Shields badges'),
'desc' => __('Add and maintain shields.io badges to the REDAME.md file'),
'priority' => 380,
'config' => true,
@ -43,13 +43,13 @@ class ImproveActionGitshields extends ImproveAction
public function isConfigured(): bool
{
return !empty($this->getPreference('username'));
return !empty($this->getSetting('username'));
}
public function configure($url): ?string
{
if (!empty($_POST['save']) && !empty($_POST['username'])) {
$this->setPreferences([
$this->setSettings([
'username' => (string) $_POST['username'],
'dotaddict' => !empty($_POST['dotaddict'])
]);
@ -58,28 +58,26 @@ class ImproveActionGitshields extends ImproveAction
return '
<p><label for="username">' . __('Your Github user name :') . '</label>' .
form::field('username', 60, 100, $this->getPreference('username')) . '
form::field('username', 60, 100, $this->getSetting('username')) . '
</p><p class="form-note">' . __('Used in your Github URL: http://github.com/username/module_id.') . '<br />' .
__('If you have badges not created by this tool in the README.md file you should remove them manually.') . '</p>
<p><label for="dotaddict">' .
form::checkbox('dotaddict', 1, !empty($this->getPreference('dotaddict'))) . ' '.
form::checkbox('dotaddict', 1, !empty($this->getSetting('dotaddict'))) . ' '.
__('Include Dotaddict badge') . '</label>
</p><p class="form-note">' . __('If your plugin or theme is on Dotaddict, you can add a badge to link to its details in Dotaddict.') . '</p>';
}
public function openModule(string $module_type, array $module_info): ?bool
public function openModule(): ?bool
{
$this->type = $module_type;
$this->module = $module_info;
$this->replaceInfo();
return null;
}
public function readFile($path, $extension, &$content): ?bool
public function readFile(&$content): ?bool
{
if ($this->stop_scan || !preg_match('/(.*?)README\.md$/i', $path)) {
if ($this->stop_scan || !preg_match('/(.*?)README\.md$/i', $this->path_full)) {
return null;
}
@ -92,31 +90,38 @@ class ImproveActionGitshields extends ImproveAction
private function replaceInfo()
{
$username = $this->getPreference('username');
$module = $this->module['id'];
$type = $this->module['type'];
$dotclear = $this->getDotclearVersion();
$bloc = [];
foreach($this->bloc_content as $k => $v) {
if ($k == 'dotaddict' && empty($this->getPreference('dotaddict'))) {
if ($k == 'dotaddict' && empty($this->getSetting('dotaddict'))) {
continue;
}
$bloc[$k] = trim(str_replace(
['%username%', '%module%', '%dotclear%', '%type%', "\r\n", "\n"],
[$username, $module, $dotclear, $type, '', ''],
[
'%username%',
'%module%',
'%dotclear%',
'%type%',
"\r\n", "\n"
],
[
$this->getSetting('username'),
$this->module['id'],
$dotclear = $this->getDotclearVersion(),
$this->module['type'],
'', ''
],
$v
));
}
$this->bloc = $bloc;
$this->setSuccess(__('Prepare custom shield info'));
}
private function getDotclearVersion()
{
$version = null;
$module = $this->module;
if (!empty($module['requires']) && is_array($module['requires'])) {
foreach ($module['requires'] as $req) {
if (!empty($this->module['requires']) && is_array($this->module['requires'])) {
foreach ($this->module['requires'] as $req) {
if (!is_array($req)) {
$req = [$req];
}
@ -131,20 +136,31 @@ class ImproveActionGitshields extends ImproveAction
private function writeShieldsBloc($content)
{
return preg_replace(
$res = preg_replace(
$this->bloc_pattern['target'],
'$1' . "\n\n" . trim(implode("\n", $this->bloc)) . "\n\n",
$content,
1
1,
$count
);
if ($count) {
$this->setSuccess(__('Write new shield bloc'));
}
return $res;
}
private function deleteShieldsBloc($content)
{
return preg_replace(
$res = preg_replace(
$this->bloc_pattern['remove'],
"\n\n",
$content
$content,
1,
$count
);
if ($count) {
$this->setSuccess(__('Delete old shield bloc'));
}
return $res;
}
}

View File

@ -26,7 +26,7 @@ class ImproveActionLicensefile extends ImproveAction
{
$this->setProperties([
'id' => 'license',
'name' => __('Fix license file'),
'name' => __('License file'),
'desc' => __('Add or remove full license file to module root'),
'priority' => 330,
'config' => true,
@ -57,7 +57,7 @@ class ImproveActionLicensefile extends ImproveAction
public function configure($url): ?string
{
if (!empty($_POST['save'])) {
$this->setPreferences([
$this->setSettings([
'action_version' => !empty($_POST['action_version']) ? $_POST['action_version'] : '',
'action_full' => !empty($_POST['action_full']) ? $_POST['action_full'] : ''
]);
@ -66,25 +66,22 @@ class ImproveActionLicensefile extends ImproveAction
return '
<p class="field"><label for="action_version">' . __('License version:') . '</label>' .
form::combo('action_version', $this->action_version, $this->getPreference('action_version')) . '
form::combo('action_version', $this->action_version, $this->getSetting('action_version')) . '
</p>
<p class="field"><label for="action_full">' . __('Action on file:') . '</label>' .
form::combo('action_full', $this->action_full, $this->getPreference('action_full')) .
form::combo('action_full', $this->action_full, $this->getSetting('action_full')) .
'</p>';
}
public function openModule(string $module_type, array $module_info): ?bool
public function openModule(): ?bool
{
$this->type = $module_type;
$this->module = $module_info;
if (in_array($this->getPreference('action_full'), ['remove', 'full','overwrite'])) {
$this->deleteFullLicense(($this->getPreference('action_full') == 'overwrite'));
if (in_array($this->getSetting('action_full'), ['remove', 'full','overwrite'])) {
$this->deleteFullLicense(($this->getSetting('action_full') == 'overwrite'));
}
if (in_array($this->getPreference('action_full'), ['create', 'overwrite', 'full'])) {
if (empty($this->getPreference('action_version'))) {
self::notice(__('no full license type selected'), false);
if (in_array($this->getSetting('action_full'), ['create', 'overwrite', 'full'])) {
if (empty($this->getSetting('action_version'))) {
$this->setWarning(__('No full license type selected'));
} else {
$this->writeFullLicense();
}
@ -95,15 +92,16 @@ class ImproveActionLicensefile extends ImproveAction
private function writeFullLicense()
{
try {
$full = file_get_contents(dirname(__FILE__) . '/license/' . $this->getPreference('action_version') . '.full.txt');
$full = file_get_contents(dirname(__FILE__) . '/license/' . $this->getSetting('action_version') . '.full.txt');
if (empty($full)) {
self::notice(__('failed to load full license'));
$this->setError(__('Failed to load license content'));
return null;
}
files::putContent($this->module['root'] . '/LICENSE', str_replace("\r\n","\n",$full));
files::putContent($this->module['root'] . '/LICENSE', str_replace("\r\n", "\n", $full));
$this->setSuccess(__('Write new license file "LICENSE"'));
} catch (Exception $e) {
self::notice(__('failed to write full license'));
$this->setError(__('Failed to write new license file'));
return null;
}
@ -113,14 +111,15 @@ class ImproveActionLicensefile extends ImproveAction
private function deleteFullLicense($only_one = false)
{
foreach(self::fileExists($this->module['root']) as $file) {
if ($only_one && $file != 'license') {
if ($only_one && $file != 'LICENSE') {
continue;
}
if (!files::isDeletable($this->module['root'] . '/' . $file)) {
self::notice(sprintf(__('full license is not deletable (%s)'), $file), false);
}
if (!@unlink($this->module['root'] . '/' . $file)) {
self::notice(sprintf(__('failed to delete full license (%s)'), $file), false);
$this->setWarning(sprintf(__('Old license file is not deletable (%s)'), $file));
} elseif (!@unlink($this->module['root'] . '/' . $file)) {
$this->setError(sprintf(__('Failed to delete old license file (%s)'), $file));
} else {
$this->setSuccess(sprintf(__('Delete old license file "%s"'), $file));
}
}
return true;

View File

@ -17,7 +17,7 @@ class ImproveActionTab extends ImproveAction
{
$this->setProperties([
'id' => 'tab',
'name' => __('Fix tabulation'),
'name' => __('Tabulations'),
'desc' => __('Replace tabulation by four space in php files'),
'priority' => 820,
'types' => ['plugin', 'theme']
@ -26,12 +26,16 @@ class ImproveActionTab extends ImproveAction
return true;
}
public function readFile($path, $extension, &$content): ?bool
public function readFile(&$content): ?bool
{
if (!in_array($extension, ['php', 'md'])) {
if (!in_array($this->path_extension, ['php', 'md'])) {
return null;
}
$content = preg_replace('/(\t)/', ' ', $content)."\n";
$clean = preg_replace('/(\t)/', ' ', $content);// . "\n";
if ($content != $clean) {
$this->setSuccess(__('Replace tabulation by spaces'));
$content = $clean;
}
return true;
}
@ -50,7 +54,7 @@ class ImproveActionNewline extends ImproveAction
{
$this->setProperties([
'id' => 'newline',
'name' => __('Fix newline'),
'name' => __('Newlines'),
'desc' => __('Replace bad and repetitive and empty newline by single newline in files'),
'priority' => 840,
'config' => true,
@ -68,20 +72,20 @@ class ImproveActionNewline extends ImproveAction
public function isConfigured(): bool
{
return !empty($this->getPreference('extensions'));
return !empty($this->getSetting('extensions'));
}
public function configure($url): ?string
{
if (!empty($_POST['save']) && !empty($_POST['newline_extensions'])) {
$this->setPreferences(
$this->setSettings(
'extensions',
Improve::cleanExtensions($_POST['newline_extensions'])
);
$this->redirect($url);
}
$ext = $this->getPreference('extensions');
$ext = $this->getSetting('extensions');
if (!is_array($ext)) {
$ext = [];
}
@ -95,13 +99,13 @@ class ImproveActionNewline extends ImproveAction
'</p>';
}
public function readFile($path, $extension, &$content): ?bool
public function readFile(&$content): ?bool
{
$ext = $this->getPreference('extensions');
if (!is_array($ext) || !in_array($extension, $ext)) {
$ext = $this->getSetting('extensions');
if (!is_array($ext) || !in_array($this->path_extension, $ext)) {
return null;
}
$content = preg_replace(
$clean = preg_replace(
'/(\n\s+\n)/',
"\n\n",
preg_replace(
@ -111,7 +115,13 @@ class ImproveActionNewline extends ImproveAction
["\r\n", "\r"],
"\n",
$content
)));
)
)
);
if ($content != $clean) {
$this->setSuccess(__('Replace bad new lines'));
$content = $clean;
}
return true;
}
@ -125,7 +135,7 @@ class ImproveActionEndoffile extends ImproveAction
{
$this->setProperties([
'id' => 'endoffile',
'name' => __('Fix end of file'),
'name' => __('End of files'),
'desc' => __('Remove php tag and empty lines from end of files'),
'priority' => 860,
'config' => true,
@ -143,29 +153,33 @@ class ImproveActionEndoffile extends ImproveAction
public function configure($url): ?string
{
if (!empty($_POST['save'])) {
$this->setPreferences('psr2', !empty($_POST['endoffile_psr2']));
$this->setSettings('psr2', !empty($_POST['endoffile_psr2']));
$this->redirect($url);
}
return
'<p><label class="classic" for="endoffile_psr2">' .
form::checkbox('endoffile_psr2', 255, $this->getPreference('psr2')) .
form::checkbox('endoffile_psr2', 255, $this->getSetting('psr2')) .
__('Add a blank line to the end of file') .
'</label></p><p class="form-note">' .
__('PSR2 must have a blank line, whereas PSR12 must not.') .
'</p>';
}
public function readFile($path, $extension, &$content): ?bool
public function readFile(&$content): ?bool
{
if (!in_array($extension, ['php', 'md'])) {
if (!in_array($this->path_extension, ['php', 'md'])) {
return null;
}
$content = preg_replace(
$clean = preg_replace(
['/(\s*)(\?>\s*)$/', '/\n+$/'],
'',
$content
) . ($this->getPreference('psr2') ? "\n" : '');
) . ($this->getSetting('psr2') ? "\n" : '');
if ($content != $clean) {
$this->setSuccess(__('Replace end of file'));
$content = $clean;
}
return true;
}

View File

@ -44,7 +44,7 @@ class ImproveActionPhpheader extends ImproveAction
{
$this->setProperties([
'id' => 'phpheader',
'name' => __('Fix PHP header'),
'name' => __('PHP header'),
'desc' => __('Add or remove phpdoc header bloc from php file'),
'priority' => 340,
'config' => true,
@ -64,13 +64,13 @@ class ImproveActionPhpheader extends ImproveAction
public function isConfigured(): bool
{
return !empty($this->getPreference('bloc_action')) || !empty($this->getPreference('remove_old'));
return !empty($this->getSetting('bloc_action')) || !empty($this->getSetting('remove_old'));
}
public function configure($url): ?string
{
if (!empty($_POST['save'])) {
$this->setPreferences([
$this->setSettings([
'bloc_action' => !empty($_POST['bloc_action']) ? $_POST['bloc_action'] : '',
'bloc_content' => !empty($_POST['bloc_content']) ? $_POST['bloc_content'] : '',
'remove_old' => !empty($_POST['remove_old']),
@ -81,22 +81,22 @@ class ImproveActionPhpheader extends ImproveAction
return '
<p><label for="bloc_action">' . __('Action:') . '</label>' .
form::combo('bloc_action', $this->action_bloc, $this->getPreference('bloc_action')) . '
form::combo('bloc_action', $this->action_bloc, $this->getSetting('bloc_action')) . '
</p>
<p><label class="classic" for="remove_old">' .
form::checkbox('remove_old', 1, $this->getPreference('remove_old')) . ' ' .
form::checkbox('remove_old', 1, $this->getSetting('remove_old')) . ' ' .
__('Remove old style bloc header (using #)') .
'</label></p>
<p><label class="classic" for="exclude_locales">' .
form::checkbox('exclude_locales', 1, $this->getPreference('exclude_locales')) . ' ' .
form::checkbox('exclude_locales', 1, $this->getSetting('exclude_locales')) . ' ' .
__('Do not add bloc to files from "locales" and "libs" folder') .
'</label></p>
<p>' . __('Bloc content:') . '</p>
<p class="area">' .
form::textarea('bloc_content', 50, 10, html::escapeHTML($this->getPreference('bloc_content'))) . '
form::textarea('bloc_content', 50, 10, html::escapeHTML($this->getSetting('bloc_content'))) . '
</p><p class="form-note">' .
sprintf(
__('You can use wildcards %s') ,
@ -105,49 +105,51 @@ class ImproveActionPhpheader extends ImproveAction
'<div class="fieldset box"><h4>' . __('Exemple') .'</h4><pre class="code">' . self::$exemple . '</pre></div>';
}
public function openModule(string $module_type, array $module_info): ?bool
public function openModule(): ?bool
{
$this->type = $module_type;
$this->module = $module_info;
$this->replaceInfo();
return null;
}
public function openDirectory(string $path): ?bool
public function openDirectory(): ?bool
{
$skipped = $this->stop_scan;
$this->stop_scan = false;
if (!empty($this->getPreference('exclude_locales')) && preg_match('/\/(locales|libs)(\/.*?|)$/', $path)) {
if (!empty($this->getSetting('exclude_locales')) && preg_match('/\/(locales|libs)(\/.*?|)$/', $this->path_full)) {
if (!$skipped) {
$this->setWarning(__('Skip directory'));
}
$this->stop_scan = true;
}
return null;
}
public function readFile($path, $extension, &$content): ?bool
public function readFile(&$content): ?bool
{
if ($this->stop_scan || $extension !='php' || self::hasNotice()) {
if ($this->stop_scan || $this->path_extension !='php' || $this->hasError()) {
return null;
}
if (!empty($this->getPreference('remove_old'))) {
if (!empty($this->getSetting('remove_old'))) {
$content = $this->deleteOldBloc($content);
}
if (empty($this->getPreference('bloc_action'))) {
if (empty($this->getSetting('bloc_action'))) {
return null;
}
$clean = $this->deleteDocBloc($content);
if ($this->getPreference('bloc_action') == 'remove') {
if ($this->getSetting('bloc_action') == 'remove') {
$content = $clean;
return null;
}
if ($content != $clean && $this->getPreference('bloc_action') == 'create') {
if ($content != $clean && $this->getSetting('bloc_action') == 'create') {
return null;
}
if ($content == $clean && $this->getPreference('bloc_action') == 'replace') {
if ($content == $clean && $this->getSetting('bloc_action') == 'replace') {
return null;
}
@ -159,7 +161,7 @@ class ImproveActionPhpheader extends ImproveAction
private function replaceInfo()
{
$bloc = trim($this->getPreference('bloc_content'));
$bloc = trim($this->getSetting('bloc_content'));
if (empty($bloc)) {
self::notice(__('bloc is empty'), false);
@ -190,8 +192,9 @@ class ImproveActionPhpheader extends ImproveAction
$bloc
)
);
$this->setSuccess(__('Prepare header info'));
} catch (Exception $e) {
self::notice(__('failed to parse bloc'));
$this->setError(__('Failed to parse bloc'));
return null;
}
@ -199,29 +202,46 @@ class ImproveActionPhpheader extends ImproveAction
private function writeDocBloc($content)
{
return preg_replace(
$res = preg_replace(
'/^(\<\?php[\n|\r\n]+)/',
'<?php' . "\n/**\n * " . str_replace("\n", "\n * ", trim($this->bloc)) . "\n */\n\n",
$content,
1
1,
$count
);
if ($count) {
$this->setSuccess(__('Write new doc bloc content'));
}
return $res;
}
private function deleteDocBloc($content)
{
return preg_replace(
$res = preg_replace(
'/^(\<\?php\s*[\n|\r\n]{0,1}\s*\/\*\*.*?\s*\*\/\s*[\n|\r\n]+)/msi',
"<?php\n",
$content
$content,
-1,
$count
);
if ($count) {
$this->setSuccess(__('Delete old doc bloc content'));
}
return $res;
}
private function deleteOldBloc($content)
{
return preg_replace(
$res = preg_replace(
'/((# -- BEGIN LICENSE BLOCK ([-]+))(.*?)(# -- END LICENSE BLOCK ([-]+))([\n|\r\n]{1,}))/msi',
"",
$content
$content,
-1,
$count
);
if ($count) {
$this->setSuccess(__('Delete old style bloc content'));
}
return $res;
}
}

View File

@ -51,13 +51,13 @@ class ImproveActionZip extends ImproveAction
public function isConfigured(): bool
{
return !empty($this->getPreference('pack_repository')) && !empty($this->getPreference('pack_filename'));
return !empty($this->getSetting('pack_repository')) && !empty($this->getSetting('pack_filename'));
}
public function configure($url): ?string
{
if (!empty($_POST['save'])) {
$this->setPreferences([
$this->setSettings([
'pack_repository' => !empty($_POST['pack_repository']) ? $_POST['pack_repository'] : '',
'pack_filename' => !empty($_POST['pack_filename']) ? $_POST['pack_filename'] : '',
'secondpack_filename' => !empty($_POST['secondpack_filename']) ? $_POST['secondpack_filename'] : '',
@ -73,7 +73,7 @@ class ImproveActionZip extends ImproveAction
<h4>' . __('Root') . '</h4>
<p><label for="pack_repository">' . __('Path to repository:') . ' ' .
form::field('pack_repository', 65, 255, $this->getPreference('pack_repository'), 'maximal') .
form::field('pack_repository', 65, 255, $this->getSetting('pack_repository'), 'maximal') .
'</label></p>' .
'<p class="form-note">' . sprintf(__('Preconization: %s'), $this->core->blog->public_path ?
path::real($this->core->blog->public_path) : __("Blog's public directory")
@ -84,17 +84,17 @@ class ImproveActionZip extends ImproveAction
<h4>' . __('Files') . '</h4>
<p><label for="pack_filename">' . __('Name of exported package:') . ' ' .
form::field('pack_filename', 65, 255, $this->getPreference('pack_filename'), 'maximal') .
'</label></p>
<p class="form-note">' . sprintf(__('Preconization: %s'), '%type%-%id%-%version%') . '</p>
<p><label for="secondpack_filename">' . __('Name of second exported package:') . ' ' .
form::field('secondpack_filename', 65, 255, $this->getPreference('secondpack_filename'), 'maximal') .
form::field('pack_filename', 65, 255, $this->getSetting('pack_filename'), 'maximal') .
'</label></p>
<p class="form-note">' . sprintf(__('Preconization: %s'), '%type%-%id%') . '</p>
<p><label for="secondpack_filename">' . __('Name of second exported package:') . ' ' .
form::field('secondpack_filename', 65, 255, $this->getSetting('secondpack_filename'), 'maximal') .
'</label></p>
<p class="form-note">' . sprintf(__('Preconization: %s'), '%type%-%id%-%version%') . '</p>
<p><label class="classic" for="pack_overwrite">'.
form::checkbox('pack_overwrite', 1, !empty($this->getPreference('pack_overwrite'))) . ' ' .
form::checkbox('pack_overwrite', 1, !empty($this->getSetting('pack_overwrite'))) . ' ' .
__('Overwrite existing package') . '</label></p>
</div>
@ -103,32 +103,34 @@ class ImproveActionZip extends ImproveAction
<h4>' . __('Content') . '</h4>
<p><label for="pack_excludefiles">' . __('Extra files to exclude from package:') . ' ' .
form::field('pack_excludefiles', 65, 255, $this->getPreference('pack_excludefiles'), 'maximal') .
form::field('pack_excludefiles', 65, 255, $this->getSetting('pack_excludefiles'), 'maximal') .
'</label></p>
<p class="form-note">' . sprintf(__('Preconization: %s'), '*.zip,*.tar,*.tar.gz') . '<br />' .
sprintf(__('By default all these files are always removed from packages : %s'), implode(', ', self::$exclude)) . '</p>
<p><label class="classic" for="pack_nocomment">' .
form::checkbox('pack_nocomment', 1, $this->getPreference('pack_nocomment')) . ' ' .
form::checkbox('pack_nocomment', 1, $this->getSetting('pack_nocomment')) . ' ' .
__('Remove comments from files') . '</label></p>
</div>';
}
public function closeModule(string $module_type, array $module_info): ?bool
public function closeModule(): ?bool
{
$exclude = array_merge(
self::$exclude,
explode(',', $this->getPreference('pack_excludefiles'))
explode(',', $this->getSetting('pack_excludefiles'))
);
if (!empty($this->getPreference('pack_nocomment'))) {
$this->setSuccess(sprintf(__('Prepare excluded files "%s"'), implode(', ', $exclude)));
if (!empty($this->getSetting('pack_nocomment'))) {
ImproveZipFileZip::$remove_comment = true;
$this->setSuccess(__('Prepare comment removal'));
}
if (!empty($this->getPreference('pack_filename'))) {
$this->zipModule($this->getPreference('pack_filename'), $exclude);
if (!empty($this->getSetting('pack_filename'))) {
$this->zipModule($this->getSetting('pack_filename'), $exclude);
}
if (!empty($this->getPreference('secondpack_filename'))) {
$this->zipModule($this->getPreference('secondpack_filename'), $exclude);
if (!empty($this->getSetting('secondpack_filename'))) {
$this->zipModule($this->getSetting('secondpack_filename'), $exclude);
}
return null;
}
@ -150,14 +152,16 @@ class ImproveActionZip extends ImproveAction
foreach($parts as $i => $part) {
$parts[$i] = files::tidyFileName($part);
}
$path = $this->getPreference('pack_repository') . '/' . implode('/', $parts) . '.zip';
if (file_exists($path) && empty($this->getPreference('pack_overwrite'))) {
self::notice(__('Destination filename already exists'), false);
$path = $this->getSetting('pack_repository') . '/' . implode('/', $parts) . '.zip';
if (file_exists($path) && empty($this->getSetting('pack_overwrite'))) {
$this->setWarning(__('Destination filename already exists'));
return null;
}
if (!is_dir(dirname($path)) || !is_writable(dirname($path))) {
self::notice(__('Destination path is not writable'));
$this->setError(__('Destination path is not writable'));
return null;
}
@set_time_limit(300);
$fp = fopen($path, 'wb');
@ -179,6 +183,8 @@ class ImproveActionZip extends ImproveAction
$zip->close();
unset($zip);
$this->setSuccess(sprintf(__('Zip module into "%s"'), $path));
return null;
}
}

View File

@ -72,24 +72,27 @@ if (!empty($_POST['fix'])) {
dcPage::addWarningNotice(__('No module selected'));
} else {
try {
$time_start = microtime(true);
$improve->fix(
$time = $improve->fixModule(
$type,
$module,
$type == 'plugin' ? $core->plugins->getModules($module) : $core->themes->getModules($module),
$_POST['actions']
);
$time_end = microtime(true);
$log_id = $improve->writeLogs();
$core->blog->triggerBlog();
dcPage::addSuccessNotice(sprintf(
__('Fix of %s complete in %s secondes'),
$module,
substr($time_end - $time_start, 0, 5)
));
if ($improve->hasLog('error')) {
$notice = ['type' => 'error', 'msg' => __('Fix of "%s" complete in %s secondes with errors')];
} elseif ($improve->hasLog('warning')) {
$notice = ['type' => 'warning', 'msg' => __('Fix of "%s" complete in %s secondes with warnings')];
} elseif ($improve->hasLog('success')) {
$notice = ['type' => 'success', 'msg' => __('Fix of "%s" complete in %s secondes')];
} else {
$notice = ['type' => 'success', 'msg' => __('Fix of "%s" complete in %s secondes without messages')];
}
dcPage::addNotice($notice['type'], sprintf($notice['msg'], $module, $time));
http::redirect($improve->getURL(['type' => $type]));
$core->adminurl->redirect('admin.plugin.improve', ['type' => $type, 'upd' => $log_id]);
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
@ -100,14 +103,14 @@ $breadcrumb = [];
if (!empty($_REQUEST['config'])) {
$breadcrumb = [
($type == 'plugin' ? __('Plugins') : __('Themes')) =>
$improve->getURL(['type' => ($type == 'plugin' ? 'plugin' : 'theme')]),
$core->adminurl->get('admin.plugin.improve', ['type' => ($type == 'plugin' ? 'plugin' : 'theme')]),
'<span class="page-title">' . __('Configure module') . '</span>' => ''
];
} else {
$breadcrumb = [
'<span class="page-title">' . ($type == 'plugin' ? __('Plugins') : __('Themes')) . '</span>' => '',
($type == 'theme' ? __('Plugins') : __('Themes')) =>
$improve->getURL(['type' => ($type == 'theme' ? 'plugin' : 'theme')])
$core->adminurl->get('admin.plugin.improve', ['type' => ($type == 'theme' ? 'plugin' : 'theme')])
];
}
@ -117,17 +120,17 @@ dcPage::breadcrumb(array_merge([__('improve') => ''], $breadcrumb),['hl' => fals
dcPage::notices();
if (!empty($_REQUEST['config'])) {
$back_url = $_REQUEST['redir'] ?? $improve->getURL(['type' => $type]);
$back_url = $_REQUEST['redir'] ?? $core->adminurl->get('admin.plugin.improve', ['type' => $type]);
if (null !== ($action = $improve->module($_REQUEST['config']))) {
$redir = $_REQUEST['redir'] ?? $improve->getURL(['type' => $type, 'config' => $action->id]);
$redir = $_REQUEST['redir'] ?? $core->adminurl->get('admin.plugin.improve', ['type' => $type, 'config' => $action->id]);
$res = $action->configure($redir);
echo '
<h3>' . sprintf(__('Configure module "%s"'), $action->name) . '</h3>
<p><a class="back" href="' . $back_url . '">' . __('Back') . '</a></p>
<p>' . html::escapeHTML($action->desc) . '</p>
<form action="' . $improve->getURL() . '" method="post" id="form-actions">' .
<form action="' . $core->adminurl->get('admin.plugin.improve') . '" method="post" id="form-actions">' .
(empty($res) ? '<p class="message">' . __('Nothing to configure'). '</p>' : $res) . '
<p class="clear"><input type="submit" name="save" value="' . __('Save') . '" />' .
form::hidden('type', $type) .
@ -148,7 +151,7 @@ if (!empty($_REQUEST['config'])) {
if (count($combo_modules) == 1) {
echo '<p class="message">' . __('No module to manage') . '</p>';
} else {
echo '<form action="' . $improve->getURL() . '" method="post" id="form-actions">';
echo '<form action="' . $core->adminurl->get('admin.plugin.improve') . '" method="post" id="form-actions">';
foreach($improve->modules() as $action) {
if (!in_array($type, $action->types)) {
continue;
@ -170,7 +173,7 @@ if (!empty($_REQUEST['config'])) {
if (false !== $action->config) {
echo
' - <a class="module-config" href="' .
(true === $action->config ? $improve->getURL(['type' => $type, 'config' => $action->id]) : $action->config) .
(true === $action->config ? $core->adminurl->get('admin.plugin.improve', ['type' => $type, 'config' => $action->id]) : $action->config) .
'" title="' . sprintf(__("Configure action '%s'"), $action->name) . '">' . __('Configure module') . '</a>';
}
echo '</p>';
@ -192,6 +195,32 @@ if (!empty($_REQUEST['config'])) {
</div>
<br class="clear" />
</form>';
$logs = $lines = [];
if (!empty($_REQUEST['upd'])) {
$logs = $improve->parseLogs($_REQUEST['upd']);
if (!empty($logs)) {
echo '<div class="fieldset"><h4>' . __('Details') . '</h4>';
foreach($logs as $path => $types) {
echo '<h5>' . $path .'</h5>';
foreach($types as $type => $tools) {
echo '<div class="' . $type . '"><ul>';
foreach($tools as $tool => $msgs) {
echo '<li>' . $improve->module($tool)->name . '<ul>';
foreach($msgs as $msg) {
echo '<li>' . $msg . '</li>';
}
echo '</ul></li>';
}
echo '</ul></div>';
}
echo '';
}
echo '</div>';
}
}
}
}

View File

@ -1,17 +1,25 @@
<?php
// Language: Français
// Module: improve - 0.1.1
// Date: 2021-09-12 21:00:21
// Date: 2021-09-14 23:23:55
// Translated with dcTranslater - 2021.09.02.1
#inc/class.improve.php:77
#inc/class.improve.php:142
#inc/class.improve.php:145
$GLOBALS['__l10n']['Begin'] = 'Début';
#inc/class.improve.php:150
$GLOBALS['__l10n']['Module path is not writable'] = 'Le chemin du module n\'est pas accessible en écriture';
#inc/class.improve.php:105
#inc/class.improve.php:181
$GLOBALS['__l10n']['File content has been removed: %s by %s'] = 'Le contenu du fichier a été supprimé : %s par %s';
#inc/class.improve.php:196
#inc/class.improve.php:198
$GLOBALS['__l10n']['End'] = 'Fin';
#inc/lib.improve.action.dcstore.php:20
$GLOBALS['__l10n']['Fix dcstore.xml'] = 'Fixer dcstore.xml';
$GLOBALS['__l10n']['Store file'] = 'Fichier de dépôt';
#inc/lib.improve.action.dcstore.php:21
$GLOBALS['__l10n']['Re-create dcstore.xml file according to _define.php variables'] = 'Re-créer le fichier dcstore.xml suivant les variables du fichier _define.php';
@ -32,41 +40,44 @@ $GLOBALS['__l10n']['For exemple on github https://github.com/MyGitName/%id%/rele
#inc/lib.improve.action.dcstore.php:53
$GLOBALS['__l10n']['Note on github, you must create a release and join to it the module zip file.'] = 'Note sur Github, vous devez créer un release et y joindre le fichier zip du module.';
#inc/lib.improve.action.dcstore.php:70
#inc/lib.improve.action.dcstore.php:65
$GLOBALS['__l10n']['Write dcstore.xml file.'] = 'Ecrire le fichier dcstore.xml';
#inc/lib.improve.action.dcstore.php:67
$GLOBALS['__l10n']['Failed to write dcstore.xml file'] = 'Impossible d\'écrire le fichier dcstore.xml';
#inc/lib.improve.action.dcstore.php:88
#inc/lib.improve.action.dcstore.php:81
$GLOBALS['__l10n']['unkow module id'] = 'Id du module inconu';
#inc/lib.improve.action.dcstore.php:94
#inc/lib.improve.action.dcstore.php:87
$GLOBALS['__l10n']['unknow module name'] = 'nom du module inconnu';
#inc/lib.improve.action.dcstore.php:100
#inc/lib.improve.action.dcstore.php:93
$GLOBALS['__l10n']['unknow module version'] = 'version du module inconnue';
#inc/lib.improve.action.dcstore.php:106
#inc/lib.improve.action.dcstore.php:99
$GLOBALS['__l10n']['unknow module author'] = 'auteur du module inconnu';
#inc/lib.improve.action.dcstore.php:113
#inc/lib.improve.action.dcstore.php:106
$GLOBALS['__l10n']['unknow module description'] = 'description du module inconnue';
#inc/lib.improve.action.dcstore.php:119
#inc/lib.improve.action.dcstore.php:112
$GLOBALS['__l10n']['no repository set in _define.php'] = 'Aucun dépôt défini dans le fichier _define.php';
#inc/lib.improve.action.dcstore.php:125
#inc/lib.improve.action.dcstore.php:118
$GLOBALS['__l10n']['no zip file pattern set in configuration'] = 'Pas de modèle de fichier zip présent dans la configuration';
#inc/lib.improve.action.dcstore.php:142
#inc/lib.improve.action.dcstore.php:135
$GLOBALS['__l10n']['no minimum dotclear version'] = 'pas de version minimum de Dotclear';
#inc/lib.improve.action.dcstore.php:149
#inc/lib.improve.action.dcstore.php:142
$GLOBALS['__l10n']['no details URL'] = 'Lien de détail non défini';
#inc/lib.improve.action.dcstore.php:162
#inc/lib.improve.action.dcstore.php:155
$GLOBALS['__l10n']['no support URL'] = 'Lien de support non défini';
#inc/lib.improve.action.gitshields.php:34
$GLOBALS['__l10n']['Fix shields badges'] = 'Fixer les badges shields.io';
$GLOBALS['__l10n']['Shields badges'] = 'Badges Shields.io';
#inc/lib.improve.action.gitshields.php:35
$GLOBALS['__l10n']['Add and maintain shields.io badges to the REDAME.md file'] = 'Ajoute et maintient à jour les badges shields.io du fichier README.md';
@ -86,8 +97,17 @@ $GLOBALS['__l10n']['Include Dotaddict badge'] = 'Inclure le badge Dotaddict';
#inc/lib.improve.action.gitshields.php:68
$GLOBALS['__l10n']['If your plugin or theme is on Dotaddict, you can add a badge to link to its details in Dotaddict.'] = 'Si votre plugin ou theme est sur Dotaddict, vous pouvez ajouter un badge lier à ses détails sur DA.';
#inc/lib.improve.action.gitshields.php:117
$GLOBALS['__l10n']['Prepare custom shield info'] = 'préparer les informations personnalisées';
#inc/lib.improve.action.gitshields.php:147
$GLOBALS['__l10n']['Write new shield bloc'] = 'Ecrire le nouveau bloc Shield';
#inc/lib.improve.action.gitshields.php:162
$GLOBALS['__l10n']['Delete old shield bloc'] = 'Effacer l\'ancine bloc Shield';
#inc/lib.improve.action.licensefile.php:29
$GLOBALS['__l10n']['Fix license file'] = 'Fixer le fichier de licence';
$GLOBALS['__l10n']['License file'] = 'Fichier de licence';
#inc/lib.improve.action.licensefile.php:30
$GLOBALS['__l10n']['Add or remove full license file to module root'] = 'Ajoute ou supprime le fichier de licence';
@ -117,53 +137,68 @@ $GLOBALS['__l10n']['License version:'] = 'Version de la licence :';
#inc/lib.improve.action.licensefile.php:72
$GLOBALS['__l10n']['Action on file:'] = 'Action sur le fichier :';
#inc/lib.improve.action.licensefile.php:87
$GLOBALS['__l10n']['no full license type selected'] = 'Aucun type de licence sélectionné';
#inc/lib.improve.action.licensefile.php:84
$GLOBALS['__l10n']['No full license type selected'] = 'Pas de type de licence seletionné';
#inc/lib.improve.action.licensefile.php:100
$GLOBALS['__l10n']['failed to load full license'] = 'Impossible de charger le fichier de licence';
#inc/lib.improve.action.licensefile.php:97
$GLOBALS['__l10n']['Failed to load license content'] = 'Impossible de charger le contenu de la licence';
#inc/lib.improve.action.licensefile.php:106
$GLOBALS['__l10n']['failed to write full license'] = 'Impossible d\'écrire le fichier de license';
#inc/lib.improve.action.licensefile.php:102
$GLOBALS['__l10n']['Write new license file "LICENSE"'] = 'Écrire le nouveau fichier "LICENSE" de licence';
#inc/lib.improve.action.licensefile.php:104
$GLOBALS['__l10n']['Failed to write new license file'] = 'Impossible d\'écrire le nouveau fichier de licence';
#inc/lib.improve.action.licensefile.php:118
$GLOBALS['__l10n']['Old license file is not deletable (%s)'] = 'L\'ancien fichier de licence n\'est pas supprimable (%s)';
#inc/lib.improve.action.licensefile.php:120
$GLOBALS['__l10n']['full license is not deletable (%s)'] = 'Le fichier de licence n\'est pas supprimable (%s)';
$GLOBALS['__l10n']['Failed to delete old license file (%s)'] = 'Impossible de supprimer l\'ancien fichier de licence (%s)';
#inc/lib.improve.action.licensefile.php:123
$GLOBALS['__l10n']['failed to delete full license (%s)'] = 'Impossible de supprimer le fichier de licence (%s)';
#inc/lib.improve.action.licensefile.php:122
$GLOBALS['__l10n']['Delete old license file "%s"'] = 'Effacer l\'ancien fichier de Licence "%s"';
#inc/lib.improve.action.php:20
$GLOBALS['__l10n']['Fix tabulation'] = 'Fixer les tabulations';
$GLOBALS['__l10n']['Tabulations'] = 'Tabulations';
#inc/lib.improve.action.php:21
$GLOBALS['__l10n']['Replace tabulation by four space in php files'] = 'Remplace les tabulation par quatre espaces dans les fichiers php';
#inc/lib.improve.action.php:53
$GLOBALS['__l10n']['Fix newline'] = 'Fixer les retours à la ligne';
#inc/lib.improve.action.php:36
$GLOBALS['__l10n']['Replace tabulation by spaces'] = 'Remplacer les tabulations';
#inc/lib.improve.action.php:54
#inc/lib.improve.action.php:57
$GLOBALS['__l10n']['Newlines'] = 'Retour à la ligne';
#inc/lib.improve.action.php:58
$GLOBALS['__l10n']['Replace bad and repetitive and empty newline by single newline in files'] = 'Remplace les mauvais ou répétitifs retour à la ligne par une seule nouvelle ligne';
#inc/lib.improve.action.php:91
#inc/lib.improve.action.php:95
$GLOBALS['__l10n']['List of files extension to work on:'] = 'Liste des extensions de fichier à corriger:';
#inc/lib.improve.action.php:94
#inc/lib.improve.action.php:98
$GLOBALS['__l10n']['Use comma separated list of extensions without dot, recommand "php,js,xml,txt,md".'] = 'Utiliser une liste d\'extensions séparé par des virgules et sans le point, recommandation: "php,js,xml,txt,md".';
#inc/lib.improve.action.php:128
$GLOBALS['__l10n']['Fix end of file'] = 'Fixer les fins de fichiers';
#inc/lib.improve.action.php:122
$GLOBALS['__l10n']['Replace bad new lines'] = 'Remplacer les retours à la ligne';
#inc/lib.improve.action.php:129
$GLOBALS['__l10n']['Remove php tag and empty lines from end of files'] = 'Supprimer le tag PHP et els lignes vides de fin de fichiers';
#inc/lib.improve.action.php:138
$GLOBALS['__l10n']['End of files'] = 'Fin de fichiers';
#inc/lib.improve.action.php:153
#inc/lib.improve.action.php:139
$GLOBALS['__l10n']['Remove php tag and empty lines from end of files'] = 'Supprimer le tag PHP et les lignes vides de fin de fichiers';
#inc/lib.improve.action.php:163
$GLOBALS['__l10n']['Add a blank line to the end of file'] = 'Ajouter une ligne vide en fin de fichier';
#inc/lib.improve.action.php:155
#inc/lib.improve.action.php:165
$GLOBALS['__l10n']['PSR2 must have a blank line, whereas PSR12 must not.'] = 'PSR2 doit avoir une ligne vide, alors que PSR12 non.';
#inc/lib.improve.action.php:180
$GLOBALS['__l10n']['Replace end of file'] = 'Remplacer les fins de fichiers';
#inc/lib.improve.action.phpheader.php:47
$GLOBALS['__l10n']['Fix PHP header'] = 'Fixer les enêtes php';
$GLOBALS['__l10n']['PHP header'] = 'Entête de fichier PHP';
#inc/lib.improve.action.phpheader.php:48
$GLOBALS['__l10n']['Add or remove phpdoc header bloc from php file'] = 'Ajouter ou supprimer les bloc d\'entête phpdoc des fichiers php';
@ -195,11 +230,26 @@ $GLOBALS['__l10n']['Bloc content:'] = 'Contenu du bloc :';
#inc/lib.improve.action.phpheader.php:104
$GLOBALS['__l10n']['Do not put structural elements to the begining of lines.'] = 'Ne pas mettre d\'élément de structure en début de ligne';
#inc/lib.improve.action.phpheader.php:165
#inc/lib.improve.action.phpheader.php:121
$GLOBALS['__l10n']['Skip directory'] = 'Ignorer le répertoire';
#inc/lib.improve.action.phpheader.php:167
$GLOBALS['__l10n']['bloc is empty'] = 'le bloc est vide';
#inc/lib.improve.action.phpheader.php:194
$GLOBALS['__l10n']['failed to parse bloc'] = 'impossible de traiter le bloc';
#inc/lib.improve.action.phpheader.php:195
$GLOBALS['__l10n']['Prepare header info'] = 'Préparer les informations d\'entête';
#inc/lib.improve.action.phpheader.php:197
$GLOBALS['__l10n']['Failed to parse bloc'] = 'Impossible de préparer le bloc';
#inc/lib.improve.action.phpheader.php:213
$GLOBALS['__l10n']['Write new doc bloc content'] = 'Ecrire le nouveau contenu de bloc';
#inc/lib.improve.action.phpheader.php:228
$GLOBALS['__l10n']['Delete old doc bloc content'] = 'Effacer l\'ancien contenu de type phpdoc';
#inc/lib.improve.action.phpheader.php:243
$GLOBALS['__l10n']['Delete old style bloc content'] = 'Effacer l\'ancien contenu de type ancien';
#inc/lib.improve.action.zip.php:42
$GLOBALS['__l10n']['Zip module'] = 'Zipper le module';
@ -243,12 +293,21 @@ $GLOBALS['__l10n']['By default all these files are always removed from packages
#inc/lib.improve.action.zip.php:113
$GLOBALS['__l10n']['Remove comments from files'] = 'Retirer les commentaires des fichiers';
#inc/lib.improve.action.zip.php:155
#inc/lib.improve.action.zip.php:124
$GLOBALS['__l10n']['Prepare excluded files "%s"'] = 'Préparer les fichiers à exclure "%s"';
#inc/lib.improve.action.zip.php:127
$GLOBALS['__l10n']['Prepare comment removal'] = 'Préparer le retrait des commentaires';
#inc/lib.improve.action.zip.php:157
$GLOBALS['__l10n']['Destination filename already exists'] = 'Le fichier de destination existe déjà';
#inc/lib.improve.action.zip.php:160
#inc/lib.improve.action.zip.php:162
$GLOBALS['__l10n']['Destination path is not writable'] = 'Le répertoire de destination n\'est pas accessible en écriture';
#inc/lib.improve.action.zip.php:186
$GLOBALS['__l10n']['Zip module into "%s"'] = 'Zipper le module vers "%s"';
#index.php:54
$GLOBALS['__l10n']['Select a module'] = 'Sélectionner un module';
@ -258,40 +317,48 @@ $GLOBALS['__l10n']['No action selected'] = 'Aucune action sélectionné';
#index.php:72
$GLOBALS['__l10n']['No module selected'] = 'Aucun module sélectionné';
#index.php:87
$GLOBALS['__l10n']['Fix of %s complete in %s secondes'] = 'Correction de %s complété en %s secondes';
#index.php:85
$GLOBALS['__l10n']['Fix of "%s" complete in %s secondes with errors'] = 'Fixe de "%s" complété en %s secondes avec des erreurs';
#index.php:102
#index.php:108
#index.php:109
#index.php:146
#index.php:87
$GLOBALS['__l10n']['Fix of "%s" complete in %s secondes with warnings'] = 'Fixe de "%s" complété en %s secondes avec des avertissements';
#index.php:89
$GLOBALS['__l10n']['Fix of "%s" complete in %s secondes'] = 'Fixe de "%s" complété en %s secondes';
#index.php:91
$GLOBALS['__l10n']['Fix of "%s" complete in %s secondes without messages'] = 'Fixe de "%s" complété en %s secondes sans message';
#index.php:105
#index.php:111
#index.php:112
#index.php:149
$GLOBALS['__l10n']['Themes'] = 'Thèmes';
#index.php:104
#index.php:174
#index.php:107
#index.php:177
$GLOBALS['__l10n']['Configure module'] = 'Configurer le module';
#index.php:127
#index.php:130
$GLOBALS['__l10n']['Configure module "%s"'] = 'Configurer le module "%s"';
#index.php:131
#index.php:134
$GLOBALS['__l10n']['Nothing to configure'] = 'Rien à configurer';
#index.php:140
#index.php:143
$GLOBALS['__l10n']['Unknow module'] = 'Module inconnu';
#index.php:149
#index.php:152
$GLOBALS['__l10n']['No module to manage'] = 'Aucun module à gérer';
#index.php:174
#index.php:177
$GLOBALS['__l10n']['Configure action \'%s\''] = 'Configurer l\'action "%s"';
#index.php:184
#index.php:187
$GLOBALS['__l10n']['Save fields selection as preference'] = 'Enregistrer la sélection comme préférence';
#index.php:185
#index.php:188
$GLOBALS['__l10n']['Select a module:'] = 'Sélectionner un module :';
#index.php:188
$GLOBALS['__l10n']['Fix it'] = 'Corriger';
#index.php:191
$GLOBALS['__l10n']['Fix it'] = 'Corriger';

View File

@ -1,6 +1,6 @@
# Language: Français
# Module: improve - 0.1.1
# Date: 2021-09-12 21:00:21
# Date: 2021-09-14 23:23:55
# Translated with translater 2021.09.02.1
msgid ""
@ -8,24 +8,34 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: improve 0.1.1\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2021-09-12T21:00:21+00:00\n"
"PO-Revision-Date: 2021-09-14T23:23:55+00:00\n"
"Last-Translator: Jean-Christian Denis\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: inc/class.improve.php:77
#: inc/class.improve.php:142
#: inc/class.improve.php:145
msgid "Begin"
msgstr "Début"
#: inc/class.improve.php:150
msgid "Module path is not writable"
msgstr "Le chemin du module n'est pas accessible en écriture"
#: inc/class.improve.php:105
#: inc/class.improve.php:181
msgid "File content has been removed: %s by %s"
msgstr "Le contenu du fichier a été supprimé : %s par %s"
#: inc/class.improve.php:196
#: inc/class.improve.php:198
msgid "End"
msgstr "Fin"
#: inc/lib.improve.action.dcstore.php:20
msgid "Fix dcstore.xml"
msgstr "Fixer dcstore.xml"
msgid "Store file"
msgstr "Fichier de dépôt"
#: inc/lib.improve.action.dcstore.php:21
msgid "Re-create dcstore.xml file according to _define.php variables"
@ -52,53 +62,57 @@ msgstr "Par exemple sur github https://github.com/MyGitName/%id%/releases/downlo
msgid "Note on github, you must create a release and join to it the module zip file."
msgstr "Note sur Github, vous devez créer un release et y joindre le fichier zip du module."
#: inc/lib.improve.action.dcstore.php:70
#: inc/lib.improve.action.dcstore.php:65
msgid "Write dcstore.xml file."
msgstr "Ecrire le fichier dcstore.xml"
#: inc/lib.improve.action.dcstore.php:67
msgid "Failed to write dcstore.xml file"
msgstr "Impossible d'écrire le fichier dcstore.xml"
#: inc/lib.improve.action.dcstore.php:88
#: inc/lib.improve.action.dcstore.php:81
msgid "unkow module id"
msgstr "Id du module inconu"
#: inc/lib.improve.action.dcstore.php:94
#: inc/lib.improve.action.dcstore.php:87
msgid "unknow module name"
msgstr "nom du module inconnu"
#: inc/lib.improve.action.dcstore.php:100
#: inc/lib.improve.action.dcstore.php:93
msgid "unknow module version"
msgstr "version du module inconnue"
#: inc/lib.improve.action.dcstore.php:106
#: inc/lib.improve.action.dcstore.php:99
msgid "unknow module author"
msgstr "auteur du module inconnu"
#: inc/lib.improve.action.dcstore.php:113
#: inc/lib.improve.action.dcstore.php:106
msgid "unknow module description"
msgstr "description du module inconnue"
#: inc/lib.improve.action.dcstore.php:119
#: inc/lib.improve.action.dcstore.php:112
msgid "no repository set in _define.php"
msgstr "Aucun dépôt défini dans le fichier _define.php"
#: inc/lib.improve.action.dcstore.php:125
#: inc/lib.improve.action.dcstore.php:118
msgid "no zip file pattern set in configuration"
msgstr "Pas de modèle de fichier zip présent dans la configuration"
#: inc/lib.improve.action.dcstore.php:142
#: inc/lib.improve.action.dcstore.php:135
msgid "no minimum dotclear version"
msgstr "pas de version minimum de Dotclear"
#: inc/lib.improve.action.dcstore.php:149
#: inc/lib.improve.action.dcstore.php:142
msgid "no details URL"
msgstr "Lien de détail non défini"
#: inc/lib.improve.action.dcstore.php:162
#: inc/lib.improve.action.dcstore.php:155
msgid "no support URL"
msgstr "Lien de support non défini"
#: inc/lib.improve.action.gitshields.php:34
msgid "Fix shields badges"
msgstr "Fixer les badges shields.io"
msgid "Shields badges"
msgstr "Badges Shields.io"
#: inc/lib.improve.action.gitshields.php:35
msgid "Add and maintain shields.io badges to the REDAME.md file"
@ -124,9 +138,21 @@ msgstr "Inclure le badge Dotaddict"
msgid "If your plugin or theme is on Dotaddict, you can add a badge to link to its details in Dotaddict."
msgstr "Si votre plugin ou theme est sur Dotaddict, vous pouvez ajouter un badge lier à ses détails sur DA."
#: inc/lib.improve.action.gitshields.php:117
msgid "Prepare custom shield info"
msgstr "préparer les informations personnalisées"
#: inc/lib.improve.action.gitshields.php:147
msgid "Write new shield bloc"
msgstr "Ecrire le nouveau bloc Shield"
#: inc/lib.improve.action.gitshields.php:162
msgid "Delete old shield bloc"
msgstr "Effacer l'ancine bloc Shield"
#: inc/lib.improve.action.licensefile.php:29
msgid "Fix license file"
msgstr "Fixer le fichier de licence"
msgid "License file"
msgstr "Fichier de licence"
#: inc/lib.improve.action.licensefile.php:30
msgid "Add or remove full license file to module root"
@ -165,69 +191,89 @@ msgstr "Version de la licence :"
msgid "Action on file:"
msgstr "Action sur le fichier :"
#: inc/lib.improve.action.licensefile.php:87
msgid "no full license type selected"
msgstr "Aucun type de licence sélectionné"
#: inc/lib.improve.action.licensefile.php:84
msgid "No full license type selected"
msgstr "Pas de type de licence seletionné"
#: inc/lib.improve.action.licensefile.php:100
msgid "failed to load full license"
msgstr "Impossible de charger le fichier de licence"
#: inc/lib.improve.action.licensefile.php:97
msgid "Failed to load license content"
msgstr "Impossible de charger le contenu de la licence"
#: inc/lib.improve.action.licensefile.php:106
msgid "failed to write full license"
msgstr "Impossible d'écrire le fichier de license"
#: inc/lib.improve.action.licensefile.php:102
msgid "Write new license file \"LICENSE\""
msgstr "Écrire le nouveau fichier \"LICENSE\" de licence"
#: inc/lib.improve.action.licensefile.php:104
msgid "Failed to write new license file"
msgstr "Impossible d'écrire le nouveau fichier de licence"
#: inc/lib.improve.action.licensefile.php:118
msgid "Old license file is not deletable (%s)"
msgstr "L'ancien fichier de licence n'est pas supprimable (%s)"
#: inc/lib.improve.action.licensefile.php:120
msgid "full license is not deletable (%s)"
msgstr "Le fichier de licence n'est pas supprimable (%s)"
msgid "Failed to delete old license file (%s)"
msgstr "Impossible de supprimer l'ancien fichier de licence (%s)"
#: inc/lib.improve.action.licensefile.php:123
msgid "failed to delete full license (%s)"
msgstr "Impossible de supprimer le fichier de licence (%s)"
#: inc/lib.improve.action.licensefile.php:122
msgid "Delete old license file \"%s\""
msgstr "Effacer l'ancien fichier de Licence \"%s\""
#: inc/lib.improve.action.php:20
msgid "Fix tabulation"
msgstr "Fixer les tabulations"
msgid "Tabulations"
msgstr "Tabulations"
#: inc/lib.improve.action.php:21
msgid "Replace tabulation by four space in php files"
msgstr "Remplace les tabulation par quatre espaces dans les fichiers php"
#: inc/lib.improve.action.php:53
msgid "Fix newline"
msgstr "Fixer les retours à la ligne"
#: inc/lib.improve.action.php:36
msgid "Replace tabulation by spaces"
msgstr "Remplacer les tabulations"
#: inc/lib.improve.action.php:54
#: inc/lib.improve.action.php:57
msgid "Newlines"
msgstr "Retour à la ligne"
#: inc/lib.improve.action.php:58
msgid "Replace bad and repetitive and empty newline by single newline in files"
msgstr "Remplace les mauvais ou répétitifs retour à la ligne par une seule nouvelle ligne"
#: inc/lib.improve.action.php:91
#: inc/lib.improve.action.php:95
msgid "List of files extension to work on:"
msgstr "Liste des extensions de fichier à corriger:"
#: inc/lib.improve.action.php:94
#: inc/lib.improve.action.php:98
msgid "Use comma separated list of extensions without dot, recommand \"php,js,xml,txt,md\"."
msgstr "Utiliser une liste d'extensions séparé par des virgules et sans le point, recommandation: \"php,js,xml,txt,md\"."
#: inc/lib.improve.action.php:128
msgid "Fix end of file"
msgstr "Fixer les fins de fichiers"
#: inc/lib.improve.action.php:122
msgid "Replace bad new lines"
msgstr "Remplacer les retours à la ligne"
#: inc/lib.improve.action.php:129
#: inc/lib.improve.action.php:138
msgid "End of files"
msgstr "Fin de fichiers"
#: inc/lib.improve.action.php:139
msgid "Remove php tag and empty lines from end of files"
msgstr "Supprimer le tag PHP et els lignes vides de fin de fichiers"
msgstr "Supprimer le tag PHP et les lignes vides de fin de fichiers"
#: inc/lib.improve.action.php:153
#: inc/lib.improve.action.php:163
msgid "Add a blank line to the end of file"
msgstr "Ajouter une ligne vide en fin de fichier"
#: inc/lib.improve.action.php:155
#: inc/lib.improve.action.php:165
msgid "PSR2 must have a blank line, whereas PSR12 must not."
msgstr "PSR2 doit avoir une ligne vide, alors que PSR12 non."
#: inc/lib.improve.action.php:180
msgid "Replace end of file"
msgstr "Remplacer les fins de fichiers"
#: inc/lib.improve.action.phpheader.php:47
msgid "Fix PHP header"
msgstr "Fixer les enêtes php"
msgid "PHP header"
msgstr "Entête de fichier PHP"
#: inc/lib.improve.action.phpheader.php:48
msgid "Add or remove phpdoc header bloc from php file"
@ -269,13 +315,33 @@ msgstr "Contenu du bloc :"
msgid "Do not put structural elements to the begining of lines."
msgstr "Ne pas mettre d'élément de structure en début de ligne"
#: inc/lib.improve.action.phpheader.php:165
#: inc/lib.improve.action.phpheader.php:121
msgid "Skip directory"
msgstr "Ignorer le répertoire"
#: inc/lib.improve.action.phpheader.php:167
msgid "bloc is empty"
msgstr "le bloc est vide"
#: inc/lib.improve.action.phpheader.php:194
msgid "failed to parse bloc"
msgstr "impossible de traiter le bloc"
#: inc/lib.improve.action.phpheader.php:195
msgid "Prepare header info"
msgstr "Préparer les informations d'entête"
#: inc/lib.improve.action.phpheader.php:197
msgid "Failed to parse bloc"
msgstr "Impossible de préparer le bloc"
#: inc/lib.improve.action.phpheader.php:213
msgid "Write new doc bloc content"
msgstr "Ecrire le nouveau contenu de bloc"
#: inc/lib.improve.action.phpheader.php:228
msgid "Delete old doc bloc content"
msgstr "Effacer l'ancien contenu de type phpdoc"
#: inc/lib.improve.action.phpheader.php:243
msgid "Delete old style bloc content"
msgstr "Effacer l'ancien contenu de type ancien"
#: inc/lib.improve.action.zip.php:42
msgid "Zip module"
@ -332,14 +398,26 @@ msgstr "Pas défaut tous ces fichiers sont toujours exclu des paquetages : %s"
msgid "Remove comments from files"
msgstr "Retirer les commentaires des fichiers"
#: inc/lib.improve.action.zip.php:155
#: inc/lib.improve.action.zip.php:124
msgid "Prepare excluded files \"%s\""
msgstr "Préparer les fichiers à exclure \"%s\""
#: inc/lib.improve.action.zip.php:127
msgid "Prepare comment removal"
msgstr "Préparer le retrait des commentaires"
#: inc/lib.improve.action.zip.php:157
msgid "Destination filename already exists"
msgstr "Le fichier de destination existe déjà"
#: inc/lib.improve.action.zip.php:160
#: inc/lib.improve.action.zip.php:162
msgid "Destination path is not writable"
msgstr "Le répertoire de destination n'est pas accessible en écriture"
#: inc/lib.improve.action.zip.php:186
msgid "Zip module into \"%s\""
msgstr "Zipper le module vers \"%s\""
#: index.php:54
msgid "Select a module"
msgstr "Sélectionner un module"
@ -352,51 +430,63 @@ msgstr "Aucune action sélectionné"
msgid "No module selected"
msgstr "Aucun module sélectionné"
#: index.php:87
msgid "Fix of %s complete in %s secondes"
msgstr "Correction de %s complété en %s secondes"
#: index.php:85
msgid "Fix of \"%s\" complete in %s secondes with errors"
msgstr "Fixe de \"%s\" complété en %s secondes avec des erreurs"
#: index.php:102
#: index.php:108
#: index.php:109
#: index.php:146
#: index.php:87
msgid "Fix of \"%s\" complete in %s secondes with warnings"
msgstr "Fixe de \"%s\" complété en %s secondes avec des avertissements"
#: index.php:89
msgid "Fix of \"%s\" complete in %s secondes"
msgstr "Fixe de \"%s\" complété en %s secondes"
#: index.php:91
msgid "Fix of \"%s\" complete in %s secondes without messages"
msgstr "Fixe de \"%s\" complété en %s secondes sans message"
#: index.php:105
#: index.php:111
#: index.php:112
#: index.php:149
msgid "Themes"
msgstr "Thèmes"
#: index.php:104
#: index.php:174
#: index.php:107
#: index.php:177
msgid "Configure module"
msgstr "Configurer le module"
#: index.php:127
#: index.php:130
msgid "Configure module \"%s\""
msgstr "Configurer le module \"%s\""
#: index.php:131
#: index.php:134
msgid "Nothing to configure"
msgstr "Rien à configurer"
#: index.php:140
#: index.php:143
msgid "Unknow module"
msgstr "Module inconnu"
#: index.php:149
#: index.php:152
msgid "No module to manage"
msgstr "Aucun module à gérer"
#: index.php:174
#: index.php:177
msgid "Configure action '%s'"
msgstr "Configurer l'action \"%s\""
#: index.php:184
#: index.php:187
msgid "Save fields selection as preference"
msgstr "Enregistrer la sélection comme préférence"
#: index.php:185
#: index.php:188
msgid "Select a module:"
msgstr "Sélectionner un module :"
#: index.php:188
#: index.php:191
msgid "Fix it"
msgstr "Corriger"