aboutsummaryrefslogtreecommitdiff
path: root/documentation/examples/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/examples/plugins')
-rw-r--r--documentation/examples/plugins/README.txt5
-rw-r--r--documentation/examples/plugins/actions/.gitignore0
-rw-r--r--documentation/examples/plugins/languages/en.php24
-rw-r--r--documentation/examples/plugins/manifest.xml18
-rw-r--r--documentation/examples/plugins/start.php22
-rw-r--r--documentation/examples/plugins/views/default/.gitignore0
6 files changed, 69 insertions, 0 deletions
diff --git a/documentation/examples/plugins/README.txt b/documentation/examples/plugins/README.txt
new file mode 100644
index 000000000..704f56598
--- /dev/null
+++ b/documentation/examples/plugins/README.txt
@@ -0,0 +1,5 @@
+Plugin Skeleton
+=========================
+This directory includes a plugin skeleton to be used as the starting point when
+creating a new plugin. Just create a new directory in /mod/ and copy the files
+and directories into it. Then update the manifest and start coding. \ No newline at end of file
diff --git a/documentation/examples/plugins/actions/.gitignore b/documentation/examples/plugins/actions/.gitignore
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/documentation/examples/plugins/actions/.gitignore
diff --git a/documentation/examples/plugins/languages/en.php b/documentation/examples/plugins/languages/en.php
new file mode 100644
index 000000000..35f838560
--- /dev/null
+++ b/documentation/examples/plugins/languages/en.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * The core language file is in /languages/en.php and each plugin has its
+ * language files in a languages directory. To change a string, copy the
+ * mapping into this file.
+ *
+ * For example, to change the blog Tools menu item
+ * from "Blog" to "Rantings", copy this pair:
+ * 'blog' => "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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8">
+ <name>My Plugin</name>
+ <author>My Name</author>
+ <version>1.0</version>
+ <description>This is a description of my plugin and its features.</description>
+ <website>http://www.elgg.org/</website>
+ <copyright>(C) My Name or Company 2012</copyright>
+ <license>GNU General Public License version 2</license>
+
+ <requires>
+ <type>elgg_release</type>
+ <version>1.8</version>
+ </requires>
+
+ <category>communication</category>
+
+</plugin_manifest>
diff --git a/documentation/examples/plugins/start.php b/documentation/examples/plugins/start.php
new file mode 100644
index 000000000..3af50ce38
--- /dev/null
+++ b/documentation/examples/plugins/start.php
@@ -0,0 +1,22 @@
+<?php
+/**
+ * Describe plugin here
+ */
+
+elgg_register_event_handler('init', 'system', 'my_plugin_init');
+
+function my_plugin_init() {
+ // Rename this function based on the name of your plugin and update the
+ // elgg_register_event_handler() call accordingly
+
+ // Register a script to handle (usually) a POST request (an action)
+ $base_dir = elgg_get_plugins_path() . 'my_plugin/actions/my_plugin';
+ elgg_register_action('my_plugin', "$base_dir/my_action.php");
+
+ // Extend the main CSS file
+ elgg_extend_view('css/elgg', 'my_plugin/css');
+
+ // Add a menu item to the main site menu
+ $item = new ElggMenuItem('my_plugin', elgg_echo('my_plugin:menu'), 'my_url');
+ elgg_register_menu_item('site', $item);
+}
diff --git a/documentation/examples/plugins/views/default/.gitignore b/documentation/examples/plugins/views/default/.gitignore
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/documentation/examples/plugins/views/default/.gitignore