aboutsummaryrefslogtreecommitdiff
path: root/documentation
diff options
context:
space:
mode:
Diffstat (limited to 'documentation')
-rw-r--r--documentation/coding_standards/best_practices.txt60
-rw-r--r--documentation/coding_standards/css_coding_standards.txt67
-rw-r--r--documentation/coding_standards/deprecation.txt36
-rw-r--r--documentation/coding_standards/html_best_practices.txt1
-rw-r--r--documentation/coding_standards/javascript_best_practices.txt1
-rw-r--r--documentation/coding_standards/javascript_coding_standards.txt13
-rw-r--r--documentation/coding_standards/php_best_practices.txt1
-rw-r--r--documentation/coding_standards/php_coding_standards.txt55
-rw-r--r--documentation/css/preview/forms.php220
-rw-r--r--documentation/css/preview/general.php70
-rw-r--r--documentation/css/preview/grid.php92
-rw-r--r--documentation/css/preview/head.php42
-rw-r--r--documentation/css/preview/icons.php41
-rw-r--r--documentation/css/preview/index.php23
-rw-r--r--documentation/css/preview/nav.php77
-rw-r--r--documentation/css/preview/objects.php84
-rw-r--r--documentation/css/preview/widgets.php63
-rw-r--r--documentation/examples/actions/basic.php22
-rw-r--r--documentation/examples/actions/manual_tokens.php6
-rw-r--r--documentation/examples/crontab.example28
-rw-r--r--documentation/examples/events/advanced.php9
-rw-r--r--documentation/examples/events/all.php16
-rw-r--r--documentation/examples/events/basic.php14
-rw-r--r--documentation/examples/events/emit.php7
-rw-r--r--documentation/examples/events/trigger.php11
-rw-r--r--documentation/examples/hooks/advanced.php28
-rw-r--r--documentation/examples/hooks/all.php (renamed from documentation/examples/hooks/register/all.php)4
-rw-r--r--documentation/examples/hooks/basic.php41
-rw-r--r--documentation/examples/hooks/register/advanced.php23
-rw-r--r--documentation/examples/hooks/register/basic.php14
-rw-r--r--documentation/examples/hooks/register/emit.php7
-rw-r--r--documentation/examples/hooks/trigger.php14
-rw-r--r--documentation/examples/hooks/trigger/advanced.php9
-rw-r--r--documentation/examples/hooks/trigger/basic.php9
-rw-r--r--documentation/examples/plugins/README.txt5
-rw-r--r--documentation/examples/plugins/actions/.gitignore (renamed from documentation/examples/events/basic.php.out)0
-rw-r--r--documentation/examples/plugins/languages/en.php24
-rw-r--r--documentation/examples/plugins/manifest.xml95
-rw-r--r--documentation/examples/plugins/start.php22
-rw-r--r--documentation/examples/plugins/views/default/.gitignore (renamed from documentation/examples/hooks/register/basic.php.out)0
-rw-r--r--documentation/info/config.php (renamed from documentation/stubs/config.php)8
-rw-r--r--documentation/info/manifest.xml98
42 files changed, 539 insertions, 921 deletions
diff --git a/documentation/coding_standards/best_practices.txt b/documentation/coding_standards/best_practices.txt
new file mode 100644
index 000000000..df04aa845
--- /dev/null
+++ b/documentation/coding_standards/best_practices.txt
@@ -0,0 +1,60 @@
+*** CODING BEST PRACTICES ***
+
+The following best practices make code easier to read, easier to maintain,
+and easier to debug. Consistent use of these guidelines means less guess
+work for developers, which means happier, more productive developers.
+
+* Adhere to "Don't Repeat Yourself" (DRY) principles of code design and
+ organization. If you are copy-and-pasting code YOU ARE DOING SOMETHING WRONG.
+ If you find a block of code that you want to use multiple times, make a
+ function. If you find views that are identical except for a single value,
+ pull it out into a generic view that takes an option.
+
+* Whitespace is free. Don't be afraid to use it to separate blocks of code.
+ Use a single space to separate function params and string concatenation.
+
+* Use self-documenting variable names. $group_guids is better than $array.
+
+* Use "positive" variable names. Prefer `$enable = true` to `$disable = false`.
+
+* Functions returning an array should return an empty array instead of FALSE
+ on no results.
+
+* Functions not throwing an exception on error should return FALSE upon
+ failure.
+
+* Functions returning only boolean should be prefaced with is_ or has_ (eg,
+ elgg_is_logged_in(), elgg_has_access_to_entity()).
+
+* Ternary syntax is acceptable for single-line, non-embedded statements.
+
+* Use comments effectively. Good comments describe the "why." Good code
+ describes the "how." Ex:
+ Not a very useful comment:
+
+ // increment $i only when the entity is marked as active.
+ foreach($entities as $entity) {
+ if ($entity->active == TRUE) {
+ $i++;
+ }
+ }
+
+ Useful comment:
+
+ // find the next index for inserting a new active entity.
+ foreach($entities as $entity) {
+ if ($entity->active == TRUE) {
+ $i++;
+ }
+ }
+
+* Use commit messages effectively. Be concise and meaningful. Ex:
+ Not meaningful:
+ Small fix to groups.
+
+ Meaningful:
+ Fixes #1234: Added missing ) that caused a WSOD on group profile page
+ when logged out.
+
+* Commit effectively: Err on the side of atomic commits. One revision with
+ many changes is scary.
diff --git a/documentation/coding_standards/css_coding_standards.txt b/documentation/coding_standards/css_coding_standards.txt
new file mode 100644
index 000000000..195ca345b
--- /dev/null
+++ b/documentation/coding_standards/css_coding_standards.txt
@@ -0,0 +1,67 @@
+*** CSS CODING STANDARDS ***
+
+* Use shorthand where possible:
+ Bad:
+ background-color: #333333;
+ background-image: url(...);
+ background-repeat: repeat-x;
+ background-position: left 10px;
+ padding: 2px 9px 2px 9px;
+
+ Good:
+ background: #333 url(...) repeat-x left 10px;
+ padding: 2px 9px;
+
+* Use hyphens as separators in classes/ids, not underscores:
+ Bad:
+ .example_class
+
+ Good:
+ .example-class
+
+* One property per line
+ Bad:
+ color: white;font-size: smaller;
+
+ Good:
+ color: white;
+ font-size: smaller;
+
+* Property declarations should be spaced like so: `property: value;`
+ Bad:
+ color:value;
+ color :value;
+ color : value;
+
+ Good:
+ color: value;
+
+* Group vendor-prefixes for the same property together:
+* Longest vendor-prefixed version first:
+* Always include non-vendor-prefixed version:
+* Put an extra newline between vendor-prefixed groups and other properties:
+ Bad:
+ -moz-border-radius: 5px;
+ border: 1px solid #999999;
+ -webkit-border-radius: 5px;
+ width: auto;
+
+ Good:
+ border: 1px solid #999999;
+
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+
+ width: auto;
+
+* Group declarations of subproperties:
+ Bad:
+ background-color: white;
+ color: #0054A7;
+ background-position: 2px -257px;
+
+ Good:
+ background-color: white;
+ background-position: 2px -257px;
+ color: #0054A7;
diff --git a/documentation/coding_standards/deprecation.txt b/documentation/coding_standards/deprecation.txt
new file mode 100644
index 000000000..370090138
--- /dev/null
+++ b/documentation/coding_standards/deprecation.txt
@@ -0,0 +1,36 @@
+*** DEPRECATING APIs ***
+
+Occasionally, functions and classes must be deprecated in favor of newer
+replacements. Since 3rd party plugin authors rely on a consistent API,
+backward compatibility must be maintained, but will not be maintained
+indefinitely as plugin authors are expected to properly update their
+plugins. In order to maintain backward compatibility, deprecated APIs will
+follow these guidelines:
+
+* Incompatible API changes cannot occur between bugfix versions
+ (1.6.0 - 1.6.1).
+
+* API changes between minor versions (1.6 - 1.7) must maintain backward
+ compatibility for at least 2 minor versions. (1.7 and 1.8. See
+ procedures, below.)
+
+* Bugfixes that change the API cannot be included in bugfix versions.
+
+* API changes between major versions (1.0 - 2.0) can occur without regard to
+ backward compatibility.
+
+The procedure for deprecating an API is as follows:
+
+* The first minor version (1.7) with a deprecated API must include a wrapper
+ function/class (or otherwise appropriate means) to maintain backward
+ compatibility, including any bugs in the original function/class.
+ This compatibility layer uses elgg_deprecated_notice('...', 1.7) to log
+ that the function is deprecated.
+
+* The second minor version (1.8) maintains the backward compatibility
+ layer, but elgg_deprecated_notice() will produce a visible warning.
+
+* The third minor version (1.9) removes the compatibility layer. Any use of
+ the deprecated API should be corrected before this.
+
+The general timeline for two minor releases is 8 to 12 months.
diff --git a/documentation/coding_standards/html_best_practices.txt b/documentation/coding_standards/html_best_practices.txt
new file mode 100644
index 000000000..ac2338a77
--- /dev/null
+++ b/documentation/coding_standards/html_best_practices.txt
@@ -0,0 +1 @@
+*** HTML BEST PRACTICES ***
diff --git a/documentation/coding_standards/javascript_best_practices.txt b/documentation/coding_standards/javascript_best_practices.txt
new file mode 100644
index 000000000..9ec1d0a19
--- /dev/null
+++ b/documentation/coding_standards/javascript_best_practices.txt
@@ -0,0 +1 @@
+*** JAVASCRIPT BEST PRACTICES ***
diff --git a/documentation/coding_standards/javascript_coding_standards.txt b/documentation/coding_standards/javascript_coding_standards.txt
new file mode 100644
index 000000000..9939e80ab
--- /dev/null
+++ b/documentation/coding_standards/javascript_coding_standards.txt
@@ -0,0 +1,13 @@
+*** JAVASCRIPT CODING STANDARDS ***
+
+* Same formatting standards as PHP.
+
+* All functions should be in the elgg namespace.
+
+* Function expressions should end with a semi-colon:
+
+ elgg.ui.toggles = function(event) {
+ event.preventDefault();
+ $(target).slideToggle('medium');
+ };
+
diff --git a/documentation/coding_standards/php_best_practices.txt b/documentation/coding_standards/php_best_practices.txt
new file mode 100644
index 000000000..9e4c63483
--- /dev/null
+++ b/documentation/coding_standards/php_best_practices.txt
@@ -0,0 +1 @@
+*** PHP BEST PRACTICES ***
diff --git a/documentation/coding_standards/php_coding_standards.txt b/documentation/coding_standards/php_coding_standards.txt
new file mode 100644
index 000000000..b7adc5dd9
--- /dev/null
+++ b/documentation/coding_standards/php_coding_standards.txt
@@ -0,0 +1,55 @@
+*** PHP CODING STANDARDS ***
+
+These are the coding standards for Elgg. All core development and bundled
+plugins are required to be in this format. Plugin developers are strongly
+encouraged to adopt these standards.
+
+* Unix line endings.
+
+* Hard tabs, 4 character tab spacing.
+
+* No PHP shortcut tags ( <? or <?= or <% ).
+
+* PHPDoc comments on functions and classes (all methods; declared properties
+ when appropriate).
+
+* Mandatory wrapped {}s around any code blocks.
+ Bad:
+ if (true)
+ foreach($arr as $elem)
+ echo $elem;
+
+ Good:
+ if (true) {
+ foreach ($arr as $elem) {
+ echo $elem;
+ }
+ }
+
+* Name standalone functions using underscore_character().
+
+* Name classes using CamelCase() and methods using lowerCamelCase().
+
+* Name globals and constants in ALL_CAPS (ACCESS_FRIENDS, $CONFIG).
+
+* Use underscores / camel case to separate standard English words in
+ functions, classes, and methods. (get_default_site(), ElggUser->isLoggedIn()).
+
+* Space functions like_this($required, $optional = TRUE).
+
+* Space keywords and constructs like this: if (FALSE) { ... }.
+
+* Correctly use spaces, quotes, and {}s in strings:
+ Bad (hard to read, misuse of quotes and {}s):
+ echo 'Hello, '.$name."! How is your {$time_of_day}?";
+
+ Good:
+ echo "Hello, $name! How is your $time_of_day?";
+
+* Line lengths should be reasonable. If you are writing lines over 100
+ characters on a line, please revise the code.
+
+* Use // or /* */ when commenting.
+
+* No closing PHP tag (?>) at EOF unless after a heredoc. (Avoids problems with
+ trailing whitespace. Required after heredoc by PHP.)
diff --git a/documentation/css/preview/forms.php b/documentation/css/preview/forms.php
deleted file mode 100644
index 89caf8e8b..000000000
--- a/documentation/css/preview/forms.php
+++ /dev/null
@@ -1,220 +0,0 @@
-<?php
-/**
- * Form CSS
- */
-
-$title = 'Forms and Buttons';
-
-require dirname(__FILE__) . '/head.php';
-
-$url = current_page_url();
-
-?>
-<body>
- <div class="elgg-page mal">
- <h1 class="mbs">
- <a href="index.php">Index</a> > <a href="<?php echo $url; ?>"><?php echo $title; ?></a>
- </h1>
- <div class="mbl">
- <a href="nav.php">< previous</a>&nbsp;&nbsp;<a href="objects.php">next ></a>
- </div>
- <h2>Form</h2>
- <form action="#">
- <fieldset>
- <legend>Form legend</legend>
- <p>
- <label for="f1">Text input:</label>
- <?php echo elgg_view('input/text', array(
- 'internalname' => 'f1',
- 'internalid' => 'f1',
- 'value' => 'input text',
- ));
- ?>
- </p>
- <p>
- <label for="f2">Password input:</label>
- <?php echo elgg_view('input/password', array(
- 'internalname' => 'f2',
- 'internalid' => 'f2',
- 'value' => 'password',
- ));
- ?>
- </p>
- <p>
- <label for="f3">Radio input:</label><br />
- <?php echo elgg_view('input/radio', array(
- 'internalname' => 'f3',
- 'internalid' => 'f3',
- 'options' => array(1, 2),
- ));
- ?>
- </p>
- <p>
- <label for="f4">Checkboxes input:</label><br />
- <?php echo elgg_view('input/checkboxes', array(
- 'internalname' => 'f4',
- 'internalid' => 'f4',
- 'options' => array(1, 2),
- ));
- ?>
- </p>
- <p>
- <label for="f5">Dropdown input:</label><br />
- <?php echo elgg_view('input/dropdown', array(
- 'internalname' => 'f5',
- 'internalid' => 'f5',
- 'options' => array('option 1', 'option 2'),
- ));
- ?>
- </p>
- <p>
- <label for="f6">Access input:</label>
- <?php echo elgg_view('input/access', array(
- 'internalname' => 'f6',
- 'internalid' => 'f6',
- 'value' => ACCESS_PUBLIC,
- ));
- ?>
- </p>
- <p>
- <label for="f7">File input:</label>
- <?php echo elgg_view('input/file', array(
- 'internalname' => 'f7',
- 'internalid' => 'f7',
- ));
- ?>
- </p>
- <p>
- <label for="f8">URL input:</label>
- <?php echo elgg_view('input/url', array(
- 'internalname' => 'f8',
- 'internalid' => 'f8',
- 'value' => 'http://elgg.org/',
- ));
- ?>
- </p>
- <p>
- <label for="f9">Tags input:</label>
- <?php echo elgg_view('input/tags', array(
- 'internalname' => 'f9',
- 'internalid' => 'f9',
- 'value' => 'one, two, three',
- ));
- ?>
- </p>
- <p>
- <label for="f10">Email input:</label>
- <?php echo elgg_view('input/email', array(
- 'internalname' => 'f10',
- 'internalid' => 'f10',
- 'value' => 'noone@elgg.org',
- ));
- ?>
- </p>
- <p>
- <label for="f11">Autocomplete input:</label>
- <?php echo elgg_view('input/autocomplete', array(
- 'internalname' => 'f11',
- 'internalid' => 'f11',
- 'match_on' => 'users',
- ));
- ?>
- </p>
- <p>
- <label for="f12">Date picker input:</label>
- <?php echo elgg_view('input/datepicker', array(
- 'internalname' => 'f12',
- 'internalid' => 'f12',
- ));
- ?>
- </p>
- <p>
- <label for="f13">User picker input:</label>
- <?php echo elgg_view('input/userpicker', array(
- 'internalname' => 'f13',
- 'internalid' => 'f13',
- ));
- ?>
- </p>
- <p>
- <label for="f14">Long text input:</label>
- <?php echo elgg_view('input/longtext', array(
- 'internalname' => 'f14',
- 'internalid' => 'f14',
- 'value' => $ipsum,
- ));
- ?>
- </p>
- <p>
- <label for="f15">Plain text input:</label>
- <?php echo elgg_view('input/plaintext', array(
- 'internalname' => 'f15',
- 'internalid' => 'f15',
- 'value' => $ipsum,
- ));
- ?>
- </p>
- </fieldset>
- </form>
-
- <div class="mtl">
- <h2>Buttons</h2>
- <p>
- <?php echo elgg_view('input/submit', array(
- 'internalname' => 'b1',
- 'value' => 'input[type=submit]',
- ));
- ?>
- </p>
- <p>
- <?php echo elgg_view('output/url', array(
- 'href' => "$url#",
- 'text' => 'a.elgg-submit-button',
- 'class' => 'elgg-button elgg-submit-button',
- ));
- ?>
- </p>
- <p>
- <?php echo elgg_view('output/url', array(
- 'href' => "$url#",
- 'text' => 'submit button disabled',
- 'class' => 'elgg-button elgg-submit-button disabled',
- ));
- ?>
- </p>
- <p>
- <?php echo elgg_view('input/button', array(
- 'internalname' => 'b3',
- 'value' => 'input[type=button]',
- ));
- ?>
- </p>
- <p>
- <?php echo elgg_view('output/url', array(
- 'href' => "$url#",
- 'text' => 'a.elgg-cancel-button',
- 'class' => 'elgg-button elgg-cancel-button',
- ));
- ?>
- </p>
- <p>
- <?php echo elgg_view('output/url', array(
- 'href' => "$url#",
- 'text' => 'a.elgg-action-button',
- 'class' => 'elgg-action-button',
- ));
- ?>
- </p>
- <p>
- <?php echo elgg_view('output/url', array(
- 'href' => "$url#",
- 'text' => 'action button disabled',
- 'class' => 'elgg-action-button disabled',
- ));
- ?>
- </p>
- </div>
-
- </div>
-</body>
-</html> \ No newline at end of file
diff --git a/documentation/css/preview/general.php b/documentation/css/preview/general.php
deleted file mode 100644
index 3e8d2f6e9..000000000
--- a/documentation/css/preview/general.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-/**
- * General CSS
- */
-
-$title = 'General CSS';
-
-require dirname(__FILE__) . '/head.php';
-
-$url = current_page_url();
-
-?>
-<body>
- <div class="elgg-page mal">
- <h1 class="mbs">
- <a href="index.php">Index</a> > <a href="<?php echo $url; ?>"><?php echo $title; ?></a>
- </h1>
- <div class="mbl">
- < previous&nbsp;&nbsp;<a href="nav.php">next ></a>
- </div>
- <h2>Headings</h2>
- <div class="mbl">
- <h1>Level 1 heading</h1>
- <h2>Level 2 heading</h2>
- <h3>Level 3 heading</h3>
- <h4>Level 4 heading</h4>
- <h5>Level 5 heading</h5>
- <h6>Level 6 heading</h6>
- </div>
- <h2>Paragraph</h2>
- <div class="mbl">
- <p>Lorem ipsum dolor sit amet, <a href="#" title="test link">test link</a>
- adipiscing elit. Nullam dignissim convallis est. Quisque aliquam. Donec
- faucibus. Nunc iaculis suscipit dui. Nam sit amet sem. Aliquam libero
- nisi, imperdiet at, tincidunt nec, gravida vehicula, nisl. Praesent
- mattis, massa quis luctus fermentum, turpis mi volutpat justo, eu
- volutpat enim diam eget metus. Maecenas ornare tortor. Donec sed tellus
- eget sapien fringilla nonummy. Mauris a ante. Suspendisse quam sem,
- consequat at, commodo vitae, feugiat in, nunc. Morbi imperdiet augue
- quis tellus.</p>
-
- <p>Lorem ipsum dolor sit amet, <em>emphasis</em>
- consectetuer
- adipiscing elit. Nullam dignissim convallis est. Quisque aliquam. Donec
- faucibus. Nunc iaculis suscipit dui. Nam sit amet sem. Aliquam libero
- nisi, imperdiet at, tincidunt nec, gravida vehicula, nisl. Praesent
- mattis, massa quis luctus fermentum, turpis mi volutpat justo, eu
- volutpat enim diam eget metus. Maecenas ornare tortor. Donec sed tellus
- eget sapien fringilla nonummy. Mauris a ante. Suspendisse quam sem,
- consequat at, commodo vitae, feugiat in, nunc. Morbi imperdiet augue
- quis tellus.</p>
- </div>
- <h2>Misc</h2>
- <p>
- I am <a href="?abc123">the a tag</a> example<br />
- I am <abbr title="test">the abbr tag</abbr> example<br />
- I am <acronym>the acronym tag</acronym> example<br />
- I am <b>the b tag</b> example<br />
- I am <code>the code tag</code> example<br />
- I am <del>the del tag</del> example<br />
- I am <em>the em tag</em> example<br />
- I am <i>the i tag</i> example<br />
- I am <strong>the strong tag</strong> example<br />
- </p>
- <blockquote><p>Paragraph inside Blockquote: <?php echo $ipsum; ?></p></blockquote>
- <pre><strong>Preformated:</strong>Testing one row
- and another</pre>
- </div>
-</body>
-</html> \ No newline at end of file
diff --git a/documentation/css/preview/grid.php b/documentation/css/preview/grid.php
deleted file mode 100644
index bf20804f8..000000000
--- a/documentation/css/preview/grid.php
+++ /dev/null
@@ -1,92 +0,0 @@
-<?php
-/**
- * Grid CSS
- */
-
-$title = 'Grid';
-
-require dirname(__FILE__) . '/head.php';
-
-$url = current_page_url();
-
-?>
-<body>
- <div class="elgg-page mal">
- <h1 class="mbs">
- <a href="index.php">Index</a> > <a href="<?php echo $url; ?>"><?php echo $title; ?></a>
- </h1>
- <div class="mbl">
- <a href="objects.php">< previous</a>&nbsp;&nbsp;<a href="widgets.php">next ></a>
- </div>
-<style>
-h3 {text-align: center;}
-.preview-outline {border: 1px solid #cccccc; padding: 5px;}
-</style>
-
-<div class="elgg-col elgg-col-1of5">
- <div class="preview-outline">
- <h3>1/5</h3>
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
- </div>
-</div>
-<div class="elgg-col elgg-col-3of5">
- <div class="preview-outline clearfix">
- <h3>3/5</h3>
- <div class="elgg-col elgg-col-1of2">
- <div class="preview-outline">
- <h3>1/2</h3>
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
- </div>
- </div>
- <div class="elgg-col elgg-col-1of2">
- <div class="preview-outline">
- <h3>1/2</h3>
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
- </div>
- </div>
- <div class="elgg-col elgg-col-1of3">
- <div class="preview-outline">
- <h3>1/3</h3>
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
- </div>
- </div>
- <div class="elgg-col elgg-col-2of3">
- <div class="preview-outline">
- <h3>2/3</h3>
- <div class="elgg-col elgg-col-1of2">
- <div class="preview-outline">
- <h3>1/2</h3>
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
- </div>
- </div>
- <div class="elgg-col elgg-col-1of2">
- <div class="preview-outline">
- <h3>1/2</h3>
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
- </div>
- </div>
- <div class="elgg-col elgg-col-1of1">
- <div class="preview-outline">
- <h3>1</h3>
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
- </div>
- </div>
- </div>
- </div>
- </div>
-</div>
-<div class="elgg-col elgg-col-1of5 elgg-col-last">
- <div class="preview-outline">
- <h3>1/5</h3>
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
- </div>
-</div>
-
- </div>
-</body>
-</html> \ No newline at end of file
diff --git a/documentation/css/preview/head.php b/documentation/css/preview/head.php
deleted file mode 100644
index 360f56647..000000000
--- a/documentation/css/preview/head.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-/**
- * head of the preview pages
- */
-require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php");
-
-$ipsum = "Sed scelerisque sagittis lorem. Phasellus sodales. Nulla urna justo, vehicula in, suscipit nec, molestie sed, tellus.";
-
-$screen = elgg_view_get_simplecache_url('css', 'screen');
-$ie_url = elgg_view_get_simplecache_url('css', 'ie');
-$ie6_url = elgg_view_get_simplecache_url('css', 'ie6');
-
-$base = elgg_get_site_url();
-elgg_register_js("{$base}vendors/jquery/jquery-1.4.2.min.js", 'jquery');
-elgg_register_js("{$base}vendors/jquery/jquery-ui-1.7.2.min.js", 'jquery-ui');
-elgg_register_js("{$base}vendors/jquery/jquery.form.js", 'jquery.form');
-
-// Set the content type
-header("Content-type: text/html; charset=UTF-8");
-
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title><?php echo $title; ?></title>
- <link rel="stylesheet" href="<?php echo $screen; ?>" type="text/css" />
- <!--[if IE 6]>
- <link rel="stylesheet" type="text/css" href="<?php echo $ie_url; ?>" />
- <![endif]-->
-
- <!--[if gt IE 6]>
- <link rel="stylesheet" type="text/css" href="<?php echo $ie6_url; ?>" />
- <![endif]-->
-<?php
-foreach (elgg_get_js() as $script) {
-?>
- <script type="text/javascript" src="<?php echo $script; ?>"></script>
-<?php
-}
-?>
-</head>
diff --git a/documentation/css/preview/icons.php b/documentation/css/preview/icons.php
deleted file mode 100644
index 2a3a9bb7e..000000000
--- a/documentation/css/preview/icons.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/**
- * Icons CSS
- */
-
-$title = 'Icons';
-
-require dirname(__FILE__) . '/head.php';
-
-$url = current_page_url();
-
-?>
-<style>li {margin: 10px; float: left;} ul {background-color: #e0e0e0;}</style>
-<body>
- <div class="elgg-page mal">
- <h1 class="mbs">
- <a href="index.php">Index</a> > <a href="<?php echo $url; ?>"><?php echo $title; ?></a>
- </h1>
- <div class="mbl">
- <a href="widgets.php">< previous</a>&nbsp;&nbsp;next >
- </div>
- <h2>Icon Sprites</h2>
- <ul class="mbl clearfix">
- <li><span class="elgg-icon elgg-icon-settings"></span>Settings</li>
- <li><span class="elgg-icon elgg-icon-friends"></span>Friends</li>
- <li><span class="elgg-icon elgg-icon-help"></span>Help</li>
- <li><span class="elgg-icon elgg-icon-delete"></span>Delete</li>
- <li><span class="elgg-icon elgg-icon-likes"></span>Likes</li>
- <li><span class="elgg-icon elgg-icon-liked"></span>Liked</li>
- <li><span class="elgg-icon elgg-icon-following"></span>Following</li>
- <li><span class="elgg-icon elgg-icon-rss"></span>RSS</li>
- <li><span class="elgg-icon elgg-icon-arrow-s"></span>Arrow S</li>
- <li><span class="elgg-icon elgg-icon-hover-menu"></span>Hover Menu</li>
- </ul>
- <h2>Ajax loader</h2>
- <div class="mbl">
- <?php echo elgg_view('graphics/ajax_loader', array('hidden' => false)); ?>
- </div>
- </div>
-</body>
-</html> \ No newline at end of file
diff --git a/documentation/css/preview/index.php b/documentation/css/preview/index.php
deleted file mode 100644
index ce71d28df..000000000
--- a/documentation/css/preview/index.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-/**
- * Main index page
- */
-
-include dirname(__FILE__) . '/head.php';
-
-?>
-<body>
- <div class="elgg-page mal">
- <h1 class="mbl"><a href="index.php">Index</a></h1>
- <ul class="mtl">
- <li><a href="general.php">General CSS</a></li>
- <li><a href="nav.php">Navigation CSS</a></li>
- <li><a href="forms.php">Form CSS</a></li>
- <li><a href="objects.php">Lists, modules, image blocks CSS</a></li>
- <li><a href="grid.php">Grid CSS</a></li>
- <li><a href="widgets.php">Widgets CSS</a></li>
- <li><a href="icons.php">Icons CSS</a></li>
- </ul>
- </div>
-</body>
-</html> \ No newline at end of file
diff --git a/documentation/css/preview/nav.php b/documentation/css/preview/nav.php
deleted file mode 100644
index 3a9daea98..000000000
--- a/documentation/css/preview/nav.php
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-/**
- * Navigation CSS
- */
-
-$title = 'Navigation';
-
-require dirname(__FILE__) . '/head.php';
-
-$url = current_page_url();
-
-elgg_push_breadcrumb('First', "$url#");
-elgg_push_breadcrumb('Second', "$url#");
-elgg_push_breadcrumb('Third');
-
-?>
-<body>
- <div class="elgg-page mal">
- <h1 class="mbs">
- <a href="index.php">Index</a> > <a href="<?php echo $url; ?>"><?php echo $title; ?></a>
- </h1>
- <div class="mbl">
- <a href="general.php">< previous</a>&nbsp;&nbsp;<a href="forms.php">next ></a>
- </div>
- <h2>Breadcrumbs</h2>
- <div class="mbl">
- <?php echo elgg_view('navigation/breadcrumbs'); ?>
- </div>
- <h2>Tabs</h2>
- <div class="mbl">
- <?php
- $tabs = array(
- array('title' => 'First', 'url' => "$url#"),
- array('title' => 'Second', 'url' => "$url#", 'selected' => true),
- array('title' => 'Third', 'url' => "$url#"),
- );
- echo elgg_view('navigation/tabs', array('tabs' => $tabs));
- ?>
- </div>
- <h2>Pagination</h2>
- <div class="mbl">
- <?php
- $params = array(
- 'count' => 1000,
- 'limit' => 10,
- 'offset' => 230,
- );
- echo elgg_view('navigation/pagination', $params);
- ?>
- </div>
- <h2>Site Menu</h2>
- <div class="mbl">
- <div class="elgg-page-header" style="height: 40px;">
- <?php
- $params = array();
- $params['menu'] = array();
- $params['menu']['default'] = array();
- for ($i=1; $i<=5; $i++) {
- $params['menu']['default'][] = new ElggMenuItem($i, "Page $i", "$url#");
- }
- $params['menu']['default'][2]->setSelected(true);
- echo elgg_view('navigation/menu/site', $params);
- ?>
- </div>
- </div>
- <h2>Page Menu</h2>
- <div class="mbl pam" style="width: 200px; background-color: #cccccc;">
- <?php
- $m = new ElggMenuItem(10, "Child", "$url#");
- $m->setParent($params['menu']['default'][1]);
- $params['menu']['default'][1]->addChild($m);
- echo elgg_view('navigation/menu/page', $params);
- ?>
- </div>
- </div>
-</body>
-</html> \ No newline at end of file
diff --git a/documentation/css/preview/objects.php b/documentation/css/preview/objects.php
deleted file mode 100644
index f90009cab..000000000
--- a/documentation/css/preview/objects.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-/**
- * CSS Objects: list, module, image_block
- */
-
-$title = 'CSS Objects';
-
-require dirname(__FILE__) . '/head.php';
-
-$url = current_page_url();
-
-?>
-<body>
- <div class="elgg-page mal">
- <h1 class="mbs">
- <a href="index.php">Index</a> > <a href="<?php echo $url; ?>"><?php echo $title; ?></a>
- </h1>
- <div class="mbl">
- <a href="forms.php">< previous</a>&nbsp;&nbsp;<a href="grid.php">next ></a>
- </div>
- <h2>Modules</h2>
- <div class="mbl clearfix">
- <div class="elgg-col elgg-col-1of2">
- <div class="pam">
- <?php
- echo elgg_view('layout/objects/module', array(
- 'title' => 'elgg-aside-module',
- 'body' => $ipsum,
- 'class' => 'elgg-aside-module',
- ));
- ?>
- <?php
- echo elgg_view('layout/objects/module', array(
- 'title' => 'elgg-popup-module',
- 'body' => $ipsum,
- 'class' => 'elgg-popup-module',
- ));
- ?>
- </div>
- </div>
- <div class="elgg-col elgg-col-1of2">
- <div class="pam">
- <?php
- echo elgg_view('layout/objects/module', array(
- 'title' => 'elgg-group-module',
- 'body' => $ipsum,
- 'class' => 'elgg-group-module',
- ));
- ?>
- </div>
- <div class="pam">
- <?php
- echo elgg_view('layout/objects/module', array(
- 'title' => 'elgg-info-module',
- 'body' => $ipsum,
- 'class' => 'elgg-info-module',
- ));
- ?>
- </div>
- </div>
- </div>
- <h2>Image Block</h2>
- <div class="mbl clearfix">
- <?php
- $src = elgg_view('icon/user/default/small');
- $image = "<img src=\"$src\" />";
- echo elgg_view_image_block($image, $ipsum);
- ?>
- </div>
- <h2>List</h2>
- <div class="mbl clearfix">
- <?php
- $obj1 = new ElggObject();
- $obj1->title = "Object 1";
- $obj1->description = $ipsum;
- $obj2 = new ElggObject();
- $obj2->title = "Object 2";
- $obj2->description = $ipsum;
- echo elgg_view('layout/objects/list', array('items' => array($obj1, $obj2)));
- ?>
- </div>
- </div>
-</body>
-</html> \ No newline at end of file
diff --git a/documentation/css/preview/widgets.php b/documentation/css/preview/widgets.php
deleted file mode 100644
index ca45132df..000000000
--- a/documentation/css/preview/widgets.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-/**
- * Widgets CSS
- */
-
-$title = 'Widgets';
-
-require dirname(__FILE__) . '/head.php';
-
-$url = current_page_url();
-
-elgg_register_plugin_hook_handler('view', 'widgets/friends/content', 'css_widget_content');
-elgg_register_plugin_hook_handler('view', 'widgets/friends/edit', 'css_widget_content');
-elgg_register_plugin_hook_handler('permissions_check', 'all', 'css_permissions_override');
-
-function css_widget_content() {
- global $ipsum;
- return $ipsum;
-}
-
-function css_permissions_override() {
- return true;
-}
-
-
-?>
-<body>
- <div class="elgg-page mal">
- <h1 class="mbs">
- <a href="index.php">Index</a> > <a href="<?php echo $url; ?>"><?php echo $title; ?></a>
- </h1>
- <div class="mbl">
- <a href="grid.php">< previous</a>&nbsp;&nbsp;<a href="icons.php">next ></a>
- </div>
-<?php
-$w = array();
-for ($i=1; $i<=6; $i++) {
- $obj = new ElggWidget();
- $obj->handler = 'friends';
- $obj->title = "Widget $i";
- $w[] = $obj;
-}
-$column1 = array($w[0], $w[1]);
-$column2 = array($w[2], $w[3]);
-$column3 = array($w[4], $w[5]);
-$widgets = array(1 => $column1, 2 => $column2, 3 => $column3);
-$num_columns = 3;
-$widget_class = "elgg-col-1of{$num_columns}";
-for ($column_index = 1; $column_index <= $num_columns; $column_index++) {
- $column_widgets = $widgets[$column_index];
-
- echo "<div class=\"$widget_class elgg-widgets\" id=\"elgg-widget-col-$column_index\">";
- if (is_array($column_widgets) && sizeof($column_widgets) > 0) {
- foreach ($column_widgets as $widget) {
- echo elgg_view_entity($widget);
- }
- }
- echo '</div>';
-}
-?>
- </div>
-</body>
-</html> \ No newline at end of file
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 @@
+<?php
+/**
+ * Demonstrates adding an annotation through an action
+ *
+ * This action adds a rating annotation to an entity. If this was coming from
+ * a five-star rating tool, the rating would be a number between 0 and 5. The
+ * GUID of the entity being rating is also submitted to the action.
+ */
+
+$rating = get_input('rating');
+$guid = get_input('guid');
+
+$entity = get_entity($guid);
+if (!$entity) {
+ register_error(elgg_echo('rating:failure'));
+ forward(REFERER);
+}
+
+$entity->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 @@
-<?php
-
-$ts = time();
-$token = generate_action_token($ts);
-
-var_dump($ts, $token);
diff --git a/documentation/examples/crontab.example b/documentation/examples/crontab.example
new file mode 100644
index 000000000..f25f5cb07
--- /dev/null
+++ b/documentation/examples/crontab.example
@@ -0,0 +1,28 @@
+# Crontab example.
+#
+# This file is an example of triggering Elgg cron events. It hits a URL to
+# trigger the events. For testing, you can simulate the cronjob by loading the
+# URL in a browser.
+#
+# See http://docs.elgg.org/wiki/Cron for more information
+#
+# @author Marcus Povey
+
+# Location of GET (see: http://docs.elgg.org/wiki/What_is_get)
+GET='/usr/bin/GET'
+
+# Location of your site (don't forget the trailing slash!)
+ELGG='http://www.example.com/'
+
+# The crontab
+# Don't edit below this line unless you know what you are doing
+@reboot $GET ${ELGG}cron/reboot/
+* * * * * $GET ${ELGG}cron/minute/
+*/5 * * * * $GET ${ELGG}cron/fiveminute/
+15,30,45,59 * * * * $GET ${ELGG}cron/fifteenmin/
+30,59 * * * * $GET ${ELGG}cron/halfhour/
+@hourly $GET ${ELGG}cron/hourly/
+@daily $GET ${ELGG}cron/daily/
+@weekly $GET ${ELGG}cron/weekly/
+@monthly $GET ${ELGG}cron/monthly/
+@yearly $GET ${ELGG}cron/yearly/
diff --git a/documentation/examples/events/advanced.php b/documentation/examples/events/advanced.php
index f566e0006..73edea9da 100644
--- a/documentation/examples/events/advanced.php
+++ b/documentation/examples/events/advanced.php
@@ -1,10 +1,13 @@
<?php
+/**
+ * This snippets demonstrates how returning false changes the normal operation
+ * of Elgg.
+ */
elgg_register_event_handler('create', 'object', 'example_event_handler');
-function example_event_handler($event, $type, $params) {
+function example_event_handler($event, $type, $object) {
// Don't allow any non-admin users to create objects
// Returning false from this function will halt the creation of the object.
- return isadminloggedin();
+ return elgg_is_admin_logged_in();
}
-
diff --git a/documentation/examples/events/all.php b/documentation/examples/events/all.php
index 238178312..0ad02c1d4 100644
--- a/documentation/examples/events/all.php
+++ b/documentation/examples/events/all.php
@@ -1,17 +1,24 @@
<?php
+/**
+ * If you register an 'all' string for the event name, the handler function will
+ * be called for all events with that name, regardless of event type. The same
+ * can be done for the event type argument. Registering 'all' for both
+ * argyuments results in a handler being called for every event.
+ */
elgg_register_event_handler('all', 'object', 'example_event_handler');
// This function will be called for any event of type 'object'
-function example_event_handler($event, $type, $params) {
+function example_event_handler($event, $type, $object) {
// check what sort of object is passed
- if ($params instanceof ElggObject) {
- $subtype = $params->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 @@
<?php
+/**
+ * This snippet demonstrates how to register for an event. It dumps the
+ * parameters that the handler receives to the screen. The third argument
+ * of the handler function is an object that is related to the event. For
+ * the 'init', 'system' eveny, it is null.
+ */
elgg_register_event_handler('init', 'system', 'example_event_handler');
-function example_event_handler($event, $type, $params) {
+function example_event_handler($event, $type, $object) {
var_dump($event);
- var_dump($object_type);
- var_dump($params);
+ var_dump($type);
+ var_dump($object);
return true;
}
-
-
diff --git a/documentation/examples/events/emit.php b/documentation/examples/events/emit.php
deleted file mode 100644
index b917c6dc0..000000000
--- a/documentation/examples/events/emit.php
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-
-$params = new ElggObject();
-elgg_trigger_event('test', 'example', $params);
-
-// handlers would be registered by saying
-elgg_register_event_handler('test', 'example', 'example_event_handler');
diff --git a/documentation/examples/events/trigger.php b/documentation/examples/events/trigger.php
new file mode 100644
index 000000000..6ce3a76f0
--- /dev/null
+++ b/documentation/examples/events/trigger.php
@@ -0,0 +1,11 @@
+<?php
+/**
+ * These two snippets demonstrates triggering an event and how to register for
+ * that event.
+ */
+
+$object = new ElggObject();
+elgg_trigger_event('test', 'example', $object);
+
+// elsewhere a handler could be registered by saying
+elgg_register_event_handler('test', 'example', 'example_event_handler');
diff --git a/documentation/examples/hooks/advanced.php b/documentation/examples/hooks/advanced.php
new file mode 100644
index 000000000..ca036c46a
--- /dev/null
+++ b/documentation/examples/hooks/advanced.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * This snippet demonstrates how to change the value of a hook. The content
+ * passed into the hook is 'This is some Sample Content.'. After the two hook
+ * handlers are done, the new content is 'This is some $@mple Content.'.
+ */
+
+// the output:page hook is triggered by elgg_view_page().
+elgg_register_plugin_hook_handler('output', 'page', 'example_plugin_hook_handler', 600);
+elgg_register_plugin_hook_handler('output', 'page', 'example_plugin_hook_handler_2', 601);
+
+function example_plugin_hook_handler($hook, $type, $value, $params) {
+ // change a to @
+ $value = str_replace('a', '@', $value);
+
+ return $value;
+}
+
+function example_plugin_hook_handler_2($hook, $type, $value, $params) {
+ // change S to $
+ $value = str_replace('S', '$', $value);
+
+ return $value;
+}
+
+$content = 'This is some Sample Content.';
+
+echo elgg_view_page('Title', $content);
diff --git a/documentation/examples/hooks/register/all.php b/documentation/examples/hooks/all.php
index 0ff19bc86..76b562335 100644
--- a/documentation/examples/hooks/register/all.php
+++ b/documentation/examples/hooks/all.php
@@ -1,4 +1,8 @@
<?php
+/**
+ * This snippet demonstrates how to register for multiple hooks with the same
+ * type.
+ */
elgg_register_plugin_hook_handler('all', 'system', 'example_plugin_hook_handler');
diff --git a/documentation/examples/hooks/basic.php b/documentation/examples/hooks/basic.php
index 71076ee96..734d9e884 100644
--- a/documentation/examples/hooks/basic.php
+++ b/documentation/examples/hooks/basic.php
@@ -1,34 +1,17 @@
<?php
+/**
+ * The handler for a plugin hook receives information about the hook (name and
+ * type), the current value for the hook, and parameters related to the hook.
+ */
-elgg_register_plugin_hook_handler('get_items', 'example', 'example_plugin_hook');
-elgg_register_plugin_hook_handler('get_items', 'example', 'example_plugin_hook_2');
+elgg_register_plugin_hook_handler('forward', '404', 'example_plugin_hook_handler');
-$params = array('username' => 'Joe');
-$items = elgg_trigger_plugin_hook('get_items', 'example', $params, $default);
+function example_plugin_hook_handler($hook, $type, $value, $params) {
+ var_dump($hook);
+ var_dump($type);
+ var_dump($value);
+ var_dump($params);
-var_dump($items);
-
-function example_plugin_hook($hook, $type, $value, $params) {
- if (is_array($value)) {
- $value[] = "Hook Value 1";
- $value[] = "Hook Value 2";
- }
-
- return $value;
-}
-
-function example_plugin_hook_2($hook, $type, $value, $params) {
- $username = isset($params['username']) ? $params['username'] : NULL;
- if (is_array($value)) {
- switch($username) {
- case 'Joe':
- $value[] = "Joe's item";
- break;
- case 'John':
- $value[] = "Joe's item";
- break;
- }
- }
-
- return $value;
+ // we are not changing $value so return null
+ return null;
}
diff --git a/documentation/examples/hooks/register/advanced.php b/documentation/examples/hooks/register/advanced.php
deleted file mode 100644
index e3951c19c..000000000
--- a/documentation/examples/hooks/register/advanced.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-// the output:page hook is triggered by elgg_view_page().
-elgg_register_plugin_hook_handler('output', 'page', 'example_plugin_hook_handler', 600);
-elgg_register_plugin_hook_handler('output', 'page', 'example_plugin_hook_handler_2', 601);
-
-function example_plugin_hook_handler($event, $type, $value, $params) {
- // change A to @
- $value = str_replace('A', '@', $value);
-
- return $value;
-}
-
-function example_plugin_hook_handler_2($event, $type, $value, $params) {
- // change S to $
- $value = str_replace('S', '$', $value);
-
- return $value;
-}
-
-$content = 'This is some Sample Content.';
-
-echo elgg_view_page('Title', $content); \ No newline at end of file
diff --git a/documentation/examples/hooks/register/basic.php b/documentation/examples/hooks/register/basic.php
deleted file mode 100644
index 20493e200..000000000
--- a/documentation/examples/hooks/register/basic.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-elgg_register_plugin_hook_handler('forward', 'system', 'example_plugin_hook_handler');
-
-function example_plugin_hook_handler($event, $type, $value, $params) {
- var_dump($event);
- var_dump($type);
- var_dump($value);
- var_dump($params);
-
- return true;
-}
-
-
diff --git a/documentation/examples/hooks/register/emit.php b/documentation/examples/hooks/register/emit.php
deleted file mode 100644
index 8382d72ca..000000000
--- a/documentation/examples/hooks/register/emit.php
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-
-// @todo this is an event, not a hook
-elgg_register_event_handler('test', 'example', 'example_init_system_callback');
-
-$params = new ElggObject();
-elgg_trigger_event('test', 'example', $params);
diff --git a/documentation/examples/hooks/trigger.php b/documentation/examples/hooks/trigger.php
new file mode 100644
index 000000000..4216fd6c0
--- /dev/null
+++ b/documentation/examples/hooks/trigger.php
@@ -0,0 +1,14 @@
+<?php
+/**
+ * The current value for the hook is passed into the trigger function. Handlers
+ * can change this value. In this snippet, we check if the value of true was
+ * changed by the handler functions.
+ */
+
+$result = elgg_trigger_plugin_hook('get_status', 'example', null, true);
+
+if ($result) {
+ var_dump('Plugin hook says ok!');
+} else {
+ var_dump('Plugin hook says no.');
+}
diff --git a/documentation/examples/hooks/trigger/advanced.php b/documentation/examples/hooks/trigger/advanced.php
deleted file mode 100644
index 5901a06e0..000000000
--- a/documentation/examples/hooks/trigger/advanced.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-$default = array('Entry 1', 'Entry 2', 'Entry 3');
-
-$menu = elgg_trigger_plugin_hook('get_menu_items', 'menu', null, $default);
-
-foreach ($menu as $item) {
- var_dump($item);
-}
diff --git a/documentation/examples/hooks/trigger/basic.php b/documentation/examples/hooks/trigger/basic.php
deleted file mode 100644
index ea27a8a98..000000000
--- a/documentation/examples/hooks/trigger/basic.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-$result = elgg_trigger_plugin_hook('get_status', 'example', null, true);
-
-if ($result) {
- var_dump('Plugin hook says ok!');
-} else {
- var_dump('Plugin hook says no.');
-}
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/events/basic.php.out b/documentation/examples/plugins/actions/.gitignore
index e69de29bb..e69de29bb 100644
--- a/documentation/examples/events/basic.php.out
+++ 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
index a61106e62..e31624432 100644
--- a/documentation/examples/plugins/manifest.xml
+++ b/documentation/examples/plugins/manifest.xml
@@ -1,99 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
-<plugin_manifest version="1.8">
+<plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8">
<name>My Plugin</name>
- <author>Elgg</author>
+ <author>My Name</author>
<version>1.0</version>
- <blurb>A concise description.</blurb>
- <description>This is a longer, more interesting description of my plugin, its features, and other important information.</description>
+ <description>This is a description of my plugin and its features.</description>
<website>http://www.elgg.org/</website>
- <copyright>(C) Elgg 2010</copyright>
- <license>GNU Public License version 2</license>
-
- <requires>
- <type>elgg_version</type>
- <version>2009030802</version>
- </requires>
+ <copyright>(C) My Name or Company 2012</copyright>
+ <license>GNU General Public License version 2</license>
<requires>
<type>elgg_release</type>
- <version>1.8-svn</version>
- </requires>
-
- <screenshot>
- <description>An example screenshot</description>
- <path>graphics/plugin_ss1.png</path>
- </screenshot>
-
- <screenshot>
- <description>Another screenshot</description>
- <path>graphics/plugin_ss2.png</path>
- </screenshot>
-
- <category>Admin</category>
- <category>ServiceAPI</category>
-
- <on_enable>setup_function</on_enable>
- <on_disable>teardown_function</on_disable>
- <admin_interface>simple</admin_interface>
-
- <requires>
- <type>php_extension</type>
- <name>gd</name>
- </requires>
-
- <requires>
- <type>php_ini</type>
- <name>short_open_tag</name>
- <value>off</value>
- </requires>
-
- <requires>
- <type>php_extension</type>
- <name>made_up</name>
- <version>1.0</version>
- </requires>
-
- <requires>
- <type>plugin</type>
- <name>fake_plugin</name>
- <version>1.0</version>
+ <version>1.8</version>
</requires>
- <requires>
- <type>plugin</type>
- <name>profile</name>
- <version>1.0</version>
- </requires>
-
- <requires>
- <type>plugin</type>
- <name>profile_api</name>
- <version>1.3</version>
- <comparison>lt</comparison>
- </requires>
-
- <requires>
- <type>priority</type>
- <priority>after</priority>
- <plugin>blog</plugin>
- </requires>
-
- <conflicts>
- <type>plugin</type>
- <name>profile_api</name>
- <version>1.0</version>
- </conflicts>
-
- <provides>
- <type>plugin</type>
- <name>profile_api</name>
- <version>1.3</version>
- </provides>
-
- <provides>
- <type>php_extension</type>
- <name>curl</name>
- <version>1.0</version>
- </provides>
+ <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/hooks/register/basic.php.out b/documentation/examples/plugins/views/default/.gitignore
index e69de29bb..e69de29bb 100644
--- a/documentation/examples/hooks/register/basic.php.out
+++ b/documentation/examples/plugins/views/default/.gitignore
diff --git a/documentation/stubs/config.php b/documentation/info/config.php
index 86ba54e6d..b45428477 100644
--- a/documentation/stubs/config.php
+++ b/documentation/info/config.php
@@ -106,7 +106,7 @@ $CONFIG->registered_tag_metadata_names;
/**
* An associative array of page handlers and their function names.
*
- * Page handlers must be registered by {@link register_page_handler()} and
+ * Page handlers must be registered by {@link elgg_register_page_handler()} and
* will be dispatched by {@link engine/handlers/pagehandler.php} to the
* proper function.
*
@@ -218,11 +218,11 @@ $CONFIG->dataroot;
$CONFIG->simplecache_enabled;
/**
- * Is view paths cache enabled
+ * Is the system cache enabled
*
- * @global string $CONFIG->viewpath_cache_enabled
+ * @global string $CONFIG->system_cache_enabled
*/
-$CONFIG->viewpath_cache_enabled;
+$CONFIG->system_cache_enabled;
/**
* The site description from the current site object.
diff --git a/documentation/info/manifest.xml b/documentation/info/manifest.xml
new file mode 100644
index 000000000..4fd4be8ce
--- /dev/null
+++ b/documentation/info/manifest.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8">
+ <name>My Plugin</name>
+ <author>Elgg</author>
+ <version>1.0</version>
+ <blurb>A concise description.</blurb>
+ <description>This is a longer, more interesting description of my plugin, its features, and other important information.</description>
+ <website>http://www.elgg.org/</website>
+ <repository>https://github.com/Elgg/Elgg</repository>
+ <bugtracker>https://github.com/Elgg/Elgg/issues</bugtracker>
+ <donations>http://elgg.org/supporter.php</donations>
+ <copyright>(C) Elgg 2011</copyright>
+ <license>GNU General Public License version 2</license>
+
+ <requires>
+ <type>elgg_version</type>
+ <version>2009030802</version>
+ </requires>
+
+ <requires>
+ <type>elgg_release</type>
+ <version>1.8</version>
+ </requires>
+
+ <screenshot>
+ <description>An example screenshot</description>
+ <path>graphics/plugin_ss1.png</path>
+ </screenshot>
+
+ <screenshot>
+ <description>Another screenshot</description>
+ <path>graphics/plugin_ss2.png</path>
+ </screenshot>
+
+ <category>admin</category>
+ <category>api</category>
+
+ <requires>
+ <type>php_extension</type>
+ <name>gd</name>
+ </requires>
+
+ <requires>
+ <type>php_ini</type>
+ <name>short_open_tag</name>
+ <value>off</value>
+ </requires>
+
+ <requires>
+ <type>php_extension</type>
+ <name>made_up</name>
+ <version>1.0</version>
+ </requires>
+
+ <requires>
+ <type>plugin</type>
+ <name>fake_plugin</name>
+ <version>1.0</version>
+ </requires>
+
+ <requires>
+ <type>plugin</type>
+ <name>profile</name>
+ <version>1.0</version>
+ </requires>
+
+ <requires>
+ <type>plugin</type>
+ <name>profile_api</name>
+ <version>1.3</version>
+ <comparison>lt</comparison>
+ </requires>
+
+ <requires>
+ <type>priority</type>
+ <priority>after</priority>
+ <plugin>blog</plugin>
+ </requires>
+
+ <conflicts>
+ <type>plugin</type>
+ <name>profile_api</name>
+ <version>1.0</version>
+ </conflicts>
+
+ <provides>
+ <type>plugin</type>
+ <name>profile_api</name>
+ <version>1.3</version>
+ </provides>
+
+ <provides>
+ <type>php_extension</type>
+ <name>curl</name>
+ <version>1.0</version>
+ </provides>
+
+</plugin_manifest>