move example plugins to -contrib

master
Andrew Dolgov 11 years ago
parent d88922a5d3
commit 2c967d6023

@ -1,3 +0,0 @@
function example(value) {
alert("Value saved: " + value);
}

@ -1,85 +0,0 @@
<?php
class Example extends Plugin {
// Demonstrates how to add a separate panel to the preferences screen and inject Javascript/save data using Dojo forms.
private $host;
function about() {
return array(1.0,
"Example plugin #1",
"fox",
true,
"http://site.com");
}
function init($host) {
$this->host = $host;
$host->add_hook($host::HOOK_PREFS_TAB, $this);
}
function save() {
$example_value = db_escape_string($_POST["example_value"]);
$this->host->set($this, "example", $example_value);
echo "Value set to $example_value";
}
function get_prefs_js() {
return file_get_contents(dirname(__FILE__) . "/example.js");
}
function hook_prefs_tab($args) {
if ($args != "prefPrefs") return;
print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__("Example Pane")."\">";
print "<br/>";
// print_r($this->host->set($this, "example", rand(0,100)));
// print_r($this->host->get_all($this));
$value = $this->host->get($this, "example");
print "<form dojoType=\"dijit.form.Form\">";
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
evt.preventDefault();
if (this.validate()) {
console.log(dojo.objectToQuery(this.getValues()));
new Ajax.Request('backend.php', {
parameters: dojo.objectToQuery(this.getValues()),
onComplete: function(transport) {
notify_info(transport.responseText);
}
});
//this.reset();
}
</script>";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"save\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"example\">";
print "<table width=\"100%\" class=\"prefPrefsList\">";
print "<tr><td width=\"40%\">".__("Sample value")."</td>";
print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"example_value\" value=\"$value\"></td></tr>";
print "</table>";
print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".
__("Set value")."</button>";
print "</form>";
print "</div>"; #pane
}
function api_version() {
return 2;
}
}
?>

@ -1,34 +0,0 @@
<?php
class Example_Api extends Plugin {
// Demonstrates adding a method to the API
// Plugin methods return an array containint
// 1. status (STATUS_OK or STATUS_ERR)
// 2. arbitrary payload
private $host;
function about() {
return array(1.0,
"Example plugin adding an API method",
"fox",
true,
"http://tt-rss.org/");
}
function init($host) {
$this->host = $host;
$host->add_api_method("example_testmethod", $this);
}
function example_testmethod() {
return array(API::STATUS_OK, array("current_time" => time()));
}
function api_version() {
return 2;
}
}
?>

@ -1,34 +0,0 @@
<?php
class Example_Article extends Plugin {
private $host;
function about() {
return array(1.0,
"Example plugin for HOOK_RENDER_ARTICLE",
"fox",
true);
}
function init($host) {
$this->host = $host;
$host->add_hook($host::HOOK_RENDER_ARTICLE, $this);
}
function get_prefs_js() {
return file_get_contents(dirname(__FILE__) . "/init.js");
}
function hook_render_article($article) {
$article["content"] = "Content changed: " . $article["content"];
return $article;
}
function api_version() {
return 2;
}
}
?>

@ -1,32 +0,0 @@
<?php
class Example_Feed extends Plugin {
// Demonstrates how to query data from the parsed feed object (SimplePie)
// don't enable unless debugging feed through f D hotkey or manually.
private $host;
function about() {
return array(1.0,
"Example feed plugin",
"fox",
true);
}
function init($host) {
$this->host = $host;
$host->add_hook($host::HOOK_FEED_PARSED, $this);
}
function hook_feed_parsed($feed) {
_debug("I'm a little feed short and stout, here's my title: " . $feed->get_title());
_debug("... here's my link element: " . $feed->get_link());
}
function api_version() {
return 2;
}
}
?>

@ -1,56 +0,0 @@
<?php
class Example_Routing extends Plugin implements IHandler {
// Demonstrates adding a custom handler and method:
// backend.php?op=test&method=example
// and masking a system builtin public method:
// public.php?op=getUnread
// Plugin class must implelement IHandler interface and has
// a public method of same name as being registered.
//
// Any system method may be masked by plugins. You can mask
// entire handler by supplying "*" instead of a method name.
private $host;
function about() {
return array(1.0,
"Example routing plugin",
"fox",
true);
}
function init($host) {
$this->host = $host;
$host->add_handler("test", "example", $this);
$host->add_handler("public", "getunread", $this);
}
function getunread() {
print rand(0,100); # yeah right
}
function example() {
print "example method called";
}
function csrf_ignore($method) {
return true;
}
function before($method) {
return true;
}
function after() {
return true;
}
function api_version() {
return 2;
}
}
?>

@ -1,52 +0,0 @@
<?php
class Example_VFeed extends Plugin {
// Demonstrates how to create a dummy special feed and chain
// headline generation to queryFeedHeadlines();
// Not implemented yet: stuff for 3 panel mode
private $host;
private $dummy_id;
function about() {
return array(1.0,
"Example vfeed plugin",
"fox",
false);
}
function init($host) {
$this->host = $host;
$this->dummy_id = $host->add_feed(-1, 'Dummy feed', 'images/pub_set.svg', $this);
}
function get_unread($feed_id) {
return 1234;
}
function get_headlines($feed_id, $options) {
$qfh_ret = queryFeedHeadlines(-4,
$options['limit'],
$options['view_mode'], $options['cat_view'],
$options['search'],
$options['search_mode'],
$options['override_order'],
$options['offset'],
$options['owner_uid'],
$options['filter'],
$options['since_id'],
$options['include_children']);
$qfh_ret[1] = 'Dummy feed';
return $qfh_ret;
}
function api_version() {
return 2;
}
}
?>
Loading…
Cancel
Save