@@ -9,24 +9,24 @@ |
||
9 | 9 | */ |
10 | 10 | Class Sensei_Twentythirteen { |
11 | 11 | |
12 | - /** |
|
13 | - * Output opening wrappers |
|
14 | - * @since 1.9.0 |
|
15 | - */ |
|
16 | - public function wrapper_start(){ |
|
17 | - ?> |
|
12 | + /** |
|
13 | + * Output opening wrappers |
|
14 | + * @since 1.9.0 |
|
15 | + */ |
|
16 | + public function wrapper_start(){ |
|
17 | + ?> |
|
18 | 18 | |
19 | 19 | <div id="primary" class="site-content"> |
20 | 20 | <div id="content" role="main" class="entry-content"> |
21 | 21 | |
22 | 22 | <?php } |
23 | 23 | |
24 | - /** |
|
25 | - * Output closing wrappers |
|
26 | - * |
|
27 | - * @since 1.9.0 |
|
28 | - */ |
|
29 | - public function wrapper_end(){ ?> |
|
24 | + /** |
|
25 | + * Output closing wrappers |
|
26 | + * |
|
27 | + * @since 1.9.0 |
|
28 | + */ |
|
29 | + public function wrapper_end(){ ?> |
|
30 | 30 | |
31 | 31 | </div> |
32 | 32 | </div> |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * Output opening wrappers |
14 | 14 | * @since 1.9.0 |
15 | 15 | */ |
16 | - public function wrapper_start(){ |
|
16 | + public function wrapper_start() { |
|
17 | 17 | ?> |
18 | 18 | |
19 | 19 | <div id="primary" class="site-content"> |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @since 1.9.0 |
28 | 28 | */ |
29 | - public function wrapper_end(){ ?> |
|
29 | + public function wrapper_end() { ?> |
|
30 | 30 | |
31 | 31 | </div> |
32 | 32 | </div> |
@@ -9,24 +9,24 @@ |
||
9 | 9 | */ |
10 | 10 | Class Sensei_Twentythirteen { |
11 | 11 | |
12 | - /** |
|
13 | - * Output opening wrappers |
|
14 | - * @since 1.9.0 |
|
15 | - */ |
|
16 | - public function wrapper_start(){ |
|
17 | - ?> |
|
12 | + /** |
|
13 | + * Output opening wrappers |
|
14 | + * @since 1.9.0 |
|
15 | + */ |
|
16 | + public function wrapper_start(){ |
|
17 | + ?> |
|
18 | 18 | |
19 | 19 | <div id="primary" class="site-content"> |
20 | 20 | <div id="content" role="main" class="entry-content"> |
21 | 21 | |
22 | 22 | <?php } |
23 | 23 | |
24 | - /** |
|
25 | - * Output closing wrappers |
|
26 | - * |
|
27 | - * @since 1.9.0 |
|
28 | - */ |
|
29 | - public function wrapper_end(){ ?> |
|
24 | + /** |
|
25 | + * Output closing wrappers |
|
26 | + * |
|
27 | + * @since 1.9.0 |
|
28 | + */ |
|
29 | + public function wrapper_end(){ ?> |
|
30 | 30 | |
31 | 31 | </div> |
32 | 32 | </div> |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * Output opening wrappers |
14 | 14 | * @since 1.9.0 |
15 | 15 | */ |
16 | - public function wrapper_start(){ |
|
16 | + public function wrapper_start() { |
|
17 | 17 | ?> |
18 | 18 | |
19 | 19 | <div id="primary" class="site-content"> |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @since 1.9.0 |
28 | 28 | */ |
29 | - public function wrapper_end(){ ?> |
|
29 | + public function wrapper_end() { ?> |
|
30 | 30 | |
31 | 31 | </div> |
32 | 32 | </div> |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Content wrappers Start |
|
4 | - * |
|
5 | - * All support theme wrappers can be found in includes/theme-integrations |
|
6 | - * |
|
7 | - * @author WooThemes |
|
8 | - * @package WooCommerce/Templates |
|
9 | - * @version 1.6.4 |
|
10 | - */ |
|
3 | + * Content wrappers Start |
|
4 | + * |
|
5 | + * All support theme wrappers can be found in includes/theme-integrations |
|
6 | + * |
|
7 | + * @author WooThemes |
|
8 | + * @package WooCommerce/Templates |
|
9 | + * @version 1.6.4 |
|
10 | + */ |
|
11 | 11 | ?> |
12 | 12 | <div id="container"> |
13 | 13 | <div id="content" role="main"> |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public static function has_language_pack_available( $locale = null ) { |
93 | 93 | |
94 | - if ( is_null( $locale ) ) { |
|
94 | + if ( is_null( $locale ) ) { |
|
95 | 95 | |
96 | 96 | $locale = get_locale(); |
97 | 97 | |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | |
110 | 110 | } |
111 | 111 | |
112 | - if( isset( $_GET['translation_updated'] ) && 5 == $_GET['translation_updated'] ){ |
|
112 | + if( isset( $_GET['translation_updated'] ) && 5 == $_GET['translation_updated'] ){ |
|
113 | 113 | |
114 | - return false; |
|
114 | + return false; |
|
115 | 115 | |
116 | - } |
|
116 | + } |
|
117 | 117 | |
118 | 118 | $version = get_option( 'woothemes_sensei_language_pack_version', array( '0', $locale ) ); |
119 | 119 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
3 | +if ( ! defined('ABSPATH')) { |
|
4 | 4 | exit; // Exit if accessed directly |
5 | 5 | } |
6 | 6 | |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | * Initialize the language pack manager |
29 | 29 | */ |
30 | 30 | public function __construct() { |
31 | - add_action( 'update_option_WPLANG', array( $this, 'updated_language_option' ), 10, 2 ); |
|
32 | - add_filter( 'admin_init', array( $this, 'language_package_actions' ), 10 ); |
|
31 | + add_action('update_option_WPLANG', array($this, 'updated_language_option'), 10, 2); |
|
32 | + add_filter('admin_init', array($this, 'language_package_actions'), 10); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @return string |
41 | 41 | */ |
42 | - public static function get_package_uri( $locale ) { |
|
43 | - return self::$repo . Sensei()->version . '/packages/' . $locale . '.zip'; |
|
42 | + public static function get_package_uri($locale) { |
|
43 | + return self::$repo.Sensei()->version.'/packages/'.$locale.'.zip'; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return string |
52 | 52 | */ |
53 | - protected static function get_settings_uri( $action ) { |
|
54 | - return wp_nonce_url( admin_url( 'admin.php?page=woothemes-sensei-settings&action=' . $action ), 'language_pack', '_sensei_language_nonce' ); |
|
53 | + protected static function get_settings_uri($action) { |
|
54 | + return wp_nonce_url(admin_url('admin.php?page=woothemes-sensei-settings&action='.$action), 'language_pack', '_sensei_language_nonce'); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @return string |
61 | 61 | */ |
62 | 62 | public static function get_install_uri() { |
63 | - return self::get_settings_uri( 'language_pack_install' ); |
|
63 | + return self::get_settings_uri('language_pack_install'); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @return string |
70 | 70 | */ |
71 | 71 | public static function get_dismiss_uri() { |
72 | - return self::get_settings_uri( 'dismiss_language_pack_notice' ); |
|
72 | + return self::get_settings_uri('dismiss_language_pack_notice'); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | * @param string $old |
79 | 79 | * @param string $new |
80 | 80 | */ |
81 | - public function updated_language_option( $old, $new ) { |
|
82 | - self::has_language_pack_available( $new ); |
|
81 | + public function updated_language_option($old, $new) { |
|
82 | + self::has_language_pack_available($new); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -89,42 +89,42 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @return bool |
91 | 91 | */ |
92 | - public static function has_language_pack_available( $locale = null ) { |
|
92 | + public static function has_language_pack_available($locale = null) { |
|
93 | 93 | |
94 | - if ( is_null( $locale ) ) { |
|
94 | + if (is_null($locale)) { |
|
95 | 95 | |
96 | 96 | $locale = get_locale(); |
97 | 97 | |
98 | 98 | } |
99 | 99 | |
100 | - if ( 'en_US' === $locale ) { |
|
100 | + if ('en_US' === $locale) { |
|
101 | 101 | |
102 | 102 | return false; |
103 | 103 | |
104 | 104 | } |
105 | 105 | |
106 | - if ( 'yes' === get_option( 'sensei_needs_language_pack_install' ) ) { |
|
106 | + if ('yes' === get_option('sensei_needs_language_pack_install')) { |
|
107 | 107 | |
108 | 108 | return true; |
109 | 109 | |
110 | 110 | } |
111 | 111 | |
112 | - if( isset( $_GET['translation_updated'] ) && 5 == $_GET['translation_updated'] ){ |
|
112 | + if (isset($_GET['translation_updated']) && 5 == $_GET['translation_updated']) { |
|
113 | 113 | |
114 | 114 | return false; |
115 | 115 | |
116 | 116 | } |
117 | 117 | |
118 | - $version = get_option( 'woothemes_sensei_language_pack_version', array( '0', $locale ) ); |
|
118 | + $version = get_option('woothemes_sensei_language_pack_version', array('0', $locale)); |
|
119 | 119 | |
120 | - if ( ! is_array( $version ) || version_compare( $version[0], Sensei()->version, '<' ) || $version[1] !== $locale ) { |
|
121 | - if ( self::check_if_language_pack_exists( $locale ) ) { |
|
122 | - update_option( 'sensei_needs_language_pack_install', 'yes' ); |
|
120 | + if ( ! is_array($version) || version_compare($version[0], Sensei()->version, '<') || $version[1] !== $locale) { |
|
121 | + if (self::check_if_language_pack_exists($locale)) { |
|
122 | + update_option('sensei_needs_language_pack_install', 'yes'); |
|
123 | 123 | |
124 | 124 | return true; |
125 | 125 | } else { |
126 | 126 | // Updated the woothemes_sensei_language_pack_version to avoid searching translations for this release again |
127 | - self::update_language_pack_version( $locale ); |
|
127 | + self::update_language_pack_version($locale); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return bool |
139 | 139 | */ |
140 | - public static function check_if_language_pack_exists( $locale ) { |
|
141 | - $response = wp_safe_remote_get( self::get_package_uri( $locale ), array( 'timeout' => 60 ) ); |
|
140 | + public static function check_if_language_pack_exists($locale) { |
|
141 | + $response = wp_safe_remote_get(self::get_package_uri($locale), array('timeout' => 60)); |
|
142 | 142 | |
143 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
143 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
144 | 144 | return true; |
145 | 145 | } else { |
146 | 146 | return false; |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @param string $locale |
154 | 154 | */ |
155 | - public static function update_language_pack_version( $locale ) { |
|
155 | + public static function update_language_pack_version($locale) { |
|
156 | 156 | // Update the language pack version |
157 | - update_option( 'woothemes_sensei_language_pack_version', array( Sensei()->version, $locale ) ); |
|
157 | + update_option('woothemes_sensei_language_pack_version', array(Sensei()->version, $locale)); |
|
158 | 158 | |
159 | 159 | // Remove the translation upgrade notice |
160 | - update_option( 'sensei_needs_language_pack_install', 'no' ); |
|
160 | + update_option('sensei_needs_language_pack_install', 'no'); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -166,17 +166,17 @@ discard block |
||
166 | 166 | public function language_package_actions() { |
167 | 167 | if ( |
168 | 168 | is_admin() |
169 | - && current_user_can( 'update_plugins' ) |
|
170 | - && isset( $_GET['page'] ) |
|
169 | + && current_user_can('update_plugins') |
|
170 | + && isset($_GET['page']) |
|
171 | 171 | && 'woothemes-sensei-settings' === $_GET['page'] |
172 | - && isset( $_GET['action'] ) |
|
172 | + && isset($_GET['action']) |
|
173 | 173 | ) { |
174 | 174 | |
175 | - if ( 'language_pack_install' === $_GET['action'] ) { |
|
175 | + if ('language_pack_install' === $_GET['action']) { |
|
176 | 176 | $this->language_pack_install(); |
177 | 177 | } |
178 | 178 | |
179 | - if ( 'dismiss_language_pack_notice' ) { |
|
179 | + if ('dismiss_language_pack_notice') { |
|
180 | 180 | $this->dismiss_language_pack_notice(); |
181 | 181 | } |
182 | 182 | } |
@@ -186,66 +186,66 @@ discard block |
||
186 | 186 | * Install language pack. |
187 | 187 | */ |
188 | 188 | protected function language_pack_install() { |
189 | - $url = wp_nonce_url( admin_url( 'admin.php?page=woothemes-sensei-settings&action=language_pack_install' ), 'language_install' ); |
|
190 | - $settings_url = admin_url( 'admin.php?page=woothemes-sensei-settings' ); |
|
189 | + $url = wp_nonce_url(admin_url('admin.php?page=woothemes-sensei-settings&action=language_pack_install'), 'language_install'); |
|
190 | + $settings_url = admin_url('admin.php?page=woothemes-sensei-settings'); |
|
191 | 191 | $locale = get_locale(); |
192 | 192 | |
193 | - if ( ! isset( $_REQUEST['_sensei_language_nonce'] ) && wp_verify_nonce( $_REQUEST['_sensei_language_nonce'], 'language_pack' ) ) { |
|
194 | - wp_redirect( add_query_arg( array( 'translation_updated' => 2 ), $settings_url ) ); |
|
193 | + if ( ! isset($_REQUEST['_sensei_language_nonce']) && wp_verify_nonce($_REQUEST['_sensei_language_nonce'], 'language_pack')) { |
|
194 | + wp_redirect(add_query_arg(array('translation_updated' => 2), $settings_url)); |
|
195 | 195 | exit; |
196 | 196 | } |
197 | 197 | |
198 | - if ( 'en_US' === $locale || ! self::check_if_language_pack_exists( $locale ) ) { |
|
199 | - wp_redirect( add_query_arg( array( 'translation_updated' => 3 ), $settings_url ) ); |
|
198 | + if ('en_US' === $locale || ! self::check_if_language_pack_exists($locale)) { |
|
199 | + wp_redirect(add_query_arg(array('translation_updated' => 3), $settings_url)); |
|
200 | 200 | exit; |
201 | 201 | } |
202 | 202 | |
203 | - if ( false === ( $creds = request_filesystem_credentials( $url, '', false, false, null ) ) ) { |
|
204 | - wp_redirect( add_query_arg( array( 'translation_updated' => 4 ), $settings_url ) ); |
|
203 | + if (false === ($creds = request_filesystem_credentials($url, '', false, false, null))) { |
|
204 | + wp_redirect(add_query_arg(array('translation_updated' => 4), $settings_url)); |
|
205 | 205 | exit; |
206 | 206 | } |
207 | 207 | |
208 | - if ( ! WP_Filesystem( $creds ) ) { |
|
209 | - request_filesystem_credentials( $url, '', true, false, null ); |
|
208 | + if ( ! WP_Filesystem($creds)) { |
|
209 | + request_filesystem_credentials($url, '', true, false, null); |
|
210 | 210 | |
211 | - wp_redirect( add_query_arg( array( 'translation_updated' => 4 ), $settings_url ) ); |
|
211 | + wp_redirect(add_query_arg(array('translation_updated' => 4), $settings_url)); |
|
212 | 212 | exit; |
213 | 213 | } |
214 | 214 | |
215 | 215 | // Download the language pack |
216 | - $response = wp_safe_remote_get( self::get_package_uri( $locale ), array( 'timeout' => 60 ) ); |
|
217 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
216 | + $response = wp_safe_remote_get(self::get_package_uri($locale), array('timeout' => 60)); |
|
217 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
218 | 218 | global $wp_filesystem; |
219 | 219 | |
220 | 220 | $upload_dir = wp_upload_dir(); |
221 | - $file = trailingslashit( $upload_dir['path'] ) . $locale . '.zip'; |
|
221 | + $file = trailingslashit($upload_dir['path']).$locale.'.zip'; |
|
222 | 222 | |
223 | 223 | // Save the zip file |
224 | - if ( ! $wp_filesystem->put_contents( $file, $response['body'], FS_CHMOD_FILE ) ) { |
|
225 | - wp_redirect( add_query_arg( array( 'translation_updated' => 4 ), $settings_url ) ); |
|
224 | + if ( ! $wp_filesystem->put_contents($file, $response['body'], FS_CHMOD_FILE)) { |
|
225 | + wp_redirect(add_query_arg(array('translation_updated' => 4), $settings_url)); |
|
226 | 226 | exit; |
227 | 227 | } |
228 | 228 | |
229 | 229 | // Unzip the file to wp-content/languages/plugins directory |
230 | - $dir = trailingslashit( WP_LANG_DIR ) . 'plugins/'; |
|
231 | - $unzip = unzip_file( $file, $dir ); |
|
232 | - if ( true !== $unzip ) { |
|
233 | - wp_redirect( add_query_arg( array( 'translation_updated' => 4 ), $settings_url ) ); |
|
230 | + $dir = trailingslashit(WP_LANG_DIR).'plugins/'; |
|
231 | + $unzip = unzip_file($file, $dir); |
|
232 | + if (true !== $unzip) { |
|
233 | + wp_redirect(add_query_arg(array('translation_updated' => 4), $settings_url)); |
|
234 | 234 | exit; |
235 | 235 | } |
236 | 236 | |
237 | 237 | // Delete the package file |
238 | - $wp_filesystem->delete( $file ); |
|
238 | + $wp_filesystem->delete($file); |
|
239 | 239 | |
240 | 240 | // Update version and remove notice |
241 | - self::update_language_pack_version( $locale ); |
|
241 | + self::update_language_pack_version($locale); |
|
242 | 242 | |
243 | 243 | // Redirect and show a success message |
244 | - wp_redirect( add_query_arg( array( 'translation_updated' => 1 ), $settings_url ) ); |
|
244 | + wp_redirect(add_query_arg(array('translation_updated' => 1), $settings_url)); |
|
245 | 245 | exit; |
246 | 246 | } else { |
247 | 247 | // Don't have a valid package for the current language! |
248 | - wp_redirect( add_query_arg( array( 'translation_updated' => 5 ), $settings_url ) ); |
|
248 | + wp_redirect(add_query_arg(array('translation_updated' => 5), $settings_url)); |
|
249 | 249 | exit; |
250 | 250 | } |
251 | 251 | } |
@@ -254,38 +254,38 @@ discard block |
||
254 | 254 | * Hide language pack notice. |
255 | 255 | */ |
256 | 256 | protected function dismiss_language_pack_notice() { |
257 | - if ( ! isset( $_REQUEST['_sensei_language_nonce'] ) && wp_verify_nonce( $_REQUEST['_sensei_language_nonce'], 'language_pack' ) ) { |
|
258 | - wp_die( __( 'Cheatin’ huh?', 'woothemes-sensei' ) ); |
|
257 | + if ( ! isset($_REQUEST['_sensei_language_nonce']) && wp_verify_nonce($_REQUEST['_sensei_language_nonce'], 'language_pack')) { |
|
258 | + wp_die(__('Cheatin’ huh?', 'woothemes-sensei')); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | // Update version and remove notice |
262 | - self::update_language_pack_version( get_locale() ); |
|
262 | + self::update_language_pack_version(get_locale()); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
266 | 266 | * Language pack messages |
267 | 267 | */ |
268 | 268 | public static function messages() { |
269 | - if ( empty( $_GET['translation_updated'] ) ) { |
|
269 | + if (empty($_GET['translation_updated'])) { |
|
270 | 270 | return; |
271 | 271 | } |
272 | 272 | |
273 | - switch ( $_GET['translation_updated'] ) { |
|
273 | + switch ($_GET['translation_updated']) { |
|
274 | 274 | case 2 : |
275 | - echo '<div class="error"><p>' . __( 'Failed to install/update the translation:', 'woothemes-sensei' ) . ' ' . __( 'Seems you don\'t have permission to do this!', 'woothemes-sensei' ) . '</p></div>'; |
|
275 | + echo '<div class="error"><p>'.__('Failed to install/update the translation:', 'woothemes-sensei').' '.__('Seems you don\'t have permission to do this!', 'woothemes-sensei').'</p></div>'; |
|
276 | 276 | break; |
277 | 277 | case 3 : |
278 | - echo '<div class="error"><p>' . __( 'Failed to install/update the translation:', 'woothemes-sensei' ) . ' ' . __( 'There is no translation available for your language!', 'woothemes-sensei' ) . '</p></div>'; |
|
278 | + echo '<div class="error"><p>'.__('Failed to install/update the translation:', 'woothemes-sensei').' '.__('There is no translation available for your language!', 'woothemes-sensei').'</p></div>'; |
|
279 | 279 | break; |
280 | 280 | case 4 : |
281 | - echo '<div class="error"><p>' . __( 'Failed to install/update the translation:', 'woothemes-sensei' ) . ' ' . sprintf( __( 'An authentication error occurred while updating the translation. Please try again or configure your %sUpgrade Constants%s.', 'woothemes-sensei' ), '<a href="http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants">', '</a>' ) . '</p></div>'; |
|
281 | + echo '<div class="error"><p>'.__('Failed to install/update the translation:', 'woothemes-sensei').' '.sprintf(__('An authentication error occurred while updating the translation. Please try again or configure your %sUpgrade Constants%s.', 'woothemes-sensei'), '<a href="http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants">', '</a>').'</p></div>'; |
|
282 | 282 | break; |
283 | 283 | case 5 : |
284 | - echo '<div class="error"><p>' . __( 'Failed to install/update the translation:', 'woothemes-sensei' ) . ' ' . __( 'Sorry but there is no translation available for your language =/', 'woothemes-sensei' ) . '</p></div>'; |
|
284 | + echo '<div class="error"><p>'.__('Failed to install/update the translation:', 'woothemes-sensei').' '.__('Sorry but there is no translation available for your language =/', 'woothemes-sensei').'</p></div>'; |
|
285 | 285 | break; |
286 | 286 | |
287 | 287 | default : |
288 | - echo '<div class="updated"><p>' . __( 'Translations installed/updated successfully!', 'woothemes-sensei' ) . '</p></div>'; |
|
288 | + echo '<div class="updated"><p>'.__('Translations installed/updated successfully!', 'woothemes-sensei').'</p></div>'; |
|
289 | 289 | break; |
290 | 290 | } |
291 | 291 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | ?> |
13 | 13 | |
14 | -<?php get_sensei_header(); ?> |
|
14 | +<?php get_sensei_header(); ?> |
|
15 | 15 | |
16 | 16 | <article <?php post_class(); ?> > |
17 | 17 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @hooked WooThemes_Sensei_Messages::the_title - 20 |
27 | 27 | * @hooked WooThemes_Sensei_Messages::the_message_sent_by_title - 40 |
28 | 28 | */ |
29 | - do_action( 'sensei_single_message_content_inside_before', get_the_ID()); |
|
29 | + do_action('sensei_single_message_content_inside_before', get_the_ID()); |
|
30 | 30 | ?> |
31 | 31 | |
32 | 32 | <section class="entry"> |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @param integer $message_id |
45 | 45 | */ |
46 | - do_action( 'sensei_single_message_content_inside_after', get_the_ID()); |
|
46 | + do_action('sensei_single_message_content_inside_after', get_the_ID()); |
|
47 | 47 | |
48 | 48 | ?> |
49 | 49 | </article><!-- .post --> |
@@ -1,14 +1,14 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * The Template for displaying all single messages. |
|
4 | - * |
|
5 | - * Override this template by copying it to yourtheme/sensei/single-message.php |
|
6 | - * |
|
7 | - * @author Automattic |
|
8 | - * @package Sensei |
|
9 | - * @category Templates |
|
10 | - * @version 1.9.0 |
|
11 | - */ |
|
3 | + * The Template for displaying all single messages. |
|
4 | + * |
|
5 | + * Override this template by copying it to yourtheme/sensei/single-message.php |
|
6 | + * |
|
7 | + * @author Automattic |
|
8 | + * @package Sensei |
|
9 | + * @category Templates |
|
10 | + * @version 1.9.0 |
|
11 | + */ |
|
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <?php get_sensei_header(); ?> |
@@ -16,18 +16,18 @@ discard block |
||
16 | 16 | <article <?php post_class(); ?> > |
17 | 17 | |
18 | 18 | <?php |
19 | - /** |
|
20 | - * Action inside the single message template before the content |
|
21 | - * |
|
22 | - * @since 1.9.0 |
|
23 | - * |
|
24 | - * @param integer $message_id |
|
25 | - * |
|
26 | - * @hooked WooThemes_Sensei_Messages::the_title - 20 |
|
27 | - * @hooked WooThemes_Sensei_Messages::the_message_sent_by_title - 40 |
|
28 | - */ |
|
29 | - do_action( 'sensei_single_message_content_inside_before', get_the_ID()); |
|
30 | - ?> |
|
19 | + /** |
|
20 | + * Action inside the single message template before the content |
|
21 | + * |
|
22 | + * @since 1.9.0 |
|
23 | + * |
|
24 | + * @param integer $message_id |
|
25 | + * |
|
26 | + * @hooked WooThemes_Sensei_Messages::the_title - 20 |
|
27 | + * @hooked WooThemes_Sensei_Messages::the_message_sent_by_title - 40 |
|
28 | + */ |
|
29 | + do_action( 'sensei_single_message_content_inside_before', get_the_ID()); |
|
30 | + ?> |
|
31 | 31 | |
32 | 32 | <section class="entry"> |
33 | 33 | |
@@ -37,15 +37,15 @@ discard block |
||
37 | 37 | |
38 | 38 | <?php |
39 | 39 | |
40 | - /** |
|
41 | - * action inside the single message template after the content |
|
42 | - * @since 1.9.0 |
|
43 | - * |
|
44 | - * @param integer $message_id |
|
45 | - */ |
|
46 | - do_action( 'sensei_single_message_content_inside_after', get_the_ID()); |
|
40 | + /** |
|
41 | + * action inside the single message template after the content |
|
42 | + * @since 1.9.0 |
|
43 | + * |
|
44 | + * @param integer $message_id |
|
45 | + */ |
|
46 | + do_action( 'sensei_single_message_content_inside_after', get_the_ID()); |
|
47 | 47 | |
48 | - ?> |
|
48 | + ?> |
|
49 | 49 | </article><!-- .post --> |
50 | 50 | |
51 | 51 | <?php get_sensei_footer(); ?> |
@@ -19,62 +19,62 @@ |
||
19 | 19 | |
20 | 20 | <?php |
21 | 21 | |
22 | - /** |
|
23 | - * Hook inside the single lesson above the content |
|
24 | - * |
|
25 | - * @since 1.9.0 |
|
26 | - * |
|
27 | - * @param integer $lesson_id |
|
28 | - * |
|
29 | - * @hooked deprecated_lesson_image_hook - 10 |
|
30 | - * @hooked deprecate_sensei_lesson_single_title - 15 |
|
31 | - * @hooked Sensei_Lesson::lesson_image() - 17 |
|
32 | - * @hooked deprecate_lesson_single_main_content_hook - 20 |
|
33 | - */ |
|
34 | - do_action( 'sensei_single_lesson_content_inside_before', get_the_ID() ); |
|
35 | - |
|
36 | - ?> |
|
22 | + /** |
|
23 | + * Hook inside the single lesson above the content |
|
24 | + * |
|
25 | + * @since 1.9.0 |
|
26 | + * |
|
27 | + * @param integer $lesson_id |
|
28 | + * |
|
29 | + * @hooked deprecated_lesson_image_hook - 10 |
|
30 | + * @hooked deprecate_sensei_lesson_single_title - 15 |
|
31 | + * @hooked Sensei_Lesson::lesson_image() - 17 |
|
32 | + * @hooked deprecate_lesson_single_main_content_hook - 20 |
|
33 | + */ |
|
34 | + do_action( 'sensei_single_lesson_content_inside_before', get_the_ID() ); |
|
35 | + |
|
36 | + ?> |
|
37 | 37 | |
38 | 38 | <section class="entry fix"> |
39 | 39 | |
40 | 40 | <?php |
41 | 41 | |
42 | - if ( sensei_can_user_view_lesson() ) { |
|
42 | + if ( sensei_can_user_view_lesson() ) { |
|
43 | 43 | |
44 | - if( apply_filters( 'sensei_video_position', 'top', $post->ID ) == 'top' ) { |
|
44 | + if( apply_filters( 'sensei_video_position', 'top', $post->ID ) == 'top' ) { |
|
45 | 45 | |
46 | - do_action( 'sensei_lesson_video', $post->ID ); |
|
46 | + do_action( 'sensei_lesson_video', $post->ID ); |
|
47 | 47 | |
48 | - } |
|
48 | + } |
|
49 | 49 | |
50 | - the_content(); |
|
50 | + the_content(); |
|
51 | 51 | |
52 | - } else { |
|
53 | - ?> |
|
52 | + } else { |
|
53 | + ?> |
|
54 | 54 | |
55 | 55 | <p> <?php the_excerpt(); ?> </p> |
56 | 56 | |
57 | 57 | <?php |
58 | - } |
|
58 | + } |
|
59 | 59 | |
60 | - ?> |
|
60 | + ?> |
|
61 | 61 | |
62 | 62 | </section> |
63 | 63 | |
64 | 64 | <?php |
65 | 65 | |
66 | - /** |
|
67 | - * Hook inside the single lesson template after the content |
|
68 | - * |
|
69 | - * @since 1.9.0 |
|
70 | - * |
|
71 | - * @param integer $lesson_id |
|
72 | - * |
|
73 | - * @hooked Sensei()->frontend->sensei_breadcrumb - 30 |
|
74 | - */ |
|
75 | - do_action( 'sensei_single_lesson_content_inside_after', get_the_ID() ); |
|
76 | - |
|
77 | - ?> |
|
66 | + /** |
|
67 | + * Hook inside the single lesson template after the content |
|
68 | + * |
|
69 | + * @since 1.9.0 |
|
70 | + * |
|
71 | + * @param integer $lesson_id |
|
72 | + * |
|
73 | + * @hooked Sensei()->frontend->sensei_breadcrumb - 30 |
|
74 | + */ |
|
75 | + do_action( 'sensei_single_lesson_content_inside_after', get_the_ID() ); |
|
76 | + |
|
77 | + ?> |
|
78 | 78 | |
79 | 79 | </article><!-- .post --> |
80 | 80 |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | */ |
12 | 12 | ?> |
13 | 13 | |
14 | -<?php get_sensei_header(); ?> |
|
14 | +<?php get_sensei_header(); ?> |
|
15 | 15 | |
16 | 16 | <?php the_post(); ?> |
17 | 17 | |
18 | -<article <?php post_class( array( 'lesson', 'post' ) ); ?>> |
|
18 | +<article <?php post_class(array('lesson', 'post')); ?>> |
|
19 | 19 | |
20 | 20 | <?php |
21 | 21 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @hooked Sensei_Lesson::lesson_image() - 17 |
32 | 32 | * @hooked deprecate_lesson_single_main_content_hook - 20 |
33 | 33 | */ |
34 | - do_action( 'sensei_single_lesson_content_inside_before', get_the_ID() ); |
|
34 | + do_action('sensei_single_lesson_content_inside_before', get_the_ID()); |
|
35 | 35 | |
36 | 36 | ?> |
37 | 37 | |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | |
40 | 40 | <?php |
41 | 41 | |
42 | - if ( sensei_can_user_view_lesson() ) { |
|
42 | + if (sensei_can_user_view_lesson()) { |
|
43 | 43 | |
44 | - if( apply_filters( 'sensei_video_position', 'top', $post->ID ) == 'top' ) { |
|
44 | + if (apply_filters('sensei_video_position', 'top', $post->ID) == 'top') { |
|
45 | 45 | |
46 | - do_action( 'sensei_lesson_video', $post->ID ); |
|
46 | + do_action('sensei_lesson_video', $post->ID); |
|
47 | 47 | |
48 | 48 | } |
49 | 49 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @hooked Sensei()->frontend->sensei_breadcrumb - 30 |
74 | 74 | */ |
75 | - do_action( 'sensei_single_lesson_content_inside_after', get_the_ID() ); |
|
75 | + do_action('sensei_single_lesson_content_inside_after', get_the_ID()); |
|
76 | 76 | |
77 | 77 | ?> |
78 | 78 |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | */ |
12 | 12 | ?> |
13 | 13 | |
14 | -<?php get_sensei_header(); ?> |
|
14 | +<?php get_sensei_header(); ?> |
|
15 | 15 | |
16 | -<article <?php post_class( array( 'course', 'post' ) ); ?>> |
|
16 | +<article <?php post_class(array('course', 'post')); ?>> |
|
17 | 17 | |
18 | 18 | <?php |
19 | 19 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @hooked Sensei()->message->send_message_link - 35 |
33 | 33 | * @hooked Sensei_Course::the_course_video - 40 |
34 | 34 | */ |
35 | - do_action( 'sensei_single_course_content_inside_before', get_the_ID() ); |
|
35 | + do_action('sensei_single_course_content_inside_before', get_the_ID()); |
|
36 | 36 | |
37 | 37 | ?> |
38 | 38 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param integer $course_id |
53 | 53 | * |
54 | 54 | */ |
55 | - do_action( 'sensei_single_course_content_inside_after', get_the_ID() ); |
|
55 | + do_action('sensei_single_course_content_inside_after', get_the_ID()); |
|
56 | 56 | |
57 | 57 | ?> |
58 | 58 | </article><!-- .post .single-course --> |
@@ -1,14 +1,14 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * The Template for displaying all single courses. |
|
4 | - * |
|
5 | - * Override this template by copying it to yourtheme/sensei/single-course.php |
|
6 | - * |
|
7 | - * @author Automattic |
|
8 | - * @package Sensei |
|
9 | - * @category Templates |
|
10 | - * @version 1.9.0 |
|
11 | - */ |
|
3 | + * The Template for displaying all single courses. |
|
4 | + * |
|
5 | + * Override this template by copying it to yourtheme/sensei/single-course.php |
|
6 | + * |
|
7 | + * @author Automattic |
|
8 | + * @package Sensei |
|
9 | + * @category Templates |
|
10 | + * @version 1.9.0 |
|
11 | + */ |
|
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <?php get_sensei_header(); ?> |
@@ -17,24 +17,24 @@ discard block |
||
17 | 17 | |
18 | 18 | <?php |
19 | 19 | |
20 | - /** |
|
21 | - * Hook inside the single course post above the content |
|
22 | - * |
|
23 | - * @since 1.9.0 |
|
24 | - * |
|
25 | - * @param integer $course_id |
|
26 | - * |
|
27 | - * @hooked Sensei()->frontend->sensei_course_start - 10 |
|
28 | - * @hooked Sensei_Course::the_title - 10 |
|
29 | - * @hooked Sensei()->course->course_image - 20 |
|
30 | - * @hooked Sensei_WC::course_in_cart_message - 20 |
|
31 | - * @hooked Sensei_Course::the_course_enrolment_actions - 30 |
|
32 | - * @hooked Sensei()->message->send_message_link - 35 |
|
33 | - * @hooked Sensei_Course::the_course_video - 40 |
|
34 | - */ |
|
35 | - do_action( 'sensei_single_course_content_inside_before', get_the_ID() ); |
|
36 | - |
|
37 | - ?> |
|
20 | + /** |
|
21 | + * Hook inside the single course post above the content |
|
22 | + * |
|
23 | + * @since 1.9.0 |
|
24 | + * |
|
25 | + * @param integer $course_id |
|
26 | + * |
|
27 | + * @hooked Sensei()->frontend->sensei_course_start - 10 |
|
28 | + * @hooked Sensei_Course::the_title - 10 |
|
29 | + * @hooked Sensei()->course->course_image - 20 |
|
30 | + * @hooked Sensei_WC::course_in_cart_message - 20 |
|
31 | + * @hooked Sensei_Course::the_course_enrolment_actions - 30 |
|
32 | + * @hooked Sensei()->message->send_message_link - 35 |
|
33 | + * @hooked Sensei_Course::the_course_video - 40 |
|
34 | + */ |
|
35 | + do_action( 'sensei_single_course_content_inside_before', get_the_ID() ); |
|
36 | + |
|
37 | + ?> |
|
38 | 38 | |
39 | 39 | <section class="entry fix"> |
40 | 40 | |
@@ -44,17 +44,17 @@ discard block |
||
44 | 44 | |
45 | 45 | <?php |
46 | 46 | |
47 | - /** |
|
48 | - * Hook inside the single course post above the content |
|
49 | - * |
|
50 | - * @since 1.9.0 |
|
51 | - * |
|
52 | - * @param integer $course_id |
|
53 | - * |
|
54 | - */ |
|
55 | - do_action( 'sensei_single_course_content_inside_after', get_the_ID() ); |
|
56 | - |
|
57 | - ?> |
|
47 | + /** |
|
48 | + * Hook inside the single course post above the content |
|
49 | + * |
|
50 | + * @since 1.9.0 |
|
51 | + * |
|
52 | + * @param integer $course_id |
|
53 | + * |
|
54 | + */ |
|
55 | + do_action( 'sensei_single_course_content_inside_after', get_the_ID() ); |
|
56 | + |
|
57 | + ?> |
|
58 | 58 | </article><!-- .post .single-course --> |
59 | 59 | |
60 | 60 | <?php get_sensei_footer(); ?> |
61 | 61 | \ No newline at end of file |
@@ -796,7 +796,7 @@ |
||
796 | 796 | * Return an array of field types expecting an array value returned. |
797 | 797 | * @access protected |
798 | 798 | * @since 1.0.0 |
799 | - * @return array |
|
799 | + * @return string[] |
|
800 | 800 | */ |
801 | 801 | protected function get_array_field_types () { |
802 | 802 | return array( 'multicheck' ); |
@@ -1,5 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | + exit; |
|
4 | +} |
|
5 | +// Exit if accessed directly |
|
3 | 6 | |
4 | 7 | /** |
5 | 8 | * A settings API (wrapping the WordPress Settings API). |
@@ -315,8 +318,9 @@ discard block |
||
315 | 318 | |
316 | 319 | echo '<section id="' . $section_id . '">'; |
317 | 320 | |
318 | - if ($section['name']) |
|
319 | - echo "<h2>{$section['name']}</h2>\n"; |
|
321 | + if ($section['name']) { |
|
322 | + echo "<h2>{$section['name']}</h2>\n"; |
|
323 | + } |
|
320 | 324 | |
321 | 325 | echo '<table class="form-table">'; |
322 | 326 | do_settings_fields($page, $section_id ); |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function register_hook_listener() { |
59 | 59 | |
60 | - add_action( 'admin_menu', array( $this, 'register_settings_screen' ), 60 ); |
|
60 | + add_action( 'admin_menu', array( $this, 'register_settings_screen' ), 60 ); |
|
61 | 61 | add_action( 'admin_init', array( $this, 'settings_fields' ) ); |
62 | - add_action( 'init', array( $this, 'general_init' ), 5 ); |
|
62 | + add_action( 'init', array( $this, 'general_init' ), 5 ); |
|
63 | 63 | |
64 | 64 | } // End setup_settings() |
65 | 65 | |
@@ -293,14 +293,14 @@ discard block |
||
293 | 293 | * @return void |
294 | 294 | */ |
295 | 295 | public function settings_screen () |
296 | - { |
|
296 | + { |
|
297 | 297 | |
298 | - ?> |
|
298 | + ?> |
|
299 | 299 | <div id="woothemes-sensei" class="wrap <?php echo esc_attr($this->token); ?>"> |
300 | 300 | <?php screen_icon('woothemes-sensei'); ?> |
301 | 301 | <h2><?php echo esc_html($this->name); ?><?php if ('' != $this->settings_version) { |
302 | - echo ' <span class="version">' . $this->settings_version . '</span>'; |
|
303 | - } ?></h2> |
|
302 | + echo ' <span class="version">' . $this->settings_version . '</span>'; |
|
303 | + } ?></h2> |
|
304 | 304 | <p class="powered-by-woo"><?php _e('Powered by', 'woothemes-sensei'); ?><a href="http://www.woothemes.com/" |
305 | 305 | title="WooThemes"><img |
306 | 306 | src="<?php echo Sensei()->plugin_url; ?>assets/images/woothemes.png" alt="WooThemes"/></a></p> |
@@ -308,26 +308,26 @@ discard block |
||
308 | 308 | <form action="options.php" method="post"> |
309 | 309 | |
310 | 310 | <?php |
311 | - $this->settings_tabs(); |
|
312 | - settings_fields($this->token); |
|
313 | - $page = 'woothemes-sensei-settings'; |
|
314 | - foreach ($this->sections as $section_id => $section) { |
|
311 | + $this->settings_tabs(); |
|
312 | + settings_fields($this->token); |
|
313 | + $page = 'woothemes-sensei-settings'; |
|
314 | + foreach ($this->sections as $section_id => $section) { |
|
315 | 315 | |
316 | - echo '<section id="' . $section_id . '">'; |
|
316 | + echo '<section id="' . $section_id . '">'; |
|
317 | 317 | |
318 | - if ($section['name']) |
|
319 | - echo "<h2>{$section['name']}</h2>\n"; |
|
318 | + if ($section['name']) |
|
319 | + echo "<h2>{$section['name']}</h2>\n"; |
|
320 | 320 | |
321 | - echo '<table class="form-table">'; |
|
322 | - do_settings_fields($page, $section_id ); |
|
323 | - echo '</table>'; |
|
321 | + echo '<table class="form-table">'; |
|
322 | + do_settings_fields($page, $section_id ); |
|
323 | + echo '</table>'; |
|
324 | 324 | |
325 | - echo '</section>'; |
|
325 | + echo '</section>'; |
|
326 | 326 | |
327 | - } |
|
327 | + } |
|
328 | 328 | |
329 | - submit_button(); |
|
330 | - ?> |
|
329 | + submit_button(); |
|
330 | + ?> |
|
331 | 331 | </form> |
332 | 332 | <?php do_action( 'settings_after_form' ); ?> |
333 | 333 | </div><!--/#woothemes-sensei--> |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | */ |
343 | 343 | public function get_settings () { |
344 | 344 | |
345 | - $this->settings = get_option( $this->token, array() ); |
|
345 | + $this->settings = get_option( $this->token, array() ); |
|
346 | 346 | |
347 | 347 | foreach ( $this->fields as $k => $v ) { |
348 | 348 | if ( ! isset( $this->settings[$k] ) && isset( $v['default'] ) ) { |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | * @return void |
376 | 376 | */ |
377 | 377 | public function settings_errors () { |
378 | - settings_errors( $this->token . '-errors' ); |
|
378 | + settings_errors( $this->token . '-errors' ); |
|
379 | 379 | } // End settings_errors() |
380 | 380 | |
381 | 381 | /** |
@@ -441,9 +441,9 @@ discard block |
||
441 | 441 | echo '<input id="' . $args['key'] . '" name="' . $this->token . '[' . esc_attr( $args['key'] ) . ']" type="checkbox" value="1"' . checked( esc_attr( $options[$args['key']] ), '1', false ) . ' />' . "\n"; |
442 | 442 | if ( $has_description ) { |
443 | 443 | echo wp_kses( $args['data']['description'], array( 'a' => array( |
444 | - 'href' => array(), |
|
445 | - 'title' => array() |
|
446 | - ) |
|
444 | + 'href' => array(), |
|
445 | + 'title' => array() |
|
446 | + ) |
|
447 | 447 | ) |
448 | 448 | ) . '</label>' . "\n"; |
449 | 449 | } |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | */ |
833 | 833 | public function enqueue_scripts () { |
834 | 834 | |
835 | - $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
835 | + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
836 | 836 | |
837 | 837 | wp_enqueue_script( 'farbtastic' ); |
838 | 838 | wp_enqueue_script( 'woothemes-sensei-settings', esc_url( Sensei()->plugin_url . 'assets/js/settings' . $suffix . '.js' ), array( 'jquery', 'farbtastic' ), Sensei()->version ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
2 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * A settings API (wrapping the WordPress Settings API). |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @access public |
32 | 32 | * @since 1.0.0 |
33 | 33 | */ |
34 | - public function __construct () { |
|
34 | + public function __construct() { |
|
35 | 35 | |
36 | 36 | $this->token = 'woothemes-sensei-settings'; |
37 | 37 | $this->page_slug = 'woothemes-sensei-settings-api'; |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function register_hook_listener() { |
59 | 59 | |
60 | - add_action( 'admin_menu', array( $this, 'register_settings_screen' ), 60 ); |
|
61 | - add_action( 'admin_init', array( $this, 'settings_fields' ) ); |
|
62 | - add_action( 'init', array( $this, 'general_init' ), 5 ); |
|
60 | + add_action('admin_menu', array($this, 'register_settings_screen'), 60); |
|
61 | + add_action('admin_init', array($this, 'settings_fields')); |
|
62 | + add_action('init', array($this, 'general_init'), 5); |
|
63 | 63 | |
64 | 64 | } // End setup_settings() |
65 | 65 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $this->init_sections(); |
74 | 74 | $this->init_fields(); |
75 | 75 | $this->get_settings(); |
76 | - if ( $this->has_tabs == true ) { |
|
76 | + if ($this->has_tabs == true) { |
|
77 | 77 | $this->create_tabs(); |
78 | 78 | } // End If Statement |
79 | 79 | } // End general_init() |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | * @since 1.0.0 |
85 | 85 | * @return void |
86 | 86 | */ |
87 | - public function init_sections () { |
|
87 | + public function init_sections() { |
|
88 | 88 | // Override this function in your class and assign the array of sections to $this->sections. |
89 | - _e( 'Override init_sections() in your class.', 'woothemes-sensei' ); |
|
89 | + _e('Override init_sections() in your class.', 'woothemes-sensei'); |
|
90 | 90 | } // End init_sections() |
91 | 91 | |
92 | 92 | /** |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | * @since 1.0.0 |
96 | 96 | * @return void |
97 | 97 | */ |
98 | - public function init_fields () { |
|
98 | + public function init_fields() { |
|
99 | 99 | // Override this function in your class and assign the array of sections to $this->fields. |
100 | - _e( 'Override init_fields() in your class.', 'woothemes-sensei' ); |
|
100 | + _e('Override init_fields() in your class.', 'woothemes-sensei'); |
|
101 | 101 | } // End init_fields() |
102 | 102 | |
103 | 103 | /** |
@@ -106,34 +106,34 @@ discard block |
||
106 | 106 | * @since 1.1.0 |
107 | 107 | * @return void |
108 | 108 | */ |
109 | - public function settings_tabs () { |
|
109 | + public function settings_tabs() { |
|
110 | 110 | |
111 | - if ( ! $this->has_tabs ) { return; } |
|
111 | + if ( ! $this->has_tabs) { return; } |
|
112 | 112 | |
113 | - if ( count( $this->tabs ) > 0 ) { |
|
113 | + if (count($this->tabs) > 0) { |
|
114 | 114 | $html = ''; |
115 | 115 | |
116 | - $html .= '<ul id="settings-sections" class="subsubsub hide-if-no-js">' . "\n"; |
|
116 | + $html .= '<ul id="settings-sections" class="subsubsub hide-if-no-js">'."\n"; |
|
117 | 117 | |
118 | 118 | $sections = array( |
119 | - 'all' => array( 'href' => '#all', 'name' => __( 'All', 'woothemes-sensei' ), 'class' => 'current all tab' ) |
|
119 | + 'all' => array('href' => '#all', 'name' => __('All', 'woothemes-sensei'), 'class' => 'current all tab') |
|
120 | 120 | ); |
121 | 121 | |
122 | - foreach ( $this->tabs as $k => $v ) { |
|
123 | - $sections[$k] = array( 'href' => '#' . esc_attr( $k ), 'name' => esc_attr( $v['name'] ), 'class' => 'tab' ); |
|
122 | + foreach ($this->tabs as $k => $v) { |
|
123 | + $sections[$k] = array('href' => '#'.esc_attr($k), 'name' => esc_attr($v['name']), 'class' => 'tab'); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | $count = 1; |
127 | - foreach ( $sections as $k => $v ) { |
|
127 | + foreach ($sections as $k => $v) { |
|
128 | 128 | $count++; |
129 | - $html .= '<li><a href="' . $v['href'] . '"'; |
|
130 | - if ( isset( $v['class'] ) && ( $v['class'] != '' ) ) { $html .= ' class="' . esc_attr( $v['class'] ) . '"'; } |
|
131 | - $html .= '>' . esc_attr( $v['name'] ) . '</a>'; |
|
132 | - if ( $count <= count( $sections ) ) { $html .= ' | '; } |
|
133 | - $html .= '</li>' . "\n"; |
|
129 | + $html .= '<li><a href="'.$v['href'].'"'; |
|
130 | + if (isset($v['class']) && ($v['class'] != '')) { $html .= ' class="'.esc_attr($v['class']).'"'; } |
|
131 | + $html .= '>'.esc_attr($v['name']).'</a>'; |
|
132 | + if ($count <= count($sections)) { $html .= ' | '; } |
|
133 | + $html .= '</li>'."\n"; |
|
134 | 134 | } |
135 | 135 | |
136 | - $html .= '</ul><div class="clear"></div>' . "\n"; |
|
136 | + $html .= '</ul><div class="clear"></div>'."\n"; |
|
137 | 137 | |
138 | 138 | echo $html; |
139 | 139 | } |
@@ -145,10 +145,10 @@ discard block |
||
145 | 145 | * @since 1.1.0 |
146 | 146 | * @return void |
147 | 147 | */ |
148 | - private function create_tabs () { |
|
149 | - if ( count( $this->sections ) > 0 ) { |
|
148 | + private function create_tabs() { |
|
149 | + if (count($this->sections) > 0) { |
|
150 | 150 | $tabs = array(); |
151 | - foreach ( $this->sections as $k => $v ) { |
|
151 | + foreach ($this->sections as $k => $v) { |
|
152 | 152 | $tabs[$k] = $v; |
153 | 153 | } |
154 | 154 | |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | * @since 1.0.0 |
163 | 163 | * @return void |
164 | 164 | */ |
165 | - public function create_sections () { |
|
166 | - if ( count( $this->sections ) > 0 ) { |
|
167 | - foreach ( $this->sections as $k => $v ) { |
|
168 | - add_settings_section( $k, $v['name'], array( $this, 'section_description' ), $this->token ); |
|
165 | + public function create_sections() { |
|
166 | + if (count($this->sections) > 0) { |
|
167 | + foreach ($this->sections as $k => $v) { |
|
168 | + add_settings_section($k, $v['name'], array($this, 'section_description'), $this->token); |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | } // End create_sections() |
@@ -176,18 +176,18 @@ discard block |
||
176 | 176 | * @since 1.0.0 |
177 | 177 | * @return void |
178 | 178 | */ |
179 | - public function create_fields () { |
|
180 | - if ( count( $this->sections ) > 0 ) { |
|
179 | + public function create_fields() { |
|
180 | + if (count($this->sections) > 0) { |
|
181 | 181 | // $this->parse_fields( $this->fields ); |
182 | 182 | |
183 | - foreach ( $this->fields as $k => $v ) { |
|
184 | - $method = $this->determine_method( $v, 'form' ); |
|
183 | + foreach ($this->fields as $k => $v) { |
|
184 | + $method = $this->determine_method($v, 'form'); |
|
185 | 185 | $name = $v['name']; |
186 | - if ( $v['type'] == 'info' ) { $name = ''; } |
|
187 | - add_settings_field( $k, $name, $method, $this->token, $v['section'], array( 'key' => $k, 'data' => $v ) ); |
|
186 | + if ($v['type'] == 'info') { $name = ''; } |
|
187 | + add_settings_field($k, $name, $method, $this->token, $v['section'], array('key' => $k, 'data' => $v)); |
|
188 | 188 | |
189 | 189 | // Let the API know that we have a colourpicker field. |
190 | - if ( $v['type'] == 'range' && $this->has_range == false ) { $this->has_range = true; } |
|
190 | + if ($v['type'] == 'range' && $this->has_range == false) { $this->has_range = true; } |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 | } // End create_fields() |
@@ -199,43 +199,43 @@ discard block |
||
199 | 199 | * @param array $data |
200 | 200 | * @return callable, array or string |
201 | 201 | */ |
202 | - protected function determine_method ( $data, $type = 'form' ) { |
|
202 | + protected function determine_method($data, $type = 'form') { |
|
203 | 203 | $method = ''; |
204 | 204 | |
205 | - if ( ! in_array( $type, array( 'form', 'validate', 'check' ) ) ) { return; } |
|
205 | + if ( ! in_array($type, array('form', 'validate', 'check'))) { return; } |
|
206 | 206 | |
207 | 207 | // Check for custom functions. |
208 | - if ( isset( $data[$type] ) ) { |
|
209 | - if ( function_exists( $data[$type] ) ) { |
|
208 | + if (isset($data[$type])) { |
|
209 | + if (function_exists($data[$type])) { |
|
210 | 210 | $method = $data[$type]; |
211 | 211 | } |
212 | 212 | |
213 | - if ( $method == '' && method_exists( $this, $data[$type] ) ) { |
|
214 | - if ( $type == 'form' ) { |
|
215 | - $method = array( $this, $data[$type] ); |
|
213 | + if ($method == '' && method_exists($this, $data[$type])) { |
|
214 | + if ($type == 'form') { |
|
215 | + $method = array($this, $data[$type]); |
|
216 | 216 | } else { |
217 | 217 | $method = $data[$type]; |
218 | 218 | } |
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
222 | - if ( $method == '' && method_exists ( $this, $type . '_field_' . $data['type'] ) ) { |
|
223 | - if ( $type == 'form' ) { |
|
224 | - $method = array( $this, $type . '_field_' . $data['type'] ); |
|
222 | + if ($method == '' && method_exists($this, $type.'_field_'.$data['type'])) { |
|
223 | + if ($type == 'form') { |
|
224 | + $method = array($this, $type.'_field_'.$data['type']); |
|
225 | 225 | } else { |
226 | - $method = $type . '_field_' . $data['type']; |
|
226 | + $method = $type.'_field_'.$data['type']; |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
230 | - if ( $method == '' && function_exists ( $this->token . '_' . $type . '_field_' . $data['type'] ) ) { |
|
231 | - $method = $this->token . '_' . $type . '_field_' . $data['type']; |
|
230 | + if ($method == '' && function_exists($this->token.'_'.$type.'_field_'.$data['type'])) { |
|
231 | + $method = $this->token.'_'.$type.'_field_'.$data['type']; |
|
232 | 232 | } |
233 | 233 | |
234 | - if ( $method == '' ) { |
|
235 | - if ( $type == 'form' ) { |
|
236 | - $method = array( $this, $type . '_field_text' ); |
|
234 | + if ($method == '') { |
|
235 | + if ($type == 'form') { |
|
236 | + $method = array($this, $type.'_field_text'); |
|
237 | 237 | } else { |
238 | - $method = $type . '_field_text'; |
|
238 | + $method = $type.'_field_text'; |
|
239 | 239 | } |
240 | 240 | } |
241 | 241 | |
@@ -249,10 +249,10 @@ discard block |
||
249 | 249 | * @param array $fields |
250 | 250 | * @return void |
251 | 251 | */ |
252 | - public function parse_fields ( $fields ) { |
|
253 | - foreach ( $fields as $k => $v ) { |
|
254 | - if ( isset( $v['section'] ) && ( $v['section'] != '' ) && ( isset( $this->sections[$v['section']] ) ) ) { |
|
255 | - if ( ! isset( $this->sections[$v['section']]['fields'] ) ) { |
|
252 | + public function parse_fields($fields) { |
|
253 | + foreach ($fields as $k => $v) { |
|
254 | + if (isset($v['section']) && ($v['section'] != '') && (isset($this->sections[$v['section']]))) { |
|
255 | + if ( ! isset($this->sections[$v['section']]['fields'])) { |
|
256 | 256 | $this->sections[$v['section']]['fields'] = array(); |
257 | 257 | } |
258 | 258 | |
@@ -269,19 +269,19 @@ discard block |
||
269 | 269 | * @since 1.0.0 |
270 | 270 | * @return void |
271 | 271 | */ |
272 | - public function register_settings_screen () { |
|
272 | + public function register_settings_screen() { |
|
273 | 273 | |
274 | - if ( current_user_can( 'manage_sensei' ) ) { |
|
275 | - $hook = add_submenu_page( 'sensei', $this->name, $this->menu_label, 'manage_sensei', $this->page_slug, array( $this, 'settings_screen' ) ); |
|
274 | + if (current_user_can('manage_sensei')) { |
|
275 | + $hook = add_submenu_page('sensei', $this->name, $this->menu_label, 'manage_sensei', $this->page_slug, array($this, 'settings_screen')); |
|
276 | 276 | |
277 | 277 | $this->hook = $hook; |
278 | 278 | } |
279 | 279 | |
280 | - if ( isset( $_GET['page'] ) && ( $_GET['page'] == $this->page_slug ) ) { |
|
280 | + if (isset($_GET['page']) && ($_GET['page'] == $this->page_slug)) { |
|
281 | 281 | |
282 | - add_action( 'admin_notices', array( $this, 'settings_errors' ) ); |
|
283 | - add_action( 'admin_print_scripts', array( $this, 'enqueue_scripts' ) ); |
|
284 | - add_action( 'admin_print_styles', array( $this, 'enqueue_styles' ) ); |
|
282 | + add_action('admin_notices', array($this, 'settings_errors')); |
|
283 | + add_action('admin_print_scripts', array($this, 'enqueue_scripts')); |
|
284 | + add_action('admin_print_styles', array($this, 'enqueue_styles')); |
|
285 | 285 | |
286 | 286 | } |
287 | 287 | } // End register_settings_screen() |
@@ -292,14 +292,14 @@ discard block |
||
292 | 292 | * @since 1.0.0 |
293 | 293 | * @return void |
294 | 294 | */ |
295 | - public function settings_screen () |
|
295 | + public function settings_screen() |
|
296 | 296 | { |
297 | 297 | |
298 | 298 | ?> |
299 | 299 | <div id="woothemes-sensei" class="wrap <?php echo esc_attr($this->token); ?>"> |
300 | 300 | <?php screen_icon('woothemes-sensei'); ?> |
301 | 301 | <h2><?php echo esc_html($this->name); ?><?php if ('' != $this->settings_version) { |
302 | - echo ' <span class="version">' . $this->settings_version . '</span>'; |
|
302 | + echo ' <span class="version">'.$this->settings_version.'</span>'; |
|
303 | 303 | } ?></h2> |
304 | 304 | <p class="powered-by-woo"><?php _e('Powered by', 'woothemes-sensei'); ?><a href="http://www.woothemes.com/" |
305 | 305 | title="WooThemes"><img |
@@ -313,13 +313,13 @@ discard block |
||
313 | 313 | $page = 'woothemes-sensei-settings'; |
314 | 314 | foreach ($this->sections as $section_id => $section) { |
315 | 315 | |
316 | - echo '<section id="' . $section_id . '">'; |
|
316 | + echo '<section id="'.$section_id.'">'; |
|
317 | 317 | |
318 | 318 | if ($section['name']) |
319 | 319 | echo "<h2>{$section['name']}</h2>\n"; |
320 | 320 | |
321 | 321 | echo '<table class="form-table">'; |
322 | - do_settings_fields($page, $section_id ); |
|
322 | + do_settings_fields($page, $section_id); |
|
323 | 323 | echo '</table>'; |
324 | 324 | |
325 | 325 | echo '</section>'; |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | submit_button(); |
330 | 330 | ?> |
331 | 331 | </form> |
332 | - <?php do_action( 'settings_after_form' ); ?> |
|
332 | + <?php do_action('settings_after_form'); ?> |
|
333 | 333 | </div><!--/#woothemes-sensei--> |
334 | 334 | <?php |
335 | 335 | } // End settings_screen() |
@@ -340,15 +340,15 @@ discard block |
||
340 | 340 | * @since 1.0.0 |
341 | 341 | * @return array |
342 | 342 | */ |
343 | - public function get_settings () { |
|
343 | + public function get_settings() { |
|
344 | 344 | |
345 | - $this->settings = get_option( $this->token, array() ); |
|
345 | + $this->settings = get_option($this->token, array()); |
|
346 | 346 | |
347 | - foreach ( $this->fields as $k => $v ) { |
|
348 | - if ( ! isset( $this->settings[$k] ) && isset( $v['default'] ) ) { |
|
347 | + foreach ($this->fields as $k => $v) { |
|
348 | + if ( ! isset($this->settings[$k]) && isset($v['default'])) { |
|
349 | 349 | $this->settings[$k] = $v['default']; |
350 | 350 | } |
351 | - if ( $v['type'] == 'checkbox' && $this->settings[$k] != true ) { |
|
351 | + if ($v['type'] == 'checkbox' && $this->settings[$k] != true) { |
|
352 | 352 | $this->settings[$k] = 0; |
353 | 353 | } |
354 | 354 | } |
@@ -362,8 +362,8 @@ discard block |
||
362 | 362 | * @since 1.0.0 |
363 | 363 | * @return void |
364 | 364 | */ |
365 | - public function settings_fields () { |
|
366 | - register_setting( $this->token, $this->token, array( $this, 'validate_fields' ) ); |
|
365 | + public function settings_fields() { |
|
366 | + register_setting($this->token, $this->token, array($this, 'validate_fields')); |
|
367 | 367 | $this->create_sections(); |
368 | 368 | $this->create_fields(); |
369 | 369 | } // End settings_fields() |
@@ -374,8 +374,8 @@ discard block |
||
374 | 374 | * @since 1.0.0 |
375 | 375 | * @return void |
376 | 376 | */ |
377 | - public function settings_errors () { |
|
378 | - settings_errors( $this->token . '-errors' ); |
|
377 | + public function settings_errors() { |
|
378 | + settings_errors($this->token.'-errors'); |
|
379 | 379 | } // End settings_errors() |
380 | 380 | |
381 | 381 | /** |
@@ -384,9 +384,9 @@ discard block |
||
384 | 384 | * @since 1.0.0 |
385 | 385 | * @return void |
386 | 386 | */ |
387 | - public function section_description ( $section ) { |
|
388 | - if ( isset( $this->sections[$section['id']]['description'] ) ) { |
|
389 | - echo wpautop( $this->sections[$section['id']]['description'] ); |
|
387 | + public function section_description($section) { |
|
388 | + if (isset($this->sections[$section['id']]['description'])) { |
|
389 | + echo wpautop($this->sections[$section['id']]['description']); |
|
390 | 390 | } |
391 | 391 | } // End section_description_main() |
392 | 392 | |
@@ -397,12 +397,12 @@ discard block |
||
397 | 397 | * @param array $args |
398 | 398 | * @return void |
399 | 399 | */ |
400 | - public function form_field_text ( $args ) { |
|
400 | + public function form_field_text($args) { |
|
401 | 401 | $options = $this->get_settings(); |
402 | 402 | |
403 | - echo '<input id="' . esc_attr( $args['key'] ) . '" name="' . $this->token . '[' . esc_attr( $args['key'] ) . ']" size="40" type="text" value="' . esc_attr( $options[$args['key']] ) . '" />' . "\n"; |
|
404 | - if ( isset( $args['data']['description'] ) ) { |
|
405 | - echo '<span class="description">' . $args['data']['description'] . '</span>' . "\n"; |
|
403 | + echo '<input id="'.esc_attr($args['key']).'" name="'.$this->token.'['.esc_attr($args['key']).']" size="40" type="text" value="'.esc_attr($options[$args['key']]).'" />'."\n"; |
|
404 | + if (isset($args['data']['description'])) { |
|
405 | + echo '<span class="description">'.$args['data']['description'].'</span>'."\n"; |
|
406 | 406 | } |
407 | 407 | } // End form_field_text() |
408 | 408 | |
@@ -413,13 +413,13 @@ discard block |
||
413 | 413 | * @param array $args |
414 | 414 | * @return void |
415 | 415 | */ |
416 | - public function form_field_color ( $args ) { |
|
416 | + public function form_field_color($args) { |
|
417 | 417 | $options = $this->get_settings(); |
418 | 418 | |
419 | - echo '<input id="' . esc_attr( $args['key'] ) . '" name="' . $this->token . '[' . esc_attr( $args['key'] ) . ']" size="40" type="text" class="color" value="' . esc_attr( $options[$args['key']] ) . '" />' . "\n"; |
|
419 | + echo '<input id="'.esc_attr($args['key']).'" name="'.$this->token.'['.esc_attr($args['key']).']" size="40" type="text" class="color" value="'.esc_attr($options[$args['key']]).'" />'."\n"; |
|
420 | 420 | echo '<div style="position:absolute;background:#FFF;z-index:99;border-radius:100%;" class="colorpicker"></div>'; |
421 | - if ( isset( $args['data']['description'] ) ) { |
|
422 | - echo '<span class="description">' . $args['data']['description'] . '</span>' . "\n"; |
|
421 | + if (isset($args['data']['description'])) { |
|
422 | + echo '<span class="description">'.$args['data']['description'].'</span>'."\n"; |
|
423 | 423 | } |
424 | 424 | } // End form_field_text() |
425 | 425 | |
@@ -430,22 +430,22 @@ discard block |
||
430 | 430 | * @param array $args |
431 | 431 | * @return void |
432 | 432 | */ |
433 | - public function form_field_checkbox ( $args ) { |
|
433 | + public function form_field_checkbox($args) { |
|
434 | 434 | $options = $this->get_settings(); |
435 | 435 | |
436 | 436 | $has_description = false; |
437 | - if ( isset( $args['data']['description'] ) ) { |
|
437 | + if (isset($args['data']['description'])) { |
|
438 | 438 | $has_description = true; |
439 | - echo '<label for="' . esc_attr( $args['key'] ) . '">' . "\n"; |
|
439 | + echo '<label for="'.esc_attr($args['key']).'">'."\n"; |
|
440 | 440 | } |
441 | - echo '<input id="' . $args['key'] . '" name="' . $this->token . '[' . esc_attr( $args['key'] ) . ']" type="checkbox" value="1"' . checked( esc_attr( $options[$args['key']] ), '1', false ) . ' />' . "\n"; |
|
442 | - if ( $has_description ) { |
|
443 | - echo wp_kses( $args['data']['description'], array( 'a' => array( |
|
441 | + echo '<input id="'.$args['key'].'" name="'.$this->token.'['.esc_attr($args['key']).']" type="checkbox" value="1"'.checked(esc_attr($options[$args['key']]), '1', false).' />'."\n"; |
|
442 | + if ($has_description) { |
|
443 | + echo wp_kses($args['data']['description'], array('a' => array( |
|
444 | 444 | 'href' => array(), |
445 | 445 | 'title' => array() |
446 | 446 | ) |
447 | 447 | ) |
448 | - ) . '</label>' . "\n"; |
|
448 | + ).'</label>'."\n"; |
|
449 | 449 | } |
450 | 450 | } // End form_field_checkbox() |
451 | 451 | |
@@ -456,12 +456,12 @@ discard block |
||
456 | 456 | * @param array $args |
457 | 457 | * @return void |
458 | 458 | */ |
459 | - public function form_field_textarea ( $args ) { |
|
459 | + public function form_field_textarea($args) { |
|
460 | 460 | $options = $this->get_settings(); |
461 | 461 | |
462 | - echo '<textarea id="' . esc_attr( $args['key'] ) . '" name="' . $this->token . '[' . esc_attr( $args['key'] ) . ']" cols="42" rows="5">' . esc_html( $options[$args['key']] ) . '</textarea>' . "\n"; |
|
463 | - if ( isset( $args['data']['description'] ) ) { |
|
464 | - echo '<p><span class="description">' . esc_html( $args['data']['description'] ) . '</span></p>' . "\n"; |
|
462 | + echo '<textarea id="'.esc_attr($args['key']).'" name="'.$this->token.'['.esc_attr($args['key']).']" cols="42" rows="5">'.esc_html($options[$args['key']]).'</textarea>'."\n"; |
|
463 | + if (isset($args['data']['description'])) { |
|
464 | + echo '<p><span class="description">'.esc_html($args['data']['description']).'</span></p>'."\n"; |
|
465 | 465 | } |
466 | 466 | } // End form_field_textarea() |
467 | 467 | |
@@ -472,20 +472,20 @@ discard block |
||
472 | 472 | * @param array $args |
473 | 473 | * @return void |
474 | 474 | */ |
475 | - public function form_field_select ( $args ) { |
|
475 | + public function form_field_select($args) { |
|
476 | 476 | $options = $this->get_settings(); |
477 | 477 | |
478 | - if ( isset( $args['data']['options'] ) && ( count( (array)$args['data']['options'] ) > 0 ) ) { |
|
478 | + if (isset($args['data']['options']) && (count((array) $args['data']['options']) > 0)) { |
|
479 | 479 | $html = ''; |
480 | - $html .= '<select class="" id="' . esc_attr( $args['key'] ) . '" name="' . esc_attr( $this->token ) . '[' . esc_attr( $args['key'] ) . ']">' . "\n"; |
|
481 | - foreach ( $args['data']['options'] as $k => $v ) { |
|
482 | - $html .= '<option value="' . esc_attr( $k ) . '"' . selected( esc_attr( $options[$args['key']] ), $k, false ) . '>' . $v . '</option>' . "\n"; |
|
480 | + $html .= '<select class="" id="'.esc_attr($args['key']).'" name="'.esc_attr($this->token).'['.esc_attr($args['key']).']">'."\n"; |
|
481 | + foreach ($args['data']['options'] as $k => $v) { |
|
482 | + $html .= '<option value="'.esc_attr($k).'"'.selected(esc_attr($options[$args['key']]), $k, false).'>'.$v.'</option>'."\n"; |
|
483 | 483 | } |
484 | - $html .= '</select>' . "\n"; |
|
484 | + $html .= '</select>'."\n"; |
|
485 | 485 | echo $html; |
486 | 486 | |
487 | - if ( isset( $args['data']['description'] ) ) { |
|
488 | - echo '<p><span class="description">' . esc_html( $args['data']['description'] ) . '</span></p>' . "\n"; |
|
487 | + if (isset($args['data']['description'])) { |
|
488 | + echo '<p><span class="description">'.esc_html($args['data']['description']).'</span></p>'."\n"; |
|
489 | 489 | } |
490 | 490 | } |
491 | 491 | } // End form_field_select() |
@@ -497,18 +497,18 @@ discard block |
||
497 | 497 | * @param array $args |
498 | 498 | * @return void |
499 | 499 | */ |
500 | - public function form_field_radio ( $args ) { |
|
500 | + public function form_field_radio($args) { |
|
501 | 501 | $options = $this->get_settings(); |
502 | 502 | |
503 | - if ( isset( $args['data']['options'] ) && ( count( (array)$args['data']['options'] ) > 0 ) ) { |
|
503 | + if (isset($args['data']['options']) && (count((array) $args['data']['options']) > 0)) { |
|
504 | 504 | $html = ''; |
505 | - foreach ( $args['data']['options'] as $k => $v ) { |
|
506 | - $html .= '<input type="radio" name="' . $this->token . '[' . esc_attr( $args['key'] ) . ']" value="' . esc_attr( $k ) . '"' . checked( esc_attr( $options[$args['key']] ), $k, false ) . ' /> ' . $v . '<br />' . "\n"; |
|
505 | + foreach ($args['data']['options'] as $k => $v) { |
|
506 | + $html .= '<input type="radio" name="'.$this->token.'['.esc_attr($args['key']).']" value="'.esc_attr($k).'"'.checked(esc_attr($options[$args['key']]), $k, false).' /> '.$v.'<br />'."\n"; |
|
507 | 507 | } |
508 | 508 | echo $html; |
509 | 509 | |
510 | - if ( isset( $args['data']['description'] ) ) { |
|
511 | - echo '<span class="description">' . esc_html( $args['data']['description'] ) . '</span>' . "\n"; |
|
510 | + if (isset($args['data']['description'])) { |
|
511 | + echo '<span class="description">'.esc_html($args['data']['description']).'</span>'."\n"; |
|
512 | 512 | } |
513 | 513 | } |
514 | 514 | } // End form_field_radio() |
@@ -520,28 +520,28 @@ discard block |
||
520 | 520 | * @param array $args |
521 | 521 | * @return void |
522 | 522 | */ |
523 | - public function form_field_multicheck ( $args ) { |
|
523 | + public function form_field_multicheck($args) { |
|
524 | 524 | $options = $this->get_settings(); |
525 | 525 | |
526 | - if ( isset( $args['data']['options'] ) && ( count( (array)$args['data']['options'] ) > 0 ) ) { |
|
527 | - $html = '<div class="multicheck-container" style="margin-bottom:10px;">' . "\n"; |
|
528 | - foreach ( $args['data']['options'] as $k => $v ) { |
|
526 | + if (isset($args['data']['options']) && (count((array) $args['data']['options']) > 0)) { |
|
527 | + $html = '<div class="multicheck-container" style="margin-bottom:10px;">'."\n"; |
|
528 | + foreach ($args['data']['options'] as $k => $v) { |
|
529 | 529 | $checked = ''; |
530 | 530 | |
531 | - if( isset( $options[ $args['key'] ] ) ) { |
|
532 | - if ( in_array( $k, (array)$options[ $args['key'] ] ) ) { $checked = ' checked="checked"'; } |
|
531 | + if (isset($options[$args['key']])) { |
|
532 | + if (in_array($k, (array) $options[$args['key']])) { $checked = ' checked="checked"'; } |
|
533 | 533 | } else { |
534 | - if ( in_array( $k, $args['data']['defaults'] ) ) { $checked = ' checked="checked"'; } |
|
534 | + if (in_array($k, $args['data']['defaults'])) { $checked = ' checked="checked"'; } |
|
535 | 535 | } |
536 | - $html .= '<label for="checkbox-' . esc_attr( $k ) . '">' . "\n"; |
|
537 | - $html .= '<input type="checkbox" name="' . esc_attr( $this->token ) . '[' . esc_attr( $args['key'] ) . '][]" class="multicheck multicheck-' . esc_attr( $args['key'] ) . '" value="' . esc_attr( $k ) . '" id="checkbox-' . esc_attr( $k ) . '" ' . $checked . ' /> ' . $v . "\n"; |
|
538 | - $html .= '</label><br />' . "\n"; |
|
536 | + $html .= '<label for="checkbox-'.esc_attr($k).'">'."\n"; |
|
537 | + $html .= '<input type="checkbox" name="'.esc_attr($this->token).'['.esc_attr($args['key']).'][]" class="multicheck multicheck-'.esc_attr($args['key']).'" value="'.esc_attr($k).'" id="checkbox-'.esc_attr($k).'" '.$checked.' /> '.$v."\n"; |
|
538 | + $html .= '</label><br />'."\n"; |
|
539 | 539 | } |
540 | - $html .= '</div>' . "\n"; |
|
540 | + $html .= '</div>'."\n"; |
|
541 | 541 | echo $html; |
542 | 542 | |
543 | - if ( isset( $args['data']['description'] ) ) { |
|
544 | - echo '<span class="description">' . esc_html( $args['data']['description'] ) . '</span>' . "\n"; |
|
543 | + if (isset($args['data']['description'])) { |
|
544 | + echo '<span class="description">'.esc_html($args['data']['description']).'</span>'."\n"; |
|
545 | 545 | } |
546 | 546 | } |
547 | 547 | } // End form_field_multicheck() |
@@ -553,20 +553,20 @@ discard block |
||
553 | 553 | * @param array $args |
554 | 554 | * @return void |
555 | 555 | */ |
556 | - public function form_field_range ( $args ) { |
|
556 | + public function form_field_range($args) { |
|
557 | 557 | $options = $this->get_settings(); |
558 | 558 | |
559 | - if ( isset( $args['data']['options'] ) && ( count( (array)$args['data']['options'] ) > 0 ) ) { |
|
559 | + if (isset($args['data']['options']) && (count((array) $args['data']['options']) > 0)) { |
|
560 | 560 | $html = ''; |
561 | - $html .= '<select id="' . esc_attr( $args['key'] ) . '" name="' . esc_attr( $this->token ) . '[' . esc_attr( $args['key'] ) . ']" class="range-input">' . "\n"; |
|
562 | - foreach ( $args['data']['options'] as $k => $v ) { |
|
563 | - $html .= '<option value="' . esc_attr( $k ) . '"' . selected( esc_attr( $options[$args['key']] ), $k, false ) . '>' . $v . '</option>' . "\n"; |
|
561 | + $html .= '<select id="'.esc_attr($args['key']).'" name="'.esc_attr($this->token).'['.esc_attr($args['key']).']" class="range-input">'."\n"; |
|
562 | + foreach ($args['data']['options'] as $k => $v) { |
|
563 | + $html .= '<option value="'.esc_attr($k).'"'.selected(esc_attr($options[$args['key']]), $k, false).'>'.$v.'</option>'."\n"; |
|
564 | 564 | } |
565 | - $html .= '</select>' . "\n"; |
|
565 | + $html .= '</select>'."\n"; |
|
566 | 566 | echo $html; |
567 | 567 | |
568 | - if ( isset( $args['data']['description'] ) ) { |
|
569 | - echo '<p><span class="description">' . esc_html( $args['data']['description'] ) . '</span></p>' . "\n"; |
|
568 | + if (isset($args['data']['description'])) { |
|
569 | + echo '<p><span class="description">'.esc_html($args['data']['description']).'</span></p>'."\n"; |
|
570 | 570 | } |
571 | 571 | } |
572 | 572 | } // End form_field_range() |
@@ -578,18 +578,18 @@ discard block |
||
578 | 578 | * @param array $args |
579 | 579 | * @return void |
580 | 580 | */ |
581 | - public function form_field_images ( $args ) { |
|
581 | + public function form_field_images($args) { |
|
582 | 582 | $options = $this->get_settings(); |
583 | 583 | |
584 | - if ( isset( $args['data']['options'] ) && ( count( (array)$args['data']['options'] ) > 0 ) ) { |
|
584 | + if (isset($args['data']['options']) && (count((array) $args['data']['options']) > 0)) { |
|
585 | 585 | $html = ''; |
586 | - foreach ( $args['data']['options'] as $k => $v ) { |
|
587 | - $html .= '<input type="radio" name="' . esc_attr( $this->token ) . '[' . esc_attr( $args['key'] ) . ']" value="' . esc_attr( $k ) . '"' . checked( esc_attr( $options[$args['key']] ), $k, false ) . ' /> ' . $v . '<br />' . "\n"; |
|
586 | + foreach ($args['data']['options'] as $k => $v) { |
|
587 | + $html .= '<input type="radio" name="'.esc_attr($this->token).'['.esc_attr($args['key']).']" value="'.esc_attr($k).'"'.checked(esc_attr($options[$args['key']]), $k, false).' /> '.$v.'<br />'."\n"; |
|
588 | 588 | } |
589 | 589 | echo $html; |
590 | 590 | |
591 | - if ( isset( $args['data']['description'] ) ) { |
|
592 | - echo '<span class="description">' . esc_html( $args['data']['description'] ) . '</span>' . "\n"; |
|
591 | + if (isset($args['data']['description'])) { |
|
592 | + echo '<span class="description">'.esc_html($args['data']['description']).'</span>'."\n"; |
|
593 | 593 | } |
594 | 594 | } |
595 | 595 | } // End form_field_images() |
@@ -601,19 +601,19 @@ discard block |
||
601 | 601 | * @param array $args |
602 | 602 | * @return void |
603 | 603 | */ |
604 | - public function form_field_info ( $args ) { |
|
604 | + public function form_field_info($args) { |
|
605 | 605 | $class = ''; |
606 | - if ( isset( $args['data']['class'] ) ) { |
|
607 | - $class = ' ' . esc_attr( $args['data']['class'] ); |
|
606 | + if (isset($args['data']['class'])) { |
|
607 | + $class = ' '.esc_attr($args['data']['class']); |
|
608 | 608 | } |
609 | - $html = '<div id="' . $args['key'] . '" class="info-box' . $class . '">' . "\n"; |
|
610 | - if ( isset( $args['data']['name'] ) && ( $args['data']['name'] != '' ) ) { |
|
611 | - $html .= '<h3 class="title">' . esc_html( $args['data']['name'] ) . '</h3>' . "\n"; |
|
609 | + $html = '<div id="'.$args['key'].'" class="info-box'.$class.'">'."\n"; |
|
610 | + if (isset($args['data']['name']) && ($args['data']['name'] != '')) { |
|
611 | + $html .= '<h3 class="title">'.esc_html($args['data']['name']).'</h3>'."\n"; |
|
612 | 612 | } |
613 | - if ( isset( $args['data']['description'] ) && ( $args['data']['description'] != '' ) ) { |
|
614 | - $html .= '<p>' . esc_html( $args['data']['description'] ) . '</p>' . "\n"; |
|
613 | + if (isset($args['data']['description']) && ($args['data']['description'] != '')) { |
|
614 | + $html .= '<p>'.esc_html($args['data']['description']).'</p>'."\n"; |
|
615 | 615 | } |
616 | - $html .= '</div>' . "\n"; |
|
616 | + $html .= '</div>'."\n"; |
|
617 | 617 | |
618 | 618 | echo $html; |
619 | 619 | } // End form_field_info() |
@@ -625,14 +625,14 @@ discard block |
||
625 | 625 | * @since 1.9.0 |
626 | 626 | * @param array $args |
627 | 627 | */ |
628 | - public function form_field_button( $args ) { |
|
628 | + public function form_field_button($args) { |
|
629 | 629 | $options = $this->get_settings(); |
630 | 630 | |
631 | - if ( isset( $args['data']['target'] ) && isset( $args['data']['label'] ) ) { |
|
632 | - printf( '<a href="%s" class="button button-secondary">%s</a> ', esc_url( $args['data']['target'] ), esc_html( $args['data']['label'] ) ); |
|
631 | + if (isset($args['data']['target']) && isset($args['data']['label'])) { |
|
632 | + printf('<a href="%s" class="button button-secondary">%s</a> ', esc_url($args['data']['target']), esc_html($args['data']['label'])); |
|
633 | 633 | |
634 | - if ( isset( $args['data']['description'] ) ) { |
|
635 | - echo '<span class="description">' . esc_html( $args['data']['description'] ) . '</span>' . "\n"; |
|
634 | + if (isset($args['data']['description'])) { |
|
635 | + echo '<span class="description">'.esc_html($args['data']['description']).'</span>'."\n"; |
|
636 | 636 | } |
637 | 637 | } |
638 | 638 | } // End form_field_button() |
@@ -646,23 +646,23 @@ discard block |
||
646 | 646 | * @uses $this->parse_errors() |
647 | 647 | * @return array $options |
648 | 648 | */ |
649 | - public function validate_fields ( $input ) { |
|
649 | + public function validate_fields($input) { |
|
650 | 650 | $options = $this->get_settings(); |
651 | 651 | |
652 | - foreach ( $this->fields as $k => $v ) { |
|
652 | + foreach ($this->fields as $k => $v) { |
|
653 | 653 | // Make sure checkboxes are present even when false. |
654 | - if ( $v['type'] == 'checkbox' && ! isset( $input[$k] ) ) { $input[$k] = false; } |
|
655 | - if ( $v['type'] == 'multicheck' && ! isset( $input[$k] ) ) { $input[$k] = false; } |
|
654 | + if ($v['type'] == 'checkbox' && ! isset($input[$k])) { $input[$k] = false; } |
|
655 | + if ($v['type'] == 'multicheck' && ! isset($input[$k])) { $input[$k] = false; } |
|
656 | 656 | |
657 | - if ( isset( $input[$k] ) ) { |
|
657 | + if (isset($input[$k])) { |
|
658 | 658 | // Perform checks on required fields. |
659 | - if ( isset( $v['required'] ) && ( $v['required'] == true ) ) { |
|
660 | - if ( in_array( $v['type'], $this->get_array_field_types() ) && ( count( (array) $input[$k] ) <= 0 ) ) { |
|
661 | - $this->add_error( $k, $v ); |
|
659 | + if (isset($v['required']) && ($v['required'] == true)) { |
|
660 | + if (in_array($v['type'], $this->get_array_field_types()) && (count((array) $input[$k]) <= 0)) { |
|
661 | + $this->add_error($k, $v); |
|
662 | 662 | continue; |
663 | 663 | } else { |
664 | - if ( $input[$k] == '' ) { |
|
665 | - $this->add_error( $k, $v ); |
|
664 | + if ($input[$k] == '') { |
|
665 | + $this->add_error($k, $v); |
|
666 | 666 | continue; |
667 | 667 | } |
668 | 668 | } |
@@ -671,28 +671,28 @@ discard block |
||
671 | 671 | $value = $input[$k]; |
672 | 672 | |
673 | 673 | // Check if the field is valid. |
674 | - $method = $this->determine_method( $v, 'check' ); |
|
674 | + $method = $this->determine_method($v, 'check'); |
|
675 | 675 | |
676 | - if ( function_exists ( $method ) ) { |
|
677 | - $is_valid = $method( $value ); |
|
676 | + if (function_exists($method)) { |
|
677 | + $is_valid = $method($value); |
|
678 | 678 | } else { |
679 | - if ( method_exists( $this, $method ) ) { |
|
680 | - $is_valid = $this->$method( $value ); |
|
679 | + if (method_exists($this, $method)) { |
|
680 | + $is_valid = $this->$method($value); |
|
681 | 681 | } |
682 | 682 | } |
683 | 683 | |
684 | - if ( ! $is_valid ) { |
|
685 | - $this->add_error( $k, $v ); |
|
684 | + if ( ! $is_valid) { |
|
685 | + $this->add_error($k, $v); |
|
686 | 686 | continue; |
687 | 687 | } |
688 | 688 | |
689 | - $method = $this->determine_method( $v, 'validate' ); |
|
689 | + $method = $this->determine_method($v, 'validate'); |
|
690 | 690 | |
691 | - if ( function_exists ( $method ) ) { |
|
692 | - $options[$k] = $method( $value ); |
|
691 | + if (function_exists($method)) { |
|
692 | + $options[$k] = $method($value); |
|
693 | 693 | } else { |
694 | - if ( method_exists( $this, $method ) ) { |
|
695 | - $options[$k] = $this->$method( $value ); |
|
694 | + if (method_exists($this, $method)) { |
|
695 | + $options[$k] = $this->$method($value); |
|
696 | 696 | } |
697 | 697 | } |
698 | 698 | } |
@@ -710,8 +710,8 @@ discard block |
||
710 | 710 | * @param string $input |
711 | 711 | * @return string |
712 | 712 | */ |
713 | - public function validate_field_text ( $input ) { |
|
714 | - return trim( esc_attr( $input ) ); |
|
713 | + public function validate_field_text($input) { |
|
714 | + return trim(esc_attr($input)); |
|
715 | 715 | } // End validate_field_text() |
716 | 716 | |
717 | 717 | /** |
@@ -721,11 +721,11 @@ discard block |
||
721 | 721 | * @param string $input |
722 | 722 | * @return string |
723 | 723 | */ |
724 | - public function validate_field_checkbox ( $input ) { |
|
725 | - if ( ! isset( $input ) ) { |
|
724 | + public function validate_field_checkbox($input) { |
|
725 | + if ( ! isset($input)) { |
|
726 | 726 | return 0; |
727 | 727 | } else { |
728 | - return (bool)$input; |
|
728 | + return (bool) $input; |
|
729 | 729 | } |
730 | 730 | } // End validate_field_checkbox() |
731 | 731 | |
@@ -736,10 +736,10 @@ discard block |
||
736 | 736 | * @param string $input |
737 | 737 | * @return string |
738 | 738 | */ |
739 | - public function validate_field_multicheck ( $input ) { |
|
739 | + public function validate_field_multicheck($input) { |
|
740 | 740 | $input = (array) $input; |
741 | 741 | |
742 | - $input = array_map( 'esc_attr', $input ); |
|
742 | + $input = array_map('esc_attr', $input); |
|
743 | 743 | |
744 | 744 | return $input; |
745 | 745 | } // End validate_field_multicheck() |
@@ -751,8 +751,8 @@ discard block |
||
751 | 751 | * @param string $input |
752 | 752 | * @return string |
753 | 753 | */ |
754 | - public function validate_field_range ( $input ) { |
|
755 | - $input = number_format( floatval( $input ), 0 ); |
|
754 | + public function validate_field_range($input) { |
|
755 | + $input = number_format(floatval($input), 0); |
|
756 | 756 | |
757 | 757 | return $input; |
758 | 758 | } // End validate_field_range() |
@@ -764,8 +764,8 @@ discard block |
||
764 | 764 | * @param string $input |
765 | 765 | * @return string |
766 | 766 | */ |
767 | - public function validate_field_url ( $input ) { |
|
768 | - return trim( esc_url( $input ) ); |
|
767 | + public function validate_field_url($input) { |
|
768 | + return trim(esc_url($input)); |
|
769 | 769 | } // End validate_field_url() |
770 | 770 | |
771 | 771 | /** |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | * @since 1.1.0 |
775 | 775 | * @return boolean Is the value valid? |
776 | 776 | */ |
777 | - public function check_field_text ( $input ) { |
|
777 | + public function check_field_text($input) { |
|
778 | 778 | $is_valid = true; |
779 | 779 | |
780 | 780 | return $is_valid; |
@@ -788,11 +788,11 @@ discard block |
||
788 | 788 | * @param array $data |
789 | 789 | * @return void |
790 | 790 | */ |
791 | - protected function add_error ( $key, $data ) { |
|
792 | - if ( isset( $data['error_message'] ) ) { |
|
791 | + protected function add_error($key, $data) { |
|
792 | + if (isset($data['error_message'])) { |
|
793 | 793 | $message = $data['error_message']; |
794 | 794 | } else { |
795 | - $message = sprintf( __( '%s is a required field', 'woothemes-sensei' ), $data['name'] ); |
|
795 | + $message = sprintf(__('%s is a required field', 'woothemes-sensei'), $data['name']); |
|
796 | 796 | } |
797 | 797 | $this->errors[$key] = $message; |
798 | 798 | } // End add_error() |
@@ -803,14 +803,14 @@ discard block |
||
803 | 803 | * @since 1.0.0 |
804 | 804 | * @return void |
805 | 805 | */ |
806 | - protected function parse_errors () { |
|
807 | - if ( count ( $this->errors ) > 0 ) { |
|
808 | - foreach ( $this->errors as $k => $v ) { |
|
809 | - add_settings_error( $this->token . '-errors', $k, $v, 'error' ); |
|
806 | + protected function parse_errors() { |
|
807 | + if (count($this->errors) > 0) { |
|
808 | + foreach ($this->errors as $k => $v) { |
|
809 | + add_settings_error($this->token.'-errors', $k, $v, 'error'); |
|
810 | 810 | } |
811 | 811 | } else { |
812 | - $message = sprintf( __( '%s updated', 'woothemes-sensei' ), $this->name ); |
|
813 | - add_settings_error( $this->token . '-errors', $this->token, $message, 'updated' ); |
|
812 | + $message = sprintf(__('%s updated', 'woothemes-sensei'), $this->name); |
|
813 | + add_settings_error($this->token.'-errors', $this->token, $message, 'updated'); |
|
814 | 814 | } |
815 | 815 | } // End parse_errors() |
816 | 816 | |
@@ -820,8 +820,8 @@ discard block |
||
820 | 820 | * @since 1.0.0 |
821 | 821 | * @return array |
822 | 822 | */ |
823 | - protected function get_array_field_types () { |
|
824 | - return array( 'multicheck' ); |
|
823 | + protected function get_array_field_types() { |
|
824 | + return array('multicheck'); |
|
825 | 825 | } // End get_array_field_types() |
826 | 826 | |
827 | 827 | /** |
@@ -830,21 +830,21 @@ discard block |
||
830 | 830 | * @since 1.0.0 |
831 | 831 | * @return void |
832 | 832 | */ |
833 | - public function enqueue_scripts () { |
|
833 | + public function enqueue_scripts() { |
|
834 | 834 | |
835 | - $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
835 | + $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; |
|
836 | 836 | |
837 | - wp_enqueue_script( 'farbtastic' ); |
|
838 | - wp_enqueue_script( 'woothemes-sensei-settings', esc_url( Sensei()->plugin_url . 'assets/js/settings' . $suffix . '.js' ), array( 'jquery', 'farbtastic' ), Sensei()->version ); |
|
837 | + wp_enqueue_script('farbtastic'); |
|
838 | + wp_enqueue_script('woothemes-sensei-settings', esc_url(Sensei()->plugin_url.'assets/js/settings'.$suffix.'.js'), array('jquery', 'farbtastic'), Sensei()->version); |
|
839 | 839 | |
840 | - if ( $this->has_range ) { |
|
841 | - wp_enqueue_script( 'woothemes-sensei-settings-ranges', esc_url( Sensei()->plugin_url . 'assets/js/ranges' . $suffix . '.js' ), array( 'jquery-ui-slider' ), Sensei()->version ); |
|
840 | + if ($this->has_range) { |
|
841 | + wp_enqueue_script('woothemes-sensei-settings-ranges', esc_url(Sensei()->plugin_url.'assets/js/ranges'.$suffix.'.js'), array('jquery-ui-slider'), Sensei()->version); |
|
842 | 842 | } |
843 | 843 | |
844 | - wp_register_script( 'woothemes-sensei-settings-imageselectors', esc_url( Sensei()->plugin_url . 'assets/js/image-selectors' . $suffix . '.js' ), array( 'jquery' ), Sensei()->version ); |
|
844 | + wp_register_script('woothemes-sensei-settings-imageselectors', esc_url(Sensei()->plugin_url.'assets/js/image-selectors'.$suffix.'.js'), array('jquery'), Sensei()->version); |
|
845 | 845 | |
846 | - if ( $this->has_imageselector ) { |
|
847 | - wp_enqueue_script( 'woothemes-sensei-settings-imageselectors' ); |
|
846 | + if ($this->has_imageselector) { |
|
847 | + wp_enqueue_script('woothemes-sensei-settings-imageselectors'); |
|
848 | 848 | } |
849 | 849 | |
850 | 850 | } // End enqueue_scripts() |
@@ -855,12 +855,12 @@ discard block |
||
855 | 855 | * @since 1.0.0 |
856 | 856 | * @return void |
857 | 857 | */ |
858 | - public function enqueue_styles () { |
|
858 | + public function enqueue_styles() { |
|
859 | 859 | |
860 | - wp_enqueue_style( $this->token . '-admin' ); |
|
860 | + wp_enqueue_style($this->token.'-admin'); |
|
861 | 861 | |
862 | - wp_enqueue_style( 'farbtastic' ); |
|
863 | - wp_enqueue_style( 'woothemes-sensei-settings-api', esc_url( Sensei()->plugin_url . 'assets/css/settings.css' ), array( 'farbtastic' ), Sensei()->version ); |
|
862 | + wp_enqueue_style('farbtastic'); |
|
863 | + wp_enqueue_style('woothemes-sensei-settings-api', esc_url(Sensei()->plugin_url.'assets/css/settings.css'), array('farbtastic'), Sensei()->version); |
|
864 | 864 | |
865 | 865 | $this->enqueue_field_styles(); |
866 | 866 | } // End enqueue_styles() |
@@ -871,16 +871,16 @@ discard block |
||
871 | 871 | * @since 1.0.0 |
872 | 872 | * @return void |
873 | 873 | */ |
874 | - public function enqueue_field_styles () { |
|
874 | + public function enqueue_field_styles() { |
|
875 | 875 | |
876 | - if ( $this->has_range ) { |
|
877 | - wp_enqueue_style( 'woothemes-sensei-settings-ranges', esc_url( Sensei()->plugin_url . 'assets/css/ranges.css' ), '', Sensei()->version ); |
|
876 | + if ($this->has_range) { |
|
877 | + wp_enqueue_style('woothemes-sensei-settings-ranges', esc_url(Sensei()->plugin_url.'assets/css/ranges.css'), '', Sensei()->version); |
|
878 | 878 | } |
879 | 879 | |
880 | - wp_register_style( 'woothemes-sensei-settings-imageselectors', esc_url( Sensei()->plugin_url . 'assets/css/image-selectors.css' ), '', Sensei()->version ); |
|
880 | + wp_register_style('woothemes-sensei-settings-imageselectors', esc_url(Sensei()->plugin_url.'assets/css/image-selectors.css'), '', Sensei()->version); |
|
881 | 881 | |
882 | - if ( $this->has_imageselector ) { |
|
883 | - wp_enqueue_style( 'woothemes-sensei-settings-imageselectors' ); |
|
882 | + if ($this->has_imageselector) { |
|
883 | + wp_enqueue_style('woothemes-sensei-settings-imageselectors'); |
|
884 | 884 | } |
885 | 885 | } // End enqueue_field_styles() |
886 | 886 | } // End Class |
@@ -890,4 +890,4 @@ discard block |
||
890 | 890 | * @ignore only for backward compatibility |
891 | 891 | * @since 1.9.0 |
892 | 892 | */ |
893 | -class WooThemes_Sensei_Settings_API extends Sensei_Settings_API{} |
|
893 | +class WooThemes_Sensei_Settings_API extends Sensei_Settings_API {} |
@@ -13,46 +13,46 @@ |
||
13 | 13 | */ |
14 | 14 | class Sensei_Student{ |
15 | 15 | |
16 | - /** |
|
17 | - * Get the students full name |
|
18 | - * |
|
19 | - * This function replaces Sensei_Learner_Managment->get_learner_full_name |
|
20 | - * @since 1.9.0 |
|
21 | - * |
|
22 | - * @param $user_id |
|
23 | - * @return bool|mixed|void |
|
24 | - */ |
|
25 | - public static function get_full_name( $user_id ){ |
|
16 | + /** |
|
17 | + * Get the students full name |
|
18 | + * |
|
19 | + * This function replaces Sensei_Learner_Managment->get_learner_full_name |
|
20 | + * @since 1.9.0 |
|
21 | + * |
|
22 | + * @param $user_id |
|
23 | + * @return bool|mixed|void |
|
24 | + */ |
|
25 | + public static function get_full_name( $user_id ){ |
|
26 | 26 | |
27 | - $full_name = ''; |
|
27 | + $full_name = ''; |
|
28 | 28 | |
29 | - if( empty( $user_id ) || ! ( 0 < intval( $user_id ) ) |
|
30 | - || !( get_userdata( $user_id ) ) ){ |
|
31 | - return false; |
|
32 | - } |
|
29 | + if( empty( $user_id ) || ! ( 0 < intval( $user_id ) ) |
|
30 | + || !( get_userdata( $user_id ) ) ){ |
|
31 | + return false; |
|
32 | + } |
|
33 | 33 | |
34 | - // get the user details |
|
35 | - $user = get_user_by( 'id', $user_id ); |
|
34 | + // get the user details |
|
35 | + $user = get_user_by( 'id', $user_id ); |
|
36 | 36 | |
37 | - if( ! empty( $user->first_name ) && ! empty( $user->last_name ) ){ |
|
37 | + if( ! empty( $user->first_name ) && ! empty( $user->last_name ) ){ |
|
38 | 38 | |
39 | - $full_name = trim( $user->first_name ) . ' ' . trim( $user->last_name ); |
|
39 | + $full_name = trim( $user->first_name ) . ' ' . trim( $user->last_name ); |
|
40 | 40 | |
41 | - }else{ |
|
41 | + }else{ |
|
42 | 42 | |
43 | - $full_name = $user->display_name; |
|
43 | + $full_name = $user->display_name; |
|
44 | 44 | |
45 | - } |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Filter the user full name from the get_learner_full_name function. |
|
49 | - * |
|
50 | - * @since 1.8.0 |
|
51 | - * @param $full_name |
|
52 | - * @param $user_id |
|
53 | - */ |
|
54 | - return apply_filters( 'sensei_learner_full_name' , $full_name , $user_id ); |
|
47 | + /** |
|
48 | + * Filter the user full name from the get_learner_full_name function. |
|
49 | + * |
|
50 | + * @since 1.8.0 |
|
51 | + * @param $full_name |
|
52 | + * @param $user_id |
|
53 | + */ |
|
54 | + return apply_filters( 'sensei_learner_full_name' , $full_name , $user_id ); |
|
55 | 55 | |
56 | - }// end get_full_name |
|
56 | + }// end get_full_name |
|
57 | 57 | |
58 | 58 | } |
59 | 59 | \ No newline at end of file |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * |
9 | 9 | * @since 1.9.0 |
10 | 10 | */ |
11 | -class Sensei_Learner{ |
|
11 | +class Sensei_Learner { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Get the students full name |
@@ -19,25 +19,25 @@ discard block |
||
19 | 19 | * @param $user_id |
20 | 20 | * @return bool|mixed|void |
21 | 21 | */ |
22 | - public static function get_full_name( $user_id ){ |
|
22 | + public static function get_full_name($user_id) { |
|
23 | 23 | |
24 | 24 | $full_name = ''; |
25 | 25 | |
26 | - if( empty( $user_id ) || ! ( 0 < intval( $user_id ) ) |
|
27 | - || !( get_userdata( $user_id ) ) ){ |
|
26 | + if (empty($user_id) || ! (0 < intval($user_id)) |
|
27 | + || ! (get_userdata($user_id))) { |
|
28 | 28 | return false; |
29 | 29 | } |
30 | 30 | |
31 | 31 | // get the user details |
32 | - $user = get_user_by( 'id', $user_id ); |
|
32 | + $user = get_user_by('id', $user_id); |
|
33 | 33 | |
34 | - if( ! empty( $user->first_name ) && ! empty( $user->last_name ) ){ |
|
34 | + if ( ! empty($user->first_name) && ! empty($user->last_name)) { |
|
35 | 35 | |
36 | - $full_name = trim( $user->first_name ) . ' ' . trim( $user->last_name ); |
|
36 | + $full_name = trim($user->first_name).' '.trim($user->last_name); |
|
37 | 37 | |
38 | - }else{ |
|
38 | + } else { |
|
39 | 39 | |
40 | - $full_name = $user->display_name; |
|
40 | + $full_name = $user->display_name; |
|
41 | 41 | |
42 | 42 | } |
43 | 43 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param $full_name |
49 | 49 | * @param $user_id |
50 | 50 | */ |
51 | - return apply_filters( 'sensei_learner_full_name' , $full_name , $user_id ); |
|
51 | + return apply_filters('sensei_learner_full_name', $full_name, $user_id); |
|
52 | 52 | |
53 | 53 | }// end get_full_name |
54 | 54 |
@@ -166,7 +166,7 @@ |
||
166 | 166 | |
167 | 167 | Sensei_Templates::get_template( 'user/my-courses.php' ); |
168 | 168 | |
169 | - }else{ |
|
169 | + } else{ |
|
170 | 170 | |
171 | 171 | Sensei()->frontend->sensei_login_form(); |
172 | 172 |