@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | namespace Subway; |
| 21 | 21 | |
| 22 | 22 | if (! defined('ABSPATH') ) { |
| 23 | - return; |
|
| 23 | + return; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -36,183 +36,183 @@ discard block |
||
| 36 | 36 | final class AuthRedirect |
| 37 | 37 | { |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Handles our ajax authentication. |
|
| 41 | - * |
|
| 42 | - * @return void |
|
| 43 | - */ |
|
| 44 | - public static function handleAuthentication() |
|
| 45 | - { |
|
| 39 | + /** |
|
| 40 | + * Handles our ajax authentication. |
|
| 41 | + * |
|
| 42 | + * @return void |
|
| 43 | + */ |
|
| 44 | + public static function handleAuthentication() |
|
| 45 | + { |
|
| 46 | 46 | |
| 47 | - // Set the header type to json. |
|
| 48 | - header('Content-Type: application/json'); |
|
| 47 | + // Set the header type to json. |
|
| 48 | + header('Content-Type: application/json'); |
|
| 49 | 49 | |
| 50 | - $log = filter_input(INPUT_POST, 'log', FILTER_SANITIZE_STRING); |
|
| 50 | + $log = filter_input(INPUT_POST, 'log', FILTER_SANITIZE_STRING); |
|
| 51 | 51 | |
| 52 | - $pwd = filter_input(INPUT_POST, 'pwd', FILTER_SANITIZE_STRING); |
|
| 52 | + $pwd = filter_input(INPUT_POST, 'pwd', FILTER_SANITIZE_STRING); |
|
| 53 | 53 | |
| 54 | - if (empty($log) && empty($pwd) ) { |
|
| 54 | + if (empty($log) && empty($pwd) ) { |
|
| 55 | 55 | |
| 56 | - $response['type'] = 'error'; |
|
| 56 | + $response['type'] = 'error'; |
|
| 57 | 57 | |
| 58 | - $response['message'] = esc_html__( |
|
| 59 | - 'Username and Password cannot be empty.', |
|
| 60 | - 'subway' |
|
| 61 | - ); |
|
| 58 | + $response['message'] = esc_html__( |
|
| 59 | + 'Username and Password cannot be empty.', |
|
| 60 | + 'subway' |
|
| 61 | + ); |
|
| 62 | 62 | |
| 63 | - } else { |
|
| 63 | + } else { |
|
| 64 | 64 | |
| 65 | - $is_signin = wp_signon(); |
|
| 65 | + $is_signin = wp_signon(); |
|
| 66 | 66 | |
| 67 | - $response = array(); |
|
| 67 | + $response = array(); |
|
| 68 | 68 | |
| 69 | - if (is_wp_error($is_signin) ) { |
|
| 69 | + if (is_wp_error($is_signin) ) { |
|
| 70 | 70 | |
| 71 | - $response['type'] = 'error'; |
|
| 71 | + $response['type'] = 'error'; |
|
| 72 | 72 | |
| 73 | - $response['message'] = $is_signin->get_error_message(); |
|
| 73 | + $response['message'] = $is_signin->get_error_message(); |
|
| 74 | 74 | |
| 75 | - } else { |
|
| 75 | + } else { |
|
| 76 | 76 | |
| 77 | - $response['type'] = 'success'; |
|
| 77 | + $response['type'] = 'success'; |
|
| 78 | 78 | |
| 79 | - $response['message'] = esc_html__( |
|
| 80 | - 'You have successfully logged-in. |
|
| 79 | + $response['message'] = esc_html__( |
|
| 80 | + 'You have successfully logged-in. |
|
| 81 | 81 | Redirecting you in few seconds...' |
| 82 | - ); |
|
| 82 | + ); |
|
| 83 | 83 | |
| 84 | - } |
|
| 85 | - } |
|
| 84 | + } |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - $subway_redirect_url = AuthRedirect::getLoginRedirectUrl(''); |
|
| 87 | + $subway_redirect_url = AuthRedirect::getLoginRedirectUrl(''); |
|
| 88 | 88 | |
| 89 | - $response['redirect_url'] = apply_filters( |
|
| 90 | - 'subway_login_redirect', |
|
| 91 | - $subway_redirect_url |
|
| 92 | - ); |
|
| 89 | + $response['redirect_url'] = apply_filters( |
|
| 90 | + 'subway_login_redirect', |
|
| 91 | + $subway_redirect_url |
|
| 92 | + ); |
|
| 93 | 93 | |
| 94 | - echo wp_json_encode($response); |
|
| 94 | + echo wp_json_encode($response); |
|
| 95 | 95 | |
| 96 | - wp_die(); |
|
| 96 | + wp_die(); |
|
| 97 | 97 | |
| 98 | - } |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - /** |
|
| 101 | - * Returns the filtered redirect url for the current user. |
|
| 102 | - * |
|
| 103 | - * @param string $redirect_to The default redirect callback argument. |
|
| 104 | - * |
|
| 105 | - * @return string The final redirect url. |
|
| 106 | - */ |
|
| 107 | - public static function getLoginRedirectUrl( $redirect_to ) |
|
| 108 | - { |
|
| 100 | + /** |
|
| 101 | + * Returns the filtered redirect url for the current user. |
|
| 102 | + * |
|
| 103 | + * @param string $redirect_to The default redirect callback argument. |
|
| 104 | + * |
|
| 105 | + * @return string The final redirect url. |
|
| 106 | + */ |
|
| 107 | + public static function getLoginRedirectUrl( $redirect_to ) |
|
| 108 | + { |
|
| 109 | 109 | |
| 110 | - $subway_redirect_type = get_option('subway_redirect_type'); |
|
| 110 | + $subway_redirect_type = get_option('subway_redirect_type'); |
|
| 111 | 111 | |
| 112 | - // Redirect the user to default behaviour. |
|
| 113 | - // If there are no redirect type option saved. |
|
| 114 | - if (empty($subway_redirect_type) ) { |
|
| 112 | + // Redirect the user to default behaviour. |
|
| 113 | + // If there are no redirect type option saved. |
|
| 114 | + if (empty($subway_redirect_type) ) { |
|
| 115 | 115 | |
| 116 | - return $redirect_to; |
|
| 116 | + return $redirect_to; |
|
| 117 | 117 | |
| 118 | - } |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - if ('default' === $subway_redirect_type ) { |
|
| 121 | - return $redirect_to; |
|
| 122 | - } |
|
| 120 | + if ('default' === $subway_redirect_type ) { |
|
| 121 | + return $redirect_to; |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - if ('page' === $subway_redirect_type ) { |
|
| 124 | + if ('page' === $subway_redirect_type ) { |
|
| 125 | 125 | |
| 126 | - // Get the page url of the selected page. |
|
| 127 | - // If the admin selected 'Custom Page' in the redirect type settings. |
|
| 128 | - $selected_redirect_page = intval(get_option('subway_redirect_page_id')); |
|
| 126 | + // Get the page url of the selected page. |
|
| 127 | + // If the admin selected 'Custom Page' in the redirect type settings. |
|
| 128 | + $selected_redirect_page = intval(get_option('subway_redirect_page_id')); |
|
| 129 | 129 | |
| 130 | - // Redirect to default WordPress behaviour. |
|
| 131 | - // If the user did not select page. |
|
| 132 | - if (empty($selected_redirect_page) ) { |
|
| 130 | + // Redirect to default WordPress behaviour. |
|
| 131 | + // If the user did not select page. |
|
| 132 | + if (empty($selected_redirect_page) ) { |
|
| 133 | 133 | |
| 134 | - return $redirect_to; |
|
| 135 | - } |
|
| 134 | + return $redirect_to; |
|
| 135 | + } |
|
| 136 | 136 | |
| 137 | - // Otherwise, get the permalink of the saved page |
|
| 138 | - // and let the user go into that page. |
|
| 139 | - return get_permalink($selected_redirect_page); |
|
| 137 | + // Otherwise, get the permalink of the saved page |
|
| 138 | + // and let the user go into that page. |
|
| 139 | + return get_permalink($selected_redirect_page); |
|
| 140 | 140 | |
| 141 | - } elseif ('custom_url' === $subway_redirect_type ) { |
|
| 141 | + } elseif ('custom_url' === $subway_redirect_type ) { |
|
| 142 | 142 | |
| 143 | - // Get the custom url saved in the redirect type settings. |
|
| 144 | - $entered_custom_url = get_option('subway_redirect_custom_url'); |
|
| 143 | + // Get the custom url saved in the redirect type settings. |
|
| 144 | + $entered_custom_url = get_option('subway_redirect_custom_url'); |
|
| 145 | 145 | |
| 146 | - // Redirect to default WordPress behaviour |
|
| 147 | - // if the user did enter a custom url. |
|
| 148 | - if (empty($entered_custom_url) ) { |
|
| 146 | + // Redirect to default WordPress behaviour |
|
| 147 | + // if the user did enter a custom url. |
|
| 148 | + if (empty($entered_custom_url) ) { |
|
| 149 | 149 | |
| 150 | - return $redirect_to; |
|
| 150 | + return $redirect_to; |
|
| 151 | 151 | |
| 152 | - } |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | - // Otherwise, get the custom url saved |
|
| 155 | - // and let the user go into that page. |
|
| 156 | - $current_user = wp_get_current_user(); |
|
| 154 | + // Otherwise, get the custom url saved |
|
| 155 | + // and let the user go into that page. |
|
| 156 | + $current_user = wp_get_current_user(); |
|
| 157 | 157 | |
| 158 | - if (! empty($current_user->ID) ) { |
|
| 159 | - $entered_custom_url = str_replace( |
|
| 160 | - '%user_id%', $current_user->ID, |
|
| 161 | - $entered_custom_url |
|
| 162 | - ); |
|
| 163 | - } |
|
| 158 | + if (! empty($current_user->ID) ) { |
|
| 159 | + $entered_custom_url = str_replace( |
|
| 160 | + '%user_id%', $current_user->ID, |
|
| 161 | + $entered_custom_url |
|
| 162 | + ); |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | - if (! empty($current_user->user_login) ) { |
|
| 166 | - $entered_custom_url = str_replace( |
|
| 167 | - '%user_name%', $current_user->user_login, |
|
| 168 | - $entered_custom_url |
|
| 169 | - ); |
|
| 170 | - } |
|
| 165 | + if (! empty($current_user->user_login) ) { |
|
| 166 | + $entered_custom_url = str_replace( |
|
| 167 | + '%user_name%', $current_user->user_login, |
|
| 168 | + $entered_custom_url |
|
| 169 | + ); |
|
| 170 | + } |
|
| 171 | 171 | |
| 172 | - return $entered_custom_url; |
|
| 172 | + return $entered_custom_url; |
|
| 173 | 173 | |
| 174 | - } |
|
| 174 | + } |
|
| 175 | 175 | |
| 176 | - // Otherwise, quit and redirect the user back to default WordPress behaviour. |
|
| 177 | - return $redirect_to; |
|
| 178 | - } |
|
| 176 | + // Otherwise, quit and redirect the user back to default WordPress behaviour. |
|
| 177 | + return $redirect_to; |
|
| 178 | + } |
|
| 179 | 179 | |
| 180 | - /** |
|
| 181 | - * Callback function for the 'login_url' filter defined in Subway.php |
|
| 182 | - * |
|
| 183 | - * @param string $login_url The login url. |
|
| 184 | - * |
|
| 185 | - * @return string The final login url. |
|
| 186 | - */ |
|
| 187 | - public static function loginUrl( $login_url ) |
|
| 188 | - { |
|
| 180 | + /** |
|
| 181 | + * Callback function for the 'login_url' filter defined in Subway.php |
|
| 182 | + * |
|
| 183 | + * @param string $login_url The login url. |
|
| 184 | + * |
|
| 185 | + * @return string The final login url. |
|
| 186 | + */ |
|
| 187 | + public static function loginUrl( $login_url ) |
|
| 188 | + { |
|
| 189 | 189 | |
| 190 | - $subway_login_page = Options::getRedirectPageUrl(); |
|
| 190 | + $subway_login_page = Options::getRedirectPageUrl(); |
|
| 191 | 191 | |
| 192 | - // Return the default login url if there is no log-in page defined. |
|
| 193 | - if (empty($subway_login_page) ) { |
|
| 194 | - return $login_url; |
|
| 195 | - } |
|
| 192 | + // Return the default login url if there is no log-in page defined. |
|
| 193 | + if (empty($subway_login_page) ) { |
|
| 194 | + return $login_url; |
|
| 195 | + } |
|
| 196 | 196 | |
| 197 | - // Otherwise, return the Subway login page. |
|
| 198 | - return $subway_login_page; |
|
| 197 | + // Otherwise, return the Subway login page. |
|
| 198 | + return $subway_login_page; |
|
| 199 | 199 | |
| 200 | - } |
|
| 200 | + } |
|
| 201 | 201 | |
| 202 | - /** |
|
| 203 | - * The callback function for our logout filter. |
|
| 204 | - * |
|
| 205 | - * @return void |
|
| 206 | - */ |
|
| 207 | - public static function logoutUrl() |
|
| 208 | - { |
|
| 202 | + /** |
|
| 203 | + * The callback function for our logout filter. |
|
| 204 | + * |
|
| 205 | + * @return void |
|
| 206 | + */ |
|
| 207 | + public static function logoutUrl() |
|
| 208 | + { |
|
| 209 | 209 | |
| 210 | - $subway_login_page = Options::getRedirectPageUrl(); |
|
| 210 | + $subway_login_page = Options::getRedirectPageUrl(); |
|
| 211 | 211 | |
| 212 | - wp_safe_redirect(esc_url($subway_login_page . '?loggedout=true')); |
|
| 212 | + wp_safe_redirect(esc_url($subway_login_page . '?loggedout=true')); |
|
| 213 | 213 | |
| 214 | - Helpers::close(); |
|
| 214 | + Helpers::close(); |
|
| 215 | 215 | |
| 216 | - } |
|
| 216 | + } |
|
| 217 | 217 | |
| 218 | 218 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | namespace Subway; |
| 21 | 21 | |
| 22 | -if (! defined('ABSPATH') ) { |
|
| 22 | +if ( ! defined('ABSPATH')) { |
|
| 23 | 23 | return; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | $pwd = filter_input(INPUT_POST, 'pwd', FILTER_SANITIZE_STRING); |
| 53 | 53 | |
| 54 | - if (empty($log) && empty($pwd) ) { |
|
| 54 | + if (empty($log) && empty($pwd)) { |
|
| 55 | 55 | |
| 56 | 56 | $response['type'] = 'error'; |
| 57 | 57 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | $response = array(); |
| 68 | 68 | |
| 69 | - if (is_wp_error($is_signin) ) { |
|
| 69 | + if (is_wp_error($is_signin)) { |
|
| 70 | 70 | |
| 71 | 71 | $response['type'] = 'error'; |
| 72 | 72 | |
@@ -104,24 +104,24 @@ discard block |
||
| 104 | 104 | * |
| 105 | 105 | * @return string The final redirect url. |
| 106 | 106 | */ |
| 107 | - public static function getLoginRedirectUrl( $redirect_to ) |
|
| 107 | + public static function getLoginRedirectUrl($redirect_to) |
|
| 108 | 108 | { |
| 109 | 109 | |
| 110 | 110 | $subway_redirect_type = get_option('subway_redirect_type'); |
| 111 | 111 | |
| 112 | 112 | // Redirect the user to default behaviour. |
| 113 | 113 | // If there are no redirect type option saved. |
| 114 | - if (empty($subway_redirect_type) ) { |
|
| 114 | + if (empty($subway_redirect_type)) { |
|
| 115 | 115 | |
| 116 | 116 | return $redirect_to; |
| 117 | 117 | |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if ('default' === $subway_redirect_type ) { |
|
| 120 | + if ('default' === $subway_redirect_type) { |
|
| 121 | 121 | return $redirect_to; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - if ('page' === $subway_redirect_type ) { |
|
| 124 | + if ('page' === $subway_redirect_type) { |
|
| 125 | 125 | |
| 126 | 126 | // Get the page url of the selected page. |
| 127 | 127 | // If the admin selected 'Custom Page' in the redirect type settings. |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | // Redirect to default WordPress behaviour. |
| 131 | 131 | // If the user did not select page. |
| 132 | - if (empty($selected_redirect_page) ) { |
|
| 132 | + if (empty($selected_redirect_page)) { |
|
| 133 | 133 | |
| 134 | 134 | return $redirect_to; |
| 135 | 135 | } |
@@ -138,14 +138,14 @@ discard block |
||
| 138 | 138 | // and let the user go into that page. |
| 139 | 139 | return get_permalink($selected_redirect_page); |
| 140 | 140 | |
| 141 | - } elseif ('custom_url' === $subway_redirect_type ) { |
|
| 141 | + } elseif ('custom_url' === $subway_redirect_type) { |
|
| 142 | 142 | |
| 143 | 143 | // Get the custom url saved in the redirect type settings. |
| 144 | 144 | $entered_custom_url = get_option('subway_redirect_custom_url'); |
| 145 | 145 | |
| 146 | 146 | // Redirect to default WordPress behaviour |
| 147 | 147 | // if the user did enter a custom url. |
| 148 | - if (empty($entered_custom_url) ) { |
|
| 148 | + if (empty($entered_custom_url)) { |
|
| 149 | 149 | |
| 150 | 150 | return $redirect_to; |
| 151 | 151 | |
@@ -155,14 +155,14 @@ discard block |
||
| 155 | 155 | // and let the user go into that page. |
| 156 | 156 | $current_user = wp_get_current_user(); |
| 157 | 157 | |
| 158 | - if (! empty($current_user->ID) ) { |
|
| 158 | + if ( ! empty($current_user->ID)) { |
|
| 159 | 159 | $entered_custom_url = str_replace( |
| 160 | 160 | '%user_id%', $current_user->ID, |
| 161 | 161 | $entered_custom_url |
| 162 | 162 | ); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - if (! empty($current_user->user_login) ) { |
|
| 165 | + if ( ! empty($current_user->user_login)) { |
|
| 166 | 166 | $entered_custom_url = str_replace( |
| 167 | 167 | '%user_name%', $current_user->user_login, |
| 168 | 168 | $entered_custom_url |
@@ -184,13 +184,13 @@ discard block |
||
| 184 | 184 | * |
| 185 | 185 | * @return string The final login url. |
| 186 | 186 | */ |
| 187 | - public static function loginUrl( $login_url ) |
|
| 187 | + public static function loginUrl($login_url) |
|
| 188 | 188 | { |
| 189 | 189 | |
| 190 | 190 | $subway_login_page = Options::getRedirectPageUrl(); |
| 191 | 191 | |
| 192 | 192 | // Return the default login url if there is no log-in page defined. |
| 193 | - if (empty($subway_login_page) ) { |
|
| 193 | + if (empty($subway_login_page)) { |
|
| 194 | 194 | return $login_url; |
| 195 | 195 | } |
| 196 | 196 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | namespace Subway; |
| 21 | 21 | |
| 22 | 22 | if (! defined('ABSPATH') ) { |
| 23 | - return; |
|
| 23 | + return; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -36,50 +36,50 @@ discard block |
||
| 36 | 36 | final class Enqueue |
| 37 | 37 | { |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Registers our CSS and Javascript to WordPress Enqueue Handler. |
|
| 41 | - * |
|
| 42 | - * @return void |
|
| 43 | - */ |
|
| 44 | - public static function registerJs() |
|
| 45 | - { |
|
| 39 | + /** |
|
| 40 | + * Registers our CSS and Javascript to WordPress Enqueue Handler. |
|
| 41 | + * |
|
| 42 | + * @return void |
|
| 43 | + */ |
|
| 44 | + public static function registerJs() |
|
| 45 | + { |
|
| 46 | 46 | |
| 47 | - $post_id = absint(get_queried_object_id()); |
|
| 47 | + $post_id = absint(get_queried_object_id()); |
|
| 48 | 48 | |
| 49 | - $signin_page = absint(get_option('subway_login_page')); |
|
| 49 | + $signin_page = absint(get_option('subway_login_page')); |
|
| 50 | 50 | |
| 51 | - // Only load the stylesheet and javascript documents inside our sign-in page. |
|
| 52 | - if ($post_id === $signin_page ) { |
|
| 51 | + // Only load the stylesheet and javascript documents inside our sign-in page. |
|
| 52 | + if ($post_id === $signin_page ) { |
|
| 53 | 53 | |
| 54 | - wp_enqueue_style( |
|
| 55 | - 'subway-style', |
|
| 56 | - SUBWAY_DIR_URL . 'assets/css/subway.css' |
|
| 57 | - ); |
|
| 54 | + wp_enqueue_style( |
|
| 55 | + 'subway-style', |
|
| 56 | + SUBWAY_DIR_URL . 'assets/css/subway.css' |
|
| 57 | + ); |
|
| 58 | 58 | |
| 59 | - if (! is_user_logged_in() ) { |
|
| 59 | + if (! is_user_logged_in() ) { |
|
| 60 | 60 | |
| 61 | - wp_enqueue_script( |
|
| 62 | - 'subway-script', |
|
| 63 | - SUBWAY_DIR_URL . 'assets/js/subway.js', |
|
| 64 | - array( 'jquery' ) |
|
| 65 | - ); |
|
| 61 | + wp_enqueue_script( |
|
| 62 | + 'subway-script', |
|
| 63 | + SUBWAY_DIR_URL . 'assets/js/subway.js', |
|
| 64 | + array( 'jquery' ) |
|
| 65 | + ); |
|
| 66 | 66 | |
| 67 | - wp_localize_script( |
|
| 68 | - 'subway-script', 'subway_config', array( |
|
| 69 | - 'ajax_url' => admin_url('admin-ajax.php'), |
|
| 70 | - 'login_http_error' => esc_html__( |
|
| 71 | - 'An error occured while |
|
| 67 | + wp_localize_script( |
|
| 68 | + 'subway-script', 'subway_config', array( |
|
| 69 | + 'ajax_url' => admin_url('admin-ajax.php'), |
|
| 70 | + 'login_http_error' => esc_html__( |
|
| 71 | + 'An error occured while |
|
| 72 | 72 | transmitting the data. Refresh the page and try again', |
| 73 | - 'subway' |
|
| 74 | - ), |
|
| 75 | - ) |
|
| 76 | - ); |
|
| 73 | + 'subway' |
|
| 74 | + ), |
|
| 75 | + ) |
|
| 76 | + ); |
|
| 77 | 77 | |
| 78 | - } |
|
| 79 | - } |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - return; |
|
| 81 | + return; |
|
| 82 | 82 | |
| 83 | - } |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | 85 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | namespace Subway; |
| 21 | 21 | |
| 22 | -if (! defined('ABSPATH') ) { |
|
| 22 | +if ( ! defined('ABSPATH')) { |
|
| 23 | 23 | return; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -49,19 +49,19 @@ discard block |
||
| 49 | 49 | $signin_page = absint(get_option('subway_login_page')); |
| 50 | 50 | |
| 51 | 51 | // Only load the stylesheet and javascript documents inside our sign-in page. |
| 52 | - if ($post_id === $signin_page ) { |
|
| 52 | + if ($post_id === $signin_page) { |
|
| 53 | 53 | |
| 54 | 54 | wp_enqueue_style( |
| 55 | 55 | 'subway-style', |
| 56 | 56 | SUBWAY_DIR_URL . 'assets/css/subway.css' |
| 57 | 57 | ); |
| 58 | 58 | |
| 59 | - if (! is_user_logged_in() ) { |
|
| 59 | + if ( ! is_user_logged_in()) { |
|
| 60 | 60 | |
| 61 | 61 | wp_enqueue_script( |
| 62 | 62 | 'subway-script', |
| 63 | 63 | SUBWAY_DIR_URL . 'assets/js/subway.js', |
| 64 | - array( 'jquery' ) |
|
| 64 | + array('jquery') |
|
| 65 | 65 | ); |
| 66 | 66 | |
| 67 | 67 | wp_localize_script( |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | namespace Subway; |
| 21 | 21 | |
| 22 | 22 | if (! defined('ABSPATH') ) { |
| 23 | - return; |
|
| 23 | + return; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -36,93 +36,93 @@ discard block |
||
| 36 | 36 | final class PageRedirect |
| 37 | 37 | { |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Redirects pages into our login page. |
|
| 41 | - * |
|
| 42 | - * @return void. |
|
| 43 | - */ |
|
| 44 | - public static function index() |
|
| 45 | - { |
|
| 46 | - |
|
| 47 | - // Only execute for non logged in users. |
|
| 48 | - if (is_user_logged_in() ) { |
|
| 49 | - return; |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - $queried_id = get_queried_object_id(); |
|
| 53 | - |
|
| 54 | - $current_post = get_post(absint($queried_id)); |
|
| 55 | - |
|
| 56 | - $login_page_id = absint(get_option('subway_login_page')); |
|
| 57 | - |
|
| 58 | - $excluded_page = Options::getPublicPostsIdentifiers(); |
|
| 59 | - |
|
| 60 | - // Already escaped inside 'subway_get_redirect_page_url'. |
|
| 61 | - $redirect_page = Options::getRedirectPageUrl(); // WPCS XSS OK. |
|
| 62 | - |
|
| 63 | - // Exit if site is public. |
|
| 64 | - if (Options::isPublicSite() ) { |
|
| 65 | - return; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - // Check if redirect page is empty or not. |
|
| 69 | - if (empty($redirect_page) ) { |
|
| 70 | - return; |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - // Check if buddypress activate page. |
|
| 74 | - if (function_exists('bp_is_activation_page') ) { |
|
| 75 | - if (bp_is_activation_page() ) { |
|
| 76 | - return; |
|
| 77 | - } |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - // Check if buddypress registration page. |
|
| 81 | - if (function_exists('bp_is_register_page') ) { |
|
| 82 | - if (bp_is_register_page() ) { |
|
| 83 | - return; |
|
| 84 | - } |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - // Assign 0 value to empty $post->ID to prevent exception. |
|
| 88 | - // This applies to custom WordPress pages such as BP Members Page and Groups. |
|
| 89 | - if (empty($current_post) ) { |
|
| 90 | - $current_post = new \stdclass; |
|
| 91 | - $current_post->ID = 0; |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - $current_page_id = absint($current_post->ID); |
|
| 95 | - |
|
| 96 | - // Check if $current_page_id && $selected_blog_id is equal to each other. |
|
| 97 | - // Get the page ID instead of global $post->ID that the query returns. |
|
| 98 | - // The ID of the first post object inside the loop is not correct. |
|
| 99 | - $blog_id = absint(get_option('page_for_posts')); |
|
| 100 | - |
|
| 101 | - if (is_home() ) { |
|
| 102 | - if ($blog_id === $login_page_id ) { |
|
| 103 | - $current_page_id = $blog_id; |
|
| 104 | - } |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - // Only execute the script for non-loggedin visitors. |
|
| 108 | - if (! is_user_logged_in() ) { |
|
| 109 | - |
|
| 110 | - if ($current_page_id !== $login_page_id ) { |
|
| 111 | - |
|
| 112 | - if (! in_array($current_page_id, $excluded_page, true) ) { |
|
| 113 | - |
|
| 114 | - wp_safe_redirect( |
|
| 115 | - add_query_arg( |
|
| 116 | - array( '_redirected' => 'yes' ), |
|
| 117 | - $redirect_page |
|
| 118 | - ) |
|
| 119 | - ); |
|
| 120 | - |
|
| 121 | - Helpers::close(); |
|
| 122 | - } |
|
| 123 | - } |
|
| 124 | - } |
|
| 125 | - } |
|
| 39 | + /** |
|
| 40 | + * Redirects pages into our login page. |
|
| 41 | + * |
|
| 42 | + * @return void. |
|
| 43 | + */ |
|
| 44 | + public static function index() |
|
| 45 | + { |
|
| 46 | + |
|
| 47 | + // Only execute for non logged in users. |
|
| 48 | + if (is_user_logged_in() ) { |
|
| 49 | + return; |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + $queried_id = get_queried_object_id(); |
|
| 53 | + |
|
| 54 | + $current_post = get_post(absint($queried_id)); |
|
| 55 | + |
|
| 56 | + $login_page_id = absint(get_option('subway_login_page')); |
|
| 57 | + |
|
| 58 | + $excluded_page = Options::getPublicPostsIdentifiers(); |
|
| 59 | + |
|
| 60 | + // Already escaped inside 'subway_get_redirect_page_url'. |
|
| 61 | + $redirect_page = Options::getRedirectPageUrl(); // WPCS XSS OK. |
|
| 62 | + |
|
| 63 | + // Exit if site is public. |
|
| 64 | + if (Options::isPublicSite() ) { |
|
| 65 | + return; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + // Check if redirect page is empty or not. |
|
| 69 | + if (empty($redirect_page) ) { |
|
| 70 | + return; |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + // Check if buddypress activate page. |
|
| 74 | + if (function_exists('bp_is_activation_page') ) { |
|
| 75 | + if (bp_is_activation_page() ) { |
|
| 76 | + return; |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + // Check if buddypress registration page. |
|
| 81 | + if (function_exists('bp_is_register_page') ) { |
|
| 82 | + if (bp_is_register_page() ) { |
|
| 83 | + return; |
|
| 84 | + } |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + // Assign 0 value to empty $post->ID to prevent exception. |
|
| 88 | + // This applies to custom WordPress pages such as BP Members Page and Groups. |
|
| 89 | + if (empty($current_post) ) { |
|
| 90 | + $current_post = new \stdclass; |
|
| 91 | + $current_post->ID = 0; |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + $current_page_id = absint($current_post->ID); |
|
| 95 | + |
|
| 96 | + // Check if $current_page_id && $selected_blog_id is equal to each other. |
|
| 97 | + // Get the page ID instead of global $post->ID that the query returns. |
|
| 98 | + // The ID of the first post object inside the loop is not correct. |
|
| 99 | + $blog_id = absint(get_option('page_for_posts')); |
|
| 100 | + |
|
| 101 | + if (is_home() ) { |
|
| 102 | + if ($blog_id === $login_page_id ) { |
|
| 103 | + $current_page_id = $blog_id; |
|
| 104 | + } |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + // Only execute the script for non-loggedin visitors. |
|
| 108 | + if (! is_user_logged_in() ) { |
|
| 109 | + |
|
| 110 | + if ($current_page_id !== $login_page_id ) { |
|
| 111 | + |
|
| 112 | + if (! in_array($current_page_id, $excluded_page, true) ) { |
|
| 113 | + |
|
| 114 | + wp_safe_redirect( |
|
| 115 | + add_query_arg( |
|
| 116 | + array( '_redirected' => 'yes' ), |
|
| 117 | + $redirect_page |
|
| 118 | + ) |
|
| 119 | + ); |
|
| 120 | + |
|
| 121 | + Helpers::close(); |
|
| 122 | + } |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | + } |
|
| 126 | 126 | |
| 127 | 127 | } |
| 128 | 128 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | namespace Subway; |
| 21 | 21 | |
| 22 | -if (! defined('ABSPATH') ) { |
|
| 22 | +if ( ! defined('ABSPATH')) { |
|
| 23 | 23 | return; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | |
| 47 | 47 | // Only execute for non logged in users. |
| 48 | - if (is_user_logged_in() ) { |
|
| 48 | + if (is_user_logged_in()) { |
|
| 49 | 49 | return; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -61,32 +61,32 @@ discard block |
||
| 61 | 61 | $redirect_page = Options::getRedirectPageUrl(); // WPCS XSS OK. |
| 62 | 62 | |
| 63 | 63 | // Exit if site is public. |
| 64 | - if (Options::isPublicSite() ) { |
|
| 64 | + if (Options::isPublicSite()) { |
|
| 65 | 65 | return; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // Check if redirect page is empty or not. |
| 69 | - if (empty($redirect_page) ) { |
|
| 69 | + if (empty($redirect_page)) { |
|
| 70 | 70 | return; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // Check if buddypress activate page. |
| 74 | - if (function_exists('bp_is_activation_page') ) { |
|
| 75 | - if (bp_is_activation_page() ) { |
|
| 74 | + if (function_exists('bp_is_activation_page')) { |
|
| 75 | + if (bp_is_activation_page()) { |
|
| 76 | 76 | return; |
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | // Check if buddypress registration page. |
| 81 | - if (function_exists('bp_is_register_page') ) { |
|
| 82 | - if (bp_is_register_page() ) { |
|
| 81 | + if (function_exists('bp_is_register_page')) { |
|
| 82 | + if (bp_is_register_page()) { |
|
| 83 | 83 | return; |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // Assign 0 value to empty $post->ID to prevent exception. |
| 88 | 88 | // This applies to custom WordPress pages such as BP Members Page and Groups. |
| 89 | - if (empty($current_post) ) { |
|
| 89 | + if (empty($current_post)) { |
|
| 90 | 90 | $current_post = new \stdclass; |
| 91 | 91 | $current_post->ID = 0; |
| 92 | 92 | } |
@@ -98,22 +98,22 @@ discard block |
||
| 98 | 98 | // The ID of the first post object inside the loop is not correct. |
| 99 | 99 | $blog_id = absint(get_option('page_for_posts')); |
| 100 | 100 | |
| 101 | - if (is_home() ) { |
|
| 102 | - if ($blog_id === $login_page_id ) { |
|
| 101 | + if (is_home()) { |
|
| 102 | + if ($blog_id === $login_page_id) { |
|
| 103 | 103 | $current_page_id = $blog_id; |
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | // Only execute the script for non-loggedin visitors. |
| 108 | - if (! is_user_logged_in() ) { |
|
| 108 | + if ( ! is_user_logged_in()) { |
|
| 109 | 109 | |
| 110 | - if ($current_page_id !== $login_page_id ) { |
|
| 110 | + if ($current_page_id !== $login_page_id) { |
|
| 111 | 111 | |
| 112 | - if (! in_array($current_page_id, $excluded_page, true) ) { |
|
| 112 | + if ( ! in_array($current_page_id, $excluded_page, true)) { |
|
| 113 | 113 | |
| 114 | 114 | wp_safe_redirect( |
| 115 | 115 | add_query_arg( |
| 116 | - array( '_redirected' => 'yes' ), |
|
| 116 | + array('_redirected' => 'yes'), |
|
| 117 | 117 | $redirect_page |
| 118 | 118 | ) |
| 119 | 119 | ); |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | namespace Subway; |
| 21 | 21 | |
| 22 | 22 | if (! defined('ABSPATH') ) { |
| 23 | - return; |
|
| 23 | + return; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -36,13 +36,13 @@ discard block |
||
| 36 | 36 | final class Helpers |
| 37 | 37 | { |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Exit wrapper. |
|
| 41 | - * |
|
| 42 | - * @return void |
|
| 43 | - */ |
|
| 44 | - public static function close() |
|
| 45 | - { |
|
| 46 | - exit; |
|
| 47 | - } |
|
| 39 | + /** |
|
| 40 | + * Exit wrapper. |
|
| 41 | + * |
|
| 42 | + * @return void |
|
| 43 | + */ |
|
| 44 | + public static function close() |
|
| 45 | + { |
|
| 46 | + exit; |
|
| 47 | + } |
|
| 48 | 48 | } |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | |
| 20 | 20 | namespace Subway; |
| 21 | 21 | |
| 22 | -if (! defined('ABSPATH') ) { |
|
| 22 | +if ( ! defined('ABSPATH')) { |
|
| 23 | 23 | return; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | namespace Subway; |
| 21 | 21 | |
| 22 | 22 | if (! defined('ABSPATH') ) { |
| 23 | - return; |
|
| 23 | + return; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -36,73 +36,73 @@ discard block |
||
| 36 | 36 | final class Options |
| 37 | 37 | { |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Get the redirect page url. |
|
| 41 | - * |
|
| 42 | - * @return mixed The redirect url of our settings. Otherwise, false. |
|
| 43 | - */ |
|
| 44 | - public static function getRedirectPageUrl() |
|
| 45 | - { |
|
| 39 | + /** |
|
| 40 | + * Get the redirect page url. |
|
| 41 | + * |
|
| 42 | + * @return mixed The redirect url of our settings. Otherwise, false. |
|
| 43 | + */ |
|
| 44 | + public static function getRedirectPageUrl() |
|
| 45 | + { |
|
| 46 | 46 | |
| 47 | - $selected_login_post_id = intval(get_option('subway_login_page')); |
|
| 47 | + $selected_login_post_id = intval(get_option('subway_login_page')); |
|
| 48 | 48 | |
| 49 | - if (0 === $selected_login_post_id ) { |
|
| 49 | + if (0 === $selected_login_post_id ) { |
|
| 50 | 50 | |
| 51 | - return; |
|
| 51 | + return; |
|
| 52 | 52 | |
| 53 | - } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - $login_post = get_post($selected_login_post_id); |
|
| 55 | + $login_post = get_post($selected_login_post_id); |
|
| 56 | 56 | |
| 57 | - if (! empty($login_post) ) { |
|
| 57 | + if (! empty($login_post) ) { |
|
| 58 | 58 | |
| 59 | - return trailingslashit(get_permalink($login_post->ID)); |
|
| 59 | + return trailingslashit(get_permalink($login_post->ID)); |
|
| 60 | 60 | |
| 61 | - } |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - return false; |
|
| 63 | + return false; |
|
| 64 | 64 | |
| 65 | - } |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * Fetches the public post ids. |
|
| 69 | - * |
|
| 70 | - * @return array The collection of public 'post' IDs. |
|
| 71 | - */ |
|
| 72 | - public static function getPublicPostsIdentifiers() |
|
| 73 | - { |
|
| 67 | + /** |
|
| 68 | + * Fetches the public post ids. |
|
| 69 | + * |
|
| 70 | + * @return array The collection of public 'post' IDs. |
|
| 71 | + */ |
|
| 72 | + public static function getPublicPostsIdentifiers() |
|
| 73 | + { |
|
| 74 | 74 | |
| 75 | - $subway_public_post = get_option('subway_public_post'); |
|
| 75 | + $subway_public_post = get_option('subway_public_post'); |
|
| 76 | 76 | |
| 77 | - $excluded_pages_collection = array(); |
|
| 77 | + $excluded_pages_collection = array(); |
|
| 78 | 78 | |
| 79 | - if (! empty($subway_public_post) ) { |
|
| 79 | + if (! empty($subway_public_post) ) { |
|
| 80 | 80 | |
| 81 | - $excluded_pages_collection = explode(',', $subway_public_post); |
|
| 81 | + $excluded_pages_collection = explode(',', $subway_public_post); |
|
| 82 | 82 | |
| 83 | - } |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - // Should filter it by integer, spaces will be ignored, other strings. |
|
| 86 | - // Will be converted to zero '0'. |
|
| 87 | - return array_filter(array_map('intval', $excluded_pages_collection)); |
|
| 85 | + // Should filter it by integer, spaces will be ignored, other strings. |
|
| 86 | + // Will be converted to zero '0'. |
|
| 87 | + return array_filter(array_map('intval', $excluded_pages_collection)); |
|
| 88 | 88 | |
| 89 | - } |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * Check if site is public or not. |
|
| 93 | - * |
|
| 94 | - * @return boolean True on success. Otherwise, false. |
|
| 95 | - */ |
|
| 96 | - public static function isPublicSite() |
|
| 97 | - { |
|
| 91 | + /** |
|
| 92 | + * Check if site is public or not. |
|
| 93 | + * |
|
| 94 | + * @return boolean True on success. Otherwise, false. |
|
| 95 | + */ |
|
| 96 | + public static function isPublicSite() |
|
| 97 | + { |
|
| 98 | 98 | |
| 99 | - $subway_public_post = get_option('subway_is_public'); |
|
| 99 | + $subway_public_post = get_option('subway_is_public'); |
|
| 100 | 100 | |
| 101 | - if (! empty($subway_public_post) ) { |
|
| 101 | + if (! empty($subway_public_post) ) { |
|
| 102 | 102 | |
| 103 | - return true; |
|
| 103 | + return true; |
|
| 104 | 104 | |
| 105 | - } |
|
| 106 | - return false; |
|
| 107 | - } |
|
| 105 | + } |
|
| 106 | + return false; |
|
| 107 | + } |
|
| 108 | 108 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | namespace Subway; |
| 21 | 21 | |
| 22 | -if (! defined('ABSPATH') ) { |
|
| 22 | +if ( ! defined('ABSPATH')) { |
|
| 23 | 23 | return; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | $selected_login_post_id = intval(get_option('subway_login_page')); |
| 48 | 48 | |
| 49 | - if (0 === $selected_login_post_id ) { |
|
| 49 | + if (0 === $selected_login_post_id) { |
|
| 50 | 50 | |
| 51 | 51 | return; |
| 52 | 52 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | $login_post = get_post($selected_login_post_id); |
| 56 | 56 | |
| 57 | - if (! empty($login_post) ) { |
|
| 57 | + if ( ! empty($login_post)) { |
|
| 58 | 58 | |
| 59 | 59 | return trailingslashit(get_permalink($login_post->ID)); |
| 60 | 60 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | $excluded_pages_collection = array(); |
| 78 | 78 | |
| 79 | - if (! empty($subway_public_post) ) { |
|
| 79 | + if ( ! empty($subway_public_post)) { |
|
| 80 | 80 | |
| 81 | 81 | $excluded_pages_collection = explode(',', $subway_public_post); |
| 82 | 82 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | $subway_public_post = get_option('subway_is_public'); |
| 100 | 100 | |
| 101 | - if (! empty($subway_public_post) ) { |
|
| 101 | + if ( ! empty($subway_public_post)) { |
|
| 102 | 102 | |
| 103 | 103 | return true; |
| 104 | 104 | |
@@ -31,13 +31,13 @@ discard block |
||
| 31 | 31 | * @package Subway |
| 32 | 32 | */ |
| 33 | 33 | |
| 34 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 34 | +if ( ! defined('ABSPATH')) { |
|
| 35 | 35 | return; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // Terminate Subway for PHP version 5.3.0 and below. |
| 39 | -if ( version_compare( PHP_VERSION, '5.3.0', '<' ) ) { |
|
| 40 | - add_action( 'admin_notices', 'subway_admin_notice' ); |
|
| 39 | +if (version_compare(PHP_VERSION, '5.3.0', '<')) { |
|
| 40 | + add_action('admin_notices', 'subway_admin_notice'); |
|
| 41 | 41 | /** |
| 42 | 42 | * Displays admin notifications if the installed PHP version is less than 5.3.0 |
| 43 | 43 | * |
@@ -48,10 +48,10 @@ discard block |
||
| 48 | 48 | <div class="notice notice-error is-dismissible"> |
| 49 | 49 | <p> |
| 50 | 50 | <strong> |
| 51 | - <?php esc_html_e( 'Notice: Subway uses PHP Class Namespaces |
|
| 51 | + <?php esc_html_e('Notice: Subway uses PHP Class Namespaces |
|
| 52 | 52 | which is only available in servers with PHP 5.3.0 version and above. |
| 53 | 53 | Update your server\'s PHP version. You can deactivate |
| 54 | - Subway in the meantime.', 'subway' ); ?> |
|
| 54 | + Subway in the meantime.', 'subway'); ?> |
|
| 55 | 55 | </strong> |
| 56 | 56 | </p> |
| 57 | 57 | </div> |
@@ -60,13 +60,13 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | // Define Subway Plugin Version. |
| 63 | -define( 'SUBWAY_VERSION', '2.0' ); |
|
| 63 | +define('SUBWAY_VERSION', '2.0'); |
|
| 64 | 64 | |
| 65 | 65 | // Define Subway Directory Path. |
| 66 | -define( 'SUBWAY_DIR_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) ); |
|
| 66 | +define('SUBWAY_DIR_PATH', trailingslashit(plugin_dir_path(__FILE__))); |
|
| 67 | 67 | |
| 68 | 68 | // Define Subway URL Path. |
| 69 | -define( 'SUBWAY_DIR_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) ); |
|
| 69 | +define('SUBWAY_DIR_URL', trailingslashit(plugin_dir_url(__FILE__))); |
|
| 70 | 70 | |
| 71 | 71 | // Include Subway i18n. |
| 72 | 72 | require_once SUBWAY_DIR_PATH . 'i18.php'; |
@@ -93,20 +93,20 @@ discard block |
||
| 93 | 93 | require_once SUBWAY_DIR_PATH . 'shortcodes/subway-shortcodes.php'; |
| 94 | 94 | |
| 95 | 95 | // Redirect (302) all front-end request to the login page. |
| 96 | -add_action( 'wp', array( 'Subway\PageRedirect', 'index' ) ); |
|
| 96 | +add_action('wp', array('Subway\PageRedirect', 'index')); |
|
| 97 | 97 | |
| 98 | 98 | // Redirect (302) invalid login request to the login page. |
| 99 | -add_action( 'wp_ajax_nopriv_subway_logging_in', array( 'Subway\AuthRedirect', 'handleAuthentication' ) ); |
|
| 99 | +add_action('wp_ajax_nopriv_subway_logging_in', array('Subway\AuthRedirect', 'handleAuthentication')); |
|
| 100 | 100 | |
| 101 | 101 | // Load our JS and CSS files. |
| 102 | -add_action( 'wp_enqueue_scripts', array( 'Subway\Enqueue', 'registerJs' ) ); |
|
| 102 | +add_action('wp_enqueue_scripts', array('Subway\Enqueue', 'registerJs')); |
|
| 103 | 103 | |
| 104 | 104 | // Change the default login url to our sign-in page. |
| 105 | -add_filter( 'login_url', array( 'Subway\AuthRedirect', 'loginUrl' ), 10, 3 ); |
|
| 105 | +add_filter('login_url', array('Subway\AuthRedirect', 'loginUrl'), 10, 3); |
|
| 106 | 106 | |
| 107 | 107 | // Redirect the user after successful logged in to the right page. |
| 108 | 108 | // Does not trigger when using ajax form. Only on default wp-login.php and wp_login_form(). |
| 109 | -add_filter( 'login_redirect', array( 'Subway\AuthRedirect', 'getLoginRedirectUrl' ), 10, 3 ); |
|
| 109 | +add_filter('login_redirect', array('Subway\AuthRedirect', 'getLoginRedirectUrl'), 10, 3); |
|
| 110 | 110 | |
| 111 | 111 | // Change the default logout url to our sign-in page. |
| 112 | -add_action( 'wp_logout', array( 'Subway\AuthRedirect', 'logoutUrl' ), 10, 3 ); |
|
| 112 | +add_action('wp_logout', array('Subway\AuthRedirect', 'logoutUrl'), 10, 3); |
|