Coding conventions

Language

Use English for comments and variables/function names.

The code, comments and developer instructions you write should be in English, no matter what your native language is. It's great if manuals are available in many languages, but code with comments and variables in English, French and Spanish is hard to understand. For feature requests and bug reports, English, French and Spanish are accepted, although English is preferred.

Use of brackets { ... }

For classes and methods, put your opening brackets and closing brackets on an empty line, and at the same indentation

function something(a)
{
    for (i=0; i < a; i++) {
        h += "$a <br />";
    }
}

This gives a very clear view of where a loop starts and where it finishes. Some code editors even improve this visibility by tracing a vertical line between the opening and the closing bracket.

Please note that control structures should have their opening brackets on the same line.

Don't use single-line conditions without brackets

Do NOT use:

if (hello) echo('goodbye');

Use:

if (hello) {
    echo ('goodbye');
}

Variables naming

New variables must be expressed in camelCase (starting with lower case and using a capital letter for each new word).

Although you might find a lot of lower-case-variables, these are remains of an older coding convention. Wherever you are completely sure about the use of a specific variable expressed in lower-case, you are invited to change it to camel case in a separate commit prefixed with the "Minor - Coding conventions" message.

Language variables should all use camel-case and start with an upper-case character. However, these are used literally through the get_lang() function, so there should be no confusion about their usage.

CONSTANTS names MUST be in all-upper-case letters

Translations management


Text is available under the Creative Commons Attribution-ShareAlike License