2014年1月10日 星期五

[WordPress] Some PHP Code Standards stated by WordPress

http://make.wordpress.org/core/handbook/coding-standards/php/

Some Highlights:

Indentation 
Rule of thumb: Tabs should be used at the beginning of the line for indentation, while spaces can be used mid-line for alignment.
Comma of Array
Note the comma after the last array item
Regex
It’s most convenient to use single-quoted strings for regular expressions 
End of Line / End of File 
Remove trailing whitespace at the end of each line of code. Omitting the closing PHP tag at the end of a file is preferred.
SQL Formatting
$wpdb->prepare() is a method that handles escaping, quoting, and int-casting for SQL queries. 






[Unrelated] Extension Reading on Programming Jargon:
http://www.codinghorror.com/blog/2012/07/new-programming-jargon.html

沒有留言:

張貼留言