From 76bea966f7f93e719ccbf6e2350f647636d4da2a Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 12 Nov 2011 14:28:52 -0500 Subject: added better plugin skeleton and added documentation to some of the examples --- documentation/examples/actions/basic.php | 22 +++++ documentation/examples/actions/manual_tokens.php | 6 -- documentation/examples/events/advanced.php | 7 +- documentation/examples/events/all.php | 16 ++-- documentation/examples/events/basic.php | 14 ++-- documentation/examples/events/emit.php | 7 -- documentation/examples/events/trigger.php | 11 +++ documentation/examples/plugins/README.txt | 3 + documentation/examples/plugins/actions/.gitignore | 0 documentation/examples/plugins/languages/en.php | 24 ++++++ documentation/examples/plugins/manifest.xml | 18 ++++ .../examples/plugins/manifest_options/manifest.xml | 95 ---------------------- .../examples/plugins/skeleton/manifest.xml | 18 ---- documentation/examples/plugins/skeleton/start.php | 0 documentation/examples/plugins/start.php | 0 .../examples/plugins/views/default/.gitignore | 0 16 files changed, 103 insertions(+), 138 deletions(-) create mode 100644 documentation/examples/actions/basic.php delete mode 100644 documentation/examples/actions/manual_tokens.php delete mode 100644 documentation/examples/events/emit.php create mode 100644 documentation/examples/events/trigger.php create mode 100644 documentation/examples/plugins/README.txt create mode 100644 documentation/examples/plugins/actions/.gitignore create mode 100644 documentation/examples/plugins/languages/en.php create mode 100644 documentation/examples/plugins/manifest.xml delete mode 100644 documentation/examples/plugins/manifest_options/manifest.xml delete mode 100644 documentation/examples/plugins/skeleton/manifest.xml delete mode 100644 documentation/examples/plugins/skeleton/start.php create mode 100644 documentation/examples/plugins/start.php create mode 100644 documentation/examples/plugins/views/default/.gitignore (limited to 'documentation/examples') diff --git a/documentation/examples/actions/basic.php b/documentation/examples/actions/basic.php new file mode 100644 index 000000000..926e11b79 --- /dev/null +++ b/documentation/examples/actions/basic.php @@ -0,0 +1,22 @@ +annotate('rating', $rating); + +system_message(elgg_echo('rating:success')); +forward(REFERER); diff --git a/documentation/examples/actions/manual_tokens.php b/documentation/examples/actions/manual_tokens.php deleted file mode 100644 index 8dcf61fb1..000000000 --- a/documentation/examples/actions/manual_tokens.php +++ /dev/null @@ -1,6 +0,0 @@ -getSubtype(); + if ($object instanceof ElggObject) { + $subtype = $object->getSubtype(); - switch($subtype) { + switch ($subtype) { case 'blog': case 'thewire': case 'pages': + // prevent these object subtypes from being saved or changed return false; default: return true; @@ -21,4 +28,3 @@ function example_event_handler($event, $type, $params) { return true; } - diff --git a/documentation/examples/events/basic.php b/documentation/examples/events/basic.php index 91704e60b..ca2762344 100644 --- a/documentation/examples/events/basic.php +++ b/documentation/examples/events/basic.php @@ -1,13 +1,17 @@ "Blog", + * into the $mapping array so that it looks like: + * 'blog' => "Rantings", + * + * Follow this pattern for any other string you want to change. Make sure this + * plugin is lower in the plugin list than any plugin that it is modifying. + * + * If you want to add languages other than English, name the file according to + * the language's ISO 639-1 code: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes + */ + +$mapping = array( + 'string:here' => 'Display string here', +); + +add_translation('en', $mapping); diff --git a/documentation/examples/plugins/manifest.xml b/documentation/examples/plugins/manifest.xml new file mode 100644 index 000000000..e31624432 --- /dev/null +++ b/documentation/examples/plugins/manifest.xml @@ -0,0 +1,18 @@ + + + My Plugin + My Name + 1.0 + This is a description of my plugin and its features. + http://www.elgg.org/ + (C) My Name or Company 2012 + GNU General Public License version 2 + + + elgg_release + 1.8 + + + communication + + diff --git a/documentation/examples/plugins/manifest_options/manifest.xml b/documentation/examples/plugins/manifest_options/manifest.xml deleted file mode 100644 index baa6cc3fa..000000000 --- a/documentation/examples/plugins/manifest_options/manifest.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - My Plugin - Elgg - 1.0 - A concise description. - This is a longer, more interesting description of my plugin, its features, and other important information. - http://www.elgg.org/ - (C) Elgg 2011 - GNU General Public License version 2 - - - elgg_version - 2009030802 - - - - elgg_release - 1.8 - - - - An example screenshot - graphics/plugin_ss1.png - - - - Another screenshot - graphics/plugin_ss2.png - - - admin - api - - - php_extension - gd - - - - php_ini - short_open_tag - off - - - - php_extension - made_up - 1.0 - - - - plugin - fake_plugin - 1.0 - - - - plugin - profile - 1.0 - - - - plugin - profile_api - 1.3 - lt - - - - priority - after - blog - - - - plugin - profile_api - 1.0 - - - - plugin - profile_api - 1.3 - - - - php_extension - curl - 1.0 - - - diff --git a/documentation/examples/plugins/skeleton/manifest.xml b/documentation/examples/plugins/skeleton/manifest.xml deleted file mode 100644 index e31624432..000000000 --- a/documentation/examples/plugins/skeleton/manifest.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - My Plugin - My Name - 1.0 - This is a description of my plugin and its features. - http://www.elgg.org/ - (C) My Name or Company 2012 - GNU General Public License version 2 - - - elgg_release - 1.8 - - - communication - - diff --git a/documentation/examples/plugins/skeleton/start.php b/documentation/examples/plugins/skeleton/start.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/documentation/examples/plugins/start.php b/documentation/examples/plugins/start.php new file mode 100644 index 000000000..e69de29bb diff --git a/documentation/examples/plugins/views/default/.gitignore b/documentation/examples/plugins/views/default/.gitignore new file mode 100644 index 000000000..e69de29bb -- cgit v1.2.3