Passed
Pull Request — master (#1)
by Joseph
11:42
created
classes/subway-wp-admin-redirect.php 2 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -210,6 +210,11 @@
 block discarded – undo
210 210
 
211 211
 	}
212 212
 
213
+	/**
214
+	 * @param string $redirect_to
215
+	 * @param string $request
216
+	 * @param integer $user
217
+	 */
213 218
 	public static function authentication_200( $redirect_to, $request, $user ) {
214 219
 
215 220
 		$subway_redirect_type = get_option( 'subway_redirect_type' );
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 namespace Subway;
14 14
 
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	return;
17 17
 }
18 18
 
@@ -20,85 +20,85 @@  discard block
 block discarded – undo
20 20
 
21 21
 	public static function index() {
22 22
 
23
-		$is_redirect_admin = get_option( 'subway_redirect_wp_admin' );
23
+		$is_redirect_admin = get_option('subway_redirect_wp_admin');
24 24
 
25 25
 		// Only run this function when on wp-login.php.
26
-		if ( ! in_array( $GLOBALS['pagenow'], array( 'wp-login.php' ), true ) ) {
26
+		if ( ! in_array($GLOBALS['pagenow'], array('wp-login.php'), true)) {
27 27
 			return;
28 28
 		}
29 29
 
30
-		if ( ! $is_redirect_admin ) {
30
+		if ( ! $is_redirect_admin) {
31 31
 			return;
32 32
 		}
33 33
 
34 34
 		// Has any errors?
35
-		$has_error = filter_input( INPUT_GET, 'error', FILTER_SANITIZE_STRING );
35
+		$has_error = filter_input(INPUT_GET, 'error', FILTER_SANITIZE_STRING);
36 36
 
37 37
 		// Error Types.
38
-		$has_type = filter_input( INPUT_GET, 'type', FILTER_SANITIZE_STRING );
38
+		$has_type = filter_input(INPUT_GET, 'type', FILTER_SANITIZE_STRING);
39 39
 
40 40
 		// Set the default to our login page.
41 41
 		$redirect_page = Options::get_redirect_page_url();
42 42
 
43
-		if ( $has_error && $has_type ) {
43
+		if ($has_error && $has_type) {
44 44
 
45
-			$redirect_to = add_query_arg( array(
45
+			$redirect_to = add_query_arg(array(
46 46
 				'login' => 'failed',
47 47
 				'type' => $has_type,
48
-			), $redirect_page );
48
+			), $redirect_page);
49 49
 
50
-			wp_safe_redirect( esc_url_raw( $redirect_to ) );
50
+			wp_safe_redirect(esc_url_raw($redirect_to));
51 51
 
52 52
 			exit;
53 53
 
54 54
 		}
55 55
 
56 56
 		// Bypass wp-login.php?action=* link.
57
-		if ( filter_input( INPUT_GET, 'action', FILTER_SANITIZE_STRING ) ) {
57
+		if (filter_input(INPUT_GET, 'action', FILTER_SANITIZE_STRING)) {
58 58
 			return;
59 59
 		}
60 60
 
61 61
 		// Bypass no redirect action
62
-		if ( filter_input( INPUT_GET, 'no_redirect', FILTER_VALIDATE_BOOLEAN ) ) {
62
+		if (filter_input(INPUT_GET, 'no_redirect', FILTER_VALIDATE_BOOLEAN)) {
63 63
 			return;
64 64
 		}
65 65
 
66 66
 		// Do not redirect if BuddyPress activation page.
67
-		if ( function_exists( 'bp_is_activation_page' ) ) {
68
-			if ( bp_is_activation_page() ) {
67
+		if (function_exists('bp_is_activation_page')) {
68
+			if (bp_is_activation_page()) {
69 69
 				return;
70 70
 			}
71 71
 		}
72 72
 
73 73
 		// Do not redirect if BuddyPress registration page.
74
-		if ( function_exists( 'bp_is_register_page' ) ) {
75
-			if ( bp_is_register_page() ) {
74
+		if (function_exists('bp_is_register_page')) {
75
+			if (bp_is_register_page()) {
76 76
 				return;
77 77
 			}
78 78
 		}
79 79
 
80 80
 		// Holds the current URI string for checking.
81
-		$curr_paged = basename( $_SERVER['REQUEST_URI'] );
81
+		$curr_paged = basename($_SERVER['REQUEST_URI']);
82 82
 
83
-		if ( empty( $redirect_page ) ) {
83
+		if (empty($redirect_page)) {
84 84
 			return;
85 85
 		}
86 86
 
87 87
 		// If user visits wp-admin or wp-login.php, redirect them.
88
-		if ( strstr( $curr_paged, 'wp-login.php' ) ) {
88
+		if (strstr($curr_paged, 'wp-login.php')) {
89 89
 
90 90
 			// Do not redirect interim login.
91
-			if ( isset( $_GET['interim-login'] ) ) {
91
+			if (isset($_GET['interim-login'])) {
92 92
 				return;
93 93
 			}
94 94
 
95 95
 			// Check if there is an action present.
96 96
 			// The action might represent user trying to log out.
97
-			if ( isset( $_GET['action'] ) ) {
97
+			if (isset($_GET['action'])) {
98 98
 
99 99
 				$action = $_GET['action'];
100 100
 
101
-				if ( 'logout' === $action ) {
101
+				if ('logout' === $action) {
102 102
 
103 103
 					return;
104 104
 
@@ -106,55 +106,55 @@  discard block
 block discarded – undo
106 106
 			}
107 107
 
108 108
 			// Only redirect if there are no incoming post data.
109
-			if ( empty( $_POST ) ) {
109
+			if (empty($_POST)) {
110 110
 
111
-				wp_safe_redirect( $redirect_page );
111
+				wp_safe_redirect($redirect_page);
112 112
 
113 113
 				exit;
114 114
 			}
115 115
 
116 116
 			// Redirect to error page if user left username and password blank.
117
-			if ( ! empty( $_POST ) ) {
117
+			if ( ! empty($_POST)) {
118 118
 
119
-				if ( empty( $_POST['log'] ) && empty( $_POST['pwd'] ) ) {
119
+				if (empty($_POST['log']) && empty($_POST['pwd'])) {
120 120
 
121
-					$redirect_to = add_query_arg( array(
121
+					$redirect_to = add_query_arg(array(
122 122
 						'login' => 'failed',
123 123
 						'type' => '__blank',
124
-					), $redirect_page );
124
+					), $redirect_page);
125 125
 
126
-					wp_safe_redirect( esc_url_raw( $redirect_to ) );
126
+					wp_safe_redirect(esc_url_raw($redirect_to));
127 127
 
128 128
 
129
-				} elseif ( empty( $_POST['log'] ) && ! empty( $_POST['pwd'] ) && ! empty( $_POST['redirect_to'] ) ) {
129
+				} elseif (empty($_POST['log']) && ! empty($_POST['pwd']) && ! empty($_POST['redirect_to'])) {
130 130
 					// Username empty.
131
-					$redirect_to = add_query_arg( array(
131
+					$redirect_to = add_query_arg(array(
132 132
 						'login' => 'failed',
133 133
 						'type' => '__userempty',
134
-					), $redirect_page );
134
+					), $redirect_page);
135 135
 
136
-					wp_safe_redirect( esc_url_raw( $redirect_to ) );
136
+					wp_safe_redirect(esc_url_raw($redirect_to));
137 137
 
138 138
 
139
-				} elseif ( ! empty( $_POST['log'] ) && empty( $_POST['pwd'] ) && ! empty( $_POST['redirect_to'] ) ) {
139
+				} elseif ( ! empty($_POST['log']) && empty($_POST['pwd']) && ! empty($_POST['redirect_to'])) {
140 140
 					// Password empty.
141
-					$redirect_to = add_query_arg( array(
141
+					$redirect_to = add_query_arg(array(
142 142
 						'login' => 'failed',
143 143
 						'type' => '__passempty',
144
-					), $redirect_page );
144
+					), $redirect_page);
145 145
 
146
-					wp_safe_redirect( esc_url_raw( $redirect_to ) );
146
+					wp_safe_redirect(esc_url_raw($redirect_to));
147 147
 
148 148
 
149 149
 				} else {
150 150
 
151 151
 					// Generic.
152
-					$redirect_to = add_query_arg( array(
152
+					$redirect_to = add_query_arg(array(
153 153
 						'login' => 'failed',
154 154
 						'type' => 'default',
155
-					), $redirect_page );
155
+					), $redirect_page);
156 156
 
157
-					wp_safe_redirect( esc_url_raw( $redirect_to ) );
157
+					wp_safe_redirect(esc_url_raw($redirect_to));
158 158
 
159 159
 				}
160 160
 			}
@@ -168,15 +168,15 @@  discard block
 block discarded – undo
168 168
 		// Set the header type to json.
169 169
 		header('Content-Type: application/json');
170 170
 
171
-		$log = filter_input( INPUT_POST, 'log', FILTER_SANITIZE_STRING );
171
+		$log = filter_input(INPUT_POST, 'log', FILTER_SANITIZE_STRING);
172 172
 
173
-		$pwd = filter_input( INPUT_POST, 'pwd', FILTER_SANITIZE_STRING );
173
+		$pwd = filter_input(INPUT_POST, 'pwd', FILTER_SANITIZE_STRING);
174 174
 
175
-		if ( empty( $log ) && empty( $pwd ) ) {
175
+		if (empty($log) && empty($pwd)) {
176 176
 
177 177
 			$response['type'] = 'error';
178 178
 
179
-			$response['message'] = esc_html__('Username and Password cannot be empty.', 'subway');;
179
+			$response['message'] = esc_html__('Username and Password cannot be empty.', 'subway'); ;
180 180
 
181 181
 		} else {
182 182
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 
185 185
 			$response = array();
186 186
 
187
-			if ( is_wp_error( $is_signin ) ) {
187
+			if (is_wp_error($is_signin)) {
188 188
 
189 189
 				$response['type'] = 'error';
190 190
 
@@ -200,52 +200,52 @@  discard block
 block discarded – undo
200 200
 
201 201
 		}
202 202
 
203
-		$subway_redirect_url = Admin_Redirect::authentication_200( $redirect_to ='', $request = '', $user =1 );
203
+		$subway_redirect_url = Admin_Redirect::authentication_200($redirect_to = '', $request = '', $user = 1);
204 204
 		
205
-		$response['redirect_url'] = apply_filters('subway_login_redirect', $subway_redirect_url );
205
+		$response['redirect_url'] = apply_filters('subway_login_redirect', $subway_redirect_url);
206 206
 
207
-		echo json_encode( $response );
207
+		echo json_encode($response);
208 208
 
209 209
 		wp_die();
210 210
 
211 211
 	}
212 212
 
213
-	public static function authentication_200( $redirect_to, $request, $user ) {
213
+	public static function authentication_200($redirect_to, $request, $user) {
214 214
 
215
-		$subway_redirect_type = get_option( 'subway_redirect_type' );
215
+		$subway_redirect_type = get_option('subway_redirect_type');
216 216
 
217 217
 		// Redirect the user to default behaviour if there are no redirect type option saved.
218
-		if ( empty( $subway_redirect_type ) ) {
218
+		if (empty($subway_redirect_type)) {
219 219
 
220 220
 			return $redirect_to;
221 221
 
222 222
 		}
223 223
 
224
-		if ( 'default' === $subway_redirect_type ) {
224
+		if ('default' === $subway_redirect_type) {
225 225
 			return $redirect_to;
226 226
 		}
227 227
 
228
-		if ( 'page' === $subway_redirect_type ) {
228
+		if ('page' === $subway_redirect_type) {
229 229
 
230 230
 			// Get the page url of the selected page if the admin selected 'Custom Page' in the redirect type settings.
231
-			$selected_redirect_page = intval( get_option( 'subway_redirect_page_id' ) );
231
+			$selected_redirect_page = intval(get_option('subway_redirect_page_id'));
232 232
 
233 233
 			// Redirect to default WordPress behaviour if the user did not select page.
234
-			if ( empty( $selected_redirect_page ) ) {
234
+			if (empty($selected_redirect_page)) {
235 235
 
236 236
 				return $redirect_to;
237 237
 			}
238 238
 
239 239
 			// Otherwise, get the permalink of the saved page and let the user go into that page.
240
-			return get_permalink( $selected_redirect_page );
240
+			return get_permalink($selected_redirect_page);
241 241
 
242
-		} elseif ( 'custom_url' === $subway_redirect_type ) {
242
+		} elseif ('custom_url' === $subway_redirect_type) {
243 243
 
244 244
 			// Get the custom url saved in the redirect type settings.
245
-			$entered_custom_url = get_option( 'subway_redirect_custom_url' );
245
+			$entered_custom_url = get_option('subway_redirect_custom_url');
246 246
 
247 247
 			// Redirect to default WordPress behaviour if the user did enter a custom url.
248
-			if ( empty( $entered_custom_url ) ) {
248
+			if (empty($entered_custom_url)) {
249 249
 
250 250
 				return $redirect_to;
251 251
 
@@ -254,12 +254,12 @@  discard block
 block discarded – undo
254 254
 			// Otherwise, get the custom url saved and let the user go into that page.
255 255
 			$current_user = wp_get_current_user();
256 256
 
257
-			if ( ! empty ( $user->ID ) ) {
258
-				$entered_custom_url = str_replace( '%user_id%', $user->ID, $entered_custom_url );
257
+			if ( ! empty ($user->ID)) {
258
+				$entered_custom_url = str_replace('%user_id%', $user->ID, $entered_custom_url);
259 259
 			}
260 260
 
261
-			if ( ! empty ( $user->user_login ) ) {
262
-				$entered_custom_url = str_replace( '%user_name%', $user->user_login, $entered_custom_url );
261
+			if ( ! empty ($user->user_login)) {
262
+				$entered_custom_url = str_replace('%user_name%', $user->user_login, $entered_custom_url);
263 263
 			}
264 264
 			return $entered_custom_url;
265 265
 
Please login to merge, or discard this patch.
subway.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -16,21 +16,21 @@  discard block
 block discarded – undo
16 16
  * @package subway
17 17
  */
18 18
 
19
-if ( ! defined( 'ABSPATH' ) ) {
19
+if ( ! defined('ABSPATH')) {
20 20
 	exit();
21 21
 }
22 22
 
23
-if ( version_compare( PHP_VERSION, '5.3.0', '<' ) ) {
24
-	add_action( 'admin_notices', 'subway_admin_notice' );
23
+if (version_compare(PHP_VERSION, '5.3.0', '<')) {
24
+	add_action('admin_notices', 'subway_admin_notice');
25 25
 	function subway_admin_notice() {
26 26
 	?>
27 27
 		<div class="notice notice-error is-dismissible">
28 28
 	        <p>
29 29
 	        	<strong>
30
-	        		<?php esc_html_e( 'Notice: Subway uses PHP Class Namespaces 
30
+	        		<?php esc_html_e('Notice: Subway uses PHP Class Namespaces 
31 31
 	        		which is only available in servers with PHP 5.3.0 version and above. 
32 32
 	        		Update your server\'s PHP version. You can deactivate 
33
-	        		Subway in the meantime.', 'subway' ); ?>
33
+	        		Subway in the meantime.', 'subway'); ?>
34 34
 	        	</strong>
35 35
 	        </p>
36 36
 	    </div>
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 }
40 40
 
41 41
 // Define Subway Plugin Version.
42
-define( 'SUBWAY_VERSION', '2.0' );
42
+define('SUBWAY_VERSION', '2.0');
43 43
 
44 44
 // Define Subway Directory Path.
45
-define( 'SUBWAY_DIR_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) );
45
+define('SUBWAY_DIR_PATH', trailingslashit(plugin_dir_path(__FILE__)));
46 46
 
47 47
 // Define Subway URL Path.
48
-define( 'SUBWAY_DIR_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
48
+define('SUBWAY_DIR_URL', trailingslashit(plugin_dir_url(__FILE__)));
49 49
 
50 50
 // Include Subway i18n.
51 51
 require_once SUBWAY_DIR_PATH . 'i18.php';
@@ -69,16 +69,16 @@  discard block
 block discarded – undo
69 69
 require_once SUBWAY_DIR_PATH . 'shortcodes/subway-shortcodes.php';
70 70
 
71 71
 // Redirect (302) all front-end request to the login page.
72
-add_action( 'wp', array( 'Subway\Page_Redirect', 'index' ) );
72
+add_action('wp', array('Subway\Page_Redirect', 'index'));
73 73
 
74 74
 // Redirect the user when he/she visit wp-admin or wp-login.php.
75
-add_action( 'init', array( 'Subway\Admin_Redirect', 'index' ) );
75
+add_action('init', array('Subway\Admin_Redirect', 'index'));
76 76
 
77 77
 // Redirect (302) invalid login request to the login page.
78
-add_action( 'wp_ajax_nopriv_subway_logging_in', array( 'Subway\Admin_Redirect', 'handle_authentication' ) );
78
+add_action('wp_ajax_nopriv_subway_logging_in', array('Subway\Admin_Redirect', 'handle_authentication'));
79 79
 
80 80
 // Redirect the user after successful logged in; Priority = 10; Accepted Params Number = 3'
81
-add_filter( 'login_redirect', array( 'Subway\Admin_Redirect', 'authentication_200' ), 10, 3 );
81
+add_filter('login_redirect', array('Subway\Admin_Redirect', 'authentication_200'), 10, 3);
82 82
 
83 83
 // Load our JS and CSS files.
84
-add_action( 'wp_enqueue_scripts', array( 'Subway\Enqueue', 'register_js' ) );
84
+add_action('wp_enqueue_scripts', array('Subway\Enqueue', 'register_js'));
Please login to merge, or discard this patch.
shortcodes/subway-shortcodes.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 namespace Subway;
13 13
 
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	return;
16 16
 }
17 17
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 	private function __construct() {
21 21
 		
22
-		add_action( 'init', array( $this, 'register') );
22
+		add_action('init', array($this, 'register'));
23 23
 		
24 24
 		return $this;
25 25
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		
30 30
 		static $instance = null;
31 31
 
32
-		if ( null === $instance ) {
32
+		if (null === $instance) {
33 33
 
34 34
 			$instance = new Shortcodes();
35 35
 
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 
43 43
 	function register() {
44 44
 
45
-		add_shortcode( 'subway_login', array( $this, 'wp_login' ) );
45
+		add_shortcode('subway_login', array($this, 'wp_login'));
46 46
 
47
-		add_action( 'login_form_middle', array( $this, 'login_form_action' ), 10, 2 );
47
+		add_action('login_form_middle', array($this, 'login_form_action'), 10, 2);
48 48
 
49
-		add_action( 'login_form_middle', array( $this, '__action_lost_password_link' ), 10, 2 );
49
+		add_action('login_form_middle', array($this, '__action_lost_password_link'), 10, 2);
50 50
 
51 51
 		return null;
52 52
 
@@ -56,26 +56,26 @@  discard block
 block discarded – undo
56 56
 		
57 57
 		$atts = array();
58 58
 
59
-		echo $this->get_template_file( $atts, $file = 'login-form.php', $content = null );
59
+		echo $this->get_template_file($atts, $file = 'login-form.php', $content = null);
60 60
 
61 61
 		return;
62 62
 	}
63 63
 
64
-	protected function get_template_file( $atts, $file = '', $content = null ) {
64
+	protected function get_template_file($atts, $file = '', $content = null) {
65 65
 
66 66
 		ob_start();
67 67
 
68
-		if ( empty( $file ) ) {
68
+		if (empty($file)) {
69 69
 			
70 70
 			return;
71 71
 
72 72
 		}
73 73
 
74
-		$template = SUBWAY_DIR_PATH . 'templates/'.$file;
74
+		$template = SUBWAY_DIR_PATH . 'templates/' . $file;
75 75
 
76
-		if ( file_exists( $template ) ) {
76
+		if (file_exists($template)) {
77 77
 
78
-			if ( $theme_template = locate_template( array('gears/shortcodes/'.$file ) ) ) {
78
+			if ($theme_template = locate_template(array('gears/shortcodes/' . $file))) {
79 79
 
80 80
 	        	$template = $theme_template;
81 81
 
@@ -85,22 +85,22 @@  discard block
 block discarded – undo
85 85
 
86 86
     	} else {
87 87
 
88
-	    	echo sprintf( __( 'Subway Error: Unable to find template file in: %1s', 'subway' ), $template );
88
+	    	echo sprintf(__('Subway Error: Unable to find template file in: %1s', 'subway'), $template);
89 89
 
90 90
 	    }
91 91
 
92 92
 	    return ob_get_clean();
93 93
 	}
94 94
 
95
-	public function login_form_action( $__content ) {
95
+	public function login_form_action($__content) {
96 96
 		ob_start();
97
-		do_action( 'login_form' );
97
+		do_action('login_form');
98 98
 		return $__content . ob_get_clean();
99 99
 	}
100 100
 
101
-	public function __action_lost_password_link( $__content ) {
101
+	public function __action_lost_password_link($__content) {
102 102
 		
103
-		return $__content . $this->get_template_file( $params = array(),  $file = 'login-form-lost-password.php',  $content = null );
103
+		return $__content . $this->get_template_file($params = array(), $file = 'login-form-lost-password.php', $content = null);
104 104
 	}
105 105
 
106 106
 }
Please login to merge, or discard this patch.
classes/subway-enqueue.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 namespace Subway;
13 13
 
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
    return;
16 16
 }
17 17
 
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
 	
20 20
 	public static function register_js() {
21 21
 
22
-   		wp_enqueue_style( 'subway-style', SUBWAY_DIR_URL . 'assets/css/subway.css' );
22
+   		wp_enqueue_style('subway-style', SUBWAY_DIR_URL . 'assets/css/subway.css');
23 23
 
24
-   		wp_enqueue_script( 'subway-script', SUBWAY_DIR_URL . 'assets/js/subway.js', array('jquery') );
24
+   		wp_enqueue_script('subway-script', SUBWAY_DIR_URL . 'assets/js/subway.js', array('jquery'));
25 25
 
26
-   		wp_localize_script( 'subway-script', 'subway_config', array( 
27
-   				'ajax_url' => admin_url( 'admin-ajax.php' ),
28
-   				'login_http_error' => __( 'An error occured while transmitting the data. Refresh the page and try again', 'subway' )
26
+   		wp_localize_script('subway-script', 'subway_config', array( 
27
+   				'ajax_url' => admin_url('admin-ajax.php'),
28
+   				'login_http_error' => __('An error occured while transmitting the data. Refresh the page and try again', 'subway')
29 29
    			)
30 30
    		);
31 31
 
Please login to merge, or discard this patch.
classes/subway-page-redirect.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 namespace Subway;
14 14
 
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	return;
17 17
 }
18 18
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
         
24 24
         global $post;
25 25
 
26
-        if ( '' == session_id() || ! isset( $_SESSION ) ) {
26
+        if ('' == session_id() || ! isset($_SESSION)) {
27 27
 
28 28
             session_start();
29 29
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 		$post_copy = &$post;
33 33
 
34
-		$login_page_id = intval( get_option( 'subway_login_page' ) );
34
+		$login_page_id = intval(get_option('subway_login_page'));
35 35
 
36 36
 		$excluded_page = Options::get_public_post_ids();
37 37
 
@@ -39,64 +39,64 @@  discard block
 block discarded – undo
39 39
 		$redirect_page = Options::get_redirect_page_url();
40 40
 
41 41
 		// Check if redirect page is empty or not.
42
-		if ( empty( $redirect_page ) ) {
42
+		if (empty($redirect_page)) {
43 43
 			return;
44 44
 		}
45 45
 
46 46
 		// Check if buddypress activate page.
47
-		if ( function_exists( 'bp_is_activation_page' ) ) {
48
-			if ( bp_is_activation_page() ) {
47
+		if (function_exists('bp_is_activation_page')) {
48
+			if (bp_is_activation_page()) {
49 49
 				return;
50 50
 			}
51 51
 		}
52 52
 
53 53
 		// Check if buddypress registration page.
54
-		if ( function_exists( 'bp_is_register_page' ) ) {
55
-			if ( bp_is_register_page() ) {
54
+		if (function_exists('bp_is_register_page')) {
55
+			if (bp_is_register_page()) {
56 56
 				return;
57 57
 			}
58 58
 		}
59 59
 
60 60
 		// Assign 0 value to empty $post->ID to prevent exception.
61 61
 		// This applies to custom WordPress pages such as BP Members Page and Groups.
62
-		if ( empty( $post_copy ) ) {
62
+		if (empty($post_copy)) {
63 63
 			$post_copy = new \stdclass;
64 64
 			$post_copy->ID = 0;
65 65
 		}
66 66
 
67
-		$current_page_id = intval( $post_copy->ID );
67
+		$current_page_id = intval($post_copy->ID);
68 68
 
69 69
 		// Check if $current_page_id && $selected_blog_id is equal to each other.
70 70
 		// If that is the case, get the page ID instead of global $post->ID that the query returns.
71 71
 		// The ID of the first post object inside the loop is not correct.
72
-		$blog_id = intval( get_option( 'page_for_posts' ) );
72
+		$blog_id = intval(get_option('page_for_posts'));
73 73
 
74
-		if ( is_home() ) {
75
-			if ( $blog_id === $login_page_id ) {
74
+		if (is_home()) {
75
+			if ($blog_id === $login_page_id) {
76 76
 				$current_page_id = $blog_id;
77 77
 			}
78 78
 		}
79 79
 
80
-		if ( isset( $_SESSION['redirected'] ) ) {
80
+		if (isset($_SESSION['redirected'])) {
81 81
 
82
-			unset( $_SESSION['redirected'] );
82
+			unset($_SESSION['redirected']);
83 83
 
84 84
 			return;
85 85
 
86 86
 		}
87 87
 
88 88
 		// Only execute the script for non-loggedin visitors.
89
-		if ( ! is_user_logged_in() ) {
89
+		if ( ! is_user_logged_in()) {
90 90
 
91
-			if ( $current_page_id !== $login_page_id ) {
91
+			if ($current_page_id !== $login_page_id) {
92 92
 
93
-				if ( ! in_array( $current_page_id, $excluded_page, true ) ) {
93
+				if ( ! in_array($current_page_id, $excluded_page, true)) {
94 94
 
95 95
 					$_SESSION['redirected'] = true;
96 96
 
97 97
 					wp_safe_redirect( 
98 98
                         add_query_arg( 
99
-                            array( '_redirected' => 'yes' ), 
99
+                            array('_redirected' => 'yes'), 
100 100
                             $redirect_page 
101 101
                         ) 
102 102
                     );
Please login to merge, or discard this patch.
classes/subway-options.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 namespace Subway;
13 13
 
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	return;
16 16
 }
17 17
 
@@ -19,19 +19,19 @@  discard block
 block discarded – undo
19 19
 
20 20
 	public static function get_redirect_page_url() {
21 21
 
22
-		$selected_login_post_id = intval( get_option( 'subway_login_page' ) );
22
+		$selected_login_post_id = intval(get_option('subway_login_page'));
23 23
 
24
-		if ( 0 === $selected_login_post_id ) {
24
+		if (0 === $selected_login_post_id) {
25 25
 
26 26
 			return;
27 27
 
28 28
 		}
29 29
 
30
-		$login_post = get_post( $selected_login_post_id );
30
+		$login_post = get_post($selected_login_post_id);
31 31
 
32
-		if ( ! empty( $login_post ) ) {
32
+		if ( ! empty($login_post)) {
33 33
 
34
-			return get_permalink( $login_post->ID );
34
+			return get_permalink($login_post->ID);
35 35
 
36 36
 		}
37 37
 
@@ -41,19 +41,19 @@  discard block
 block discarded – undo
41 41
 
42 42
 	public static function get_public_post_ids() {
43 43
 
44
-		$subway_public_post = get_option( 'subway_public_post' );
44
+		$subway_public_post = get_option('subway_public_post');
45 45
 
46 46
 		$excluded_pages_collection = array();
47 47
 
48
-		if ( ! empty( $subway_public_post ) ) {
48
+		if ( ! empty($subway_public_post)) {
49 49
 
50
-			$excluded_pages_collection = explode( ',', $subway_public_post );
50
+			$excluded_pages_collection = explode(',', $subway_public_post);
51 51
 
52 52
 		}
53 53
 
54 54
 		// Should filter it by integer, spaces will be ignored, other strings.
55 55
 		// Will be converted to zero '0'.
56
-		return array_filter( array_map( 'intval', $excluded_pages_collection ) );
56
+		return array_filter(array_map('intval', $excluded_pages_collection));
57 57
 		
58 58
 	}
59 59
 }
Please login to merge, or discard this patch.
i18.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,14 +10,14 @@  discard block
 block discarded – undo
10 10
  * @package Subway
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	return;
15 15
 }
16 16
 
17 17
 /**
18 18
  * Plugin i18n.
19 19
  */
20
-add_action( 'plugins_loaded', 'subway_localize_plugin' );
20
+add_action('plugins_loaded', 'subway_localize_plugin');
21 21
 
22 22
 /**
23 23
  * Subway l10n callback.
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 	$rel_path = SUBWAY_DIR_PATH . 'languages';
30 30
 
31
-	load_plugin_textdomain( 'subway', false, $rel_path );
31
+	load_plugin_textdomain('subway', false, $rel_path);
32 32
 
33 33
 	return;
34 34
 }
Please login to merge, or discard this patch.
templates/login-form-lost-password.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@
 block discarded – undo
10 10
  * @package Subway
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	return;
15 15
 }
16 16
 ?>
17 17
 <p class="subway-login-lost-password">
18
-	<a href="<?php echo esc_url( wp_lostpassword_url( $redirect = '' ) ); ?>">
19
-	 	<?php esc_html_e( 'Forgot Password', 'subway' ); ?>
18
+	<a href="<?php echo esc_url(wp_lostpassword_url($redirect = '')); ?>">
19
+	 	<?php esc_html_e('Forgot Password', 'subway'); ?>
20 20
 	</a>
21 21
 </p>
22 22
\ No newline at end of file
Please login to merge, or discard this patch.
templates/login-form.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@  discard block
 block discarded – undo
10 10
  * @package Subway
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	return;
15 15
 }
16 16
 
17 17
 $args = array(
18 18
 	'echo'           => true,
19 19
 	'form_id'        => 'loginform',
20
-	'label_username' => __( 'Username', 'subway' ),
21
-	'label_password' => __( 'Password', 'subway' ),
22
-	'label_remember' => __( 'Remember Me', 'subway' ),
23
-	'label_log_in'   => __( 'Log In', 'subway' ),
20
+	'label_username' => __('Username', 'subway'),
21
+	'label_password' => __('Password', 'subway'),
22
+	'label_remember' => __('Remember Me', 'subway'),
23
+	'label_log_in'   => __('Log In', 'subway'),
24 24
 	'id_username'    => 'user_login',
25 25
 	'id_password'    => 'user_pass',
26 26
 	'id_remember'    => 'rememberme',
@@ -35,87 +35,87 @@  discard block
 block discarded – undo
35 35
 
36 36
 $message_types = array();
37 37
 
38
-if ( isset( $_GET['login'] ) ) {
38
+if (isset($_GET['login'])) {
39 39
 
40
-	if ( 'failed' === $_GET['login'] ) {
40
+	if ('failed' === $_GET['login']) {
41 41
 
42
-		if ( isset( $_GET['type'] ) ) {
42
+		if (isset($_GET['type'])) {
43 43
 
44 44
 			$message_types = array(
45 45
 
46 46
 				'default' => array(
47
-						'message' => __( 'There was an error trying to sign-in to your account. Make sure the credentials below are correct.', 'subway' ),
47
+						'message' => __('There was an error trying to sign-in to your account. Make sure the credentials below are correct.', 'subway'),
48 48
 					),
49 49
 				'__blank' => array(
50
-						'message' => __( 'Required: Username and Password cannot be empty.', 'subway' ),
50
+						'message' => __('Required: Username and Password cannot be empty.', 'subway'),
51 51
 					),
52 52
 				'__userempty' => array(
53
-						'message' => __( 'Required: Username cannot be empty.', 'subway' ),
53
+						'message' => __('Required: Username cannot be empty.', 'subway'),
54 54
 					),
55 55
 				'__passempty' => array(
56
-						'message' => __( 'Required: Password cannot be empty.', 'subway' ),
56
+						'message' => __('Required: Password cannot be empty.', 'subway'),
57 57
 					),
58 58
 				'fb_invalid_email' => array(
59
-						'message' => __( 'Facebook email address is invalid or is not yet verified.', 'subway' ),
59
+						'message' => __('Facebook email address is invalid or is not yet verified.', 'subway'),
60 60
 					),
61 61
 				'fb_error' => array(
62
-						'message' => __( 'Facebook Application Error. Misconfigured or App is rejected.', 'subway' ),
62
+						'message' => __('Facebook Application Error. Misconfigured or App is rejected.', 'subway'),
63 63
 					),
64 64
 				'app_not_live' => array(
65
-						'message' => __( 'Unable to fetch your Facebook Profile.', 'subway' ),
65
+						'message' => __('Unable to fetch your Facebook Profile.', 'subway'),
66 66
 					),
67 67
 				'gears_username_or_email_exists' => array(
68
-						'message' => __( 'Username or email address already exists', 'subway' ),
68
+						'message' => __('Username or email address already exists', 'subway'),
69 69
 					),
70 70
 				'gp_error_authentication' => array(
71
-						'message' => __( 'Google Plus Authentication Error. Invalid Client ID or Secret.', 'subway' ),
71
+						'message' => __('Google Plus Authentication Error. Invalid Client ID or Secret.', 'subway'),
72 72
 					),
73 73
 			);
74 74
 
75 75
 			$message = $message_types['default']['message'];
76 76
 
77
-			if ( array_key_exists( $_GET['type'], $message_types ) ) {
77
+			if (array_key_exists($_GET['type'], $message_types)) {
78 78
 
79
-				$message = $message_types[ $_GET['type'] ]['message'];
79
+				$message = $message_types[$_GET['type']]['message'];
80 80
 
81 81
 			}
82 82
 
83
-			$error_login_message = '<div id="message" class="error">'. esc_html( $message ) .'</div>';
83
+			$error_login_message = '<div id="message" class="error">' . esc_html($message) . '</div>';
84 84
 
85 85
 		} else {
86 86
 
87
-			$error_login_message = '<div id="message" class="error">'. esc_html__ ( 'Error: Invalid username and password combination.', 'subway' ).'</div>';
87
+			$error_login_message = '<div id="message" class="error">' . esc_html__('Error: Invalid username and password combination.', 'subway') . '</div>';
88 88
 
89 89
 		}
90 90
 	}
91 91
 }
92 92
 
93
-if ( isset( $_GET['_redirected'] ) ) {
94
-	$error_login_message = '<div id="message" class="success">' . esc_html__( 'We are glad to have you back. Please use the login form below to access the page.', 'subway' ) . '</div>';
93
+if (isset($_GET['_redirected'])) {
94
+	$error_login_message = '<div id="message" class="success">' . esc_html__('We are glad to have you back. Please use the login form below to access the page.', 'subway') . '</div>';
95 95
 }
96 96
 
97 97
 ?>
98
-<?php if ( ! is_user_logged_in() ) { ?>
98
+<?php if ( ! is_user_logged_in()) { ?>
99 99
 	<div class="mg-top-35 mg-bottom-35 subway-login-form">
100 100
 		<div class="subway-login-form-form">
101 101
 			<div class="subway-login-form__actions">
102 102
 				<h3>
103
-					<?php _e( 'Account Sign-in', 'subway' ); ?>
103
+					<?php _e('Account Sign-in', 'subway'); ?>
104 104
 				</h3>
105
-				<?php do_action( 'gears_login_form' ); ?>
105
+				<?php do_action('gears_login_form'); ?>
106 106
 			</div>
107 107
 			<div class="subway-login-form-message">
108 108
 				<?php echo $error_login_message; ?>
109 109
 			</div>
110 110
 			<div class="subway-login-form__form">
111
-				<?php echo wp_login_form( $args ); ?>
111
+				<?php echo wp_login_form($args); ?>
112 112
 			</div>
113 113
 		</div>
114 114
 	</div>
115 115
 <?php } else { ?>
116 116
 	<div class="mg-top-35 mg-bottom-35 subway-login-sucessfull" style="background: #CDDC39; padding: 15px 15px 15px 15px;border-radius: 4px;color: #616161;">
117 117
 		<p style="margin-bottom: 0px;">
118
-			<?php echo esc_html__( apply_filters( 'subway_login_message', 'Great! You have succesfully login.' ), 'subway' ); ?>
118
+			<?php echo esc_html__(apply_filters('subway_login_message', 'Great! You have succesfully login.'), 'subway'); ?>
119 119
 		</p>
120 120
 	</div>
121 121
 <?php } ?>
Please login to merge, or discard this patch.