Passed
Push — master ( 018ce1...ad6937 )
by Joseph
04:29 queued 02:12
created
settings-fields/field-subway-login-page-form.php 1 patch
Spacing   +11 added lines, -11 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,24 +21,24 @@  discard block
 block discarded – undo
21 21
  */
22 22
 function subway_login_page_form() {
23 23
 
24
-	$subway_login_page_id = intval( get_option( 'subway_login_page' ) );
24
+	$subway_login_page_id = intval(get_option('subway_login_page'));
25 25
 
26
-	if ( ! empty( $subway_login_page_id ) ) {
26
+	if ( ! empty($subway_login_page_id)) {
27 27
 
28
-		$login_page_object = get_post( $subway_login_page_id );
28
+		$login_page_object = get_post($subway_login_page_id);
29 29
 
30
-		if ( ! empty( $login_page_object )  && isset( $login_page_object->post_content ) ) {
30
+		if ( ! empty($login_page_object) && isset($login_page_object->post_content)) {
31 31
 
32 32
 			// Automatically prepend the login shortcode if no
33 33
 			// Shortcode exists in the selected login page.
34
-			if ( ! has_shortcode( $login_page_object->post_content, 'subway_login' ) ) {
34
+			if ( ! has_shortcode($login_page_object->post_content, 'subway_login')) {
35 35
 
36 36
 				$new_post_object = array(
37 37
 				  'ID' => $login_page_object->ID,
38
-				  'post_content' => '[subway_login] ' . $login_page_object->post_content,// Prepend Only.
38
+				  'post_content' => '[subway_login] ' . $login_page_object->post_content, // Prepend Only.
39 39
 				 );
40 40
 
41
-				wp_update_post( $new_post_object );
41
+				wp_update_post($new_post_object);
42 42
 			}
43 43
 		}
44 44
 	}
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
 	wp_dropdown_pages(
47 47
 		array(
48 48
 		'name' => 'subway_login_page',
49
-		'selected' => intval( $subway_login_page_id ),
50
-		'show_option_none' => esc_html__( '---', 'subway' ),
49
+		'selected' => intval($subway_login_page_id),
50
+		'show_option_none' => esc_html__('---', 'subway'),
51 51
 		)
52 52
 	);
53 53
 
54
-	echo '<p class="description">' . sprintf( esc_html__( 'Select a login page and save the changes to make your site private. Leave blank to make your site public. %1$s.', 'subway' ), '<span style="font-weight: bold; color: #e53935;">' . esc_html__( 'You need to add "[subway_login]" shortcode in the selected page to show the login form (this will be done automatically after saving)', 'subway' ) ) . '</span></p>';
54
+	echo '<p class="description">' . sprintf(esc_html__('Select a login page and save the changes to make your site private. Leave blank to make your site public. %1$s.', 'subway'), '<span style="font-weight: bold; color: #e53935;">' . esc_html__('You need to add "[subway_login]" shortcode in the selected page to show the login form (this will be done automatically after saving)', 'subway')) . '</span></p>';
55 55
 
56 56
 	return;
57 57
 }
Please login to merge, or discard this patch.
settings-fields/field-subway-lock-wp-admin.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
 
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 
19 19
 	<p class="description">
20 20
 		<?php 
21
-			echo sprintf( __( "In case, you were locked out. Use the link below to bypass the log-in page and go directly 
22
-			to your website's wp-login URL (http://yoursiteurl.com/wp-login.php): <strong style='color: #e53935;'>%s</strong>", 'subway' ), site_url( 'wp-login.php?no_redirect=true' ) ); 
21
+			echo sprintf(__("In case, you were locked out. Use the link below to bypass the log-in page and go directly 
22
+			to your website's wp-login URL (http://yoursiteurl.com/wp-login.php): <strong style='color: #e53935;'>%s</strong>", 'subway'), site_url('wp-login.php?no_redirect=true')); 
23 23
 		?>
24 24
 	</p>
25 25
 <?php
Please login to merge, or discard this patch.
classes/subway-helpers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 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
 
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
@@ -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
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function __construct() {
30 30
 
31
-		add_action( 'plugins_loaded', array( $this, 'subway_localize_plugin' ) );
31
+		add_action('plugins_loaded', array($this, 'subway_localize_plugin'));
32 32
 
33 33
 		return;
34 34
 	}
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 		$rel_path = SUBWAY_DIR_PATH . 'languages';
44 44
 
45
-		load_plugin_textdomain( 'subway', false, $rel_path );
45
+		load_plugin_textdomain('subway', false, $rel_path);
46 46
 
47 47
 		return;
48 48
 	}
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, 'login-form.php', null );
59
+		echo $this->get_template_file($atts, 'login-form.php', 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,26 +85,26 @@  discard block
 block discarded – undo
85 85
 
86 86
     	} else {
87 87
 
88
-	    	echo sprintf( esc_html_e( 'Subway Error: Unable to find template file in: %1s', 'subway' ), $template );
88
+	    	echo sprintf(esc_html_e('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
 
97 97
 		ob_start();
98 98
 		
99
-		do_action( 'login_form' );
99
+		do_action('login_form');
100 100
 		
101 101
 		return $__content . ob_get_clean();
102 102
 
103 103
 	}
104 104
 
105
-	public function __action_lost_password_link( $__content ) {
105
+	public function __action_lost_password_link($__content) {
106 106
 		
107
-		return $__content . $this->get_template_file( array(), 'login-form-lost-password.php', null );
107
+		return $__content . $this->get_template_file(array(), 'login-form-lost-password.php', null);
108 108
 
109 109
 	}
110 110
 
Please login to merge, or discard this patch.
classes/subway-auth-redirect.php 1 patch
Spacing   +29 added lines, -29 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
 
@@ -31,17 +31,17 @@  discard block
 block discarded – undo
31 31
 	public static function handle_authentication() {
32 32
 
33 33
 		// Set the header type to json.
34
-		header( 'Content-Type: application/json' );
34
+		header('Content-Type: application/json');
35 35
 
36
-		$log = filter_input( INPUT_POST, 'log', FILTER_SANITIZE_STRING );
36
+		$log = filter_input(INPUT_POST, 'log', FILTER_SANITIZE_STRING);
37 37
 
38
-		$pwd = filter_input( INPUT_POST, 'pwd', FILTER_SANITIZE_STRING );
38
+		$pwd = filter_input(INPUT_POST, 'pwd', FILTER_SANITIZE_STRING);
39 39
 
40
-		if ( empty( $log ) && empty( $pwd ) ) {
40
+		if (empty($log) && empty($pwd)) {
41 41
 
42 42
 			$response['type'] = 'error';
43 43
 
44
-			$response['message'] = esc_html__( 'Username and Password cannot be empty.', 'subway' );
44
+			$response['message'] = esc_html__('Username and Password cannot be empty.', 'subway');
45 45
 
46 46
 		} else {
47 47
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 			$response = array();
51 51
 
52
-			if ( is_wp_error( $is_signin ) ) {
52
+			if (is_wp_error($is_signin)) {
53 53
 
54 54
 				$response['type'] = 'error';
55 55
 
@@ -59,16 +59,16 @@  discard block
 block discarded – undo
59 59
 
60 60
 				$response['type'] = 'success';
61 61
 
62
-				$response['message'] = esc_html__( 'You have successfully logged-in. Redirecting you in few seconds...' );
62
+				$response['message'] = esc_html__('You have successfully logged-in. Redirecting you in few seconds...');
63 63
 
64 64
 			}
65 65
 		}
66 66
 		
67
-		$subway_redirect_url = Auth_Redirect::get_login_redirect_url( '', '' );
67
+		$subway_redirect_url = Auth_Redirect::get_login_redirect_url('', '');
68 68
 
69
-		$response['redirect_url'] = apply_filters( 'subway_login_redirect', $subway_redirect_url );
69
+		$response['redirect_url'] = apply_filters('subway_login_redirect', $subway_redirect_url);
70 70
 
71
-		echo wp_json_encode( $response );
71
+		echo wp_json_encode($response);
72 72
 
73 73
 		wp_die();
74 74
 
@@ -82,42 +82,42 @@  discard block
 block discarded – undo
82 82
 	 * @param  integer $user        The current user logging in.
83 83
 	 * @return string               The final redirect url.
84 84
 	 */
85
-	public static function get_login_redirect_url( $redirect_to ) {
85
+	public static function get_login_redirect_url($redirect_to) {
86 86
 
87
-		$subway_redirect_type = get_option( 'subway_redirect_type' );
87
+		$subway_redirect_type = get_option('subway_redirect_type');
88 88
 
89 89
 		// Redirect the user to default behaviour if there are no redirect type option saved.
90
-		if ( empty( $subway_redirect_type ) ) {
90
+		if (empty($subway_redirect_type)) {
91 91
 
92 92
 			return $redirect_to;
93 93
 
94 94
 		}
95 95
 
96
-		if ( 'default' === $subway_redirect_type ) {
96
+		if ('default' === $subway_redirect_type) {
97 97
 			return $redirect_to;
98 98
 		}
99 99
 
100
-		if ( 'page' === $subway_redirect_type ) {
100
+		if ('page' === $subway_redirect_type) {
101 101
 
102 102
 			// Get the page url of the selected page if the admin selected 'Custom Page' in the redirect type settings.
103
-			$selected_redirect_page = intval( get_option( 'subway_redirect_page_id' ) );
103
+			$selected_redirect_page = intval(get_option('subway_redirect_page_id'));
104 104
 
105 105
 			// Redirect to default WordPress behaviour if the user did not select page.
106
-			if ( empty( $selected_redirect_page ) ) {
106
+			if (empty($selected_redirect_page)) {
107 107
 
108 108
 				return $redirect_to;
109 109
 			}
110 110
 
111 111
 			// Otherwise, get the permalink of the saved page and let the user go into that page.
112
-			return get_permalink( $selected_redirect_page );
112
+			return get_permalink($selected_redirect_page);
113 113
 
114
-		} elseif ( 'custom_url' === $subway_redirect_type ) {
114
+		} elseif ('custom_url' === $subway_redirect_type) {
115 115
 
116 116
 			// Get the custom url saved in the redirect type settings.
117
-			$entered_custom_url = get_option( 'subway_redirect_custom_url' );
117
+			$entered_custom_url = get_option('subway_redirect_custom_url');
118 118
 
119 119
 			// Redirect to default WordPress behaviour if the user did enter a custom url.
120
-			if ( empty( $entered_custom_url ) ) {
120
+			if (empty($entered_custom_url)) {
121 121
 
122 122
 				return $redirect_to;
123 123
 
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 			// Otherwise, get the custom url saved and let the user go into that page.
127 127
 			$current_user = wp_get_current_user();
128 128
 
129
-			if ( ! empty( $current_user->ID ) ) {
130
-				$entered_custom_url = str_replace( '%user_id%', $current_user->ID, $entered_custom_url );
129
+			if ( ! empty($current_user->ID)) {
130
+				$entered_custom_url = str_replace('%user_id%', $current_user->ID, $entered_custom_url);
131 131
 			}
132 132
 
133
-			if ( ! empty( $current_user->user_login ) ) {
134
-				$entered_custom_url = str_replace( '%user_name%', $current_user->user_login, $entered_custom_url );
133
+			if ( ! empty($current_user->user_login)) {
134
+				$entered_custom_url = str_replace('%user_name%', $current_user->user_login, $entered_custom_url);
135 135
 			}
136 136
 
137 137
 			return $entered_custom_url;
@@ -148,12 +148,12 @@  discard block
 block discarded – undo
148 148
 	 * @param  string $login_url    The login url.
149 149
 	 * @return string               The final login url.
150 150
 	 */
151
-	public static function login_url( $login_url  ) {
151
+	public static function login_url($login_url) {
152 152
 
153 153
 		$subway_login_page = Options::get_redirect_page_url();
154 154
 
155 155
 		// Return the default login url if there is no log-in page defined.
156
-		if ( empty( $subway_login_page ) ) {
156
+		if (empty($subway_login_page)) {
157 157
 			return $login_url;
158 158
 		}
159 159
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
 		$subway_login_page = Options::get_redirect_page_url();
173 173
 
174
-		wp_safe_redirect( esc_url( $subway_login_page . '?loggedout=true' ) );
174
+		wp_safe_redirect(esc_url($subway_login_page . '?loggedout=true'));
175 175
 
176 176
 		Helpers::close();
177 177
 
Please login to merge, or discard this patch.