class mw_sourceml extends mw_plugin{
- function title(){
+ public function title(){
return "SourceML";
}
- function description(){
+ public function description(){
return "Publication de sources musicales";
}
- function init($env){
+ public function loaded($env){
+ $AUTO_ACTIVATE = false;
+ if(!$env->bdd("sgbd") || ($plugin_data = $env->plugin_data("mw_sourceml")) === false) return;
+ if(!isset($plugin_data["installed"]) || !$plugin_data["installed"]){
+ $data = $env->data();
+ $sgbd = $data->sgbd();
+ if($env->bdd("sgbd") == "xml"){
+ $AUTO_ACTIVATE = $sgbd->data_exists("sources");
+ }
+ else{
+ $AUTO_ACTIVATE = $sgbd->table_exists("#--sources");
+ }
+ }
+ if($AUTO_ACTIVATE){
+ if(
+ $env->set_plugin_data(
+ "mw_sourceml",
+ array(
+ "installed" => true,
+ "enabled" => true,
+ "priorite" => 0
+ )
+ )
+ ){
+ $env->load_plugin("mw_sourceml");
+ }
+ }
+ }
+
+ public function init($env){
$env->set_link("admin/sourceml", $env->url("admin/sourceml"), "SourceML", 50);
$env->set_link("admin/sourceml/licences", $env->url("admin/licences"), "Licences", 10);
return true;
}
- function nb_invitations($env){
+ public function nb_invitations($env){
if($user = $env->user()){
$data = $env->data();
if($groupes = $data->groupes($user["id"])){
return 0;
}
- function enable($env){
+ public function enable($env){
$data = $env->data();
- if(
- ($data->config("site_name") == "mtweb")
- && (($plugins = $env->plugins()) !== false)
- && (count($plugins) == 1)
- ){
+ if($data->config("site_name") == "mtweb"){
$data->set_config("site_name", "SourceML");
}
return true;
function disable($env){
$data = $env->data();
- if(
- ($data->config("site_name") == "SourceML")
- && (($plugins = $env->plugins()) !== false)
- && (count($plugins) == 1)
- ){
+ if($data->config("site_name") == "SourceML"){
$data->set_config("site_name", "mtweb");
}
return true;
}
- function install($env){
+ public function install($env){
$data = $env->data();
$res = true;
if(
return $res;
}
- function uninstall($env){
+ public function uninstall($env){
$data = $env->data();
$res = true;
if(