Passed
Push — master ( 58dda0...5d51c3 )
by Joseph
142:23 queued 96:49
created
classes/subway-page-redirect.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@  discard block
 block discarded – undo
6 6
 
7 7
 	public static function index() {
8 8
         
9
-        global $post;
9
+		global $post;
10 10
 
11
-        if ( '' == session_id() || ! isset( $_SESSION ) ) {
11
+		if ( '' == session_id() || ! isset( $_SESSION ) ) {
12 12
 
13
-            session_start();
13
+			session_start();
14 14
 
15
-        }
15
+		}
16 16
 
17 17
 		$post_copy = &$post;
18 18
 
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 					$_SESSION['redirected'] = true;
81 81
 
82 82
 					wp_safe_redirect( 
83
-                        add_query_arg( 
84
-                            array( '_redirected' => 'yes' ), 
85
-                            $redirect_page 
86
-                        ) 
87
-                    );
83
+						add_query_arg( 
84
+							array( '_redirected' => 'yes' ), 
85
+							$redirect_page 
86
+						) 
87
+					);
88 88
 
89 89
 					die();
90 90
 
Please login to merge, or discard this 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-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.
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.
settings-fields/field-subway-redirect-option-form.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  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
 
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
 		<!-- Page -->
38 38
 		<label for="subway_use_page">
39 39
 			
40
-			<input <?php checked( 'page', get_option( 'subway_redirect_type' ), true ); ?> value="page" name="subway_redirect_type" id="subway_use_page" type="radio" class="code" /> 
40
+			<input <?php checked('page', get_option('subway_redirect_type'), true); ?> value="page" name="subway_redirect_type" id="subway_use_page" type="radio" class="code" /> 
41 41
 			
42
-			<?php esc_html_e( 'Custom Page', 'subway' ); ?>
42
+			<?php esc_html_e('Custom Page', 'subway'); ?>
43 43
 
44 44
 		</label>
45 45
 
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 
50 50
 		<label for="subway_use_custom_url">
51 51
 			
52
-			<input <?php checked( 'custom_url', get_option( 'subway_redirect_type' ), true ); ?> value="custom_url" name="subway_redirect_type" id="subway_use_custom_url" type="radio" class="code" /> 
52
+			<input <?php checked('custom_url', get_option('subway_redirect_type'), true); ?> value="custom_url" name="subway_redirect_type" id="subway_use_custom_url" type="radio" class="code" /> 
53 53
 			
54
-			<?php esc_html_e( 'Custom URL', 'subway' ); ?>
54
+			<?php esc_html_e('Custom URL', 'subway'); ?>
55 55
 
56 56
 		</label>
57 57
 
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 
62 62
 		<label for="subway_use_default">
63 63
 			
64
-			<input <?php checked( 'default', get_option( 'subway_redirect_type' ), true ); ?> value="default" name="subway_redirect_type" id="subway_use_default" type="radio" class="code" /> 
64
+			<input <?php checked('default', get_option('subway_redirect_type'), true); ?> value="default" name="subway_redirect_type" id="subway_use_default" type="radio" class="code" /> 
65 65
 			
66
-			<?php esc_html_e( 'Default Behavior', 'subway' ); ?>
66
+			<?php esc_html_e('Default Behavior', 'subway'); ?>
67 67
 
68 68
 		</label>
69 69
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	<div id="subway_redirect_page_option_section" class="hidden subway-redirect-option-section">
80 80
 		
81 81
 		<label for="subway_redirect_page_id">
82
-			<?php esc_html_e( 'Select Page' ); ?>
82
+			<?php esc_html_e('Select Page'); ?>
83 83
 		</label>
84 84
 
85 85
 		<?php
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 			wp_dropdown_pages(
88 88
 				array(
89 89
 						'name' => 'subway_redirect_page_id',
90
-						'selected' => intval( get_option( 'subway_redirect_page_id' ) ),
91
-						'show_option_none' => esc_html__( '-', 'subway' ),
90
+						'selected' => intval(get_option('subway_redirect_page_id')),
91
+						'show_option_none' => esc_html__('-', 'subway'),
92 92
 				)
93 93
 			);
94 94
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
 		<p class="description">
98 98
 			
99
-			<?php _e( 'The selected page will be used as the redirect endpoint for all of your users. Selecting blank (-) will redirect the user to the default redirect defined in WordPress or other plugins. Choose "Custom URL" if you want to redirect to a custom URL or domain.', 'subway' ); ?>
99
+			<?php _e('The selected page will be used as the redirect endpoint for all of your users. Selecting blank (-) will redirect the user to the default redirect defined in WordPress or other plugins. Choose "Custom URL" if you want to redirect to a custom URL or domain.', 'subway'); ?>
100 100
 
101 101
 		</p>
102 102
 
@@ -105,29 +105,29 @@  discard block
 block discarded – undo
105 105
 	<div id="subway_redirect_custom_url_option_section" class="hidden subway-redirect-option-section">
106 106
 		
107 107
 		<label for="subway_redirect_custom_url">
108
-			<?php esc_attr_e( 'Enter Redirect URL:', 'subway' ); ?>
108
+			<?php esc_attr_e('Enter Redirect URL:', 'subway'); ?>
109 109
 		</label>
110 110
 
111
-		<input value="<?php echo esc_attr( esc_url( get_option( 'subway_redirect_custom_url' ) ) ); ?>" type="text" name="subway_redirect_custom_url" placeholder="<?php esc_attr_e( 'http://', 'subway' ); ?>" 
111
+		<input value="<?php echo esc_attr(esc_url(get_option('subway_redirect_custom_url'))); ?>" type="text" name="subway_redirect_custom_url" placeholder="<?php esc_attr_e('http://', 'subway'); ?>" 
112 112
 		id="subway_redirect_custom_url" size="75" />
113 113
 
114 114
 		<p class="description"><br>
115 115
 
116 116
 		<?php
117
-			echo sprintf( __( 'When entering a custom domain, you can use a variable string such us: %1$s and %2$s. For example, http://yoursiteurl.com/members/<strong>%2$s</strong> will translate to http://yoursiteurl/members/<strong>admin</strong> where "admin" is equal to the %2$s variable; http://yoursiteurl.com/users/<strong>%1$s</strong> will translate to http://yoursiteurl.com/users/<strong>4</strong> where "4" is equal to the %1$s. Both variables refer to the current user that is logged-in.', 'subway' ), '%user_id%', '%user_name%' );
117
+			echo sprintf(__('When entering a custom domain, you can use a variable string such us: %1$s and %2$s. For example, http://yoursiteurl.com/members/<strong>%2$s</strong> will translate to http://yoursiteurl/members/<strong>admin</strong> where "admin" is equal to the %2$s variable; http://yoursiteurl.com/users/<strong>%1$s</strong> will translate to http://yoursiteurl.com/users/<strong>4</strong> where "4" is equal to the %1$s. Both variables refer to the current user that is logged-in.', 'subway'), '%user_id%', '%user_name%');
118 118
 		?>
119 119
 
120 120
 		</p><br>
121 121
 
122 122
 		<p class="description">
123 123
 
124
-			<?php esc_attr_e( 'Leave empty to use existing WordPress or other 3rd party plugin redirect option.', 'subway' ); ?>
124
+			<?php esc_attr_e('Leave empty to use existing WordPress or other 3rd party plugin redirect option.', 'subway'); ?>
125 125
 
126 126
 		</p><br>
127 127
 
128 128
 		<p class="description">
129 129
 
130
-			<?php esc_html_e( 'Warning: External URLs are not supported by WordPress Function (wp_safe_redirect) and will be redirected back to default WordPress behavior.', 'subway' ); ?>
130
+			<?php esc_html_e('Warning: External URLs are not supported by WordPress Function (wp_safe_redirect) and will be redirected back to default WordPress behavior.', 'subway'); ?>
131 131
 
132 132
 		</p> 
133 133
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	<div id="subway_redirect_default_option_section" class="hidden subway-redirect-option-section">
138 138
 		<p>
139 139
 			<?php
140
-				esc_html_e( "By choosing the default behavior, the redirect type will be set to the default WordPress' behavior. For example, if you have plugins like Peter's Login Redirect. This option will disable Subway's redirect and use the Peter's Login Redirect Instead.", 'subway' );
140
+				esc_html_e("By choosing the default behavior, the redirect type will be set to the default WordPress' behavior. For example, if you have plugins like Peter's Login Redirect. This option will disable Subway's redirect and use the Peter's Login Redirect Instead.", 'subway');
141 141
 			?>
142 142
 		</p>
143 143
 	</div>
Please login to merge, or discard this patch.
settings-fields/field-subway-lock-wp-admin.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,24 +10,24 @@
 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
 function subway_lock_wp_admin() { ?>
18 18
 
19 19
 	<label for="subway_redirect_wp_admin">
20
-		<input <?php echo checked( 1, get_option( 'subway_redirect_wp_admin' ), false ) ;?> value="1" name="subway_redirect_wp_admin" 
20
+		<input <?php echo checked(1, get_option('subway_redirect_wp_admin'), false); ?> value="1" name="subway_redirect_wp_admin" 
21 21
 		id="subway_redirect_wp_admin" type="checkbox" class="code" /> 
22
-		<?php esc_html_e( 'Check to hide /wp-admin or /wp-login.php to logged out users and redirect them to Subway custom login form.', 'subway' ); ?>
22
+		<?php esc_html_e('Check to hide /wp-admin or /wp-login.php to logged out users and redirect them to Subway custom login form.', 'subway'); ?>
23 23
 		
24 24
 	</label>
25 25
 
26 26
 	<p class="description">
27 27
 		<?php 
28
-			echo sprintf( __( "<br/>In case, you were locked out. Use the link below to bypass the log-in page and go directly 
28
+			echo sprintf(__("<br/>In case, you were locked out. Use the link below to bypass the log-in page and go directly 
29 29
 			to your website's wp-login URL (http://yoursiteurl.com/wp-login.php):
30
-			<br> <strong>%s</strong>", 'subway' ), site_url( 'wp-login.php?no_redirect=true' ) ); 
30
+			<br> <strong>%s</strong>", 'subway'), site_url('wp-login.php?no_redirect=true')); 
31 31
 		?>
32 32
 	</p>
33 33
 <?php
Please login to merge, or discard this patch.
settings-fields/field-subway-is-public-form.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  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
 
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  */
22 22
 function subway_is_public_form() {
23 23
 
24
-	echo '<label for="subway_is_public"><input ' . checked( 1, get_option( 'subway_is_public' ), false ) . ' value="1" name="subway_is_public" id="subway_is_public" type="checkbox" class="code" /> Check to make all of your posts and pages visible to public.</label>';
25
-	echo '<p class="description">' . esc_html__( 'This option will overwrite the \'Private Login Page\' below. BuddyPress pages like user profile, members, and groups are still only available to the rightful owner of the profile.', 'subway' ) . '</p>';
24
+	echo '<label for="subway_is_public"><input ' . checked(1, get_option('subway_is_public'), false) . ' value="1" name="subway_is_public" id="subway_is_public" type="checkbox" class="code" /> Check to make all of your posts and pages visible to public.</label>';
25
+	echo '<p class="description">' . esc_html__('This option will overwrite the \'Private Login Page\' below. BuddyPress pages like user profile, members, and groups are still only available to the rightful owner of the profile.', 'subway') . '</p>';
26 26
 
27 27
 	return;
28 28
 }
Please login to merge, or discard this patch.
settings-fields/field-subway-public-post.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,15 +10,15 @@
 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
 function subway_public_post() {
18 18
 
19
-	echo '<textarea id="subway_public_post" name="subway_public_post" rows="5" cols="95">' . esc_attr( trim( get_option( 'subway_public_post' ) ) ) . '</textarea>';
19
+	echo '<textarea id="subway_public_post" name="subway_public_post" rows="5" cols="95">' . esc_attr(trim(get_option('subway_public_post'))) . '</textarea>';
20 20
 
21
-	echo '<p class="description">' . nl2br( esc_html( "Enter the IDs of posts and pages that you wanted to show in public. You need to separate it by ',' (comma),  for example: 143,123,213. Alternatively, you can enable public viewing of all of your pages and posts by checking the 'Public Website' option above.", 'subway' ) ) . '</p>';
21
+	echo '<p class="description">' . nl2br(esc_html("Enter the IDs of posts and pages that you wanted to show in public. You need to separate it by ',' (comma),  for example: 143,123,213. Alternatively, you can enable public viewing of all of your pages and posts by checking the 'Public Website' option above.", 'subway')) . '</p>';
22 22
 
23 23
 	return;
24 24
 
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__( 'Members only page. 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__('Members only page. 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 esc_html_e( 'Account Sign-in', 'subway' ); ?>
103
+					<?php esc_html_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.