2b6ac77922
Test sur une api rest -> OK! Test sur le deplacement d'une autre page de compte -> OK! TODO: créé les pages de blog (sommaire,news) permettant d'afficher les fichiers md TODO: finir créer les commandes pour l'ajout de modules
90 lines
3.4 KiB
PHP
90 lines
3.4 KiB
PHP
<?php
|
|
|
|
namespace MVC\Classe;
|
|
|
|
class Modular{
|
|
|
|
private $app = "";
|
|
private $subapp_dir = "";
|
|
private $subfile = "index.php";
|
|
|
|
public function __construct($appName,$type = 'symfony',$options = array()){
|
|
|
|
//Dumper::dump($options);die();
|
|
|
|
$this->app = $appName;
|
|
switch ($type) {
|
|
case "symfony":
|
|
break;
|
|
case "wordpress":
|
|
if(isset($options[0])) {
|
|
switch ($options[0]) {
|
|
case 'wp-admin':
|
|
$this->subapp_dir = DIRECTORY_SEPARATOR . $options[0];
|
|
if(isset($options[1])) {
|
|
switch ($options[1]) {
|
|
case 'setup-config.php':
|
|
case 'install.php':
|
|
$this->subfile = $options[1];
|
|
break;
|
|
default:
|
|
if(preg_match('#(.)*\.php#',$options[1])){
|
|
$this->subfile = $options[1];
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
case 'wp-login.php':
|
|
$this->subfile = $options[0];
|
|
break;
|
|
default:
|
|
}
|
|
}
|
|
break;
|
|
case "prestashop":
|
|
if(isset($options[0])) {
|
|
switch ($options[0]) {
|
|
case 'admin-dev':
|
|
case 'install-dev':
|
|
$this->subapp_dir = DIRECTORY_SEPARATOR . $options[0];
|
|
break;
|
|
default:
|
|
}
|
|
}
|
|
break;
|
|
case "phplist":
|
|
if(isset($options[0])) {
|
|
switch ($options[0]) {
|
|
case 'admin':
|
|
$this->subapp_dir = DIRECTORY_SEPARATOR . 'public_html' . DIRECTORY_SEPARATOR . 'lists'. DIRECTORY_SEPARATOR . $options[0] ;
|
|
break;
|
|
default:
|
|
}
|
|
}else{
|
|
$this->subapp_dir = DIRECTORY_SEPARATOR . 'public_html' . DIRECTORY_SEPARATOR . 'lists';
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
public function getAppName(){
|
|
return $this->app;
|
|
}
|
|
|
|
public function load($type = "symfony"){
|
|
switch ($type) {
|
|
case "symfony":
|
|
require MODULES_PATH . DIRECTORY_SEPARATOR . $this->getAppName() . DIRECTORY_SEPARATOR . "public" . DIRECTORY_SEPARATOR . "index.php";
|
|
break;
|
|
case "wordpress":
|
|
require MODULES_PATH . DIRECTORY_SEPARATOR . $this->getAppName() . $this->subapp_dir . DIRECTORY_SEPARATOR . $this->subfile;
|
|
break;
|
|
case "prestashop":
|
|
require MODULES_PATH . DIRECTORY_SEPARATOR . $this->getAppName() . $this->subapp_dir . DIRECTORY_SEPARATOR . "index.php";
|
|
break;
|
|
case "phplist":
|
|
require MODULES_PATH . DIRECTORY_SEPARATOR . $this->getAppName() . $this->subapp_dir . DIRECTORY_SEPARATOR . "index.php";
|
|
break;
|
|
}
|
|
}
|
|
} |