aboutsummaryrefslogtreecommitdiff
path: root/documentation/coding_standards
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2011-11-18 07:32:27 +0100
committerSem <sembrestels@riseup.net>2011-11-18 07:32:27 +0100
commite53d410129701ea1c9d19529afa493f11b5f5b70 (patch)
treed9963b24bf8932654b4a47e36602c75975e50dba /documentation/coding_standards
parent377da25d2965c64941f83baae119fc970ec60982 (diff)
parent08a962c98e2923724f8013d6eaae89101243752a (diff)
downloadelgg-e53d410129701ea1c9d19529afa493f11b5f5b70.tar.gz
elgg-e53d410129701ea1c9d19529afa493f11b5f5b70.tar.bz2
Merge github.com:Elgg/Elgg
Conflicts: engine/lib/input.php
Diffstat (limited to 'documentation/coding_standards')
-rw-r--r--documentation/coding_standards/best_practices.txt2
-rw-r--r--documentation/coding_standards/javascript_coding_standards.txt11
2 files changed, 13 insertions, 0 deletions
diff --git a/documentation/coding_standards/best_practices.txt b/documentation/coding_standards/best_practices.txt
index 069ac42aa..df04aa845 100644
--- a/documentation/coding_standards/best_practices.txt
+++ b/documentation/coding_standards/best_practices.txt
@@ -15,6 +15,8 @@ work for developers, which means happier, more productive developers.
* 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.
diff --git a/documentation/coding_standards/javascript_coding_standards.txt b/documentation/coding_standards/javascript_coding_standards.txt
index 7d3b842ec..9939e80ab 100644
--- a/documentation/coding_standards/javascript_coding_standards.txt
+++ b/documentation/coding_standards/javascript_coding_standards.txt
@@ -1,2 +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');
+ };
+