11<?php
2+ /**
3+ * PluginDeveloperBoilerplate Init
4+ *
5+ * @version 1.0.1
6+ * @package 'plugin-developer-boilerplate
7+ */
28
39namespace PluginDeveloperBoilerplate ;
410
5- if ( ! defined ( 'ABSPATH ' ) )
11+ if ( ! defined ( 'ABSPATH ' ) ) {
612 exit ;
13+ }
714
8- if ( ! class_exists ( 'PluginDeveloperBoilerplate ' ) ):
15+ if ( ! class_exists ( 'PluginDeveloperBoilerplate ' ) ) :
916 /**
1017 * Class PluginDeveloperBoilerplate
11- * @package PluginDeveloperBoilerplate
12- * @author Heitor <heitorspedroso@gmail.com>
13- * @version 1.0.0
1418 */
1519 final class PluginDeveloperBoilerplate {
1620
1721 /**
22+ * Const PLUGIN_PATH
23+ *
1824 * @const PLUGIN_PATH
1925 */
2026 public const PLUGIN_PATH = __FILE__ ;
2127
2228 /**
29+ * Instance of this class.
30+ *
2331 * @var $instance
2432 */
2533 protected static $ instance = null ;
2634
2735 /**
36+ * Return an instance of this class.
37+ *
2838 * @return static::$instance
2939 */
30- final public static function instance () {
40+ public static function instance () {
3141 if ( null === static ::$ instance ) {
3242 static ::$ instance = new static ();
3343 }
@@ -38,52 +48,29 @@ final public static function instance() {
3848 * PluginDeveloperBoilerplate constructor.
3949 */
4050 public function __construct () {
41- $ this ->registerHooks ();
51+ $ this ->register_hooks ();
52+ $ this ->register_classes ();
4253 }
4354
4455 /**
45- * registerHooks
56+ * Register_hooks function.
4657 */
47- private function registerHooks (){
48- register_activation_hook ( self ::PLUGIN_PATH , [$ this , 'activate ' ] );
49- register_deactivation_hook ( self ::PLUGIN_PATH , [$ this , 'deactivate ' ] );
50-
51- // Load plugin text domain.
52- add_action ( 'init ' , [$ this , 'loadPluginTextDomain ' ] );
58+ private function register_hooks () {
59+ add_action ( 'init ' , array ( $ this , 'load_plugin_textdomain ' ) );
5360 }
5461
5562 /**
56- * activate
63+ * Register_classes function.
5764 */
58- private function activate (){
59- Activate::activate ();
60- }
65+ private function register_classes () {
6166
62- /**
63- * deactivate
64- */
65- private function deactivate (){
66- Deactivate::deactivate ();
6767 }
6868
6969 /**
70- * loadPluginTextDomain
70+ * Load_plugin_textdomain function
7171 */
72- public function loadPluginTextDomain () {
73- load_plugin_textdomain ( 'plugin-developer-boilerplate ' , false , dirname ( plugin_basename ( __FILE__ ) ) . '/languages/ ' );
74- }
75-
76- /**
77- * Debug
78- */
79- public function debugMe ( $ message ) {
80- if ( WP_DEBUG === true ) {
81- if ( is_array ( $ message ) || is_object ( $ message ) ) {
82- error_log ( print_r ( $ message , true ) );
83- } else {
84- error_log ( $ message );
85- }
86- }
72+ public function load_plugin_textdomain () {
73+ load_plugin_textdomain ( 'plugin-developer-boilerplate ' , false , dirname ( plugin_basename ( self ::PLUGIN_PATH ) ) . '/i18n/languages/ ' );
8774 }
8875 }
8976endif ;
0 commit comments