@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | /** |
20 | 20 | * @since 2.3.0 |
21 | 21 | */ |
22 | - public function __construct( $atts, $content, $shortcode = null ) { |
|
22 | + public function __construct($atts, $content, $shortcode = null) { |
|
23 | 23 | |
24 | 24 | _deprecated_function( |
25 | 25 | __METHOD__ |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | , 'WordPoints_Points_Shortcode_HTGP::__construct' |
28 | 28 | ); |
29 | 29 | |
30 | - parent::__construct( $atts, $content, $shortcode ); |
|
30 | + parent::__construct($atts, $content, $shortcode); |
|
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * @since 2.3.0 |
44 | 44 | */ |
45 | - public function __construct( $atts, $content, $shortcode = null ) { |
|
45 | + public function __construct($atts, $content, $shortcode = null) { |
|
46 | 46 | |
47 | 47 | _deprecated_function( |
48 | 48 | __METHOD__ |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | , 'WordPoints_Points_Shortcode_User_Points::__construct' |
51 | 51 | ); |
52 | 52 | |
53 | - parent::__construct( $atts, $content, $shortcode ); |
|
53 | + parent::__construct($atts, $content, $shortcode); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | /** |
66 | 66 | * @since 2.3.0 |
67 | 67 | */ |
68 | - public function __construct( $atts, $content, $shortcode = null ) { |
|
68 | + public function __construct($atts, $content, $shortcode = null) { |
|
69 | 69 | |
70 | 70 | _deprecated_function( |
71 | 71 | __METHOD__ |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | , 'WordPoints_Points_Shortcode_Logs::__construct' |
74 | 74 | ); |
75 | 75 | |
76 | - parent::__construct( $atts, $content, $shortcode ); |
|
76 | + parent::__construct($atts, $content, $shortcode); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | /** |
89 | 89 | * @since 2.3.0 |
90 | 90 | */ |
91 | - public function __construct( $atts, $content, $shortcode = null ) { |
|
91 | + public function __construct($atts, $content, $shortcode = null) { |
|
92 | 92 | |
93 | 93 | _deprecated_function( |
94 | 94 | __METHOD__ |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | , 'WordPoints_Points_Shortcode_Top_Users::__construct' |
97 | 97 | ); |
98 | 98 | |
99 | - parent::__construct( $atts, $content, $shortcode ); |
|
99 | + parent::__construct($atts, $content, $shortcode); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @param WordPoints_Class_Registry_Persistent $reactors The reactors registry. |
18 | 18 | */ |
19 | -function wordpoints_points_hook_reactors_init( $reactors ) { |
|
19 | +function wordpoints_points_hook_reactors_init($reactors) { |
|
20 | 20 | |
21 | - $reactors->register( 'points', 'WordPoints_Points_Hook_Reactor' ); |
|
22 | - $reactors->register( 'points_legacy', 'WordPoints_Points_Hook_Reactor_Legacy' ); |
|
21 | + $reactors->register('points', 'WordPoints_Points_Hook_Reactor'); |
|
22 | + $reactors->register('points_legacy', 'WordPoints_Points_Hook_Reactor_Legacy'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @param WordPoints_Class_Registry_Children $reaction_stores The store registry. |
33 | 33 | */ |
34 | -function wordpoints_points_hook_reaction_stores_init( $reaction_stores ) { |
|
34 | +function wordpoints_points_hook_reaction_stores_init($reaction_stores) { |
|
35 | 35 | |
36 | 36 | $reaction_stores->register( |
37 | 37 | 'standard' |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | , 'WordPoints_Hook_Reaction_Store_Options' |
40 | 40 | ); |
41 | 41 | |
42 | - if ( is_wordpoints_network_active() ) { |
|
42 | + if (is_wordpoints_network_active()) { |
|
43 | 43 | $reaction_stores->register( |
44 | 44 | 'network' |
45 | 45 | , 'points' |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @param WordPoints_Class_Registry_Persistent $extensions The extension registry. |
59 | 59 | */ |
60 | -function wordpoints_points_hook_extensions_init( $extensions ) { |
|
60 | +function wordpoints_points_hook_extensions_init($extensions) { |
|
61 | 61 | |
62 | 62 | $extensions->register( |
63 | 63 | 'points_legacy_reversals' |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @param string $slug The slug of the post type. |
87 | 87 | */ |
88 | -function wordpoints_points_register_legacy_post_publish_events( $slug ) { |
|
88 | +function wordpoints_points_register_legacy_post_publish_events($slug) { |
|
89 | 89 | |
90 | - if ( 'attachment' === $slug ) { |
|
90 | + if ('attachment' === $slug) { |
|
91 | 91 | return; |
92 | 92 | } |
93 | 93 | |
94 | - $events = wordpoints_hooks()->get_sub_app( 'events' ); |
|
94 | + $events = wordpoints_hooks()->get_sub_app('events'); |
|
95 | 95 | |
96 | 96 | $events->register( |
97 | 97 | "points_legacy_post_publish\\{$slug}" |
@@ -131,19 +131,19 @@ discard block |
||
131 | 131 | wp_register_style( |
132 | 132 | 'wordpoints-points-logs' |
133 | 133 | , "{$assets_url}/css/points-logs{$suffix}.css" |
134 | - , array( 'dashicons' ) |
|
134 | + , array('dashicons') |
|
135 | 135 | , WORDPOINTS_VERSION |
136 | 136 | ); |
137 | 137 | |
138 | 138 | $styles = wp_styles(); |
139 | - $rtl_styles = array( 'wordpoints-top-users', 'wordpoints-points-logs' ); |
|
139 | + $rtl_styles = array('wordpoints-top-users', 'wordpoints-points-logs'); |
|
140 | 140 | |
141 | - foreach ( $rtl_styles as $rtl_style ) { |
|
141 | + foreach ($rtl_styles as $rtl_style) { |
|
142 | 142 | |
143 | - $styles->add_data( $rtl_style, 'rtl', 'replace' ); |
|
143 | + $styles->add_data($rtl_style, 'rtl', 'replace'); |
|
144 | 144 | |
145 | - if ( $suffix ) { |
|
146 | - $styles->add_data( $rtl_style, 'suffix', $suffix ); |
|
145 | + if ($suffix) { |
|
146 | + $styles->add_data($rtl_style, 'suffix', $suffix); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | return array( |
161 | 161 | 'set_wordpoints_points' => 'manage_options', |
162 | 162 | 'manage_network_wordpoints_points_hooks' => 'manage_network_options', |
163 | - 'manage_wordpoints_points_types' => ( is_wordpoints_network_active() ) ? 'manage_network_options' : 'manage_options', |
|
163 | + 'manage_wordpoints_points_types' => (is_wordpoints_network_active()) ? 'manage_network_options' : 'manage_options', |
|
164 | 164 | ); |
165 | 165 | } |
166 | 166 | |
@@ -178,23 +178,23 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @return string $points formatted with prefix and suffix. |
180 | 180 | */ |
181 | -function wordpoints_format_points_filter( $formatted, $points, $type ) { |
|
181 | +function wordpoints_format_points_filter($formatted, $points, $type) { |
|
182 | 182 | |
183 | - $points_type = wordpoints_get_points_type( $type ); |
|
183 | + $points_type = wordpoints_get_points_type($type); |
|
184 | 184 | |
185 | - if ( isset( $points_type['prefix'] ) ) { |
|
185 | + if (isset($points_type['prefix'])) { |
|
186 | 186 | |
187 | - if ( $points < 0 ) { |
|
187 | + if ($points < 0) { |
|
188 | 188 | |
189 | - $points = abs( $points ); |
|
189 | + $points = abs($points); |
|
190 | 190 | $points_type['prefix'] = '-' . $points_type['prefix']; |
191 | 191 | } |
192 | 192 | |
193 | - $formatted = esc_html( $points_type['prefix'] . $points ); |
|
193 | + $formatted = esc_html($points_type['prefix'] . $points); |
|
194 | 194 | } |
195 | 195 | |
196 | - if ( isset( $points_type['suffix'] ) ) { |
|
197 | - $formatted = $formatted . esc_html( $points_type['suffix'] ); |
|
196 | + if (isset($points_type['suffix'])) { |
|
197 | + $formatted = $formatted . esc_html($points_type['suffix']); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | return $formatted; |
@@ -211,20 +211,20 @@ discard block |
||
211 | 211 | * @param array $args The arguments for the dropdown {@see |
212 | 212 | * WordPoints_Dropdown_Builder::$args}. |
213 | 213 | */ |
214 | -function wordpoints_points_types_dropdown( array $args ) { |
|
214 | +function wordpoints_points_types_dropdown(array $args) { |
|
215 | 215 | |
216 | 216 | $points_types = array(); |
217 | 217 | |
218 | - foreach ( wordpoints_get_points_types() as $slug => $settings ) { |
|
218 | + foreach (wordpoints_get_points_types() as $slug => $settings) { |
|
219 | 219 | |
220 | - $points_types[ $slug ] = $settings['name']; |
|
220 | + $points_types[$slug] = $settings['name']; |
|
221 | 221 | } |
222 | 222 | |
223 | - if ( isset( $args['options'] ) && is_array( $args['options'] ) ) { |
|
223 | + if (isset($args['options']) && is_array($args['options'])) { |
|
224 | 224 | $points_types = $args['options'] + $points_types; |
225 | 225 | } |
226 | 226 | |
227 | - $dropdown = new WordPoints_Dropdown_Builder( $points_types, $args ); |
|
227 | + $dropdown = new WordPoints_Dropdown_Builder($points_types, $args); |
|
228 | 228 | |
229 | 229 | $dropdown->display(); |
230 | 230 | } |
@@ -238,27 +238,27 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @param int $user_id The ID of the user just deleted. |
240 | 240 | */ |
241 | -function wordpoints_delete_points_logs_for_user( $user_id ) { |
|
241 | +function wordpoints_delete_points_logs_for_user($user_id) { |
|
242 | 242 | |
243 | 243 | global $wpdb; |
244 | 244 | |
245 | - $query_args = array( 'fields' => 'id', 'user_id' => $user_id ); |
|
245 | + $query_args = array('fields' => 'id', 'user_id' => $user_id); |
|
246 | 246 | |
247 | 247 | // If the user is being deleted from all blogs on multisite. |
248 | - if ( is_multisite() && ! get_userdata( $user_id ) ) { |
|
248 | + if (is_multisite() && ! get_userdata($user_id)) { |
|
249 | 249 | $query_args['blog_id'] = 0; |
250 | 250 | } |
251 | 251 | |
252 | 252 | // Delete log meta. |
253 | - $query = new WordPoints_Points_Logs_Query( $query_args ); |
|
253 | + $query = new WordPoints_Points_Logs_Query($query_args); |
|
254 | 254 | |
255 | - foreach ( $query->get( 'col' ) as $log_id ) { |
|
256 | - wordpoints_points_log_delete_all_metadata( $log_id ); |
|
255 | + foreach ($query->get('col') as $log_id) { |
|
256 | + wordpoints_points_log_delete_all_metadata($log_id); |
|
257 | 257 | } |
258 | 258 | |
259 | - $where = array( 'user_id' => $user_id ); |
|
259 | + $where = array('user_id' => $user_id); |
|
260 | 260 | |
261 | - if ( ! isset( $query_args['blog_id'] ) ) { |
|
261 | + if ( ! isset($query_args['blog_id'])) { |
|
262 | 262 | $where['blog_id'] = $wpdb->blogid; |
263 | 263 | } |
264 | 264 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | ,'%d' |
270 | 270 | ); |
271 | 271 | |
272 | - wordpoints_flush_points_logs_caches( array( 'user_id' => $user_id ) ); |
|
272 | + wordpoints_flush_points_logs_caches(array('user_id' => $user_id)); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | /** |
@@ -281,21 +281,21 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @param int $blog_id The ID of the blog being deleted. |
283 | 283 | */ |
284 | -function wordpoints_delete_points_logs_for_blog( $blog_id ) { |
|
284 | +function wordpoints_delete_points_logs_for_blog($blog_id) { |
|
285 | 285 | |
286 | 286 | global $wpdb; |
287 | 287 | |
288 | 288 | // Delete log meta. |
289 | - $query = new WordPoints_Points_Logs_Query( array( 'fields' => 'id' ) ); |
|
289 | + $query = new WordPoints_Points_Logs_Query(array('fields' => 'id')); |
|
290 | 290 | |
291 | - foreach ( $query->get( 'col' ) as $log_id ) { |
|
292 | - wordpoints_points_log_delete_all_metadata( $log_id ); |
|
291 | + foreach ($query->get('col') as $log_id) { |
|
292 | + wordpoints_points_log_delete_all_metadata($log_id); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | // Now delete the logs. |
296 | 296 | $wpdb->delete( |
297 | 297 | $wpdb->wordpoints_points_logs |
298 | - ,array( 'blog_id' => $blog_id ) |
|
298 | + ,array('blog_id' => $blog_id) |
|
299 | 299 | ,'%d' |
300 | 300 | ); |
301 | 301 | |
@@ -311,13 +311,13 @@ discard block |
||
311 | 311 | * |
312 | 312 | * @param string $points_type The type of points the settings are being shown for. |
313 | 313 | */ |
314 | -function wordpoints_points_settings_custom_meta_key_message( $points_type ) { |
|
314 | +function wordpoints_points_settings_custom_meta_key_message($points_type) { |
|
315 | 315 | |
316 | - $custom_key = wordpoints_get_points_type_setting( $points_type, 'meta_key' ); |
|
316 | + $custom_key = wordpoints_get_points_type_setting($points_type, 'meta_key'); |
|
317 | 317 | |
318 | - if ( ! empty( $custom_key ) ) { |
|
318 | + if ( ! empty($custom_key)) { |
|
319 | 319 | // translators: 1. Meta key. |
320 | - echo '<p>' . esc_html( sprintf( __( 'This points type uses a custom meta key: %s', 'wordpoints' ), $custom_key ) ) . '</p>'; |
|
320 | + echo '<p>' . esc_html(sprintf(__('This points type uses a custom meta key: %s', 'wordpoints'), $custom_key)) . '</p>'; |
|
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
@@ -330,20 +330,20 @@ discard block |
||
330 | 330 | * |
331 | 331 | * @param string $points_type The type of points whose logs are being displayed. |
332 | 332 | */ |
333 | -function wordpoints_points_logs_custom_meta_key_message( $points_type ) { |
|
333 | +function wordpoints_points_logs_custom_meta_key_message($points_type) { |
|
334 | 334 | |
335 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
335 | + if ( ! current_user_can('manage_options')) { |
|
336 | 336 | return; |
337 | 337 | } |
338 | 338 | |
339 | - $custom_key = wordpoints_get_points_type_setting( $points_type, 'meta_key' ); |
|
339 | + $custom_key = wordpoints_get_points_type_setting($points_type, 'meta_key'); |
|
340 | 340 | |
341 | - if ( ! empty( $custom_key ) ) { |
|
341 | + if ( ! empty($custom_key)) { |
|
342 | 342 | wordpoints_show_admin_message( |
343 | 343 | esc_html( |
344 | 344 | sprintf( |
345 | 345 | // translators: Meta key. |
346 | - __( 'This points type uses a custom meta key (“%s”). If this key is also used by another plugin, changes made by it will not be logged. Only transactions performed by WordPoints are included in the logs.', 'wordpoints' ) |
|
346 | + __('This points type uses a custom meta key (“%s”). If this key is also used by another plugin, changes made by it will not be logged. Only transactions performed by WordPoints are included in the logs.', 'wordpoints') |
|
347 | 347 | , $custom_key |
348 | 348 | ) |
349 | 349 | ) |
@@ -362,18 +362,18 @@ discard block |
||
362 | 362 | */ |
363 | 363 | function wordpoints_points_add_global_cache_groups() { |
364 | 364 | |
365 | - if ( function_exists( 'wp_cache_add_global_groups' ) ) { |
|
365 | + if (function_exists('wp_cache_add_global_groups')) { |
|
366 | 366 | |
367 | 367 | $groups = array( |
368 | 368 | 'wordpoints_network_points_logs_query', |
369 | 369 | 'wordpoints_points_log_meta', |
370 | 370 | ); |
371 | 371 | |
372 | - if ( is_wordpoints_network_active() ) { |
|
372 | + if (is_wordpoints_network_active()) { |
|
373 | 373 | $groups[] = 'wordpoints_points_top_users'; |
374 | 374 | } |
375 | 375 | |
376 | - wp_cache_add_global_groups( $groups ); |
|
376 | + wp_cache_add_global_groups($groups); |
|
377 | 377 | } |
378 | 378 | } |
379 | 379 | |
@@ -387,13 +387,13 @@ discard block |
||
387 | 387 | function wordpoints_register_points_widgets() { |
388 | 388 | |
389 | 389 | // My points widget. |
390 | - register_widget( 'WordPoints_Points_Widget_User_Points' ); |
|
390 | + register_widget('WordPoints_Points_Widget_User_Points'); |
|
391 | 391 | |
392 | 392 | // Top users widget. |
393 | - register_widget( 'WordPoints_Points_Widget_Top_Users' ); |
|
393 | + register_widget('WordPoints_Points_Widget_Top_Users'); |
|
394 | 394 | |
395 | 395 | // Points logs widget. |
396 | - register_widget( 'WordPoints_Points_Widget_Logs' ); |
|
396 | + register_widget('WordPoints_Points_Widget_Logs'); |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | // EOF |
@@ -19,22 +19,22 @@ discard block |
||
19 | 19 | /** |
20 | 20 | * @since 1.9.0 |
21 | 21 | */ |
22 | - protected function verify_settings( $instance ) { |
|
22 | + protected function verify_settings($instance) { |
|
23 | 23 | |
24 | - if ( isset( $this->defaults['points_type'] ) ) { |
|
24 | + if (isset($this->defaults['points_type'])) { |
|
25 | 25 | |
26 | 26 | if ( |
27 | - empty( $instance['points_type'] ) |
|
28 | - || ! wordpoints_is_points_type( $instance['points_type'] ) |
|
27 | + empty($instance['points_type']) |
|
28 | + || ! wordpoints_is_points_type($instance['points_type']) |
|
29 | 29 | ) { |
30 | 30 | return new WP_Error( |
31 | 31 | 'wordpoints_widget_invalid_points_type' |
32 | - , esc_html__( 'Please select a valid points type.', 'wordpoints' ) |
|
32 | + , esc_html__('Please select a valid points type.', 'wordpoints') |
|
33 | 33 | ); |
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
37 | - return parent::verify_settings( $instance ); |
|
37 | + return parent::verify_settings($instance); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -48,17 +48,17 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @param string $maybe_points_type The variable to insure is a points type. |
50 | 50 | */ |
51 | - protected function make_a_points_type( &$maybe_points_type ) { |
|
51 | + protected function make_a_points_type(&$maybe_points_type) { |
|
52 | 52 | |
53 | - if ( ! wordpoints_is_points_type( $maybe_points_type ) ) { |
|
53 | + if ( ! wordpoints_is_points_type($maybe_points_type)) { |
|
54 | 54 | |
55 | 55 | $maybe_points_type = wordpoints_get_default_points_type(); |
56 | 56 | |
57 | - if ( ! $maybe_points_type ) { |
|
57 | + if ( ! $maybe_points_type) { |
|
58 | 58 | |
59 | 59 | $points_types = wordpoints_get_points_types(); |
60 | 60 | |
61 | - $maybe_points_type = key( $points_types ); |
|
61 | + $maybe_points_type = key($points_types); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | } |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | /** |
67 | 67 | * @since 2.0.0 |
68 | 68 | */ |
69 | - public function update( $new_instance, $old_instance ) { |
|
69 | + public function update($new_instance, $old_instance) { |
|
70 | 70 | |
71 | - parent::update( $new_instance, $old_instance ); |
|
71 | + parent::update($new_instance, $old_instance); |
|
72 | 72 | |
73 | - $this->make_a_points_type( $this->instance['points_type'] ); |
|
73 | + $this->make_a_points_type($this->instance['points_type']); |
|
74 | 74 | |
75 | 75 | return $this->instance; |
76 | 76 | } |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | /** |
79 | 79 | * @since 2.0.0 |
80 | 80 | */ |
81 | - public function form( $instance ) { |
|
81 | + public function form($instance) { |
|
82 | 82 | |
83 | - parent::form( $instance ); |
|
83 | + parent::form($instance); |
|
84 | 84 | |
85 | 85 | $this->form_points_type_field(); |
86 | 86 | |
@@ -96,16 +96,16 @@ discard block |
||
96 | 96 | |
97 | 97 | $dropdown_args = array( |
98 | 98 | 'selected' => $this->instance['points_type'], |
99 | - 'id' => $this->get_field_id( 'points_type' ), |
|
100 | - 'name' => $this->get_field_name( 'points_type' ), |
|
99 | + 'id' => $this->get_field_id('points_type'), |
|
100 | + 'name' => $this->get_field_name('points_type'), |
|
101 | 101 | 'class' => 'widefat', |
102 | 102 | ); |
103 | 103 | |
104 | 104 | ?> |
105 | 105 | |
106 | 106 | <p> |
107 | - <label for="<?php echo esc_attr( $dropdown_args['id'] ); ?>"><?php echo esc_html_x( 'Points type', 'form label', 'wordpoints' ); ?></label> |
|
108 | - <?php wordpoints_points_types_dropdown( $dropdown_args ); ?> |
|
107 | + <label for="<?php echo esc_attr($dropdown_args['id']); ?>"><?php echo esc_html_x('Points type', 'form label', 'wordpoints'); ?></label> |
|
108 | + <?php wordpoints_points_types_dropdown($dropdown_args); ?> |
|
109 | 109 | </p> |
110 | 110 | |
111 | 111 | <?php |
@@ -31,36 +31,36 @@ discard block |
||
31 | 31 | WordPoints_Hook_ReactionI $reaction |
32 | 32 | ) { |
33 | 33 | |
34 | - $period = parent::get_period_by_reaction( $settings, $reaction ); |
|
34 | + $period = parent::get_period_by_reaction($settings, $reaction); |
|
35 | 35 | |
36 | - if ( $period ) { |
|
36 | + if ($period) { |
|
37 | 37 | return $period; |
38 | 38 | } |
39 | 39 | |
40 | - $expected_settings = array( array( 'current:user' ) ); |
|
40 | + $expected_settings = array(array('current:user')); |
|
41 | 41 | |
42 | - if ( ! isset( $settings['args'] ) || $settings['args'] !== $expected_settings ) { |
|
42 | + if ( ! isset($settings['args']) || $settings['args'] !== $expected_settings) { |
|
43 | 43 | return false; |
44 | 44 | } |
45 | 45 | |
46 | 46 | // Get the user ID. |
47 | - $user = $this->event_args->get_from_hierarchy( array( 'current:user' ) ); |
|
47 | + $user = $this->event_args->get_from_hierarchy(array('current:user')); |
|
48 | 48 | |
49 | - if ( ! $user instanceof WordPoints_Entity ) { |
|
49 | + if ( ! $user instanceof WordPoints_Entity) { |
|
50 | 50 | return false; |
51 | 51 | } |
52 | 52 | |
53 | 53 | $user_id = $user->get_the_id(); |
54 | 54 | $reaction_guid = $reaction->get_guid(); |
55 | - $points_type = $reaction->get_meta( 'points_type' ); |
|
56 | - $log_type = $reaction->get_meta( 'legacy_log_type' ); |
|
55 | + $points_type = $reaction->get_meta('points_type'); |
|
56 | + $log_type = $reaction->get_meta('legacy_log_type'); |
|
57 | 57 | |
58 | - $cache_key = wp_json_encode( $reaction_guid ) . "-{$user_id}-{$points_type}-{$log_type}"; |
|
58 | + $cache_key = wp_json_encode($reaction_guid) . "-{$user_id}-{$points_type}-{$log_type}"; |
|
59 | 59 | |
60 | 60 | // Before we run the query, we try to lookup the period in the cache. |
61 | - $period = wp_cache_get( $cache_key, 'wordpoints_points_legacy_hook_periods' ); |
|
61 | + $period = wp_cache_get($cache_key, 'wordpoints_points_legacy_hook_periods'); |
|
62 | 62 | |
63 | - if ( $period ) { |
|
63 | + if ($period) { |
|
64 | 64 | return $period; |
65 | 65 | } |
66 | 66 | |
@@ -74,15 +74,15 @@ discard block |
||
74 | 74 | ) |
75 | 75 | ); |
76 | 76 | |
77 | - $date = $query->get( 'var' ); |
|
77 | + $date = $query->get('var'); |
|
78 | 78 | |
79 | - if ( ! $date ) { |
|
79 | + if ( ! $date) { |
|
80 | 80 | return false; |
81 | 81 | } |
82 | 82 | |
83 | - $period = (object) array( 'date' => $date ); |
|
83 | + $period = (object) array('date' => $date); |
|
84 | 84 | |
85 | - wp_cache_set( $cache_key, $period, 'wordpoints_points_legacy_hook_periods' ); |
|
85 | + wp_cache_set($cache_key, $period, 'wordpoints_points_legacy_hook_periods'); |
|
86 | 86 | |
87 | 87 | return $period; |
88 | 88 | } |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | */ |
23 | 23 | protected function verify_atts() { |
24 | 24 | |
25 | - if ( isset( $this->pairs['points_type'] ) ) { |
|
25 | + if (isset($this->pairs['points_type'])) { |
|
26 | 26 | |
27 | 27 | $points_type = $this->get_points_type(); |
28 | 28 | |
29 | - if ( is_wp_error( $points_type ) ) { |
|
29 | + if (is_wp_error($points_type)) { |
|
30 | 30 | return $points_type; |
31 | 31 | } |
32 | 32 | |
@@ -52,20 +52,20 @@ discard block |
||
52 | 52 | |
53 | 53 | $points_type = $this->atts['points_type']; |
54 | 54 | |
55 | - if ( ! wordpoints_is_points_type( $points_type ) ) { |
|
55 | + if ( ! wordpoints_is_points_type($points_type)) { |
|
56 | 56 | |
57 | 57 | $points_type = wordpoints_get_default_points_type(); |
58 | 58 | |
59 | - if ( ! $points_type ) { |
|
59 | + if ( ! $points_type) { |
|
60 | 60 | |
61 | 61 | $points_type = new WP_Error( |
62 | 62 | 'wordpoints_shortcode_no_points_type' |
63 | 63 | , sprintf( |
64 | 64 | // translators: 1. Attribute name; 2. Shortcode name; 3. Example of proper usage. |
65 | - __( 'The “%1$s” attribute of the %2$s shortcode must be the slug of a points type. Example: %3$s.', 'wordpoints' ) |
|
65 | + __('The “%1$s” attribute of the %2$s shortcode must be the slug of a points type. Example: %3$s.', 'wordpoints') |
|
66 | 66 | , 'points_type' |
67 | - , '<code>[' . sanitize_key( $this->shortcode ) . ']</code>' |
|
68 | - , '<code>[' . sanitize_key( $this->shortcode ) . ' points_type="points"]</code>' |
|
67 | + , '<code>[' . sanitize_key($this->shortcode) . ']</code>' |
|
68 | + , '<code>[' . sanitize_key($this->shortcode) . ' points_type="points"]</code>' |
|
69 | 69 | ) |
70 | 70 | ); |
71 | 71 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @param array $atts The shortcode attributes. |
81 | 81 | * @param string $shortcode The shortcode. |
82 | 82 | */ |
83 | - return apply_filters( 'wordpoints_shortcode_points_type', $points_type, $this->atts, $this->shortcode ); |
|
83 | + return apply_filters('wordpoints_shortcode_points_type', $points_type, $this->atts, $this->shortcode); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 |
@@ -36,13 +36,13 @@ |
||
36 | 36 | */ |
37 | 37 | protected function verify_atts() { |
38 | 38 | |
39 | - if ( ! wordpoints_posint( $this->atts['users'] ) ) { |
|
39 | + if ( ! wordpoints_posint($this->atts['users'])) { |
|
40 | 40 | return sprintf( |
41 | 41 | // translators: 1. Attribute name; 2. Shortcode name; 3. Example of proper usage. |
42 | - __( 'The “%1$s” attribute of the %2$s shortcode must be a positive integer. Example: %3$s.', 'wordpoints' ) |
|
42 | + __('The “%1$s” attribute of the %2$s shortcode must be a positive integer. Example: %3$s.', 'wordpoints') |
|
43 | 43 | , 'users' |
44 | - , '<code>[' . sanitize_key( $this->shortcode ) . ']</code>' |
|
45 | - , '<code>[' . sanitize_key( $this->shortcode ) . ' <b>users="10"</b> type="points"]</code>' |
|
44 | + , '<code>[' . sanitize_key($this->shortcode) . ']</code>' |
|
45 | + , '<code>[' . sanitize_key($this->shortcode) . ' <b>users="10"</b> type="points"]</code>' |
|
46 | 46 | ); |
47 | 47 | } |
48 | 48 |
@@ -43,34 +43,34 @@ discard block |
||
43 | 43 | * @param string[] $extra_classes The extra classes for the table element. |
44 | 44 | * @param array $atts The arguments for table display from the shortcode. |
45 | 45 | */ |
46 | - $extra_classes = apply_filters( 'wordpoints_how_to_get_points_table_extra_classes', array(), $this->atts ); |
|
46 | + $extra_classes = apply_filters('wordpoints_how_to_get_points_table_extra_classes', array(), $this->atts); |
|
47 | 47 | |
48 | - $points_heading = _x( 'Points', 'column name', 'wordpoints' ); |
|
48 | + $points_heading = _x('Points', 'column name', 'wordpoints'); |
|
49 | 49 | |
50 | 50 | $points_type_name = wordpoints_get_points_type_setting( |
51 | 51 | $this->atts['points_type'] |
52 | 52 | , 'name' |
53 | 53 | ); |
54 | 54 | |
55 | - if ( ! empty( $points_type_name ) ) { |
|
55 | + if ( ! empty($points_type_name)) { |
|
56 | 56 | $points_heading = $points_type_name; |
57 | 57 | } |
58 | 58 | |
59 | - $html = '<table class="wordpoints-how-to-get-points ' . esc_attr( implode( ' ', $extra_classes ) ) . '"> |
|
59 | + $html = '<table class="wordpoints-how-to-get-points ' . esc_attr(implode(' ', $extra_classes)) . '"> |
|
60 | 60 | <thead> |
61 | - <tr><th style="padding-right: 10px">' . esc_html( $points_heading ) . '</th> |
|
62 | - <th>' . esc_html_x( 'Action', 'column name', 'wordpoints' ) . '</th></tr> |
|
61 | + <tr><th style="padding-right: 10px">' . esc_html($points_heading) . '</th> |
|
62 | + <th>' . esc_html_x('Action', 'column name', 'wordpoints') . '</th></tr> |
|
63 | 63 | </thead> |
64 | 64 | <tbody>'; |
65 | 65 | |
66 | - $html .= $this->list_reactions( 'points' ); |
|
66 | + $html .= $this->list_reactions('points'); |
|
67 | 67 | $html .= $this->list_points_hooks(); |
68 | 68 | |
69 | - if ( is_wordpoints_network_active() ) { |
|
69 | + if (is_wordpoints_network_active()) { |
|
70 | 70 | |
71 | - WordPoints_Points_Hooks::set_network_mode( true ); |
|
71 | + WordPoints_Points_Hooks::set_network_mode(true); |
|
72 | 72 | $html .= $this->list_points_hooks(); |
73 | - WordPoints_Points_Hooks::set_network_mode( false ); |
|
73 | + WordPoints_Points_Hooks::set_network_mode(false); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | $html .= '</tbody></table>'; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | $network = ''; |
92 | 92 | |
93 | - if ( WordPoints_Points_Hooks::get_network_mode() ) { |
|
93 | + if (WordPoints_Points_Hooks::get_network_mode()) { |
|
94 | 94 | $network = 'network_'; |
95 | 95 | } |
96 | 96 | |
@@ -100,17 +100,17 @@ discard block |
||
100 | 100 | |
101 | 101 | $html = ''; |
102 | 102 | |
103 | - foreach ( $hooks as $hook_id ) { |
|
103 | + foreach ($hooks as $hook_id) { |
|
104 | 104 | |
105 | - $hook = WordPoints_Points_Hooks::get_handler( $hook_id ); |
|
105 | + $hook = WordPoints_Points_Hooks::get_handler($hook_id); |
|
106 | 106 | |
107 | - if ( ! $hook ) { |
|
107 | + if ( ! $hook) { |
|
108 | 108 | continue; |
109 | 109 | } |
110 | 110 | |
111 | - $points = $hook->get_points( $network . $hook->get_number() ); |
|
111 | + $points = $hook->get_points($network . $hook->get_number()); |
|
112 | 112 | |
113 | - if ( ! $points ) { |
|
113 | + if ( ! $points) { |
|
114 | 114 | continue; |
115 | 115 | } |
116 | 116 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | $html .= '<tr> |
124 | 124 | <td>' . $points . '</td> |
125 | - <td>' . esc_html( $hook->get_description() ) . '</td> |
|
125 | + <td>' . esc_html($hook->get_description()) . '</td> |
|
126 | 126 | </tr>'; |
127 | 127 | } |
128 | 128 | |
@@ -142,21 +142,21 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @return string The HTML for the table rows. |
144 | 144 | */ |
145 | - protected function list_reactions( $store_slug ) { |
|
145 | + protected function list_reactions($store_slug) { |
|
146 | 146 | |
147 | 147 | $html = ''; |
148 | 148 | |
149 | - foreach ( wordpoints_hooks()->get_reaction_stores( $store_slug ) as $store ) { |
|
149 | + foreach (wordpoints_hooks()->get_reaction_stores($store_slug) as $store) { |
|
150 | 150 | |
151 | - foreach ( $store->get_reactions() as $reaction ) { |
|
151 | + foreach ($store->get_reactions() as $reaction) { |
|
152 | 152 | |
153 | - if ( $reaction->get_meta( 'points_type' ) !== $this->atts['points_type'] ) { |
|
153 | + if ($reaction->get_meta('points_type') !== $this->atts['points_type']) { |
|
154 | 154 | continue; |
155 | 155 | } |
156 | 156 | |
157 | - $points = $reaction->get_meta( 'points' ); |
|
157 | + $points = $reaction->get_meta('points'); |
|
158 | 158 | |
159 | - if ( ! $points ) { |
|
159 | + if ( ! $points) { |
|
160 | 160 | continue; |
161 | 161 | } |
162 | 162 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | |
169 | 169 | $html .= '<tr> |
170 | 170 | <td>' . $points . '</td> |
171 | - <td>' . esc_html( $reaction->get_meta( 'description' ) ) . '</td> |
|
171 | + <td>' . esc_html($reaction->get_meta('description')) . '</td> |
|
172 | 172 | </tr>'; |
173 | 173 | } |
174 | 174 | } |
@@ -40,26 +40,26 @@ |
||
40 | 40 | */ |
41 | 41 | protected function verify_atts() { |
42 | 42 | |
43 | - if ( ! wordpoints_is_points_logs_query( $this->atts['query'] ) ) { |
|
43 | + if ( ! wordpoints_is_points_logs_query($this->atts['query'])) { |
|
44 | 44 | return sprintf( |
45 | 45 | // translators: 1. Attribute name; 2. Shortcode name; 3. Example of proper usage. |
46 | - __( 'The “%1$s” attribute of the %2$s shortcode must be the slug of a registered points log query. Example: %3$s.', 'wordpoints' ) |
|
46 | + __('The “%1$s” attribute of the %2$s shortcode must be the slug of a registered points log query. Example: %3$s.', 'wordpoints') |
|
47 | 47 | , 'query' |
48 | - , '<code>[' . sanitize_key( $this->shortcode ) . ']</code>' |
|
49 | - , '<code>[' . sanitize_key( $this->shortcode ) . ' <b>query="default"</b> points_type="points"]</code>' |
|
48 | + , '<code>[' . sanitize_key($this->shortcode) . ']</code>' |
|
49 | + , '<code>[' . sanitize_key($this->shortcode) . ' <b>query="default"</b> points_type="points"]</code>' |
|
50 | 50 | ); |
51 | 51 | } |
52 | 52 | |
53 | - if ( false === wordpoints_int( $this->atts['paginate'] ) ) { |
|
53 | + if (false === wordpoints_int($this->atts['paginate'])) { |
|
54 | 54 | $this->atts['paginate'] = 1; |
55 | 55 | } |
56 | 56 | |
57 | 57 | // Back-compat. Needs to stay here "forever" for legacy installs. |
58 | - if ( isset( $this->atts['datatables'] ) ) { |
|
59 | - $this->atts['paginate'] = wordpoints_int( $this->atts['datatables'] ); |
|
58 | + if (isset($this->atts['datatables'])) { |
|
59 | + $this->atts['paginate'] = wordpoints_int($this->atts['datatables']); |
|
60 | 60 | } |
61 | 61 | |
62 | - if ( false === wordpoints_int( $this->atts['show_users'] ) ) { |
|
62 | + if (false === wordpoints_int($this->atts['show_users'])) { |
|
63 | 63 | $this->atts['show_users'] = 1; |
64 | 64 | } |
65 | 65 |
@@ -30,47 +30,47 @@ discard block |
||
30 | 30 | |
31 | 31 | parent::__construct( |
32 | 32 | 'WordPoints_Points_Widget' |
33 | - , __( 'WordPoints', 'wordpoints' ) |
|
33 | + , __('WordPoints', 'wordpoints') |
|
34 | 34 | , array( |
35 | - 'description' => __( 'Display the points of the current logged in user.', 'wordpoints' ), |
|
35 | + 'description' => __('Display the points of the current logged in user.', 'wordpoints'), |
|
36 | 36 | 'wordpoints_hook_slug' => 'points', |
37 | 37 | ) |
38 | 38 | ); |
39 | 39 | |
40 | 40 | $this->defaults = array( |
41 | - 'title' => _x( 'My Points', 'widget title', 'wordpoints' ), |
|
41 | + 'title' => _x('My Points', 'widget title', 'wordpoints'), |
|
42 | 42 | 'points_type' => wordpoints_get_default_points_type(), |
43 | 43 | // translators: Number of points. |
44 | - 'text' => sprintf( __( 'Points: %s', 'wordpoints' ), '%points%' ), |
|
45 | - 'alt_text' => __( 'You must be logged in to view your points.', 'wordpoints' ), |
|
44 | + 'text' => sprintf(__('Points: %s', 'wordpoints'), '%points%'), |
|
45 | + 'alt_text' => __('You must be logged in to view your points.', 'wordpoints'), |
|
46 | 46 | 'number_logs' => 5, |
47 | 47 | ); |
48 | 48 | |
49 | - add_filter( 'wordpoints_points_widget_text', 'esc_html', 20 ); |
|
49 | + add_filter('wordpoints_points_widget_text', 'esc_html', 20); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
53 | 53 | * @since 1.9.0 As part of WordPoints_My_Points_Widget. |
54 | 54 | * @since 2.3.0 |
55 | 55 | */ |
56 | - protected function verify_settings( $instance ) { |
|
56 | + protected function verify_settings($instance) { |
|
57 | 57 | |
58 | - if ( ! is_user_logged_in() && empty( $instance['alt_text'] ) ) { |
|
58 | + if ( ! is_user_logged_in() && empty($instance['alt_text'])) { |
|
59 | 59 | return new WP_Error; |
60 | 60 | } |
61 | 61 | |
62 | 62 | if ( |
63 | - ! isset( $instance['number_logs'] ) |
|
64 | - || ! wordpoints_posint( $instance['number_logs'] ) |
|
63 | + ! isset($instance['number_logs']) |
|
64 | + || ! wordpoints_posint($instance['number_logs']) |
|
65 | 65 | ) { |
66 | 66 | $instance['number_logs'] = 0; |
67 | 67 | } |
68 | 68 | |
69 | 69 | // In case the points type isn't set, we do this first. |
70 | - $instance = parent::verify_settings( $instance ); |
|
70 | + $instance = parent::verify_settings($instance); |
|
71 | 71 | |
72 | - if ( ! is_wp_error( $instance ) && is_user_logged_in() && empty( $instance['text'] ) ) { |
|
73 | - $instance['text'] = wordpoints_get_points_type_setting( $instance['points_type'], 'name' ) . ': %points%'; |
|
72 | + if ( ! is_wp_error($instance) && is_user_logged_in() && empty($instance['text'])) { |
|
73 | + $instance['text'] = wordpoints_get_points_type_setting($instance['points_type'], 'name') . ': %points%'; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | return $instance; |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | * @since 1.9.0 As part of WordPoints_My_Points_Widget. |
81 | 81 | * @since 2.3.0 |
82 | 82 | */ |
83 | - protected function widget_body( $instance ) { |
|
83 | + protected function widget_body($instance) { |
|
84 | 84 | |
85 | - if ( is_user_logged_in() ) { |
|
85 | + if (is_user_logged_in()) { |
|
86 | 86 | |
87 | 87 | $text = str_replace( |
88 | 88 | '%points%', |
89 | 89 | wordpoints_format_points( |
90 | - wordpoints_get_points( get_current_user_id(), $instance['points_type'] ), |
|
90 | + wordpoints_get_points(get_current_user_id(), $instance['points_type']), |
|
91 | 91 | $instance['points_type'], |
92 | 92 | 'my_points_widget' |
93 | 93 | ), |
@@ -113,20 +113,20 @@ discard block |
||
113 | 113 | * @param string $text The text for the widget set by the user. |
114 | 114 | * @param array $instance The settings for this instance of the widget. |
115 | 115 | */ |
116 | - $text = apply_filters( 'wordpoints_points_widget_text', $text, $instance ); |
|
116 | + $text = apply_filters('wordpoints_points_widget_text', $text, $instance); |
|
117 | 117 | |
118 | 118 | echo '<div class="wordpoints-points-widget-text">', $text, '</div><br />'; // XSS OK, WPCS |
119 | 119 | |
120 | - if ( is_user_logged_in() && 0 !== $instance['number_logs'] ) { |
|
120 | + if (is_user_logged_in() && 0 !== $instance['number_logs']) { |
|
121 | 121 | |
122 | - $query_args = wordpoints_get_points_logs_query_args( $instance['points_type'], 'current_user' ); |
|
122 | + $query_args = wordpoints_get_points_logs_query_args($instance['points_type'], 'current_user'); |
|
123 | 123 | |
124 | 124 | $query_args['limit'] = $instance['number_logs']; |
125 | 125 | |
126 | - $logs_query = new WordPoints_Points_Logs_Query( $query_args ); |
|
127 | - $logs_query->prime_cache( 'current_user:%points_type%:%user_id%' ); |
|
126 | + $logs_query = new WordPoints_Points_Logs_Query($query_args); |
|
127 | + $logs_query->prime_cache('current_user:%points_type%:%user_id%'); |
|
128 | 128 | |
129 | - wordpoints_show_points_logs( $logs_query, array( 'paginate' => false, 'searchable' => false, 'show_users' => false ) ); |
|
129 | + wordpoints_show_points_logs($logs_query, array('paginate' => false, 'searchable' => false, 'show_users' => false)); |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
@@ -141,14 +141,14 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @return array The updated settings for the widget instance. |
143 | 143 | */ |
144 | - public function update( $new_instance, $old_instance ) { |
|
144 | + public function update($new_instance, $old_instance) { |
|
145 | 145 | |
146 | - parent::update( $new_instance, $old_instance ); |
|
146 | + parent::update($new_instance, $old_instance); |
|
147 | 147 | |
148 | - $this->instance['text'] = trim( $this->instance['text'] ); |
|
149 | - $this->instance['alt_text'] = trim( $this->instance['alt_text'] ); |
|
148 | + $this->instance['text'] = trim($this->instance['text']); |
|
149 | + $this->instance['alt_text'] = trim($this->instance['alt_text']); |
|
150 | 150 | |
151 | - if ( ! wordpoints_posint( $this->instance['number_logs'] ) ) { |
|
151 | + if ( ! wordpoints_posint($this->instance['number_logs'])) { |
|
152 | 152 | $this->instance['number_logs'] = 0; |
153 | 153 | } |
154 | 154 | |
@@ -159,17 +159,17 @@ discard block |
||
159 | 159 | * @since 1.0.0 As part of WordPoints_My_Points_Widget. |
160 | 160 | * @since 2.3.0 |
161 | 161 | */ |
162 | - public function form( $instance ) { |
|
162 | + public function form($instance) { |
|
163 | 163 | |
164 | - parent::form( $instance ); |
|
164 | + parent::form($instance); |
|
165 | 165 | |
166 | 166 | ?> |
167 | 167 | |
168 | 168 | <p> |
169 | - <label for="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>"><?php esc_html_e( 'Widget text', 'wordpoints' ); ?></label> |
|
170 | - <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'text' ) ); ?>" value="<?php echo esc_attr( $this->instance['text'] ); ?>" /> |
|
169 | + <label for="<?php echo esc_attr($this->get_field_id('text')); ?>"><?php esc_html_e('Widget text', 'wordpoints'); ?></label> |
|
170 | + <input type="text" class="widefat" id="<?php echo esc_attr($this->get_field_id('text')); ?>" name="<?php echo esc_attr($this->get_field_name('text')); ?>" value="<?php echo esc_attr($this->instance['text']); ?>" /> |
|
171 | 171 | <?php // translators: Placeholder name. ?> |
172 | - <small><i><?php echo esc_html( sprintf( __( '%s will be replaced with the points of the logged in user', 'wordpoints' ), '%points%' ) ); ?></i></small> |
|
172 | + <small><i><?php echo esc_html(sprintf(__('%s will be replaced with the points of the logged in user', 'wordpoints'), '%points%')); ?></i></small> |
|
173 | 173 | <?php |
174 | 174 | |
175 | 175 | /** |
@@ -179,19 +179,19 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @param array $instance The settings of the current widget instance. |
181 | 181 | */ |
182 | - do_action( 'wordpoints_my_points_widget_below_text_field', $this->instance ); |
|
182 | + do_action('wordpoints_my_points_widget_below_text_field', $this->instance); |
|
183 | 183 | |
184 | 184 | ?> |
185 | 185 | </p> |
186 | 186 | <p> |
187 | - <label for="<?php echo esc_attr( $this->get_field_id( 'alt_text' ) ); ?>"><?php esc_html_e( 'Text if the user is not logged in', 'wordpoints' ); ?></label> |
|
188 | - <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'alt_text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'alt_text' ) ); ?>" value="<?php echo esc_attr( $this->instance['alt_text'] ); ?>" /> |
|
189 | - <small><i><?php esc_html_e( 'Leave this field blank to hide the widget if the user is not logged in', 'wordpoints' ); ?></i></small> |
|
187 | + <label for="<?php echo esc_attr($this->get_field_id('alt_text')); ?>"><?php esc_html_e('Text if the user is not logged in', 'wordpoints'); ?></label> |
|
188 | + <input type="text" class="widefat" id="<?php echo esc_attr($this->get_field_id('alt_text')); ?>" name="<?php echo esc_attr($this->get_field_name('alt_text')); ?>" value="<?php echo esc_attr($this->instance['alt_text']); ?>" /> |
|
189 | + <small><i><?php esc_html_e('Leave this field blank to hide the widget if the user is not logged in', 'wordpoints'); ?></i></small> |
|
190 | 190 | </p> |
191 | 191 | <p> |
192 | - <label for="<?php echo esc_attr( $this->get_field_id( 'number_logs' ) ); ?>"><?php esc_html_e( 'Number of latest log entries for this user to display', 'wordpoints' ); ?></label> |
|
193 | - <input type="number" min="0" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'number_logs' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'number_logs' ) ); ?>" value="<?php echo esc_attr( $this->instance['number_logs'] ); ?>" /> |
|
194 | - <small><i><?php esc_html_e( 'Set this to 0 to keep from showing any logs', 'wordpoints' ); ?></i></small> |
|
192 | + <label for="<?php echo esc_attr($this->get_field_id('number_logs')); ?>"><?php esc_html_e('Number of latest log entries for this user to display', 'wordpoints'); ?></label> |
|
193 | + <input type="number" min="0" class="widefat" id="<?php echo esc_attr($this->get_field_id('number_logs')); ?>" name="<?php echo esc_attr($this->get_field_name('number_logs')); ?>" value="<?php echo esc_attr($this->instance['number_logs']); ?>" /> |
|
194 | + <small><i><?php esc_html_e('Set this to 0 to keep from showing any logs', 'wordpoints'); ?></i></small> |
|
195 | 195 | </p> |
196 | 196 | |
197 | 197 | <?php |