Joomla! Coding Standards
Including Code
Anywhere you are unconditionally including a class file, use require_once(). Anywhere you are conditionally including a class file (for example, factory methods), use include_once(). Either of these will ensure that class files are included only once. They share the same file list, so you don’t need to worry about mixing them - a file included with require_once() will not be included again by include_once().
Note: include_once() and require_once() are statements, not functions. You don’t need parentheses around the filename to be included.
PHP Code Tags
Always use <?php ?> to delimit PHP code, not the <? ?> shorthand. This is required for PEAR compliance and is also the most portable way to include PHP code on differing operating systems and setups.
For files that contain only PHP code, the closing tag (”?>”) is never permitted. It is not required by PHP. Not including it prevents trailing whitespace from being accidentally injected into the output.
SQL Queries
SQL keywords are to be written in uppercase, while all other identifiers (which the exception of quoted text obviously) is to be in lowercase. Carriage returns should not be used as JDatabase::getQuery provides for formatted output. However, indenting with spaces to improve readability is desireable.
Queries should be wrapped in single quotes (as these text blocks are parsed faster by php).
All quoted string must using the Quote method to facilitate future compatibility with other database engines.
All expected integer or floating-point variable must be cast with (int), (float) or (double) as appropriate
...
More...