mirror of
https://github.com/Codiad/Codiad.git
synced 2026-03-05 00:44:00 +01:00
62 lines
1.8 KiB
PHP
62 lines
1.8 KiB
PHP
<?php
|
|
|
|
/*
|
|
* Copyright (c) Codiad & Kent Safranski (codiad.com), distributed
|
|
* as-is and without warranty under the MIT License. See
|
|
* [root]/license.txt for more. This information must remain intact.
|
|
*/
|
|
|
|
include('../common/class.common.php');
|
|
|
|
class Plugin_manager extends Common {
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
// PROPERTIES
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
public $plugins = '';
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
// METHODS
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
// -----------------------------||----------------------------- //
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
// Construct
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
public function __construct(){
|
|
$this->plugins = getJSON('plugins.php');
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
// Deactivate Plugin
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
public function Deactivate($name){
|
|
$revised_array = array();
|
|
foreach($this->plugins as $plugin){
|
|
if($plugin!=$name){
|
|
$revised_array[] = $plugin;
|
|
}
|
|
}
|
|
// Save array back to JSON
|
|
saveJSON('plugins.php',$revised_array);
|
|
// Response
|
|
echo formatJSEND("success",null);
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
// Activate Plugin
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
public function Activate($name){
|
|
$this->plugins[] = $name;
|
|
saveJSON('plugins.php',$this->plugins);
|
|
// Response
|
|
echo formatJSEND("success",null);
|
|
}
|
|
|
|
}
|