parent
3d2c9f5adf
commit
369dbc19d6
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class Plugin_Button {
|
||||
class Button {
|
||||
|
||||
protected $link;
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class Mail_Button extends Plugin_Button {
|
||||
class Button_Mail extends Button {
|
||||
function render($article_id) {
|
||||
return "<img src=\"".theme_image($link, 'images/art-email.png')."\"
|
||||
class='tagsPic' style=\"cursor : pointer\"
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class Note_Button extends Plugin_Button {
|
||||
class Button_Note extends Button {
|
||||
function render($article_id) {
|
||||
return "<img src=\"".theme_image($this->link, "images/art-pub-note.png")."\"
|
||||
style=\"cursor : pointer\" style=\"cursor : pointer\"
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class Share_Button extends Plugin_Button {
|
||||
class Button_Share extends Button {
|
||||
function render($article_id, $line) {
|
||||
return "<img src=\"".theme_image($this->link, 'images/art-share.png')."\"
|
||||
class='tagsPic' style=\"cursor : pointer\"
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class Tweet_Button extends Plugin_Button {
|
||||
class Button_Tweet extends Button {
|
||||
function render($article_id) {
|
||||
$rv = "<img src=\"".theme_image($this->link, 'images/art-tweet.png')."\"
|
||||
class='tagsPic' style=\"cursor : pointer\"
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class Protected_Handler extends Handler {
|
||||
class Handler_Protected extends Handler {
|
||||
|
||||
function before($method) {
|
||||
return parent::before($method) && $_SESSION['uid'];
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class Public_Handler extends Handler {
|
||||
class Handler_Public extends Handler {
|
||||
|
||||
private function generate_syndicated_feed($owner_uid, $feed, $is_cat,
|
||||
$limit, $search, $search_mode, $match_on, $view_mode = false) {
|
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
class Plugin {
|
||||
protected $link;
|
||||
protected $handler;
|
||||
|
||||
function __construct($link, $handler) {
|
||||
$this->link = $link;
|
||||
$this->handler = $handler;
|
||||
$this->initialize();
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
function add_listener($hook) {
|
||||
$this->handler->add_listener($hook, $this);
|
||||
}
|
||||
}
|
||||
?>
|
@ -0,0 +1,11 @@
|
||||
<?
|
||||
class Plugin_Example extends Plugin {
|
||||
function initialize() {
|
||||
$this->add_listener('article_before');
|
||||
}
|
||||
|
||||
function article_before(&$line) {
|
||||
$line["title"] = "EXAMPLE/REPLACED:" . $line["title"];
|
||||
}
|
||||
}
|
||||
?>
|
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
class Plugins {
|
||||
protected $link;
|
||||
protected $plugins;
|
||||
protected $listeners;
|
||||
|
||||
function __construct($link) {
|
||||
$this->link = $link;
|
||||
$this->listeners = array();
|
||||
$this->load_plugins();
|
||||
}
|
||||
|
||||
function load_plugins() {
|
||||
if (defined('_ENABLE_PLUGINS')) {
|
||||
$plugins = explode(",", _ENABLE_PLUGINS);
|
||||
|
||||
foreach ($plugins as $p) {
|
||||
$plugin_class = "plugin_$p";
|
||||
if (class_exists($plugin_class)) {
|
||||
$plugin = new $plugin_class($this->link, $this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function add_listener($hook_name, $plugin) {
|
||||
if (!is_array($this->listeners[$hook_name]))
|
||||
$this->listeners[$hook_name] = array();
|
||||
|
||||
array_push($this->listeners[$hook_name], $plugin);
|
||||
}
|
||||
|
||||
function hook($hook_name, &$params) {
|
||||
if (is_array($this->listeners[$hook_name])) {
|
||||
foreach ($this->listeners[$hook_name] as $p) {
|
||||
if (method_exists($p, $hook_name)) {
|
||||
$p->$hook_name($params);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class Pref_Feeds extends Protected_Handler {
|
||||
class Pref_Feeds extends Handler_Protected {
|
||||
|
||||
function csrf_ignore($method) {
|
||||
$csrf_ignored = array("index", "getfeedtree", "add", "editcats", "editfeed",
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class Pref_Filters extends Protected_Handler {
|
||||
class Pref_Filters extends Handler_Protected {
|
||||
|
||||
function csrf_ignore($method) {
|
||||
$csrf_ignored = array("index", "getfiltertree", "edit");
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class Pref_Instances extends Protected_Handler {
|
||||
class Pref_Instances extends Handler_Protected {
|
||||
|
||||
function csrf_ignore($method) {
|
||||
$csrf_ignored = array("index", "edit");
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class Pref_Labels extends Protected_Handler {
|
||||
class Pref_Labels extends Handler_Protected {
|
||||
|
||||
function csrf_ignore($method) {
|
||||
$csrf_ignored = array("index", "getlabeltree", "edit");
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class Pref_Prefs extends Protected_Handler {
|
||||
class Pref_Prefs extends Handler_Protected {
|
||||
|
||||
function csrf_ignore($method) {
|
||||
$csrf_ignored = array("index");
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class Pref_Users extends Protected_Handler {
|
||||
class Pref_Users extends Handler_Protected {
|
||||
function before($method) {
|
||||
if (parent::before($method)) {
|
||||
if ($_SESSION["access_level"] < 10) {
|
Loading…
Reference in New Issue