@@ -111,22 +111,22 @@ |
||
| 111 | 111 | $points_type = $this->points_type( $number ); |
| 112 | 112 | |
| 113 | 113 | if ( |
| 114 | - $this->is_matching_post_type( $post->post_type, $instance['post_type'] ) |
|
| 114 | + $this->is_matching_post_type( $post->post_type, $instance[ 'post_type' ] ) |
|
| 115 | 115 | && ! $this->awarded_points_already( $post->ID, $points_type ) |
| 116 | 116 | ) { |
| 117 | 117 | |
| 118 | - if ( isset( $instance['publish'] ) ) { |
|
| 118 | + if ( isset( $instance[ 'publish' ] ) ) { |
|
| 119 | 119 | _deprecated_argument( __METHOD__, '1.4.0', 'The "publish" hook setting is no longer used to hold the value for the points. Use "points" instead.' ); |
| 120 | - $instance['points'] = $instance['publish']; |
|
| 120 | + $instance[ 'points' ] = $instance[ 'publish' ]; |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - if ( ! isset( $instance['points'] ) ) { |
|
| 123 | + if ( ! isset( $instance[ 'points' ] ) ) { |
|
| 124 | 124 | continue; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | wordpoints_alter_points( |
| 128 | 128 | $post->post_author |
| 129 | - , $instance['points'] |
|
| 129 | + , $instance[ 'points' ] |
|
| 130 | 130 | , $points_type |
| 131 | 131 | , 'post_publish' |
| 132 | 132 | , array( 'post_id' => $post->ID ) |
@@ -59,8 +59,8 @@ |
||
| 59 | 59 | |
| 60 | 60 | foreach ( $this->get_instances() as $number => $instance ) { |
| 61 | 61 | |
| 62 | - if ( isset( $instance['points'] ) ) { |
|
| 63 | - wordpoints_add_points( $user_id, $instance['points'], $this->points_type( $number ), 'register' ); |
|
| 62 | + if ( isset( $instance[ 'points' ] ) ) { |
|
| 63 | + wordpoints_add_points( $user_id, $instance[ 'points' ], $this->points_type( $number ), 'register' ); |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -86,14 +86,14 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | if ( |
| 88 | 88 | 'approved' === $last_status |
| 89 | - || ! $this->is_matching_post_type( $post->post_type, $instance['post_type'] ) |
|
| 89 | + || ! $this->is_matching_post_type( $post->post_type, $instance[ 'post_type' ] ) |
|
| 90 | 90 | ) { |
| 91 | 91 | continue; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | wordpoints_add_points( |
| 95 | 95 | $this->select_user_to_award( $comment, $post ) |
| 96 | - , $instance['points'] |
|
| 96 | + , $instance[ 'points' ] |
|
| 97 | 97 | , $points_type |
| 98 | 98 | , $this->log_type |
| 99 | 99 | , array( 'comment_id' => $comment->comment_ID ) |
@@ -258,8 +258,8 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | $comment = false; |
| 260 | 260 | |
| 261 | - if ( isset( $meta['comment_id'] ) ) { |
|
| 262 | - $comment = get_comment( $meta['comment_id'] ); |
|
| 261 | + if ( isset( $meta[ 'comment_id' ] ) ) { |
|
| 262 | + $comment = get_comment( $meta[ 'comment_id' ] ); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | if ( ! $comment ) { |
@@ -183,12 +183,12 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | $this->table_name = $wpdb->wordpoints_points_logs; |
| 185 | 185 | |
| 186 | - $this->columns['points_type']['values'] = array_keys( |
|
| 186 | + $this->columns[ 'points_type' ][ 'values' ] = array_keys( |
|
| 187 | 187 | wordpoints_get_points_types() |
| 188 | 188 | ); |
| 189 | 189 | |
| 190 | - $this->defaults['order_by'] = 'date'; |
|
| 191 | - $this->defaults['text__compare'] = 'LIKE'; |
|
| 190 | + $this->defaults[ 'order_by' ] = 'date'; |
|
| 191 | + $this->defaults[ 'text__compare' ] = 'LIKE'; |
|
| 192 | 192 | |
| 193 | 193 | // Back-compat for pre-2.3.0, in case an object or string is passed. |
| 194 | 194 | $args = wp_parse_args( $args ); |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | protected function convert_deprecated_arg_values( $args ) { |
| 224 | 224 | |
| 225 | 225 | // Back-compat for pre-2.3.0, when the fields arg supported 'all'. |
| 226 | - if ( isset( $args['fields'] ) && 'all' === $args['fields'] ) { |
|
| 226 | + if ( isset( $args[ 'fields' ] ) && 'all' === $args[ 'fields' ] ) { |
|
| 227 | 227 | |
| 228 | 228 | _deprecated_argument( |
| 229 | 229 | __METHOD__ |
@@ -231,11 +231,11 @@ discard block |
||
| 231 | 231 | , esc_html( "Passing 'fields' => 'all' is deprecated, just omit the 'fields' arg instead, since all fields returned by default." ) |
| 232 | 232 | ); |
| 233 | 233 | |
| 234 | - unset( $args['fields'] ); |
|
| 234 | + unset( $args[ 'fields' ] ); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | // Back-compat for pre-2.3.0, when the orderby arg supported 'none'. |
| 238 | - if ( isset( $args['orderby'] ) && 'none' === $args['orderby'] ) { |
|
| 238 | + if ( isset( $args[ 'orderby' ] ) && 'none' === $args[ 'orderby' ] ) { |
|
| 239 | 239 | |
| 240 | 240 | _deprecated_argument( |
| 241 | 241 | __METHOD__ |
@@ -243,8 +243,8 @@ discard block |
||
| 243 | 243 | , esc_html( "Passing 'orderby' => 'none' is deprecated, pass 'order_by' => null instead." ) |
| 244 | 244 | ); |
| 245 | 245 | |
| 246 | - $args['order_by'] = null; |
|
| 247 | - unset( $args['orderby'] ); |
|
| 246 | + $args[ 'order_by' ] = null; |
|
| 247 | + unset( $args[ 'orderby' ] ); |
|
| 248 | 248 | |
| 249 | 249 | return $args; |
| 250 | 250 | } |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | if ( false !== $cache ) { |
| 368 | 368 | return array_slice( |
| 369 | 369 | $cache |
| 370 | - , $start - $this->args['start'] |
|
| 370 | + , $start - $this->args[ 'start' ] |
|
| 371 | 371 | , $per_page |
| 372 | 372 | ); |
| 373 | 373 | } |
@@ -376,14 +376,14 @@ discard block |
||
| 376 | 376 | // Stash the args so we can restore them later. |
| 377 | 377 | $args = $this->args; |
| 378 | 378 | |
| 379 | - $this->args['start'] += $start; |
|
| 379 | + $this->args[ 'start' ] += $start; |
|
| 380 | 380 | |
| 381 | - if ( ! empty( $this->args['limit'] ) ) { |
|
| 382 | - $this->args['limit'] -= $start; |
|
| 381 | + if ( ! empty( $this->args[ 'limit' ] ) ) { |
|
| 382 | + $this->args[ 'limit' ] -= $start; |
|
| 383 | 383 | } |
| 384 | 384 | |
| 385 | - if ( empty( $this->args['limit'] ) || $this->args['limit'] > $per_page ) { |
|
| 386 | - $this->args['limit'] = $per_page; |
|
| 385 | + if ( empty( $this->args[ 'limit' ] ) || $this->args[ 'limit' ] > $per_page ) { |
|
| 386 | + $this->args[ 'limit' ] = $per_page; |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | // Regenerate the query limit after changing the start and limit args. |
@@ -466,8 +466,8 @@ discard block |
||
| 466 | 466 | '%user_id%', |
| 467 | 467 | ) |
| 468 | 468 | , array( |
| 469 | - isset( $this->args['points_type'] ) ? $this->args['points_type'] : '', |
|
| 470 | - isset( $this->args['user_id'] ) ? $this->args['user_id'] : 0, |
|
| 469 | + isset( $this->args[ 'points_type' ] ) ? $this->args[ 'points_type' ] : '', |
|
| 470 | + isset( $this->args[ 'user_id' ] ) ? $this->args[ 'user_id' ] : 0, |
|
| 471 | 471 | ) |
| 472 | 472 | , $key |
| 473 | 473 | ); |
@@ -182,19 +182,19 @@ discard block |
||
| 182 | 182 | |
| 183 | 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 | 187 | if ( $points < 0 ) { |
| 188 | 188 | |
| 189 | 189 | $points = abs( $points ); |
| 190 | - $points_type['prefix'] = '-' . $points_type['prefix']; |
|
| 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; |
@@ -217,11 +217,11 @@ discard block |
||
| 217 | 217 | |
| 218 | 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'] ) ) { |
|
| 224 | - $points_types = $args['options'] + $points_types; |
|
| 223 | + if ( isset( $args[ 'options' ] ) && is_array( $args[ 'options' ] ) ) { |
|
| 224 | + $points_types = $args[ 'options' ] + $points_types; |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | $dropdown = new WordPoints_Dropdown_Builder( $points_types, $args ); |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | // If the user is being deleted from all blogs on multisite. |
| 248 | 248 | if ( is_multisite() && ! get_userdata( $user_id ) ) { |
| 249 | - $query_args['blog_id'] = 0; |
|
| 249 | + $query_args[ 'blog_id' ] = 0; |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | // Delete log meta. |
@@ -258,8 +258,8 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | $where = array( 'user_id' => $user_id ); |
| 260 | 260 | |
| 261 | - if ( ! isset( $query_args['blog_id'] ) ) { |
|
| 262 | - $where['blog_id'] = $wpdb->blogid; |
|
| 261 | + if ( ! isset( $query_args[ 'blog_id' ] ) ) { |
|
| 262 | + $where[ 'blog_id' ] = $wpdb->blogid; |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | // Now delete the logs. |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | ); |
| 371 | 371 | |
| 372 | 372 | if ( is_wordpoints_network_active() ) { |
| 373 | - $groups[] = 'wordpoints_points_top_users'; |
|
| 373 | + $groups[ ] = 'wordpoints_points_top_users'; |
|
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | wp_cache_add_global_groups( $groups ); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | // Save hooks order for all points types. |
| 41 | - if ( ! isset( $_POST['points_types'] ) || ! is_array( $_POST['points_types'] ) ) { |
|
| 41 | + if ( ! isset( $_POST[ 'points_types' ] ) || ! is_array( $_POST[ 'points_types' ] ) ) { |
|
| 42 | 42 | wp_die( -1, '', array( 'response' => 400 ) ); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | foreach ( array_keys( wordpoints_get_points_types() ) as $points_type ) { |
| 48 | 48 | |
| 49 | - if ( empty( $_POST['points_types'][ $points_type ] ) ) { |
|
| 49 | + if ( empty( $_POST[ 'points_types' ][ $points_type ] ) ) { |
|
| 50 | 50 | continue; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - $hooks = sanitize_text_field( wp_unslash( $_POST['points_types'][ $points_type ] ) ); |
|
| 53 | + $hooks = sanitize_text_field( wp_unslash( $_POST[ 'points_types' ][ $points_type ] ) ); |
|
| 54 | 54 | |
| 55 | 55 | $points_type_hooks = array(); |
| 56 | 56 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | $error = __( 'An error has occurred. Please reload the page and try again.', 'wordpoints' ); |
| 108 | 108 | |
| 109 | - if ( isset( $_POST['points-slug'] ) ) { |
|
| 109 | + if ( isset( $_POST[ 'points-slug' ] ) ) { |
|
| 110 | 110 | |
| 111 | 111 | // - We are saving the settings for a points type. |
| 112 | 112 | |
@@ -123,19 +123,19 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | $settings = array(); |
| 125 | 125 | |
| 126 | - if ( isset( $_POST['points-name'] ) ) { |
|
| 127 | - $settings['name'] = trim( sanitize_text_field( wp_unslash( $_POST['points-name'] ) ) ); |
|
| 126 | + if ( isset( $_POST[ 'points-name' ] ) ) { |
|
| 127 | + $settings[ 'name' ] = trim( sanitize_text_field( wp_unslash( $_POST[ 'points-name' ] ) ) ); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - if ( isset( $_POST['points-prefix'] ) ) { |
|
| 131 | - $settings['prefix'] = ltrim( sanitize_text_field( wp_unslash( $_POST['points-prefix'] ) ) ); |
|
| 130 | + if ( isset( $_POST[ 'points-prefix' ] ) ) { |
|
| 131 | + $settings[ 'prefix' ] = ltrim( sanitize_text_field( wp_unslash( $_POST[ 'points-prefix' ] ) ) ); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - if ( isset( $_POST['points-suffix'] ) ) { |
|
| 135 | - $settings['suffix'] = rtrim( sanitize_text_field( wp_unslash( $_POST['points-suffix'] ) ) ); |
|
| 134 | + if ( isset( $_POST[ 'points-suffix' ] ) ) { |
|
| 135 | + $settings[ 'suffix' ] = rtrim( sanitize_text_field( wp_unslash( $_POST[ 'points-suffix' ] ) ) ); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - $points_type = sanitize_key( $_POST['points-slug'] ); |
|
| 138 | + $points_type = sanitize_key( $_POST[ 'points-slug' ] ); |
|
| 139 | 139 | |
| 140 | 140 | $old_settings = wordpoints_get_points_type( $points_type ); |
| 141 | 141 | |
@@ -159,14 +159,14 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | // - We are creating/updating/deleting an instance of a hook. |
| 161 | 161 | |
| 162 | - if ( ! isset( $_POST['id_base'], $_POST['hook-id'], $_POST['points_type'], $_POST['hook_number'] ) ) { |
|
| 162 | + if ( ! isset( $_POST[ 'id_base' ], $_POST[ 'hook-id' ], $_POST[ 'points_type' ], $_POST[ 'hook_number' ] ) ) { |
|
| 163 | 163 | wp_die( -1, '', array( 'response' => 400 ) ); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - $id_base = sanitize_key( $_POST['id_base'] ); |
|
| 167 | - $hook_id = sanitize_key( $_POST['hook-id'] ); |
|
| 168 | - $points_type_id = sanitize_key( $_POST['points_type'] ); |
|
| 169 | - $number = (int) $_POST['hook_number']; |
|
| 166 | + $id_base = sanitize_key( $_POST[ 'id_base' ] ); |
|
| 167 | + $hook_id = sanitize_key( $_POST[ 'hook-id' ] ); |
|
| 168 | + $points_type_id = sanitize_key( $_POST[ 'points_type' ] ); |
|
| 169 | + $number = (int) $_POST[ 'hook_number' ]; |
|
| 170 | 170 | |
| 171 | 171 | /* |
| 172 | 172 | * Normally the hook ID will be in 'hook-id' when we are updating a hook. |
@@ -177,11 +177,11 @@ discard block |
||
| 177 | 177 | if ( ! $number ) { |
| 178 | 178 | |
| 179 | 179 | // This holds the ID number if the hook is brand new. |
| 180 | - if ( ! isset( $_POST['multi_number'] ) || ! wordpoints_posint( $_POST['multi_number'] ) ) { |
|
| 180 | + if ( ! isset( $_POST[ 'multi_number' ] ) || ! wordpoints_posint( $_POST[ 'multi_number' ] ) ) { |
|
| 181 | 181 | wp_die( '<p>' . esc_html( $error ) . '</p>', '', array( 'response' => 400 ) ); |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - $number = (int) $_POST['multi_number']; |
|
| 184 | + $number = (int) $_POST[ 'multi_number' ]; |
|
| 185 | 185 | $hook_id = $id_base . '-' . $number; |
| 186 | 186 | } |
| 187 | 187 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | // Get the hooks for this points type. |
| 199 | 199 | $points_type_hooks = ( isset( $points_types_hooks[ $points_type_id ] ) ) ? $points_types_hooks[ $points_type_id ] : array(); |
| 200 | 200 | |
| 201 | - if ( ! empty( $_POST['delete_hook'] ) ) { |
|
| 201 | + if ( ! empty( $_POST[ 'delete_hook' ] ) ) { |
|
| 202 | 202 | |
| 203 | 203 | // - We are deleting a hook instance. |
| 204 | 204 | |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $new_instance = reset( $settings ); |
| 230 | 230 | |
| 231 | 231 | // Save the points types-hooks associations. |
| 232 | - $points_type_hooks[] = $hook->get_id( $number ); |
|
| 232 | + $points_type_hooks[ ] = $hook->get_id( $number ); |
|
| 233 | 233 | $points_types_hooks[ $points_type_id ] = $points_type_hooks; |
| 234 | 234 | WordPoints_Points_Hooks::save_points_types_hooks( $points_types_hooks ); |
| 235 | 235 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | |
| 248 | 248 | $hook->update_callback( wp_unslash( $new_instance ), $number ); |
| 249 | 249 | |
| 250 | - if ( empty( $_POST['add_new'] ) ) { |
|
| 250 | + if ( empty( $_POST[ 'add_new' ] ) ) { |
|
| 251 | 251 | $hook->form_callback( $number ); |
| 252 | 252 | } |
| 253 | 253 | |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | <input class="widefat" type="text" |
| 268 | 268 | id="points-name-<?php echo esc_attr( $slug ); ?>" |
| 269 | 269 | name="points-name" |
| 270 | - value="<?php echo esc_attr( $points_type['name'] ); ?>"/> |
|
| 270 | + value="<?php echo esc_attr( $points_type[ 'name' ] ); ?>"/> |
|
| 271 | 271 | </p> |
| 272 | 272 | <p> |
| 273 | 273 | <label |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | <input class="widefat" type="text" |
| 276 | 276 | id="points-prefix-<?php echo esc_attr( $slug ); ?>" |
| 277 | 277 | name="points-prefix" |
| 278 | - value="<?php echo esc_attr( $points_type['prefix'] ); ?>"/> |
|
| 278 | + value="<?php echo esc_attr( $points_type[ 'prefix' ] ); ?>"/> |
|
| 279 | 279 | </p> |
| 280 | 280 | <p> |
| 281 | 281 | <label |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | <input class="widefat" type="text" |
| 284 | 284 | id="points-suffix-<?php echo esc_attr( $slug ); ?>" |
| 285 | 285 | name="points-suffix" |
| 286 | - value="<?php echo esc_attr( $points_type['suffix'] ); ?>"/> |
|
| 286 | + value="<?php echo esc_attr( $points_type[ 'suffix' ] ); ?>"/> |
|
| 287 | 287 | </p> |
| 288 | 288 | |
| 289 | 289 | <?php |
@@ -428,13 +428,13 @@ discard block |
||
| 428 | 428 | */ |
| 429 | 429 | public function display_event_meta_box( $points_type, $meta_box ) { |
| 430 | 430 | |
| 431 | - $event_slug = $meta_box['args']['slug']; |
|
| 431 | + $event_slug = $meta_box[ 'args' ][ 'slug' ]; |
|
| 432 | 432 | |
| 433 | 433 | $data = array(); |
| 434 | 434 | |
| 435 | 435 | foreach ( $this->reaction_store->get_reactions_to_event( $event_slug ) as $id => $reaction ) { |
| 436 | 436 | if ( $reaction->get_meta( 'points_type' ) === $this->current_points_type ) { |
| 437 | - $data[] = WordPoints_Admin_Ajax_Hooks::prepare_hook_reaction( |
|
| 437 | + $data[ ] = WordPoints_Admin_Ajax_Hooks::prepare_hook_reaction( |
|
| 438 | 438 | $reaction |
| 439 | 439 | ); |
| 440 | 440 | } |
@@ -444,13 +444,13 @@ discard block |
||
| 444 | 444 | |
| 445 | 445 | foreach ( $this->event_args->get_children( $event_slug ) as $slug => $arg ) { |
| 446 | 446 | |
| 447 | - $event_data['args'][ $slug ] = array( |
|
| 447 | + $event_data[ 'args' ][ $slug ] = array( |
|
| 448 | 448 | 'slug' => $slug, |
| 449 | 449 | ); |
| 450 | 450 | |
| 451 | 451 | if ( $arg instanceof WordPoints_Hook_ArgI ) { |
| 452 | - $event_data['args'][ $slug ]['title'] = $arg->get_title(); |
|
| 453 | - $event_data['args'][ $slug ]['is_stateful'] = $arg->is_stateful(); |
|
| 452 | + $event_data[ 'args' ][ $slug ][ 'title' ] = $arg->get_title(); |
|
| 453 | + $event_data[ 'args' ][ $slug ][ 'is_stateful' ] = $arg->is_stateful(); |
|
| 454 | 454 | } |
| 455 | 455 | } |
| 456 | 456 | |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | |
| 464 | 464 | <div class="wordpoints-hook-reaction-group-container"> |
| 465 | 465 | <p class="description wordpoints-hook-reaction-group-description"> |
| 466 | - <?php echo esc_html( $meta_box['args']['event']->get_description() ); ?> |
|
| 466 | + <?php echo esc_html( $meta_box[ 'args' ][ 'event' ]->get_description() ); ?> |
|
| 467 | 467 | </p> |
| 468 | 468 | |
| 469 | 469 | <div class="wordpoints-hook-reaction-group" |
@@ -505,10 +505,10 @@ discard block |
||
| 505 | 505 | $tabs = array(); |
| 506 | 506 | |
| 507 | 507 | foreach ( $points_types as $slug => $settings ) { |
| 508 | - $tabs[ $slug ] = $settings['name']; |
|
| 508 | + $tabs[ $slug ] = $settings[ 'name' ]; |
|
| 509 | 509 | } |
| 510 | 510 | |
| 511 | - $tabs['add-new'] = __( 'Add New', 'wordpoints' ); |
|
| 511 | + $tabs[ 'add-new' ] = __( 'Add New', 'wordpoints' ); |
|
| 512 | 512 | |
| 513 | 513 | $tab = wordpoints_admin_get_current_tab( $tabs ); |
| 514 | 514 | |
@@ -532,15 +532,15 @@ discard block |
||
| 532 | 532 | return; |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | - if ( isset( $_POST['save-points-type'] ) ) { // WPCS: CSRF OK |
|
| 535 | + if ( isset( $_POST[ 'save-points-type' ] ) ) { // WPCS: CSRF OK |
|
| 536 | 536 | |
| 537 | - if ( ! empty( $_POST['add_new'] ) ) { // WPCS: CSRF OK |
|
| 537 | + if ( ! empty( $_POST[ 'add_new' ] ) ) { // WPCS: CSRF OK |
|
| 538 | 538 | $this->add_points_type(); |
| 539 | 539 | } else { |
| 540 | 540 | $this->update_points_type(); |
| 541 | 541 | } |
| 542 | 542 | |
| 543 | - } elseif ( ! empty( $_POST['delete-points-type'] ) ) { // WPCS: CSRF OK |
|
| 543 | + } elseif ( ! empty( $_POST[ 'delete-points-type' ] ) ) { // WPCS: CSRF OK |
|
| 544 | 544 | |
| 545 | 545 | $this->delete_points_type(); |
| 546 | 546 | } |
@@ -557,21 +557,21 @@ discard block |
||
| 557 | 557 | |
| 558 | 558 | $settings = array(); |
| 559 | 559 | |
| 560 | - if ( isset( $_POST['points-name'] ) ) { // WPCS: CSRF OK |
|
| 561 | - $settings['name'] = trim( |
|
| 562 | - sanitize_text_field( wp_unslash( $_POST['points-name'] ) ) // WPCS: CSRF OK |
|
| 560 | + if ( isset( $_POST[ 'points-name' ] ) ) { // WPCS: CSRF OK |
|
| 561 | + $settings[ 'name' ] = trim( |
|
| 562 | + sanitize_text_field( wp_unslash( $_POST[ 'points-name' ] ) ) // WPCS: CSRF OK |
|
| 563 | 563 | ); |
| 564 | 564 | } |
| 565 | 565 | |
| 566 | - if ( isset( $_POST['points-prefix'] ) ) { // WPCS: CSRF OK |
|
| 567 | - $settings['prefix'] = ltrim( |
|
| 568 | - sanitize_text_field( wp_unslash( $_POST['points-prefix'] ) ) // WPCS: CSRF OK |
|
| 566 | + if ( isset( $_POST[ 'points-prefix' ] ) ) { // WPCS: CSRF OK |
|
| 567 | + $settings[ 'prefix' ] = ltrim( |
|
| 568 | + sanitize_text_field( wp_unslash( $_POST[ 'points-prefix' ] ) ) // WPCS: CSRF OK |
|
| 569 | 569 | ); |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | - if ( isset( $_POST['points-suffix'] ) ) { // WPCS: CSRF OK |
|
| 573 | - $settings['suffix'] = rtrim( |
|
| 574 | - sanitize_text_field( wp_unslash( $_POST['points-suffix'] ) ) // WPCS: CSRF OK |
|
| 572 | + if ( isset( $_POST[ 'points-suffix' ] ) ) { // WPCS: CSRF OK |
|
| 573 | + $settings[ 'suffix' ] = rtrim( |
|
| 574 | + sanitize_text_field( wp_unslash( $_POST[ 'points-suffix' ] ) ) // WPCS: CSRF OK |
|
| 575 | 575 | ); |
| 576 | 576 | } |
| 577 | 577 | |
@@ -592,14 +592,14 @@ discard block |
||
| 592 | 592 | , array( 'points-slug' ) |
| 593 | 593 | , 'post' |
| 594 | 594 | ) |
| 595 | - || ! isset( $_POST['points-slug'] ) |
|
| 595 | + || ! isset( $_POST[ 'points-slug' ] ) |
|
| 596 | 596 | ) { |
| 597 | 597 | return; |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | $settings = $this->get_points_type_settings(); |
| 601 | 601 | |
| 602 | - if ( empty( $settings['name'] ) ) { |
|
| 602 | + if ( empty( $settings[ 'name' ] ) ) { |
|
| 603 | 603 | |
| 604 | 604 | add_settings_error( |
| 605 | 605 | 'points-name' |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | return; |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | - $points_type = sanitize_key( $_POST['points-slug'] ); |
|
| 613 | + $points_type = sanitize_key( $_POST[ 'points-slug' ] ); |
|
| 614 | 614 | |
| 615 | 615 | $old_settings = wordpoints_get_points_type( $points_type ); |
| 616 | 616 | |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | |
| 681 | 681 | } else { |
| 682 | 682 | |
| 683 | - $_GET['tab'] = $slug; |
|
| 683 | + $_GET[ 'tab' ] = $slug; |
|
| 684 | 684 | |
| 685 | 685 | add_settings_error( |
| 686 | 686 | '' |
@@ -705,12 +705,12 @@ discard block |
||
| 705 | 705 | , array( 'points-slug' ) |
| 706 | 706 | , 'post' |
| 707 | 707 | ) |
| 708 | - && isset( $_POST['points-slug'] ) |
|
| 708 | + && isset( $_POST[ 'points-slug' ] ) |
|
| 709 | 709 | ) { |
| 710 | 710 | |
| 711 | 711 | if ( |
| 712 | 712 | wordpoints_delete_points_type( |
| 713 | - sanitize_key( $_POST['points-slug'] ) |
|
| 713 | + sanitize_key( $_POST[ 'points-slug' ] ) |
|
| 714 | 714 | ) |
| 715 | 715 | ) { |
| 716 | 716 | |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | |
| 755 | 755 | if ( isset( $this->current_points_type ) ) { |
| 756 | 756 | $points_type = wordpoints_get_points_type( $this->current_points_type ); |
| 757 | - $points_type['slug'] = $this->current_points_type; |
|
| 757 | + $points_type[ 'slug' ] = $this->current_points_type; |
|
| 758 | 758 | } else { |
| 759 | 759 | $points_type = false; |
| 760 | 760 | } |
@@ -211,9 +211,12 @@ discard block |
||
| 211 | 211 | <p> |
| 212 | 212 | <?php if ( $slug ) : ?> |
| 213 | 213 | <?php esc_html_e( 'Changes to this points type’s settings will affect all sites on this network.', 'wordpoints' ) ?> |
| 214 | - <?php else : ?> |
|
| 214 | + <?php else { |
|
| 215 | + : ?> |
|
| 215 | 216 | <?php esc_html_e( 'The new points type will be global across all sites on this network.', 'wordpoints' ) ?> |
| 216 | - <?php endif; ?> |
|
| 217 | + <?php endif; |
|
| 218 | +} |
|
| 219 | +?> |
|
| 217 | 220 | </p> |
| 218 | 221 | </div> |
| 219 | 222 | <?php endif; ?> |
@@ -532,15 +535,18 @@ discard block |
||
| 532 | 535 | return; |
| 533 | 536 | } |
| 534 | 537 | |
| 535 | - if ( isset( $_POST['save-points-type'] ) ) { // WPCS: CSRF OK |
|
| 538 | + if ( isset( $_POST['save-points-type'] ) ) { |
|
| 539 | +// WPCS: CSRF OK |
|
| 536 | 540 | |
| 537 | - if ( ! empty( $_POST['add_new'] ) ) { // WPCS: CSRF OK |
|
| 541 | + if ( ! empty( $_POST['add_new'] ) ) { |
|
| 542 | +// WPCS: CSRF OK |
|
| 538 | 543 | $this->add_points_type(); |
| 539 | 544 | } else { |
| 540 | 545 | $this->update_points_type(); |
| 541 | 546 | } |
| 542 | 547 | |
| 543 | - } elseif ( ! empty( $_POST['delete-points-type'] ) ) { // WPCS: CSRF OK |
|
| 548 | + } elseif ( ! empty( $_POST['delete-points-type'] ) ) { |
|
| 549 | +// WPCS: CSRF OK |
|
| 544 | 550 | |
| 545 | 551 | $this->delete_points_type(); |
| 546 | 552 | } |
@@ -557,19 +563,22 @@ discard block |
||
| 557 | 563 | |
| 558 | 564 | $settings = array(); |
| 559 | 565 | |
| 560 | - if ( isset( $_POST['points-name'] ) ) { // WPCS: CSRF OK |
|
| 566 | + if ( isset( $_POST['points-name'] ) ) { |
|
| 567 | +// WPCS: CSRF OK |
|
| 561 | 568 | $settings['name'] = trim( |
| 562 | 569 | sanitize_text_field( wp_unslash( $_POST['points-name'] ) ) // WPCS: CSRF OK |
| 563 | 570 | ); |
| 564 | 571 | } |
| 565 | 572 | |
| 566 | - if ( isset( $_POST['points-prefix'] ) ) { // WPCS: CSRF OK |
|
| 573 | + if ( isset( $_POST['points-prefix'] ) ) { |
|
| 574 | +// WPCS: CSRF OK |
|
| 567 | 575 | $settings['prefix'] = ltrim( |
| 568 | 576 | sanitize_text_field( wp_unslash( $_POST['points-prefix'] ) ) // WPCS: CSRF OK |
| 569 | 577 | ); |
| 570 | 578 | } |
| 571 | 579 | |
| 572 | - if ( isset( $_POST['points-suffix'] ) ) { // WPCS: CSRF OK |
|
| 580 | + if ( isset( $_POST['points-suffix'] ) ) { |
|
| 581 | +// WPCS: CSRF OK |
|
| 573 | 582 | $settings['suffix'] = rtrim( |
| 574 | 583 | sanitize_text_field( wp_unslash( $_POST['points-suffix'] ) ) // WPCS: CSRF OK |
| 575 | 584 | ); |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | return; |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -if ( ! isset( $_POST['hook-id'] ) ) { |
|
| 14 | +if ( ! isset( $_POST[ 'hook-id' ] ) ) { |
|
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -$hook_id = sanitize_key( $_POST['hook-id'] ); |
|
| 18 | +$hook_id = sanitize_key( $_POST[ 'hook-id' ] ); |
|
| 19 | 19 | |
| 20 | 20 | check_admin_referer( "save-delete-hook-{$hook_id}" ); |
| 21 | 21 | |
@@ -25,12 +25,12 @@ discard block |
||
| 25 | 25 | WordPoints_Points_Hooks::set_network_mode( true ); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | -if ( ! isset( $_POST['points_type'], $_POST['id_base'] ) ) { |
|
| 28 | +if ( ! isset( $_POST[ 'points_type' ], $_POST[ 'id_base' ] ) ) { |
|
| 29 | 29 | return; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | -$points_type_id = sanitize_key( $_POST['points_type'] ); |
|
| 33 | -$id_base = sanitize_key( $_POST['id_base'] ); |
|
| 32 | +$points_type_id = sanitize_key( $_POST[ 'points_type' ] ); |
|
| 33 | +$id_base = sanitize_key( $_POST[ 'id_base' ] ); |
|
| 34 | 34 | |
| 35 | 35 | // These are the hooks grouped by points type. |
| 36 | 36 | $points_types_hooks = WordPoints_Points_Hooks::get_points_types_hooks(); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | $hook = WordPoints_Points_Hooks::get_handler_by_id_base( $id_base ); |
| 49 | 49 | |
| 50 | -if ( ! empty( $_POST['removehook'] ) ) { |
|
| 50 | +if ( ! empty( $_POST[ 'removehook' ] ) ) { |
|
| 51 | 51 | |
| 52 | 52 | // - We are deleting an instance of a hook. |
| 53 | 53 | |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | $hook->delete_callback( $hook_id ); |
| 65 | 65 | |
| 66 | -} elseif ( ! empty( $_POST['savehook'] ) ) { |
|
| 66 | +} elseif ( ! empty( $_POST[ 'savehook' ] ) ) { |
|
| 67 | 67 | |
| 68 | 68 | // - We are saving an instance of a hook. |
| 69 | 69 | |
| 70 | - $number = isset( $_POST['multi_number'] ) ? (int) $_POST['multi_number'] : ''; |
|
| 70 | + $number = isset( $_POST[ 'multi_number' ] ) ? (int) $_POST[ 'multi_number' ] : ''; |
|
| 71 | 71 | |
| 72 | 72 | if ( $number ) { |
| 73 | 73 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | // Add hook it to this points type. |
| 102 | 102 | if ( ! in_array( $hook_id, $points_type_hooks, true ) ) { |
| 103 | 103 | |
| 104 | - $points_type_hooks[] = $hook_id; |
|
| 104 | + $points_type_hooks[ ] = $hook_id; |
|
| 105 | 105 | $points_types_hooks[ $points_type_id ] = $points_type_hooks; |
| 106 | 106 | } |
| 107 | 107 | |
@@ -41,11 +41,11 @@ |
||
| 41 | 41 | $accessibility_mode = get_user_setting( 'wordpoints_points_hooks_access' ); |
| 42 | 42 | |
| 43 | 43 | if ( |
| 44 | - isset( $_GET['accessibility-mode'], $_GET['wordpoints-accessiblity-nonce'] ) |
|
| 44 | + isset( $_GET[ 'accessibility-mode' ], $_GET[ 'wordpoints-accessiblity-nonce' ] ) |
|
| 45 | 45 | && wordpoints_verify_nonce( 'wordpoints-accessiblity-nonce', 'wordpoints_points_hooks_accessiblity' ) |
| 46 | 46 | ) { |
| 47 | 47 | |
| 48 | - $accessibility_mode = ( 'on' === sanitize_key( $_GET['accessibility-mode'] ) ) ? 'on' : 'off'; |
|
| 48 | + $accessibility_mode = ( 'on' === sanitize_key( $_GET[ 'accessibility-mode' ] ) ) ? 'on' : 'off'; |
|
| 49 | 49 | set_user_setting( 'wordpoints_points_hooks_access', $accessibility_mode ); |
| 50 | 50 | } |
| 51 | 51 | |