@@ -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 |
@@ -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 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | private function __construct() |
45 | 45 | { |
46 | 46 | |
47 | - add_action('init', array( $this, 'register')); |
|
47 | + add_action('init', array($this, 'register')); |
|
48 | 48 | |
49 | 49 | return $this; |
50 | 50 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | static $instance = null; |
62 | 62 | |
63 | - if (null === $instance ) { |
|
63 | + if (null === $instance) { |
|
64 | 64 | |
65 | 65 | $instance = new Shortcodes(); |
66 | 66 | |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | public function register() |
79 | 79 | { |
80 | 80 | |
81 | - add_shortcode('subway_login', array( $this, 'loginForm' )); |
|
81 | + add_shortcode('subway_login', array($this, 'loginForm')); |
|
82 | 82 | |
83 | - add_action('login_form_middle', array( $this, 'loginFormAction' ), 10, 2); |
|
83 | + add_action('login_form_middle', array($this, 'loginFormAction'), 10, 2); |
|
84 | 84 | |
85 | - add_action('login_form_middle', array( $this, 'lostPasswordLink' ), 10, 2); |
|
85 | + add_action('login_form_middle', array($this, 'lostPasswordLink'), 10, 2); |
|
86 | 86 | |
87 | 87 | return; |
88 | 88 | |
@@ -111,22 +111,22 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @return string The html template content. |
113 | 113 | */ |
114 | - protected function renderTemplate( $atts, $file = '' ) |
|
114 | + protected function renderTemplate($atts, $file = '') |
|
115 | 115 | { |
116 | 116 | |
117 | 117 | ob_start(); |
118 | 118 | |
119 | - if (empty($file) ) { |
|
119 | + if (empty($file)) { |
|
120 | 120 | |
121 | 121 | return; |
122 | 122 | |
123 | 123 | } |
124 | 124 | |
125 | - $template = SUBWAY_DIR_PATH . 'templates/'.$file; |
|
125 | + $template = SUBWAY_DIR_PATH . 'templates/' . $file; |
|
126 | 126 | |
127 | - if (file_exists($template) ) { |
|
127 | + if (file_exists($template)) { |
|
128 | 128 | |
129 | - $theme_template = locate_template(array('gears/shortcodes/'.$file )); |
|
129 | + $theme_template = locate_template(array('gears/shortcodes/' . $file)); |
|
130 | 130 | |
131 | 131 | if ($theme_template) { |
132 | 132 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * |
158 | 158 | * @return string The content of our login form action. |
159 | 159 | */ |
160 | - public function loginFormAction( $__content ) |
|
160 | + public function loginFormAction($__content) |
|
161 | 161 | { |
162 | 162 | |
163 | 163 | ob_start(); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @return string The content of our lost password link. |
177 | 177 | */ |
178 | - public function lostPasswordLink( $content ) |
|
178 | + public function lostPasswordLink($content) |
|
179 | 179 | { |
180 | 180 | |
181 | 181 | return $content . $this->renderTemplate( |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | /** |
40 | 40 | * Class Constructor. |
41 | 41 | * |
42 | - * @return void |
|
42 | + * @return Shortcodes |
|
43 | 43 | */ |
44 | 44 | private function __construct() |
45 | 45 | { |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | /** |
54 | 54 | * Instantiate our class. |
55 | 55 | * |
56 | - * @return mixed The instance of this class. |
|
56 | + * @return Shortcodes|null The instance of this class. |
|
57 | 57 | */ |
58 | 58 | public static function instance() |
59 | 59 | { |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | /** |
92 | 92 | * Displays the login form |
93 | 93 | * |
94 | - * @return void |
|
94 | + * @return null|string |
|
95 | 95 | */ |
96 | 96 | public function loginForm() |
97 | 97 | { |
@@ -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 Shortcodes |
37 | 37 | { |
38 | 38 | |
39 | - /** |
|
40 | - * Class Constructor. |
|
41 | - * |
|
42 | - * @return void |
|
43 | - */ |
|
44 | - private function __construct() |
|
45 | - { |
|
39 | + /** |
|
40 | + * Class Constructor. |
|
41 | + * |
|
42 | + * @return void |
|
43 | + */ |
|
44 | + private function __construct() |
|
45 | + { |
|
46 | 46 | |
47 | - add_action('init', array( $this, 'register')); |
|
47 | + add_action('init', array( $this, 'register')); |
|
48 | 48 | |
49 | - return $this; |
|
49 | + return $this; |
|
50 | 50 | |
51 | - } |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Instantiate our class. |
|
55 | - * |
|
56 | - * @return mixed The instance of this class. |
|
57 | - */ |
|
58 | - public static function instance() |
|
59 | - { |
|
53 | + /** |
|
54 | + * Instantiate our class. |
|
55 | + * |
|
56 | + * @return mixed The instance of this class. |
|
57 | + */ |
|
58 | + public static function instance() |
|
59 | + { |
|
60 | 60 | |
61 | - static $instance = null; |
|
61 | + static $instance = null; |
|
62 | 62 | |
63 | - if (null === $instance ) { |
|
63 | + if (null === $instance ) { |
|
64 | 64 | |
65 | - $instance = new Shortcodes(); |
|
65 | + $instance = new Shortcodes(); |
|
66 | 66 | |
67 | - } |
|
67 | + } |
|
68 | 68 | |
69 | - return $instance; |
|
69 | + return $instance; |
|
70 | 70 | |
71 | - } |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Instantiate our class. |
|
75 | - * |
|
76 | - * @return void |
|
77 | - */ |
|
78 | - public function register() |
|
79 | - { |
|
73 | + /** |
|
74 | + * Instantiate our class. |
|
75 | + * |
|
76 | + * @return void |
|
77 | + */ |
|
78 | + public function register() |
|
79 | + { |
|
80 | 80 | |
81 | - add_shortcode('subway_login', array( $this, 'loginForm' )); |
|
81 | + add_shortcode('subway_login', array( $this, 'loginForm' )); |
|
82 | 82 | |
83 | - add_action('login_form_middle', array( $this, 'loginFormAction' ), 10, 2); |
|
83 | + add_action('login_form_middle', array( $this, 'loginFormAction' ), 10, 2); |
|
84 | 84 | |
85 | - add_action('login_form_middle', array( $this, 'lostPasswordLink' ), 10, 2); |
|
85 | + add_action('login_form_middle', array( $this, 'lostPasswordLink' ), 10, 2); |
|
86 | 86 | |
87 | - return; |
|
87 | + return; |
|
88 | 88 | |
89 | - } |
|
89 | + } |
|
90 | 90 | |
91 | - /** |
|
92 | - * Displays the login form |
|
93 | - * |
|
94 | - * @return void |
|
95 | - */ |
|
96 | - public function loginForm() |
|
97 | - { |
|
91 | + /** |
|
92 | + * Displays the login form |
|
93 | + * |
|
94 | + * @return void |
|
95 | + */ |
|
96 | + public function loginForm() |
|
97 | + { |
|
98 | 98 | |
99 | - $atts = array(); |
|
99 | + $atts = array(); |
|
100 | 100 | |
101 | - return $this->renderTemplate($atts, 'login-form.php'); |
|
101 | + return $this->renderTemplate($atts, 'login-form.php'); |
|
102 | 102 | |
103 | - } |
|
104 | - |
|
105 | - /** |
|
106 | - * Include the specific plugin file if there is no template file. |
|
107 | - * |
|
108 | - * @param mixed $atts The shortcode attribute. |
|
109 | - * @param string $file The shortcode template file. |
|
110 | - * |
|
111 | - * @return string The html template content. |
|
112 | - */ |
|
113 | - protected function renderTemplate( $atts, $file = '' ) |
|
114 | - { |
|
115 | - |
|
116 | - ob_start(); |
|
117 | - |
|
118 | - if (empty($file) ) { |
|
103 | + } |
|
104 | + |
|
105 | + /** |
|
106 | + * Include the specific plugin file if there is no template file. |
|
107 | + * |
|
108 | + * @param mixed $atts The shortcode attribute. |
|
109 | + * @param string $file The shortcode template file. |
|
110 | + * |
|
111 | + * @return string The html template content. |
|
112 | + */ |
|
113 | + protected function renderTemplate( $atts, $file = '' ) |
|
114 | + { |
|
115 | + |
|
116 | + ob_start(); |
|
117 | + |
|
118 | + if (empty($file) ) { |
|
119 | 119 | |
120 | - return; |
|
120 | + return; |
|
121 | 121 | |
122 | - } |
|
122 | + } |
|
123 | 123 | |
124 | - $template = SUBWAY_DIR_PATH . 'templates/'.$file; |
|
124 | + $template = SUBWAY_DIR_PATH . 'templates/'.$file; |
|
125 | 125 | |
126 | - if (file_exists($template) ) { |
|
126 | + if (file_exists($template) ) { |
|
127 | 127 | |
128 | - $theme_template = locate_template(array('gears/shortcodes/'.$file )); |
|
128 | + $theme_template = locate_template(array('gears/shortcodes/'.$file )); |
|
129 | 129 | |
130 | - if ($theme_template) { |
|
130 | + if ($theme_template) { |
|
131 | 131 | |
132 | - $template = $theme_template; |
|
132 | + $template = $theme_template; |
|
133 | 133 | |
134 | - } |
|
134 | + } |
|
135 | 135 | |
136 | - include $template; |
|
136 | + include $template; |
|
137 | 137 | |
138 | - } else { |
|
138 | + } else { |
|
139 | 139 | |
140 | - echo sprintf( |
|
141 | - esc_html_e( |
|
142 | - 'Subway Error: Unable to find template file in: %1s', 'subway' |
|
143 | - ), |
|
144 | - $template |
|
145 | - ); |
|
140 | + echo sprintf( |
|
141 | + esc_html_e( |
|
142 | + 'Subway Error: Unable to find template file in: %1s', 'subway' |
|
143 | + ), |
|
144 | + $template |
|
145 | + ); |
|
146 | 146 | |
147 | - } |
|
147 | + } |
|
148 | 148 | |
149 | - return ob_get_clean(); |
|
150 | - } |
|
149 | + return ob_get_clean(); |
|
150 | + } |
|
151 | 151 | |
152 | - /** |
|
153 | - * The action for our login form. |
|
154 | - * |
|
155 | - * @param string $__content The current filtered contents. |
|
156 | - * |
|
157 | - * @return string The content of our login form action. |
|
158 | - */ |
|
159 | - public function loginFormAction( $__content ) |
|
160 | - { |
|
152 | + /** |
|
153 | + * The action for our login form. |
|
154 | + * |
|
155 | + * @param string $__content The current filtered contents. |
|
156 | + * |
|
157 | + * @return string The content of our login form action. |
|
158 | + */ |
|
159 | + public function loginFormAction( $__content ) |
|
160 | + { |
|
161 | 161 | |
162 | - ob_start(); |
|
162 | + ob_start(); |
|
163 | 163 | |
164 | - do_action('login_form'); |
|
164 | + do_action('login_form'); |
|
165 | 165 | |
166 | - return $__content . ob_get_clean(); |
|
167 | - |
|
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * The action for our 'lost password' link. |
|
172 | - * |
|
173 | - * @param string $content The current filtered contents. |
|
174 | - * |
|
175 | - * @return string The content of our lost password link. |
|
176 | - */ |
|
177 | - public function lostPasswordLink( $content ) |
|
178 | - { |
|
166 | + return $__content . ob_get_clean(); |
|
167 | + |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * The action for our 'lost password' link. |
|
172 | + * |
|
173 | + * @param string $content The current filtered contents. |
|
174 | + * |
|
175 | + * @return string The content of our lost password link. |
|
176 | + */ |
|
177 | + public function lostPasswordLink( $content ) |
|
178 | + { |
|
179 | 179 | |
180 | - return $content . $this->renderTemplate( |
|
181 | - array(), |
|
182 | - 'login-form-lost-password.php' |
|
183 | - ); |
|
180 | + return $content . $this->renderTemplate( |
|
181 | + array(), |
|
182 | + 'login-form-lost-password.php' |
|
183 | + ); |
|
184 | 184 | |
185 | - } |
|
185 | + } |
|
186 | 186 | |
187 | 187 | } |
188 | 188 |
@@ -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,33 +36,33 @@ discard block |
||
36 | 36 | final class I18 |
37 | 37 | { |
38 | 38 | |
39 | - /** |
|
40 | - * Class Constructor. |
|
41 | - * |
|
42 | - * @return void |
|
43 | - */ |
|
44 | - public function __construct() |
|
45 | - { |
|
39 | + /** |
|
40 | + * Class Constructor. |
|
41 | + * |
|
42 | + * @return void |
|
43 | + */ |
|
44 | + public function __construct() |
|
45 | + { |
|
46 | 46 | |
47 | - add_action('plugins_loaded', array( $this, 'subwayLocalizePlugin' )); |
|
47 | + add_action('plugins_loaded', array( $this, 'subwayLocalizePlugin' )); |
|
48 | 48 | |
49 | - return; |
|
50 | - } |
|
49 | + return; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Subway l8n callback. |
|
54 | - * |
|
55 | - * @return void |
|
56 | - */ |
|
57 | - public function subwayLocalizePlugin() |
|
58 | - { |
|
52 | + /** |
|
53 | + * Subway l8n callback. |
|
54 | + * |
|
55 | + * @return void |
|
56 | + */ |
|
57 | + public function subwayLocalizePlugin() |
|
58 | + { |
|
59 | 59 | |
60 | - $rel_path = SUBWAY_DIR_PATH . 'languages'; |
|
60 | + $rel_path = SUBWAY_DIR_PATH . 'languages'; |
|
61 | 61 | |
62 | - load_plugin_textdomain('subway', false, $rel_path); |
|
62 | + load_plugin_textdomain('subway', false, $rel_path); |
|
63 | 63 | |
64 | - return; |
|
65 | - } |
|
64 | + return; |
|
65 | + } |
|
66 | 66 | |
67 | 67 | } |
68 | 68 |
@@ -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 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | public function __construct() |
45 | 45 | { |
46 | 46 | |
47 | - add_action('plugins_loaded', array( $this, 'subwayLocalizePlugin' )); |
|
47 | + add_action('plugins_loaded', array($this, 'subwayLocalizePlugin')); |
|
48 | 48 | |
49 | 49 | return; |
50 | 50 | } |
@@ -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> |
@@ -17,17 +17,17 @@ discard block |
||
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 | $args = array( |
25 | 25 | 'echo' => true, |
26 | 26 | 'form_id' => 'loginform', |
27 | - 'label_username' => __( 'Username', 'subway' ), |
|
28 | - 'label_password' => __( 'Password', 'subway' ), |
|
29 | - 'label_remember' => __( 'Remember Me', 'subway' ), |
|
30 | - 'label_log_in' => __( 'Log In', 'subway' ), |
|
27 | + 'label_username' => __('Username', 'subway'), |
|
28 | + 'label_password' => __('Password', 'subway'), |
|
29 | + 'label_remember' => __('Remember Me', 'subway'), |
|
30 | + 'label_log_in' => __('Log In', 'subway'), |
|
31 | 31 | 'id_username' => 'user_login', |
32 | 32 | 'id_password' => 'user_pass', |
33 | 33 | 'id_remember' => 'rememberme', |
@@ -42,100 +42,100 @@ discard block |
||
42 | 42 | |
43 | 43 | $message_types = array(); |
44 | 44 | |
45 | -$http_request_login = filter_input( INPUT_GET, 'login', FILTER_SANITIZE_SPECIAL_CHARS ); |
|
45 | +$http_request_login = filter_input(INPUT_GET, 'login', FILTER_SANITIZE_SPECIAL_CHARS); |
|
46 | 46 | |
47 | -$http_request_type = filter_input( INPUT_GET, 'type', FILTER_SANITIZE_SPECIAL_CHARS ); |
|
47 | +$http_request_type = filter_input(INPUT_GET, 'type', FILTER_SANITIZE_SPECIAL_CHARS); |
|
48 | 48 | |
49 | -$http_request_logout = filter_input( INPUT_GET, 'loggedout', FILTER_SANITIZE_SPECIAL_CHARS ); |
|
49 | +$http_request_logout = filter_input(INPUT_GET, 'loggedout', FILTER_SANITIZE_SPECIAL_CHARS); |
|
50 | 50 | |
51 | -if ( isset( $http_request_login ) ) { |
|
51 | +if (isset($http_request_login)) { |
|
52 | 52 | |
53 | - if ( 'failed' === $http_request_login ) { |
|
53 | + if ('failed' === $http_request_login) { |
|
54 | 54 | |
55 | - if ( isset( $http_request_type ) ) { |
|
55 | + if (isset($http_request_type)) { |
|
56 | 56 | |
57 | 57 | $message_types = array( |
58 | 58 | |
59 | 59 | 'default' => array( |
60 | - 'message' => __( 'There was an error trying to sign-in to your account. Make sure the credentials below are correct.', 'subway' ), |
|
60 | + 'message' => __('There was an error trying to sign-in to your account. Make sure the credentials below are correct.', 'subway'), |
|
61 | 61 | ), |
62 | 62 | '__blank' => array( |
63 | - 'message' => __( 'Required: Username and Password cannot be empty.', 'subway' ), |
|
63 | + 'message' => __('Required: Username and Password cannot be empty.', 'subway'), |
|
64 | 64 | ), |
65 | 65 | '__userempty' => array( |
66 | - 'message' => __( 'Required: Username cannot be empty.', 'subway' ), |
|
66 | + 'message' => __('Required: Username cannot be empty.', 'subway'), |
|
67 | 67 | ), |
68 | 68 | '__passempty' => array( |
69 | - 'message' => __( 'Required: Password cannot be empty.', 'subway' ), |
|
69 | + 'message' => __('Required: Password cannot be empty.', 'subway'), |
|
70 | 70 | ), |
71 | 71 | 'fb_invalid_email' => array( |
72 | - 'message' => __( 'Facebook email address is invalid or is not yet verified.', 'subway' ), |
|
72 | + 'message' => __('Facebook email address is invalid or is not yet verified.', 'subway'), |
|
73 | 73 | ), |
74 | 74 | 'fb_error' => array( |
75 | - 'message' => __( 'Facebook Application Error. Misconfigured or App is rejected.', 'subway' ), |
|
75 | + 'message' => __('Facebook Application Error. Misconfigured or App is rejected.', 'subway'), |
|
76 | 76 | ), |
77 | 77 | 'app_not_live' => array( |
78 | - 'message' => __( 'Unable to fetch your Facebook Profile.', 'subway' ), |
|
78 | + 'message' => __('Unable to fetch your Facebook Profile.', 'subway'), |
|
79 | 79 | ), |
80 | 80 | 'gears_username_or_email_exists' => array( |
81 | - 'message' => __( 'Username or email address already exists', 'subway' ), |
|
81 | + 'message' => __('Username or email address already exists', 'subway'), |
|
82 | 82 | ), |
83 | 83 | 'gp_error_authentication' => array( |
84 | - 'message' => __( 'Google Plus Authentication Error. Invalid Client ID or Secret.', 'subway' ), |
|
84 | + 'message' => __('Google Plus Authentication Error. Invalid Client ID or Secret.', 'subway'), |
|
85 | 85 | ), |
86 | 86 | ); |
87 | 87 | |
88 | 88 | $message = $message_types['default']['message']; |
89 | 89 | |
90 | - if ( array_key_exists( $http_request_type, $message_types ) ) { |
|
90 | + if (array_key_exists($http_request_type, $message_types)) { |
|
91 | 91 | |
92 | - $message = $message_types[ $http_request_type ]['message']; |
|
92 | + $message = $message_types[$http_request_type]['message']; |
|
93 | 93 | |
94 | 94 | } |
95 | 95 | |
96 | - $error_login_message = '<div id="message" class="error">' . esc_html( $message ) . '</div>'; |
|
96 | + $error_login_message = '<div id="message" class="error">' . esc_html($message) . '</div>'; |
|
97 | 97 | |
98 | 98 | } else { |
99 | 99 | |
100 | - $error_login_message = '<div id="message" class="error">' . esc_html__( 'Error: Invalid username and password combination.', 'subway' ) . '</div>'; |
|
100 | + $error_login_message = '<div id="message" class="error">' . esc_html__('Error: Invalid username and password combination.', 'subway') . '</div>'; |
|
101 | 101 | |
102 | 102 | } |
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
106 | -if ( isset( $http_request_logout ) ) { |
|
107 | - $error_login_message = '<div id="message" class="success">' . esc_html__( 'You have logged out successfully.', 'subway' ) . '</div>'; |
|
106 | +if (isset($http_request_logout)) { |
|
107 | + $error_login_message = '<div id="message" class="success">' . esc_html__('You have logged out successfully.', 'subway') . '</div>'; |
|
108 | 108 | } |
109 | 109 | |
110 | -$http_request_redirected = filter_input( INPUT_GET, '_redirected', FILTER_SANITIZE_SPECIAL_CHARS ); |
|
110 | +$http_request_redirected = filter_input(INPUT_GET, '_redirected', FILTER_SANITIZE_SPECIAL_CHARS); |
|
111 | 111 | |
112 | -if ( isset( $http_request_redirected ) ) { |
|
113 | - $error_login_message = '<div id="message" class="success">' . esc_html__( 'Members only page. Please use the login form below to access the page.', 'subway' ) . '</div>'; |
|
112 | +if (isset($http_request_redirected)) { |
|
113 | + $error_login_message = '<div id="message" class="success">' . esc_html__('Members only page. Please use the login form below to access the page.', 'subway') . '</div>'; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | ?> |
117 | -<?php if ( ! is_user_logged_in() ) { ?> |
|
117 | +<?php if ( ! is_user_logged_in()) { ?> |
|
118 | 118 | <div class="mg-top-35 mg-bottom-35 subway-login-form"> |
119 | 119 | <div class="subway-login-form-form"> |
120 | 120 | <div class="subway-login-form__actions"> |
121 | 121 | <h3> |
122 | - <?php esc_html_e( 'Account Sign-in', 'subway' ); ?> |
|
122 | + <?php esc_html_e('Account Sign-in', 'subway'); ?> |
|
123 | 123 | </h3> |
124 | - <?php do_action( 'gears_login_form' ); ?> |
|
124 | + <?php do_action('gears_login_form'); ?> |
|
125 | 125 | </div> |
126 | 126 | <div class="subway-login-form-message"> |
127 | - <?php echo wp_kses_post( $error_login_message ); ?> |
|
127 | + <?php echo wp_kses_post($error_login_message); ?> |
|
128 | 128 | </div> |
129 | 129 | <div class="subway-login-form__form"> |
130 | - <?php echo wp_login_form( $args ); ?> |
|
130 | + <?php echo wp_login_form($args); ?> |
|
131 | 131 | </div> |
132 | 132 | </div> |
133 | 133 | </div> |
134 | 134 | <?php } else { ?> |
135 | 135 | <div class="mg-top-35 mg-bottom-35 subway-login-sucessfull" style="background: #CDDC39; padding: 15px 15px 15px 15px;border-radius: 4px;color: #616161;"> |
136 | 136 | <p style="margin-bottom: 0px;"> |
137 | - <?php $success_message = apply_filters( 'subway_login_message_success', esc_html__( 'Great! You have succesfully login.', 'subway' ) ); ?> |
|
138 | - <?php echo esc_html( $success_message ); ?> |
|
137 | + <?php $success_message = apply_filters('subway_login_message_success', esc_html__('Great! You have succesfully login.', 'subway')); ?> |
|
138 | + <?php echo esc_html($success_message); ?> |
|
139 | 139 | </p> |
140 | 140 | </div> |
141 | 141 | <?php } ?> |