Completed
Push — master ( c1bd80...7840cd )
by CodexShaper
11:04 queued 12s
created
routes/web.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -16,17 +16,17 @@
 block discarded – undo
16 16
 use Illuminate\Http\Request;
17 17
 
18 18
 $router->get(
19
-	'test',
20
-	function() {
21
-		echo wpb_view( 'welcome' );
22
-		die();
23
-	}
19
+    'test',
20
+    function() {
21
+        echo wpb_view( 'welcome' );
22
+        die();
23
+    }
24 24
 );
25 25
 
26 26
 Route::get(
27
-	'test/facade',
28
-	function( Request $request ) {
29
-		echo 'This is a facade route';
30
-		die();
31
-	}
27
+    'test/facade',
28
+    function( Request $request ) {
29
+        echo 'This is a facade route';
30
+        die();
31
+    }
32 32
 );
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@
 block discarded – undo
18 18
 $router->get(
19 19
 	'test',
20 20
 	function() {
21
-		echo wpb_view( 'welcome' );
21
+		echo wpb_view('welcome');
22 22
 		die();
23 23
 	}
24 24
 );
25 25
 
26 26
 Route::get(
27 27
 	'test/facade',
28
-	function( Request $request ) {
28
+	function(Request $request) {
29 29
 		echo 'This is a facade route';
30 30
 		die();
31 31
 	}
Please login to merge, or discard this patch.
config/app.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@
 block discarded – undo
10 10
  */
11 11
 
12 12
 return array(
13
-	'debug'     => true,
14
-	'env'       => 'production',
15
-	'providers' => array(
16
-		'\Illuminate\Filesystem\FilesystemServiceProvider',
17
-		'\Illuminate\Events\EventServiceProvider',
18
-		'\CodexShaper\Routing\RoutingServiceProvider',
19
-		'Illuminate\View\ViewServiceProvider',
20
-	),
13
+    'debug'     => true,
14
+    'env'       => 'production',
15
+    'providers' => array(
16
+        '\Illuminate\Filesystem\FilesystemServiceProvider',
17
+        '\Illuminate\Events\EventServiceProvider',
18
+        '\CodexShaper\Routing\RoutingServiceProvider',
19
+        'Illuminate\View\ViewServiceProvider',
20
+    ),
21 21
 );
Please login to merge, or discard this patch.
config/view.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@
 block discarded – undo
10 10
  */
11 11
 
12 12
 return array(
13
-	'paths'    => array(
14
-		__DIR__ . '/../resources/views',
15
-	),
16
-	'compiled' => __DIR__ . '/../storage/cache',
13
+    'paths'    => array(
14
+        __DIR__ . '/../resources/views',
15
+    ),
16
+    'compiled' => __DIR__ . '/../storage/cache',
17 17
 );
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 
12 12
 return array(
13 13
 	'paths'    => array(
14
-		__DIR__ . '/../resources/views',
14
+		__DIR__.'/../resources/views',
15 15
 	),
16
-	'compiled' => __DIR__ . '/../storage/cache',
16
+	'compiled' => __DIR__.'/../storage/cache',
17 17
 );
Please login to merge, or discard this patch.
config/database.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@
 block discarded – undo
10 10
  */
11 11
 
12 12
 return array(
13
-	'paths' => array(
14
-		'migrations' => __DIR__ . '/../database/migrations',
15
-		'seeds'      => __DIR__ . '/../database/seeds',
16
-	),
13
+    'paths' => array(
14
+        'migrations' => __DIR__ . '/../database/migrations',
15
+        'seeds'      => __DIR__ . '/../database/seeds',
16
+    ),
17 17
 );
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 
12 12
 return array(
13 13
 	'paths' => array(
14
-		'migrations' => __DIR__ . '/../database/migrations',
15
-		'seeds'      => __DIR__ . '/../database/seeds',
14
+		'migrations' => __DIR__.'/../database/migrations',
15
+		'seeds'      => __DIR__.'/../database/seeds',
16 16
 	),
17 17
 );
Please login to merge, or discard this patch.
includes/class-wpb.php 2 patches
Indentation   +340 added lines, -340 removed lines patch added patch discarded remove patch
@@ -28,344 +28,344 @@
 block discarded – undo
28 28
  */
29 29
 class WPB {
30 30
 
31
-	/**
32
-	 * The loader that's responsible for maintaining and registering all hooks that power
33
-	 * the plugin.
34
-	 *
35
-	 * @since    1.0.0
36
-	 * @access   protected
37
-	 * @var      WPB_Loader    $loader    Maintains and registers all hooks for the plugin.
38
-	 */
39
-	protected $loader;
40
-
41
-	/**
42
-	 * The unique identifier of this plugin.
43
-	 *
44
-	 * @since    1.0.0
45
-	 * @access   protected
46
-	 * @var      string    $plugin_name    The string used to uniquely identify this plugin.
47
-	 */
48
-	protected $plugin_name;
49
-
50
-	/**
51
-	 * The current version of the plugin.
52
-	 *
53
-	 * @since    1.0.0
54
-	 * @access   protected
55
-	 * @var      string    $version    The current version of the plugin.
56
-	 */
57
-	protected $version;
58
-
59
-	/**
60
-	 * Define the core functionality of the plugin.
61
-	 *
62
-	 * Set the plugin name and the plugin version that can be used throughout the plugin.
63
-	 * Load the dependencies, define the locale, and set the hooks for the admin area and
64
-	 * the public-facing side of the site.
65
-	 *
66
-	 * @since    1.0.0
67
-	 */
68
-	public function __construct() {
69
-
70
-		$this->define_constants();
71
-
72
-		if ( defined( 'WPB_VERSION' ) ) {
73
-			$this->version = WPB_VERSION;
74
-		} else {
75
-			$this->version = '1.0.0';
76
-		}
77
-		$this->plugin_name = 'wpb';
78
-		$this->load_dependencies();
79
-		$this->set_locale();
80
-		$this->define_admin_hooks();
81
-		$this->define_public_hooks();
82
-		$this->register_assets();
83
-
84
-		$menu              = new WPB_Admin_Menu();
85
-		$menu->plugin_name = 'wpb';
86
-		$menu->page_title  = 'WPB';
87
-		$menu->menu_title  = 'WPB';
88
-		$menu->capability  = 'manage_options';
89
-		$menu->slug        = 'wpb';
90
-		$menu->callback    = function() {
91
-				echo '<div class="wrap"><div id="wpb-admin" base-url="' . esc_attr( get_site_url() ) . '" csrf-token="' . esc_attr( wpb_csrf_token() ) . '"></div></div>';
92
-		};
93
-		$menu->icon        = 'dashicons-text';
94
-		$menu->save();
95
-
96
-		$submenu              = new WPB_Admin_SubMenu();
97
-		$submenu->plugin_name = 'wpb';
98
-		$submenu->parent_slug = $menu->slug;
99
-		$submenu->page_title  = 'Settings';
100
-		$submenu->menu_title  = 'Settings';
101
-		$submenu->capability  = 'manage_options';
102
-		$submenu->slug        = 'admin.php?page=' . $menu->slug . '#/settings';
103
-		$submenu->save();
104
-	}
105
-
106
-	/**
107
-	 * Load the required dependencies for this plugin.
108
-	 *
109
-	 * Include the following files that make up the plugin:
110
-	 *
111
-	 * - WPB_Loader. Orchestrates the hooks of the plugin.
112
-	 * - WPB_i18n. Defines internationalization functionality.
113
-	 * - WPB_Admin. Defines all hooks for the admin area.
114
-	 * - WPB_Public. Defines all hooks for the public side of the site.
115
-	 *
116
-	 * Create an instance of the loader which will be used to register the hooks
117
-	 * with WordPress.
118
-	 *
119
-	 * @since    1.0.0
120
-	 * @access   private
121
-	 */
122
-	private function load_dependencies() {
123
-
124
-		/**
125
-		 * The class responsible for orchestrating the actions and filters of the
126
-		 * core plugin.
127
-		 */
128
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpb-loader.php';
129
-
130
-		/**
131
-		 * The class responsible for defining internationalization functionality
132
-		 * of the plugin.
133
-		 */
134
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpb-i18n.php';
135
-
136
-		/**
137
-		 * The class responsible for defining all actions that occur in the admin area.
138
-		 */
139
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin.php';
140
-
141
-		/**
142
-		 * The class responsible for defining all menu actions that occur in the admin area.
143
-		 */
144
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin-menu.php';
145
-
146
-		/**
147
-		 * The class responsible for defining all submenu actions that occur in the admin area.
148
-		 */
149
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin-submenu.php';
150
-
151
-		/**
152
-		 * The class responsible for defining all actions that occur in the public-facing
153
-		 * side of the site.
154
-		 */
155
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wpb-public.php';
156
-
157
-		$this->loader = new WPB_Loader();
158
-
159
-	}
160
-
161
-	/**
162
-	 * Define the locale for this plugin for internationalization.
163
-	 *
164
-	 * Uses the WPB_i18n class in order to set the domain and to register the hook
165
-	 * with WordPress.
166
-	 *
167
-	 * @since    1.0.0
168
-	 * @access   private
169
-	 */
170
-	private function set_locale() {
171
-
172
-		$plugin_i18n = new WPB_I18n();
173
-
174
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
175
-
176
-	}
177
-
178
-	/**
179
-	 * Register all of the hooks related to the admin area functionality
180
-	 * of the plugin.
181
-	 *
182
-	 * @since    1.0.0
183
-	 * @access   private
184
-	 */
185
-	private function define_admin_hooks() {
186
-
187
-		$plugin_admin = new WPB_Admin( $this->get_plugin_name(), $this->get_version() );
188
-
189
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
190
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
191
-
192
-	}
193
-
194
-	/**
195
-	 * Register all of the hooks related to the public-facing functionality
196
-	 * of the plugin.
197
-	 *
198
-	 * @since    1.0.0
199
-	 * @access   private
200
-	 */
201
-	private function define_public_hooks() {
202
-
203
-		$plugin_public = new WPB_Public( $this->get_plugin_name(), $this->get_version() );
204
-
205
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
206
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
207
-
208
-	}
209
-
210
-	/**
211
-	 * Run the loader to execute all of the hooks with WordPress.
212
-	 *
213
-	 * @since    1.0.0
214
-	 */
215
-	public function run() {
216
-		$this->loader->run();
217
-	}
218
-
219
-	/**
220
-	 * The name of the plugin used to uniquely identify it within the context of
221
-	 * WordPress and to define internationalization functionality.
222
-	 *
223
-	 * @since     1.0.0
224
-	 * @return    string    The name of the plugin.
225
-	 */
226
-	public function get_plugin_name() {
227
-		return $this->plugin_name;
228
-	}
229
-
230
-	/**
231
-	 * The reference to the class that orchestrates the hooks with the plugin.
232
-	 *
233
-	 * @since     1.0.0
234
-	 * @return    WPB_Loader    Orchestrates the hooks of the plugin.
235
-	 */
236
-	public function get_loader() {
237
-		return $this->loader;
238
-	}
239
-
240
-	/**
241
-	 * Retrieve the version number of the plugin.
242
-	 *
243
-	 * @since     1.0.0
244
-	 * @return    string    The version number of the plugin.
245
-	 */
246
-	public function get_version() {
247
-		return $this->version;
248
-	}
249
-
250
-	/**
251
-	 * Define the constants.
252
-	 *
253
-	 * @return void
254
-	 */
255
-	public function define_constants() {
256
-		define( 'WPB_VERSION', $this->version );
257
-	}
258
-
259
-	/**
260
-	 * Register our app scripts and styles.
261
-	 *
262
-	 * @return void
263
-	 */
264
-	public function register_assets() {
265
-		$this->register_scripts( $this->get_scripts() );
266
-		$this->register_styles( $this->get_styles() );
267
-	}
268
-
269
-	/**
270
-	 * Register scripts.
271
-	 *
272
-	 * @param  array $scripts All Scripts as an array.
273
-	 *
274
-	 * @return void
275
-	 */
276
-	private function register_scripts( $scripts ) {
277
-		foreach ( $scripts as $handle => $script ) {
278
-			$deps      = isset( $script['deps'] ) ? $script['deps'] : false;
279
-			$in_footer = isset( $script['in_footer'] ) ? $script['in_footer'] : false;
280
-			$version   = isset( $script['version'] ) ? $script['version'] : WPB_VERSION;
281
-
282
-			wp_register_script( $handle, $script['src'], $deps, $version, $in_footer );
283
-		}
284
-	}
285
-
286
-	/**
287
-	 * Register styles.
288
-	 *
289
-	 * @param  array $styles All styles as an array.
290
-	 *
291
-	 * @return void
292
-	 */
293
-	public function register_styles( $styles ) {
294
-		foreach ( $styles as $handle => $style ) {
295
-			$deps = isset( $style['deps'] ) ? $style['deps'] : false;
296
-
297
-			wp_register_style( $handle, $style['src'], $deps, WPB_VERSION );
298
-		}
299
-	}
300
-
301
-	/**
302
-	 * Get all registered scripts.
303
-	 *
304
-	 * @return array
305
-	 */
306
-	public function get_scripts() {
307
-
308
-		$prefix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.min' : '';
309
-
310
-		$scripts = array(
311
-			'wpb-runtime'  => array(
312
-				'src'       => WPB_ASSETS . '/js/runtime.js',
313
-				'version'   => filemtime( WPB_PATH . '/public/js/runtime.js' ),
314
-				'in_footer' => true,
315
-			),
316
-			'wpb-vendor'   => array(
317
-				'src'       => WPB_ASSETS . '/js/vendors.js',
318
-				'version'   => filemtime( WPB_PATH . '/public/js/vendors.js' ),
319
-				'in_footer' => true,
320
-			),
321
-			'wpb-frontend' => array(
322
-				'src'       => WPB_ASSETS . '/js/frontend.js',
323
-				'deps'      => array( 'jquery', 'wpb-vendor', 'wpb-runtime' ),
324
-				'version'   => filemtime( WPB_PATH . '/public/js/frontend.js' ),
325
-				'in_footer' => true,
326
-			),
327
-			'wpb-admin'    => array(
328
-				'src'       => WPB_ASSETS . '/js/admin.js',
329
-				'deps'      => array( 'jquery', 'wpb-vendor', 'wpb-runtime' ),
330
-				'version'   => filemtime( WPB_PATH . '/public/js/admin.js' ),
331
-				'in_footer' => true,
332
-			),
333
-			'wpb-spa'      => array(
334
-				'src'       => WPB_ASSETS . '/js/spa.js',
335
-				'deps'      => array( 'jquery', 'wpb-vendor', 'wpb-runtime' ),
336
-				'version'   => filemtime( WPB_PATH . '/public/js/spa.js' ),
337
-				'in_footer' => true,
338
-			),
339
-		);
340
-
341
-		return $scripts;
342
-	}
343
-
344
-	/**
345
-	 * Get registered styles.
346
-	 *
347
-	 * @return array
348
-	 */
349
-	public function get_styles() {
350
-
351
-		$styles = array(
352
-			'wpb-style'    => array(
353
-				'src' => WPB_ASSETS . '/css/style.css',
354
-			),
355
-			'wpb-frontend' => array(
356
-				'src' => WPB_ASSETS . '/css/frontend.css',
357
-			),
358
-			'wpb-admin'    => array(
359
-				'src' => WPB_ASSETS . '/css/admin.css',
360
-			),
361
-			'wpb-spa'      => array(
362
-				'src' => WPB_ASSETS . '/css/spa.css',
363
-			),
364
-			'wpb-vendors'  => array(
365
-				'src' => WPB_ASSETS . '/css/vendors.css',
366
-			),
367
-		);
368
-
369
-		return $styles;
370
-	}
31
+    /**
32
+     * The loader that's responsible for maintaining and registering all hooks that power
33
+     * the plugin.
34
+     *
35
+     * @since    1.0.0
36
+     * @access   protected
37
+     * @var      WPB_Loader    $loader    Maintains and registers all hooks for the plugin.
38
+     */
39
+    protected $loader;
40
+
41
+    /**
42
+     * The unique identifier of this plugin.
43
+     *
44
+     * @since    1.0.0
45
+     * @access   protected
46
+     * @var      string    $plugin_name    The string used to uniquely identify this plugin.
47
+     */
48
+    protected $plugin_name;
49
+
50
+    /**
51
+     * The current version of the plugin.
52
+     *
53
+     * @since    1.0.0
54
+     * @access   protected
55
+     * @var      string    $version    The current version of the plugin.
56
+     */
57
+    protected $version;
58
+
59
+    /**
60
+     * Define the core functionality of the plugin.
61
+     *
62
+     * Set the plugin name and the plugin version that can be used throughout the plugin.
63
+     * Load the dependencies, define the locale, and set the hooks for the admin area and
64
+     * the public-facing side of the site.
65
+     *
66
+     * @since    1.0.0
67
+     */
68
+    public function __construct() {
69
+
70
+        $this->define_constants();
71
+
72
+        if ( defined( 'WPB_VERSION' ) ) {
73
+            $this->version = WPB_VERSION;
74
+        } else {
75
+            $this->version = '1.0.0';
76
+        }
77
+        $this->plugin_name = 'wpb';
78
+        $this->load_dependencies();
79
+        $this->set_locale();
80
+        $this->define_admin_hooks();
81
+        $this->define_public_hooks();
82
+        $this->register_assets();
83
+
84
+        $menu              = new WPB_Admin_Menu();
85
+        $menu->plugin_name = 'wpb';
86
+        $menu->page_title  = 'WPB';
87
+        $menu->menu_title  = 'WPB';
88
+        $menu->capability  = 'manage_options';
89
+        $menu->slug        = 'wpb';
90
+        $menu->callback    = function() {
91
+                echo '<div class="wrap"><div id="wpb-admin" base-url="' . esc_attr( get_site_url() ) . '" csrf-token="' . esc_attr( wpb_csrf_token() ) . '"></div></div>';
92
+        };
93
+        $menu->icon        = 'dashicons-text';
94
+        $menu->save();
95
+
96
+        $submenu              = new WPB_Admin_SubMenu();
97
+        $submenu->plugin_name = 'wpb';
98
+        $submenu->parent_slug = $menu->slug;
99
+        $submenu->page_title  = 'Settings';
100
+        $submenu->menu_title  = 'Settings';
101
+        $submenu->capability  = 'manage_options';
102
+        $submenu->slug        = 'admin.php?page=' . $menu->slug . '#/settings';
103
+        $submenu->save();
104
+    }
105
+
106
+    /**
107
+     * Load the required dependencies for this plugin.
108
+     *
109
+     * Include the following files that make up the plugin:
110
+     *
111
+     * - WPB_Loader. Orchestrates the hooks of the plugin.
112
+     * - WPB_i18n. Defines internationalization functionality.
113
+     * - WPB_Admin. Defines all hooks for the admin area.
114
+     * - WPB_Public. Defines all hooks for the public side of the site.
115
+     *
116
+     * Create an instance of the loader which will be used to register the hooks
117
+     * with WordPress.
118
+     *
119
+     * @since    1.0.0
120
+     * @access   private
121
+     */
122
+    private function load_dependencies() {
123
+
124
+        /**
125
+         * The class responsible for orchestrating the actions and filters of the
126
+         * core plugin.
127
+         */
128
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpb-loader.php';
129
+
130
+        /**
131
+         * The class responsible for defining internationalization functionality
132
+         * of the plugin.
133
+         */
134
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpb-i18n.php';
135
+
136
+        /**
137
+         * The class responsible for defining all actions that occur in the admin area.
138
+         */
139
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin.php';
140
+
141
+        /**
142
+         * The class responsible for defining all menu actions that occur in the admin area.
143
+         */
144
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin-menu.php';
145
+
146
+        /**
147
+         * The class responsible for defining all submenu actions that occur in the admin area.
148
+         */
149
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin-submenu.php';
150
+
151
+        /**
152
+         * The class responsible for defining all actions that occur in the public-facing
153
+         * side of the site.
154
+         */
155
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wpb-public.php';
156
+
157
+        $this->loader = new WPB_Loader();
158
+
159
+    }
160
+
161
+    /**
162
+     * Define the locale for this plugin for internationalization.
163
+     *
164
+     * Uses the WPB_i18n class in order to set the domain and to register the hook
165
+     * with WordPress.
166
+     *
167
+     * @since    1.0.0
168
+     * @access   private
169
+     */
170
+    private function set_locale() {
171
+
172
+        $plugin_i18n = new WPB_I18n();
173
+
174
+        $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
175
+
176
+    }
177
+
178
+    /**
179
+     * Register all of the hooks related to the admin area functionality
180
+     * of the plugin.
181
+     *
182
+     * @since    1.0.0
183
+     * @access   private
184
+     */
185
+    private function define_admin_hooks() {
186
+
187
+        $plugin_admin = new WPB_Admin( $this->get_plugin_name(), $this->get_version() );
188
+
189
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
190
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
191
+
192
+    }
193
+
194
+    /**
195
+     * Register all of the hooks related to the public-facing functionality
196
+     * of the plugin.
197
+     *
198
+     * @since    1.0.0
199
+     * @access   private
200
+     */
201
+    private function define_public_hooks() {
202
+
203
+        $plugin_public = new WPB_Public( $this->get_plugin_name(), $this->get_version() );
204
+
205
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
206
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
207
+
208
+    }
209
+
210
+    /**
211
+     * Run the loader to execute all of the hooks with WordPress.
212
+     *
213
+     * @since    1.0.0
214
+     */
215
+    public function run() {
216
+        $this->loader->run();
217
+    }
218
+
219
+    /**
220
+     * The name of the plugin used to uniquely identify it within the context of
221
+     * WordPress and to define internationalization functionality.
222
+     *
223
+     * @since     1.0.0
224
+     * @return    string    The name of the plugin.
225
+     */
226
+    public function get_plugin_name() {
227
+        return $this->plugin_name;
228
+    }
229
+
230
+    /**
231
+     * The reference to the class that orchestrates the hooks with the plugin.
232
+     *
233
+     * @since     1.0.0
234
+     * @return    WPB_Loader    Orchestrates the hooks of the plugin.
235
+     */
236
+    public function get_loader() {
237
+        return $this->loader;
238
+    }
239
+
240
+    /**
241
+     * Retrieve the version number of the plugin.
242
+     *
243
+     * @since     1.0.0
244
+     * @return    string    The version number of the plugin.
245
+     */
246
+    public function get_version() {
247
+        return $this->version;
248
+    }
249
+
250
+    /**
251
+     * Define the constants.
252
+     *
253
+     * @return void
254
+     */
255
+    public function define_constants() {
256
+        define( 'WPB_VERSION', $this->version );
257
+    }
258
+
259
+    /**
260
+     * Register our app scripts and styles.
261
+     *
262
+     * @return void
263
+     */
264
+    public function register_assets() {
265
+        $this->register_scripts( $this->get_scripts() );
266
+        $this->register_styles( $this->get_styles() );
267
+    }
268
+
269
+    /**
270
+     * Register scripts.
271
+     *
272
+     * @param  array $scripts All Scripts as an array.
273
+     *
274
+     * @return void
275
+     */
276
+    private function register_scripts( $scripts ) {
277
+        foreach ( $scripts as $handle => $script ) {
278
+            $deps      = isset( $script['deps'] ) ? $script['deps'] : false;
279
+            $in_footer = isset( $script['in_footer'] ) ? $script['in_footer'] : false;
280
+            $version   = isset( $script['version'] ) ? $script['version'] : WPB_VERSION;
281
+
282
+            wp_register_script( $handle, $script['src'], $deps, $version, $in_footer );
283
+        }
284
+    }
285
+
286
+    /**
287
+     * Register styles.
288
+     *
289
+     * @param  array $styles All styles as an array.
290
+     *
291
+     * @return void
292
+     */
293
+    public function register_styles( $styles ) {
294
+        foreach ( $styles as $handle => $style ) {
295
+            $deps = isset( $style['deps'] ) ? $style['deps'] : false;
296
+
297
+            wp_register_style( $handle, $style['src'], $deps, WPB_VERSION );
298
+        }
299
+    }
300
+
301
+    /**
302
+     * Get all registered scripts.
303
+     *
304
+     * @return array
305
+     */
306
+    public function get_scripts() {
307
+
308
+        $prefix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.min' : '';
309
+
310
+        $scripts = array(
311
+            'wpb-runtime'  => array(
312
+                'src'       => WPB_ASSETS . '/js/runtime.js',
313
+                'version'   => filemtime( WPB_PATH . '/public/js/runtime.js' ),
314
+                'in_footer' => true,
315
+            ),
316
+            'wpb-vendor'   => array(
317
+                'src'       => WPB_ASSETS . '/js/vendors.js',
318
+                'version'   => filemtime( WPB_PATH . '/public/js/vendors.js' ),
319
+                'in_footer' => true,
320
+            ),
321
+            'wpb-frontend' => array(
322
+                'src'       => WPB_ASSETS . '/js/frontend.js',
323
+                'deps'      => array( 'jquery', 'wpb-vendor', 'wpb-runtime' ),
324
+                'version'   => filemtime( WPB_PATH . '/public/js/frontend.js' ),
325
+                'in_footer' => true,
326
+            ),
327
+            'wpb-admin'    => array(
328
+                'src'       => WPB_ASSETS . '/js/admin.js',
329
+                'deps'      => array( 'jquery', 'wpb-vendor', 'wpb-runtime' ),
330
+                'version'   => filemtime( WPB_PATH . '/public/js/admin.js' ),
331
+                'in_footer' => true,
332
+            ),
333
+            'wpb-spa'      => array(
334
+                'src'       => WPB_ASSETS . '/js/spa.js',
335
+                'deps'      => array( 'jquery', 'wpb-vendor', 'wpb-runtime' ),
336
+                'version'   => filemtime( WPB_PATH . '/public/js/spa.js' ),
337
+                'in_footer' => true,
338
+            ),
339
+        );
340
+
341
+        return $scripts;
342
+    }
343
+
344
+    /**
345
+     * Get registered styles.
346
+     *
347
+     * @return array
348
+     */
349
+    public function get_styles() {
350
+
351
+        $styles = array(
352
+            'wpb-style'    => array(
353
+                'src' => WPB_ASSETS . '/css/style.css',
354
+            ),
355
+            'wpb-frontend' => array(
356
+                'src' => WPB_ASSETS . '/css/frontend.css',
357
+            ),
358
+            'wpb-admin'    => array(
359
+                'src' => WPB_ASSETS . '/css/admin.css',
360
+            ),
361
+            'wpb-spa'      => array(
362
+                'src' => WPB_ASSETS . '/css/spa.css',
363
+            ),
364
+            'wpb-vendors'  => array(
365
+                'src' => WPB_ASSETS . '/css/vendors.css',
366
+            ),
367
+        );
368
+
369
+        return $styles;
370
+    }
371 371
 }
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
 		$this->define_constants();
71 71
 
72
-		if ( defined( 'WPB_VERSION' ) ) {
72
+		if (defined('WPB_VERSION')) {
73 73
 			$this->version = WPB_VERSION;
74 74
 		} else {
75 75
 			$this->version = '1.0.0';
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 		$menu->capability  = 'manage_options';
89 89
 		$menu->slug        = 'wpb';
90 90
 		$menu->callback    = function() {
91
-				echo '<div class="wrap"><div id="wpb-admin" base-url="' . esc_attr( get_site_url() ) . '" csrf-token="' . esc_attr( wpb_csrf_token() ) . '"></div></div>';
91
+				echo '<div class="wrap"><div id="wpb-admin" base-url="'.esc_attr(get_site_url()).'" csrf-token="'.esc_attr(wpb_csrf_token()).'"></div></div>';
92 92
 		};
93 93
 		$menu->icon        = 'dashicons-text';
94 94
 		$menu->save();
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		$submenu->page_title  = 'Settings';
100 100
 		$submenu->menu_title  = 'Settings';
101 101
 		$submenu->capability  = 'manage_options';
102
-		$submenu->slug        = 'admin.php?page=' . $menu->slug . '#/settings';
102
+		$submenu->slug        = 'admin.php?page='.$menu->slug.'#/settings';
103 103
 		$submenu->save();
104 104
 	}
105 105
 
@@ -125,34 +125,34 @@  discard block
 block discarded – undo
125 125
 		 * The class responsible for orchestrating the actions and filters of the
126 126
 		 * core plugin.
127 127
 		 */
128
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpb-loader.php';
128
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wpb-loader.php';
129 129
 
130 130
 		/**
131 131
 		 * The class responsible for defining internationalization functionality
132 132
 		 * of the plugin.
133 133
 		 */
134
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpb-i18n.php';
134
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wpb-i18n.php';
135 135
 
136 136
 		/**
137 137
 		 * The class responsible for defining all actions that occur in the admin area.
138 138
 		 */
139
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin.php';
139
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wpb-admin.php';
140 140
 
141 141
 		/**
142 142
 		 * The class responsible for defining all menu actions that occur in the admin area.
143 143
 		 */
144
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin-menu.php';
144
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wpb-admin-menu.php';
145 145
 
146 146
 		/**
147 147
 		 * The class responsible for defining all submenu actions that occur in the admin area.
148 148
 		 */
149
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin-submenu.php';
149
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wpb-admin-submenu.php';
150 150
 
151 151
 		/**
152 152
 		 * The class responsible for defining all actions that occur in the public-facing
153 153
 		 * side of the site.
154 154
 		 */
155
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wpb-public.php';
155
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wpb-public.php';
156 156
 
157 157
 		$this->loader = new WPB_Loader();
158 158
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
 		$plugin_i18n = new WPB_I18n();
173 173
 
174
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
174
+		$this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain');
175 175
 
176 176
 	}
177 177
 
@@ -184,10 +184,10 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	private function define_admin_hooks() {
186 186
 
187
-		$plugin_admin = new WPB_Admin( $this->get_plugin_name(), $this->get_version() );
187
+		$plugin_admin = new WPB_Admin($this->get_plugin_name(), $this->get_version());
188 188
 
189
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
190
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
189
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles');
190
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts');
191 191
 
192 192
 	}
193 193
 
@@ -200,10 +200,10 @@  discard block
 block discarded – undo
200 200
 	 */
201 201
 	private function define_public_hooks() {
202 202
 
203
-		$plugin_public = new WPB_Public( $this->get_plugin_name(), $this->get_version() );
203
+		$plugin_public = new WPB_Public($this->get_plugin_name(), $this->get_version());
204 204
 
205
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
206
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
205
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles');
206
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts');
207 207
 
208 208
 	}
209 209
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 * @return void
254 254
 	 */
255 255
 	public function define_constants() {
256
-		define( 'WPB_VERSION', $this->version );
256
+		define('WPB_VERSION', $this->version);
257 257
 	}
258 258
 
259 259
 	/**
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
 	 * @return void
263 263
 	 */
264 264
 	public function register_assets() {
265
-		$this->register_scripts( $this->get_scripts() );
266
-		$this->register_styles( $this->get_styles() );
265
+		$this->register_scripts($this->get_scripts());
266
+		$this->register_styles($this->get_styles());
267 267
 	}
268 268
 
269 269
 	/**
@@ -273,13 +273,13 @@  discard block
 block discarded – undo
273 273
 	 *
274 274
 	 * @return void
275 275
 	 */
276
-	private function register_scripts( $scripts ) {
277
-		foreach ( $scripts as $handle => $script ) {
278
-			$deps      = isset( $script['deps'] ) ? $script['deps'] : false;
279
-			$in_footer = isset( $script['in_footer'] ) ? $script['in_footer'] : false;
280
-			$version   = isset( $script['version'] ) ? $script['version'] : WPB_VERSION;
276
+	private function register_scripts($scripts) {
277
+		foreach ($scripts as $handle => $script) {
278
+			$deps      = isset($script['deps']) ? $script['deps'] : false;
279
+			$in_footer = isset($script['in_footer']) ? $script['in_footer'] : false;
280
+			$version   = isset($script['version']) ? $script['version'] : WPB_VERSION;
281 281
 
282
-			wp_register_script( $handle, $script['src'], $deps, $version, $in_footer );
282
+			wp_register_script($handle, $script['src'], $deps, $version, $in_footer);
283 283
 		}
284 284
 	}
285 285
 
@@ -290,11 +290,11 @@  discard block
 block discarded – undo
290 290
 	 *
291 291
 	 * @return void
292 292
 	 */
293
-	public function register_styles( $styles ) {
294
-		foreach ( $styles as $handle => $style ) {
295
-			$deps = isset( $style['deps'] ) ? $style['deps'] : false;
293
+	public function register_styles($styles) {
294
+		foreach ($styles as $handle => $style) {
295
+			$deps = isset($style['deps']) ? $style['deps'] : false;
296 296
 
297
-			wp_register_style( $handle, $style['src'], $deps, WPB_VERSION );
297
+			wp_register_style($handle, $style['src'], $deps, WPB_VERSION);
298 298
 		}
299 299
 	}
300 300
 
@@ -305,35 +305,35 @@  discard block
 block discarded – undo
305 305
 	 */
306 306
 	public function get_scripts() {
307 307
 
308
-		$prefix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.min' : '';
308
+		$prefix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.min' : '';
309 309
 
310 310
 		$scripts = array(
311 311
 			'wpb-runtime'  => array(
312
-				'src'       => WPB_ASSETS . '/js/runtime.js',
313
-				'version'   => filemtime( WPB_PATH . '/public/js/runtime.js' ),
312
+				'src'       => WPB_ASSETS.'/js/runtime.js',
313
+				'version'   => filemtime(WPB_PATH.'/public/js/runtime.js'),
314 314
 				'in_footer' => true,
315 315
 			),
316 316
 			'wpb-vendor'   => array(
317
-				'src'       => WPB_ASSETS . '/js/vendors.js',
318
-				'version'   => filemtime( WPB_PATH . '/public/js/vendors.js' ),
317
+				'src'       => WPB_ASSETS.'/js/vendors.js',
318
+				'version'   => filemtime(WPB_PATH.'/public/js/vendors.js'),
319 319
 				'in_footer' => true,
320 320
 			),
321 321
 			'wpb-frontend' => array(
322
-				'src'       => WPB_ASSETS . '/js/frontend.js',
323
-				'deps'      => array( 'jquery', 'wpb-vendor', 'wpb-runtime' ),
324
-				'version'   => filemtime( WPB_PATH . '/public/js/frontend.js' ),
322
+				'src'       => WPB_ASSETS.'/js/frontend.js',
323
+				'deps'      => array('jquery', 'wpb-vendor', 'wpb-runtime'),
324
+				'version'   => filemtime(WPB_PATH.'/public/js/frontend.js'),
325 325
 				'in_footer' => true,
326 326
 			),
327 327
 			'wpb-admin'    => array(
328
-				'src'       => WPB_ASSETS . '/js/admin.js',
329
-				'deps'      => array( 'jquery', 'wpb-vendor', 'wpb-runtime' ),
330
-				'version'   => filemtime( WPB_PATH . '/public/js/admin.js' ),
328
+				'src'       => WPB_ASSETS.'/js/admin.js',
329
+				'deps'      => array('jquery', 'wpb-vendor', 'wpb-runtime'),
330
+				'version'   => filemtime(WPB_PATH.'/public/js/admin.js'),
331 331
 				'in_footer' => true,
332 332
 			),
333 333
 			'wpb-spa'      => array(
334
-				'src'       => WPB_ASSETS . '/js/spa.js',
335
-				'deps'      => array( 'jquery', 'wpb-vendor', 'wpb-runtime' ),
336
-				'version'   => filemtime( WPB_PATH . '/public/js/spa.js' ),
334
+				'src'       => WPB_ASSETS.'/js/spa.js',
335
+				'deps'      => array('jquery', 'wpb-vendor', 'wpb-runtime'),
336
+				'version'   => filemtime(WPB_PATH.'/public/js/spa.js'),
337 337
 				'in_footer' => true,
338 338
 			),
339 339
 		);
@@ -350,19 +350,19 @@  discard block
 block discarded – undo
350 350
 
351 351
 		$styles = array(
352 352
 			'wpb-style'    => array(
353
-				'src' => WPB_ASSETS . '/css/style.css',
353
+				'src' => WPB_ASSETS.'/css/style.css',
354 354
 			),
355 355
 			'wpb-frontend' => array(
356
-				'src' => WPB_ASSETS . '/css/frontend.css',
356
+				'src' => WPB_ASSETS.'/css/frontend.css',
357 357
 			),
358 358
 			'wpb-admin'    => array(
359
-				'src' => WPB_ASSETS . '/css/admin.css',
359
+				'src' => WPB_ASSETS.'/css/admin.css',
360 360
 			),
361 361
 			'wpb-spa'      => array(
362
-				'src' => WPB_ASSETS . '/css/spa.css',
362
+				'src' => WPB_ASSETS.'/css/spa.css',
363 363
 			),
364 364
 			'wpb-vendors'  => array(
365
-				'src' => WPB_ASSETS . '/css/vendors.css',
365
+				'src' => WPB_ASSETS.'/css/vendors.css',
366 366
 			),
367 367
 		);
368 368
 
Please login to merge, or discard this patch.
includes/class-wpb-loader.php 2 patches
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -22,107 +22,107 @@
 block discarded – undo
22 22
  */
23 23
 class WPB_Loader {
24 24
 
25
-	/**
26
-	 * The array of actions registered with WordPress.
27
-	 *
28
-	 * @since    1.0.0
29
-	 * @access   protected
30
-	 * @var      array    $actions    The actions registered with WordPress to fire when the plugin loads.
31
-	 */
32
-	protected $actions;
33
-
34
-	/**
35
-	 * The array of filters registered with WordPress.
36
-	 *
37
-	 * @since    1.0.0
38
-	 * @access   protected
39
-	 * @var      array    $filters    The filters registered with WordPress to fire when the plugin loads.
40
-	 */
41
-	protected $filters;
42
-
43
-	/**
44
-	 * Initialize the collections used to maintain the actions and filters.
45
-	 *
46
-	 * @since    1.0.0
47
-	 */
48
-	public function __construct() {
49
-
50
-		$this->actions = array();
51
-		$this->filters = array();
52
-
53
-	}
54
-
55
-	/**
56
-	 * Add a new action to the collection to be registered with WordPress.
57
-	 *
58
-	 * @since    1.0.0
59
-	 * @param    string $hook             The name of the WordPress action that is being registered.
60
-	 * @param    object $component        A reference to the instance of the object on which the action is defined.
61
-	 * @param    string $callback         The name of the function definition on the $component.
62
-	 * @param    int    $priority         Optional. The priority at which the function should be fired. Default is 10.
63
-	 * @param    int    $accepted_args    Optional. The number of arguments that should be passed to the $callback. Default is 1.
64
-	 */
65
-	public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
66
-		$this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
67
-	}
68
-
69
-	/**
70
-	 * Add a new filter to the collection to be registered with WordPress.
71
-	 *
72
-	 * @since    1.0.0
73
-	 * @param    string $hook             The name of the WordPress filter that is being registered.
74
-	 * @param    object $component        A reference to the instance of the object on which the filter is defined.
75
-	 * @param    string $callback         The name of the function definition on the $component.
76
-	 * @param    int    $priority         Optional. The priority at which the function should be fired. Default is 10.
77
-	 * @param    int    $accepted_args    Optional. The number of arguments that should be passed to the $callback. Default is 1.
78
-	 */
79
-	public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
80
-		$this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
81
-	}
82
-
83
-	/**
84
-	 * A utility function that is used to register the actions and hooks into a single
85
-	 * collection.
86
-	 *
87
-	 * @since    1.0.0
88
-	 * @access   private
89
-	 * @param    array  $hooks            The collection of hooks that is being registered (that is, actions or filters).
90
-	 * @param    string $hook             The name of the WordPress filter that is being registered.
91
-	 * @param    object $component        A reference to the instance of the object on which the filter is defined.
92
-	 * @param    string $callback         The name of the function definition on the $component.
93
-	 * @param    int    $priority         The priority at which the function should be fired.
94
-	 * @param    int    $accepted_args    The number of arguments that should be passed to the $callback.
95
-	 * @return   array                                  The collection of actions and filters registered with WordPress.
96
-	 */
97
-	private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
98
-
99
-		$hooks[] = array(
100
-			'hook'          => $hook,
101
-			'component'     => $component,
102
-			'callback'      => $callback,
103
-			'priority'      => $priority,
104
-			'accepted_args' => $accepted_args,
105
-		);
106
-
107
-		return $hooks;
108
-
109
-	}
110
-
111
-	/**
112
-	 * Register the filters and actions with WordPress.
113
-	 *
114
-	 * @since    1.0.0
115
-	 */
116
-	public function run() {
117
-
118
-		foreach ( $this->filters as $hook ) {
119
-			add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
120
-		}
121
-
122
-		foreach ( $this->actions as $hook ) {
123
-			add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
124
-		}
125
-
126
-	}
25
+    /**
26
+     * The array of actions registered with WordPress.
27
+     *
28
+     * @since    1.0.0
29
+     * @access   protected
30
+     * @var      array    $actions    The actions registered with WordPress to fire when the plugin loads.
31
+     */
32
+    protected $actions;
33
+
34
+    /**
35
+     * The array of filters registered with WordPress.
36
+     *
37
+     * @since    1.0.0
38
+     * @access   protected
39
+     * @var      array    $filters    The filters registered with WordPress to fire when the plugin loads.
40
+     */
41
+    protected $filters;
42
+
43
+    /**
44
+     * Initialize the collections used to maintain the actions and filters.
45
+     *
46
+     * @since    1.0.0
47
+     */
48
+    public function __construct() {
49
+
50
+        $this->actions = array();
51
+        $this->filters = array();
52
+
53
+    }
54
+
55
+    /**
56
+     * Add a new action to the collection to be registered with WordPress.
57
+     *
58
+     * @since    1.0.0
59
+     * @param    string $hook             The name of the WordPress action that is being registered.
60
+     * @param    object $component        A reference to the instance of the object on which the action is defined.
61
+     * @param    string $callback         The name of the function definition on the $component.
62
+     * @param    int    $priority         Optional. The priority at which the function should be fired. Default is 10.
63
+     * @param    int    $accepted_args    Optional. The number of arguments that should be passed to the $callback. Default is 1.
64
+     */
65
+    public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
66
+        $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
67
+    }
68
+
69
+    /**
70
+     * Add a new filter to the collection to be registered with WordPress.
71
+     *
72
+     * @since    1.0.0
73
+     * @param    string $hook             The name of the WordPress filter that is being registered.
74
+     * @param    object $component        A reference to the instance of the object on which the filter is defined.
75
+     * @param    string $callback         The name of the function definition on the $component.
76
+     * @param    int    $priority         Optional. The priority at which the function should be fired. Default is 10.
77
+     * @param    int    $accepted_args    Optional. The number of arguments that should be passed to the $callback. Default is 1.
78
+     */
79
+    public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
80
+        $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
81
+    }
82
+
83
+    /**
84
+     * A utility function that is used to register the actions and hooks into a single
85
+     * collection.
86
+     *
87
+     * @since    1.0.0
88
+     * @access   private
89
+     * @param    array  $hooks            The collection of hooks that is being registered (that is, actions or filters).
90
+     * @param    string $hook             The name of the WordPress filter that is being registered.
91
+     * @param    object $component        A reference to the instance of the object on which the filter is defined.
92
+     * @param    string $callback         The name of the function definition on the $component.
93
+     * @param    int    $priority         The priority at which the function should be fired.
94
+     * @param    int    $accepted_args    The number of arguments that should be passed to the $callback.
95
+     * @return   array                                  The collection of actions and filters registered with WordPress.
96
+     */
97
+    private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
98
+
99
+        $hooks[] = array(
100
+            'hook'          => $hook,
101
+            'component'     => $component,
102
+            'callback'      => $callback,
103
+            'priority'      => $priority,
104
+            'accepted_args' => $accepted_args,
105
+        );
106
+
107
+        return $hooks;
108
+
109
+    }
110
+
111
+    /**
112
+     * Register the filters and actions with WordPress.
113
+     *
114
+     * @since    1.0.0
115
+     */
116
+    public function run() {
117
+
118
+        foreach ( $this->filters as $hook ) {
119
+            add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
120
+        }
121
+
122
+        foreach ( $this->actions as $hook ) {
123
+            add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
124
+        }
125
+
126
+    }
127 127
 
128 128
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	 * @param    int    $priority         Optional. The priority at which the function should be fired. Default is 10.
63 63
 	 * @param    int    $accepted_args    Optional. The number of arguments that should be passed to the $callback. Default is 1.
64 64
 	 */
65
-	public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
66
-		$this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
65
+	public function add_action($hook, $component, $callback, $priority = 10, $accepted_args = 1) {
66
+		$this->actions = $this->add($this->actions, $hook, $component, $callback, $priority, $accepted_args);
67 67
 	}
68 68
 
69 69
 	/**
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 	 * @param    int    $priority         Optional. The priority at which the function should be fired. Default is 10.
77 77
 	 * @param    int    $accepted_args    Optional. The number of arguments that should be passed to the $callback. Default is 1.
78 78
 	 */
79
-	public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
80
-		$this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
79
+	public function add_filter($hook, $component, $callback, $priority = 10, $accepted_args = 1) {
80
+		$this->filters = $this->add($this->filters, $hook, $component, $callback, $priority, $accepted_args);
81 81
 	}
82 82
 
83 83
 	/**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 * @param    int    $accepted_args    The number of arguments that should be passed to the $callback.
95 95
 	 * @return   array                                  The collection of actions and filters registered with WordPress.
96 96
 	 */
97
-	private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
97
+	private function add($hooks, $hook, $component, $callback, $priority, $accepted_args) {
98 98
 
99 99
 		$hooks[] = array(
100 100
 			'hook'          => $hook,
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function run() {
117 117
 
118
-		foreach ( $this->filters as $hook ) {
119
-			add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
118
+		foreach ($this->filters as $hook) {
119
+			add_filter($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']);
120 120
 		}
121 121
 
122
-		foreach ( $this->actions as $hook ) {
123
-			add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
122
+		foreach ($this->actions as $hook) {
123
+			add_action($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']);
124 124
 		}
125 125
 
126 126
 	}
Please login to merge, or discard this patch.
src/Composer/ComposerScripts.php 2 patches
Indentation   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -26,139 +26,139 @@
 block discarded – undo
26 26
  */
27 27
 class ComposerScripts {
28 28
 
29
-	/**
30
-	 * Handle the post-install Composer event.
31
-	 *
32
-	 * @param  \Composer\Script\Event $event The composer event.
33
-	 * @return void
34
-	 */
35
-	public static function post_install( Event $event ) {
36
-		require_once $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/autoload.php';
37
-	}
29
+    /**
30
+     * Handle the post-install Composer event.
31
+     *
32
+     * @param  \Composer\Script\Event $event The composer event.
33
+     * @return void
34
+     */
35
+    public static function post_install( Event $event ) {
36
+        require_once $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/autoload.php';
37
+    }
38 38
 
39
-	/**
40
-	 * Handle the post-update Composer event.
41
-	 *
42
-	 * @param  \Composer\Script\Event $event The composer event.
43
-	 * @return void
44
-	 */
45
-	public static function post_update( Event $event ) {
46
-		require_once $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/autoload.php';
47
-	}
39
+    /**
40
+     * Handle the post-update Composer event.
41
+     *
42
+     * @param  \Composer\Script\Event $event The composer event.
43
+     * @return void
44
+     */
45
+    public static function post_update( Event $event ) {
46
+        require_once $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/autoload.php';
47
+    }
48 48
 
49
-	/**
50
-	 * Handle the post-autoload-dump Composer event.
51
-	 *
52
-	 * @param  \Composer\Script\Event $event The composer event.
53
-	 * @return void
54
-	 */
55
-	public static function post_autoload_dump( Event $event ) {
56
-		require_once $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/autoload.php';
49
+    /**
50
+     * Handle the post-autoload-dump Composer event.
51
+     *
52
+     * @param  \Composer\Script\Event $event The composer event.
53
+     * @return void
54
+     */
55
+    public static function post_autoload_dump( Event $event ) {
56
+        require_once $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/autoload.php';
57 57
 
58
-		$dir  = $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/../';
59
-		$root = dirname( $event->getComposer()->getConfig()->get( 'vendor-dir' ) );
58
+        $dir  = $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/../';
59
+        $root = dirname( $event->getComposer()->getConfig()->get( 'vendor-dir' ) );
60 60
 
61
-		$vendor_name         = strtolower( basename( $root ) );
62
-		$partials            = explode( '-', $vendor_name );
63
-		$camel_case_partials = array();
64
-		foreach ( $partials as $partial ) {
65
-			$camel_case_partials[] = ucfirst( strtolower( $partial ) );
66
-		}
67
-		$camel_case = implode( '_', $camel_case_partials );
68
-		$snake_case = implode( '_', $partials );
61
+        $vendor_name         = strtolower( basename( $root ) );
62
+        $partials            = explode( '-', $vendor_name );
63
+        $camel_case_partials = array();
64
+        foreach ( $partials as $partial ) {
65
+            $camel_case_partials[] = ucfirst( strtolower( $partial ) );
66
+        }
67
+        $camel_case = implode( '_', $camel_case_partials );
68
+        $snake_case = implode( '_', $partials );
69 69
 
70
-		$files = array(
71
-			'/wpb.php',
72
-			'/bootstrap/app.php',
73
-			'/includes/class-wpb-activator.php',
74
-			'/includes/class-wpb-deactivator.php',
75
-			'/includes/class-wpb-i18n.php',
76
-			'/includes/class-wpb-loader.php',
77
-			'/includes/class-wpb.php',
78
-			'/admin/class-wpb-admin.php',
79
-			'/admin/class-wpb-admin-menu.php',
80
-			'/admin/class-wpb-admin-submenu.php',
81
-			'/admin/partials/wpb-admin-display.php',
82
-			'/admin/css/wpb-admin.css',
83
-			'/admin/js/wpb-admin.js',
84
-			'/public/class-wpb-public.php',
85
-			'/public/partials/wpb-public-display.php',
86
-			'/public/css/wpb-public.css',
87
-			'/public/js/wpb-public.js',
88
-			'/routes/web.php',
89
-			'/routes/api.php',
90
-			'/resources/js/admin/main.js',
91
-			'/resources/js/frontend/main.js',
92
-			'/resources/js/spa/main.js',
93
-			'/src/Application.php',
94
-			'/src/helpers.php',
95
-			'/src/Support/Facades/Config.php',
96
-			'/src/Support/Facades/Route.php',
97
-			'/src/Http/Kernel.php',
98
-			'/src/Http/Events/RequestHandler.php',
99
-			'/src/Exceptions/Handler.php',
100
-			'/app/User.php',
101
-			'/app/Post.php',
102
-			'/app/Http/Controllers/ProductController.php',
103
-			'/app/Http/Middleware/AuthMiddleware.php',
104
-			'/app/Http/Middleware/VerifyCsrfToken.php',
105
-			'/app/Http/Kernel.php',
106
-			'/app/Exceptions/Handler.php',
107
-		);
70
+        $files = array(
71
+            '/wpb.php',
72
+            '/bootstrap/app.php',
73
+            '/includes/class-wpb-activator.php',
74
+            '/includes/class-wpb-deactivator.php',
75
+            '/includes/class-wpb-i18n.php',
76
+            '/includes/class-wpb-loader.php',
77
+            '/includes/class-wpb.php',
78
+            '/admin/class-wpb-admin.php',
79
+            '/admin/class-wpb-admin-menu.php',
80
+            '/admin/class-wpb-admin-submenu.php',
81
+            '/admin/partials/wpb-admin-display.php',
82
+            '/admin/css/wpb-admin.css',
83
+            '/admin/js/wpb-admin.js',
84
+            '/public/class-wpb-public.php',
85
+            '/public/partials/wpb-public-display.php',
86
+            '/public/css/wpb-public.css',
87
+            '/public/js/wpb-public.js',
88
+            '/routes/web.php',
89
+            '/routes/api.php',
90
+            '/resources/js/admin/main.js',
91
+            '/resources/js/frontend/main.js',
92
+            '/resources/js/spa/main.js',
93
+            '/src/Application.php',
94
+            '/src/helpers.php',
95
+            '/src/Support/Facades/Config.php',
96
+            '/src/Support/Facades/Route.php',
97
+            '/src/Http/Kernel.php',
98
+            '/src/Http/Events/RequestHandler.php',
99
+            '/src/Exceptions/Handler.php',
100
+            '/app/User.php',
101
+            '/app/Post.php',
102
+            '/app/Http/Controllers/ProductController.php',
103
+            '/app/Http/Middleware/AuthMiddleware.php',
104
+            '/app/Http/Middleware/VerifyCsrfToken.php',
105
+            '/app/Http/Kernel.php',
106
+            '/app/Exceptions/Handler.php',
107
+        );
108 108
 
109
-		foreach ( $files as $file ) {
110
-			$file = $root . $file;
111
-			if ( file_exists( $file ) ) {
112
-				$contents = get_contents( $file );
113
-				$contents = str_replace( 'wpb_', $snake_case . '_', $contents );
114
-				$contents = str_replace( 'wpb', $vendor_name, $contents );
115
-				$contents = str_replace( 'WPB_APP_ROOT', strtoupper( $camel_case ) . '_APP_ROOT', $contents );
116
-				$contents = str_replace( 'WPB_FILE', strtoupper( $camel_case ) . '_FILE', $contents );
117
-				$contents = str_replace( 'WPB_PATH', strtoupper( $camel_case ) . '_PATH', $contents );
118
-				$contents = str_replace( 'WPB_INCLUDES', strtoupper( $camel_case ) . '_INCLUDES', $contents );
119
-				$contents = str_replace( 'WPB_URL', strtoupper( $camel_case ) . '_URL', $contents );
120
-				$contents = str_replace( 'WPB_ASSETS', strtoupper( $camel_case ) . '_ASSETS', $contents );
121
-				$contents = str_replace( 'WPB_VERSION', strtoupper( $camel_case ) . '_VERSION', $contents );
122
-				$contents = str_replace( 'WPB', $camel_case, $contents );
123
-				put_contents(
124
-					$file,
125
-					$contents
126
-				);
109
+        foreach ( $files as $file ) {
110
+            $file = $root . $file;
111
+            if ( file_exists( $file ) ) {
112
+                $contents = get_contents( $file );
113
+                $contents = str_replace( 'wpb_', $snake_case . '_', $contents );
114
+                $contents = str_replace( 'wpb', $vendor_name, $contents );
115
+                $contents = str_replace( 'WPB_APP_ROOT', strtoupper( $camel_case ) . '_APP_ROOT', $contents );
116
+                $contents = str_replace( 'WPB_FILE', strtoupper( $camel_case ) . '_FILE', $contents );
117
+                $contents = str_replace( 'WPB_PATH', strtoupper( $camel_case ) . '_PATH', $contents );
118
+                $contents = str_replace( 'WPB_INCLUDES', strtoupper( $camel_case ) . '_INCLUDES', $contents );
119
+                $contents = str_replace( 'WPB_URL', strtoupper( $camel_case ) . '_URL', $contents );
120
+                $contents = str_replace( 'WPB_ASSETS', strtoupper( $camel_case ) . '_ASSETS', $contents );
121
+                $contents = str_replace( 'WPB_VERSION', strtoupper( $camel_case ) . '_VERSION', $contents );
122
+                $contents = str_replace( 'WPB', $camel_case, $contents );
123
+                put_contents(
124
+                    $file,
125
+                    $contents
126
+                );
127 127
 
128
-				$dir           = dirname( $file );
129
-				$file_name     = basename( $file );
130
-				$new_file_name = str_replace( 'wpb', $vendor_name, $file_name );
128
+                $dir           = dirname( $file );
129
+                $file_name     = basename( $file );
130
+                $new_file_name = str_replace( 'wpb', $vendor_name, $file_name );
131 131
 
132
-				if ( $file_name !== $new_file_name ) {
133
-					rename( $file, $dir . '/' . $new_file_name );
134
-				}
135
-			}
136
-		}
132
+                if ( $file_name !== $new_file_name ) {
133
+                    rename( $file, $dir . '/' . $new_file_name );
134
+                }
135
+            }
136
+        }
137 137
 
138
-		static::update_bootstrap( $root, $camel_case );
139
-	}
138
+        static::update_bootstrap( $root, $camel_case );
139
+    }
140 140
 
141
-	/**
142
-	 * Replace bootstrap file.
143
-	 *
144
-	 * @since    1.0.0
145
-	 * @access   public
146
-	 *
147
-	 * @param string $root The string is unique root path for each plugin.
148
-	 * @param string $camel_case This string is camel case of project name.
149
-	 *
150
-	 * @return void
151
-	 */
152
-	protected static function update_bootstrap( $root, $camel_case ) {
153
-		$file = $root . '/bootstrap/app.php';
154
-		if ( file_exists( $file ) ) {
155
-			$contents = get_contents( $file );
156
-			$contents = str_replace( 'WPB_APP_ROOT', strtoupper( $camel_case ) . '_APP_ROOT', $contents );
157
-			put_contents(
158
-				$file,
159
-				$contents
160
-			);
141
+    /**
142
+     * Replace bootstrap file.
143
+     *
144
+     * @since    1.0.0
145
+     * @access   public
146
+     *
147
+     * @param string $root The string is unique root path for each plugin.
148
+     * @param string $camel_case This string is camel case of project name.
149
+     *
150
+     * @return void
151
+     */
152
+    protected static function update_bootstrap( $root, $camel_case ) {
153
+        $file = $root . '/bootstrap/app.php';
154
+        if ( file_exists( $file ) ) {
155
+            $contents = get_contents( $file );
156
+            $contents = str_replace( 'WPB_APP_ROOT', strtoupper( $camel_case ) . '_APP_ROOT', $contents );
157
+            put_contents(
158
+                $file,
159
+                $contents
160
+            );
161 161
 
162
-		}
163
-	}
162
+        }
163
+    }
164 164
 }
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
 	 * @param  \Composer\Script\Event $event The composer event.
33 33
 	 * @return void
34 34
 	 */
35
-	public static function post_install( Event $event ) {
36
-		require_once $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/autoload.php';
35
+	public static function post_install(Event $event) {
36
+		require_once $event->getComposer()->getConfig()->get('vendor-dir').'/autoload.php';
37 37
 	}
38 38
 
39 39
 	/**
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 * @param  \Composer\Script\Event $event The composer event.
43 43
 	 * @return void
44 44
 	 */
45
-	public static function post_update( Event $event ) {
46
-		require_once $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/autoload.php';
45
+	public static function post_update(Event $event) {
46
+		require_once $event->getComposer()->getConfig()->get('vendor-dir').'/autoload.php';
47 47
 	}
48 48
 
49 49
 	/**
@@ -52,20 +52,20 @@  discard block
 block discarded – undo
52 52
 	 * @param  \Composer\Script\Event $event The composer event.
53 53
 	 * @return void
54 54
 	 */
55
-	public static function post_autoload_dump( Event $event ) {
56
-		require_once $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/autoload.php';
55
+	public static function post_autoload_dump(Event $event) {
56
+		require_once $event->getComposer()->getConfig()->get('vendor-dir').'/autoload.php';
57 57
 
58
-		$dir  = $event->getComposer()->getConfig()->get( 'vendor-dir' ) . '/../';
59
-		$root = dirname( $event->getComposer()->getConfig()->get( 'vendor-dir' ) );
58
+		$dir  = $event->getComposer()->getConfig()->get('vendor-dir').'/../';
59
+		$root = dirname($event->getComposer()->getConfig()->get('vendor-dir'));
60 60
 
61
-		$vendor_name         = strtolower( basename( $root ) );
62
-		$partials            = explode( '-', $vendor_name );
61
+		$vendor_name         = strtolower(basename($root));
62
+		$partials            = explode('-', $vendor_name);
63 63
 		$camel_case_partials = array();
64
-		foreach ( $partials as $partial ) {
65
-			$camel_case_partials[] = ucfirst( strtolower( $partial ) );
64
+		foreach ($partials as $partial) {
65
+			$camel_case_partials[] = ucfirst(strtolower($partial));
66 66
 		}
67
-		$camel_case = implode( '_', $camel_case_partials );
68
-		$snake_case = implode( '_', $partials );
67
+		$camel_case = implode('_', $camel_case_partials);
68
+		$snake_case = implode('_', $partials);
69 69
 
70 70
 		$files = array(
71 71
 			'/wpb.php',
@@ -106,36 +106,36 @@  discard block
 block discarded – undo
106 106
 			'/app/Exceptions/Handler.php',
107 107
 		);
108 108
 
109
-		foreach ( $files as $file ) {
110
-			$file = $root . $file;
111
-			if ( file_exists( $file ) ) {
112
-				$contents = get_contents( $file );
113
-				$contents = str_replace( 'wpb_', $snake_case . '_', $contents );
114
-				$contents = str_replace( 'wpb', $vendor_name, $contents );
115
-				$contents = str_replace( 'WPB_APP_ROOT', strtoupper( $camel_case ) . '_APP_ROOT', $contents );
116
-				$contents = str_replace( 'WPB_FILE', strtoupper( $camel_case ) . '_FILE', $contents );
117
-				$contents = str_replace( 'WPB_PATH', strtoupper( $camel_case ) . '_PATH', $contents );
118
-				$contents = str_replace( 'WPB_INCLUDES', strtoupper( $camel_case ) . '_INCLUDES', $contents );
119
-				$contents = str_replace( 'WPB_URL', strtoupper( $camel_case ) . '_URL', $contents );
120
-				$contents = str_replace( 'WPB_ASSETS', strtoupper( $camel_case ) . '_ASSETS', $contents );
121
-				$contents = str_replace( 'WPB_VERSION', strtoupper( $camel_case ) . '_VERSION', $contents );
122
-				$contents = str_replace( 'WPB', $camel_case, $contents );
109
+		foreach ($files as $file) {
110
+			$file = $root.$file;
111
+			if (file_exists($file)) {
112
+				$contents = get_contents($file);
113
+				$contents = str_replace('wpb_', $snake_case.'_', $contents);
114
+				$contents = str_replace('wpb', $vendor_name, $contents);
115
+				$contents = str_replace('WPB_APP_ROOT', strtoupper($camel_case).'_APP_ROOT', $contents);
116
+				$contents = str_replace('WPB_FILE', strtoupper($camel_case).'_FILE', $contents);
117
+				$contents = str_replace('WPB_PATH', strtoupper($camel_case).'_PATH', $contents);
118
+				$contents = str_replace('WPB_INCLUDES', strtoupper($camel_case).'_INCLUDES', $contents);
119
+				$contents = str_replace('WPB_URL', strtoupper($camel_case).'_URL', $contents);
120
+				$contents = str_replace('WPB_ASSETS', strtoupper($camel_case).'_ASSETS', $contents);
121
+				$contents = str_replace('WPB_VERSION', strtoupper($camel_case).'_VERSION', $contents);
122
+				$contents = str_replace('WPB', $camel_case, $contents);
123 123
 				put_contents(
124 124
 					$file,
125 125
 					$contents
126 126
 				);
127 127
 
128
-				$dir           = dirname( $file );
129
-				$file_name     = basename( $file );
130
-				$new_file_name = str_replace( 'wpb', $vendor_name, $file_name );
128
+				$dir           = dirname($file);
129
+				$file_name     = basename($file);
130
+				$new_file_name = str_replace('wpb', $vendor_name, $file_name);
131 131
 
132
-				if ( $file_name !== $new_file_name ) {
133
-					rename( $file, $dir . '/' . $new_file_name );
132
+				if ($file_name !== $new_file_name) {
133
+					rename($file, $dir.'/'.$new_file_name);
134 134
 				}
135 135
 			}
136 136
 		}
137 137
 
138
-		static::update_bootstrap( $root, $camel_case );
138
+		static::update_bootstrap($root, $camel_case);
139 139
 	}
140 140
 
141 141
 	/**
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
 	 *
150 150
 	 * @return void
151 151
 	 */
152
-	protected static function update_bootstrap( $root, $camel_case ) {
153
-		$file = $root . '/bootstrap/app.php';
154
-		if ( file_exists( $file ) ) {
155
-			$contents = get_contents( $file );
156
-			$contents = str_replace( 'WPB_APP_ROOT', strtoupper( $camel_case ) . '_APP_ROOT', $contents );
152
+	protected static function update_bootstrap($root, $camel_case) {
153
+		$file = $root.'/bootstrap/app.php';
154
+		if (file_exists($file)) {
155
+			$contents = get_contents($file);
156
+			$contents = str_replace('WPB_APP_ROOT', strtoupper($camel_case).'_APP_ROOT', $contents);
157 157
 			put_contents(
158 158
 				$file,
159 159
 				$contents
Please login to merge, or discard this patch.
bootstrap/app.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -16,35 +16,35 @@
 block discarded – undo
16 16
 use WPB\Application;
17 17
 
18 18
 $app = ( new Application(
19
-	array(
20
-		'paths' => array(
21
-			'root' => WPB_APP_ROOT,
22
-		),
23
-	)
19
+    array(
20
+        'paths' => array(
21
+            'root' => WPB_APP_ROOT,
22
+        ),
23
+    )
24 24
 ) );
25 25
 
26 26
 $container = $app->getInstance();
27 27
 
28 28
 $container->singleton(
29
-	Illuminate\Contracts\Http\Kernel::class,
30
-	\WPB\App\Http\Kernel::class
29
+    Illuminate\Contracts\Http\Kernel::class,
30
+    \WPB\App\Http\Kernel::class
31 31
 );
32 32
 $container->singleton(
33
-	\Illuminate\Contracts\Debug\ExceptionHandler::class,
34
-	\WPB\App\Exceptions\Handler::class
33
+    \Illuminate\Contracts\Debug\ExceptionHandler::class,
34
+    \WPB\App\Exceptions\Handler::class
35 35
 );
36 36
 
37 37
 try {
38 38
 
39
-	$kernel = $container->make( \Illuminate\Contracts\Http\Kernel::class );
39
+    $kernel = $container->make( \Illuminate\Contracts\Http\Kernel::class );
40 40
 
41
-	$response = $kernel->handle( \Illuminate\Http\Request::capture() );
41
+    $response = $kernel->handle( \Illuminate\Http\Request::capture() );
42 42
 
43
-	$response->send();
43
+    $response->send();
44 44
 
45 45
 } catch ( \Exception $ex ) {
46
-	if ( ! \WPB\Support\Facades\Route::current() ) {
47
-		return true;
48
-	}
49
-	throw new \Exception( $ex, 1 );
46
+    if ( ! \WPB\Support\Facades\Route::current() ) {
47
+        return true;
48
+    }
49
+    throw new \Exception( $ex, 1 );
50 50
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -9,19 +9,19 @@  discard block
 block discarded – undo
9 9
  * @subpackage WPB/bootstrap
10 10
  */
11 11
 
12
-require_once ABSPATH . 'wp-includes/pluggable.php';
13
-require_once __DIR__ . '/../vendor/autoload.php';
14
-require_once __DIR__ . '/../src/helpers.php';
12
+require_once ABSPATH.'wp-includes/pluggable.php';
13
+require_once __DIR__.'/../vendor/autoload.php';
14
+require_once __DIR__.'/../src/helpers.php';
15 15
 
16 16
 use WPB\Application;
17 17
 
18
-$app = ( new Application(
18
+$app = (new Application(
19 19
 	array(
20 20
 		'paths' => array(
21 21
 			'root' => WPB_APP_ROOT,
22 22
 		),
23 23
 	)
24
-) );
24
+));
25 25
 
26 26
 $container = $app->getInstance();
27 27
 
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
 
37 37
 try {
38 38
 
39
-	$kernel = $container->make( \Illuminate\Contracts\Http\Kernel::class );
39
+	$kernel = $container->make(\Illuminate\Contracts\Http\Kernel::class);
40 40
 
41
-	$response = $kernel->handle( \Illuminate\Http\Request::capture() );
41
+	$response = $kernel->handle(\Illuminate\Http\Request::capture());
42 42
 
43 43
 	$response->send();
44 44
 
45
-} catch ( \Exception $ex ) {
46
-	if ( ! \WPB\Support\Facades\Route::current() ) {
45
+} catch (\Exception $ex) {
46
+	if (!\WPB\Support\Facades\Route::current()) {
47 47
 		return true;
48 48
 	}
49
-	throw new \Exception( $ex, 1 );
49
+	throw new \Exception($ex, 1);
50 50
 }
Please login to merge, or discard this patch.
public/class-wpb-public.php 2 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -21,82 +21,82 @@
 block discarded – undo
21 21
  */
22 22
 class WPB_Public {
23 23
 
24
-	/**
25
-	 * The ID of this plugin.
26
-	 *
27
-	 * @since    1.0.0
28
-	 * @access   private
29
-	 * @var      string    $plugin_name    The ID of this plugin.
30
-	 */
31
-	private $plugin_name;
24
+    /**
25
+     * The ID of this plugin.
26
+     *
27
+     * @since    1.0.0
28
+     * @access   private
29
+     * @var      string    $plugin_name    The ID of this plugin.
30
+     */
31
+    private $plugin_name;
32 32
 
33
-	/**
34
-	 * The version of this plugin.
35
-	 *
36
-	 * @since    1.0.0
37
-	 * @access   private
38
-	 * @var      string    $version    The current version of this plugin.
39
-	 */
40
-	private $version;
33
+    /**
34
+     * The version of this plugin.
35
+     *
36
+     * @since    1.0.0
37
+     * @access   private
38
+     * @var      string    $version    The current version of this plugin.
39
+     */
40
+    private $version;
41 41
 
42
-	/**
43
-	 * Initialize the class and set its properties.
44
-	 *
45
-	 * @since    1.0.0
46
-	 * @param      string $plugin_name       The name of the plugin.
47
-	 * @param      string $version    The version of this plugin.
48
-	 */
49
-	public function __construct( $plugin_name, $version ) {
42
+    /**
43
+     * Initialize the class and set its properties.
44
+     *
45
+     * @since    1.0.0
46
+     * @param      string $plugin_name       The name of the plugin.
47
+     * @param      string $version    The version of this plugin.
48
+     */
49
+    public function __construct( $plugin_name, $version ) {
50 50
 
51
-		$this->plugin_name = $plugin_name;
52
-		$this->version     = $version;
51
+        $this->plugin_name = $plugin_name;
52
+        $this->version     = $version;
53 53
 
54
-	}
54
+    }
55 55
 
56
-	/**
57
-	 * Register the stylesheets for the public-facing side of the site.
58
-	 *
59
-	 * @since    1.0.0
60
-	 */
61
-	public function enqueue_styles() {
56
+    /**
57
+     * Register the stylesheets for the public-facing side of the site.
58
+     *
59
+     * @since    1.0.0
60
+     */
61
+    public function enqueue_styles() {
62 62
 
63
-		/**
64
-		 * This function is provided for demonstration purposes only.
65
-		 *
66
-		 * An instance of this class should be passed to the run() function
67
-		 * defined in WPB_Loader as all of the hooks are defined
68
-		 * in that particular class.
69
-		 *
70
-		 * The WPB_Loader will then create the relationship
71
-		 * between the defined hooks and the functions defined in this
72
-		 * class.
73
-		 */
63
+        /**
64
+         * This function is provided for demonstration purposes only.
65
+         *
66
+         * An instance of this class should be passed to the run() function
67
+         * defined in WPB_Loader as all of the hooks are defined
68
+         * in that particular class.
69
+         *
70
+         * The WPB_Loader will then create the relationship
71
+         * between the defined hooks and the functions defined in this
72
+         * class.
73
+         */
74 74
 
75
-		wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wpb-public.css', array(), $this->version, 'all' );
75
+        wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wpb-public.css', array(), $this->version, 'all' );
76 76
 
77
-	}
77
+    }
78 78
 
79
-	/**
80
-	 * Register the JavaScript for the public-facing side of the site.
81
-	 *
82
-	 * @since    1.0.0
83
-	 */
84
-	public function enqueue_scripts() {
79
+    /**
80
+     * Register the JavaScript for the public-facing side of the site.
81
+     *
82
+     * @since    1.0.0
83
+     */
84
+    public function enqueue_scripts() {
85 85
 
86
-		/**
87
-		 * This function is provided for demonstration purposes only.
88
-		 *
89
-		 * An instance of this class should be passed to the run() function
90
-		 * defined in WPB_Loader as all of the hooks are defined
91
-		 * in that particular class.
92
-		 *
93
-		 * The WPB_Loader will then create the relationship
94
-		 * between the defined hooks and the functions defined in this
95
-		 * class.
96
-		 */
86
+        /**
87
+         * This function is provided for demonstration purposes only.
88
+         *
89
+         * An instance of this class should be passed to the run() function
90
+         * defined in WPB_Loader as all of the hooks are defined
91
+         * in that particular class.
92
+         *
93
+         * The WPB_Loader will then create the relationship
94
+         * between the defined hooks and the functions defined in this
95
+         * class.
96
+         */
97 97
 
98
-		wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wpb-public.js', array( 'jquery' ), $this->version, false );
98
+        wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wpb-public.js', array( 'jquery' ), $this->version, false );
99 99
 
100
-	}
100
+    }
101 101
 
102 102
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @param      string $plugin_name       The name of the plugin.
47 47
 	 * @param      string $version    The version of this plugin.
48 48
 	 */
49
-	public function __construct( $plugin_name, $version ) {
49
+	public function __construct($plugin_name, $version) {
50 50
 
51 51
 		$this->plugin_name = $plugin_name;
52 52
 		$this->version     = $version;
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		 * class.
73 73
 		 */
74 74
 
75
-		wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wpb-public.css', array(), $this->version, 'all' );
75
+		wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/wpb-public.css', array(), $this->version, 'all');
76 76
 
77 77
 	}
78 78
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		 * class.
96 96
 		 */
97 97
 
98
-		wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wpb-public.js', array( 'jquery' ), $this->version, false );
98
+		wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__).'js/wpb-public.js', array('jquery'), $this->version, false);
99 99
 
100 100
 	}
101 101
 
Please login to merge, or discard this patch.