Make plugins list and switcher
This commit is contained in:
38
app/views/Plugins.php
Normal file
38
app/views/Plugins.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
class Plugins extends Template
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
$userManager = new UserManager();
|
||||
$langMng = new LanguageManager('en');
|
||||
|
||||
|
||||
if (!$userManager->isLogin()){
|
||||
header('Location: ' . BASEURL . 'login');
|
||||
}
|
||||
|
||||
$dir = $_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/';
|
||||
$pluginsFiles = array_diff(scandir($dir), ['..', '.']);
|
||||
|
||||
$plugins = array();
|
||||
|
||||
foreach ($pluginsFiles as $key => $pluginFile) {
|
||||
$status = (strpos($pluginFile, "!") !== false ? false : true);
|
||||
$plugins[$key]['name'] = str_replace("!", "", str_replace(".php", "", $pluginFile));
|
||||
$plugins[$key]['status'] = $status;
|
||||
}
|
||||
|
||||
sort($plugins);
|
||||
|
||||
$template = new Template('plugins');
|
||||
$template->prepare('baseDir', BASEDIR);
|
||||
$template->prepare('debugMod', DEBUGMOD);
|
||||
$template->prepare('title', 'Plugins');
|
||||
$template->prepare('langMng', $langMng);
|
||||
$template->prepare('plugins', $plugins);
|
||||
|
||||
|
||||
|
||||
$template->render();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user