Completed
Push — master ( 35416d...50e245 )
by CodexShaper
03:37
created
includes/class-wpb.php 1 patch
Spacing   +46 added lines, -46 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';
@@ -104,34 +104,34 @@  discard block
 block discarded – undo
104 104
 		 * The class responsible for orchestrating the actions and filters of the
105 105
 		 * core plugin.
106 106
 		 */
107
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpb-loader.php';
107
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wpb-loader.php';
108 108
 
109 109
 		/**
110 110
 		 * The class responsible for defining internationalization functionality
111 111
 		 * of the plugin.
112 112
 		 */
113
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpb-i18n.php';
113
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wpb-i18n.php';
114 114
 
115 115
 		/**
116 116
 		 * The class responsible for defining all actions that occur in the admin area.
117 117
 		 */
118
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin.php';
118
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wpb-admin.php';
119 119
 
120 120
 		/**
121 121
 		 * The class responsible for defining all menu actions that occur in the admin area.
122 122
 		 */
123
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin-menu.php';
123
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wpb-admin-menu.php';
124 124
 
125 125
 		/**
126 126
 		 * The class responsible for defining all submenu actions that occur in the admin area.
127 127
 		 */
128
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin-submenu.php';
128
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wpb-admin-submenu.php';
129 129
 
130 130
 		/**
131 131
 		 * The class responsible for defining all actions that occur in the public-facing
132 132
 		 * side of the site.
133 133
 		 */
134
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wpb-public.php';
134
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wpb-public.php';
135 135
 
136 136
 		$this->loader = new WPB_Loader();
137 137
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 
151 151
 		$plugin_i18n = new WPB_I18n();
152 152
 
153
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
153
+		$this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain');
154 154
 
155 155
 	}
156 156
 
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	private function define_admin_hooks() {
165 165
 
166
-		$plugin_admin = new WPB_Admin( $this->get_plugin_name(), $this->get_version() );
166
+		$plugin_admin = new WPB_Admin($this->get_plugin_name(), $this->get_version());
167 167
 
168
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
169
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
168
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles');
169
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts');
170 170
 
171 171
 	}
172 172
 
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
 	 */
180 180
 	private function define_public_hooks() {
181 181
 
182
-		$plugin_public = new WPB_Public( $this->get_plugin_name(), $this->get_version() );
182
+		$plugin_public = new WPB_Public($this->get_plugin_name(), $this->get_version());
183 183
 
184
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
185
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
184
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles');
185
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts');
186 186
 
187 187
 	}
188 188
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @return void
233 233
 	 */
234 234
 	public function define_constants() {
235
-		define( 'WPB_VERSION', $this->version );
235
+		define('WPB_VERSION', $this->version);
236 236
 	}
237 237
 
238 238
 	/**
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 	 * @return void
242 242
 	 */
243 243
 	public function register_assets() {
244
-		$this->register_scripts( $this->get_scripts() );
245
-		$this->register_styles( $this->get_styles() );
244
+		$this->register_scripts($this->get_scripts());
245
+		$this->register_styles($this->get_styles());
246 246
 	}
247 247
 
248 248
 	/**
@@ -252,13 +252,13 @@  discard block
 block discarded – undo
252 252
 	 *
253 253
 	 * @return void
254 254
 	 */
255
-	private function register_scripts( $scripts ) {
256
-		foreach ( $scripts as $handle => $script ) {
257
-			$deps      = isset( $script['deps'] ) ? $script['deps'] : false;
258
-			$in_footer = isset( $script['in_footer'] ) ? $script['in_footer'] : false;
259
-			$version   = isset( $script['version'] ) ? $script['version'] : WPB_VERSION;
255
+	private function register_scripts($scripts) {
256
+		foreach ($scripts as $handle => $script) {
257
+			$deps      = isset($script['deps']) ? $script['deps'] : false;
258
+			$in_footer = isset($script['in_footer']) ? $script['in_footer'] : false;
259
+			$version   = isset($script['version']) ? $script['version'] : WPB_VERSION;
260 260
 
261
-			wp_register_script( $handle, $script['src'], $deps, $version, $in_footer );
261
+			wp_register_script($handle, $script['src'], $deps, $version, $in_footer);
262 262
 		}
263 263
 	}
264 264
 
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
 	 *
270 270
 	 * @return void
271 271
 	 */
272
-	public function register_styles( $styles ) {
273
-		foreach ( $styles as $handle => $style ) {
274
-			$deps = isset( $style['deps'] ) ? $style['deps'] : false;
272
+	public function register_styles($styles) {
273
+		foreach ($styles as $handle => $style) {
274
+			$deps = isset($style['deps']) ? $style['deps'] : false;
275 275
 
276
-			wp_register_style( $handle, $style['src'], $deps, WPB_VERSION );
276
+			wp_register_style($handle, $style['src'], $deps, WPB_VERSION);
277 277
 		}
278 278
 	}
279 279
 
@@ -284,35 +284,35 @@  discard block
 block discarded – undo
284 284
 	 */
285 285
 	public function get_scripts() {
286 286
 
287
-		$prefix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.min' : '';
287
+		$prefix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.min' : '';
288 288
 
289 289
 		$scripts = array(
290 290
 			'wpb-runtime'  => array(
291
-				'src'       => WPB_ASSETS . '/js/runtime.js',
292
-				'version'   => filemtime( WPB_PATH . '/public/js/runtime.js' ),
291
+				'src'       => WPB_ASSETS.'/js/runtime.js',
292
+				'version'   => filemtime(WPB_PATH.'/public/js/runtime.js'),
293 293
 				'in_footer' => true,
294 294
 			),
295 295
 			'wpb-vendor'   => array(
296
-				'src'       => WPB_ASSETS . '/js/vendors.js',
297
-				'version'   => filemtime( WPB_PATH . '/public/js/vendors.js' ),
296
+				'src'       => WPB_ASSETS.'/js/vendors.js',
297
+				'version'   => filemtime(WPB_PATH.'/public/js/vendors.js'),
298 298
 				'in_footer' => true,
299 299
 			),
300 300
 			'wpb-frontend' => array(
301
-				'src'       => WPB_ASSETS . '/js/frontend.js',
302
-				'deps'      => array( 'jquery', 'wpb-vendor', 'wpb-runtime' ),
303
-				'version'   => filemtime( WPB_PATH . '/public/js/frontend.js' ),
301
+				'src'       => WPB_ASSETS.'/js/frontend.js',
302
+				'deps'      => array('jquery', 'wpb-vendor', 'wpb-runtime'),
303
+				'version'   => filemtime(WPB_PATH.'/public/js/frontend.js'),
304 304
 				'in_footer' => true,
305 305
 			),
306 306
 			'wpb-admin'    => array(
307
-				'src'       => WPB_ASSETS . '/js/admin.js',
308
-				'deps'      => array( 'jquery', 'wpb-vendor', 'wpb-runtime' ),
309
-				'version'   => filemtime( WPB_PATH . '/public/js/admin.js' ),
307
+				'src'       => WPB_ASSETS.'/js/admin.js',
308
+				'deps'      => array('jquery', 'wpb-vendor', 'wpb-runtime'),
309
+				'version'   => filemtime(WPB_PATH.'/public/js/admin.js'),
310 310
 				'in_footer' => true,
311 311
 			),
312 312
 			'wpb-spa'      => array(
313
-				'src'       => WPB_ASSETS . '/js/spa.js',
314
-				'deps'      => array( 'jquery', 'wpb-vendor', 'wpb-runtime' ),
315
-				'version'   => filemtime( WPB_PATH . '/public/js/spa.js' ),
313
+				'src'       => WPB_ASSETS.'/js/spa.js',
314
+				'deps'      => array('jquery', 'wpb-vendor', 'wpb-runtime'),
315
+				'version'   => filemtime(WPB_PATH.'/public/js/spa.js'),
316 316
 				'in_footer' => true,
317 317
 			),
318 318
 		);
@@ -329,19 +329,19 @@  discard block
 block discarded – undo
329 329
 
330 330
 		$styles = array(
331 331
 			'wpb-style'    => array(
332
-				'src' => WPB_ASSETS . '/css/style.css',
332
+				'src' => WPB_ASSETS.'/css/style.css',
333 333
 			),
334 334
 			'wpb-frontend' => array(
335
-				'src' => WPB_ASSETS . '/css/frontend.css',
335
+				'src' => WPB_ASSETS.'/css/frontend.css',
336 336
 			),
337 337
 			'wpb-admin'    => array(
338
-				'src' => WPB_ASSETS . '/css/admin.css',
338
+				'src' => WPB_ASSETS.'/css/admin.css',
339 339
 			),
340 340
 			'wpb-spa'      => array(
341
-				'src' => WPB_ASSETS . '/css/spa.css',
341
+				'src' => WPB_ASSETS.'/css/spa.css',
342 342
 			),
343 343
 			'wpb-vendors'  => array(
344
-				'src' => WPB_ASSETS . '/css/vendors.css',
344
+				'src' => WPB_ASSETS.'/css/vendors.css',
345 345
 			),
346 346
 		);
347 347
 
Please login to merge, or discard this patch.
admin/class-wpb-admin.php 1 patch
Spacing   +6 added lines, -6 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 this 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-admin.css', array(), $this->version, 'all' );
75
+		wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/wpb-admin.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-admin.js', array( 'jquery' ), $this->version, false );
98
+		wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__).'js/wpb-admin.js', array('jquery'), $this->version, false);
99 99
 
100 100
 	}
101 101
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function register_menus() {
108 108
 		// Registerv root menu.
109
-		$menu             = new WPB_Admin_Menu( $this->plugin_name );
109
+		$menu             = new WPB_Admin_Menu($this->plugin_name);
110 110
 		$menu->page_title = 'WPB';
111 111
 		$menu->menu_title = 'WPB';
112 112
 		$menu->capability = 'manage_options';
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
 		$menu->icon       = 'dashicons-text';
115 115
 		$menu->save();
116 116
 		// Register submenu for root menu.
117
-		$submenu              = new WPB_Admin_SubMenu( $this->plugin_name );
117
+		$submenu              = new WPB_Admin_SubMenu($this->plugin_name);
118 118
 		$submenu->parent_slug = $menu->slug;
119 119
 		$submenu->page_title  = 'Settings';
120 120
 		$submenu->menu_title  = 'Settings';
121 121
 		$submenu->capability  = 'manage_options';
122
-		$submenu->slug        = 'admin.php?page=' . $menu->slug . '#/settings';
122
+		$submenu->slug        = 'admin.php?page='.$menu->slug.'#/settings';
123 123
 		$submenu->save();
124 124
 	}
125 125
 
Please login to merge, or discard this patch.
admin/class-wpb-admin-menu.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 * @since    1.0.0
101 101
 	 * @access   public
102 102
 	 */
103
-	public function __construct( $plugin_name ) {
103
+	public function __construct($plugin_name) {
104 104
 		$this->plugin_name = $plugin_name;
105 105
 	}
106 106
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @access   public
112 112
 	 */
113 113
 	public function save() {
114
-		add_action( 'admin_menu', array( $this, 'create_menu' ) );
114
+		add_action('admin_menu', array($this, 'create_menu'));
115 115
 	}
116 116
 
117 117
 	/**
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
 	 * @param    array $options Pass proprties as an array.
122 122
 	 * @access   public
123 123
 	 */
124
-	public function make( $options = array() ) {
125
-		foreach ( $options as $property => $value ) {
126
-			if ( property_exists( get_called_class(), $property ) ) {
124
+	public function make($options = array()) {
125
+		foreach ($options as $property => $value) {
126
+			if (property_exists(get_called_class(), $property)) {
127 127
 				$this->{$property} = $value;
128 128
 			}
129 129
 		}
130
-		add_action( 'admin_menu', array( $this, 'create_menu' ) );
130
+		add_action('admin_menu', array($this, 'create_menu'));
131 131
 	}
132 132
 
133 133
 	/**
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 * @return void
137 137
 	 */
138 138
 	public function create_menu() {
139
-		$callback = $this->callback ?? array( $this, 'render_content' );
139
+		$callback = $this->callback ?? array($this, 'render_content');
140 140
 		$hook     = add_menu_page(
141 141
 			$this->page_title,
142 142
 			$this->menu_title,
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 			$this->icon
147 147
 		);
148 148
 
149
-		add_action( 'load-' . $hook, array( $this, 'init_hooks' ) );
149
+		add_action('load-'.$hook, array($this, 'init_hooks'));
150 150
 	}
151 151
 
152 152
 	/**
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 * @return void
156 156
 	 */
157 157
 	public function init_hooks() {
158
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
158
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
159 159
 	}
160 160
 
161 161
 	/**
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 	 * @return void
165 165
 	 */
166 166
 	public function enqueue_scripts() {
167
-		wp_enqueue_style( $this->plugin_name . '-vendors' );
168
-		wp_enqueue_style( $this->plugin_name . '-admin' );
169
-		wp_enqueue_script( $this->plugin_name . '-admin' );
167
+		wp_enqueue_style($this->plugin_name.'-vendors');
168
+		wp_enqueue_style($this->plugin_name.'-admin');
169
+		wp_enqueue_script($this->plugin_name.'-admin');
170 170
 	}
171 171
 
172 172
 	/**
@@ -175,6 +175,6 @@  discard block
 block discarded – undo
175 175
 	 * @return void
176 176
 	 */
177 177
 	public function render_content() {
178
-		echo '<div class="wrap"><div id="wpb-admin" base-url="' . esc_attr( get_site_url() ) . '" csrf-token="' . esc_attr( wpb_csrf_token() ) . '"></div></div>';
178
+		echo '<div class="wrap"><div id="wpb-admin" base-url="'.esc_attr(get_site_url()).'" csrf-token="'.esc_attr(wpb_csrf_token()).'"></div></div>';
179 179
 	}
180 180
 }
Please login to merge, or discard this patch.