Passed
Push — master ( ae7108...58dda0 )
by Joseph
69:36 queued 35:36
created
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-wp-admin-redirect.php 1 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.
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.
admin-settings.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  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
-add_action( 'admin_menu', 'subway_admin_menu' );
17
+add_action('admin_menu', 'subway_admin_menu');
18 18
 
19
-add_action( 'admin_init', 'subway_register_settings' );
19
+add_action('admin_init', 'subway_register_settings');
20 20
 
21 21
 /**
22 22
  * Display 'Subway' link under 'Settings'
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  */
25 25
 function subway_admin_menu() {
26 26
     
27
-    add_options_page( 'Subway Settings', 'Subway', 'manage_options', 'subway', 'subway_options_page' );
27
+    add_options_page('Subway Settings', 'Subway', 'manage_options', 'subway', 'subway_options_page');
28 28
 
29 29
     return;
30 30
 }
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
 function subway_register_settings() {
34 34
 
35 35
 	// Register our settings section.
36
-	add_settings_section( 'subway-page-visibility-section', __( 'Pages Visibility', 'subway' ), 'subway_section_cb', 'subway-settings-section' );
37
-	add_settings_section( 'subway-redirect-section', __( 'Redirect Options', 'subway' ), 'subway_redirect_cb', 'subway-settings-section' );
36
+	add_settings_section('subway-page-visibility-section', __('Pages Visibility', 'subway'), 'subway_section_cb', 'subway-settings-section');
37
+	add_settings_section('subway-redirect-section', __('Redirect Options', 'subway'), 'subway_redirect_cb', 'subway-settings-section');
38 38
 
39 39
 	// Register the fields.
40 40
     $fields = array(
41 41
     		array(
42 42
     				'id' => 'subway_is_public',
43
-    				'label' => __( 'Public Website', 'subway' ),
43
+    				'label' => __('Public Website', 'subway'),
44 44
     				'callback' => 'subway_is_public_form',
45 45
     				'section' => 'subway-settings-section',
46 46
     				'group' => 'subway-page-visibility-section'
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
     		
49 49
     		array(
50 50
     				'id' => 'subway_login_page',
51
-    				'label' => __( 'Private Login Page', 'subway' ),
51
+    				'label' => __('Private Login Page', 'subway'),
52 52
     				'callback' => 'subway_login_page_form',
53 53
     				'section' => 'subway-settings-section',
54 54
     				'group' => 'subway-page-visibility-section'
55 55
     			),
56 56
     		array(
57 57
     				'id' => 'subway_public_post',
58
-    				'label' => __( 'Public Posts IDs', 'subway' ),
58
+    				'label' => __('Public Posts IDs', 'subway'),
59 59
     				'callback' => 'subway_public_post',
60 60
     				'section' => 'subway-settings-section',
61 61
     				'group' => 'subway-page-visibility-section'
@@ -63,29 +63,29 @@  discard block
 block discarded – undo
63 63
     	
64 64
     		array(
65 65
     				'id' => 'subway_redirect_type',
66
-    				'label' => __( 'Redirect Type', 'subway' ),
66
+    				'label' => __('Redirect Type', 'subway'),
67 67
     				'callback' => 'subway_redirect_option_form',
68 68
     				'section' => 'subway-settings-section',
69 69
     				'group' => 'subway-redirect-section'
70 70
     			),
71 71
     		array(
72 72
     				'id' => 'subway_redirect_wp_admin',
73
-    				'label' => __( 'Block <em>wp-admin</em> Access', 'subway' ),
73
+    				'label' => __('Block <em>wp-admin</em> Access', 'subway'),
74 74
     				'callback' => 'subway_lock_wp_admin',
75 75
     				'section' => 'subway-settings-section',
76 76
     				'group' => 'subway-redirect-section'
77 77
     			),
78 78
     	);
79 79
 
80
-    foreach( $fields as $field ) {
80
+    foreach ($fields as $field) {
81 81
 
82
-    	add_settings_field( $field['id'], $field['label'], $field['callback'], $field['section'], $field['group'] );
83
-    	register_setting( 'subway-settings-group', $field['id'] );
84
-    	require_once trailingslashit( SUBWAY_DIR_PATH ) . 'settings-fields/field-' . sanitize_title( str_replace('_','-', $field['callback']) ) . '.php';
82
+    	add_settings_field($field['id'], $field['label'], $field['callback'], $field['section'], $field['group']);
83
+    	register_setting('subway-settings-group', $field['id']);
84
+    	require_once trailingslashit(SUBWAY_DIR_PATH) . 'settings-fields/field-' . sanitize_title(str_replace('_', '-', $field['callback'])) . '.php';
85 85
     }
86 86
 
87
-	register_setting( 'subway-settings-group', 'subway_redirect_page_id' );
88
-	register_setting( 'subway-settings-group', 'subway_redirect_custom_url' );
87
+	register_setting('subway-settings-group', 'subway_redirect_page_id');
88
+	register_setting('subway-settings-group', 'subway_redirect_custom_url');
89 89
 
90 90
     return;
91 91
 }
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
         	<?php esc_html_e('Subway Settings', 'subway'); ?>
106 106
         </h2>
107 107
         <form id="subway-settings-form" action="options.php" method="POST">
108
-            <?php settings_fields( 'subway-settings-group' ); ?>
109
-            <?php do_settings_sections( 'subway-settings-section' ); ?>
108
+            <?php settings_fields('subway-settings-group'); ?>
109
+            <?php do_settings_sections('subway-settings-section'); ?>
110 110
             <?php submit_button(); ?>
111 111
         </form>
112 112
     </div>
Please login to merge, or discard this patch.