From 807ae30cb037b827319b924994952daf57db2a40 Mon Sep 17 00:00:00 2001 From: cash Date: Sun, 3 Jul 2011 08:58:58 -0400 Subject: separate out coding standards --- .../coding_standards/php_coding_standards.txt | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 documentation/coding_standards/php_coding_standards.txt (limited to 'documentation/coding_standards/php_coding_standards.txt') 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 ( 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.) -- cgit v1.2.3