testing NsClass
parent
4463766a78
commit
f155a33fb1
18
_admin.php
18
_admin.php
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @brief pacKman, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
$admin = implode('\\', ['Dotclear', 'Plugin', basename(__DIR__), 'Admin']);
|
||||
if ($admin::init()) {
|
||||
$admin::process();
|
||||
}
|
19
_config.php
19
_config.php
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @brief pacKman, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
$config = implode('\\', ['Dotclear', 'Plugin', basename(__DIR__), 'Config']);
|
||||
if ($config::init()) {
|
||||
$config::process();
|
||||
$config::render();
|
||||
}
|
|
@ -23,7 +23,7 @@ $this->registerModule(
|
|||
'pacKman',
|
||||
'Manage your Dotclear packages',
|
||||
'Jean-Christian Denis',
|
||||
'2023.01.07',
|
||||
'2023.01.09-dev',
|
||||
[
|
||||
'requires' => [['core', '2.24']],
|
||||
'permissions' => null,
|
||||
|
|
20
_install.php
20
_install.php
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @brief pacKman, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
$install = implode('\\', ['Dotclear', 'Plugin', basename(__DIR__), 'Install']);
|
||||
if ($install::init()) {
|
||||
return $install::process();
|
||||
}
|
||||
|
||||
return null;
|
22
_prepend.php
22
_prepend.php
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @brief pacKman, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
$prepend = implode('\\', ['Dotclear', 'Plugin', basename(__DIR__), 'Prepend']);
|
||||
if (!class_exists($prepend)) {
|
||||
require implode(DIRECTORY_SEPARATOR, [__DIR__, 'inc', 'Prepend.php']);
|
||||
|
||||
if ($prepend::init()) {
|
||||
$prepend::process();
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @brief pacKman, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
$uninstall = implode('\\', ['Dotclear', 'Plugin', basename(__DIR__), 'Uninstall']);
|
||||
|
||||
// cope with disabled plugin
|
||||
if (!class_exists($uninstall)) {
|
||||
require implode(DIRECTORY_SEPARATOR, [__DIR__, 'inc', 'Uninstall.php']);
|
||||
}
|
||||
|
||||
if ($uninstall::init()) {
|
||||
$uninstall::process($this);
|
||||
}
|
|
@ -19,11 +19,11 @@ use dcAdmin;
|
|||
use dcCore;
|
||||
use dcFavorites;
|
||||
use dcPage;
|
||||
use dcNsProcess;
|
||||
|
||||
class Admin
|
||||
class Admin extends dcNsProcess
|
||||
{
|
||||
private static $pid = '';
|
||||
protected static $init = false;
|
||||
|
||||
public static function init(): bool
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ class Admin
|
|||
return self::$init;
|
||||
}
|
||||
|
||||
public static function process(): ?bool
|
||||
public static function process(): bool
|
||||
{
|
||||
if (!self::$init) {
|
||||
return false;
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace Dotclear\Plugin\pacKman;
|
|||
/* dotclear ns */
|
||||
use dcCore;
|
||||
use dcPage;
|
||||
use dcNsProcess;
|
||||
|
||||
/* clearbricks ns */
|
||||
use form;
|
||||
|
@ -25,14 +26,13 @@ use http;
|
|||
/* php ns */
|
||||
use Exception;
|
||||
|
||||
class Config
|
||||
class Config extends dcNsProcess
|
||||
{
|
||||
private static $pid = '';
|
||||
protected static $init = false;
|
||||
|
||||
public static function init(): bool
|
||||
{
|
||||
if (defined('DC_CONTEXT_ADMIN') && defined('DC_CONTEXT_MODULE')) {
|
||||
if (defined('DC_CONTEXT_ADMIN')) {
|
||||
self::$pid = basename(dirname(__DIR__));
|
||||
self::$init = true;
|
||||
}
|
||||
|
@ -40,14 +40,14 @@ class Config
|
|||
return self::$init;
|
||||
}
|
||||
|
||||
public static function process(): ?bool
|
||||
public static function process(): bool
|
||||
{
|
||||
if (!self::$init) {
|
||||
if (!self::$init || !defined('DC_CONTEXT_MODULE')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($_POST['save'])) {
|
||||
return null;
|
||||
return true;
|
||||
}
|
||||
|
||||
# -- Set settings --
|
||||
|
@ -83,20 +83,18 @@ class Config
|
|||
dcCore::app()->admin->__get('list')->getURL('module=' . self::$pid . '&conf=1&redir=' .
|
||||
dcCore::app()->admin->__get('list')->getRedir())
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
dcCore::app()->error->add($e->getMessage());
|
||||
}
|
||||
|
||||
return null;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function render()
|
||||
public static function render(): void
|
||||
{
|
||||
if (!self::$init) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
# -- Get settings --
|
||||
|
|
|
@ -17,11 +17,12 @@ namespace Dotclear\Plugin\pacKman;
|
|||
/* dotclear ns */
|
||||
use dcCore;
|
||||
use dcNamespace;
|
||||
use dcNsProcess;
|
||||
|
||||
/* php ns */
|
||||
use Exception;
|
||||
|
||||
class Install
|
||||
class Install extends dcNsProcess
|
||||
{
|
||||
// Module specs
|
||||
private static $mod_conf = [
|
||||
|
@ -71,7 +72,6 @@ class Install
|
|||
|
||||
// Nothing to change below
|
||||
private static $pid = '';
|
||||
protected static $init = false;
|
||||
|
||||
public static function init(): bool
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ class Install
|
|||
return self::$init;
|
||||
}
|
||||
|
||||
public static function process(): ?bool
|
||||
public static function process(): bool
|
||||
{
|
||||
if (!self::$init) {
|
||||
return false;
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace Dotclear\Plugin\pacKman;
|
|||
use dcCore;
|
||||
use dcPage;
|
||||
use dcThemes;
|
||||
use dcNsProcess;
|
||||
|
||||
/* clearbricks ns */
|
||||
use files;
|
||||
|
@ -27,12 +28,11 @@ use path;
|
|||
/* php ns */
|
||||
use Exception;
|
||||
|
||||
class Manage
|
||||
class Manage extends dcNsProcess
|
||||
{
|
||||
private static $plugins_path = '';
|
||||
private static $themes_path = '';
|
||||
private static $pid = '';
|
||||
protected static $init = false;
|
||||
|
||||
public static function init(): bool
|
||||
{
|
||||
|
@ -51,10 +51,10 @@ class Manage
|
|||
return self::$init;
|
||||
}
|
||||
|
||||
public static function process(): void
|
||||
public static function process(): bool
|
||||
{
|
||||
if (!self::$init) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
# Queries
|
||||
|
@ -279,12 +279,14 @@ class Manage
|
|||
} catch (Exception $e) {
|
||||
dcCore::app()->error->add($e->getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function render()
|
||||
public static function render(): void
|
||||
{
|
||||
if (!self::$init) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
# Settings
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @brief pacKman, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotclear\Plugin\pacKman;
|
||||
|
||||
/* clearbricks ns */
|
||||
use Clearbricks;
|
||||
|
||||
class Prepend
|
||||
{
|
||||
private const LIBS = [
|
||||
'Admin',
|
||||
'Config',
|
||||
'Core',
|
||||
'Filezip',
|
||||
'Install',
|
||||
'Manage',
|
||||
'Prepend',
|
||||
'Uninstall',
|
||||
'Utils',
|
||||
];
|
||||
protected static $init = false;
|
||||
|
||||
public static function init(): bool
|
||||
{
|
||||
self::$init = defined('DC_RC_PATH');
|
||||
|
||||
return self::$init;
|
||||
}
|
||||
|
||||
public static function process(): ?bool
|
||||
{
|
||||
if (!self::$init) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (self::LIBS as $lib) {
|
||||
Clearbricks::lib()->autoload([
|
||||
__NAMESPACE__ . '\\' . $lib => __DIR__ . DIRECTORY_SEPARATOR . $lib . '.php',
|
||||
]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
19
index.php
19
index.php
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @brief pacKman, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
$manage = implode('\\', ['Dotclear', 'Plugin', basename(__DIR__), 'Manage']);
|
||||
if ($manage::init()) {
|
||||
$manage::process();
|
||||
$manage::render();
|
||||
}
|
Loading…
Reference in New Issue