@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | namespace Subway; |
| 14 | 14 | |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | return; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -12,7 +12,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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( $redirect_to = '', $request = '', $user = 1 ); |
|
| 67 | + $subway_redirect_url = Auth_Redirect::get_login_redirect_url($redirect_to = '', $request = '', $user = 1); |
|
| 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 |
||
| 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, $request, $user ) { |
|
| 85 | + public static function get_login_redirect_url($redirect_to, $request, $user) { |
|
| 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 |
||
| 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( $user->ID ) ) { |
|
| 130 | - $entered_custom_url = str_replace( '%user_id%', $user->ID, $entered_custom_url ); |
|
| 129 | + if ( ! empty($user->ID)) { |
|
| 130 | + $entered_custom_url = str_replace('%user_id%', $user->ID, $entered_custom_url); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - if ( ! empty( $user->user_login ) ) { |
|
| 134 | - $entered_custom_url = str_replace( '%user_name%', $user->user_login, $entered_custom_url ); |
|
| 133 | + if ( ! empty($user->user_login)) { |
|
| 134 | + $entered_custom_url = str_replace('%user_name%', $user->user_login, $entered_custom_url); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | return $entered_custom_url; |
@@ -148,12 +148,12 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -12,7 +12,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |