Passed
Push — master ( 1297c1...1551ad )
by Nirjhar
02:14
created
autoload.php 2 patches
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  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
6 6
  */
7
-if ( ! class_exists( 'PLUGIN_BUILD' ) ) {
7
+if ( ! class_exists('PLUGIN_BUILD')) {
8 8
 
9 9
 	final class PLUGIN_BUILD {
10 10
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		 */
45 45
 		public function cron_activation() {
46 46
 
47
-			if ( class_exists( 'PLUGIN_CRON' ) ) {
47
+			if (class_exists('PLUGIN_CRON')) {
48 48
 
49 49
 				$cron = new PLUGIN_CRON();
50 50
 				$schedule = $cron->schedule_task(
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		 */
68 68
 		public function db_install() {
69 69
 
70
-			if ( class_exists( 'PLUGIN_DB' ) ) {
70
+			if (class_exists('PLUGIN_DB')) {
71 71
 
72 72
 				$db = new PLUGIN_DB();
73 73
 				$db->table = self::$plugin_table;
@@ -77,15 +77,15 @@  discard block
 block discarded – undo
77 77
 				$db->build();
78 78
 			}
79 79
 
80
-			if (get_option( '_plugin_db_exist') == '0' ) {
81
-				add_action( 'admin_notices', array( $this, 'db_error_msg' ) );
80
+			if (get_option('_plugin_db_exist') == '0') {
81
+				add_action('admin_notices', array($this, 'db_error_msg'));
82 82
 			}
83 83
 
84 84
 			$options = array(
85
-				array( 'option_name', '__value__' ),
85
+				array('option_name', '__value__'),
86 86
 			);
87
-			foreach ( $options as $value ) {
88
-				update_option( $value[0], $value[1] );
87
+			foreach ($options as $value) {
88
+				update_option($value[0], $value[1]);
89 89
 			}
90 90
 		}
91 91
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 		public function db_error_msg() { ?>
99 99
 
100 100
 			<div class="notice notice-error is-dismissible">
101
-				<p><?php _e( 'Database table Not installed correctly.', 'textdomain' ); ?></p>
101
+				<p><?php _e('Database table Not installed correctly.', 'textdomain'); ?></p>
102 102
  			</div>
103 103
 			<?php
104 104
 		}
@@ -114,13 +114,13 @@  discard block
 block discarded – undo
114 114
 			$table_name = self::$plugin_table;
115 115
 
116 116
 			global $wpdb;
117
-			$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}$table_name" );
117
+			$wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}$table_name");
118 118
 
119 119
 			$options = array(
120 120
 				'_plugin_db_exist'
121 121
 			);
122
-			foreach ( $options as $value ) {
123
-				delete_option( $value );
122
+			foreach ($options as $value) {
123
+				delete_option($value);
124 124
 			}
125 125
 		}
126 126
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 		 */
144 144
 		public function custom_cron_hook_cb() {
145 145
 
146
-			add_action( 'custom_cron_hook', array( $this, 'do_cron_job_function' ) );
146
+			add_action('custom_cron_hook', array($this, 'do_cron_job_function'));
147 147
 		}
148 148
 
149 149
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 		 */
155 155
 		public function cron_uninstall() {
156 156
 
157
-			wp_clear_scheduled_hook( 'custom_cron_hook' );
157
+			wp_clear_scheduled_hook('custom_cron_hook');
158 158
 		}
159 159
 
160 160
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 		 */
166 166
 		public function scripts() {
167 167
 
168
-			if ( class_exists( 'PLUGIN_SCRIPT' ) ) new PLUGIN_SCRIPT();
168
+			if (class_exists('PLUGIN_SCRIPT')) new PLUGIN_SCRIPT();
169 169
 		}
170 170
 
171 171
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		 */
177 177
 		public function settings() {
178 178
 
179
-			if ( class_exists( 'PLUGIN_SETTINGS' ) ) new PLUGIN_SETTINGS();
179
+			if (class_exists('PLUGIN_SETTINGS')) new PLUGIN_SETTINGS();
180 180
 		}
181 181
 
182 182
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		 */
188 188
 		public function widgets() {
189 189
 
190
-			if ( class_exists( 'PLUGIN_WIDGET' ) ) new PLUGIN_WIDGET();
190
+			if (class_exists('PLUGIN_WIDGET')) new PLUGIN_WIDGET();
191 191
 		}
192 192
 
193 193
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 		 */
199 199
 		public function metabox() {
200 200
 
201
-			if ( class_exists( 'PLUGIN_METABOX' ) ) new PLUGIN_METABOX();
201
+			if (class_exists('PLUGIN_METABOX')) new PLUGIN_METABOX();
202 202
 		}
203 203
 
204 204
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 		 */
210 210
 		public function shortcode() {
211 211
 
212
-			if ( class_exists( 'PLUGIN_SHORTCODE' ) ) new PLUGIN_SHORTCODE();
212
+			if (class_exists('PLUGIN_SHORTCODE')) new PLUGIN_SHORTCODE();
213 213
 		}
214 214
 
215 215
 
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
 		 */
222 222
 		public function functionality() {
223 223
 
224
-			require_once( 'src/install.php' );
225
-			require_once( 'src/db.php' );
226
-			require_once( 'src/query.php' );
227
-			require_once( 'src/settings.php' );
228
-			require_once( 'src/widget.php' );
229
-			require_once( 'src/metabox.php' );
230
-			require_once( 'src/shortcode.php' );
224
+			require_once('src/install.php');
225
+			require_once('src/db.php');
226
+			require_once('src/query.php');
227
+			require_once('src/settings.php');
228
+			require_once('src/widget.php');
229
+			require_once('src/metabox.php');
230
+			require_once('src/shortcode.php');
231 231
 		}
232 232
 
233 233
 
@@ -239,12 +239,12 @@  discard block
 block discarded – undo
239 239
 		 */
240 240
 		public function helpers() {
241 241
 
242
-			require_once( 'lib/cron.php' );
243
-			require_once( 'lib/api.php' );
244
-			require_once( 'lib/table.php' );
245
-			require_once( 'lib/ajax.php' );
246
-			require_once( 'lib/upload.php' );
247
-			require_once( 'lib/script.php' );
242
+			require_once('lib/cron.php');
243
+			require_once('lib/api.php');
244
+			require_once('lib/table.php');
245
+			require_once('lib/ajax.php');
246
+			require_once('lib/upload.php');
247
+			require_once('lib/script.php');
248 248
 		}
249 249
 
250 250
 
@@ -258,16 +258,16 @@  discard block
 block discarded – undo
258 258
 			$this->helpers();
259 259
 			$this->functionality();
260 260
 
261
-			register_activation_hook( PLUGIN_FILE, array( $this, 'db_install' ) );
262
-			register_activation_hook( PLUGIN_FILE, array($this, 'cron_activation' ) );
261
+			register_activation_hook(PLUGIN_FILE, array($this, 'db_install'));
262
+			register_activation_hook(PLUGIN_FILE, array($this, 'cron_activation'));
263 263
 
264 264
 			//remove the DB and CORN upon uninstallation
265 265
 			//$this won't work here.
266
-			register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'db_uninstall' ) );
267
-			register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'cron_uninstall' ) );
266
+			register_uninstall_hook(PLUGIN_FILE, array('PLUGIN_BUILD', 'db_uninstall'));
267
+			register_uninstall_hook(PLUGIN_FILE, array('PLUGIN_BUILD', 'cron_uninstall'));
268 268
 
269
-			add_action( 'init', array( $this, 'installation' ) );
270
-			add_action( 'init', array( $this, 'custom_cron_hook_cb' ) );
269
+			add_action('init', array($this, 'installation'));
270
+			add_action('init', array($this, 'custom_cron_hook_cb'));
271 271
 
272 272
 			$this->scripts();
273 273
 			$this->widgets();
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit;
2
+if ( ! defined( 'ABSPATH' ) ) {
3
+	exit;
4
+}
3 5
 
4 6
 /**
5 7
  * Main plugin object to define the plugin
@@ -165,7 +167,9 @@  discard block
 block discarded – undo
165 167
 		 */
166 168
 		public function scripts() {
167 169
 
168
-			if ( class_exists( 'PLUGIN_SCRIPT' ) ) new PLUGIN_SCRIPT();
170
+			if ( class_exists( 'PLUGIN_SCRIPT' ) ) {
171
+				new PLUGIN_SCRIPT();
172
+			}
169 173
 		}
170 174
 
171 175
 
@@ -176,7 +180,9 @@  discard block
 block discarded – undo
176 180
 		 */
177 181
 		public function settings() {
178 182
 
179
-			if ( class_exists( 'PLUGIN_SETTINGS' ) ) new PLUGIN_SETTINGS();
183
+			if ( class_exists( 'PLUGIN_SETTINGS' ) ) {
184
+				new PLUGIN_SETTINGS();
185
+			}
180 186
 		}
181 187
 
182 188
 
@@ -187,7 +193,9 @@  discard block
 block discarded – undo
187 193
 		 */
188 194
 		public function widgets() {
189 195
 
190
-			if ( class_exists( 'PLUGIN_WIDGET' ) ) new PLUGIN_WIDGET();
196
+			if ( class_exists( 'PLUGIN_WIDGET' ) ) {
197
+				new PLUGIN_WIDGET();
198
+			}
191 199
 		}
192 200
 
193 201
 
@@ -198,7 +206,9 @@  discard block
 block discarded – undo
198 206
 		 */
199 207
 		public function metabox() {
200 208
 
201
-			if ( class_exists( 'PLUGIN_METABOX' ) ) new PLUGIN_METABOX();
209
+			if ( class_exists( 'PLUGIN_METABOX' ) ) {
210
+				new PLUGIN_METABOX();
211
+			}
202 212
 		}
203 213
 
204 214
 
@@ -209,7 +219,9 @@  discard block
 block discarded – undo
209 219
 		 */
210 220
 		public function shortcode() {
211 221
 
212
-			if ( class_exists( 'PLUGIN_SHORTCODE' ) ) new PLUGIN_SHORTCODE();
222
+			if ( class_exists( 'PLUGIN_SHORTCODE' ) ) {
223
+				new PLUGIN_SHORTCODE();
224
+			}
213 225
 		}
214 226
 
215 227
 
Please login to merge, or discard this patch.
wp-plugin-framework.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -11,23 +11,23 @@
 block discarded – undo
11 11
  License: GPLv2
12 12
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
13 13
  */
14
-if ( !defined( 'ABSPATH' ) ) exit;
14
+if ( ! defined('ABSPATH')) exit;
15 15
 
16 16
 
17 17
 //Define basic names
18 18
 //Edit the "_PLUGIN" in following namespaces for compatibility with your desired name.
19
-defined( 'PLUGIN_DEBUG' ) or define( 'PLUGIN_DEBUG', false );
19
+defined('PLUGIN_DEBUG') or define('PLUGIN_DEBUG', false);
20 20
 
21
-defined( 'PLUGIN_PATH' ) or define( 'PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
22
-defined( 'PLUGIN_FILE' ) or define( 'PLUGIN_FILE', plugin_basename( __FILE__ ) );
21
+defined('PLUGIN_PATH') or define('PLUGIN_PATH', plugin_dir_path(__FILE__));
22
+defined('PLUGIN_FILE') or define('PLUGIN_FILE', plugin_basename(__FILE__));
23 23
 
24
-defined( 'PLUGIN_TRANSLATE' ) or define( 'PLUGIN_TRANSLATE', plugin_basename( plugin_dir_path( __FILE__ ) . 'asset/ln/' ) );
24
+defined('PLUGIN_TRANSLATE') or define('PLUGIN_TRANSLATE', plugin_basename(plugin_dir_path(__FILE__) . 'asset/ln/'));
25 25
 
26
-defined( 'PLUGIN_JS' ) or define( 'PLUGIN_JS', plugins_url( '/asset/js/', __FILE__  ) );
27
-defined( 'PLUGIN_CSS' ) or define( 'PLUGIN_CSS', plugins_url( '/asset/css/', __FILE__ ) );
28
-defined( 'PLUGIN_IMAGE' ) or define( 'PLUGIN_IMAGE', plugins_url( '/asset/img/', __FILE__ ) );
26
+defined('PLUGIN_JS') or define('PLUGIN_JS', plugins_url('/asset/js/', __FILE__));
27
+defined('PLUGIN_CSS') or define('PLUGIN_CSS', plugins_url('/asset/css/', __FILE__));
28
+defined('PLUGIN_IMAGE') or define('PLUGIN_IMAGE', plugins_url('/asset/img/', __FILE__));
29 29
 
30 30
 
31 31
 //The Plugin
32
-require_once( 'autoload.php' );
33
-if ( class_exists( 'PLUGIN_BUILD' ) ) new PLUGIN_BUILD(); ?>
32
+require_once('autoload.php');
33
+if (class_exists('PLUGIN_BUILD')) new PLUGIN_BUILD(); ?>
Please login to merge, or discard this patch.
Braces   +7 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,9 @@  discard block
 block discarded – undo
11 11
  License: GPLv2
12 12
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
13 13
  */
14
-if ( !defined( 'ABSPATH' ) ) exit;
14
+if ( !defined( 'ABSPATH' ) ) {
15
+	exit;
16
+}
15 17
 
16 18
 
17 19
 //Define basic names
@@ -30,4 +32,7 @@  discard block
 block discarded – undo
30 32
 
31 33
 //The Plugin
32 34
 require_once( 'autoload.php' );
33
-if ( class_exists( 'PLUGIN_BUILD' ) ) new PLUGIN_BUILD(); ?>
35
+if ( class_exists( 'PLUGIN_BUILD' ) ) {
36
+	new PLUGIN_BUILD();
37
+}
38
+?>
Please login to merge, or discard this patch.
src/install.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit;
2
+if ( ! defined('ABSPATH')) exit;
3 3
 
4 4
 /**
5 5
  * Implimentation of WordPress inbuilt functions for plugin activation.
6 6
  */
7
-if ( ! class_exists( 'PLUGIN_INSTALL' ) ) {
7
+if ( ! class_exists('PLUGIN_INSTALL')) {
8 8
 
9 9
 	final class PLUGIN_INSTALL {
10 10
 
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 		 */
22 22
 		public function execute() {
23 23
 
24
-			add_action( 'plugins_loaded', array( $this, 'text_domain_cb' ) );
25
-			add_action( 'admin_notices', array( $this, 'php_ver_incompatible' ) );
26
-			add_filter( 'plugin_action_links', array( $this, 'menu_page_link' ), 10, 2 );
24
+			add_action('plugins_loaded', array($this, 'text_domain_cb'));
25
+			add_action('admin_notices', array($this, 'php_ver_incompatible'));
26
+			add_filter('plugin_action_links', array($this, 'menu_page_link'), 10, 2);
27 27
 		}
28 28
 
29 29
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
 			unload_textdomain($this->text_domain);
41 41
 			load_textdomain($this->text_domain, PLUGIN_LN . 'textdomain-' . $locale . '.mo');
42
-			load_plugin_textdomain( $this->text_domain, false, PLUGIN_LN );
42
+			load_plugin_textdomain($this->text_domain, false, PLUGIN_LN);
43 43
 		}
44 44
 
45 45
 
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 		 */
51 51
 		public function php_ver_incompatible() {
52 52
 
53
-			if ( version_compare( phpversion(), $this->php_ver_allowed, '<' ) ) :
54
-				$text = __( 'The Plugin can\'t be activated because your PHP version', 'textdomain' );
55
-				$text_last = __( 'is less than required '.$this->php_ver_allowed.'. See more information', 'textdomain' );
53
+			if (version_compare(phpversion(), $this->php_ver_allowed, '<')) :
54
+				$text = __('The Plugin can\'t be activated because your PHP version', 'textdomain');
55
+				$text_last = __('is less than required ' . $this->php_ver_allowed . '. See more information', 'textdomain');
56 56
 				$text_link = 'php.net/eol.php'; ?>
57 57
 
58 58
 				<div id="message" class="updated notice notice-success is-dismissible">
@@ -72,20 +72,20 @@  discard block
 block discarded – undo
72 72
 		 * @param String $file
73 73
 		 * @return Array
74 74
 		 */
75
-		public function menu_page_link( $links, $file ) {
75
+		public function menu_page_link($links, $file) {
76 76
 
77 77
 			if ($this->plugin_page_links) {
78 78
 				static $this_plugin;
79
-				if ( ! $this_plugin ) {
79
+				if ( ! $this_plugin) {
80 80
 					$this_plugin = PLUGIN_FILE;
81 81
 				}
82
-				if ( $file == $this_plugin ) {
82
+				if ($file == $this_plugin) {
83 83
 					$shift_link = array();
84 84
 					foreach ($this->plugin_page_links as $value) {
85
-						$shift_link[] = '<a href="'.$value['slug'].'">'.$value['label'].'</a>';
85
+						$shift_link[] = '<a href="' . $value['slug'] . '">' . $value['label'] . '</a>';
86 86
 					}
87
-					foreach( $shift_link as $val ) {
88
-						array_unshift( $links, $val );
87
+					foreach ($shift_link as $val) {
88
+						array_unshift($links, $val);
89 89
 					}
90 90
 				}
91 91
 				return $links;
Please login to merge, or discard this patch.