@@ -20,7 +20,7 @@ |
||
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | // If we're not running a module check, let the maintenance message show. |
| 23 | -if ( ! isset( $_GET['wordpoints_module_check'], $_GET['check_module'] ) ) { // WPCS: CSRF OK. |
|
| 23 | +if ( ! isset( $_GET[ 'wordpoints_module_check' ], $_GET[ 'check_module' ] ) ) { // WPCS: CSRF OK. |
|
| 24 | 24 | return; |
| 25 | 25 | } |
| 26 | 26 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | private function verify_request( $action ) { |
| 317 | 317 | |
| 318 | 318 | if ( |
| 319 | - empty( $_POST['nonce'] ) |
|
| 319 | + empty( $_POST[ 'nonce' ] ) |
|
| 320 | 320 | || ! wordpoints_verify_nonce( 'nonce', $action, null, 'post' ) |
| 321 | 321 | ) { |
| 322 | 322 | wp_send_json_error( |
@@ -334,11 +334,11 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | protected function get_reaction_store() { |
| 336 | 336 | |
| 337 | - if ( ! isset( $_POST['reaction_store'] ) ) { // WPCS: CSRF OK. |
|
| 337 | + if ( ! isset( $_POST[ 'reaction_store' ] ) ) { // WPCS: CSRF OK. |
|
| 338 | 338 | $this->unexpected_error( 'reaction_store' ); |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | - $reactor_slug = sanitize_key( $_POST['reaction_store'] ); // WPCS: CSRF OK. |
|
| 341 | + $reactor_slug = sanitize_key( $_POST[ 'reaction_store' ] ); // WPCS: CSRF OK. |
|
| 342 | 342 | |
| 343 | 343 | $reaction_store = wordpoints_hooks()->get_reaction_store( $reactor_slug ); |
| 344 | 344 | |
@@ -361,12 +361,12 @@ discard block |
||
| 361 | 361 | */ |
| 362 | 362 | protected function get_reaction() { |
| 363 | 363 | |
| 364 | - if ( ! isset( $_POST['id'] ) ) { // WPCS: CSRF OK. |
|
| 364 | + if ( ! isset( $_POST[ 'id' ] ) ) { // WPCS: CSRF OK. |
|
| 365 | 365 | $this->unexpected_error( 'id' ); |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | $reaction = $this->reaction_store->get_reaction( |
| 369 | - wordpoints_int( $_POST['id'] ) // WPCS: CSRF OK. |
|
| 369 | + wordpoints_int( $_POST[ 'id' ] ) // WPCS: CSRF OK. |
|
| 370 | 370 | ); |
| 371 | 371 | |
| 372 | 372 | if ( ! $reaction ) { |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | |
| 388 | 388 | $data = wp_unslash( $_POST ); // WPCS: CSRF OK. |
| 389 | 389 | |
| 390 | - unset( $data['id'], $data['action'], $data['nonce'], $data['reaction_store'] ); |
|
| 390 | + unset( $data[ 'id' ], $data[ 'action' ], $data[ 'nonce' ], $data[ 'reaction_store' ] ); |
|
| 391 | 391 | |
| 392 | 392 | return $data; |
| 393 | 393 | } |
@@ -13,15 +13,15 @@ |
||
| 13 | 13 | |
| 14 | 14 | if ( |
| 15 | 15 | 'components' !== wordpoints_admin_get_current_tab() |
| 16 | - || ! isset( $_POST['wordpoints_component'], $_POST['wordpoints_component_action'], $_POST['_wpnonce'] ) |
|
| 16 | + || ! isset( $_POST[ 'wordpoints_component' ], $_POST[ 'wordpoints_component_action' ], $_POST[ '_wpnonce' ] ) |
|
| 17 | 17 | ) { |
| 18 | 18 | return; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $components = WordPoints_Components::instance(); |
| 22 | -$component = sanitize_key( $_POST['wordpoints_component'] ); |
|
| 22 | +$component = sanitize_key( $_POST[ 'wordpoints_component' ] ); |
|
| 23 | 23 | |
| 24 | -$action = sanitize_key( $_POST['wordpoints_component_action'] ); |
|
| 24 | +$action = sanitize_key( $_POST[ 'wordpoints_component_action' ] ); |
|
| 25 | 25 | |
| 26 | 26 | check_admin_referer( "wordpoints_{$action}_component-{$component}" ); |
| 27 | 27 | |
@@ -12,13 +12,13 @@ |
||
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | if ( |
| 15 | - isset( $_POST['wordpoints_settings_nonce'], $_POST['excluded_users'] ) |
|
| 15 | + isset( $_POST[ 'wordpoints_settings_nonce' ], $_POST[ 'excluded_users' ] ) |
|
| 16 | 16 | && wordpoints_verify_nonce( 'wordpoints_settings_nonce', 'wordpoints_settings_submit', null, 'post' ) |
| 17 | 17 | ) { |
| 18 | 18 | |
| 19 | 19 | // - The form has been submitted. |
| 20 | 20 | |
| 21 | - $excluded_users = preg_replace( '/\s/', '', sanitize_text_field( wp_unslash( $_POST['excluded_users'] ) ) ); |
|
| 21 | + $excluded_users = preg_replace( '/\s/', '', sanitize_text_field( wp_unslash( $_POST[ 'excluded_users' ] ) ) ); |
|
| 22 | 22 | |
| 23 | 23 | if ( ! empty( $excluded_users ) ) { |
| 24 | 24 | |
@@ -17,13 +17,13 @@ discard block |
||
| 17 | 17 | // Show messages and errors. |
| 18 | 18 | // |
| 19 | 19 | |
| 20 | -if ( isset( $_GET['wordpoints_component'], $_GET['_wpnonce'] ) && $wordpoints_components->is_registered( sanitize_key( $_GET['wordpoints_component'] ) ) ) { // WPCS: CSRF OK. |
|
| 20 | +if ( isset( $_GET[ 'wordpoints_component' ], $_GET[ '_wpnonce' ] ) && $wordpoints_components->is_registered( sanitize_key( $_GET[ 'wordpoints_component' ] ) ) ) { // WPCS: CSRF OK. |
|
| 21 | 21 | |
| 22 | - $component = sanitize_key( $_GET['wordpoints_component'] ); |
|
| 22 | + $component = sanitize_key( $_GET[ 'wordpoints_component' ] ); |
|
| 23 | 23 | |
| 24 | - if ( isset( $_GET['message'] ) && wordpoints_verify_nonce( '_wpnonce', "wordpoints_component_message-{$component}" ) ) { |
|
| 24 | + if ( isset( $_GET[ 'message' ] ) && wordpoints_verify_nonce( '_wpnonce', "wordpoints_component_message-{$component}" ) ) { |
|
| 25 | 25 | |
| 26 | - switch ( (int) $_GET['message'] ) { |
|
| 26 | + switch ( (int) $_GET[ 'message' ] ) { |
|
| 27 | 27 | |
| 28 | 28 | case 1: |
| 29 | 29 | if ( $wordpoints_components->is_active( $component ) ) { |
@@ -43,15 +43,15 @@ discard block |
||
| 43 | 43 | if ( isset( $message ) ) { |
| 44 | 44 | |
| 45 | 45 | wordpoints_show_admin_message( |
| 46 | - esc_html( sprintf( $message, $components[ $component ]['name'] ) ) |
|
| 46 | + esc_html( sprintf( $message, $components[ $component ][ 'name' ] ) ) |
|
| 47 | 47 | , 'success' |
| 48 | 48 | , array( 'dismissible' => true ) |
| 49 | 49 | ); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - } elseif ( isset( $_GET['error'] ) && wordpoints_verify_nonce( '_wpnonce', "wordpoints_component_error-{$component}" ) ) { |
|
| 52 | + } elseif ( isset( $_GET[ 'error' ] ) && wordpoints_verify_nonce( '_wpnonce', "wordpoints_component_error-{$component}" ) ) { |
|
| 53 | 53 | |
| 54 | - switch ( (int) $_GET['error'] ) { |
|
| 54 | + switch ( (int) $_GET[ 'error' ] ) { |
|
| 55 | 55 | |
| 56 | 56 | case 1: |
| 57 | 57 | if ( ! $wordpoints_components->is_active( $component ) ) { |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | if ( isset( $error ) ) { |
| 72 | 72 | |
| 73 | 73 | wordpoints_show_admin_error( |
| 74 | - esc_html( sprintf( $error, $components[ $component ]['name'] ) ) |
|
| 74 | + esc_html( sprintf( $error, $components[ $component ][ 'name' ] ) ) |
|
| 75 | 75 | , array( 'dismissible' => true ) |
| 76 | 76 | ); |
| 77 | 77 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | <?php |
| 111 | 111 | |
| 112 | - if ( $wordpoints_components->is_active( $component['slug'] ) ) { |
|
| 112 | + if ( $wordpoints_components->is_active( $component[ 'slug' ] ) ) { |
|
| 113 | 113 | |
| 114 | 114 | $action = 'deactivate'; |
| 115 | 115 | $button = __( 'Deactivate', 'wordpoints' ); |
@@ -124,38 +124,38 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | <tr> |
| 126 | 126 | <td> |
| 127 | - <?php if ( '' !== $component['component_uri'] ) : ?> |
|
| 128 | - <a href="<?php echo esc_url( $component['component_uri'] ); ?>"> |
|
| 127 | + <?php if ( '' !== $component[ 'component_uri' ] ) : ?> |
|
| 128 | + <a href="<?php echo esc_url( $component[ 'component_uri' ] ); ?>"> |
|
| 129 | 129 | <?php endif; ?> |
| 130 | - <?php echo esc_html( $component['name'] ); ?> |
|
| 131 | - <?php if ( '' !== $component['component_uri'] ) : ?> |
|
| 130 | + <?php echo esc_html( $component[ 'name' ] ); ?> |
|
| 131 | + <?php if ( '' !== $component[ 'component_uri' ] ) : ?> |
|
| 132 | 132 | </a> |
| 133 | 133 | <?php endif; ?> |
| 134 | 134 | </td> |
| 135 | 135 | <td> |
| 136 | - <?php echo wp_kses( $component['description'], 'wordpoints_component_description' ); ?> |
|
| 137 | - <?php if ( '' !== $component['author'] ) : ?> |
|
| 136 | + <?php echo wp_kses( $component[ 'description' ], 'wordpoints_component_description' ); ?> |
|
| 137 | + <?php if ( '' !== $component[ 'author' ] ) : ?> |
|
| 138 | 138 | | |
| 139 | 139 | <?php |
| 140 | 140 | // translators: Author name. |
| 141 | 141 | echo esc_html( sprintf( __( 'By %s', 'wordpoints' ), '' /* This space intentionally left blank */ ) ); |
| 142 | 142 | ?> |
| 143 | - <?php if ( '' !== $component['author_uri'] ) : ?> |
|
| 144 | - <a href="<?php echo esc_url( $component['author_uri'] ); ?>"> |
|
| 143 | + <?php if ( '' !== $component[ 'author_uri' ] ) : ?> |
|
| 144 | + <a href="<?php echo esc_url( $component[ 'author_uri' ] ); ?>"> |
|
| 145 | 145 | <?php endif; ?> |
| 146 | - <?php echo esc_html( $component['author'] ); ?> |
|
| 147 | - <?php if ( '' !== $component['author_uri'] ) : ?> |
|
| 146 | + <?php echo esc_html( $component[ 'author' ] ); ?> |
|
| 147 | + <?php if ( '' !== $component[ 'author_uri' ] ) : ?> |
|
| 148 | 148 | </a> |
| 149 | 149 | <?php endif; ?> |
| 150 | 150 | <?php endif; ?> |
| 151 | 151 | </td> |
| 152 | - <td><?php echo esc_html( $component['version'] ); ?></td> |
|
| 152 | + <td><?php echo esc_html( $component[ 'version' ] ); ?></td> |
|
| 153 | 153 | <td> |
| 154 | - <form method="post" name="wordpoints_components_form_<?php echo esc_attr( $component['slug'] ); ?>"> |
|
| 154 | + <form method="post" name="wordpoints_components_form_<?php echo esc_attr( $component[ 'slug' ] ); ?>"> |
|
| 155 | 155 | <input type="hidden" name="wordpoints_component_action" value="<?php echo esc_attr( $action ); ?>" /> |
| 156 | - <input type="hidden" name="wordpoints_component" value="<?php echo esc_attr( $component['slug'] ); ?>" /> |
|
| 157 | - <?php wp_nonce_field( "wordpoints_{$action}_component-{$component['slug']}" ); ?> |
|
| 158 | - <?php submit_button( $button, "secondary wordpoints-component-{$action}", "wordpoints-component-{$action}_{$component['slug']}", false ); ?> |
|
| 156 | + <input type="hidden" name="wordpoints_component" value="<?php echo esc_attr( $component[ 'slug' ] ); ?>" /> |
|
| 157 | + <?php wp_nonce_field( "wordpoints_{$action}_component-{$component[ 'slug' ]}" ); ?> |
|
| 158 | + <?php submit_button( $button, "secondary wordpoints-component-{$action}", "wordpoints-component-{$action}_{$component[ 'slug' ]}", false ); ?> |
|
| 159 | 159 | </form> |
| 160 | 160 | </td> |
| 161 | 161 | </tr> |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | // The current user needs to be set dynamically, since it can change at times. |
| 91 | 91 | if ( 'current_user' === $query_slug ) { |
| 92 | - $args['user_id'] = get_current_user_id(); |
|
| 92 | + $args[ 'user_id' ] = get_current_user_id(); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -137,12 +137,12 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | $query_data = WordPoints_Points_Log_Queries::get_query_data( $query_slug ); |
| 139 | 139 | |
| 140 | - if ( $query_data['cache_queries'] ) { |
|
| 140 | + if ( $query_data[ 'cache_queries' ] ) { |
|
| 141 | 141 | |
| 142 | 142 | $query->prime_cache( |
| 143 | - $query_data['cache_key'] |
|
| 143 | + $query_data[ 'cache_key' ] |
|
| 144 | 144 | , null |
| 145 | - , $query_data['network_wide'] |
|
| 145 | + , $query_data[ 'network_wide' ] |
|
| 146 | 146 | ); |
| 147 | 147 | } |
| 148 | 148 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | $args = array_merge( $defaults, $args ); |
| 198 | 198 | |
| 199 | - if ( ! $args['datatable'] ) { |
|
| 199 | + if ( ! $args[ 'datatable' ] ) { |
|
| 200 | 200 | |
| 201 | 201 | _deprecated_argument( |
| 202 | 202 | __FUNCTION__ |
@@ -204,13 +204,13 @@ discard block |
||
| 204 | 204 | , '$args["datatable"] is deprecated and should no longer be used. Use $args["paginate"] instead.' |
| 205 | 205 | ); |
| 206 | 206 | |
| 207 | - $args['paginate'] = false; |
|
| 207 | + $args[ 'paginate' ] = false; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | $view = wordpoints_component( 'points' ) |
| 211 | 211 | ->get_sub_app( 'logs' ) |
| 212 | 212 | ->get_sub_app( 'views' ) |
| 213 | - ->get( $args['view'], array( $logs_query, $args ) ); |
|
| 213 | + ->get( $args[ 'view' ], array( $logs_query, $args ) ); |
|
| 214 | 214 | |
| 215 | 215 | if ( ! $view instanceof WordPoints_Points_Logs_View ) { |
| 216 | 216 | return; |
@@ -284,10 +284,10 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | function wordpoints_points_logs_profile_edit( $text, $points, $points_type, $user_id, $log_type, $meta ) { |
| 286 | 286 | |
| 287 | - $user_name = sanitize_user_field( 'display_name', get_userdata( $meta['user_id'] )->display_name, $meta['user_id'], 'display' ); |
|
| 287 | + $user_name = sanitize_user_field( 'display_name', get_userdata( $meta[ 'user_id' ] )->display_name, $meta[ 'user_id' ], 'display' ); |
|
| 288 | 288 | |
| 289 | 289 | // translators: 1. User name; 2. Reason given. |
| 290 | - return sprintf( _x( 'Points adjusted by %1$s. Reason: %2$s', 'points log description', 'wordpoints' ), $user_name, esc_html( $meta['reason'] ) ); |
|
| 290 | + return sprintf( _x( 'Points adjusted by %1$s. Reason: %2$s', 'points log description', 'wordpoints' ), $user_name, esc_html( $meta[ 'reason' ] ) ); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | */ |
| 300 | 300 | function wordpoints_points_logs_comment_disapprove( $text, $points, $points_type, $user_id, $log_type, $meta ) { |
| 301 | 301 | |
| 302 | - switch ( $meta['status'] ) { |
|
| 302 | + switch ( $meta[ 'status' ] ) { |
|
| 303 | 303 | |
| 304 | 304 | case 'spam': |
| 305 | 305 | $text = _x( 'Comment marked as spam.', 'points log description', 'wordpoints' ); |
@@ -325,9 +325,9 @@ discard block |
||
| 325 | 325 | */ |
| 326 | 326 | function wordpoints_points_logs_post_delete( $text, $points, $points_type, $user_id, $log_type, $meta ) { |
| 327 | 327 | |
| 328 | - if ( isset( $meta['post_type'] ) ) { |
|
| 328 | + if ( isset( $meta[ 'post_type' ] ) ) { |
|
| 329 | 329 | |
| 330 | - $post_type = get_post_type_object( $meta['post_type'] ); |
|
| 330 | + $post_type = get_post_type_object( $meta[ 'post_type' ] ); |
|
| 331 | 331 | |
| 332 | 332 | if ( ! is_null( $post_type ) ) { |
| 333 | 333 | |
@@ -389,18 +389,18 @@ discard block |
||
| 389 | 389 | '%user_id%', |
| 390 | 390 | ); |
| 391 | 391 | |
| 392 | - if ( empty( $args['points_type'] ) ) { |
|
| 392 | + if ( empty( $args[ 'points_type' ] ) ) { |
|
| 393 | 393 | $points_types = array_keys( wordpoints_get_points_types() ); |
| 394 | 394 | } else { |
| 395 | - $points_types = (array) $args['points_type']; |
|
| 395 | + $points_types = (array) $args[ 'points_type' ]; |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | foreach ( $points_types as $points_type ) { |
| 399 | 399 | foreach ( WordPoints_Points_Log_Queries::get_queries() as $query ) { |
| 400 | 400 | |
| 401 | - if ( ! empty( $query['cache_key'] ) ) { |
|
| 401 | + if ( ! empty( $query[ 'cache_key' ] ) ) { |
|
| 402 | 402 | |
| 403 | - if ( $query['network_wide'] ) { |
|
| 403 | + if ( $query[ 'network_wide' ] ) { |
|
| 404 | 404 | $group = 'wordpoints_network_points_logs_query'; |
| 405 | 405 | } else { |
| 406 | 406 | $group = 'wordpoints_points_logs_query'; |
@@ -408,11 +408,11 @@ discard block |
||
| 408 | 408 | |
| 409 | 409 | $replace = array( |
| 410 | 410 | $points_type, |
| 411 | - $args['user_id'], |
|
| 411 | + $args[ 'user_id' ], |
|
| 412 | 412 | ); |
| 413 | 413 | |
| 414 | 414 | wp_cache_delete( |
| 415 | - str_replace( $find, $replace, $query['cache_key'] ) |
|
| 415 | + str_replace( $find, $replace, $query[ 'cache_key' ] ) |
|
| 416 | 416 | , $group |
| 417 | 417 | ); |
| 418 | 418 | } |
@@ -184,13 +184,13 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | $instance = array_merge( $this->defaults, $instance ); |
| 186 | 186 | |
| 187 | - if ( ! $this->is_matching_post_type( $post->post_type, $instance['post_type'] ) ) { |
|
| 187 | + if ( ! $this->is_matching_post_type( $post->post_type, $instance[ 'post_type' ] ) ) { |
|
| 188 | 188 | continue; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | $points_type = $this->points_type( $number ); |
| 192 | 192 | |
| 193 | - wordpoints_subtract_points( $comment->user_id, $instance['points'], $points_type, 'comment_disapprove', array( 'status' => $new_status ) ); |
|
| 193 | + wordpoints_subtract_points( $comment->user_id, $instance[ 'points' ], $points_type, 'comment_disapprove', array( 'status' => $new_status ) ); |
|
| 194 | 194 | |
| 195 | 195 | update_comment_meta( |
| 196 | 196 | $comment->comment_ID |
@@ -375,14 +375,14 @@ discard block |
||
| 375 | 375 | $instance = array_merge( $this->defaults, $instance ); |
| 376 | 376 | |
| 377 | 377 | if ( |
| 378 | - $this->is_matching_post_type( $post->post_type, $instance['post_type'] ) |
|
| 378 | + $this->is_matching_post_type( $post->post_type, $instance[ 'post_type' ] ) |
|
| 379 | 379 | && 'auto-draft' !== $post->post_status |
| 380 | 380 | && __( 'Auto Draft', 'default' ) !== $post->post_title |
| 381 | 381 | ) { |
| 382 | 382 | |
| 383 | 383 | wordpoints_alter_points( |
| 384 | 384 | $post->post_author |
| 385 | - , -$instance['points'] |
|
| 385 | + , -$instance[ 'points' ] |
|
| 386 | 386 | , $this->points_type( $number ) |
| 387 | 387 | , 'post_delete' |
| 388 | 388 | , array( 'post_title' => $post->post_title, 'post_type' => $post->post_type ) |
@@ -85,15 +85,15 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | if ( |
| 87 | 87 | ! isset( $last_visit[ $points_type ] ) |
| 88 | - || (int) ( $last_visit[ $points_type ] / $instance['period'] ) < (int) ( $now / $instance['period'] ) |
|
| 88 | + || (int) ( $last_visit[ $points_type ] / $instance[ 'period' ] ) < (int) ( $now / $instance[ 'period' ] ) |
|
| 89 | 89 | ) { |
| 90 | 90 | |
| 91 | 91 | wordpoints_add_points( |
| 92 | 92 | $user_id |
| 93 | - , $instance['points'] |
|
| 93 | + , $instance[ 'points' ] |
|
| 94 | 94 | , $points_type |
| 95 | 95 | , 'periodic' |
| 96 | - , array( 'period' => $instance['period'] ) |
|
| 96 | + , array( 'period' => $instance[ 'period' ] ) |
|
| 97 | 97 | ); |
| 98 | 98 | |
| 99 | 99 | $last_visit[ $points_type ] = $now; |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | public function logs( $text, $points, $points_type, $user_id, $log_type, $meta ) { |
| 135 | 135 | |
| 136 | - switch ( $meta['period'] ) { |
|
| 136 | + switch ( $meta[ 'period' ] ) { |
|
| 137 | 137 | |
| 138 | 138 | case HOUR_IN_SECONDS: |
| 139 | 139 | $message = _x( 'Hourly points.', 'points log description', 'wordpoints' ); |
@@ -169,9 +169,9 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | protected function generate_description( $instance = array() ) { |
| 171 | 171 | |
| 172 | - if ( ! empty( $instance['period'] ) ) { |
|
| 172 | + if ( ! empty( $instance[ 'period' ] ) ) { |
|
| 173 | 173 | |
| 174 | - switch ( $instance['period'] ) { |
|
| 174 | + switch ( $instance[ 'period' ] ) { |
|
| 175 | 175 | |
| 176 | 176 | case HOUR_IN_SECONDS: |
| 177 | 177 | return __( 'Visiting the site at least once in an hour.', 'wordpoints' ); |
@@ -207,8 +207,8 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | $new_instance = array_merge( $this->defaults, $old_instance, $new_instance ); |
| 209 | 209 | |
| 210 | - wordpoints_posint( $new_instance['points'] ); |
|
| 211 | - wordpoints_posint( $new_instance['period'] ); |
|
| 210 | + wordpoints_posint( $new_instance[ 'points' ] ); |
|
| 211 | + wordpoints_posint( $new_instance[ 'period' ] ); |
|
| 212 | 212 | |
| 213 | 213 | return $new_instance; |
| 214 | 214 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $instance = array_merge( $this->defaults, $instance ); |
| 228 | 228 | |
| 229 | 229 | $dropdown_args = array( |
| 230 | - 'selected' => $instance['period'], |
|
| 230 | + 'selected' => $instance[ 'period' ], |
|
| 231 | 231 | 'id' => $this->get_field_id( 'period' ), |
| 232 | 232 | 'name' => $this->get_field_name( 'period' ), |
| 233 | 233 | 'class' => 'widefat wordpoints-append-to-hook-title', |
@@ -261,9 +261,9 @@ discard block |
||
| 261 | 261 | protected function get_periods() { |
| 262 | 262 | |
| 263 | 263 | $periods = array( |
| 264 | - HOUR_IN_SECONDS => __( 'hourly', 'wordpoints' ), |
|
| 265 | - DAY_IN_SECONDS => __( 'daily', 'wordpoints' ), |
|
| 266 | - WEEK_IN_SECONDS => __( 'weekly', 'wordpoints' ), |
|
| 264 | + HOUR_IN_SECONDS => __( 'hourly', 'wordpoints' ), |
|
| 265 | + DAY_IN_SECONDS => __( 'daily', 'wordpoints' ), |
|
| 266 | + WEEK_IN_SECONDS => __( 'weekly', 'wordpoints' ), |
|
| 267 | 267 | 30 * DAY_IN_SECONDS => __( 'monthly', 'wordpoints' ), |
| 268 | 268 | ); |
| 269 | 269 | |
@@ -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 ) |