26 $this->db = XoopsDatabaseFactory::getDatabaseConnection();
27 $this->_dbtable = $this->db->prefix(
"rmc_plugins");
43 $this->primary =
'dir';
49 $this->primary =
'id_plugin';
59 if (
$dir ==
'')
return false;
63 if (!is_file(
$path.
'/'.strtolower(
$dir).
'-plugin.php'))
return false;
65 include_once
$path.
'/'.strtolower(
$dir).
'-plugin.php';
68 if (!class_exists(
$class))
return false;
73 foreach ($this->
plugin->info() as $k => $v){
81 return $this->
getVar(
'id_plugin');
93 include_once
RMCPATH.
'/plugins/'.
$dir.
'/'.strtolower(
$dir).
'-plugin.php';
101 return $this->
plugin()->get_info($name);
105 return $this->
plugin->on_install();
109 return $this->
plugin->on_update();
113 return $this->
plugin->on_uninstall();
117 return $this->
plugin->on_activate($q);
121 return $this->
plugin->options();
127 $pre_options = $this->
plugin->options();
129 if (empty($pre_options))
return;
131 $db = XoopsDatabaseFactory::getDatabaseConnection();
134 if (empty($c_options)){
137 foreach ($pre_options as $name => $option){
139 $sql .=
"('$dir','$name','plugin','$option[value]','$option[valuetype]')";
142 $sql =
"INSERT INTO ".$db->prefix(
"rmc_settings").
" (`element`,`name`,`type`,`value`,`valuetype`) VALUES ".
$sql;
145 $this->
addError($this->db->error());
154 foreach ($pre_options as $name => $option){
156 if (isset($c_options[$name])){
157 $option[
'value'] = $c_options[$name][
'value'];
158 $sql =
"UPDATE ".$db->prefix(
"rmc_settings").
" SET value='$option[value]' WHERE element='$dir' AND type='plugin' AND name='$name'";
161 $sql =
"INSERT INTO ".$db->prefix(
"rmc_settings").
" (`element`,`name`,`type`,`value`,`valuetype`) VALUES
162 ('$dir','$name','plugin','$option[value]','$option[valuetype]')";
183 public function delete(){
186 $db = XoopsDatabaseFactory::getDatabaseConnection();
187 $sql =
"DELETE FROM ".$db->prefix(
"rmc_settings").
" WHERE element='$dir' AND type='plugin'";