private $storage = array();
private $feeds = array();
private $api_methods = array();
+ private $plugin_actions = array();
private $owner_uid;
private $debug;
private $last_registered;
const HOOK_SUBSCRIBE_FEED = 27;
const HOOK_HEADLINES_BEFORE = 28;
const HOOK_RENDER_ENCLOSURE = 29;
+ const HOOK_ARTICLE_FILTER_ACTION = 30;
+ const HOOK_ARTICLE_EXPORT_FEED = 31;
+ const HOOK_MAIN_TOOLBAR_BUTTON = 32;
+ const HOOK_ENCLOSURE_ENTRY = 33;
+ const HOOK_FORMAT_ARTICLE = 34;
+ const HOOK_FORMAT_ARTICLE_CDM = 35;
+ const HOOK_FEED_BASIC_INFO = 36;
const KIND_ALL = 1;
const KIND_SYSTEM = 2;
}
function get_plugin($name) {
- return $this->plugins[$name];
+ return $this->plugins[strtolower($name)];
}
function run_hooks($type, $method, $args) {
return array();
}
}
- function load_all($kind, $owner_uid = false) {
+ function load_all($kind, $owner_uid = false, $skip_init = false) {
$plugins = array_merge(glob("plugins/*"), glob("plugins.local/*"));
$plugins = array_filter($plugins, "is_dir");
asort($plugins);
- $this->load(join(",", $plugins), $kind, $owner_uid);
+ $this->load(join(",", $plugins), $kind, $owner_uid, $skip_init);
}
- function load($classlist, $kind, $owner_uid = false) {
+ function load($classlist, $kind, $owner_uid = false, $skip_init = false) {
$plugins = explode(",", $classlist);
$this->owner_uid = (int) $owner_uid;
switch ($kind) {
case $this::KIND_SYSTEM:
if ($this->is_system($plugin)) {
- $plugin->init($this);
+ if (!$skip_init) $plugin->init($this);
$this->register_plugin($class, $plugin);
}
break;
case $this::KIND_USER:
if (!$this->is_system($plugin)) {
- $plugin->init($this);
+ if (!$skip_init) $plugin->init($this);
$this->register_plugin($class, $plugin);
}
break;
case $this::KIND_ALL:
- $plugin->init($this);
+ if (!$skip_init) $plugin->init($this);
$this->register_plugin($class, $plugin);
break;
}
}
}
- function load_data($force = false) {
+ function load_data() {
if ($this->owner_uid) {
$result = $this->dbh->query("SELECT name, content FROM ttrss_plugin_storage
WHERE owner_uid = '".$this->owner_uid."'");
function get_api_method($name) {
return $this->api_methods[$name];
}
+
+ function add_filter_action($sender, $action_name, $action_desc) {
+ $sender_class = get_class($sender);
+
+ if (!isset($this->plugin_actions[$sender_class]))
+ $this->plugin_actions[$sender_class] = array();
+
+ array_push($this->plugin_actions[$sender_class],
+ array("action" => $action_name, "description" => $action_desc, "sender" => $sender));
+ }
+
+ function get_filter_actions() {
+ return $this->plugin_actions;
+ }
}
-?>