Passed
Push — master ( 93534b...206518 )
by Nirjhar
08:40
created
autoload.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit;
2
+if ( ! defined('ABSPATH')) exit;
3 3
 
4 4
 /**
5 5
  * Main plugin object to define the plugin
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @author     Nirjhar Lo
9 9
  * @package    wp-plugin-framework
10 10
  */
11
-if ( ! class_exists( 'PLUGIN_BUILD' ) ) {
11
+if ( ! class_exists('PLUGIN_BUILD')) {
12 12
 
13 13
 	final class PLUGIN_BUILD {
14 14
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		 */
70 70
 		public static function instance() {
71 71
 
72
-			if ( is_null( self::$_instance ) ) {
72
+			if (is_null(self::$_instance)) {
73 73
 				self::$_instance = new self();
74 74
 				self::$_instance->init();
75 75
 			}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 			}
96 96
 
97 97
 			//If CPT exists, include taht and flush the rewrite rules
98
-			if ( class_exists( 'PLUGIN_CPT' ) ) new PLUGIN_CPT();
98
+			if (class_exists('PLUGIN_CPT')) new PLUGIN_CPT();
99 99
 			flush_rewrite_rules();
100 100
 		}
101 101
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		 */
108 108
 		public function cron_activation() {
109 109
 
110
-			if ( class_exists( 'PLUGIN_CRON' ) ) {
110
+			if (class_exists('PLUGIN_CRON')) {
111 111
 
112 112
 				$cron = new PLUGIN_CRON();
113 113
 				$schedule = $cron->schedule_task(
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		 */
131 131
 		public function db_install() {
132 132
 
133
-			if ( class_exists( 'PLUGIN_DB' ) ) {
133
+			if (class_exists('PLUGIN_DB')) {
134 134
 
135 135
 				$db = new PLUGIN_DB();
136 136
 				$db->table = self::$plugin_table;
@@ -140,15 +140,15 @@  discard block
 block discarded – undo
140 140
 				$db->build();
141 141
 			}
142 142
 
143
-			if (get_option( '_plugin_db_exist') == '0' ) {
144
-				add_action( 'admin_notices', array( $this, 'db_error_msg' ) );
143
+			if (get_option('_plugin_db_exist') == '0') {
144
+				add_action('admin_notices', array($this, 'db_error_msg'));
145 145
 			}
146 146
 
147 147
 			$options = array(
148
-				array( 'option_name', '__value__' ),
148
+				array('option_name', '__value__'),
149 149
 			);
150
-			foreach ( $options as $value ) {
151
-				update_option( $value[0], $value[1] );
150
+			foreach ($options as $value) {
151
+				update_option($value[0], $value[1]);
152 152
 			}
153 153
 		}
154 154
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		public function db_error_msg() { ?>
162 162
 
163 163
 			<div class="notice notice-error is-dismissible">
164
-				<p><?php _e( 'Database table Not installed correctly.', 'textdomain' ); ?></p>
164
+				<p><?php _e('Database table Not installed correctly.', 'textdomain'); ?></p>
165 165
  			</div>
166 166
 			<?php
167 167
 		}
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
 			$table_name = self::$plugin_table;
178 178
 
179 179
 			global $wpdb;
180
-			$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}$table_name" );
180
+			$wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}$table_name");
181 181
 
182 182
 			$options = array(
183 183
 				'_plugin_db_exist'
184 184
 			);
185
-			foreach ( $options as $value ) {
186
-				delete_option( $value );
185
+			foreach ($options as $value) {
186
+				delete_option($value);
187 187
 			}
188 188
 		}
189 189
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 		 */
207 207
 		public function custom_cron_hook_cb() {
208 208
 
209
-			add_action( 'custom_cron_hook', array( $this, 'do_cron_job_function' ) );
209
+			add_action('custom_cron_hook', array($this, 'do_cron_job_function'));
210 210
 		}
211 211
 
212 212
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 		 */
218 218
 		public function cron_uninstall() {
219 219
 
220
-			wp_clear_scheduled_hook( 'custom_cron_hook' );
220
+			wp_clear_scheduled_hook('custom_cron_hook');
221 221
 		}
222 222
 
223 223
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 		 */
229 229
 		public function cpt() {
230 230
 
231
-			if ( class_exists( 'PLUGIN_CPT' ) ) new PLUGIN_CPT();
231
+			if (class_exists('PLUGIN_CPT')) new PLUGIN_CPT();
232 232
 		}
233 233
 
234 234
 
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 		 */
240 240
 		public function scripts() {
241 241
 
242
-			if ( class_exists( 'PLUGIN_SCRIPT' ) ) new PLUGIN_SCRIPT();
242
+			if (class_exists('PLUGIN_SCRIPT')) new PLUGIN_SCRIPT();
243 243
 		}
244 244
 
245 245
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 		 */
251 251
 		public function settings() {
252 252
 
253
-			if ( class_exists( 'PLUGIN_SETTINGS' ) ) new PLUGIN_SETTINGS();
253
+			if (class_exists('PLUGIN_SETTINGS')) new PLUGIN_SETTINGS();
254 254
 		}
255 255
 
256 256
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 		 */
262 262
 		public function widgets() {
263 263
 
264
-			if ( class_exists( 'PLUGIN_WIDGET' ) ) new PLUGIN_WIDGET();
264
+			if (class_exists('PLUGIN_WIDGET')) new PLUGIN_WIDGET();
265 265
 		}
266 266
 
267 267
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		 */
273 273
 		public function metabox() {
274 274
 
275
-			if ( class_exists( 'PLUGIN_METABOX' ) ) new PLUGIN_METABOX();
275
+			if (class_exists('PLUGIN_METABOX')) new PLUGIN_METABOX();
276 276
 		}
277 277
 
278 278
 
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 		 */
284 284
 		public function shortcode() {
285 285
 
286
-			if ( class_exists( 'PLUGIN_SHORTCODE' ) ) new PLUGIN_SHORTCODE();
286
+			if (class_exists('PLUGIN_SHORTCODE')) new PLUGIN_SHORTCODE();
287 287
 		}
288 288
 
289 289
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 		 */
295 295
 		 public function rest_api() {
296 296
 
297
-			 if ( class_exists( 'PLUGIN_CUSTOM_ROUTE' ) ) new PLUGIN_CUSTOM_ROUTE();
297
+			 if (class_exists('PLUGIN_CUSTOM_ROUTE')) new PLUGIN_CUSTOM_ROUTE();
298 298
 		 }
299 299
 
300 300
 
@@ -306,15 +306,15 @@  discard block
 block discarded – undo
306 306
 		 */
307 307
 		public function functionality() {
308 308
 
309
-			require_once( 'src/class-install.php' );
310
-			require_once( 'src/class-db.php' );
311
-			require_once( 'src/class-query.php' );
312
-			require_once( 'src/class-settings.php' );
313
-			require_once( 'src/class-widget.php' );
314
-			require_once( 'src/class-metabox.php' );
315
-			require_once( 'src/class-shortcode.php' );
316
-			require_once( 'src/class-cpt.php' );
317
-			require_once( 'src/class-rest.php' );
309
+			require_once('src/class-install.php');
310
+			require_once('src/class-db.php');
311
+			require_once('src/class-query.php');
312
+			require_once('src/class-settings.php');
313
+			require_once('src/class-widget.php');
314
+			require_once('src/class-metabox.php');
315
+			require_once('src/class-shortcode.php');
316
+			require_once('src/class-cpt.php');
317
+			require_once('src/class-rest.php');
318 318
 		}
319 319
 
320 320
 
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
 		 */
327 327
 		public function helpers() {
328 328
 
329
-			require_once( 'lib/class-cron.php' );
330
-			require_once( 'lib/class-api.php' );
331
-			require_once( 'lib/class-table.php' );
332
-			require_once( 'lib/class-ajax.php' );
333
-			require_once( 'lib/class-upload.php' );
334
-			require_once( 'lib/class-script.php' );
329
+			require_once('lib/class-cron.php');
330
+			require_once('lib/class-api.php');
331
+			require_once('lib/class-table.php');
332
+			require_once('lib/class-ajax.php');
333
+			require_once('lib/class-upload.php');
334
+			require_once('lib/class-script.php');
335 335
 		}
336 336
 
337 337
 
@@ -345,17 +345,17 @@  discard block
 block discarded – undo
345 345
 			$this->helpers();
346 346
 			$this->functionality();
347 347
 
348
-			register_activation_hook( PLUGIN_FILE, array( $this, 'db_install' ) );
349
-			register_activation_hook( PLUGIN_FILE, array( $this, 'cron_activation' ) );
348
+			register_activation_hook(PLUGIN_FILE, array($this, 'db_install'));
349
+			register_activation_hook(PLUGIN_FILE, array($this, 'cron_activation'));
350 350
 
351 351
 			//remove the DB and CORN upon uninstallation
352 352
 			//using $this won't work here.
353
-			register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'db_uninstall' ) );
354
-			register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'cron_uninstall' ) );
353
+			register_uninstall_hook(PLUGIN_FILE, array('PLUGIN_BUILD', 'db_uninstall'));
354
+			register_uninstall_hook(PLUGIN_FILE, array('PLUGIN_BUILD', 'cron_uninstall'));
355 355
 
356
-			add_action( 'init', array( $this, 'installation' ) );
357
-			add_action( 'init', array( $this, 'custom_cron_hook_cb' ) );
358
-			add_action( 'init', array( $this, 'cpt' ) );
356
+			add_action('init', array($this, 'installation'));
357
+			add_action('init', array($this, 'custom_cron_hook_cb'));
358
+			add_action('init', array($this, 'cpt'));
359 359
 
360 360
 			$this->scripts();
361 361
 			$this->widgets();
Please login to merge, or discard this patch.
src/class-rest.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-<?php
3
-if ( ! defined( 'ABSPATH' ) ) exit;
2
+< ?php
3
+if ( ! defined('ABSPATH')) exit;
4 4
 
5 5
 /**
6 6
  * Extending REST API framework of WordPress
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @author     Nirjhar Lo
9 9
  * @package    wp-plugin-framework
10 10
  */
11
-if ( ! class_exists( 'PLUGIN_CUSTOM_ROUTE' ) ) {
11
+if ( ! class_exists('PLUGIN_CUSTOM_ROUTE')) {
12 12
 
13 13
 	class PLUGIN_CUSTOM_ROUTE extends WP_REST_Controller {
14 14
 
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
     		$base = 'route';
26 26
 
27 27
 			//Available options for methods are CREATABLE, READABLE, EDITABLE, DELETABLE
28
-			register_rest_route( $namespace, '/' . $base, array(
28
+			register_rest_route($namespace, '/' . $base, array(
29 29
         		'methods'             => WP_REST_Server::READABLE,
30
-        		'callback'            => array( $this, 'callback' ),
31
-        		'permission_callback' => array( $this, 'permission' ),
30
+        		'callback'            => array($this, 'callback'),
31
+        		'permission_callback' => array($this, 'permission'),
32 32
         		'args'                => array('sample', 'list', 'of', 'args'),
33 33
       		),
34 34
 		}
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
 
44 44
     		$params = $request->get_params();
45 45
     		$items = array();
46
-    		$data = $this->prepare_item_for_response( $items, $request );
46
+    		$data = $this->prepare_item_for_response($items, $request);
47 47
 
48
-    		if ( $data ) {
49
-      			return new WP_REST_Response( $data, 200 );
48
+    		if ($data) {
49
+      			return new WP_REST_Response($data, 200);
50 50
     		} else {
51
-				return new WP_Error( 'status_code', __( 'message', 'text-domain' ) );
51
+				return new WP_Error('status_code', __('message', 'text-domain'));
52 52
 			}
53 53
 		}
54 54
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		 */
61 61
 		public function permission() {
62 62
 
63
-			return current_user_can( 'manage_options' );
63
+			return current_user_can('manage_options');
64 64
 		}
65 65
 
66 66
 
Please login to merge, or discard this patch.