- Plugin API: add possibility to disable plugin in AJAX mode, 'noajax' property
- Plugin API: add possibility to disable plugin in framed mode, 'noframe' property
| | |
| | | - Fix handling of URLs with tilde (~) or semicolon (;) character (#1487087, #1487088) |
| | | - Plugin API: added 'contact_form' hook |
| | | - Add SORT=DISPLAY support (RFC 5957) |
| | | - Plugin API: add possibility to disable plugin in AJAX mode, 'noajax' property |
| | | - Plugin API: add possibility to disable plugin in framed mode, 'noframe' property |
| | | |
| | | RELEASE 0.4.2 |
| | | ------------- |
| | |
| | | */ |
| | | abstract class rcube_plugin |
| | | { |
| | | /** |
| | | * Class name of the plugin instance |
| | | * |
| | | * @var string |
| | | */ |
| | | public $ID; |
| | | |
| | | /** |
| | | * Holds an istance of Plugin API |
| | | * Instance of Plugin API |
| | | * |
| | | * @var rcube_plugin_api |
| | | */ |
| | | public $api; |
| | | |
| | | /** |
| | | * Regular expression defining task(s) to bind with |
| | | * |
| | | * @var string |
| | | */ |
| | | public $task; |
| | | |
| | | /** |
| | | * Disables plugin in AJAX requests |
| | | * |
| | | * @var boolean |
| | | */ |
| | | public $noajax = false; |
| | | |
| | | /** |
| | | * Disables plugin in framed mode |
| | | * |
| | | * @var boolean |
| | | */ |
| | | public $noframe = false; |
| | | |
| | | protected $home; |
| | | protected $urlbase; |
| | | private $mytask; |
| | | |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | |
| | | // instantiate class if exists |
| | | if (class_exists($plugin_name, false)) { |
| | | $plugin = new $plugin_name($this); |
| | | // check inheritance and task specification |
| | | if (is_subclass_of($plugin, 'rcube_plugin') && (!$plugin->task || preg_match('/^('.$plugin->task.')$/i', $rcmail->task))) { |
| | | // check inheritance... |
| | | if (is_subclass_of($plugin, 'rcube_plugin')) { |
| | | // ... task, request type and framed mode |
| | | if ((!$plugin->task || preg_match('/^('.$plugin->task.')$/i', $rcmail->task)) |
| | | && (!$plugin->noajax || is_a($this->output, 'rcube_template')) |
| | | && (!$plugin->noframe || empty($_REQUEST['_framed'])) |
| | | ) { |
| | | $plugin->init(); |
| | | $this->plugins[] = $plugin; |
| | | } |
| | | } |
| | | } |
| | | else { |
| | | raise_error(array('code' => 520, 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |