Passed
Push — master ( c28712...836585 )
by Nirjhar
02:28
created
autoload.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit;
2
+if ( ! defined('ABSPATH')) exit;
3 3
 
4 4
 //Main plugin object to define the plugin
5
-if ( ! class_exists( 'PLUGIN_BUILD' ) ) {
5
+if ( ! class_exists('PLUGIN_BUILD')) {
6 6
 	
7 7
 	final class PLUGIN_BUILD {
8 8
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		//Custom corn class, register it while activation
39 39
 		public function corn() {
40 40
 
41
-			if ( class_exists( 'PLUGIN_CRON' ) ) {
41
+			if (class_exists('PLUGIN_CRON')) {
42 42
 				$cron = new PLUGIN_CRON();
43 43
 				$schedule = $cron->schedule_task(
44 44
 							array(
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 		public function db_error_msg() { ?>
98 98
 
99 99
 			<div class="notice notice-error is-dismissible">
100
-				<p><?php _e( 'Database table Not installed correctly.', 'textdomain' ); ?></p>
100
+				<p><?php _e('Database table Not installed correctly.', 'textdomain'); ?></p>
101 101
  			</div>
102 102
 			<?php
103 103
 		}
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 		//Include scripts
130 130
 		public function scripts() {
131 131
 
132
-			if ( class_exists( 'PLUGIN_SCRIPT' ) ) new PLUGIN_SCRIPT();
132
+			if (class_exists('PLUGIN_SCRIPT')) new PLUGIN_SCRIPT();
133 133
 		}
134 134
 
135 135
 
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
 		//Include settings pages
138 138
 		public function settings() {
139 139
 
140
-			if ( class_exists( 'PLUGIN_SETTINGS' ) ) new PLUGIN_SETTINGS();
140
+			if (class_exists('PLUGIN_SETTINGS')) new PLUGIN_SETTINGS();
141 141
 		}
142 142
 
143 143
 
144 144
 		//Include widget classes
145 145
 		public function widgets() {
146 146
 
147
-			if ( class_exists( 'PLUGIN_WIDGET' ) ) new PLUGIN_WIDGET();
147
+			if (class_exists('PLUGIN_WIDGET')) new PLUGIN_WIDGET();
148 148
 		}
149 149
 
150 150
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		//Include metabox classes
153 153
 		public function metabox() {
154 154
 
155
-			if ( class_exists( 'PLUGIN_METABOX' ) ) new PLUGIN_METABOX();
155
+			if (class_exists('PLUGIN_METABOX')) new PLUGIN_METABOX();
156 156
 		}
157 157
 
158 158
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 		//Include shortcode classes
161 161
 		public function shortcode() {
162 162
 
163
-			if ( class_exists( 'PLUGIN_SHORTCODE' ) ) new PLUGIN_SHORTCODE();
163
+			if (class_exists('PLUGIN_SHORTCODE')) new PLUGIN_SHORTCODE();
164 164
 		}
165 165
 
166 166
 
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 			$this->helpers();
203 203
 			$this->functionality();
204 204
 
205
-			register_activation_hook( PLUGIN_FILE, array( $this, 'db_install' ) );
205
+			register_activation_hook(PLUGIN_FILE, array($this, 'db_install'));
206 206
 
207 207
 			//remove the DB upon uninstallation
208
-			register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'db_uninstall' ) ); //$this won't work here.
208
+			register_uninstall_hook(PLUGIN_FILE, array('PLUGIN_BUILD', 'db_uninstall')); //$this won't work here.
209 209
 
210 210
 			add_action('init', array($this, 'installation'));
211 211
 
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
 
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
 
26 26
 
27 27
 		public function execute() {
28
-			add_action( 'plugins_loaded', array( $this, 'text_domain_cb' ) );
29
-			add_action( 'admin_notices', array( $this, 'php_ver_incompatible' ) );
30
-			add_filter( 'plugin_action_links', array( $this, 'menu_page_link' ), 10, 2 );
28
+			add_action('plugins_loaded', array($this, 'text_domain_cb'));
29
+			add_action('admin_notices', array($this, 'php_ver_incompatible'));
30
+			add_filter('plugin_action_links', array($this, 'menu_page_link'), 10, 2);
31 31
 		}
32 32
 
33 33
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		//Load plugin textdomain
36 36
 		public function text_domain_cb() {
37 37
 
38
-			load_plugin_textdomain( $this->textDomin, false, PLUGIN_LN );
38
+			load_plugin_textdomain($this->textDomin, false, PLUGIN_LN);
39 39
 		}
40 40
 
41 41
 
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 		//Define low php verson errors
44 44
 		public function php_ver_incompatible() {
45 45
 
46
-			if ( version_compare( phpversion(), $this->phpVerAllowed, '<' ) ) :
47
-				$text = __( 'The Plugin can\'t be activated because your PHP version', 'textdomain' );
48
-				$text_last = __( 'is less than required '.$this->phpVerAllowed.'. See more information', 'textdomain' );
46
+			if (version_compare(phpversion(), $this->phpVerAllowed, '<')) :
47
+				$text = __('The Plugin can\'t be activated because your PHP version', 'textdomain');
48
+				$text_last = __('is less than required ' . $this->phpVerAllowed . '. See more information', 'textdomain');
49 49
 				$text_link = 'php.net/eol.php'; ?>
50 50
 
51 51
 				<div id="message" class="updated notice notice-success is-dismissible"><p><?php echo $text . ' ' . phpversion() . ' ' . $text_last . ': '; ?><a href="http://php.net/eol.php/" target="_blank"><?php echo $text_link; ?></a></p></div>
@@ -55,20 +55,20 @@  discard block
 block discarded – undo
55 55
 
56 56
 
57 57
 		// Add settings link to plugin page
58
-		public function menu_page_link( $links, $file ) {
58
+		public function menu_page_link($links, $file) {
59 59
 
60 60
 			if ($this->pluginPageLinks) {
61 61
 				static $this_plugin;
62
-				if ( ! $this_plugin ) {
62
+				if ( ! $this_plugin) {
63 63
 					$this_plugin = PLUGIN_FILE;
64 64
 				}
65
-				if ( $file == $this_plugin ) {
65
+				if ($file == $this_plugin) {
66 66
 					$shift_link = array();
67 67
 					foreach ($this->pluginPageLinks as $value) {
68
-						$shift_link[] = '<a href="'.$value['slug'].'">'.$value['label'].'</a>';
68
+						$shift_link[] = '<a href="' . $value['slug'] . '">' . $value['label'] . '</a>';
69 69
 					}
70
-					foreach( $shift_link as $val ) {
71
-						array_unshift( $links, $val );
70
+					foreach ($shift_link as $val) {
71
+						array_unshift($links, $val);
72 72
 					}
73 73
 				}
74 74
 				return $links;
Please login to merge, or discard this patch.
lib/ajax.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -3,10 +3,10 @@  discard block
 block discarded – undo
3 3
  * Doing AJAX the WordPress way.
4 4
  * Use this class in admin or user side
5 5
  */
6
-if ( ! defined( 'ABSPATH' ) ) exit;
6
+if ( ! defined('ABSPATH')) exit;
7 7
 
8 8
 //AJAX helper class
9
-if ( ! class_exists( 'PLUGIN_AJAX' ) ) {
9
+if ( ! class_exists('PLUGIN_AJAX')) {
10 10
 
11 11
 	final class PLUGIN_AJAX {
12 12
 
@@ -15,9 +15,9 @@  discard block
 block discarded – undo
15 15
 		public function __construct() {
16 16
 
17 17
 			//Adding the AJAX
18
-			add_action( 'wp_footer', array( $this, 'customName_js' ) );
19
-			add_action( 'wp_ajax_customName', array( $this, 'customName' ) );
20
-			add_action( 'wp_ajax_nopriv_customName', array( $this, 'customName' ) );
18
+			add_action('wp_footer', array($this, 'customName_js'));
19
+			add_action('wp_ajax_customName', array($this, 'customName'));
20
+			add_action('wp_ajax_nopriv_customName', array($this, 'customName'));
21 21
 		}
22 22
 
23 23
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 		public function form() { ?>
27 27
 
28 28
 			<form id="addByAjax" method="POST" action="">
29
-				<input type="text" name="textName" placeholder="<?php _e( 'Text', 'textdomain' ); ?>">
29
+				<input type="text" name="textName" placeholder="<?php _e('Text', 'textdomain'); ?>">
30 30
 				<input id="AjaxSubmit" type="submit" name="submit" value="Submit">
31 31
 			</form>
32 32
 			<?php
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 
78 78
 			// DO some stuff
79 79
 			 
80
-			$response = array( 'val' => $value );
81
-			echo json_encode( $response );
80
+			$response = array('val' => $value);
81
+			echo json_encode($response);
82 82
 			wp_die();
83 83
 		}
84 84
 	}
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,12 +1,12 @@  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
6 6
  * 
7 7
  * 
8 8
  */
9
-if ( ! class_exists( 'PLUGIN_UPLOAD' ) ) {
9
+if ( ! class_exists('PLUGIN_UPLOAD')) {
10 10
 
11 11
 	final class PLUGIN_UPLOAD {
12 12
 
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 		// Add basic form
16 16
 		public function __construct() {
17 17
 
18
-			if ( isset($_POST['UploadSubmit']) ) {
18
+			if (isset($_POST['UploadSubmit'])) {
19 19
 				$this->upload_controller();
20 20
 			}
21 21
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
 			<form method="POST" action="" enctype="multipart/form-data">
31 31
 				<input name="UploadFile" type="file" multiple="false"/>
32
-				<?php submit_button( __( 'Upload', 'stv' ), 'secondary', 'UploadSubmit' ); ?>
32
+				<?php submit_button(__('Upload', 'stv'), 'secondary', 'UploadSubmit'); ?>
33 33
 			</form>
34 34
 			<?php
35 35
 		}
@@ -43,28 +43,28 @@  discard block
 block discarded – undo
43 43
 			$type = $file['type'];
44 44
 
45 45
 			// Check in your file type
46
-			if( $type != 'application/_TYPE_' ) {
47
-				add_action( 'admin_notices', array( $this, 'file_type_error_admin_notice' ) );
46
+			if ($type != 'application/_TYPE_') {
47
+				add_action('admin_notices', array($this, 'file_type_error_admin_notice'));
48 48
 			} else {
49 49
 
50
-				if (!function_exists('wp_handle_upload')){
50
+				if ( ! function_exists('wp_handle_upload')) {
51 51
 					require_once(ABSPATH . 'wp-admin/includes/image.php');
52 52
 					require_once(ABSPATH . 'wp-admin/includes/file.php');
53 53
 					require_once(ABSPATH . 'wp-admin/includes/media.php');
54 54
 				}
55 55
 
56
-				$overrides = array( 'test_form' => false);
56
+				$overrides = array('test_form' => false);
57 57
 				$attachment_id = wp_handle_upload($file, $overrides);
58 58
 
59
-				if( is_array( $attachment_id ) && array_key_exists( 'url', $attachment_id ) ) {
59
+				if (is_array($attachment_id) && array_key_exists('url', $attachment_id)) {
60 60
 					$upload_id = $attachment_id['url'];
61 61
 
62
-					add_action( 'admin_notices', array( $this, 'success_notice' ) );
62
+					add_action('admin_notices', array($this, 'success_notice'));
63 63
 
64 64
 					// Use $upload_id for any purpose. For example storing temporarily
65 65
 					//update_option('some_token', $upload_id);
66 66
 				} else {
67
-					add_action( 'admin_notices', array( $this, 'file_error_admin_notice' ) );
67
+					add_action('admin_notices', array($this, 'file_error_admin_notice'));
68 68
 					$upload_id = false;
69 69
 				}
70 70
 			}
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		public function file_type_error_admin_notice() { ?>
76 76
 
77 77
 			<div class="notice notice-error is-dismissible">
78
-				<p><?php _e( 'Please Upload correct type of file only.', 'textdomain' ); ?></p>
78
+				<p><?php _e('Please Upload correct type of file only.', 'textdomain'); ?></p>
79 79
  			</div>
80 80
 		<?php
81 81
 		}
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		public function file_error_admin_notice() { ?>
86 86
 
87 87
 			<div class="notice notice-error is-dismissible">
88
-				<p><?php _e( 'File Upload failed.', 'textdomain' ); ?></p>
88
+				<p><?php _e('File Upload failed.', 'textdomain'); ?></p>
89 89
  			</div>
90 90
 		<?php
91 91
 		}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		public function success_notice() { ?>
96 96
 
97 97
 			<div class="notice notice-success is-dismissible">
98
-				<p><?php _e( 'Successfully saved file details.', 'textdomain' ); ?></p>
98
+				<p><?php _e('Successfully saved file details.', 'textdomain'); ?></p>
99 99
  			</div>
100 100
 		<?php
101 101
 		}
Please login to merge, or discard this patch.