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

沒有留言:

張貼留言

辦公室心態秘技輯錄

要過感恩的生活,在工作中也要如是。 有同事脾氣暴躁,所以跟他相處不刺激到他已值得感恩了,可是當他發脾氣的時候,告訴自已不要放於心裏,不要被他的說話影響自己就好了。 有同事不負責任,這個很難相處,就做好自己本份,辛苦委屈唯有交托給主。 有同事懶懶閒,這也改變不到他的心態,不與他說話...