@@ -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,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 |
@@ -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( $atts ) |
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,166 +36,166 @@ 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; |
|
62 | - |
|
63 | - if (null === $instance ) { |
|
64 | - |
|
65 | - $instance = new Shortcodes(); |
|
66 | - |
|
67 | - } |
|
68 | - |
|
69 | - return $instance; |
|
70 | - |
|
71 | - } |
|
72 | - |
|
73 | - /** |
|
74 | - * Instantiate our class. |
|
75 | - * |
|
76 | - * @return void |
|
77 | - */ |
|
78 | - public function register() |
|
79 | - { |
|
80 | - |
|
81 | - add_shortcode('subway_login', array( $this, 'loginForm' )); |
|
82 | - |
|
83 | - add_action('login_form_middle', array( $this, 'loginFormAction' ), 10, 2); |
|
84 | - |
|
85 | - add_action('login_form_middle', array( $this, 'lostPasswordLink' ), 10, 2); |
|
86 | - |
|
87 | - return; |
|
88 | - |
|
89 | - } |
|
90 | - |
|
91 | - /** |
|
92 | - * Displays the login form |
|
93 | - * |
|
94 | - * @return void |
|
95 | - */ |
|
96 | - public function loginForm( $atts ) |
|
97 | - { |
|
98 | - $atts = shortcode_atts( array( |
|
99 | - 'echo' => true, |
|
100 | - 'form_id' => 'loginform', |
|
101 | - 'label_username' => __( 'Username', 'subway' ), |
|
102 | - 'label_password' => __( 'Password', 'subway' ), |
|
103 | - 'label_remember' => __( 'Remember Me', 'subway' ), |
|
104 | - 'label_log_in' => __( 'Log In', 'subway' ), |
|
105 | - 'id_username' => 'user_login', |
|
106 | - 'id_password' => 'user_pass', |
|
107 | - 'id_remember' => 'rememberme', |
|
108 | - 'id_submit' => 'wp-submit', |
|
109 | - 'remember' => true, |
|
110 | - 'value_username' => '', |
|
111 | - 'value_remember' => false, |
|
112 | - 'redirect' => home_url(), |
|
113 | - ), $atts ); |
|
114 | - |
|
115 | - return $this->renderTemplate($atts, 'login-form.php'); |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * Include the specific plugin file if there is no template file. |
|
120 | - * |
|
121 | - * @param mixed $atts The shortcode attribute. |
|
122 | - * @param string $file The shortcode template file. |
|
123 | - * |
|
124 | - * @return string The html template content. |
|
125 | - */ |
|
126 | - protected function renderTemplate( $atts, $file = '' ) |
|
127 | - { |
|
128 | - |
|
129 | - ob_start(); |
|
130 | - |
|
131 | - if (empty($file) ) { |
|
61 | + static $instance = null; |
|
62 | + |
|
63 | + if (null === $instance ) { |
|
64 | + |
|
65 | + $instance = new Shortcodes(); |
|
66 | + |
|
67 | + } |
|
68 | + |
|
69 | + return $instance; |
|
70 | + |
|
71 | + } |
|
72 | + |
|
73 | + /** |
|
74 | + * Instantiate our class. |
|
75 | + * |
|
76 | + * @return void |
|
77 | + */ |
|
78 | + public function register() |
|
79 | + { |
|
80 | + |
|
81 | + add_shortcode('subway_login', array( $this, 'loginForm' )); |
|
82 | + |
|
83 | + add_action('login_form_middle', array( $this, 'loginFormAction' ), 10, 2); |
|
84 | + |
|
85 | + add_action('login_form_middle', array( $this, 'lostPasswordLink' ), 10, 2); |
|
86 | + |
|
87 | + return; |
|
88 | + |
|
89 | + } |
|
90 | + |
|
91 | + /** |
|
92 | + * Displays the login form |
|
93 | + * |
|
94 | + * @return void |
|
95 | + */ |
|
96 | + public function loginForm( $atts ) |
|
97 | + { |
|
98 | + $atts = shortcode_atts( array( |
|
99 | + 'echo' => true, |
|
100 | + 'form_id' => 'loginform', |
|
101 | + 'label_username' => __( 'Username', 'subway' ), |
|
102 | + 'label_password' => __( 'Password', 'subway' ), |
|
103 | + 'label_remember' => __( 'Remember Me', 'subway' ), |
|
104 | + 'label_log_in' => __( 'Log In', 'subway' ), |
|
105 | + 'id_username' => 'user_login', |
|
106 | + 'id_password' => 'user_pass', |
|
107 | + 'id_remember' => 'rememberme', |
|
108 | + 'id_submit' => 'wp-submit', |
|
109 | + 'remember' => true, |
|
110 | + 'value_username' => '', |
|
111 | + 'value_remember' => false, |
|
112 | + 'redirect' => home_url(), |
|
113 | + ), $atts ); |
|
114 | + |
|
115 | + return $this->renderTemplate($atts, 'login-form.php'); |
|
116 | + } |
|
117 | + |
|
118 | + /** |
|
119 | + * Include the specific plugin file if there is no template file. |
|
120 | + * |
|
121 | + * @param mixed $atts The shortcode attribute. |
|
122 | + * @param string $file The shortcode template file. |
|
123 | + * |
|
124 | + * @return string The html template content. |
|
125 | + */ |
|
126 | + protected function renderTemplate( $atts, $file = '' ) |
|
127 | + { |
|
128 | + |
|
129 | + ob_start(); |
|
130 | + |
|
131 | + if (empty($file) ) { |
|
132 | 132 | |
133 | - return; |
|
133 | + return; |
|
134 | 134 | |
135 | - } |
|
135 | + } |
|
136 | 136 | |
137 | - $template = SUBWAY_DIR_PATH . 'templates/'.$file; |
|
137 | + $template = SUBWAY_DIR_PATH . 'templates/'.$file; |
|
138 | 138 | |
139 | - if (file_exists($template) ) { |
|
139 | + if (file_exists($template) ) { |
|
140 | 140 | |
141 | - $theme_template = locate_template(array('gears/shortcodes/'.$file )); |
|
141 | + $theme_template = locate_template(array('gears/shortcodes/'.$file )); |
|
142 | 142 | |
143 | - if ($theme_template) { |
|
143 | + if ($theme_template) { |
|
144 | 144 | |
145 | - $template = $theme_template; |
|
145 | + $template = $theme_template; |
|
146 | 146 | |
147 | - } |
|
147 | + } |
|
148 | 148 | |
149 | - include $template; |
|
149 | + include $template; |
|
150 | 150 | |
151 | - } else { |
|
151 | + } else { |
|
152 | 152 | |
153 | - echo sprintf( |
|
154 | - esc_html_e( |
|
155 | - 'Subway Error: Unable to find template file in: %1s', 'subway' |
|
156 | - ), |
|
157 | - $template |
|
158 | - ); |
|
153 | + echo sprintf( |
|
154 | + esc_html_e( |
|
155 | + 'Subway Error: Unable to find template file in: %1s', 'subway' |
|
156 | + ), |
|
157 | + $template |
|
158 | + ); |
|
159 | 159 | |
160 | - } |
|
160 | + } |
|
161 | 161 | |
162 | - return ob_get_clean(); |
|
163 | - } |
|
162 | + return ob_get_clean(); |
|
163 | + } |
|
164 | 164 | |
165 | - /** |
|
166 | - * The action for our login form. |
|
167 | - * |
|
168 | - * @param string $__content The current filtered contents. |
|
169 | - * |
|
170 | - * @return string The content of our login form action. |
|
171 | - */ |
|
172 | - public function loginFormAction( $__content ) |
|
173 | - { |
|
165 | + /** |
|
166 | + * The action for our login form. |
|
167 | + * |
|
168 | + * @param string $__content The current filtered contents. |
|
169 | + * |
|
170 | + * @return string The content of our login form action. |
|
171 | + */ |
|
172 | + public function loginFormAction( $__content ) |
|
173 | + { |
|
174 | 174 | |
175 | - ob_start(); |
|
175 | + ob_start(); |
|
176 | 176 | |
177 | - do_action('login_form'); |
|
177 | + do_action('login_form'); |
|
178 | 178 | |
179 | - return $__content . ob_get_clean(); |
|
180 | - |
|
181 | - } |
|
182 | - |
|
183 | - /** |
|
184 | - * The action for our 'lost password' link. |
|
185 | - * |
|
186 | - * @param string $content The current filtered contents. |
|
187 | - * |
|
188 | - * @return string The content of our lost password link. |
|
189 | - */ |
|
190 | - public function lostPasswordLink( $content ) |
|
191 | - { |
|
179 | + return $__content . ob_get_clean(); |
|
180 | + |
|
181 | + } |
|
182 | + |
|
183 | + /** |
|
184 | + * The action for our 'lost password' link. |
|
185 | + * |
|
186 | + * @param string $content The current filtered contents. |
|
187 | + * |
|
188 | + * @return string The content of our lost password link. |
|
189 | + */ |
|
190 | + public function lostPasswordLink( $content ) |
|
191 | + { |
|
192 | 192 | |
193 | - return $content . $this->renderTemplate( |
|
194 | - array(), |
|
195 | - 'login-form-lost-password.php' |
|
196 | - ); |
|
193 | + return $content . $this->renderTemplate( |
|
194 | + array(), |
|
195 | + 'login-form-lost-password.php' |
|
196 | + ); |
|
197 | 197 | |
198 | - } |
|
198 | + } |
|
199 | 199 | |
200 | 200 | } |
201 | 201 |
@@ -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 | |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @return void |
95 | 95 | */ |
96 | - public function loginForm( $atts ) |
|
96 | + public function loginForm($atts) |
|
97 | 97 | { |
98 | - $atts = shortcode_atts( array( |
|
98 | + $atts = shortcode_atts(array( |
|
99 | 99 | 'echo' => true, |
100 | 100 | 'form_id' => 'loginform', |
101 | - 'label_username' => __( 'Username', 'subway' ), |
|
102 | - 'label_password' => __( 'Password', 'subway' ), |
|
103 | - 'label_remember' => __( 'Remember Me', 'subway' ), |
|
104 | - 'label_log_in' => __( 'Log In', 'subway' ), |
|
101 | + 'label_username' => __('Username', 'subway'), |
|
102 | + 'label_password' => __('Password', 'subway'), |
|
103 | + 'label_remember' => __('Remember Me', 'subway'), |
|
104 | + 'label_log_in' => __('Log In', 'subway'), |
|
105 | 105 | 'id_username' => 'user_login', |
106 | 106 | 'id_password' => 'user_pass', |
107 | 107 | 'id_remember' => 'rememberme', |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | 'value_username' => '', |
111 | 111 | 'value_remember' => false, |
112 | 112 | 'redirect' => home_url(), |
113 | - ), $atts ); |
|
113 | + ), $atts); |
|
114 | 114 | |
115 | 115 | return $this->renderTemplate($atts, 'login-form.php'); |
116 | 116 | } |
@@ -123,22 +123,22 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return string The html template content. |
125 | 125 | */ |
126 | - protected function renderTemplate( $atts, $file = '' ) |
|
126 | + protected function renderTemplate($atts, $file = '') |
|
127 | 127 | { |
128 | 128 | |
129 | 129 | ob_start(); |
130 | 130 | |
131 | - if (empty($file) ) { |
|
131 | + if (empty($file)) { |
|
132 | 132 | |
133 | 133 | return; |
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | - $template = SUBWAY_DIR_PATH . 'templates/'.$file; |
|
137 | + $template = SUBWAY_DIR_PATH . 'templates/' . $file; |
|
138 | 138 | |
139 | - if (file_exists($template) ) { |
|
139 | + if (file_exists($template)) { |
|
140 | 140 | |
141 | - $theme_template = locate_template(array('gears/shortcodes/'.$file )); |
|
141 | + $theme_template = locate_template(array('gears/shortcodes/' . $file)); |
|
142 | 142 | |
143 | 143 | if ($theme_template) { |
144 | 144 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @return string The content of our login form action. |
171 | 171 | */ |
172 | - public function loginFormAction( $__content ) |
|
172 | + public function loginFormAction($__content) |
|
173 | 173 | { |
174 | 174 | |
175 | 175 | ob_start(); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * |
188 | 188 | * @return string The content of our lost password link. |
189 | 189 | */ |
190 | - public function lostPasswordLink( $content ) |
|
190 | + public function lostPasswordLink($content) |
|
191 | 191 | { |
192 | 192 | |
193 | 193 | return $content . $this->renderTemplate( |
@@ -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,32 +36,32 @@ 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 | - load_plugin_textdomain('subway', false, basename( dirname( __FILE__ ) ) . '/languages' ); |
|
60 | + load_plugin_textdomain('subway', false, basename( dirname( __FILE__ ) ) . '/languages' ); |
|
61 | 61 | |
62 | - return; |
|
62 | + return; |
|
63 | 63 | |
64 | - } |
|
64 | + } |
|
65 | 65 | |
66 | 66 | } |
67 | 67 |
@@ -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 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | public function subwayLocalizePlugin() |
58 | 58 | { |
59 | 59 | |
60 | - load_plugin_textdomain('subway', false, basename( dirname( __FILE__ ) ) . '/languages' ); |
|
60 | + load_plugin_textdomain('subway', false, basename(dirname(__FILE__)) . '/languages'); |
|
61 | 61 | |
62 | 62 | return; |
63 | 63 |
@@ -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 | |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | <!-- Page --> |
27 | 27 | <label for="subway_use_page"> |
28 | 28 | |
29 | - <input <?php checked( 'page', get_option( 'subway_redirect_type' ), true ); ?> value="page" name="subway_redirect_type" id="subway_use_page" type="radio" class="code" /> |
|
29 | + <input <?php checked('page', get_option('subway_redirect_type'), true); ?> value="page" name="subway_redirect_type" id="subway_use_page" type="radio" class="code" /> |
|
30 | 30 | |
31 | - <?php esc_html_e( 'Custom Page', 'subway' ); ?> |
|
31 | + <?php esc_html_e('Custom Page', 'subway'); ?> |
|
32 | 32 | |
33 | 33 | </label> |
34 | 34 | |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | |
37 | 37 | <label for="subway_use_custom_url"> |
38 | 38 | |
39 | - <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" /> |
|
39 | + <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" /> |
|
40 | 40 | |
41 | - <?php esc_html_e( 'Custom URL', 'subway' ); ?> |
|
41 | + <?php esc_html_e('Custom URL', 'subway'); ?> |
|
42 | 42 | |
43 | 43 | </label> |
44 | 44 | |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | |
47 | 47 | <label for="subway_use_default"> |
48 | 48 | |
49 | - <input <?php checked( 'default', get_option( 'subway_redirect_type' ), true ); ?> value="default" name="subway_redirect_type" id="subway_use_default" type="radio" class="code" /> |
|
49 | + <input <?php checked('default', get_option('subway_redirect_type'), true); ?> value="default" name="subway_redirect_type" id="subway_use_default" type="radio" class="code" /> |
|
50 | 50 | |
51 | - <?php esc_html_e( 'Default Behavior', 'subway' ); ?> |
|
51 | + <?php esc_html_e('Default Behavior', 'subway'); ?> |
|
52 | 52 | |
53 | 53 | </label> |
54 | 54 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | <div id="subway_redirect_page_option_section" class="hidden subway-redirect-option-section"> |
65 | 65 | |
66 | 66 | <label for="subway_redirect_page_id"> |
67 | - <?php esc_html_e( 'Select Page' ); ?> |
|
67 | + <?php esc_html_e('Select Page'); ?> |
|
68 | 68 | </label> |
69 | 69 | |
70 | 70 | <?php |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | wp_dropdown_pages( |
73 | 73 | array( |
74 | 74 | 'name' => 'subway_redirect_page_id', |
75 | - 'selected' => intval( get_option( 'subway_redirect_page_id' ) ), |
|
76 | - 'show_option_none' => esc_html__( '-', 'subway' ), |
|
75 | + 'selected' => intval(get_option('subway_redirect_page_id')), |
|
76 | + 'show_option_none' => esc_html__('-', 'subway'), |
|
77 | 77 | ) |
78 | 78 | ); |
79 | 79 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | <p class="description"> |
83 | 83 | |
84 | - <?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' ); ?> |
|
84 | + <?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'); ?> |
|
85 | 85 | |
86 | 86 | </p> |
87 | 87 | |
@@ -90,29 +90,29 @@ discard block |
||
90 | 90 | <div id="subway_redirect_custom_url_option_section" class="hidden subway-redirect-option-section"> |
91 | 91 | |
92 | 92 | <label for="subway_redirect_custom_url"> |
93 | - <?php esc_attr_e( 'Enter Redirect URL:', 'subway' ); ?> |
|
93 | + <?php esc_attr_e('Enter Redirect URL:', 'subway'); ?> |
|
94 | 94 | </label> |
95 | 95 | |
96 | - <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' ); ?>" |
|
96 | + <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'); ?>" |
|
97 | 97 | id="subway_redirect_custom_url" size="75" /> |
98 | 98 | |
99 | 99 | <p class="description"><br> |
100 | 100 | |
101 | 101 | <?php |
102 | - 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%' ); |
|
102 | + 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%'); |
|
103 | 103 | ?> |
104 | 104 | |
105 | 105 | </p><br> |
106 | 106 | |
107 | 107 | <p class="description"> |
108 | 108 | |
109 | - <?php esc_attr_e( 'Leave empty to use existing WordPress or other 3rd party plugin redirect option.', 'subway' ); ?> |
|
109 | + <?php esc_attr_e('Leave empty to use existing WordPress or other 3rd party plugin redirect option.', 'subway'); ?> |
|
110 | 110 | |
111 | 111 | </p><br> |
112 | 112 | |
113 | 113 | <p class="description"> |
114 | 114 | |
115 | - <?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' ); ?> |
|
115 | + <?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'); ?> |
|
116 | 116 | |
117 | 117 | </p> |
118 | 118 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | <div id="subway_redirect_default_option_section" class="hidden subway-redirect-option-section"> |
123 | 123 | <p> |
124 | 124 | <?php |
125 | - 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' ); |
|
125 | + 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'); |
|
126 | 126 | ?> |
127 | 127 | </p> |
128 | 128 | </div> |
@@ -10,16 +10,16 @@ |
||
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_deprecated" rows="5" cols="95" readonly="readonly">' . esc_attr( trim( get_option( 'subway_public_post' ) ) ) . '</textarea>'; |
|
19 | + echo '<textarea id="subway_public_post" name="subway_public_post_deprecated" rows="5" cols="95" readonly="readonly">' . 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' ) ); |
|
22 | - echo '<span class="subway-settings-notice">' . nl2br( esc_html( ' This setting is now disabled on Subway 2.0.9 and future versions. To make your post/page private, go to your individual post/page and check the "Subway: Visibility Option" checkbox.', 'subway' ) ) . '</span>' . '</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')); |
|
22 | + echo '<span class="subway-settings-notice">' . nl2br(esc_html(' This setting is now disabled on Subway 2.0.9 and future versions. To make your post/page private, go to your individual post/page and check the "Subway: Visibility Option" checkbox.', 'subway')) . '</span>' . '</p>'; |
|
23 | 23 | |
24 | 24 | return; |
25 | 25 |
@@ -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'; |
@@ -96,23 +96,23 @@ discard block |
||
96 | 96 | require_once SUBWAY_DIR_PATH . 'shortcodes/subway-shortcodes.php'; |
97 | 97 | |
98 | 98 | // Redirect (302) all front-end request to the login page. |
99 | -add_action( 'wp', array( 'Subway\PageRedirect', 'index' ) ); |
|
99 | +add_action('wp', array('Subway\PageRedirect', 'index')); |
|
100 | 100 | |
101 | 101 | // Redirect (302) invalid login request to the login page. |
102 | -add_action( 'wp_ajax_nopriv_subway_logging_in', array( 'Subway\AuthRedirect', 'handleAuthentication' ) ); |
|
102 | +add_action('wp_ajax_nopriv_subway_logging_in', array('Subway\AuthRedirect', 'handleAuthentication')); |
|
103 | 103 | |
104 | 104 | // Load our JS and CSS files. |
105 | -add_action( 'wp_enqueue_scripts', array( 'Subway\Enqueue', 'registerJs' ) ); |
|
105 | +add_action('wp_enqueue_scripts', array('Subway\Enqueue', 'registerJs')); |
|
106 | 106 | |
107 | 107 | // Change the default login url to our sign-in page. |
108 | -add_filter( 'login_url', array( 'Subway\AuthRedirect', 'loginUrl' ), 10, 3 ); |
|
108 | +add_filter('login_url', array('Subway\AuthRedirect', 'loginUrl'), 10, 3); |
|
109 | 109 | |
110 | 110 | // Redirect the user after successful logged in to the right page. |
111 | 111 | // Does not trigger when using ajax form. Only on default wp-login.php and wp_login_form(). |
112 | -add_filter( 'login_redirect', array( 'Subway\AuthRedirect', 'getLoginRedirectUrl' ), 10, 3 ); |
|
112 | +add_filter('login_redirect', array('Subway\AuthRedirect', 'getLoginRedirectUrl'), 10, 3); |
|
113 | 113 | |
114 | 114 | // Change the default logout url to our sign-in page. |
115 | -add_action( 'wp_logout', array( 'Subway\AuthRedirect', 'logoutUrl' ), 10, 3 ); |
|
115 | +add_action('wp_logout', array('Subway\AuthRedirect', 'logoutUrl'), 10, 3); |
|
116 | 116 | |
117 | 117 | // Adds the Subvway metabox. |
118 | -add_action( 'plugins_loaded', array( 'Subway\Metabox', 'initMetabox' ) ); |
|
118 | +add_action('plugins_loaded', array('Subway\Metabox', 'initMetabox')); |
@@ -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,10 +58,10 @@ 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 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueueSettingsScripts' ) ); |
|
64 | + add_action('admin_enqueue_scripts', array($this, 'enqueueSettingsScripts')); |
|
65 | 65 | |
66 | 66 | return; |
67 | 67 | } |
@@ -77,19 +77,19 @@ discard block |
||
77 | 77 | // Register our settings section. |
78 | 78 | add_settings_section( |
79 | 79 | 'subway-page-visibility-section', __('Pages Visibility', 'subway'), |
80 | - array( $this, 'sectionCallback' ), 'subway-settings-section' |
|
80 | + array($this, 'sectionCallback'), 'subway-settings-section' |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | // Register Redirect Options pages. |
84 | 84 | add_settings_section( |
85 | 85 | 'subway-redirect-section', __('Redirect Options', 'subway'), |
86 | - array( $this, 'redirectCallback' ), 'subway-settings-section' |
|
86 | + array($this, 'redirectCallback'), 'subway-settings-section' |
|
87 | 87 | ); |
88 | 88 | |
89 | 89 | $is_public_site = Options::isPublicSite(); |
90 | 90 | $hidden_class = ''; |
91 | 91 | |
92 | - if ( $is_public_site ) { |
|
92 | + if ($is_public_site) { |
|
93 | 93 | $hidden_class = 'hidden'; |
94 | 94 | } |
95 | 95 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | ), |
155 | 155 | ); |
156 | 156 | |
157 | - foreach ( $fields as $field ) { |
|
157 | + foreach ($fields as $field) { |
|
158 | 158 | |
159 | 159 | add_settings_field( |
160 | 160 | $field['id'], $field['label'], |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | public function registerSettingsScripts() { |
240 | 240 | |
241 | 241 | // Registers the Subway settings Javascript. |
242 | - wp_register_script( 'subway-settings-script', plugins_url('/assets/js/settings.js', __FILE__) ); |
|
243 | - wp_register_style( 'subway-settings-style', plugins_url('/assets/css/settings.css', __FILE__) ); |
|
242 | + wp_register_script('subway-settings-script', plugins_url('/assets/js/settings.js', __FILE__)); |
|
243 | + wp_register_style('subway-settings-style', plugins_url('/assets/css/settings.css', __FILE__)); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -251,12 +251,12 @@ discard block |
||
251 | 251 | * @return void |
252 | 252 | * @return void |
253 | 253 | */ |
254 | - public function enqueueSettingsScripts( $hook ) { |
|
254 | + public function enqueueSettingsScripts($hook) { |
|
255 | 255 | // Checks if page hook is Subway settings page. |
256 | - if ( 'settings_page_subway' === $hook ) { |
|
256 | + if ('settings_page_subway' === $hook) { |
|
257 | 257 | // Enqueues the script only on the Subway Settings page. |
258 | - wp_enqueue_script( 'subway-settings-script' ); |
|
259 | - wp_enqueue_style( 'subway-settings-style' ); |
|
258 | + wp_enqueue_script('subway-settings-script'); |
|
259 | + wp_enqueue_style('subway-settings-style'); |
|
260 | 260 | } |
261 | 261 | } |
262 | 262 | } |
@@ -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,55 +36,55 @@ 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' )); |
|
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 | |
51 | - /** |
|
52 | - * Display 'Subway' link under 'Settings' |
|
53 | - * |
|
54 | - * @return void |
|
55 | - */ |
|
56 | - public function adminMenu() |
|
57 | - { |
|
51 | + /** |
|
52 | + * Display 'Subway' link under 'Settings' |
|
53 | + * |
|
54 | + * @return void |
|
55 | + */ |
|
56 | + public function adminMenu() |
|
57 | + { |
|
58 | 58 | |
59 | - add_options_page( |
|
60 | - 'Subway Settings', 'Subway', 'manage_options', |
|
61 | - 'subway', array( $this, 'optionsPage' ) |
|
62 | - ); |
|
59 | + add_options_page( |
|
60 | + 'Subway Settings', 'Subway', 'manage_options', |
|
61 | + 'subway', array( $this, 'optionsPage' ) |
|
62 | + ); |
|
63 | 63 | |
64 | 64 | add_action( 'admin_enqueue_scripts', array( $this, 'enqueueSettingsScripts' ) ); |
65 | 65 | |
66 | - return; |
|
67 | - } |
|
68 | - |
|
69 | - /** |
|
70 | - * Registers all settings related to Subway. |
|
71 | - * |
|
72 | - * @return void |
|
73 | - */ |
|
74 | - public function registerSettings() |
|
75 | - { |
|
76 | - |
|
77 | - // Register our settings section. |
|
78 | - add_settings_section( |
|
79 | - 'subway-page-visibility-section', __('Pages Visibility', 'subway'), |
|
80 | - array( $this, 'sectionCallback' ), 'subway-settings-section' |
|
81 | - ); |
|
82 | - |
|
83 | - // Register Redirect Options pages. |
|
84 | - add_settings_section( |
|
85 | - 'subway-redirect-section', __('Redirect Options', 'subway'), |
|
86 | - array( $this, 'redirectCallback' ), 'subway-settings-section' |
|
87 | - ); |
|
66 | + return; |
|
67 | + } |
|
68 | + |
|
69 | + /** |
|
70 | + * Registers all settings related to Subway. |
|
71 | + * |
|
72 | + * @return void |
|
73 | + */ |
|
74 | + public function registerSettings() |
|
75 | + { |
|
76 | + |
|
77 | + // Register our settings section. |
|
78 | + add_settings_section( |
|
79 | + 'subway-page-visibility-section', __('Pages Visibility', 'subway'), |
|
80 | + array( $this, 'sectionCallback' ), 'subway-settings-section' |
|
81 | + ); |
|
82 | + |
|
83 | + // Register Redirect Options pages. |
|
84 | + add_settings_section( |
|
85 | + 'subway-redirect-section', __('Redirect Options', 'subway'), |
|
86 | + array( $this, 'redirectCallback' ), 'subway-settings-section' |
|
87 | + ); |
|
88 | 88 | |
89 | 89 | $is_public_site = Options::isPublicSite(); |
90 | 90 | $hidden_class = ''; |
@@ -93,127 +93,127 @@ discard block |
||
93 | 93 | $hidden_class = 'hidden'; |
94 | 94 | } |
95 | 95 | |
96 | - // Register the fields. |
|
97 | - $fields = array( |
|
96 | + // Register the fields. |
|
97 | + $fields = array( |
|
98 | 98 | |
99 | - array( |
|
100 | - 'id' => 'subway_login_page', |
|
101 | - 'label' => __('Login Page', 'subway'), |
|
102 | - 'callback' => 'subway_login_page_form', |
|
103 | - 'section' => 'subway-settings-section', |
|
104 | - 'group' => 'subway-page-visibility-section', |
|
99 | + array( |
|
100 | + 'id' => 'subway_login_page', |
|
101 | + 'label' => __('Login Page', 'subway'), |
|
102 | + 'callback' => 'subway_login_page_form', |
|
103 | + 'section' => 'subway-settings-section', |
|
104 | + 'group' => 'subway-page-visibility-section', |
|
105 | 105 | 'args' => array( |
106 | 106 | 'label_for' => 'subway_login_page', |
107 | 107 | 'class' => 'subway_login_page-option', |
108 | 108 | ), |
109 | - ), |
|
110 | - array( |
|
111 | - 'id' => 'subway_public_post_deprecated', |
|
112 | - 'label' => __('Public Posts IDs', 'subway'), |
|
113 | - 'callback' => 'subway_public_post', |
|
114 | - 'section' => 'subway-settings-section', |
|
115 | - 'group' => 'subway-page-visibility-section', |
|
109 | + ), |
|
110 | + array( |
|
111 | + 'id' => 'subway_public_post_deprecated', |
|
112 | + 'label' => __('Public Posts IDs', 'subway'), |
|
113 | + 'callback' => 'subway_public_post', |
|
114 | + 'section' => 'subway-settings-section', |
|
115 | + 'group' => 'subway-page-visibility-section', |
|
116 | 116 | 'args' => array( |
117 | 117 | 'label_for' => 'subway_public_post_deprecated', |
118 | 118 | 'class' => 'subway_public_post_deprecated-option ' . $hidden_class, |
119 | 119 | ), |
120 | - ), |
|
121 | - array( |
|
122 | - 'id' => 'subway_is_public', |
|
123 | - 'label' => __('Public Website', 'subway'), |
|
124 | - 'callback' => 'subway_is_public_form', |
|
125 | - 'section' => 'subway-settings-section', |
|
126 | - 'group' => 'subway-page-visibility-section', |
|
127 | - 'args' => array( |
|
128 | - 'label_for' => 'subway_is_public', |
|
129 | - 'class' => 'subway_is_public-option', |
|
130 | - ), |
|
131 | - ), |
|
132 | - |
|
133 | - array( |
|
134 | - 'id' => 'subway_redirect_type', |
|
135 | - 'label' => __('Redirect Type', 'subway'), |
|
136 | - 'callback' => 'subway_redirect_option_form', |
|
137 | - 'section' => 'subway-settings-section', |
|
138 | - 'group' => 'subway-redirect-section', |
|
120 | + ), |
|
121 | + array( |
|
122 | + 'id' => 'subway_is_public', |
|
123 | + 'label' => __('Public Website', 'subway'), |
|
124 | + 'callback' => 'subway_is_public_form', |
|
125 | + 'section' => 'subway-settings-section', |
|
126 | + 'group' => 'subway-page-visibility-section', |
|
127 | + 'args' => array( |
|
128 | + 'label_for' => 'subway_is_public', |
|
129 | + 'class' => 'subway_is_public-option', |
|
130 | + ), |
|
131 | + ), |
|
132 | + |
|
133 | + array( |
|
134 | + 'id' => 'subway_redirect_type', |
|
135 | + 'label' => __('Redirect Type', 'subway'), |
|
136 | + 'callback' => 'subway_redirect_option_form', |
|
137 | + 'section' => 'subway-settings-section', |
|
138 | + 'group' => 'subway-redirect-section', |
|
139 | 139 | 'args' => array( |
140 | 140 | 'label_for' => 'subway_redirect_type', |
141 | 141 | 'class' => 'subway_redirect_type-option ', |
142 | 142 | ), |
143 | - ), |
|
144 | - array( |
|
145 | - 'id' => 'subway_redirect_wp_admin', |
|
146 | - 'label' => __('WP Login Link', 'subway'), |
|
147 | - 'callback' => 'subway_lock_wp_admin', |
|
148 | - 'section' => 'subway-settings-section', |
|
149 | - 'group' => 'subway-redirect-section', |
|
143 | + ), |
|
144 | + array( |
|
145 | + 'id' => 'subway_redirect_wp_admin', |
|
146 | + 'label' => __('WP Login Link', 'subway'), |
|
147 | + 'callback' => 'subway_lock_wp_admin', |
|
148 | + 'section' => 'subway-settings-section', |
|
149 | + 'group' => 'subway-redirect-section', |
|
150 | 150 | 'args' => array( |
151 | 151 | 'label_for' => 'subway_redirect_wp_admin', |
152 | 152 | 'class' => 'subway_redirect_wp_admin-option ', |
153 | 153 | ), |
154 | - ), |
|
155 | - ); |
|
154 | + ), |
|
155 | + ); |
|
156 | 156 | |
157 | - foreach ( $fields as $field ) { |
|
157 | + foreach ( $fields as $field ) { |
|
158 | 158 | |
159 | - add_settings_field( |
|
160 | - $field['id'], $field['label'], |
|
161 | - $field['callback'], $field['section'], |
|
162 | - $field['group'], $field['args'] |
|
163 | - ); |
|
159 | + add_settings_field( |
|
160 | + $field['id'], $field['label'], |
|
161 | + $field['callback'], $field['section'], |
|
162 | + $field['group'], $field['args'] |
|
163 | + ); |
|
164 | 164 | |
165 | - register_setting('subway-settings-group', $field['id']); |
|
165 | + register_setting('subway-settings-group', $field['id']); |
|
166 | 166 | |
167 | - $file = str_replace('_', '-', $field['callback']); |
|
167 | + $file = str_replace('_', '-', $field['callback']); |
|
168 | 168 | |
169 | - include_once trailingslashit(SUBWAY_DIR_PATH) . |
|
170 | - 'settings-fields/field-' . sanitize_title($file) . '.php'; |
|
169 | + include_once trailingslashit(SUBWAY_DIR_PATH) . |
|
170 | + 'settings-fields/field-' . sanitize_title($file) . '.php'; |
|
171 | 171 | |
172 | - } |
|
172 | + } |
|
173 | 173 | |
174 | - // Register Redirect Page ID Settings. |
|
175 | - register_setting('subway-settings-group', 'subway_redirect_page_id'); |
|
174 | + // Register Redirect Page ID Settings. |
|
175 | + register_setting('subway-settings-group', 'subway_redirect_page_id'); |
|
176 | 176 | |
177 | - // Register Redirect Custom URL Settings. |
|
178 | - register_setting('subway-settings-group', 'subway_redirect_custom_url'); |
|
177 | + // Register Redirect Custom URL Settings. |
|
178 | + register_setting('subway-settings-group', 'subway_redirect_custom_url'); |
|
179 | 179 | |
180 | 180 | $this->registerSettingsScripts(); |
181 | 181 | |
182 | - return; |
|
183 | - } |
|
184 | - |
|
185 | - /** |
|
186 | - * Callback function for the first Section. |
|
187 | - * |
|
188 | - * @return void |
|
189 | - */ |
|
190 | - public function sectionCallback() |
|
191 | - { |
|
192 | - echo esc_html_e( |
|
193 | - 'All settings related to the |
|
182 | + return; |
|
183 | + } |
|
184 | + |
|
185 | + /** |
|
186 | + * Callback function for the first Section. |
|
187 | + * |
|
188 | + * @return void |
|
189 | + */ |
|
190 | + public function sectionCallback() |
|
191 | + { |
|
192 | + echo esc_html_e( |
|
193 | + 'All settings related to the |
|
194 | 194 | visibility of your site and pages.', 'subway' |
195 | - ); |
|
196 | - return; |
|
197 | - } |
|
198 | - |
|
199 | - /** |
|
200 | - * Callback function for the second Section. |
|
201 | - * |
|
202 | - * @return void |
|
203 | - */ |
|
204 | - public function redirectCallback() |
|
205 | - { |
|
206 | - return; |
|
207 | - } |
|
208 | - |
|
209 | - /** |
|
210 | - * Renders the 'wrapper' for our options pages. |
|
211 | - * |
|
212 | - * @return void |
|
213 | - */ |
|
214 | - public function optionsPage() |
|
215 | - { |
|
216 | - ?> |
|
195 | + ); |
|
196 | + return; |
|
197 | + } |
|
198 | + |
|
199 | + /** |
|
200 | + * Callback function for the second Section. |
|
201 | + * |
|
202 | + * @return void |
|
203 | + */ |
|
204 | + public function redirectCallback() |
|
205 | + { |
|
206 | + return; |
|
207 | + } |
|
208 | + |
|
209 | + /** |
|
210 | + * Renders the 'wrapper' for our options pages. |
|
211 | + * |
|
212 | + * @return void |
|
213 | + */ |
|
214 | + public function optionsPage() |
|
215 | + { |
|
216 | + ?> |
|
217 | 217 | |
218 | 218 | <div class="wrap"> |
219 | 219 | <h2> |
@@ -227,30 +227,30 @@ discard block |
||
227 | 227 | </div> |
228 | 228 | |
229 | 229 | <?php |
230 | - } |
|
230 | + } |
|
231 | 231 | |
232 | 232 | /** |
233 | - * Registers the scipts for the Subway settings page. |
|
234 | - * |
|
233 | + * Registers the scipts for the Subway settings page. |
|
234 | + * |
|
235 | 235 | * @since 2.0.9 |
236 | - * @access public |
|
237 | - * @return void |
|
238 | - */ |
|
236 | + * @access public |
|
237 | + * @return void |
|
238 | + */ |
|
239 | 239 | public function registerSettingsScripts() { |
240 | 240 | |
241 | 241 | // Registers the Subway settings Javascript. |
242 | - wp_register_script( 'subway-settings-script', plugins_url('/assets/js/settings.js', __FILE__) ); |
|
243 | - wp_register_style( 'subway-settings-style', plugins_url('/assets/css/settings.css', __FILE__) ); |
|
242 | + wp_register_script( 'subway-settings-script', plugins_url('/assets/js/settings.js', __FILE__) ); |
|
243 | + wp_register_style( 'subway-settings-style', plugins_url('/assets/css/settings.css', __FILE__) ); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
247 | - * Loads the scipts for the Subway settings page. |
|
247 | + * Loads the scipts for the Subway settings page. |
|
248 | 248 | * |
249 | 249 | * @since 2.0.9 |
250 | - * @access public |
|
251 | - * @return void |
|
252 | - * @return void |
|
253 | - */ |
|
250 | + * @access public |
|
251 | + * @return void |
|
252 | + * @return void |
|
253 | + */ |
|
254 | 254 | public function enqueueSettingsScripts( $hook ) { |
255 | 255 | // Checks if page hook is Subway settings page. |
256 | 256 | if ( 'settings_page_subway' === $hook ) { |