@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | return [ |
4 | - 'paths' => [ |
|
5 | - __DIR__ . '/../resources/views' |
|
6 | - ], |
|
7 | - 'compiled' => __DIR__ . '/../storage/cache', |
|
4 | + 'paths' => [ |
|
5 | + __DIR__ . '/../resources/views' |
|
6 | + ], |
|
7 | + 'compiled' => __DIR__ . '/../storage/cache', |
|
8 | 8 | ]; |
9 | 9 | \ No newline at end of file |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | return [ |
4 | - 'debug' => true, |
|
5 | - 'env' => 'production', |
|
6 | - 'providers' => [ |
|
7 | - '\Illuminate\Filesystem\FilesystemServiceProvider', |
|
8 | - '\Illuminate\Events\EventServiceProvider', |
|
9 | - '\CodexShaper\Routing\RoutingServiceProvider', |
|
10 | - 'Illuminate\View\ViewServiceProvider', |
|
11 | - ] |
|
4 | + 'debug' => true, |
|
5 | + 'env' => 'production', |
|
6 | + 'providers' => [ |
|
7 | + '\Illuminate\Filesystem\FilesystemServiceProvider', |
|
8 | + '\Illuminate\Events\EventServiceProvider', |
|
9 | + '\CodexShaper\Routing\RoutingServiceProvider', |
|
10 | + 'Illuminate\View\ViewServiceProvider', |
|
11 | + ] |
|
12 | 12 | ]; |
13 | 13 | \ No newline at end of file |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | return [ |
4 | - 'paths' => [ |
|
5 | - 'migrations' => __DIR__ . '/../database/migrations', |
|
6 | - 'seeds' => __DIR__ . '/../database/seeds', |
|
7 | - ], |
|
4 | + 'paths' => [ |
|
5 | + 'migrations' => __DIR__ . '/../database/migrations', |
|
6 | + 'seeds' => __DIR__ . '/../database/seeds', |
|
7 | + ], |
|
8 | 8 | ]; |
9 | 9 | \ No newline at end of file |
@@ -24,15 +24,15 @@ |
||
24 | 24 | */ |
25 | 25 | class WPB_Activator { |
26 | 26 | |
27 | - /** |
|
28 | - * Short Description. (use period) |
|
29 | - * |
|
30 | - * Long Description. |
|
31 | - * |
|
32 | - * @since 1.0.0 |
|
33 | - */ |
|
34 | - public static function activate() { |
|
27 | + /** |
|
28 | + * Short Description. (use period) |
|
29 | + * |
|
30 | + * Long Description. |
|
31 | + * |
|
32 | + * @since 1.0.0 |
|
33 | + */ |
|
34 | + public static function activate() { |
|
35 | 35 | |
36 | - } |
|
36 | + } |
|
37 | 37 | |
38 | 38 | } |
@@ -27,20 +27,20 @@ |
||
27 | 27 | class WPB_i18n { |
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * Load the plugin text domain for translation. |
|
32 | - * |
|
33 | - * @since 1.0.0 |
|
34 | - */ |
|
35 | - public function load_plugin_textdomain() { |
|
36 | - |
|
37 | - load_plugin_textdomain( |
|
38 | - 'wpb', |
|
39 | - false, |
|
40 | - dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' |
|
41 | - ); |
|
42 | - |
|
43 | - } |
|
30 | + /** |
|
31 | + * Load the plugin text domain for translation. |
|
32 | + * |
|
33 | + * @since 1.0.0 |
|
34 | + */ |
|
35 | + public function load_plugin_textdomain() { |
|
36 | + |
|
37 | + load_plugin_textdomain( |
|
38 | + 'wpb', |
|
39 | + false, |
|
40 | + dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' |
|
41 | + ); |
|
42 | + |
|
43 | + } |
|
44 | 44 | |
45 | 45 | |
46 | 46 |
@@ -23,107 +23,107 @@ |
||
23 | 23 | */ |
24 | 24 | class WPB_Loader { |
25 | 25 | |
26 | - /** |
|
27 | - * The array of actions registered with WordPress. |
|
28 | - * |
|
29 | - * @since 1.0.0 |
|
30 | - * @access protected |
|
31 | - * @var array $actions The actions registered with WordPress to fire when the plugin loads. |
|
32 | - */ |
|
33 | - protected $actions; |
|
34 | - |
|
35 | - /** |
|
36 | - * The array of filters registered with WordPress. |
|
37 | - * |
|
38 | - * @since 1.0.0 |
|
39 | - * @access protected |
|
40 | - * @var array $filters The filters registered with WordPress to fire when the plugin loads. |
|
41 | - */ |
|
42 | - protected $filters; |
|
43 | - |
|
44 | - /** |
|
45 | - * Initialize the collections used to maintain the actions and filters. |
|
46 | - * |
|
47 | - * @since 1.0.0 |
|
48 | - */ |
|
49 | - public function __construct() { |
|
50 | - |
|
51 | - $this->actions = array(); |
|
52 | - $this->filters = array(); |
|
53 | - |
|
54 | - } |
|
55 | - |
|
56 | - /** |
|
57 | - * Add a new action to the collection to be registered with WordPress. |
|
58 | - * |
|
59 | - * @since 1.0.0 |
|
60 | - * @param string $hook The name of the WordPress action that is being registered. |
|
61 | - * @param object $component A reference to the instance of the object on which the action is defined. |
|
62 | - * @param string $callback The name of the function definition on the $component. |
|
63 | - * @param int $priority Optional. The priority at which the function should be fired. Default is 10. |
|
64 | - * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. |
|
65 | - */ |
|
66 | - public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
67 | - $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * Add a new filter to the collection to be registered with WordPress. |
|
72 | - * |
|
73 | - * @since 1.0.0 |
|
74 | - * @param string $hook The name of the WordPress filter that is being registered. |
|
75 | - * @param object $component A reference to the instance of the object on which the filter is defined. |
|
76 | - * @param string $callback The name of the function definition on the $component. |
|
77 | - * @param int $priority Optional. The priority at which the function should be fired. Default is 10. |
|
78 | - * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1 |
|
79 | - */ |
|
80 | - public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
81 | - $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); |
|
82 | - } |
|
83 | - |
|
84 | - /** |
|
85 | - * A utility function that is used to register the actions and hooks into a single |
|
86 | - * collection. |
|
87 | - * |
|
88 | - * @since 1.0.0 |
|
89 | - * @access private |
|
90 | - * @param array $hooks The collection of hooks that is being registered (that is, actions or filters). |
|
91 | - * @param string $hook The name of the WordPress filter that is being registered. |
|
92 | - * @param object $component A reference to the instance of the object on which the filter is defined. |
|
93 | - * @param string $callback The name of the function definition on the $component. |
|
94 | - * @param int $priority The priority at which the function should be fired. |
|
95 | - * @param int $accepted_args The number of arguments that should be passed to the $callback. |
|
96 | - * @return array The collection of actions and filters registered with WordPress. |
|
97 | - */ |
|
98 | - private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { |
|
99 | - |
|
100 | - $hooks[] = array( |
|
101 | - 'hook' => $hook, |
|
102 | - 'component' => $component, |
|
103 | - 'callback' => $callback, |
|
104 | - 'priority' => $priority, |
|
105 | - 'accepted_args' => $accepted_args |
|
106 | - ); |
|
107 | - |
|
108 | - return $hooks; |
|
109 | - |
|
110 | - } |
|
111 | - |
|
112 | - /** |
|
113 | - * Register the filters and actions with WordPress. |
|
114 | - * |
|
115 | - * @since 1.0.0 |
|
116 | - */ |
|
117 | - public function run() { |
|
118 | - |
|
119 | - foreach ( $this->filters as $hook ) { |
|
120 | - add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
121 | - } |
|
122 | - |
|
123 | - foreach ( $this->actions as $hook ) { |
|
124 | - add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
125 | - } |
|
126 | - |
|
127 | - } |
|
26 | + /** |
|
27 | + * The array of actions registered with WordPress. |
|
28 | + * |
|
29 | + * @since 1.0.0 |
|
30 | + * @access protected |
|
31 | + * @var array $actions The actions registered with WordPress to fire when the plugin loads. |
|
32 | + */ |
|
33 | + protected $actions; |
|
34 | + |
|
35 | + /** |
|
36 | + * The array of filters registered with WordPress. |
|
37 | + * |
|
38 | + * @since 1.0.0 |
|
39 | + * @access protected |
|
40 | + * @var array $filters The filters registered with WordPress to fire when the plugin loads. |
|
41 | + */ |
|
42 | + protected $filters; |
|
43 | + |
|
44 | + /** |
|
45 | + * Initialize the collections used to maintain the actions and filters. |
|
46 | + * |
|
47 | + * @since 1.0.0 |
|
48 | + */ |
|
49 | + public function __construct() { |
|
50 | + |
|
51 | + $this->actions = array(); |
|
52 | + $this->filters = array(); |
|
53 | + |
|
54 | + } |
|
55 | + |
|
56 | + /** |
|
57 | + * Add a new action to the collection to be registered with WordPress. |
|
58 | + * |
|
59 | + * @since 1.0.0 |
|
60 | + * @param string $hook The name of the WordPress action that is being registered. |
|
61 | + * @param object $component A reference to the instance of the object on which the action is defined. |
|
62 | + * @param string $callback The name of the function definition on the $component. |
|
63 | + * @param int $priority Optional. The priority at which the function should be fired. Default is 10. |
|
64 | + * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. |
|
65 | + */ |
|
66 | + public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
67 | + $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * Add a new filter to the collection to be registered with WordPress. |
|
72 | + * |
|
73 | + * @since 1.0.0 |
|
74 | + * @param string $hook The name of the WordPress filter that is being registered. |
|
75 | + * @param object $component A reference to the instance of the object on which the filter is defined. |
|
76 | + * @param string $callback The name of the function definition on the $component. |
|
77 | + * @param int $priority Optional. The priority at which the function should be fired. Default is 10. |
|
78 | + * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1 |
|
79 | + */ |
|
80 | + public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
81 | + $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); |
|
82 | + } |
|
83 | + |
|
84 | + /** |
|
85 | + * A utility function that is used to register the actions and hooks into a single |
|
86 | + * collection. |
|
87 | + * |
|
88 | + * @since 1.0.0 |
|
89 | + * @access private |
|
90 | + * @param array $hooks The collection of hooks that is being registered (that is, actions or filters). |
|
91 | + * @param string $hook The name of the WordPress filter that is being registered. |
|
92 | + * @param object $component A reference to the instance of the object on which the filter is defined. |
|
93 | + * @param string $callback The name of the function definition on the $component. |
|
94 | + * @param int $priority The priority at which the function should be fired. |
|
95 | + * @param int $accepted_args The number of arguments that should be passed to the $callback. |
|
96 | + * @return array The collection of actions and filters registered with WordPress. |
|
97 | + */ |
|
98 | + private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { |
|
99 | + |
|
100 | + $hooks[] = array( |
|
101 | + 'hook' => $hook, |
|
102 | + 'component' => $component, |
|
103 | + 'callback' => $callback, |
|
104 | + 'priority' => $priority, |
|
105 | + 'accepted_args' => $accepted_args |
|
106 | + ); |
|
107 | + |
|
108 | + return $hooks; |
|
109 | + |
|
110 | + } |
|
111 | + |
|
112 | + /** |
|
113 | + * Register the filters and actions with WordPress. |
|
114 | + * |
|
115 | + * @since 1.0.0 |
|
116 | + */ |
|
117 | + public function run() { |
|
118 | + |
|
119 | + foreach ( $this->filters as $hook ) { |
|
120 | + add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
121 | + } |
|
122 | + |
|
123 | + foreach ( $this->actions as $hook ) { |
|
124 | + add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
125 | + } |
|
126 | + |
|
127 | + } |
|
128 | 128 | |
129 | 129 | } |
@@ -33,58 +33,58 @@ discard block |
||
33 | 33 | */ |
34 | 34 | class WPB { |
35 | 35 | |
36 | - /** |
|
37 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
38 | - * the plugin. |
|
39 | - * |
|
40 | - * @since 1.0.0 |
|
41 | - * @access protected |
|
42 | - * @var WPB_Loader $loader Maintains and registers all hooks for the plugin. |
|
43 | - */ |
|
44 | - protected $loader; |
|
45 | - |
|
46 | - /** |
|
47 | - * The unique identifier of this plugin. |
|
48 | - * |
|
49 | - * @since 1.0.0 |
|
50 | - * @access protected |
|
51 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
52 | - */ |
|
53 | - protected $plugin_name; |
|
54 | - |
|
55 | - /** |
|
56 | - * The current version of the plugin. |
|
57 | - * |
|
58 | - * @since 1.0.0 |
|
59 | - * @access protected |
|
60 | - * @var string $version The current version of the plugin. |
|
61 | - */ |
|
62 | - protected $version; |
|
63 | - |
|
64 | - /** |
|
65 | - * Define the core functionality of the plugin. |
|
66 | - * |
|
67 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
68 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
69 | - * the public-facing side of the site. |
|
70 | - * |
|
71 | - * @since 1.0.0 |
|
72 | - */ |
|
73 | - public function __construct() { |
|
74 | - |
|
75 | - $this->define_constants(); |
|
76 | - |
|
77 | - if ( defined( 'WPB_VERSION' ) ) { |
|
78 | - $this->version = WPB_VERSION; |
|
79 | - } else { |
|
80 | - $this->version = '1.0.0'; |
|
81 | - } |
|
82 | - $this->plugin_name = 'wpb'; |
|
83 | - $this->load_dependencies(); |
|
84 | - $this->set_locale(); |
|
85 | - $this->define_admin_hooks(); |
|
86 | - $this->define_public_hooks(); |
|
87 | - $this->register_assets(); |
|
36 | + /** |
|
37 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
38 | + * the plugin. |
|
39 | + * |
|
40 | + * @since 1.0.0 |
|
41 | + * @access protected |
|
42 | + * @var WPB_Loader $loader Maintains and registers all hooks for the plugin. |
|
43 | + */ |
|
44 | + protected $loader; |
|
45 | + |
|
46 | + /** |
|
47 | + * The unique identifier of this plugin. |
|
48 | + * |
|
49 | + * @since 1.0.0 |
|
50 | + * @access protected |
|
51 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
52 | + */ |
|
53 | + protected $plugin_name; |
|
54 | + |
|
55 | + /** |
|
56 | + * The current version of the plugin. |
|
57 | + * |
|
58 | + * @since 1.0.0 |
|
59 | + * @access protected |
|
60 | + * @var string $version The current version of the plugin. |
|
61 | + */ |
|
62 | + protected $version; |
|
63 | + |
|
64 | + /** |
|
65 | + * Define the core functionality of the plugin. |
|
66 | + * |
|
67 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
68 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
69 | + * the public-facing side of the site. |
|
70 | + * |
|
71 | + * @since 1.0.0 |
|
72 | + */ |
|
73 | + public function __construct() { |
|
74 | + |
|
75 | + $this->define_constants(); |
|
76 | + |
|
77 | + if ( defined( 'WPB_VERSION' ) ) { |
|
78 | + $this->version = WPB_VERSION; |
|
79 | + } else { |
|
80 | + $this->version = '1.0.0'; |
|
81 | + } |
|
82 | + $this->plugin_name = 'wpb'; |
|
83 | + $this->load_dependencies(); |
|
84 | + $this->set_locale(); |
|
85 | + $this->define_admin_hooks(); |
|
86 | + $this->define_public_hooks(); |
|
87 | + $this->register_assets(); |
|
88 | 88 | |
89 | 89 | $menu = new WPB_Admin_Menu; |
90 | 90 | $menu->plugin_name = "wpb"; |
@@ -106,153 +106,153 @@ discard block |
||
106 | 106 | $submenu->capability = 'manage_options'; |
107 | 107 | $submenu->slug = 'admin.php?page=' . $menu->slug . '#/settings'; |
108 | 108 | $submenu->save(); |
109 | - } |
|
110 | - |
|
111 | - /** |
|
112 | - * Load the required dependencies for this plugin. |
|
113 | - * |
|
114 | - * Include the following files that make up the plugin: |
|
115 | - * |
|
116 | - * - WPB_Loader. Orchestrates the hooks of the plugin. |
|
117 | - * - WPB_i18n. Defines internationalization functionality. |
|
118 | - * - WPB_Admin. Defines all hooks for the admin area. |
|
119 | - * - WPB_Public. Defines all hooks for the public side of the site. |
|
120 | - * |
|
121 | - * Create an instance of the loader which will be used to register the hooks |
|
122 | - * with WordPress. |
|
123 | - * |
|
124 | - * @since 1.0.0 |
|
125 | - * @access private |
|
126 | - */ |
|
127 | - private function load_dependencies() { |
|
128 | - |
|
129 | - /** |
|
130 | - * The class responsible for orchestrating the actions and filters of the |
|
131 | - * core plugin. |
|
132 | - */ |
|
133 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpb-loader.php'; |
|
134 | - |
|
135 | - /** |
|
136 | - * The class responsible for defining internationalization functionality |
|
137 | - * of the plugin. |
|
138 | - */ |
|
139 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpb-i18n.php'; |
|
140 | - |
|
141 | - /** |
|
142 | - * The class responsible for defining all actions that occur in the admin area. |
|
143 | - */ |
|
144 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin.php'; |
|
145 | - |
|
146 | - /** |
|
147 | - * The class responsible for defining all menu actions that occur in the admin area. |
|
148 | - */ |
|
149 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin-menu.php'; |
|
150 | - |
|
151 | - /** |
|
152 | - * The class responsible for defining all submenu actions that occur in the admin area. |
|
153 | - */ |
|
154 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin-submenu.php'; |
|
155 | - |
|
156 | - /** |
|
157 | - * The class responsible for defining all actions that occur in the public-facing |
|
158 | - * side of the site. |
|
159 | - */ |
|
160 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wpb-public.php'; |
|
161 | - |
|
162 | - $this->loader = new WPB_Loader(); |
|
163 | - |
|
164 | - } |
|
165 | - |
|
166 | - /** |
|
167 | - * Define the locale for this plugin for internationalization. |
|
168 | - * |
|
169 | - * Uses the WPB_i18n class in order to set the domain and to register the hook |
|
170 | - * with WordPress. |
|
171 | - * |
|
172 | - * @since 1.0.0 |
|
173 | - * @access private |
|
174 | - */ |
|
175 | - private function set_locale() { |
|
176 | - |
|
177 | - $plugin_i18n = new WPB_i18n(); |
|
178 | - |
|
179 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
180 | - |
|
181 | - } |
|
182 | - |
|
183 | - /** |
|
184 | - * Register all of the hooks related to the admin area functionality |
|
185 | - * of the plugin. |
|
186 | - * |
|
187 | - * @since 1.0.0 |
|
188 | - * @access private |
|
189 | - */ |
|
190 | - private function define_admin_hooks() { |
|
191 | - |
|
192 | - $plugin_admin = new WPB_Admin( $this->get_plugin_name(), $this->get_version() ); |
|
193 | - |
|
194 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
195 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
196 | - |
|
197 | - } |
|
198 | - |
|
199 | - /** |
|
200 | - * Register all of the hooks related to the public-facing functionality |
|
201 | - * of the plugin. |
|
202 | - * |
|
203 | - * @since 1.0.0 |
|
204 | - * @access private |
|
205 | - */ |
|
206 | - private function define_public_hooks() { |
|
207 | - |
|
208 | - $plugin_public = new WPB_Public( $this->get_plugin_name(), $this->get_version() ); |
|
209 | - |
|
210 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
211 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
212 | - |
|
213 | - } |
|
214 | - |
|
215 | - /** |
|
216 | - * Run the loader to execute all of the hooks with WordPress. |
|
217 | - * |
|
218 | - * @since 1.0.0 |
|
219 | - */ |
|
220 | - public function run() { |
|
221 | - $this->loader->run(); |
|
222 | - } |
|
223 | - |
|
224 | - /** |
|
225 | - * The name of the plugin used to uniquely identify it within the context of |
|
226 | - * WordPress and to define internationalization functionality. |
|
227 | - * |
|
228 | - * @since 1.0.0 |
|
229 | - * @return string The name of the plugin. |
|
230 | - */ |
|
231 | - public function get_plugin_name() { |
|
232 | - return $this->plugin_name; |
|
233 | - } |
|
234 | - |
|
235 | - /** |
|
236 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
237 | - * |
|
238 | - * @since 1.0.0 |
|
239 | - * @return WPB_Loader Orchestrates the hooks of the plugin. |
|
240 | - */ |
|
241 | - public function get_loader() { |
|
242 | - return $this->loader; |
|
243 | - } |
|
244 | - |
|
245 | - /** |
|
246 | - * Retrieve the version number of the plugin. |
|
247 | - * |
|
248 | - * @since 1.0.0 |
|
249 | - * @return string The version number of the plugin. |
|
250 | - */ |
|
251 | - public function get_version() { |
|
252 | - return $this->version; |
|
253 | - } |
|
254 | - |
|
255 | - /** |
|
109 | + } |
|
110 | + |
|
111 | + /** |
|
112 | + * Load the required dependencies for this plugin. |
|
113 | + * |
|
114 | + * Include the following files that make up the plugin: |
|
115 | + * |
|
116 | + * - WPB_Loader. Orchestrates the hooks of the plugin. |
|
117 | + * - WPB_i18n. Defines internationalization functionality. |
|
118 | + * - WPB_Admin. Defines all hooks for the admin area. |
|
119 | + * - WPB_Public. Defines all hooks for the public side of the site. |
|
120 | + * |
|
121 | + * Create an instance of the loader which will be used to register the hooks |
|
122 | + * with WordPress. |
|
123 | + * |
|
124 | + * @since 1.0.0 |
|
125 | + * @access private |
|
126 | + */ |
|
127 | + private function load_dependencies() { |
|
128 | + |
|
129 | + /** |
|
130 | + * The class responsible for orchestrating the actions and filters of the |
|
131 | + * core plugin. |
|
132 | + */ |
|
133 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpb-loader.php'; |
|
134 | + |
|
135 | + /** |
|
136 | + * The class responsible for defining internationalization functionality |
|
137 | + * of the plugin. |
|
138 | + */ |
|
139 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpb-i18n.php'; |
|
140 | + |
|
141 | + /** |
|
142 | + * The class responsible for defining all actions that occur in the admin area. |
|
143 | + */ |
|
144 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin.php'; |
|
145 | + |
|
146 | + /** |
|
147 | + * The class responsible for defining all menu actions that occur in the admin area. |
|
148 | + */ |
|
149 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin-menu.php'; |
|
150 | + |
|
151 | + /** |
|
152 | + * The class responsible for defining all submenu actions that occur in the admin area. |
|
153 | + */ |
|
154 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin-submenu.php'; |
|
155 | + |
|
156 | + /** |
|
157 | + * The class responsible for defining all actions that occur in the public-facing |
|
158 | + * side of the site. |
|
159 | + */ |
|
160 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wpb-public.php'; |
|
161 | + |
|
162 | + $this->loader = new WPB_Loader(); |
|
163 | + |
|
164 | + } |
|
165 | + |
|
166 | + /** |
|
167 | + * Define the locale for this plugin for internationalization. |
|
168 | + * |
|
169 | + * Uses the WPB_i18n class in order to set the domain and to register the hook |
|
170 | + * with WordPress. |
|
171 | + * |
|
172 | + * @since 1.0.0 |
|
173 | + * @access private |
|
174 | + */ |
|
175 | + private function set_locale() { |
|
176 | + |
|
177 | + $plugin_i18n = new WPB_i18n(); |
|
178 | + |
|
179 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
180 | + |
|
181 | + } |
|
182 | + |
|
183 | + /** |
|
184 | + * Register all of the hooks related to the admin area functionality |
|
185 | + * of the plugin. |
|
186 | + * |
|
187 | + * @since 1.0.0 |
|
188 | + * @access private |
|
189 | + */ |
|
190 | + private function define_admin_hooks() { |
|
191 | + |
|
192 | + $plugin_admin = new WPB_Admin( $this->get_plugin_name(), $this->get_version() ); |
|
193 | + |
|
194 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
195 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
196 | + |
|
197 | + } |
|
198 | + |
|
199 | + /** |
|
200 | + * Register all of the hooks related to the public-facing functionality |
|
201 | + * of the plugin. |
|
202 | + * |
|
203 | + * @since 1.0.0 |
|
204 | + * @access private |
|
205 | + */ |
|
206 | + private function define_public_hooks() { |
|
207 | + |
|
208 | + $plugin_public = new WPB_Public( $this->get_plugin_name(), $this->get_version() ); |
|
209 | + |
|
210 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
211 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
212 | + |
|
213 | + } |
|
214 | + |
|
215 | + /** |
|
216 | + * Run the loader to execute all of the hooks with WordPress. |
|
217 | + * |
|
218 | + * @since 1.0.0 |
|
219 | + */ |
|
220 | + public function run() { |
|
221 | + $this->loader->run(); |
|
222 | + } |
|
223 | + |
|
224 | + /** |
|
225 | + * The name of the plugin used to uniquely identify it within the context of |
|
226 | + * WordPress and to define internationalization functionality. |
|
227 | + * |
|
228 | + * @since 1.0.0 |
|
229 | + * @return string The name of the plugin. |
|
230 | + */ |
|
231 | + public function get_plugin_name() { |
|
232 | + return $this->plugin_name; |
|
233 | + } |
|
234 | + |
|
235 | + /** |
|
236 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
237 | + * |
|
238 | + * @since 1.0.0 |
|
239 | + * @return WPB_Loader Orchestrates the hooks of the plugin. |
|
240 | + */ |
|
241 | + public function get_loader() { |
|
242 | + return $this->loader; |
|
243 | + } |
|
244 | + |
|
245 | + /** |
|
246 | + * Retrieve the version number of the plugin. |
|
247 | + * |
|
248 | + * @since 1.0.0 |
|
249 | + * @return string The version number of the plugin. |
|
250 | + */ |
|
251 | + public function get_version() { |
|
252 | + return $this->version; |
|
253 | + } |
|
254 | + |
|
255 | + /** |
|
256 | 256 | * Define the constants. |
257 | 257 | * |
258 | 258 | * @return void |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | } |
304 | 304 | } |
305 | 305 | |
306 | - /** |
|
306 | + /** |
|
307 | 307 | * Get all registered scripts. |
308 | 308 | * |
309 | 309 | * @return array |
@@ -22,15 +22,15 @@ |
||
22 | 22 | */ |
23 | 23 | class WPB_Deactivator { |
24 | 24 | |
25 | - /** |
|
26 | - * Short Description. (use period) |
|
27 | - * |
|
28 | - * Long Description. |
|
29 | - * |
|
30 | - * @since 1.0.0 |
|
31 | - */ |
|
32 | - public static function deactivate() { |
|
25 | + /** |
|
26 | + * Short Description. (use period) |
|
27 | + * |
|
28 | + * Long Description. |
|
29 | + * |
|
30 | + * @since 1.0.0 |
|
31 | + */ |
|
32 | + public static function deactivate() { |
|
33 | 33 | |
34 | - } |
|
34 | + } |
|
35 | 35 | |
36 | 36 | } |
@@ -27,32 +27,32 @@ discard block |
||
27 | 27 | |
28 | 28 | // If this file is called directly, abort. |
29 | 29 | if ( ! defined( 'WPINC' ) ) { |
30 | - die; |
|
30 | + die; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | // Application root directory. |
34 | 34 | if (!defined('WPB_APP_ROOT')) { |
35 | - define( 'WPB_APP_ROOT', __DIR__ ); |
|
35 | + define( 'WPB_APP_ROOT', __DIR__ ); |
|
36 | 36 | } |
37 | 37 | // Worpress plugin builder file path. |
38 | 38 | if (!defined('WPB_FILE')) { |
39 | - define( 'WPB_FILE', __FILE__ ); |
|
39 | + define( 'WPB_FILE', __FILE__ ); |
|
40 | 40 | } |
41 | 41 | // Worpress plugin builder directory path. |
42 | 42 | if (!defined('WPB_PATH')) { |
43 | - define( 'WPB_PATH', dirname( WPB_FILE ) ); |
|
43 | + define( 'WPB_PATH', dirname( WPB_FILE ) ); |
|
44 | 44 | } |
45 | 45 | // Worpress plugin builder includes path. |
46 | 46 | if (!defined('WPB_INCLUDES')) { |
47 | - define( 'WPB_INCLUDES', WPB_PATH . '/includes' ); |
|
47 | + define( 'WPB_INCLUDES', WPB_PATH . '/includes' ); |
|
48 | 48 | } |
49 | 49 | // Worpress plugin builder url. |
50 | 50 | if (!defined('WPB_URL')) { |
51 | - define( 'WPB_URL', plugins_url( '', WPB_FILE ) ); |
|
51 | + define( 'WPB_URL', plugins_url( '', WPB_FILE ) ); |
|
52 | 52 | } |
53 | 53 | // Worpress plugin builder assets path. |
54 | 54 | if (!defined('WPB_ASSETS')) { |
55 | - define( 'WPB_ASSETS', WPB_URL . '/public' ); |
|
55 | + define( 'WPB_ASSETS', WPB_URL . '/public' ); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | require_once __DIR__.'/bootstrap/app.php'; |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | * This action is documented in includes/class-wpb-activator.php |
70 | 70 | */ |
71 | 71 | function wpb_activate() { |
72 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wpb-activator.php'; |
|
73 | - WPB_Activator::activate(); |
|
72 | + require_once plugin_dir_path( __FILE__ ) . 'includes/class-wpb-activator.php'; |
|
73 | + WPB_Activator::activate(); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | * This action is documented in includes/class-wpb-deactivator.php |
79 | 79 | */ |
80 | 80 | function wpb_deactivate() { |
81 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wpb-deactivator.php'; |
|
82 | - WPB_Deactivator::deactivate(); |
|
81 | + require_once plugin_dir_path( __FILE__ ) . 'includes/class-wpb-deactivator.php'; |
|
82 | + WPB_Deactivator::deactivate(); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | register_activation_hook( __FILE__, 'wpb_activate' ); |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | */ |
103 | 103 | function wpb_run() { |
104 | 104 | |
105 | - $plugin = new WPB(); |
|
106 | - $plugin->run(); |
|
105 | + $plugin = new WPB(); |
|
106 | + $plugin->run(); |
|
107 | 107 | |
108 | 108 | } |
109 | 109 | wpb_run(); |