mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 06:38:00 +02:00
Updated e107 Coding Standard (markdown)
@@ -52,7 +52,7 @@ Use camelCase for variables.
|
||||
### 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.
|
||||
|
||||
@@ -318,19 +318,19 @@ Avoid duplicating terms, particularly in the admin area. If coding for admin, al
|
||||
|
||||
**Good:**
|
||||
|
||||
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 [b]Firstname[/b]");
|
||||
define("LAN_XXX", "Thank you [x]"); // Good - replace [ and ] with <a href='...'> and </a> using str_replace()
|
||||
|
||||
|
||||
**Bad:**
|
||||
|
||||
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 [link=www.somewhere.com]Firstname[/link]"); //Bad - allows translator to modify link.
|
||||
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 [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.
|
||||
|
||||
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]');
|
||||
$repl = array($changed,$errors,$unchanged);
|
||||
$text = str_replace($srch,$repl,LAN_EXAMPLE_01);
|
||||
|
Reference in New Issue
Block a user