🐛 Corrections autour des modules
This commit is contained in:
parent
b2f30a0bbb
commit
90d230e2f4
3 changed files with 17 additions and 8 deletions
|
@ -35,10 +35,18 @@ class Plugin
|
||||||
// (array) List of custom hooks
|
// (array) List of custom hooks
|
||||||
public $customHooks;
|
public $customHooks;
|
||||||
|
|
||||||
function __construct()
|
// domain of the module
|
||||||
|
private $domain;
|
||||||
|
|
||||||
|
// path of the module
|
||||||
|
private $path;
|
||||||
|
|
||||||
|
function __construct($path, $domain)
|
||||||
{
|
{
|
||||||
$this->dbFields = array();
|
$this->dbFields = array();
|
||||||
$this->customHooks = array();
|
$this->customHooks = array();
|
||||||
|
$this->path = $path;
|
||||||
|
$this->domain = $domain;
|
||||||
|
|
||||||
$reflector = new ReflectionClass(get_class($this));
|
$reflector = new ReflectionClass(get_class($this));
|
||||||
|
|
||||||
|
@ -59,7 +67,7 @@ class Plugin
|
||||||
$this->filenameDb = PATH_PLUGINS_DATABASES . $this->directoryName . DS . 'db.php';
|
$this->filenameDb = PATH_PLUGINS_DATABASES . $this->directoryName . DS . 'db.php';
|
||||||
|
|
||||||
// --- Metadata ---
|
// --- Metadata ---
|
||||||
$this->filenameMetadata = PATH_PLUGINS . $this->directoryName() . DS . 'metadata.json';
|
$this->filenameMetadata = $this->path . $this->directoryName() . DS . 'metadata.json';
|
||||||
$metadataString = file_get_contents($this->filenameMetadata);
|
$metadataString = file_get_contents($this->filenameMetadata);
|
||||||
$this->metadata = json_decode($metadataString, true);
|
$this->metadata = json_decode($metadataString, true);
|
||||||
|
|
||||||
|
@ -92,7 +100,7 @@ class Plugin
|
||||||
// This function helps to include CSS or Javascript files with absolute URL
|
// This function helps to include CSS or Javascript files with absolute URL
|
||||||
public function domainPath()
|
public function domainPath()
|
||||||
{
|
{
|
||||||
return DOMAIN_PLUGINS . $this->directoryName . '/';
|
return $this->domain . $this->directoryName . '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns relative path of the plugin directory
|
// Returns relative path of the plugin directory
|
||||||
|
@ -106,7 +114,7 @@ class Plugin
|
||||||
// This function helps to include PHP libraries or some file at server level
|
// This function helps to include PHP libraries or some file at server level
|
||||||
public function phpPath()
|
public function phpPath()
|
||||||
{
|
{
|
||||||
return PATH_PLUGINS . $this->directoryName . DS;
|
return $this->path . $this->directoryName . DS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function phpPathDB()
|
public function phpPathDB()
|
||||||
|
|
|
@ -261,6 +261,7 @@ define('DOMAIN_UPLOADS_PAGES', DOMAIN . HTML_PATH_UPLOADS_PAGES);
|
||||||
define('DOMAIN_UPLOADS_PROFILES', DOMAIN . HTML_PATH_UPLOADS_PROFILES);
|
define('DOMAIN_UPLOADS_PROFILES', DOMAIN . HTML_PATH_UPLOADS_PROFILES);
|
||||||
define('DOMAIN_UPLOADS_THUMBNAILS', DOMAIN . HTML_PATH_UPLOADS_THUMBNAILS);
|
define('DOMAIN_UPLOADS_THUMBNAILS', DOMAIN . HTML_PATH_UPLOADS_THUMBNAILS);
|
||||||
define('DOMAIN_PLUGINS', DOMAIN . HTML_PATH_PLUGINS);
|
define('DOMAIN_PLUGINS', DOMAIN . HTML_PATH_PLUGINS);
|
||||||
|
define('DOMAIN_MODULES', DOMAIN . HTML_PATH_MODULES);
|
||||||
define('DOMAIN_CONTENT', DOMAIN . HTML_PATH_CONTENT);
|
define('DOMAIN_CONTENT', DOMAIN . HTML_PATH_CONTENT);
|
||||||
|
|
||||||
define('DOMAIN_ADMIN', DOMAIN_BASE . ADMIN_URI_FILTER . '/');
|
define('DOMAIN_ADMIN', DOMAIN_BASE . ADMIN_URI_FILTER . '/');
|
||||||
|
|
|
@ -49,7 +49,7 @@ $pluginsInstalled = array();
|
||||||
// Functions
|
// Functions
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
function buildPlugins($path, $autoActivate = false)
|
function buildPlugins($path, $domain, $autoActivate = false)
|
||||||
{
|
{
|
||||||
global $plugins;
|
global $plugins;
|
||||||
global $pluginsEvents;
|
global $pluginsEvents;
|
||||||
|
@ -74,7 +74,7 @@ function buildPlugins($path, $autoActivate = false)
|
||||||
$pluginsDeclaredClasess = array_diff(get_declared_classes(), $currentDeclaredClasess);
|
$pluginsDeclaredClasess = array_diff(get_declared_classes(), $currentDeclaredClasess);
|
||||||
|
|
||||||
foreach ($pluginsDeclaredClasess as $pluginClass) {
|
foreach ($pluginsDeclaredClasess as $pluginClass) {
|
||||||
$Plugin = new $pluginClass;
|
$Plugin = new $pluginClass($path, $domain);
|
||||||
|
|
||||||
// Check if the plugin is translated
|
// Check if the plugin is translated
|
||||||
$languageFilename = $path.$Plugin->directoryName().DS.'languages'.DS.$site->language().'.json';
|
$languageFilename = $path.$Plugin->directoryName().DS.'languages'.DS.$site->language().'.json';
|
||||||
|
@ -135,5 +135,5 @@ function buildPlugins($path, $autoActivate = false)
|
||||||
// Main
|
// Main
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
buildPlugins(PATH_PLUGINS);
|
buildPlugins(PATH_PLUGINS, DOMAIN_PLUGINS);
|
||||||
buildPlugins(PATH_MODULES, true);
|
buildPlugins(PATH_MODULES, DOMAIN_MODULES, true);
|
||||||
|
|
Loading…
Add table
Reference in a new issue