User Tools

Site Tools


getsimple_coding

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

getsimple_coding [2011/05/14 14:07]
ccagle8
getsimple_coding [2013/04/19 14:54]
Line 1: Line 1:
-====== 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 like this: <​code>​$string = 'Some plain text and a ' .$variable;</​code>​ than to use double quotes like this: <​code>​$string = "Some plain text and a $variable";</​code>​ 
-  * Do not use [[http://​en.wikipedia.org/​wiki/​Ternary_operation#​Perl.2C_PHP|ternary operators]]. Instead of this:  <​code>​$dynamic = ($language == '​php'​ ? true : false);</​code>​ use this: <​code>​if($language == '​php'​) { 
-  $dynamic = true; 
-} else { 
-  $dynamic = false; 
-}</​code>​ 
-  * Do not use PHP short tags ''<?​= ?>''​. Instead, use the full tag syntax: ''<?​php ...?>'' ​ 
getsimple_coding.txt ยท Last modified: 2013/04/19 14:54 (external edit)