1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-07 15:16:30 +02:00

Updated e107 Coding Standard (markdown)

Moc
2013-03-24 11:07:41 -07:00
parent 148f39fba0
commit a8e0a4ffb7

@@ -52,7 +52,7 @@ Use camelCase for variables.
### Constants ### Constants
Use UPPER_CASE_WITH_UNDERSCORES for constants. Use UPPER_CASE_WITH_UNDERSCORES for constants.
define("CONSTANT_NAME","some value"); define("CONSTANT_NAME", "some value");
Where numeric values represent a particular status, define a constant for that value to make the meaning more obvious. Where numeric values represent a particular status, define a constant for that value to make the meaning more obvious.
@@ -318,19 +318,19 @@ Avoid duplicating terms, particularly in the admin area. If coding for admin, al
**Good:** **Good:**
define("LAN_XXX","Thank you [b]Firstname[/b]"); define("LAN_XXX", "Thank you [b]Firstname[/b]");
define("LAN_XXX","Thank you [x]"); // Good - replace [ and ] with <a href='...'> and </a> using str_replace() define("LAN_XXX", "Thank you [x]"); // Good - replace [ and ] with <a href='...'> and </a> using str_replace()
**Bad:** **Bad:**
define("LAN_XXX","Thank you <b>Firstname</b>"); //Bad contains HTML define("LAN_XXX", "Thank you <b>Firstname</b>"); //Bad contains HTML
define("LAN_XXX","Thank you <a href='www.somewhere.com'>Firstname</a>"); //Bad contains HTML define("LAN_XXX", "Thank you <a href='www.somewhere.com'>Firstname</a>"); //Bad contains HTML
define("LAN_XXX","Thank you [link=www.somewhere.com]Firstname[/link]"); //Bad - allows translator to modify link. define("LAN_XXX", "Thank you [link=www.somewhere.com]Firstname[/link]"); //Bad - allows translator to modify link.
Avoid short language strings for words such as 'and', 'to' and so on. There aren't always equivalents in other languages. If embedding values into a phrase, use substitution. Avoid using substitution terms which are real words or known bbcodes. Avoid short language strings for words such as 'and', 'to' and so on. There aren't always equivalents in other languages. If embedding values into a phrase, use substitution. Avoid using substitution terms which are real words or known bbcodes.
define('LAN_EXAMPLE_01','Update results: [x] records changed, [y] errors, [z] not changed'); define("LAN_EXAMPLE_01", "Update results: [x] records changed, [y] errors, [z] not changed");
$srch = array('[x]','[y]','[z]'); $srch = array('[x]','[y]','[z]');
$repl = array($changed,$errors,$unchanged); $repl = array($changed,$errors,$unchanged);
$text = str_replace($srch,$repl,LAN_EXAMPLE_01); $text = str_replace($srch,$repl,LAN_EXAMPLE_01);