function __autoload($class) {
$class_file = str_replace("_", "/", strtolower(basename($class)));
- $file = dirname(__FILE__)."/../plugins/$class_file.php";
-
- if (file_exists($file)) {
- require $file;
- return;
- }
-
$file = dirname(__FILE__)."/../classes/$class_file.php";
if (file_exists($file)) {
ccache_update($link, $feed_id, $owner_uid);
}
- $result = db_query($link, "SELECT title,link,content,feed_id,comments,int_id,
+ $result = db_query($link, "SELECT id,title,link,content,feed_id,comments,int_id,
".SUBSTRING_FOR_DATE."(updated,1,16) as updated,
(SELECT icon_url FROM ttrss_feeds WHERE id = feed_id) as icon_url,
(SELECT site_url FROM ttrss_feeds WHERE id = feed_id) as site_url,
onclick=\"postOpenInNewTab(event, $id)\"
alt='Zoom' title='".__('Open article in new tab')."'>";
- $button_plugins = explode(",", ARTICLE_BUTTON_PLUGINS);
+ global $pluginhost;
- foreach ($button_plugins as $p) {
- $pclass = "button_" . trim($p);
-
- if (class_exists($pclass)) {
- $plugin = new $pclass($link);
- $rv['content'] .= $plugin->render($id, $line);
- }
+ foreach ($pluginhost->get_hooks($pluginhost::HOOK_ARTICLE_BUTTON) as $p) {
+ $rv['content'] .= $p->hook_article_button($line);
}
$rv['content'] .= "<img src=\"".theme_image($link, 'images/digest_checkbox.png')."\"
return $tag;
}
- // we need to placate idiots who don't know any better
function get_self_url_prefix() {
- return preg_replace("/\/$/", "", SELF_URL_PATH);
+ if (strrpos(SELF_URL_PATH, "/") === strlen(SELF_URL_PATH)-1) {
+ return substr(SELF_URL_PATH, 0, strlen(SELF_URL_PATH)-1);
+ } else {
+ return SELF_URL_PATH;
+ }
}
function opml_publish_url($link){
db_query($link, "SET NAMES " . MYSQL_CHARSET);
}
}
+
+ global $pluginhost;
+
+ $pluginhost = new PluginHost($link);
+ $pluginhost->load(PLUGINS);
+
return true;
} else {
print "Unable to connect to database:" . db_last_error();
return $rc;
}
+ function implements_interface($class, $interface) {
+ return in_array($interface, class_implements($class));
+ }
+
?>