@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | $this->validate_count(); |
94 | 94 | |
95 | - if ( isset( $settings['conditions'] ) ) { |
|
95 | + if ( isset( $settings[ 'conditions' ] ) ) { |
|
96 | 96 | $this->validate_conditions( $arg ); |
97 | 97 | } |
98 | 98 | |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | protected function validate_count() { |
108 | 108 | |
109 | 109 | if ( |
110 | - ! empty( $this->settings['max'] ) |
|
111 | - && ! wordpoints_posint( $this->settings['max'] ) |
|
110 | + ! empty( $this->settings[ 'max' ] ) |
|
111 | + && ! wordpoints_posint( $this->settings[ 'max' ] ) |
|
112 | 112 | ) { |
113 | 113 | $this->validator->add_error( |
114 | 114 | __( 'The maximum must be a positive integer.', 'wordpoints' ) |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | ); |
117 | 117 | } |
118 | 118 | |
119 | - if ( ! empty( $this->settings['min'] ) ) { |
|
119 | + if ( ! empty( $this->settings[ 'min' ] ) ) { |
|
120 | 120 | |
121 | - if ( ! wordpoints_posint( $this->settings['min'] ) ) { |
|
121 | + if ( ! wordpoints_posint( $this->settings[ 'min' ] ) ) { |
|
122 | 122 | |
123 | 123 | $this->validator->add_error( |
124 | 124 | __( 'The minimum must be a positive integer.', 'wordpoints' ) |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | ); |
127 | 127 | |
128 | 128 | } elseif ( |
129 | - ! empty( $this->settings['max'] ) |
|
130 | - && $this->settings['max'] < $this->settings['min'] |
|
129 | + ! empty( $this->settings[ 'max' ] ) |
|
130 | + && $this->settings[ 'max' ] < $this->settings[ 'min' ] |
|
131 | 131 | ) { |
132 | 132 | |
133 | 133 | $this->validator->add_error( |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | |
165 | 165 | $this->validator->push_field( 'conditions' ); |
166 | 166 | |
167 | - $this->settings['conditions'] = $this->conditions_extension->validate_conditions( |
|
168 | - $this->settings['conditions'] |
|
167 | + $this->settings[ 'conditions' ] = $this->conditions_extension->validate_conditions( |
|
168 | + $this->settings[ 'conditions' ] |
|
169 | 169 | , $args |
170 | 170 | ); |
171 | 171 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | $entities = $arg->get_the_entities(); |
189 | 189 | |
190 | - if ( isset( $this->settings['conditions'] ) ) { |
|
190 | + if ( isset( $this->settings[ 'conditions' ] ) ) { |
|
191 | 191 | $entities = $this->filter_entities( $entities ); |
192 | 192 | } |
193 | 193 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $event_args->add_entity( $entity ); |
213 | 213 | |
214 | 214 | $matches = $this->conditions_extension->conditions_are_met( |
215 | - $this->settings['conditions'] |
|
215 | + $this->settings[ 'conditions' ] |
|
216 | 216 | , $event_args |
217 | 217 | ); |
218 | 218 | |
@@ -235,11 +235,11 @@ discard block |
||
235 | 235 | */ |
236 | 236 | protected function check_count( $count ) { |
237 | 237 | |
238 | - if ( isset( $this->settings['max'] ) && $count > $this->settings['max'] ) { |
|
238 | + if ( isset( $this->settings[ 'max' ] ) && $count > $this->settings[ 'max' ] ) { |
|
239 | 239 | return false; |
240 | 240 | } |
241 | 241 | |
242 | - if ( isset( $this->settings['min'] ) && $count < $this->settings['min'] ) { |
|
242 | + if ( isset( $this->settings[ 'min' ] ) && $count < $this->settings[ 'min' ] ) { |
|
243 | 243 | return false; |
244 | 244 | } |
245 | 245 |
@@ -39,7 +39,7 @@ |
||
39 | 39 | */ |
40 | 40 | public function is_met( array $settings, WordPoints_Hook_Event_Args $args ) { |
41 | 41 | |
42 | - return $settings['value'] === $args->get_current()->get_the_value(); |
|
42 | + return $settings[ 'value' ] === $args->get_current()->get_the_value(); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function start() { |
102 | 102 | |
103 | - echo '<select id="', esc_attr( $this->args['id'] ), '" name="', esc_attr( $this->args['name'] ), '" class="', esc_attr( $this->args['class'] ), '">'; |
|
103 | + echo '<select id="', esc_attr( $this->args[ 'id' ] ), '" name="', esc_attr( $this->args[ 'name' ] ), '" class="', esc_attr( $this->args[ 'class' ] ), '">'; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -110,20 +110,20 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function options() { |
112 | 112 | |
113 | - if ( ! empty( $this->args['show_option_none'] ) ) { |
|
113 | + if ( ! empty( $this->args[ 'show_option_none' ] ) ) { |
|
114 | 114 | |
115 | - echo '<option value="-1"', selected( '-1', $this->args['selected'], false ), '>', esc_html( $this->args['show_option_none'] ), '</option>'; |
|
115 | + echo '<option value="-1"', selected( '-1', $this->args[ 'selected' ], false ), '>', esc_html( $this->args[ 'show_option_none' ] ), '</option>'; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | foreach ( $this->options as $value => $option ) { |
119 | 119 | |
120 | - if ( isset( $this->args['values_key'], $this->args['options_key'] ) ) { |
|
120 | + if ( isset( $this->args[ 'values_key' ], $this->args[ 'options_key' ] ) ) { |
|
121 | 121 | $option = (array) $option; |
122 | - $value = $option[ $this->args['values_key'] ]; |
|
123 | - $option = $option[ $this->args['options_key'] ]; |
|
122 | + $value = $option[ $this->args[ 'values_key' ] ]; |
|
123 | + $option = $option[ $this->args[ 'options_key' ] ]; |
|
124 | 124 | } |
125 | 125 | |
126 | - echo '<option value="', esc_attr( $value ), '"', selected( $value, $this->args['selected'], false ), '>', esc_html( $option ), '</option>'; |
|
126 | + echo '<option value="', esc_attr( $value ), '"', selected( $value, $this->args[ 'selected' ], false ), '>', esc_html( $option ), '</option>'; |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 |
@@ -119,8 +119,8 @@ |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | foreach ( self::$paths as $path ) { |
122 | - if ( 0 === strpos( $file, $path['module_realpath'] ) ) { |
|
123 | - $file = $path['module_path'] . substr( $file, $path['realpath_length'] ); |
|
122 | + if ( 0 === strpos( $file, $path[ 'module_realpath' ] ) ) { |
|
123 | + $file = $path[ 'module_path' ] . substr( $file, $path[ 'realpath_length' ] ); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $message = $message->get_error_message(); |
63 | 63 | } |
64 | 64 | |
65 | - echo $args['before_widget']; // XSS OK here, WPCS. |
|
65 | + echo $args[ 'before_widget' ]; // XSS OK here, WPCS. |
|
66 | 66 | |
67 | 67 | ?> |
68 | 68 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | <?php |
88 | 88 | |
89 | - echo $args['after_widget']; // XSs OK here too, WPCS. |
|
89 | + echo $args[ 'after_widget' ]; // XSs OK here too, WPCS. |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | */ |
107 | 107 | protected function verify_settings( $instance ) { |
108 | 108 | |
109 | - if ( ! isset( $instance['title'] ) ) { |
|
110 | - $instance['title'] = ''; |
|
109 | + if ( ! isset( $instance[ 'title' ] ) ) { |
|
110 | + $instance[ 'title' ] = ''; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $instance; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | return; |
131 | 131 | } |
132 | 132 | |
133 | - echo $args['before_widget']; // XSS OK here, WPCS. |
|
133 | + echo $args[ 'before_widget' ]; // XSS OK here, WPCS. |
|
134 | 134 | |
135 | 135 | /** |
136 | 136 | * The widget's title. |
@@ -139,14 +139,14 @@ discard block |
||
139 | 139 | * |
140 | 140 | * @param string $title The widget title. |
141 | 141 | */ |
142 | - $title = apply_filters( 'widget_title', $instance['title'] ); |
|
142 | + $title = apply_filters( 'widget_title', $instance[ 'title' ] ); |
|
143 | 143 | |
144 | 144 | if ( ! empty( $title ) ) { |
145 | 145 | |
146 | - echo $args['before_title'] . $title . $args['after_title']; // XSS OK, WPCS. |
|
146 | + echo $args[ 'before_title' ] . $title . $args[ 'after_title' ]; // XSS OK, WPCS. |
|
147 | 147 | } |
148 | 148 | |
149 | - $widget_slug = $this->widget_options['wordpoints_hook_slug']; |
|
149 | + $widget_slug = $this->widget_options[ 'wordpoints_hook_slug' ]; |
|
150 | 150 | |
151 | 151 | /** |
152 | 152 | * Before a WordPoints widget. |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | */ |
169 | 169 | do_action( "wordpoints_{$widget_slug}_widget_after", $instance ); |
170 | 170 | |
171 | - echo $args['after_widget']; // XSS OK here too, WPCS. |
|
171 | + echo $args[ 'after_widget' ]; // XSS OK here too, WPCS. |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * @since 2.0.0 |
207 | 207 | */ |
208 | 208 | public function update_title() { |
209 | - $this->instance['title'] = strip_tags( $this->instance['title'] ); |
|
209 | + $this->instance[ 'title' ] = strip_tags( $this->instance[ 'title' ] ); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | <p> |
234 | 234 | <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php echo esc_html_x( 'Title', 'form label', 'wordpoints' ); ?></label> |
235 | - <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $this->instance['title'] ); ?>" /> |
|
235 | + <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $this->instance[ 'title' ] ); ?>" /> |
|
236 | 236 | </p> |
237 | 237 | |
238 | 238 | <?php |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function backup() { |
40 | 40 | |
41 | - $this->backup['original_blog_id'] = get_current_blog_id(); |
|
41 | + $this->backup[ 'original_blog_id' ] = get_current_blog_id(); |
|
42 | 42 | |
43 | - if ( isset( $GLOBALS['_wp_switched_stack'] ) ) { |
|
44 | - $this->backup['switched_stack'] = $GLOBALS['_wp_switched_stack']; |
|
43 | + if ( isset( $GLOBALS[ '_wp_switched_stack' ] ) ) { |
|
44 | + $this->backup[ 'switched_stack' ] = $GLOBALS[ '_wp_switched_stack' ]; |
|
45 | 45 | } |
46 | 46 | |
47 | - if ( isset( $GLOBALS['switched'] ) ) { |
|
48 | - $this->backup['switched'] = $GLOBALS['switched']; |
|
47 | + if ( isset( $GLOBALS[ 'switched' ] ) ) { |
|
48 | + $this->backup[ 'switched' ] = $GLOBALS[ 'switched' ]; |
|
49 | 49 | } |
50 | 50 | |
51 | - return $this->backup['original_blog_id']; |
|
51 | + return $this->backup[ 'original_blog_id' ]; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -62,21 +62,21 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function restore() { |
64 | 64 | |
65 | - switch_to_blog( $this->backup['original_blog_id'] ); |
|
65 | + switch_to_blog( $this->backup[ 'original_blog_id' ] ); |
|
66 | 66 | |
67 | - if ( isset( $this->backup['switched_stack'] ) ) { |
|
68 | - $GLOBALS['_wp_switched_stack'] = $this->backup['switched_stack']; |
|
67 | + if ( isset( $this->backup[ 'switched_stack' ] ) ) { |
|
68 | + $GLOBALS[ '_wp_switched_stack' ] = $this->backup[ 'switched_stack' ]; |
|
69 | 69 | } else { |
70 | - unset( $GLOBALS['_wp_switched_stack'] ); |
|
70 | + unset( $GLOBALS[ '_wp_switched_stack' ] ); |
|
71 | 71 | } |
72 | 72 | |
73 | - if ( isset( $this->backup['switched'] ) ) { |
|
74 | - $GLOBALS['switched'] = $this->backup['switched']; |
|
73 | + if ( isset( $this->backup[ 'switched' ] ) ) { |
|
74 | + $GLOBALS[ 'switched' ] = $this->backup[ 'switched' ]; |
|
75 | 75 | } else { |
76 | - unset( $GLOBALS['switched'] ); |
|
76 | + unset( $GLOBALS[ 'switched' ] ); |
|
77 | 77 | } |
78 | 78 | |
79 | - return $this->backup['original_blog_id']; |
|
79 | + return $this->backup[ 'original_blog_id' ]; |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | parent::__construct( |
49 | 49 | array( |
50 | 50 | 'plural' => 'modules', |
51 | - 'screen' => ( isset( $args['screen'] ) ) ? $args['screen'] : null, |
|
51 | + 'screen' => ( isset( $args[ 'screen' ] ) ) ? $args[ 'screen' ] : null, |
|
52 | 52 | ) |
53 | 53 | ); |
54 | 54 | |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | */ |
69 | 69 | $module_statuses = apply_filters( 'wordpoints_module_statuses', $module_statuses ); |
70 | 70 | |
71 | - if ( isset( $_REQUEST['module_status'] ) && in_array( wp_unslash( $_REQUEST['module_status'] ), $module_statuses, true ) ) { // WPCS: CSRF OK. |
|
72 | - $status = sanitize_key( $_REQUEST['module_status'] ); // WPCS: CSRF OK. |
|
71 | + if ( isset( $_REQUEST[ 'module_status' ] ) && in_array( wp_unslash( $_REQUEST[ 'module_status' ] ), $module_statuses, true ) ) { // WPCS: CSRF OK. |
|
72 | + $status = sanitize_key( $_REQUEST[ 'module_status' ] ); // WPCS: CSRF OK. |
|
73 | 73 | } |
74 | 74 | |
75 | - if ( isset( $_REQUEST['s'] ) ) { // WPCS: CSRF OK. |
|
76 | - $_SERVER['REQUEST_URI'] = add_query_arg( 's', sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ) ); // WPCS: CSRF OK. |
|
75 | + if ( isset( $_REQUEST[ 's' ] ) ) { // WPCS: CSRF OK. |
|
76 | + $_SERVER[ 'REQUEST_URI' ] = add_query_arg( 's', sanitize_text_field( wp_unslash( $_REQUEST[ 's' ] ) ) ); // WPCS: CSRF OK. |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | $page = $this->get_pagenum(); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function get_table_classes() { |
90 | 90 | |
91 | - return array( 'widefat', $this->_args['plural'], 'plugins' ); |
|
91 | + return array( 'widefat', $this->_args[ 'plural' ], 'plugins' ); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | } // End if ( not network admin ). |
182 | 182 | |
183 | - foreach ( (array) $modules['all'] as $module_file => $module_data ) { |
|
183 | + foreach ( (array) $modules[ 'all' ] as $module_file => $module_data ) { |
|
184 | 184 | |
185 | 185 | // Filter into individual sections. |
186 | 186 | if ( |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | ) { |
191 | 191 | |
192 | 192 | if ( $show_network_active ) { |
193 | - $modules['inactive'][ $module_file ] = $module_data; |
|
193 | + $modules[ 'inactive' ][ $module_file ] = $module_data; |
|
194 | 194 | } else { |
195 | - unset( $modules['all'][ $module_file ] ); |
|
195 | + unset( $modules[ 'all' ][ $module_file ] ); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | } elseif ( |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | ) { |
202 | 202 | |
203 | 203 | if ( $show_network_active ) { |
204 | - $modules['active'][ $module_file ] = $module_data; |
|
204 | + $modules[ 'active' ][ $module_file ] = $module_data; |
|
205 | 205 | } else { |
206 | - unset( $modules['all'][ $module_file ] ); |
|
206 | + unset( $modules[ 'all' ][ $module_file ] ); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | } elseif ( |
@@ -216,16 +216,16 @@ discard block |
||
216 | 216 | ) |
217 | 217 | ) { |
218 | 218 | |
219 | - $modules['active'][ $module_file ] = $module_data; |
|
219 | + $modules[ 'active' ][ $module_file ] = $module_data; |
|
220 | 220 | |
221 | 221 | } else { |
222 | 222 | |
223 | 223 | // Was the module recently activated? |
224 | 224 | if ( ! $this->screen->in_admin( 'network' ) && isset( $recently_activated[ $module_file ] ) ) { |
225 | - $modules['recently_activated'][ $module_file ] = $module_data; |
|
225 | + $modules[ 'recently_activated' ][ $module_file ] = $module_data; |
|
226 | 226 | } |
227 | 227 | |
228 | - $modules['inactive'][ $module_file ] = $module_data; |
|
228 | + $modules[ 'inactive' ][ $module_file ] = $module_data; |
|
229 | 229 | |
230 | 230 | } // End if (). |
231 | 231 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | if ( $s ) { |
235 | 235 | |
236 | 236 | $status = 'search'; |
237 | - $modules['search'] = array_filter( $modules['all'], array( $this, '_search_callback' ) ); |
|
237 | + $modules[ 'search' ] = array_filter( $modules[ 'all' ], array( $this, '_search_callback' ) ); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | |
312 | 312 | static $term; |
313 | 313 | |
314 | - if ( is_null( $term ) && isset( $_REQUEST['s'] ) ) { // WPCS: CSRF OK. |
|
315 | - $term = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ); // WPCS: CSRF OK. |
|
314 | + if ( is_null( $term ) && isset( $_REQUEST[ 's' ] ) ) { // WPCS: CSRF OK. |
|
315 | + $term = sanitize_text_field( wp_unslash( $_REQUEST[ 's' ] ) ); // WPCS: CSRF OK. |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | foreach ( $module_data as $value ) { |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | |
365 | 365 | global $modules; |
366 | 366 | |
367 | - if ( ! empty( $modules['all'] ) ) { |
|
367 | + if ( ! empty( $modules[ 'all' ] ) ) { |
|
368 | 368 | esc_html_e( 'No modules found.', 'wordpoints' ); |
369 | 369 | } else { |
370 | 370 | esc_html_e( 'There are not any modules installed.', 'wordpoints' ); |
@@ -478,11 +478,11 @@ discard block |
||
478 | 478 | $actions = array(); |
479 | 479 | |
480 | 480 | if ( 'active' !== $status ) { |
481 | - $actions['activate-selected'] = ( $this->screen->in_admin( 'network' ) ) ? esc_html__( 'Network Activate', 'wordpoints' ) : esc_html__( 'Activate', 'wordpoints' ); |
|
481 | + $actions[ 'activate-selected' ] = ( $this->screen->in_admin( 'network' ) ) ? esc_html__( 'Network Activate', 'wordpoints' ) : esc_html__( 'Activate', 'wordpoints' ); |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | if ( 'inactive' !== $status && 'recent' !== $status ) { |
485 | - $actions['deactivate-selected'] = ( $this->screen->in_admin( 'network' ) ) ? esc_html__( 'Network Deactivate', 'wordpoints' ) : esc_html__( 'Deactivate', 'wordpoints' ); |
|
485 | + $actions[ 'deactivate-selected' ] = ( $this->screen->in_admin( 'network' ) ) ? esc_html__( 'Network Deactivate', 'wordpoints' ) : esc_html__( 'Deactivate', 'wordpoints' ); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | if ( |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | && current_user_can( 'delete_wordpoints_modules' ) |
491 | 491 | && 'active' !== $status |
492 | 492 | ) { |
493 | - $actions['delete-selected'] = esc_html__( 'Delete', 'wordpoints' ); |
|
493 | + $actions[ 'delete-selected' ] = esc_html__( 'Delete', 'wordpoints' ); |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | /** |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | $class = apply_filters( 'wordpoints_module_list_row_class', $class, $module_file, $module_data, $context ); |
579 | 579 | |
580 | 580 | ?> |
581 | - <tr id="<?php echo esc_attr( sanitize_title( $module_data['name'] ) ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
|
581 | + <tr id="<?php echo esc_attr( sanitize_title( $module_data[ 'name' ] ) ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
|
582 | 582 | <?php $this->single_row_columns( $item, $class, $is_active ); ?> |
583 | 583 | </tr> |
584 | 584 | <?php |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | |
619 | 619 | list( $module_file, $module_data ) = $item; |
620 | 620 | |
621 | - $module_data['extra']['module_file'] = $module_file; |
|
621 | + $module_data[ 'extra' ][ 'module_file' ] = $module_file; |
|
622 | 622 | |
623 | 623 | if ( $this->screen->in_admin( 'network' ) ) { |
624 | 624 | |
@@ -631,11 +631,11 @@ discard block |
||
631 | 631 | $restricted_network_only = ( is_multisite() && is_network_only_wordpoints_module( $module_file ) && ! $is_active ); |
632 | 632 | } |
633 | 633 | |
634 | - $module_data['extra']['is_active'] = $is_active; |
|
635 | - $module_data['extra']['restricted_network_active'] = $restricted_network_active; |
|
636 | - $module_data['extra']['restricted_network_only'] = $restricted_network_only; |
|
634 | + $module_data[ 'extra' ][ 'is_active' ] = $is_active; |
|
635 | + $module_data[ 'extra' ][ 'restricted_network_active' ] = $restricted_network_active; |
|
636 | + $module_data[ 'extra' ][ 'restricted_network_only' ] = $restricted_network_only; |
|
637 | 637 | |
638 | - list( $columns, $hidden, , $primary ) = $this->get_column_info(); |
|
638 | + list( $columns, $hidden,, $primary ) = $this->get_column_info(); |
|
639 | 639 | |
640 | 640 | foreach ( $columns as $column_name => $column_display_name ) { |
641 | 641 | |
@@ -672,11 +672,11 @@ discard block |
||
672 | 672 | */ |
673 | 673 | protected function column_cb( $module_data ) { |
674 | 674 | |
675 | - $checkbox_id = 'checkbox_' . sanitize_key( $module_data['extra']['module_file'] ); |
|
675 | + $checkbox_id = 'checkbox_' . sanitize_key( $module_data[ 'extra' ][ 'module_file' ] ); |
|
676 | 676 | |
677 | 677 | ?> |
678 | 678 | <th scope="row" class="check-column"> |
679 | - <?php if ( ! $module_data['extra']['restricted_network_active'] && ! $module_data['extra']['restricted_network_only'] ) : ?> |
|
679 | + <?php if ( ! $module_data[ 'extra' ][ 'restricted_network_active' ] && ! $module_data[ 'extra' ][ 'restricted_network_only' ] ) : ?> |
|
680 | 680 | <label class="screen-reader-text" for="<?php echo esc_attr( $checkbox_id ); ?>"> |
681 | 681 | <?php |
682 | 682 | |
@@ -684,13 +684,13 @@ discard block |
||
684 | 684 | sprintf( |
685 | 685 | // translators: Module name. |
686 | 686 | __( 'Select %s', 'wordpoints' ) |
687 | - , $module_data['name'] |
|
687 | + , $module_data[ 'name' ] |
|
688 | 688 | ) |
689 | 689 | ); |
690 | 690 | |
691 | 691 | ?> |
692 | 692 | </label> |
693 | - <input type="checkbox" name="checked[]" value="<?php echo esc_attr( $module_data['extra']['module_file'] ); ?>" id="<?php echo esc_attr( $checkbox_id ); ?>" /> |
|
693 | + <input type="checkbox" name="checked[]" value="<?php echo esc_attr( $module_data[ 'extra' ][ 'module_file' ] ); ?>" id="<?php echo esc_attr( $checkbox_id ); ?>" /> |
|
694 | 694 | <?php endif; ?> |
695 | 695 | </th> |
696 | 696 | <?php |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | |
710 | 710 | ?> |
711 | 711 | <td class="module-title<?php echo ( $is_hidden ) ? ' hidden' : ''; ?><?php echo ( $is_primary ) ? ' has-row-actions column-primary' : ''; ?>"> |
712 | - <strong><?php echo esc_html( $module_data['name'] ); ?></strong> |
|
712 | + <strong><?php echo esc_html( $module_data[ 'name' ] ); ?></strong> |
|
713 | 713 | <?php if ( $is_primary ) : ?> |
714 | 714 | <?php echo $this->row_actions( $this->get_module_row_actions( $module_data ), true ); // WPCS XSS OK. ?> |
715 | 715 | <?php endif; ?> |
@@ -735,8 +735,8 @@ discard block |
||
735 | 735 | <td class="column-description desc<?php echo ( $is_hidden ) ? ' hidden' : ''; ?><?php echo ( $is_primary ) ? ' has-row-actions column-primary' : ''; ?>"> |
736 | 736 | <div class="module-description"> |
737 | 737 | <p> |
738 | - <?php if ( ! empty( $module_data['description'] ) ) : ?> |
|
739 | - <?php echo wp_kses( $module_data['description'] , 'wordpoints_module_description' ); ?> |
|
738 | + <?php if ( ! empty( $module_data[ 'description' ] ) ) : ?> |
|
739 | + <?php echo wp_kses( $module_data[ 'description' ], 'wordpoints_module_description' ); ?> |
|
740 | 740 | <?php else : ?> |
741 | 741 | |
742 | 742 | <?php endif; ?> |
@@ -747,25 +747,25 @@ discard block |
||
747 | 747 | |
748 | 748 | $module_meta = array(); |
749 | 749 | |
750 | - if ( ! empty( $module_data['version'] ) ) { |
|
750 | + if ( ! empty( $module_data[ 'version' ] ) ) { |
|
751 | 751 | // translators: Module version. |
752 | - $module_meta[] = sprintf( esc_html__( 'Version %s', 'wordpoints' ), $module_data['version'] ); |
|
752 | + $module_meta[ ] = sprintf( esc_html__( 'Version %s', 'wordpoints' ), $module_data[ 'version' ] ); |
|
753 | 753 | } |
754 | 754 | |
755 | - if ( ! empty( $module_data['author'] ) ) { |
|
755 | + if ( ! empty( $module_data[ 'author' ] ) ) { |
|
756 | 756 | |
757 | - $author = $module_data['author']; |
|
757 | + $author = $module_data[ 'author' ]; |
|
758 | 758 | |
759 | - if ( ! empty( $module_data['author_uri'] ) ) { |
|
760 | - $author = '<a href="' . esc_url( $module_data['author_uri'] ) . '">' . esc_html( $module_data['author'] ) . '</a>'; |
|
759 | + if ( ! empty( $module_data[ 'author_uri' ] ) ) { |
|
760 | + $author = '<a href="' . esc_url( $module_data[ 'author_uri' ] ) . '">' . esc_html( $module_data[ 'author' ] ) . '</a>'; |
|
761 | 761 | } |
762 | 762 | |
763 | 763 | // translators: Author name. |
764 | - $module_meta[] = sprintf( __( 'By %s', 'wordpoints' ), $author ); |
|
764 | + $module_meta[ ] = sprintf( __( 'By %s', 'wordpoints' ), $author ); |
|
765 | 765 | } |
766 | 766 | |
767 | - if ( ! empty( $module_data['module_uri'] ) ) { |
|
768 | - $module_meta[] = '<a href="' . esc_url( $module_data['module_uri'] ) . '">' . esc_html__( 'Visit module site', 'wordpoints' ) . '</a>'; |
|
767 | + if ( ! empty( $module_data[ 'module_uri' ] ) ) { |
|
768 | + $module_meta[ ] = '<a href="' . esc_url( $module_data[ 'module_uri' ] ) . '">' . esc_html__( 'Visit module site', 'wordpoints' ) . '</a>'; |
|
769 | 769 | } |
770 | 770 | |
771 | 771 | /** |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | * @param array $module_data The info about the module. |
782 | 782 | * @param string $status The module status being displayed. |
783 | 783 | */ |
784 | - $module_meta = apply_filters( 'wordpoints_module_row_meta', $module_meta, $module_data['extra']['module_file'], $module_data, $status ); |
|
784 | + $module_meta = apply_filters( 'wordpoints_module_row_meta', $module_meta, $module_data[ 'extra' ][ 'module_file' ], $module_data, $status ); |
|
785 | 785 | |
786 | 786 | echo wp_kses( implode( ' | ', $module_meta ), 'data' ); |
787 | 787 | |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | * @param string $module_file The main file of the current module. |
819 | 819 | * @param array $module_data The module's info. |
820 | 820 | */ |
821 | - do_action( 'wordpoints_manage_modules_custom_column', $column_name, $module_data['module_file'], $module_data ); |
|
821 | + do_action( 'wordpoints_manage_modules_custom_column', $column_name, $module_data[ 'module_file' ], $module_data ); |
|
822 | 822 | ?> |
823 | 823 | <?php if ( $is_primary ) : ?> |
824 | 824 | <?php echo $this->row_actions( $this->get_module_row_actions( $module_data ), true ); // WPCS XSS OK. ?> |
@@ -847,8 +847,8 @@ discard block |
||
847 | 847 | |
848 | 848 | $context = $status; |
849 | 849 | |
850 | - $module_file = $module_data['extra']['module_file']; |
|
851 | - $args = $module_data['extra']; |
|
850 | + $module_file = $module_data[ 'extra' ][ 'module_file' ]; |
|
851 | + $args = $module_data[ 'extra' ]; |
|
852 | 852 | |
853 | 853 | // Pre-order. |
854 | 854 | $actions = array( |
@@ -861,49 +861,49 @@ discard block |
||
861 | 861 | |
862 | 862 | if ( $this->screen->in_admin( 'network' ) ) { |
863 | 863 | |
864 | - if ( $args['is_active'] ) { |
|
864 | + if ( $args[ 'is_active' ] ) { |
|
865 | 865 | |
866 | 866 | if ( current_user_can( 'manage_network_wordpoints_modules' ) ) { |
867 | 867 | // translators: Module name. |
868 | - $actions['deactivate'] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'deactivate', $url ), "deactivate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Network deactivate %s', 'wordpoints' ), $module_data['name'] ) ) . '">' . esc_html__( 'Network Deactivate', 'wordpoints' ) . '</a>'; |
|
868 | + $actions[ 'deactivate' ] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'deactivate', $url ), "deactivate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Network deactivate %s', 'wordpoints' ), $module_data[ 'name' ] ) ) . '">' . esc_html__( 'Network Deactivate', 'wordpoints' ) . '</a>'; |
|
869 | 869 | } |
870 | 870 | |
871 | 871 | } else { |
872 | 872 | |
873 | 873 | if ( current_user_can( 'manage_network_wordpoints_modules' ) ) { |
874 | 874 | // translators: Module name. |
875 | - $actions['activate'] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'activate', $url ), "activate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Network activate %s', 'wordpoints' ), $module_data['name'] ) ) . '" class="edit">' . esc_html__( 'Network Activate', 'wordpoints' ) . '</a>'; |
|
875 | + $actions[ 'activate' ] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'activate', $url ), "activate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Network activate %s', 'wordpoints' ), $module_data[ 'name' ] ) ) . '" class="edit">' . esc_html__( 'Network Activate', 'wordpoints' ) . '</a>'; |
|
876 | 876 | } |
877 | 877 | |
878 | 878 | if ( current_user_can( 'delete_wordpoints_modules' ) && ! is_wordpoints_module_active( $module_file ) ) { |
879 | 879 | // translators: Module name. |
880 | - $actions['delete'] = '<a href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_modules&action=delete-selected&checked[]=' . $module_file . '&module_status=' . $context . '&paged=' . $page . '&s=' . $s ), 'bulk-modules' ) . '" aria-label="' . esc_attr( sprintf( __( 'Delete %s', 'wordpoints' ), $module_data['name'] ) ) . '" class="delete">' . esc_html__( 'Delete', 'wordpoints' ) . '</a>'; |
|
880 | + $actions[ 'delete' ] = '<a href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_modules&action=delete-selected&checked[]=' . $module_file . '&module_status=' . $context . '&paged=' . $page . '&s=' . $s ), 'bulk-modules' ) . '" aria-label="' . esc_attr( sprintf( __( 'Delete %s', 'wordpoints' ), $module_data[ 'name' ] ) ) . '" class="delete">' . esc_html__( 'Delete', 'wordpoints' ) . '</a>'; |
|
881 | 881 | } |
882 | 882 | } |
883 | 883 | |
884 | 884 | } else { |
885 | 885 | |
886 | - if ( $args['restricted_network_active'] ) { |
|
886 | + if ( $args[ 'restricted_network_active' ] ) { |
|
887 | 887 | |
888 | 888 | $actions = array( 'network_active' => __( 'Network Active', 'wordpoints' ) ); |
889 | 889 | |
890 | - } elseif ( $args['restricted_network_only'] ) { |
|
890 | + } elseif ( $args[ 'restricted_network_only' ] ) { |
|
891 | 891 | |
892 | 892 | $actions = array( 'network_only' => __( 'Network Only', 'wordpoints' ) ); |
893 | 893 | |
894 | - } elseif ( $args['is_active'] ) { |
|
894 | + } elseif ( $args[ 'is_active' ] ) { |
|
895 | 895 | |
896 | 896 | // translators: Module name. |
897 | - $actions['deactivate'] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'deactivate', $url ), "deactivate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Deactivate %s', 'wordpoints' ), $module_data['name'] ) ) . '">' . esc_html__( 'Deactivate', 'wordpoints' ) . '</a>'; |
|
897 | + $actions[ 'deactivate' ] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'deactivate', $url ), "deactivate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Deactivate %s', 'wordpoints' ), $module_data[ 'name' ] ) ) . '">' . esc_html__( 'Deactivate', 'wordpoints' ) . '</a>'; |
|
898 | 898 | |
899 | 899 | } else { |
900 | 900 | |
901 | 901 | // translators: Module name. |
902 | - $actions['activate'] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'activate', $url ), "activate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Activate %s', 'wordpoints' ), $module_data['name'] ) ) . '" class="edit">' . esc_html__( 'Activate', 'wordpoints' ) . '</a>'; |
|
902 | + $actions[ 'activate' ] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'activate', $url ), "activate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Activate %s', 'wordpoints' ), $module_data[ 'name' ] ) ) . '" class="edit">' . esc_html__( 'Activate', 'wordpoints' ) . '</a>'; |
|
903 | 903 | |
904 | 904 | if ( ! is_multisite() && current_user_can( 'delete_wordpoints_modules' ) ) { |
905 | 905 | // translators: Module name. |
906 | - $actions['delete'] = '<a href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_modules&action=delete-selected&checked[]=' . $module_file . '&module_status=' . $context . '&paged=' . $page . '&s=' . $s ), 'bulk-modules' ) . '" aria-label="' . esc_attr( sprintf( __( 'Delete %s', 'wordpoints' ), $module_data['name'] ) ) . '" class="delete">' . esc_html__( 'Delete', 'wordpoints' ) . '</a>'; |
|
906 | + $actions[ 'delete' ] = '<a href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_modules&action=delete-selected&checked[]=' . $module_file . '&module_status=' . $context . '&paged=' . $page . '&s=' . $s ), 'bulk-modules' ) . '" aria-label="' . esc_attr( sprintf( __( 'Delete %s', 'wordpoints' ), $module_data[ 'name' ] ) ) . '" class="delete">' . esc_html__( 'Delete', 'wordpoints' ) . '</a>'; |
|
907 | 907 | } |
908 | 908 | } |
909 | 909 |
@@ -68,11 +68,13 @@ discard block |
||
68 | 68 | */ |
69 | 69 | $module_statuses = apply_filters( 'wordpoints_module_statuses', $module_statuses ); |
70 | 70 | |
71 | - if ( isset( $_REQUEST['module_status'] ) && in_array( wp_unslash( $_REQUEST['module_status'] ), $module_statuses, true ) ) { // WPCS: CSRF OK. |
|
71 | + if ( isset( $_REQUEST['module_status'] ) && in_array( wp_unslash( $_REQUEST['module_status'] ), $module_statuses, true ) ) { |
|
72 | +// WPCS: CSRF OK. |
|
72 | 73 | $status = sanitize_key( $_REQUEST['module_status'] ); // WPCS: CSRF OK. |
73 | 74 | } |
74 | 75 | |
75 | - if ( isset( $_REQUEST['s'] ) ) { // WPCS: CSRF OK. |
|
76 | + if ( isset( $_REQUEST['s'] ) ) { |
|
77 | +// WPCS: CSRF OK. |
|
76 | 78 | $_SERVER['REQUEST_URI'] = add_query_arg( 's', sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ) ); // WPCS: CSRF OK. |
77 | 79 | } |
78 | 80 | |
@@ -311,7 +313,8 @@ discard block |
||
311 | 313 | |
312 | 314 | static $term; |
313 | 315 | |
314 | - if ( is_null( $term ) && isset( $_REQUEST['s'] ) ) { // WPCS: CSRF OK. |
|
316 | + if ( is_null( $term ) && isset( $_REQUEST['s'] ) ) { |
|
317 | +// WPCS: CSRF OK. |
|
315 | 318 | $term = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ); // WPCS: CSRF OK. |
316 | 319 | } |
317 | 320 | |
@@ -737,9 +740,12 @@ discard block |
||
737 | 740 | <p> |
738 | 741 | <?php if ( ! empty( $module_data['description'] ) ) : ?> |
739 | 742 | <?php echo wp_kses( $module_data['description'] , 'wordpoints_module_description' ); ?> |
740 | - <?php else : ?> |
|
743 | + <?php else { |
|
744 | + : ?> |
|
741 | 745 | |
742 | - <?php endif; ?> |
|
746 | + <?php endif; |
|
747 | +} |
|
748 | +?> |
|
743 | 749 | </p> |
744 | 750 | </div> |
745 | 751 | <div class="<?php echo esc_attr( $class ); ?> second module-version-author-uri"> |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $points_heading = _x( 'Points', 'column name', 'wordpoints' ); |
49 | 49 | |
50 | 50 | $points_type_name = wordpoints_get_points_type_setting( |
51 | - $this->atts['points_type'] |
|
51 | + $this->atts[ 'points_type' ] |
|
52 | 52 | , 'name' |
53 | 53 | ); |
54 | 54 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | } |
96 | 96 | |
97 | 97 | $hooks = WordPoints_Points_Hooks::get_points_type_hooks( |
98 | - $this->atts['points_type'] |
|
98 | + $this->atts[ 'points_type' ] |
|
99 | 99 | ); |
100 | 100 | |
101 | 101 | $html = ''; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | $points = wordpoints_format_points( |
118 | 118 | $points |
119 | - , $this->atts['points_type'] |
|
119 | + , $this->atts[ 'points_type' ] |
|
120 | 120 | , 'how-to-get-points-shortcode' |
121 | 121 | ); |
122 | 122 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 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 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | if ( $points ) { |
187 | 187 | $points = wordpoints_format_points( |
188 | 188 | $points |
189 | - , $this->atts['points_type'] |
|
189 | + , $this->atts[ 'points_type' ] |
|
190 | 190 | , 'how-to-get-points-shortcode' |
191 | 191 | ); |
192 | 192 | } |
@@ -21,21 +21,21 @@ discard block |
||
21 | 21 | */ |
22 | 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 | // This happens when the widget is first created in the Customizer; the |
27 | 27 | // settings are completely empty. |
28 | - if ( empty( $instance['points_type'] ) ) { |
|
29 | - $default = $this->defaults['points_type']; |
|
28 | + if ( empty( $instance[ 'points_type' ] ) ) { |
|
29 | + $default = $this->defaults[ 'points_type' ]; |
|
30 | 30 | |
31 | 31 | if ( ! $default ) { |
32 | 32 | $this->make_a_points_type( $default ); |
33 | 33 | } |
34 | 34 | |
35 | - $instance['points_type'] = $default; |
|
35 | + $instance[ 'points_type' ] = $default; |
|
36 | 36 | } |
37 | 37 | |
38 | - if ( ! wordpoints_is_points_type( $instance['points_type'] ) ) { |
|
38 | + if ( ! wordpoints_is_points_type( $instance[ 'points_type' ] ) ) { |
|
39 | 39 | return new WP_Error( |
40 | 40 | 'wordpoints_widget_invalid_points_type' |
41 | 41 | , esc_html__( 'Please select a valid points type.', 'wordpoints' ) |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | parent::update( $new_instance, $old_instance ); |
81 | 81 | |
82 | - $this->make_a_points_type( $this->instance['points_type'] ); |
|
82 | + $this->make_a_points_type( $this->instance[ 'points_type' ] ); |
|
83 | 83 | |
84 | 84 | return $this->instance; |
85 | 85 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | public function form_points_type_field() { |
105 | 105 | |
106 | 106 | $dropdown_args = array( |
107 | - 'selected' => $this->instance['points_type'], |
|
107 | + 'selected' => $this->instance[ 'points_type' ], |
|
108 | 108 | 'id' => $this->get_field_id( 'points_type' ), |
109 | 109 | 'name' => $this->get_field_name( 'points_type' ), |
110 | 110 | 'class' => 'widefat', |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | ?> |
114 | 114 | |
115 | 115 | <p> |
116 | - <label for="<?php echo esc_attr( $dropdown_args['id'] ); ?>"><?php echo esc_html_x( 'Points type', 'form label', 'wordpoints' ); ?></label> |
|
116 | + <label for="<?php echo esc_attr( $dropdown_args[ 'id' ] ); ?>"><?php echo esc_html_x( 'Points type', 'form label', 'wordpoints' ); ?></label> |
|
117 | 117 | <?php wordpoints_points_types_dropdown( $dropdown_args ); ?> |
118 | 118 | </p> |
119 | 119 |