Passed
Push — master ( 2434f2...f94701 )
by Nirjhar
08:29
created
autoload.php 1 patch
Spacing   +40 added lines, -40 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
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @license    http://www.gnu.org/licenses/gpl-3.0.txt GNU LESSER GENERAL PUBLIC LICENSE
12 12
  * @package    wp-plugin-framework
13 13
  */
14
-if ( ! class_exists( 'PLUGIN_BUILD' ) ) {
14
+if ( ! class_exists('PLUGIN_BUILD')) {
15 15
 
16 16
 	final class PLUGIN_BUILD {
17 17
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		 */
73 73
 		public static function instance() {
74 74
 
75
-			if ( is_null( self::$_instance ) ) {
75
+			if (is_null(self::$_instance)) {
76 76
 				self::$_instance = new self();
77 77
 				self::$_instance->init();
78 78
 			}
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 		 */
107 107
 		public function cron_activation() {
108 108
 
109
-			if ( class_exists( 'PLUGIN_CRON' ) ) {
109
+			if (class_exists('PLUGIN_CRON')) {
110 110
 
111 111
 				$cron = new PLUGIN_CRON();
112 112
 				$schedule = $cron->schedule_task(
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 		 */
130 130
 		public function db_install() {
131 131
 
132
-			if ( class_exists( 'PLUGIN_DB' ) ) {
132
+			if (class_exists('PLUGIN_DB')) {
133 133
 
134 134
 				$db = new PLUGIN_DB();
135 135
 				$db->table = self::$plugin_table;
@@ -139,15 +139,15 @@  discard block
 block discarded – undo
139 139
 				$db->build();
140 140
 			}
141 141
 
142
-			if (get_option( '_plugin_db_exist') == '0' ) {
143
-				add_action( 'admin_notices', array( $this, 'db_error_msg' ) );
142
+			if (get_option('_plugin_db_exist') == '0') {
143
+				add_action('admin_notices', array($this, 'db_error_msg'));
144 144
 			}
145 145
 
146 146
 			$options = array(
147
-				array( 'option_name', '__value__' ),
147
+				array('option_name', '__value__'),
148 148
 			);
149
-			foreach ( $options as $value ) {
150
-				update_option( $value[0], $value[1] );
149
+			foreach ($options as $value) {
150
+				update_option($value[0], $value[1]);
151 151
 			}
152 152
 		}
153 153
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 		public function db_error_msg() { ?>
161 161
 
162 162
 			<div class="notice notice-error is-dismissible">
163
-				<p><?php _e( 'Database table Not installed correctly.', 'textdomain' ); ?></p>
163
+				<p><?php _e('Database table Not installed correctly.', 'textdomain'); ?></p>
164 164
  			</div>
165 165
 			<?php
166 166
 		}
@@ -176,13 +176,13 @@  discard block
 block discarded – undo
176 176
 			$table_name = self::$plugin_table;
177 177
 
178 178
 			global $wpdb;
179
-			$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}$table_name" );
179
+			$wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}$table_name");
180 180
 
181 181
 			$options = array(
182 182
 				'_plugin_db_exist'
183 183
 			);
184
-			foreach ( $options as $value ) {
185
-				delete_option( $value );
184
+			foreach ($options as $value) {
185
+				delete_option($value);
186 186
 			}
187 187
 		}
188 188
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 		 */
206 206
 		public function custom_cron_hook_cb() {
207 207
 
208
-			add_action( 'custom_cron_hook', array( $this, 'do_cron_job_function' ) );
208
+			add_action('custom_cron_hook', array($this, 'do_cron_job_function'));
209 209
 		}
210 210
 
211 211
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 		 */
217 217
 		public function cron_uninstall() {
218 218
 
219
-			wp_clear_scheduled_hook( 'custom_cron_hook' );
219
+			wp_clear_scheduled_hook('custom_cron_hook');
220 220
 		}
221 221
 
222 222
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 		 */
228 228
 		public function scripts() {
229 229
 
230
-			if ( class_exists( 'PLUGIN_SCRIPT' ) ) new PLUGIN_SCRIPT();
230
+			if (class_exists('PLUGIN_SCRIPT')) new PLUGIN_SCRIPT();
231 231
 		}
232 232
 
233 233
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 		 */
239 239
 		public function settings() {
240 240
 
241
-			if ( class_exists( 'PLUGIN_SETTINGS' ) ) new PLUGIN_SETTINGS();
241
+			if (class_exists('PLUGIN_SETTINGS')) new PLUGIN_SETTINGS();
242 242
 		}
243 243
 
244 244
 
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 		 */
250 250
 		public function widgets() {
251 251
 
252
-			if ( class_exists( 'PLUGIN_WIDGET' ) ) new PLUGIN_WIDGET();
252
+			if (class_exists('PLUGIN_WIDGET')) new PLUGIN_WIDGET();
253 253
 		}
254 254
 
255 255
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 		 */
261 261
 		public function metabox() {
262 262
 
263
-			if ( class_exists( 'PLUGIN_METABOX' ) ) new PLUGIN_METABOX();
263
+			if (class_exists('PLUGIN_METABOX')) new PLUGIN_METABOX();
264 264
 		}
265 265
 
266 266
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 		 */
272 272
 		public function shortcode() {
273 273
 
274
-			if ( class_exists( 'PLUGIN_SHORTCODE' ) ) new PLUGIN_SHORTCODE();
274
+			if (class_exists('PLUGIN_SHORTCODE')) new PLUGIN_SHORTCODE();
275 275
 		}
276 276
 
277 277
 
@@ -283,13 +283,13 @@  discard block
 block discarded – undo
283 283
 		 */
284 284
 		public function functionality() {
285 285
 
286
-			require_once( 'src/install.php' );
287
-			require_once( 'src/db.php' );
288
-			require_once( 'src/query.php' );
289
-			require_once( 'src/settings.php' );
290
-			require_once( 'src/widget.php' );
291
-			require_once( 'src/metabox.php' );
292
-			require_once( 'src/shortcode.php' );
286
+			require_once('src/install.php');
287
+			require_once('src/db.php');
288
+			require_once('src/query.php');
289
+			require_once('src/settings.php');
290
+			require_once('src/widget.php');
291
+			require_once('src/metabox.php');
292
+			require_once('src/shortcode.php');
293 293
 		}
294 294
 
295 295
 
@@ -301,12 +301,12 @@  discard block
 block discarded – undo
301 301
 		 */
302 302
 		public function helpers() {
303 303
 
304
-			require_once( 'lib/cron.php' );
305
-			require_once( 'lib/api.php' );
306
-			require_once( 'lib/table.php' );
307
-			require_once( 'lib/ajax.php' );
308
-			require_once( 'lib/upload.php' );
309
-			require_once( 'lib/script.php' );
304
+			require_once('lib/cron.php');
305
+			require_once('lib/api.php');
306
+			require_once('lib/table.php');
307
+			require_once('lib/ajax.php');
308
+			require_once('lib/upload.php');
309
+			require_once('lib/script.php');
310 310
 		}
311 311
 
312 312
 
@@ -320,16 +320,16 @@  discard block
 block discarded – undo
320 320
 			$this->helpers();
321 321
 			$this->functionality();
322 322
 
323
-			register_activation_hook( PLUGIN_FILE, array( $this, 'db_install' ) );
324
-			register_activation_hook( PLUGIN_FILE, array( $this, 'cron_activation' ) );
323
+			register_activation_hook(PLUGIN_FILE, array($this, 'db_install'));
324
+			register_activation_hook(PLUGIN_FILE, array($this, 'cron_activation'));
325 325
 
326 326
 			//remove the DB and CORN upon uninstallation
327 327
 			//using $this won't work here.
328
-			register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'db_uninstall' ) );
329
-			register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'cron_uninstall' ) );
328
+			register_uninstall_hook(PLUGIN_FILE, array('PLUGIN_BUILD', 'db_uninstall'));
329
+			register_uninstall_hook(PLUGIN_FILE, array('PLUGIN_BUILD', 'cron_uninstall'));
330 330
 
331
-			add_action( 'init', array( $this, 'installation' ) );
332
-			add_action( 'init', array( $this, 'custom_cron_hook_cb' ) );
331
+			add_action('init', array($this, 'installation'));
332
+			add_action('init', array($this, 'custom_cron_hook_cb'));
333 333
 
334 334
 			$this->scripts();
335 335
 			$this->widgets();
Please login to merge, or discard this patch.
lib/api.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @version    1.2.1
17 17
  * @package    wp-plugin-framework
18 18
  */
19
-if ( ! class_exists( 'PLUGIN_API' ) ) {
19
+if ( ! class_exists('PLUGIN_API')) {
20 20
 
21 21
 	class PLUGIN_API {
22 22
 
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
 
91 91
 			$curl = curl_init();
92 92
 
93
-			curl_setopt_array( $curl, $this->build() );
93
+			curl_setopt_array($curl, $this->build());
94 94
 
95
-			$result = curl_exec( $curl );
96
-			$err = curl_error( $curl );
95
+			$result = curl_exec($curl);
96
+			$err = curl_error($curl);
97 97
 
98
-			curl_close( $curl );
98
+			curl_close($curl);
99 99
 
100
-			if ( $err ) {
100
+			if ($err) {
101 101
 				$result = "cURL Error #:" . $err;
102 102
 			}
103 103
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		 */
113 113
 		public function parse($data) {
114 114
 
115
-			call_user_func( array( $this, $this->data_type ), $data );
115
+			call_user_func(array($this, $this->data_type), $data);
116 116
 		}
117 117
 
118 118
 
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
 		 *
122 122
 		 * @return Array
123 123
 		 */
124
-		public function xml( $data ) {
124
+		public function xml($data) {
125 125
 
126
-			libxml_use_internal_errors( true );
127
-			$parsed = ( ! $data || $data == '' ? false : simplexml_load_string( $data ) );
126
+			libxml_use_internal_errors(true);
127
+			$parsed = ( ! $data || $data == '' ? false : simplexml_load_string($data));
128 128
 
129
-			if ( ! $parsed ) {
129
+			if ( ! $parsed) {
130 130
 				return false;
131 131
 				libxml_clear_errors();
132 132
 			} else {
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 		 *
141 141
 		 * @return Array
142 142
 		 */
143
-		public function json( $data ) {
143
+		public function json($data) {
144 144
 
145
-			$parsed = ( ! $data || $data == '' ? false : json_decode( $data, 1 ) );
145
+			$parsed = ( ! $data || $data == '' ? false : json_decode($data, 1));
146 146
 			return $parsed;
147 147
 		}
148 148
 	}
Please login to merge, or discard this patch.
lib/cron.php 2 patches
Spacing   +13 added lines, -13 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
  * Add Cron schedules and cron task callback
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @version    1.2.1
9 9
  * @package    wp-plugin-framework
10 10
  */
11
-if ( ! class_exists( 'PLUGIN_CRON' ) ) {
11
+if ( ! class_exists('PLUGIN_CRON')) {
12 12
 
13 13
 	final class PLUGIN_CRON {
14 14
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 		public function __construct() {
22 22
 
23 23
 			//Add cron schedules
24
-			add_filter('cron_schedules', array( $this, 'cron_schedules' ) );
24
+			add_filter('cron_schedules', array($this, 'cron_schedules'));
25 25
 		}
26 26
 
27 27
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 		 *
31 31
 		 * @return Void
32 32
 		 */
33
-		public function cron_schedules( $schedules ) {
33
+		public function cron_schedules($schedules) {
34 34
 
35 35
 			$prefix = 'prefix_'; // Avoid conflict with other crons. Example Reference: cron_30_mins
36 36
 
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 						);
52 52
 
53 53
 			/* Add each custom schedule into the cron job system. */
54
-			foreach($schedule_options as $schedule_key => $schedule){
54
+			foreach ($schedule_options as $schedule_key => $schedule) {
55 55
 
56
-				if(!isset($schedules[$prefix.$schedule_key])) {
56
+				if ( ! isset($schedules[$prefix . $schedule_key])) {
57 57
 
58
-					$schedules[$prefix.$schedule_key] = array(
58
+					$schedules[$prefix . $schedule_key] = array(
59 59
 									'interval' => $schedule['interval'],
60
-									'display' => __( 'Every '.$schedule['display'] )
60
+									'display' => __('Every ' . $schedule['display'])
61 61
 									);
62 62
 				}
63 63
 			}
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 		 */
74 74
 		public function schedule_task($task) {
75 75
 
76
-			if( ! $task ) {
76
+			if ( ! $task) {
77 77
 				return false;
78 78
 			}
79 79
 
@@ -83,17 +83,17 @@  discard block
 block discarded – undo
83 83
 						'hook'
84 84
 					);
85 85
 			$missing_keys = array();
86
-			foreach( $required_keys as $key ){
87
-				if( ! array_key_exists( $key, $task ) ) {
86
+			foreach ($required_keys as $key) {
87
+				if ( ! array_key_exists($key, $task)) {
88 88
 					$missing_keys[] = $key;
89 89
 				}
90 90
 			}
91 91
 
92
-			if( ! empty( $missing_keys ) ){
92
+			if ( ! empty($missing_keys)) {
93 93
 				return false;
94 94
 			}
95 95
 
96
-			if( wp_next_scheduled( $task['hook'] ) ){
96
+			if (wp_next_scheduled($task['hook'])) {
97 97
 				wp_clear_scheduled_hook($task['hook']);
98 98
 			}
99 99
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit;
2
+if ( ! defined( 'ABSPATH' ) ) {
3
+	exit;
4
+}
3 5
 
4 6
 /**
5 7
  * Add Cron schedules and cron task callback
Please login to merge, or discard this patch.
lib/table.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 13
 if ( ! class_exists( 'PLUGIN_TABLE' ) ) {
14 14
 
15 15
 	if ( ! class_exists( 'WP_List_Table' ) ) {
16
-    	require_once( ABSPATH . 'wp-admin/includes/screen.php' );
17
-    	require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
16
+		require_once( ABSPATH . 'wp-admin/includes/screen.php' );
17
+		require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
18 18
 	}
19 19
 
20 20
 	final class PLUGIN_TABLE extends WP_List_Table {
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
  * @version    1.2.1
11 11
  * @package    wp-plugin-framework
12 12
  */
13
-if ( ! class_exists( 'PLUGIN_TABLE' ) ) {
13
+if ( ! class_exists('PLUGIN_TABLE')) {
14 14
 
15
-	if ( ! class_exists( 'WP_List_Table' ) ) {
16
-    	require_once( ABSPATH . 'wp-admin/includes/screen.php' );
17
-    	require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
15
+	if ( ! class_exists('WP_List_Table')) {
16
+    	require_once(ABSPATH . 'wp-admin/includes/screen.php');
17
+    	require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
18 18
 	}
19 19
 
20 20
 	final class PLUGIN_TABLE extends WP_List_Table {
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 
30
-			parent::__construct( [
31
-				'singular' => __( 'Name', 'textdomain' ),
32
-				'plural'   => __( 'Names', 'textdomain' ),
30
+			parent::__construct([
31
+				'singular' => __('Name', 'textdomain'),
32
+				'plural'   => __('Names', 'textdomain'),
33 33
 				'ajax'     => false,
34
-			] );
34
+			]);
35 35
 		}
36 36
 
37 37
 
@@ -40,27 +40,27 @@  discard block
 block discarded – undo
40 40
 		 *
41 41
 		 * @return Array
42 42
 		 */
43
-		public static function get_Table( $per_page = 5, $page_number = 1 ) {
43
+		public static function get_Table($per_page = 5, $page_number = 1) {
44 44
 
45 45
 			global $wpdb;
46 46
 
47 47
 			//Take pivotal from URL
48
-			$link = ( isset( $_GET['link'] ) ? $_GET['link'] : 'link' );
48
+			$link = (isset($_GET['link']) ? $_GET['link'] : 'link');
49 49
 
50 50
 			//Build the db query base
51 51
 			$sql = "SELECT * FROM {$wpdb->prefix}wordpress_table";
52 52
 			$sql .= " QUERIES with $link'";
53 53
 
54 54
 			//Set filters in the query using $_REQUEST
55
-			if ( ! empty( $_REQUEST['orderby'] ) ) {
56
-				$sql .= ' ORDER BY ' . esc_sql( $_REQUEST['orderby'] );
57
-				$sql .= ! empty( $_REQUEST['order'] ) ? ' ' . esc_sql( $_REQUEST['order'] ) : ' ASC';
55
+			if ( ! empty($_REQUEST['orderby'])) {
56
+				$sql .= ' ORDER BY ' . esc_sql($_REQUEST['orderby']);
57
+				$sql .= ! empty($_REQUEST['order']) ? ' ' . esc_sql($_REQUEST['order']) : ' ASC';
58 58
 			}
59 59
 			$sql .= " LIMIT $per_page";
60
-			$sql .= ' OFFSET ' . ( $page_number - 1 ) * $per_page;
60
+			$sql .= ' OFFSET ' . ($page_number - 1) * $per_page;
61 61
 
62 62
 			//get the data from database
63
-			$result = $wpdb->get_results( $sql, 'ARRAY_A' );
63
+			$result = $wpdb->get_results($sql, 'ARRAY_A');
64 64
 
65 65
 			return $result;
66 66
 		}
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
 		 *
72 72
 		 * @return Void
73 73
 		 */
74
-		public static function delete_url( $id ) {
74
+		public static function delete_url($id) {
75 75
 
76 76
 			global $wpdb;
77 77
 
78
-			$wpdb->delete( "{$wpdb->prefix}wordpress_table", array( 'ID' => $id ), array( '%s' ) );
78
+			$wpdb->delete("{$wpdb->prefix}wordpress_table", array('ID' => $id), array('%s'));
79 79
 		}
80 80
 
81 81
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		 */
87 87
 		public function no_items() {
88 88
 
89
-			_e( 'No Items Added yet.', 'textDomain' );
89
+			_e('No Items Added yet.', 'textDomain');
90 90
 		}
91 91
 
92 92
 
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
 			global $wpdb;
101 101
 
102 102
 			//Take pivotal from URL
103
-			$link = ( isset( $_GET['link'] ) ? $_GET['link'] : 'link' );
103
+			$link = (isset($_GET['link']) ? $_GET['link'] : 'link');
104 104
 
105 105
 			//Build the db query base
106 106
 			$sql = "SELECT COUNT(*) FROM {$wpdb->prefix}wordpress_table";
107 107
 			$sql .= " QUERIES with $link'";
108 108
 
109
-			return $wpdb->get_var( $sql );
109
+			return $wpdb->get_var($sql);
110 110
 		}
111 111
 
112 112
 
@@ -115,17 +115,17 @@  discard block
 block discarded – undo
115 115
 		 *
116 116
 		 * @return Html
117 117
 		 */
118
-		public function column_name( $item ) {
118
+		public function column_name($item) {
119 119
 
120
-			$delete_nonce = wp_create_nonce( 'delete_url' );
121
-			$title = sprintf( '<strong>%s</strong>', $item['item_name'] );
120
+			$delete_nonce = wp_create_nonce('delete_url');
121
+			$title = sprintf('<strong>%s</strong>', $item['item_name']);
122 122
 
123 123
 			//Change the page instruction where you want to show it
124 124
 			$actions = array(
125
-					'delete' => sprintf( '<a href="?page=%s&action=%s&instruction=%s&_wpnonce=%s">%s</a>', esc_attr( $_REQUEST['page'] ), 'delete', absint( $item['ID'] ), $delete_nonce, __( 'Delete', 'textdomain' ) )
125
+					'delete' => sprintf('<a href="?page=%s&action=%s&instruction=%s&_wpnonce=%s">%s</a>', esc_attr($_REQUEST['page']), 'delete', absint($item['ID']), $delete_nonce, __('Delete', 'textdomain'))
126 126
 					);
127 127
 
128
-			return $title . $this->row_actions( $actions );
128
+			return $title . $this->row_actions($actions);
129 129
 		}
130 130
 
131 131
 
@@ -134,22 +134,22 @@  discard block
 block discarded – undo
134 134
 		 *
135 135
 		 * @return Html
136 136
 		 */
137
-		public function column_default( $item, $column_name ) {
137
+		public function column_default($item, $column_name) {
138 138
 
139
-			switch ( $column_name ) {
139
+			switch ($column_name) {
140 140
 
141 141
 				case 'name':
142 142
 					//This is the first column
143
-					return $this->column_name( $item );
143
+					return $this->column_name($item);
144 144
 				case 'caseOne':
145 145
 				case 'caseTwo':
146 146
 				case 'caseThree':
147
-					return $item[ $column_name ];
147
+					return $item[$column_name];
148 148
 
149 149
 				default:
150 150
 
151 151
 					//Show the whole array for troubleshooting purposes
152
-					return print_r( $item, true );
152
+					return print_r($item, true);
153 153
 			}
154 154
 		}
155 155
 
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 		 *
160 160
 		 * @return Html
161 161
 		 */
162
-		public function column_cb( $item ) {
162
+		public function column_cb($item) {
163 163
 
164
-			return sprintf( '<input type="checkbox" name="bulk-select[]" value="%s" />', $item['ID'] );
164
+			return sprintf('<input type="checkbox" name="bulk-select[]" value="%s" />', $item['ID']);
165 165
 		}
166 166
 
167 167
 
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 
175 175
 			$columns = array(
176 176
 							'cb'		=> '<input type="checkbox" />',
177
-							'name'	=> __( 'Name', 'textdomain' ),
178
-							'caseOne'	=> __( 'Case One', 'textdomain' ),
179
-							'caseTwo'	=> __( 'Case Two', 'textdomain' ),
180
-							'caseThree'	=> __( 'Case Three', 'textdomain' ),
177
+							'name'	=> __('Name', 'textdomain'),
178
+							'caseOne'	=> __('Case One', 'textdomain'),
179
+							'caseTwo'	=> __('Case Two', 'textdomain'),
180
+							'caseThree'	=> __('Case Three', 'textdomain'),
181 181
 						);
182 182
 
183 183
 			return $columns;
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
 		public function get_sortable_columns() {
193 193
 
194 194
 			$sortable_columns = array(
195
-				'name' => array( 'name', true ),
196
-				'caseOne' => array( 'caseOne', false ),
197
-				'caseTwo' => array( 'caseTwo', false ),
195
+				'name' => array('name', true),
196
+				'caseOne' => array('caseOne', false),
197
+				'caseTwo' => array('caseTwo', false),
198 198
 			);
199 199
 
200 200
 			return $sortable_columns;
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 		 */
209 209
 		public function get_bulk_actions() {
210 210
 
211
-			$actions = array( 'bulk-delete' => 'Delete'	);
211
+			$actions = array('bulk-delete' => 'Delete');
212 212
 
213 213
 			return $actions;
214 214
 		}
@@ -225,15 +225,15 @@  discard block
 block discarded – undo
225 225
 
226 226
 			/** Process bulk action */
227 227
 			$this->process_bulk_action();
228
-			$per_page     = $this->get_items_per_page( 'option_name_per_page', 5 );
228
+			$per_page     = $this->get_items_per_page('option_name_per_page', 5);
229 229
 			$current_page = $this->get_pagenum();
230 230
 			$total_items  = self::record_count();
231
-			$this->set_pagination_args( array(
231
+			$this->set_pagination_args(array(
232 232
 				'total_items' => $total_items,
233 233
 				'per_page'    => $per_page,
234
-			) );
234
+			));
235 235
 
236
-			$this->items = self::get_Table( $per_page, $current_page );
236
+			$this->items = self::get_Table($per_page, $current_page);
237 237
 		}
238 238
 
239 239
 
@@ -245,24 +245,24 @@  discard block
 block discarded – undo
245 245
 		public function process_bulk_action() {
246 246
 
247 247
 			//Detect when a bulk action is being triggered...
248
-			if ( 'delete' === $this->current_action() ) {
248
+			if ('delete' === $this->current_action()) {
249 249
 
250 250
 				//In our file that handles the request, verify the nonce.
251
-				$nonce = esc_attr( $_REQUEST['_wpnonce'] );
251
+				$nonce = esc_attr($_REQUEST['_wpnonce']);
252 252
 
253
-				if ( ! wp_verify_nonce( $nonce, 'delete_url' ) ) {
254
-					die( 'Go get a live script kiddies' );
253
+				if ( ! wp_verify_nonce($nonce, 'delete_url')) {
254
+					die('Go get a live script kiddies');
255 255
 				} else {
256
-					self::delete_url( absint( $_GET['instruction'] ) ); //Remember the instruction param from column_name method
256
+					self::delete_url(absint($_GET['instruction'])); //Remember the instruction param from column_name method
257 257
 				}
258 258
 			}
259 259
 
260 260
 			//If the delete bulk action is triggered
261
-			if ( isset( $_POST['action'] ) ) {
262
-				if ( ( isset( $_POST['action'] ) && $_POST['action'] == 'bulk-delete' ) ) {
263
-					$delete_ids = esc_sql( $_POST['bulk-select'] );
264
-					foreach ( $delete_ids as $id ) {
265
-						self::delete_url( $id );
261
+			if (isset($_POST['action'])) {
262
+				if ((isset($_POST['action']) && $_POST['action'] == 'bulk-delete')) {
263
+					$delete_ids = esc_sql($_POST['bulk-select']);
264
+					foreach ($delete_ids as $id) {
265
+						self::delete_url($id);
266 266
 					}
267 267
 				}
268 268
 			}
Please login to merge, or discard this patch.
lib/ajax.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
  * @version    1.2.1
8 8
  * @package    wp-plugin-framework
9 9
  */
10
-if ( ! defined( 'ABSPATH' ) ) exit;
10
+if ( ! defined('ABSPATH')) exit;
11 11
 
12 12
 //AJAX helper class
13
-if ( ! class_exists( 'PLUGIN_AJAX' ) ) {
13
+if ( ! class_exists('PLUGIN_AJAX')) {
14 14
 
15 15
 	final class PLUGIN_AJAX {
16 16
 
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 		 */
23 23
 		public function __construct() {
24 24
 
25
-			add_action( 'wp_footer', array( $this, 'custom_name_js' ) );
26
-			add_action( 'wp_ajax_custom_name', array( $this, 'custom_name' ) );
27
-			add_action( 'wp_ajax_nopriv_custom_name', array( $this, 'custom_name' ) );
25
+			add_action('wp_footer', array($this, 'custom_name_js'));
26
+			add_action('wp_ajax_custom_name', array($this, 'custom_name'));
27
+			add_action('wp_ajax_nopriv_custom_name', array($this, 'custom_name'));
28 28
 		}
29 29
 
30 30
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		public function form() { ?>
37 37
 
38 38
 			<form id="add_by_ajax" method="POST" action="">
39
-				<input type="text" name="text_name" placeholder="<?php _e( 'Text', 'textdomain' ); ?>">
39
+				<input type="text" name="text_name" placeholder="<?php _e('Text', 'textdomain'); ?>">
40 40
 				<input id="ajax_submit" type="submit" name="submit" value="Submit">
41 41
 			</form>
42 42
 			<?php
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 
90 90
 			// DO some stuff
91 91
 
92
-			$response = array( 'val' => $value );
93
-			echo json_encode( $response );
92
+			$response = array('val' => $value);
93
+			echo json_encode($response);
94 94
 			wp_die();
95 95
 		}
96 96
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,9 @@
 block discarded – undo
7 7
  * @version    1.2.1
8 8
  * @package    wp-plugin-framework
9 9
  */
10
-if ( ! defined( 'ABSPATH' ) ) exit;
10
+if ( ! defined( 'ABSPATH' ) ) {
11
+	exit;
12
+}
11 13
 
12 14
 //AJAX helper class
13 15
 if ( ! class_exists( 'PLUGIN_AJAX' ) ) {
Please login to merge, or discard this patch.
lib/script.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@  discard block
 block discarded – undo
6 6
  * @version    1.2.1
7 7
  * @package    wp-plugin-framework
8 8
  */
9
-if ( ! defined( 'ABSPATH' ) ) exit;
9
+if ( ! defined('ABSPATH')) exit;
10 10
 
11
-if ( ! class_exists( 'PLUGIN_SCRIPT' ) ) {
11
+if ( ! class_exists('PLUGIN_SCRIPT')) {
12 12
 
13 13
 	final class PLUGIN_SCRIPT {
14 14
 
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
 		 */
21 21
 		public function __construct() {
22 22
 
23
-			add_action( 'admin_head', array( $this, 'data_table_css' ) );
24
-			add_action( 'admin_enqueue_scripts', array( $this, 'backend_scripts' ) );
25
-			add_action( 'wp_enqueue_scripts', array( $this, 'frontend_scripts' ) );
23
+			add_action('admin_head', array($this, 'data_table_css'));
24
+			add_action('admin_enqueue_scripts', array($this, 'backend_scripts'));
25
+			add_action('wp_enqueue_scripts', array($this, 'frontend_scripts'));
26 26
 		}
27 27
 
28 28
 
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
 			// Set condition to add script
55 55
 			// if ( ! isset( $_GET['page'] ) || $_GET['page'] != 'pageName' ) return;
56 56
 
57
-			wp_enqueue_script( 'jsName', PLUGIN_JS . 'ui.js', array() );
58
-			wp_localize_script( 'jsName', 'ajax', array( 'ajax_url' => admin_url('admin-ajax.php') ) );
57
+			wp_enqueue_script('jsName', PLUGIN_JS . 'ui.js', array());
58
+			wp_localize_script('jsName', 'ajax', array('ajax_url' => admin_url('admin-ajax.php')));
59 59
 
60
-			wp_enqueue_style( 'cssName', PLUGIN_CSS . 'css.css' );
60
+			wp_enqueue_style('cssName', PLUGIN_CSS . 'css.css');
61 61
 		}
62 62
 
63 63
 
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
 		 */
69 69
 		public function frontend_scripts() {
70 70
 
71
-			wp_enqueue_script( 'jsName', PLUGIN_JS . 'ui.js', array() );
72
-			wp_localize_script( 'jsName', 'ajax', array( 'ajax_url' => admin_url('admin-ajax.php') ) );
71
+			wp_enqueue_script('jsName', PLUGIN_JS . 'ui.js', array());
72
+			wp_localize_script('jsName', 'ajax', array('ajax_url' => admin_url('admin-ajax.php')));
73 73
 
74
-			wp_enqueue_style( 'cssName', PLUGIN_CSS . 'css.css' );
74
+			wp_enqueue_style('cssName', PLUGIN_CSS . 'css.css');
75 75
 		}
76 76
 	}
77 77
 } ?>
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@
 block discarded – undo
6 6
  * @version    1.2.1
7 7
  * @package    wp-plugin-framework
8 8
  */
9
-if ( ! defined( 'ABSPATH' ) ) exit;
9
+if ( ! defined( 'ABSPATH' ) ) {
10
+	exit;
11
+}
10 12
 
11 13
 if ( ! class_exists( 'PLUGIN_SCRIPT' ) ) {
12 14
 
Please login to merge, or discard this patch.
lib/upload.php 1 patch
Spacing   +14 added lines, -14 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
  * Plugin upload for WordPress front end or backend
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @version    1.2.1
9 9
  * @package    wp-plugin-framework
10 10
  */
11
-if ( ! class_exists( 'PLUGIN_UPLOAD' ) ) {
11
+if ( ! class_exists('PLUGIN_UPLOAD')) {
12 12
 
13 13
 	final class PLUGIN_UPLOAD {
14 14
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 		 */
21 21
 		public function __construct() {
22 22
 
23
-			if ( isset($_POST['UploadSubmit']) ) {
23
+			if (isset($_POST['UploadSubmit'])) {
24 24
 				$this->upload_controller();
25 25
 			}
26 26
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
 			<form method="POST" action="" enctype="multipart/form-data">
39 39
 				<input name="UploadFile" type="file" multiple="false"/>
40
-				<?php submit_button( __( 'Upload', 'stv' ), 'secondary', 'UploadSubmit' ); ?>
40
+				<?php submit_button(__('Upload', 'stv'), 'secondary', 'UploadSubmit'); ?>
41 41
 			</form>
42 42
 			<?php
43 43
 		}
@@ -54,28 +54,28 @@  discard block
 block discarded – undo
54 54
 			$type = $file['type'];
55 55
 
56 56
 			// Check in your file type
57
-			if( $type != 'application/_TYPE_' ) {
58
-				add_action( 'admin_notices', array( $this, 'file_type_error_admin_notice' ) );
57
+			if ($type != 'application/_TYPE_') {
58
+				add_action('admin_notices', array($this, 'file_type_error_admin_notice'));
59 59
 			} else {
60 60
 
61
-				if (!function_exists('wp_handle_upload')){
61
+				if ( ! function_exists('wp_handle_upload')) {
62 62
 					require_once(ABSPATH . 'wp-admin/includes/image.php');
63 63
 					require_once(ABSPATH . 'wp-admin/includes/file.php');
64 64
 					require_once(ABSPATH . 'wp-admin/includes/media.php');
65 65
 				}
66 66
 
67
-				$overrides = array( 'test_form' => false);
67
+				$overrides = array('test_form' => false);
68 68
 				$attachment = wp_handle_upload($file, $overrides);
69 69
 
70
-				if( is_array( $attachment_id ) && array_key_exists( 'path', $attachment ) ) {
70
+				if (is_array($attachment_id) && array_key_exists('path', $attachment)) {
71 71
 					$upload_path = $attachment['path'];
72 72
 
73
-					add_action( 'admin_notices', array( $this, 'success_notice' ) );
73
+					add_action('admin_notices', array($this, 'success_notice'));
74 74
 
75 75
 					// Use $upload_path for any purpose. For example storing temporarily
76 76
 					// update_option( 'some_token', $upload_path );
77 77
 				} else {
78
-					add_action( 'admin_notices', array( $this, 'file_error_admin_notice' ) );
78
+					add_action('admin_notices', array($this, 'file_error_admin_notice'));
79 79
 					$upload_path = false;
80 80
 				}
81 81
 			}
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		public function file_type_error_admin_notice() { ?>
91 91
 
92 92
 			<div class="notice notice-error is-dismissible">
93
-				<p><?php _e( 'Please Upload correct type of file only.', 'textdomain' ); ?></p>
93
+				<p><?php _e('Please Upload correct type of file only.', 'textdomain'); ?></p>
94 94
  			</div>
95 95
 		<?php
96 96
 		}
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 		public function file_error_admin_notice() { ?>
105 105
 
106 106
 			<div class="notice notice-error is-dismissible">
107
-				<p><?php _e( 'File Upload failed.', 'textdomain' ); ?></p>
107
+				<p><?php _e('File Upload failed.', 'textdomain'); ?></p>
108 108
  			</div>
109 109
 		<?php
110 110
 		}
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		public function success_notice() { ?>
119 119
 
120 120
 			<div class="notice notice-success is-dismissible">
121
-				<p><?php _e( 'Successfully saved file details.', 'textdomain' ); ?></p>
121
+				<p><?php _e('Successfully saved file details.', 'textdomain'); ?></p>
122 122
  			</div>
123 123
 		<?php
124 124
 		}
Please login to merge, or discard this patch.
src/settings.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 					break;
165 165
 			}
166 166
 
167
-    		if ( $output ) return $output; // Related to PLUGIN_TABLE()
167
+			if ( $output ) return $output; // Related to PLUGIN_TABLE()
168 168
 		}
169 169
 
170 170
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 			echo '<textarea name="settings_field_name" id="settings_field_name" value="' . get_option('settings_field_name') . '>'. __( 'Enter Value', 'textdomain' ) . '</textarea>';
280 280
 			echo '<select name="settings_field_name" id="settings_field_name"><option value="value" ' . selected( 'value', get_option('settings_field_name'), false) . '>Value</option></select>';
281 281
 			echo '<input type="checkbox" id="settings_field_name" name="settings_field_name" value="1"' . checked( 1, get_option('settings_field_name'), false ) . '/>';
282
-			*/
282
+			 */
283 283
 		}
284 284
 	}
285 285
 } ?>
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 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
  * Backend settings page class, can have settings fields or data table
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @version    1.2.1
9 9
  * @package    wp-plugin-framework
10 10
  */
11
-if ( ! class_exists( 'PLUGIN_SETTINGS' ) ) {
11
+if ( ! class_exists('PLUGIN_SETTINGS')) {
12 12
 
13 13
 	final class PLUGIN_SETTINGS {
14 14
 
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
 		public function __construct() {
58 58
 
59 59
 			$this->capability = 'manage_options';
60
-			$this->menu_page = array( 'name' => '', 'heading' => '', 'slug' => '' );
60
+			$this->menu_page = array('name' => '', 'heading' => '', 'slug' => '');
61 61
 			$this->sub_menu_page = array(
62 62
 									'name' => '',
63 63
 									'heading' => '',
64 64
 									'slug' => '',
65 65
 									'parent_slug' => '',
66
-									'help' => '',//true/false,
67
-									'screen' => '',//true/false
66
+									'help' => '', //true/false,
67
+									'screen' => '', //true/false
68 68
 								);
69 69
 			$this->helpData = array(
70 70
 								array(
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
 											'info' => array(
74 74
 														array(
75 75
 															'id' => 'helpId',
76
-															'title' => __( 'Title', 'textdomain' ),
77
-															'content' => __( 'Description', 'textdomain' ),
76
+															'title' => __('Title', 'textdomain'),
77
+															'content' => __('Description', 'textdomain'),
78 78
 														),
79 79
 													),
80
-											'link' => '<p><a href="#">' . __( 'helpLink', 'textdomain' ) . '</a></p>',
80
+											'link' => '<p><a href="#">' . __('helpLink', 'textdomain') . '</a></p>',
81 81
 											)
82 82
 								)
83 83
 							);
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 					$this->menu_page['heading'],
109 109
 					$this->capability,
110 110
 					$this->menu_page['slug'],
111
-					array( $this, 'menu_page_callback' )
111
+					array($this, 'menu_page_callback')
112 112
 				);
113 113
 			}
114 114
 		}
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 		 */
122 122
 		public function sub_menu_page() {
123 123
 
124
-			if ( $this->sub_menu_page ) {
125
-				foreach ( $this->sub_menu_page as $page ) {
124
+			if ($this->sub_menu_page) {
125
+				foreach ($this->sub_menu_page as $page) {
126 126
 					$hook = add_submenu_page(
127 127
 							$page['parent_slug'],
128 128
 							$page['name'],
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
 							// For the first submenu page, slug should be same as menupage.
132 132
 							$page['slug'],
133 133
 							// For the first submenu page, callback should be same as menupage.
134
-							array( $this, 'menu_page_callback' )
134
+							array($this, 'menu_page_callback')
135 135
 						);
136
-					if ( $page['help'] ) {
137
-						add_action( 'load-' . $hook, array( $this, 'help_tabs' ) );
136
+					if ($page['help']) {
137
+						add_action('load-' . $hook, array($this, 'help_tabs'));
138 138
 					}
139
-					if ( $page['screen'] ) {
140
-						add_action( 'load-' . $hook, array( $this, 'screen_option' ) );
139
+					if ($page['screen']) {
140
+						add_action('load-' . $hook, array($this, 'screen_option'));
141 141
 					}
142 142
 				}
143 143
 			}
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 					break;
165 165
 			}
166 166
 
167
-    		if ( $output ) return $output; // Related to PLUGIN_TABLE()
167
+    		if ($output) return $output; // Related to PLUGIN_TABLE()
168 168
 		}
169 169
 
170 170
 
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 
178 178
 			$option = 'per_page';
179 179
 			$args   = array(
180
-						'label'   => __( 'Show per page', 'textdomain' ),
180
+						'label'   => __('Show per page', 'textdomain'),
181 181
 						'default' => 10,
182 182
 						'option'  => 'option_name_per_page' // Related to PLUGIN_TABLE()
183 183
 						);
184
-			add_screen_option( $option, $args );
184
+			add_screen_option($option, $args);
185 185
 			$this->table = new PLUGIN_TABLE(); // Source /lib/table.php
186 186
 		}
187 187
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 					<form method="post" action="">
205 205
 						<?php settings_fields("settings_id");
206 206
 						do_settings_sections("settings_name");
207
-						submit_button( __( 'Save', 'textdomain' ), 'primary', 'id' ); ?>
207
+						submit_button(__('Save', 'textdomain'), 'primary', 'id'); ?>
208 208
 					</form>
209 209
 
210 210
 					<?php
@@ -232,10 +232,10 @@  discard block
 block discarded – undo
232 232
 			foreach ($this->helpData as $value) {
233 233
 				if ($_GET['page'] == $value['slug']) {
234 234
 					$this->screen = get_current_screen();
235
-					foreach( $value['info'] as $key ) {
236
-						$this->screen->add_help_tab( $key );
235
+					foreach ($value['info'] as $key) {
236
+						$this->screen->add_help_tab($key);
237 237
 					}
238
-					$this->screen->set_help_sidebar( $value['link'] );
238
+					$this->screen->set_help_sidebar($value['link']);
239 239
 				}
240 240
 			}
241 241
 		}
@@ -248,10 +248,10 @@  discard block
 block discarded – undo
248 248
 		 */
249 249
 		public function add_settings() {
250 250
 
251
-			add_settings_section( 'settings_id', __( 'Section Name', 'textdomain' ), array( $this,'section_cb' ), 'settings_name' );
251
+			add_settings_section('settings_id', __('Section Name', 'textdomain'), array($this, 'section_cb'), 'settings_name');
252 252
 
253
-			register_setting( 'settings_id', 'settings_field_name' );
254
-			add_settings_field( 'settings_field_name', __( 'Field Name', 'textdomain' ), array( $this, 'settings_field_cb' ), 'settings_name', 'settings_id' );
253
+			register_setting('settings_id', 'settings_field_name');
254
+			add_settings_field('settings_field_name', __('Field Name', 'textdomain'), array($this, 'settings_field_cb'), 'settings_name', 'settings_id');
255 255
 		}
256 256
 
257 257
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 		 */
263 263
 		public function section_cb() {
264 264
 
265
-			echo '<p class="description">' . __( 'Set up settings', 'textdomain' ) . '</p>';
265
+			echo '<p class="description">' . __('Set up settings', 'textdomain') . '</p>';
266 266
 		}
267 267
 
268 268
 
Please login to merge, or discard this patch.
Braces   +7 added lines, -2 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
  * Backend settings page class, can have settings fields or data table
@@ -164,7 +166,10 @@  discard block
 block discarded – undo
164 166
 					break;
165 167
 			}
166 168
 
167
-    		if ( $output ) return $output; // Related to PLUGIN_TABLE()
169
+    		if ( $output ) {
170
+    			return $output;
171
+    		}
172
+    		// Related to PLUGIN_TABLE()
168 173
 		}
169 174
 
170 175
 
Please login to merge, or discard this patch.
src/widget.php 1 patch
Spacing   +14 added lines, -14 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
  * Widget class
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @version    1.2.1
9 9
  * @package    wp-plugin-framework
10 10
  */
11
-if ( ! class_exists( 'PLUGIN_WIDGET' ) ) {
11
+if ( ! class_exists('PLUGIN_WIDGET')) {
12 12
 
13 13
 	final class PLUGIN_WIDGET extends WP_WIDGET {
14 14
 
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 
23 23
 			$widget_ops = array(
24 24
 							'classname' => 'plugin_widget',
25
-							'description' => __( 'Plugin widget', 'textdomain' ),
25
+							'description' => __('Plugin widget', 'textdomain'),
26 26
 							);
27
-			parent::__construct( 'my_widget_id', __( 'Plugin widget', 'textdomain' ), $widget_ops );
27
+			parent::__construct('my_widget_id', __('Plugin widget', 'textdomain'), $widget_ops);
28 28
 		}
29 29
 
30 30
 
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
 		 *
37 37
 		 * @return Html
38 38
 		 */
39
-		public function widget( $args, $instance ) {
39
+		public function widget($args, $instance) {
40 40
 
41 41
 			echo $args['before_widget'];
42
-			if ( ! empty( $instance['title'] ) ) {
43
-				echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'];
42
+			if ( ! empty($instance['title'])) {
43
+				echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
44 44
 			}
45
-			echo esc_html__( 'Hello, World!', 'textdomain' );
45
+			echo esc_html__('Hello, World!', 'textdomain');
46 46
 			echo $args['after_widget'];
47 47
 		}
48 48
 
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 		 *
55 55
 		 * @return Html
56 56
 		 */
57
-		public function form( $instance ) {
57
+		public function form($instance) {
58 58
 
59
-			$title = ! empty( $instance['title'] ) ? $instance['title'] : esc_html__( 'Internal Link Master', 'textdomain' ); ?>
59
+			$title = ! empty($instance['title']) ? $instance['title'] : esc_html__('Internal Link Master', 'textdomain'); ?>
60 60
 			<p>
61
-				<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_attr_e( 'Title:', 'textdomain' ); ?></label>
62
-				<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>">
61
+				<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_attr_e('Title:', 'textdomain'); ?></label>
62
+				<input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>">
63 63
 			</p>
64 64
 		<?php
65 65
 		}
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
 		 *
74 74
 		 * @return Array
75 75
 		 */
76
-		public function update( $new_instance, $old_instance ) {
76
+		public function update($new_instance, $old_instance) {
77 77
 
78 78
 			$instance = array();
79
-			$instance['title'] = ( ! empty( $new_instance['title'] ) ? sanitize_text_field( $new_instance['title'] ) : '' );
79
+			$instance['title'] = ( ! empty($new_instance['title']) ? sanitize_text_field($new_instance['title']) : '');
80 80
 			return $instance;
81 81
 		}
82 82
 	}
Please login to merge, or discard this patch.