diff --git a/WordPress/Docs/NamingConventions/PrefixAllGlobalsStandard.xml b/WordPress/Docs/NamingConventions/PrefixAllGlobalsStandard.xml new file mode 100644 index 0000000000..855dba8e6c --- /dev/null +++ b/WordPress/Docs/NamingConventions/PrefixAllGlobalsStandard.xml @@ -0,0 +1,115 @@ + + + + + + + 'ECPT_VERSION', '1.0' ); + +$ecpt_admin = new ECPT_Admin_Page(); + +class ECPT_Admin_Page {} + +apply_filter( + 'ecpt_modify_content', + $ecpt_content +); + ]]> + + + 'PLUGIN_VERSION', '1.0' ); + +$admin = new Admin_Page(); + +class Admin_Page {} + +apply_filter( + 'modify_content', + $content +); + ]]> + + + + + ECPT_Plugin\Admin; + +// Constants declared using `const` will +// be namespaced and therefore prefixed. +const VERSION = 1.0; + +// A class declared in a (prefixed) namespace +// is automatically prefixed. +class Admin_Page {} + +// Variables in a namespaced file are not +// namespaced, so still need prefixing. +$ecpt_admin = new Admin_Page(); + +// Hook names are not subject to namespacing. +apply_filter( + 'ecpt_modify_content', + $ecpt_content +); + ]]> + + + Admin; + +// As the namespace is not prefixed, this +// is still bad. +const VERSION = 1.0; + +// As the namespace is not prefixed, this +// is still bad. +class Admin_Page {} + ]]> + + + + + + + + mycoolplugin_save_post() {} + ]]> + + + wp_save_post() {} + ]]> + + + + + + + + MyPluginIsCool {} + ]]> + + + My {} + ]]> + + +