Source for file class.plugin.php
Documentation is available at class.plugin.php
* @package linea21.modules
* @author Simon Georget <simon@linea21.com>
* @license http://opensource.org/licenses/gpl-3.0.html
throw new Exception($name. ' plugin : xml file was not found');
$this->info['name'] = $name;
$this->info['shortname'] = str_replace('l21_', '', $name);
$this->info['description'] = $flow->description;
$this->info['version'] = $flow->version;
$this->info['date'] = $flow->date;
$this->info['compatibility'] = $flow->compatibility;
$this->info['author'] = $flow->author;
$this->info['homepage'] = $flow->homepage;
$this->info['settings'] = (integer) $flow->settings;
$this->info['default_language'] = $flow->default_language;
$this->info['status'] = $flow->status;
$this->info['image'] = $flow->image;
$this->info['active_path'] = SITE_PATH. 'plugins/'. $this->info['name']. '/.active';
$this->info['active_url'] = SITE_ROOT_URL. 'plugins/'. $this->info['name']. '/';
$this->info['relative_url'] = '../plugins/'. $this->info['name']. '/';
if($flow->apps->app != null) {
foreach($flow->apps->app as $el) {
$this->info['apps'][]=(string) $el;
if(!empty($this->info['image'])) return true;
if($this->info['settings'] == true) return true;
return '../plugins/'. $this->info['name']. '/'. $this->info['image'];
public function getVar($varname) {
if(isset ($this->info[$varname])) {
return $this->info[$varname];
// Notify the beginning of the current method
$this->dispatcher->notify(new sfEvent($this, 'plugin.load'));
// we check if the current app is concerned by the module or if we are in current plugin page (back-office)
if(($this->getVar('apps') && in_array(CURRENT_APP, $this->getVar('apps'))) || (isset ($_REQUEST['current']) && isset ($_REQUEST['rub']) && $_REQUEST['rub'] == 'plugins' && $_REQUEST['current'] == $this->info['name'])) {
if(file_exists(SITE_PATH. 'plugins/'. $this->info['name']. '/__init__.php')) {
include_once(SITE_PATH. 'plugins/'. $this->info['name']. '/__init__.php');
// Notify the beginning of the current method
$this->dispatcher->notify(new sfEvent($this, 'plugin.enable'));
if(file_exists(SITE_PATH. 'plugins/'. $this->info['name']. '/__install__.php')) {
include_once(SITE_PATH. 'plugins/'. $this->info['name']. '/__install__.php');
// Notify the beginning of the current method
$this->dispatcher->notify(new sfEvent($this, 'plugin.disable'));
// Notify the beginning of the current method
$this->dispatcher->notify(new sfEvent($this, 'plugin.retrieve_values'));
$q = 'SELECT plugin_values FROM '. T_PLUGIN. ' WHERE plugin_name = "'. $this->getVar('name'). '"';
$r = $sqlo->DBSelect($q);
if(isset ($r[0]['plugin_values'])){
// Notify the beginning of the current method
$this->dispatcher->notify(new sfEvent($this, 'plugin.store_values'));
// test if plugin is already registerd
$q = 'UPDATE '. T_PLUGIN. ' SET plugin_values="'. $sqlo->DBescape(serialize($array)). '" WHERE plugin_name = "'. $this->getVar('name'). '";';
$q = 'INSERT INTO '. T_PLUGIN. ' (plugin_name, plugin_values, plugin_date_crea) VALUES("'. $this->getVar('name'). '", "'. $sqlo->DBescape(serialize($array)). '", NOW());';
$r = $sqlo->DBInsert($q);
$q = 'SELECT plugin_values FROM '. T_PLUGIN. ' WHERE plugin_name = "'. $this->getVar('name'). '"';
$r = $sqlo->DBSelect($q);
if(isset ($r[0]['plugin_values'])) return true;
|