@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @package Subway |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | <!-- Page --> |
38 | 38 | <label for="subway_use_page"> |
39 | 39 | |
40 | - <input <?php checked( 'page', get_option( 'subway_redirect_type' ), true ); ?> value="page" name="subway_redirect_type" id="subway_use_page" type="radio" class="code" /> |
|
40 | + <input <?php checked('page', get_option('subway_redirect_type'), true); ?> value="page" name="subway_redirect_type" id="subway_use_page" type="radio" class="code" /> |
|
41 | 41 | |
42 | - <?php esc_html_e( 'Custom Page', 'subway' ); ?> |
|
42 | + <?php esc_html_e('Custom Page', 'subway'); ?> |
|
43 | 43 | |
44 | 44 | </label> |
45 | 45 | |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | |
50 | 50 | <label for="subway_use_custom_url"> |
51 | 51 | |
52 | - <input <?php checked( 'custom_url', get_option( 'subway_redirect_type' ), true ); ?> value="custom_url" name="subway_redirect_type" id="subway_use_custom_url" type="radio" class="code" /> |
|
52 | + <input <?php checked('custom_url', get_option('subway_redirect_type'), true); ?> value="custom_url" name="subway_redirect_type" id="subway_use_custom_url" type="radio" class="code" /> |
|
53 | 53 | |
54 | - <?php esc_html_e( 'Custom URL', 'subway' ); ?> |
|
54 | + <?php esc_html_e('Custom URL', 'subway'); ?> |
|
55 | 55 | |
56 | 56 | </label> |
57 | 57 | |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | |
62 | 62 | <label for="subway_use_default"> |
63 | 63 | |
64 | - <input <?php checked( 'default', get_option( 'subway_redirect_type' ), true ); ?> value="default" name="subway_redirect_type" id="subway_use_default" type="radio" class="code" /> |
|
64 | + <input <?php checked('default', get_option('subway_redirect_type'), true); ?> value="default" name="subway_redirect_type" id="subway_use_default" type="radio" class="code" /> |
|
65 | 65 | |
66 | - <?php esc_html_e( 'Default Behavior', 'subway' ); ?> |
|
66 | + <?php esc_html_e('Default Behavior', 'subway'); ?> |
|
67 | 67 | |
68 | 68 | </label> |
69 | 69 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | <div id="subway_redirect_page_option_section" class="hidden subway-redirect-option-section"> |
80 | 80 | |
81 | 81 | <label for="subway_redirect_page_id"> |
82 | - <?php esc_html_e( 'Select Page' ); ?> |
|
82 | + <?php esc_html_e('Select Page'); ?> |
|
83 | 83 | </label> |
84 | 84 | |
85 | 85 | <?php |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | wp_dropdown_pages( |
88 | 88 | array( |
89 | 89 | 'name' => 'subway_redirect_page_id', |
90 | - 'selected' => intval( get_option( 'subway_redirect_page_id' ) ), |
|
91 | - 'show_option_none' => esc_html__( '-', 'subway' ), |
|
90 | + 'selected' => intval(get_option('subway_redirect_page_id')), |
|
91 | + 'show_option_none' => esc_html__('-', 'subway'), |
|
92 | 92 | ) |
93 | 93 | ); |
94 | 94 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | <p class="description"> |
98 | 98 | |
99 | - <?php _e( 'The selected page will be used as the redirect endpoint for all of your users. Selecting blank (-) will redirect the user to the default redirect defined in WordPress or other plugins. Choose "Custom URL" if you want to redirect to a custom URL or domain.', 'subway' ); ?> |
|
99 | + <?php _e('The selected page will be used as the redirect endpoint for all of your users. Selecting blank (-) will redirect the user to the default redirect defined in WordPress or other plugins. Choose "Custom URL" if you want to redirect to a custom URL or domain.', 'subway'); ?> |
|
100 | 100 | |
101 | 101 | </p> |
102 | 102 | |
@@ -105,29 +105,29 @@ discard block |
||
105 | 105 | <div id="subway_redirect_custom_url_option_section" class="hidden subway-redirect-option-section"> |
106 | 106 | |
107 | 107 | <label for="subway_redirect_custom_url"> |
108 | - <?php esc_attr_e( 'Enter Redirect URL:', 'subway' ); ?> |
|
108 | + <?php esc_attr_e('Enter Redirect URL:', 'subway'); ?> |
|
109 | 109 | </label> |
110 | 110 | |
111 | - <input value="<?php echo esc_attr( esc_url( get_option( 'subway_redirect_custom_url' ) ) ); ?>" type="text" name="subway_redirect_custom_url" placeholder="<?php esc_attr_e( 'http://', 'subway' ); ?>" |
|
111 | + <input value="<?php echo esc_attr(esc_url(get_option('subway_redirect_custom_url'))); ?>" type="text" name="subway_redirect_custom_url" placeholder="<?php esc_attr_e('http://', 'subway'); ?>" |
|
112 | 112 | id="subway_redirect_custom_url" size="75" /> |
113 | 113 | |
114 | 114 | <p class="description"><br> |
115 | 115 | |
116 | 116 | <?php |
117 | - echo sprintf( __( 'When entering a custom domain, you can use a variable string such us: %1$s and %2$s. For example, http://yoursiteurl.com/members/<strong>%2$s</strong> will translate to http://yoursiteurl/members/<strong>admin</strong> where "admin" is equal to the %2$s variable; http://yoursiteurl.com/users/<strong>%1$s</strong> will translate to http://yoursiteurl.com/users/<strong>4</strong> where "4" is equal to the %1$s. Both variables refer to the current user that is logged-in.', 'subway' ), '%user_id%', '%user_name%' ); |
|
117 | + echo sprintf(__('When entering a custom domain, you can use a variable string such us: %1$s and %2$s. For example, http://yoursiteurl.com/members/<strong>%2$s</strong> will translate to http://yoursiteurl/members/<strong>admin</strong> where "admin" is equal to the %2$s variable; http://yoursiteurl.com/users/<strong>%1$s</strong> will translate to http://yoursiteurl.com/users/<strong>4</strong> where "4" is equal to the %1$s. Both variables refer to the current user that is logged-in.', 'subway'), '%user_id%', '%user_name%'); |
|
118 | 118 | ?> |
119 | 119 | |
120 | 120 | </p><br> |
121 | 121 | |
122 | 122 | <p class="description"> |
123 | 123 | |
124 | - <?php esc_attr_e( 'Leave empty to use existing WordPress or other 3rd party plugin redirect option.', 'subway' ); ?> |
|
124 | + <?php esc_attr_e('Leave empty to use existing WordPress or other 3rd party plugin redirect option.', 'subway'); ?> |
|
125 | 125 | |
126 | 126 | </p><br> |
127 | 127 | |
128 | 128 | <p class="description"> |
129 | 129 | |
130 | - <?php esc_html_e( 'Warning: External URLs are not supported by WordPress Function (wp_safe_redirect) and will be redirected back to default WordPress behavior.', 'subway' ); ?> |
|
130 | + <?php esc_html_e('Warning: External URLs are not supported by WordPress Function (wp_safe_redirect) and will be redirected back to default WordPress behavior.', 'subway'); ?> |
|
131 | 131 | |
132 | 132 | </p> |
133 | 133 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | <div id="subway_redirect_default_option_section" class="hidden subway-redirect-option-section"> |
138 | 138 | <p> |
139 | 139 | <?php |
140 | - esc_html_e( "By choosing the default behavior, the redirect type will be set to the default WordPress' behavior. For example, if you have plugins like Peter's Login Redirect. This option will disable Subway's redirect and use the Peter's Login Redirect Instead.", 'subway' ); |
|
140 | + esc_html_e("By choosing the default behavior, the redirect type will be set to the default WordPress' behavior. For example, if you have plugins like Peter's Login Redirect. This option will disable Subway's redirect and use the Peter's Login Redirect Instead.", 'subway'); |
|
141 | 141 | ?> |
142 | 142 | </p> |
143 | 143 | </div> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @package Subway |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | */ |
22 | 22 | function subway_is_public_form() { |
23 | 23 | |
24 | - echo '<label for="subway_is_public"><input ' . checked( 1, get_option( 'subway_is_public' ), false ) . ' value="1" name="subway_is_public" id="subway_is_public" type="checkbox" class="code" /> Check to make all of your posts and pages visible to public.</label>'; |
|
25 | - echo '<p class="description">' . esc_html__( 'This option will overwrite the \'Private Login Page\' below. BuddyPress pages like user profile, members, and groups are still only available to the rightful owner of the profile.', 'subway' ) . '</p>'; |
|
24 | + echo '<label for="subway_is_public"><input ' . checked(1, get_option('subway_is_public'), false) . ' value="1" name="subway_is_public" id="subway_is_public" type="checkbox" class="code" /> Check to make all of your posts and pages visible to public.</label>'; |
|
25 | + echo '<p class="description">' . esc_html__('This option will overwrite the \'Private Login Page\' below. BuddyPress pages like user profile, members, and groups are still only available to the rightful owner of the profile.', 'subway') . '</p>'; |
|
26 | 26 | |
27 | 27 | return; |
28 | 28 | } |
@@ -10,15 +10,15 @@ |
||
10 | 10 | * @package Subway |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
17 | 17 | function subway_public_post() { |
18 | 18 | |
19 | - echo '<textarea id="subway_public_post" name="subway_public_post" rows="5" cols="95">' . esc_attr( trim( get_option( 'subway_public_post' ) ) ) . '</textarea>'; |
|
19 | + echo '<textarea id="subway_public_post" name="subway_public_post" rows="5" cols="95">' . esc_attr(trim(get_option('subway_public_post'))) . '</textarea>'; |
|
20 | 20 | |
21 | - echo '<p class="description">' . nl2br( esc_html( "Enter the IDs of posts and pages that you wanted to show in public. You need to separate it by ',' (comma), for example: 143,123,213. Alternatively, you can enable public viewing of all of your pages and posts by checking the 'Public Website' option above.", 'subway' ) ) . '</p>'; |
|
21 | + echo '<p class="description">' . nl2br(esc_html("Enter the IDs of posts and pages that you wanted to show in public. You need to separate it by ',' (comma), for example: 143,123,213. Alternatively, you can enable public viewing of all of your pages and posts by checking the 'Public Website' option above.", 'subway')) . '</p>'; |
|
22 | 22 | |
23 | 23 | return; |
24 | 24 |
@@ -10,7 +10,7 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -10,7 +10,7 @@ discard block |
||
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 |
||
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 |
@@ -17,12 +17,12 @@ |
||
17 | 17 | * @link github.com/codehaiku/subway The Plugin Repository |
18 | 18 | */ |
19 | 19 | |
20 | -if ( ! defined( 'ABSPATH' ) ) { |
|
20 | +if ( ! defined('ABSPATH')) { |
|
21 | 21 | return; |
22 | 22 | } |
23 | 23 | ?> |
24 | 24 | <p class="subway-login-lost-password"> |
25 | - <a href="<?php echo esc_url( wp_lostpassword_url( $redirect = '' ) ); ?>"> |
|
26 | - <?php esc_html_e( 'Forgot Password', 'subway' ); ?> |
|
25 | + <a href="<?php echo esc_url(wp_lostpassword_url($redirect = '')); ?>"> |
|
26 | + <?php esc_html_e('Forgot Password', 'subway'); ?> |
|
27 | 27 | </a> |
28 | 28 | </p> |
@@ -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,153 +36,153 @@ discard block |
||
36 | 36 | final class AdminSettings |
37 | 37 | { |
38 | 38 | |
39 | - /** |
|
40 | - * Our class constructor |
|
41 | - */ |
|
42 | - public function __construct() |
|
43 | - { |
|
39 | + /** |
|
40 | + * Our class constructor |
|
41 | + */ |
|
42 | + public function __construct() |
|
43 | + { |
|
44 | 44 | |
45 | - add_action('admin_menu', array( $this, 'adminMenu' )); |
|
46 | - |
|
47 | - add_action('admin_init', array( $this, 'registerSettings' )); |
|
48 | - |
|
49 | - } |
|
50 | - |
|
51 | - /** |
|
52 | - * Display 'Subway' link under 'Settings' |
|
53 | - * |
|
54 | - * @return void |
|
55 | - */ |
|
56 | - public function adminMenu() |
|
57 | - { |
|
58 | - |
|
59 | - add_options_page( |
|
60 | - 'Subway Settings', 'Subway', 'manage_options', |
|
61 | - 'subway', array( $this, 'optionsPage' ) |
|
62 | - ); |
|
63 | - |
|
64 | - return; |
|
65 | - } |
|
66 | - |
|
67 | - /** |
|
68 | - * Registers all settings related to Subway. |
|
69 | - * |
|
70 | - * @return void |
|
71 | - */ |
|
72 | - public function registerSettings() |
|
73 | - { |
|
74 | - |
|
75 | - // Register our settings section. |
|
76 | - add_settings_section( |
|
77 | - 'subway-page-visibility-section', __('Pages Visibility', 'subway'), |
|
78 | - array( $this, 'sectionCallback' ), 'subway-settings-section' |
|
79 | - ); |
|
80 | - |
|
81 | - // Register Redirect Options pages. |
|
82 | - add_settings_section( |
|
83 | - 'subway-redirect-section', __('Redirect Options', 'subway'), |
|
84 | - array( $this, 'redirectCallback' ), 'subway-settings-section' |
|
85 | - ); |
|
86 | - |
|
87 | - // Register the fields. |
|
88 | - $fields = array( |
|
89 | - array( |
|
90 | - 'id' => 'subway_is_public', |
|
91 | - 'label' => __('Public Website', 'subway'), |
|
92 | - 'callback' => 'subway_is_public_form', |
|
93 | - 'section' => 'subway-settings-section', |
|
94 | - 'group' => 'subway-page-visibility-section', |
|
95 | - ), |
|
45 | + add_action('admin_menu', array( $this, 'adminMenu' )); |
|
46 | + |
|
47 | + add_action('admin_init', array( $this, 'registerSettings' )); |
|
48 | + |
|
49 | + } |
|
50 | + |
|
51 | + /** |
|
52 | + * Display 'Subway' link under 'Settings' |
|
53 | + * |
|
54 | + * @return void |
|
55 | + */ |
|
56 | + public function adminMenu() |
|
57 | + { |
|
58 | + |
|
59 | + add_options_page( |
|
60 | + 'Subway Settings', 'Subway', 'manage_options', |
|
61 | + 'subway', array( $this, 'optionsPage' ) |
|
62 | + ); |
|
63 | + |
|
64 | + return; |
|
65 | + } |
|
66 | + |
|
67 | + /** |
|
68 | + * Registers all settings related to Subway. |
|
69 | + * |
|
70 | + * @return void |
|
71 | + */ |
|
72 | + public function registerSettings() |
|
73 | + { |
|
74 | + |
|
75 | + // Register our settings section. |
|
76 | + add_settings_section( |
|
77 | + 'subway-page-visibility-section', __('Pages Visibility', 'subway'), |
|
78 | + array( $this, 'sectionCallback' ), 'subway-settings-section' |
|
79 | + ); |
|
80 | + |
|
81 | + // Register Redirect Options pages. |
|
82 | + add_settings_section( |
|
83 | + 'subway-redirect-section', __('Redirect Options', 'subway'), |
|
84 | + array( $this, 'redirectCallback' ), 'subway-settings-section' |
|
85 | + ); |
|
86 | + |
|
87 | + // Register the fields. |
|
88 | + $fields = array( |
|
89 | + array( |
|
90 | + 'id' => 'subway_is_public', |
|
91 | + 'label' => __('Public Website', 'subway'), |
|
92 | + 'callback' => 'subway_is_public_form', |
|
93 | + 'section' => 'subway-settings-section', |
|
94 | + 'group' => 'subway-page-visibility-section', |
|
95 | + ), |
|
96 | 96 | |
97 | - array( |
|
98 | - 'id' => 'subway_login_page', |
|
99 | - 'label' => __('Private Login Page', 'subway'), |
|
100 | - 'callback' => 'subway_login_page_form', |
|
101 | - 'section' => 'subway-settings-section', |
|
102 | - 'group' => 'subway-page-visibility-section', |
|
103 | - ), |
|
104 | - array( |
|
105 | - 'id' => 'subway_public_post', |
|
106 | - 'label' => __('Public Posts IDs', 'subway'), |
|
107 | - 'callback' => 'subway_public_post', |
|
108 | - 'section' => 'subway-settings-section', |
|
109 | - 'group' => 'subway-page-visibility-section', |
|
110 | - ), |
|
97 | + array( |
|
98 | + 'id' => 'subway_login_page', |
|
99 | + 'label' => __('Private Login Page', 'subway'), |
|
100 | + 'callback' => 'subway_login_page_form', |
|
101 | + 'section' => 'subway-settings-section', |
|
102 | + 'group' => 'subway-page-visibility-section', |
|
103 | + ), |
|
104 | + array( |
|
105 | + 'id' => 'subway_public_post', |
|
106 | + 'label' => __('Public Posts IDs', 'subway'), |
|
107 | + 'callback' => 'subway_public_post', |
|
108 | + 'section' => 'subway-settings-section', |
|
109 | + 'group' => 'subway-page-visibility-section', |
|
110 | + ), |
|
111 | 111 | |
112 | - array( |
|
113 | - 'id' => 'subway_redirect_type', |
|
114 | - 'label' => __('Redirect Type', 'subway'), |
|
115 | - 'callback' => 'subway_redirect_option_form', |
|
116 | - 'section' => 'subway-settings-section', |
|
117 | - 'group' => 'subway-redirect-section', |
|
118 | - ), |
|
119 | - array( |
|
120 | - 'id' => 'subway_redirect_wp_admin', |
|
121 | - 'label' => __('Bypassing <em>wp-login.php</em>', 'subway'), |
|
122 | - 'callback' => 'subway_lock_wp_admin', |
|
123 | - 'section' => 'subway-settings-section', |
|
124 | - 'group' => 'subway-redirect-section', |
|
125 | - ), |
|
126 | - ); |
|
127 | - |
|
128 | - foreach ( $fields as $field ) { |
|
129 | - |
|
130 | - add_settings_field( |
|
131 | - $field['id'], $field['label'], |
|
132 | - $field['callback'], $field['section'], |
|
133 | - $field['group'] |
|
134 | - ); |
|
135 | - |
|
136 | - register_setting('subway-settings-group', $field['id']); |
|
137 | - |
|
138 | - $file = str_replace('_', '-', $field['callback']); |
|
139 | - |
|
140 | - include_once trailingslashit(SUBWAY_DIR_PATH) . |
|
141 | - 'settings-fields/field-' . sanitize_title($file) . '.php'; |
|
142 | - |
|
143 | - } |
|
144 | - |
|
145 | - // Register Redirect Page ID Settings. |
|
146 | - register_setting('subway-settings-group', 'subway_redirect_page_id'); |
|
147 | - |
|
148 | - // Register Redirect Custom URL Settings. |
|
149 | - register_setting('subway-settings-group', 'subway_redirect_custom_url'); |
|
150 | - |
|
151 | - return; |
|
152 | - } |
|
153 | - |
|
154 | - /** |
|
155 | - * Callback function for the first Section. |
|
156 | - * |
|
157 | - * @return void |
|
158 | - */ |
|
159 | - public function sectionCallback() |
|
160 | - { |
|
161 | - echo esc_html_e( |
|
162 | - 'All settings related to the |
|
112 | + array( |
|
113 | + 'id' => 'subway_redirect_type', |
|
114 | + 'label' => __('Redirect Type', 'subway'), |
|
115 | + 'callback' => 'subway_redirect_option_form', |
|
116 | + 'section' => 'subway-settings-section', |
|
117 | + 'group' => 'subway-redirect-section', |
|
118 | + ), |
|
119 | + array( |
|
120 | + 'id' => 'subway_redirect_wp_admin', |
|
121 | + 'label' => __('Bypassing <em>wp-login.php</em>', 'subway'), |
|
122 | + 'callback' => 'subway_lock_wp_admin', |
|
123 | + 'section' => 'subway-settings-section', |
|
124 | + 'group' => 'subway-redirect-section', |
|
125 | + ), |
|
126 | + ); |
|
127 | + |
|
128 | + foreach ( $fields as $field ) { |
|
129 | + |
|
130 | + add_settings_field( |
|
131 | + $field['id'], $field['label'], |
|
132 | + $field['callback'], $field['section'], |
|
133 | + $field['group'] |
|
134 | + ); |
|
135 | + |
|
136 | + register_setting('subway-settings-group', $field['id']); |
|
137 | + |
|
138 | + $file = str_replace('_', '-', $field['callback']); |
|
139 | + |
|
140 | + include_once trailingslashit(SUBWAY_DIR_PATH) . |
|
141 | + 'settings-fields/field-' . sanitize_title($file) . '.php'; |
|
142 | + |
|
143 | + } |
|
144 | + |
|
145 | + // Register Redirect Page ID Settings. |
|
146 | + register_setting('subway-settings-group', 'subway_redirect_page_id'); |
|
147 | + |
|
148 | + // Register Redirect Custom URL Settings. |
|
149 | + register_setting('subway-settings-group', 'subway_redirect_custom_url'); |
|
150 | + |
|
151 | + return; |
|
152 | + } |
|
153 | + |
|
154 | + /** |
|
155 | + * Callback function for the first Section. |
|
156 | + * |
|
157 | + * @return void |
|
158 | + */ |
|
159 | + public function sectionCallback() |
|
160 | + { |
|
161 | + echo esc_html_e( |
|
162 | + 'All settings related to the |
|
163 | 163 | visibility of your site and pages.', 'subway' |
164 | - ); |
|
165 | - return; |
|
166 | - } |
|
167 | - |
|
168 | - /** |
|
169 | - * Callback function for the second Section. |
|
170 | - * |
|
171 | - * @return void |
|
172 | - */ |
|
173 | - public function redirectCallback() |
|
174 | - { |
|
175 | - return; |
|
176 | - } |
|
177 | - |
|
178 | - /** |
|
179 | - * Renders the 'wrapper' for our options pages. |
|
180 | - * |
|
181 | - * @return void |
|
182 | - */ |
|
183 | - public function optionsPage() |
|
184 | - { |
|
185 | - ?> |
|
164 | + ); |
|
165 | + return; |
|
166 | + } |
|
167 | + |
|
168 | + /** |
|
169 | + * Callback function for the second Section. |
|
170 | + * |
|
171 | + * @return void |
|
172 | + */ |
|
173 | + public function redirectCallback() |
|
174 | + { |
|
175 | + return; |
|
176 | + } |
|
177 | + |
|
178 | + /** |
|
179 | + * Renders the 'wrapper' for our options pages. |
|
180 | + * |
|
181 | + * @return void |
|
182 | + */ |
|
183 | + public function optionsPage() |
|
184 | + { |
|
185 | + ?> |
|
186 | 186 | |
187 | 187 | <div class="wrap"> |
188 | 188 | <h2> |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | </div> |
197 | 197 | |
198 | 198 | <?php |
199 | - } |
|
199 | + } |
|
200 | 200 | |
201 | 201 | } |
202 | 202 |
@@ -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 | |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | public function __construct() |
43 | 43 | { |
44 | 44 | |
45 | - add_action('admin_menu', array( $this, 'adminMenu' )); |
|
45 | + add_action('admin_menu', array($this, 'adminMenu')); |
|
46 | 46 | |
47 | - add_action('admin_init', array( $this, 'registerSettings' )); |
|
47 | + add_action('admin_init', array($this, 'registerSettings')); |
|
48 | 48 | |
49 | 49 | } |
50 | 50 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | add_options_page( |
60 | 60 | 'Subway Settings', 'Subway', 'manage_options', |
61 | - 'subway', array( $this, 'optionsPage' ) |
|
61 | + 'subway', array($this, 'optionsPage') |
|
62 | 62 | ); |
63 | 63 | |
64 | 64 | return; |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | // Register our settings section. |
76 | 76 | add_settings_section( |
77 | 77 | 'subway-page-visibility-section', __('Pages Visibility', 'subway'), |
78 | - array( $this, 'sectionCallback' ), 'subway-settings-section' |
|
78 | + array($this, 'sectionCallback'), 'subway-settings-section' |
|
79 | 79 | ); |
80 | 80 | |
81 | 81 | // Register Redirect Options pages. |
82 | 82 | add_settings_section( |
83 | 83 | 'subway-redirect-section', __('Redirect Options', 'subway'), |
84 | - array( $this, 'redirectCallback' ), 'subway-settings-section' |
|
84 | + array($this, 'redirectCallback'), 'subway-settings-section' |
|
85 | 85 | ); |
86 | 86 | |
87 | 87 | // Register the fields. |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | ), |
126 | 126 | ); |
127 | 127 | |
128 | - foreach ( $fields as $field ) { |
|
128 | + foreach ($fields as $field) { |
|
129 | 129 | |
130 | 130 | add_settings_field( |
131 | 131 | $field['id'], $field['label'], |
@@ -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( |