Code convention for CodeOz PHP and Web based code
IMPORTANT - This documentation moved to ‘docs’ folder in ‘codeoz/php-lib’ repository
Use lowercase letters in variable, action/filter, and function names(never camelCase). Separate words via underscores. Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.
function some_name( $some_variable ) { [...] }
Class names should use capitalized words separated by underscores OR camelCase Any acronyms should be all upper case. When using namespaces, class names do NOT need to be preceded by an identifier, like “COZ_” for example.
class Logger { [...] } ==> in “Logger.php”
class SiteDefs { [...] } ==> in “SiteDefs.php”
class Site_Stats { [...] } ==> in “Site-Stats.php”
--- OR CamelCase ---
class CozActnPrty { [...] } ==> in “COZ-Actn-Prty.php”
Class file names should be “Classname.php”(Start with Uppercase) with underscores replaced with hyphens, for example
Site_Defs class in Site-Defs.php
Constants should be in all upper-case with underscores separating words:
define( 'DOING_AJAX', true );
define( 'DOING_AJAX', true );
Files should be named:
For example:
my-plugin-name.php
My-Class.php
Files containing template tags in wp-includes should have -template appended to the end of the name so that they are obvious. For example:
general-template.php