PunBB 1.3 Coding standards

Recommendations below describes the appearance of PHP, JavaScript, SQL or any other code used in PunBB and extensions.

Naming convention

The naming rules apply to the naming of variables, functions, classes, attributes, arrays, array elements, HTML form fields, query string parameters, database tables, database fields as well as any other applicable entities.

Formatting

All line breaks should be LF only. Set your editor to save files with UNIX style line breaks.

The indent style and brace policy is the Allman style. All indentation should be made with tabs, not spaces. Examples:

if (<expression>)
{
    <statement>;
    ...
    <statement>;
}
else
{
    <statement>;
    ...
    <statement>;
}
 
while (<expression)
{
    <statement>;
    ...
    <statement>;
}

One allowed exception from the standard Allman style is “braceless” blocks:

if (<expression>)
    <statement>;
else
    <statement>;
 
while (<expression)
    <statement>;

PHP

SQL

CSS

Here is the example of the indentation in CSS files:

.class {
    attribute: value;
    }