fix PSR coding style
This commit is contained in:
parent
e2d8a94e28
commit
af474f0189
10 changed files with 190 additions and 171 deletions
|
@ -10,7 +10,6 @@
|
|||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_CONTEXT_MODULE')) {
|
||||
return null;
|
||||
}
|
||||
|
@ -78,7 +77,9 @@ echo '
|
|||
<p><label for="packman_pack_repository">' . __('Path to repository:') . ' ' .
|
||||
form::field('packman_pack_repository', 65, 255, $packman_pack_repository, 'maximal') .
|
||||
'</label></p>' .
|
||||
'<p class="form-note">' . sprintf(__('Preconization: %s'), $core->blog->public_path ?
|
||||
'<p class="form-note">' . sprintf(
|
||||
__('Preconization: %s'),
|
||||
$core->blog->public_path ?
|
||||
$core->blog->public_path : __("Blog's public directory")
|
||||
) . '</p>
|
||||
</div>
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
return null;
|
||||
}
|
||||
|
|
18
_install.php
18
_install.php
|
@ -10,7 +10,6 @@
|
|||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
return null;
|
||||
}
|
||||
|
@ -72,7 +71,8 @@ try {
|
|||
if (version_compare(
|
||||
$core->getVersion($mod_id),
|
||||
$core->plugins->moduleInfo($mod_id, 'version'),
|
||||
'>=')) {
|
||||
'>='
|
||||
)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,9 @@ try {
|
|||
if (!method_exists('dcUtils', 'versionsCompare')
|
||||
|| dcUtils::versionsCompare(DC_VERSION, $dc_min, '<', false)) {
|
||||
throw new Exception(sprintf(
|
||||
'%s requires Dotclear %s', $mod_id, $dc_min
|
||||
'%s requires Dotclear %s',
|
||||
$mod_id,
|
||||
$dc_min
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -88,7 +90,12 @@ try {
|
|||
$core->blog->settings->addNamespace($mod_id);
|
||||
foreach ($mod_conf as $v) {
|
||||
$core->blog->settings->{$mod_id}->put(
|
||||
$v[0], $v[2], $v[3], $v[1], false, true
|
||||
$v[0],
|
||||
$v[2],
|
||||
$v[3],
|
||||
$v[1],
|
||||
false,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -99,8 +106,7 @@ try {
|
|||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$core->error->add($e->getMessage());
|
||||
|
||||
return false;
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
return null;
|
||||
}
|
||||
|
@ -18,43 +17,67 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
|||
$mod_id = 'pacKman';
|
||||
|
||||
$this->addUserAction(
|
||||
/* type */ 'settings',
|
||||
/* action */ 'delete_all',
|
||||
/* ns */ $mod_id,
|
||||
/* desc */ __('delete all settings')
|
||||
/* type */
|
||||
'settings',
|
||||
/* action */
|
||||
'delete_all',
|
||||
/* ns */
|
||||
$mod_id,
|
||||
/* desc */
|
||||
__('delete all settings')
|
||||
);
|
||||
|
||||
$this->addUserAction(
|
||||
/* type */ 'plugins',
|
||||
/* action */ 'delete',
|
||||
/* ns */ $mod_id,
|
||||
/* desc */ __('delete plugin files')
|
||||
/* type */
|
||||
'plugins',
|
||||
/* action */
|
||||
'delete',
|
||||
/* ns */
|
||||
$mod_id,
|
||||
/* desc */
|
||||
__('delete plugin files')
|
||||
);
|
||||
|
||||
$this->addUserAction(
|
||||
/* type */ 'versions',
|
||||
/* action */ 'delete',
|
||||
/* ns */ $mod_id,
|
||||
/* desc */ __('delete the version number')
|
||||
/* type */
|
||||
'versions',
|
||||
/* action */
|
||||
'delete',
|
||||
/* ns */
|
||||
$mod_id,
|
||||
/* desc */
|
||||
__('delete the version number')
|
||||
);
|
||||
|
||||
$this->addDirectAction(
|
||||
/* type */ 'settings',
|
||||
/* action */ 'delete_all',
|
||||
/* ns */ $mod_id,
|
||||
/* desc */ sprintf(__('delete all %s settings'), $mod_id)
|
||||
/* type */
|
||||
'settings',
|
||||
/* action */
|
||||
'delete_all',
|
||||
/* ns */
|
||||
$mod_id,
|
||||
/* desc */
|
||||
sprintf(__('delete all %s settings'), $mod_id)
|
||||
);
|
||||
|
||||
$this->addDirectAction(
|
||||
/* type */ 'plugins',
|
||||
/* action */ 'delete',
|
||||
/* ns */ $mod_id,
|
||||
/* desc */ sprintf(__('delete %s plugin files'), $mod_id)
|
||||
/* type */
|
||||
'plugins',
|
||||
/* action */
|
||||
'delete',
|
||||
/* ns */
|
||||
$mod_id,
|
||||
/* desc */
|
||||
sprintf(__('delete %s plugin files'), $mod_id)
|
||||
);
|
||||
|
||||
$this->addDirectAction(
|
||||
/* type */ 'versions',
|
||||
/* action */ 'delete',
|
||||
/* ns */ $mod_id,
|
||||
/* desc */ sprintf(__('delete %s version number'), $mod_id)
|
||||
/* type */
|
||||
'versions',
|
||||
/* action */
|
||||
'delete',
|
||||
/* ns */
|
||||
$mod_id,
|
||||
/* desc */
|
||||
sprintf(__('delete %s version number'), $mod_id)
|
||||
);
|
|
@ -10,7 +10,6 @@
|
|||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
return null;
|
||||
}
|
||||
|
@ -31,7 +30,7 @@ class dcPackman
|
|||
|
||||
public static function quote_exclude($exclude)
|
||||
{
|
||||
foreach($exclude AS $k => $v) {
|
||||
foreach ($exclude as $k => $v) {
|
||||
$exclude[$k] = '#(^|/)(' . str_replace(
|
||||
['.', '*'],
|
||||
['\.', '.*?'],
|
||||
|
@ -131,7 +130,7 @@ class dcPackman
|
|||
}
|
||||
$zip = new packmanFileZip($fp);
|
||||
|
||||
foreach($exclude AS $e) {
|
||||
foreach ($exclude as $e) {
|
||||
$zip->addExclusion($e);
|
||||
}
|
||||
$zip->addDirectory(
|
||||
|
@ -204,6 +203,7 @@ class dcPackman
|
|||
foreach ($parts as $i => $part) {
|
||||
$parts[$i] = files::tidyFileName($part);
|
||||
}
|
||||
|
||||
return implode('/', $parts) . '.zip';
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
class packmanFileZip extends fileZip
|
||||
{
|
||||
public static $remove_comment = false;
|
||||
|
@ -47,8 +46,7 @@ class packmanFileZip extends fileZip
|
|||
$mtime = $this->makeTime($mtime);
|
||||
|
||||
# Data descriptor
|
||||
$data_desc =
|
||||
"\x50\x4b\x03\x04" .
|
||||
$data_desc = "\x50\x4b\x03\x04" .
|
||||
"\x14\x00" . # ver needed to extract
|
||||
"\x00\x00" . # gen purpose bit flag
|
||||
"\x08\x00" . # compression method
|
||||
|
@ -71,8 +69,7 @@ class packmanFileZip extends fileZip
|
|||
$new_offset = $this->old_offset + strlen($data_desc);
|
||||
|
||||
# Add to central directory record
|
||||
$cdrec =
|
||||
"\x50\x4b\x01\x02" .
|
||||
$cdrec = "\x50\x4b\x01\x02" .
|
||||
"\x00\x00" . # version made by
|
||||
"\x14\x00" . # version needed to extract
|
||||
"\x00\x00" . # gen purpose bit flag
|
||||
|
@ -119,6 +116,7 @@ class packmanFileZip extends fileZip
|
|||
$newStr .= $token;
|
||||
}
|
||||
}
|
||||
|
||||
return $newStr;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
return null;
|
||||
}
|
||||
|
@ -99,7 +98,8 @@ class libPackman
|
|||
'</table>' .
|
||||
'<p class="checkboxes-helpers"></p>' .
|
||||
'<p>' .
|
||||
(!empty($_REQUEST['redir']) ?
|
||||
(
|
||||
!empty($_REQUEST['redir']) ?
|
||||
form::hidden(
|
||||
['redir'],
|
||||
html::escapeHTML($_REQUEST['redir'])
|
||||
|
@ -158,7 +158,7 @@ class libPackman
|
|||
'</tr>';
|
||||
|
||||
$dup = [];
|
||||
foreach(self::sort($modules) AS $module) {
|
||||
foreach (self::sort($modules) as $module) {
|
||||
if (isset($dup[$module['root']])) {
|
||||
continue;
|
||||
}
|
||||
|
|
10
index.php
10
index.php
|
@ -10,7 +10,6 @@
|
|||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
return null;
|
||||
}
|
||||
|
@ -18,7 +17,7 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
|||
dcPage::checkSuper();
|
||||
|
||||
# Queries
|
||||
$action = isset($_POST['action']) ? $_POST['action'] : '';
|
||||
$action = $_POST['action'] ?? '';
|
||||
$type = isset($_POST['type']) && in_array($_POST['type'], ['plugins', 'themes', 'repository']) ? $_POST['type'] : '';
|
||||
|
||||
# Settings
|
||||
|
@ -45,8 +44,7 @@ $is_writable = libPackman::is_writable(
|
|||
$s->packman_pack_repository,
|
||||
$s->packman_pack_filename
|
||||
);
|
||||
$is_editable =
|
||||
!empty($type)
|
||||
$is_editable = !empty($type)
|
||||
&& !empty($_POST['modules'])
|
||||
&& is_array($_POST['modules']);
|
||||
|
||||
|
@ -97,7 +95,6 @@ try {
|
|||
header('Content-Type: text/plain');
|
||||
http::head(404, 'Not Found');
|
||||
exit;
|
||||
|
||||
} elseif (!empty($action) && !$is_editable) {
|
||||
throw new Exception('No selected modules');
|
||||
|
||||
|
@ -129,7 +126,6 @@ try {
|
|||
|
||||
# --BEHAVIOR-- packmanAfterCreatePackage
|
||||
$core->callBehavior('packmanAfterCreatePackage', $core, $module);
|
||||
|
||||
}
|
||||
|
||||
dcPage::addSuccessNotice(
|
||||
|
@ -178,7 +174,6 @@ try {
|
|||
|
||||
# --BEHAVIOR-- packmanAfterInstallPackage
|
||||
$core->callBehavior('packmanAfterInstallPackage', $type, $id, $root);
|
||||
|
||||
}
|
||||
|
||||
dcPage::addSuccessNotice(
|
||||
|
@ -274,7 +269,6 @@ if ($core->error->flag()) {
|
|||
'<a href="plugins.php?module=pacKman&conf=1&redir=' .
|
||||
urlencode('plugin.php?p=pacKman') . '">' . __('Configuration') . '</a>' .
|
||||
'</p>';
|
||||
|
||||
} else {
|
||||
$repo_path_modules = array_merge(
|
||||
dcPackman::getPackages(
|
||||
|
|
Loading…
Reference in a new issue