User Tools

Site Tools


getsimple_coding

This is an old revision of the document!


Coding Best Practices for GetSimple

  • All new code developed can using PHP 5.2+
  • All PHP files will use complete open tags and include an ending tag with no whitespace after it. (no shorthand PHP <?=)
  • All files, classes, class methods, class variables, functions and defines will be documented with DocBlocks
  • Assume all user input will be malicious - properly sanitize all form entries and $_GET, $_POST and $_COOKIE variables
  • Minimize the use of double quotes. Double quotes force the PHP parser to check the string for variables to evaluate, even if there aren't any variables to evaluate. It is better to use single quotes and concatenate variables
$string = 'Some plain text and a ' .$variable;

is better than

$string = "Some plain text and a $variable";
$dynamic = ($language == 'php' ? true : false);

use this:

if($language == 'php') {
  $dynamic = true;
} else {
  $dynamic = false;
}
getsimple_coding.1300042256.txt.gz · Last modified: 2013/04/19 14:53 (external edit)