@@ -9,22 +9,22 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | global $status, $wp_version; |
| 11 | 11 | |
| 12 | -if ( isset( $_POST['clear-recent-list'] ) ) { |
|
| 12 | +if ( isset( $_POST[ 'clear-recent-list' ] ) ) { |
|
| 13 | 13 | $action = 'clear-recent-list'; |
| 14 | -} elseif ( isset( $_REQUEST['action'] ) && -1 !== (int) $_REQUEST['action'] ) { // WPCS: CSRF OK. |
|
| 15 | - $action = sanitize_key( $_REQUEST['action'] ); |
|
| 16 | -} elseif ( isset( $_REQUEST['action2'] ) && -1 !== (int) $_REQUEST['action2'] ) { // WPCS: CSRF OK. |
|
| 17 | - $action = sanitize_key( $_REQUEST['action2'] ); |
|
| 14 | +} elseif ( isset( $_REQUEST[ 'action' ] ) && -1 !== (int) $_REQUEST[ 'action' ] ) { // WPCS: CSRF OK. |
|
| 15 | + $action = sanitize_key( $_REQUEST[ 'action' ] ); |
|
| 16 | +} elseif ( isset( $_REQUEST[ 'action2' ] ) && -1 !== (int) $_REQUEST[ 'action2' ] ) { // WPCS: CSRF OK. |
|
| 17 | + $action = sanitize_key( $_REQUEST[ 'action2' ] ); |
|
| 18 | 18 | } else { |
| 19 | 19 | $action = ''; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -$page = ( isset( $_REQUEST['paged'] ) ) ? max( 1, absint( $_REQUEST['paged'] ) ) : 1; // WPCS: CSRF OK. |
|
| 23 | -$module = ( isset( $_REQUEST['module'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['module'] ) ) : ''; // WPCS: CSRF OK. |
|
| 24 | -$s = ( isset( $_REQUEST['s'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ) : ''; // WPCS: CSRF OK. |
|
| 22 | +$page = ( isset( $_REQUEST[ 'paged' ] ) ) ? max( 1, absint( $_REQUEST[ 'paged' ] ) ) : 1; // WPCS: CSRF OK. |
|
| 23 | +$module = ( isset( $_REQUEST[ 'module' ] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[ 'module' ] ) ) : ''; // WPCS: CSRF OK. |
|
| 24 | +$s = ( isset( $_REQUEST[ 's' ] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[ 's' ] ) ) : ''; // WPCS: CSRF OK. |
|
| 25 | 25 | |
| 26 | 26 | // Clean up request URI from temporary args for screen options/paging URI's to work as expected. |
| 27 | -$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce' ) ); |
|
| 27 | +$_SERVER[ 'REQUEST_URI' ] = remove_query_arg( array( 'error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce' ) ); |
|
| 28 | 28 | |
| 29 | 29 | $redirect_url = self_admin_url( "admin.php?page=wordpoints_modules&module_status={$status}&paged={$page}&s={$s}" ); |
| 30 | 30 | |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | check_admin_referer( 'bulk-modules' ); |
| 92 | 92 | |
| 93 | - $modules = isset( $_POST['checked'] ) |
|
| 94 | - ? array_map( 'sanitize_text_field', (array) wp_unslash( $_POST['checked'] ) ) |
|
| 93 | + $modules = isset( $_POST[ 'checked' ] ) |
|
| 94 | + ? array_map( 'sanitize_text_field', (array) wp_unslash( $_POST[ 'checked' ] ) ) |
|
| 95 | 95 | : array(); |
| 96 | 96 | |
| 97 | 97 | // Only activate modules which are not already active. |
@@ -218,8 +218,8 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | check_admin_referer( 'bulk-modules' ); |
| 220 | 220 | |
| 221 | - $modules = isset( $_POST['checked'] ) |
|
| 222 | - ? array_map( 'sanitize_text_field', (array) wp_unslash( $_POST['checked'] ) ) |
|
| 221 | + $modules = isset( $_POST[ 'checked' ] ) |
|
| 222 | + ? array_map( 'sanitize_text_field', (array) wp_unslash( $_POST[ 'checked' ] ) ) |
|
| 223 | 223 | : array(); |
| 224 | 224 | |
| 225 | 225 | $network_modules = array_filter( $modules, 'is_wordpoints_module_active_for_network' ); |
@@ -261,8 +261,8 @@ discard block |
||
| 261 | 261 | check_admin_referer( 'bulk-modules' ); |
| 262 | 262 | |
| 263 | 263 | // $_POST = from the module form; $_GET = from the FTP details screen. |
| 264 | - $modules = isset( $_REQUEST['checked'] ) |
|
| 265 | - ? array_map( 'sanitize_text_field', (array) wp_unslash( $_REQUEST['checked'] ) ) |
|
| 264 | + $modules = isset( $_REQUEST[ 'checked' ] ) |
|
| 265 | + ? array_map( 'sanitize_text_field', (array) wp_unslash( $_REQUEST[ 'checked' ] ) ) |
|
| 266 | 266 | : array(); |
| 267 | 267 | |
| 268 | 268 | if ( empty( $modules ) ) { |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | |
| 288 | 288 | $parent_file = 'admin.php'; |
| 289 | 289 | |
| 290 | - if ( ! isset( $_REQUEST['verify-delete'] ) ) { |
|
| 290 | + if ( ! isset( $_REQUEST[ 'verify-delete' ] ) ) { |
|
| 291 | 291 | |
| 292 | 292 | wp_enqueue_script( 'jquery' ); |
| 293 | 293 | require_once ABSPATH . 'wp-admin/admin-header.php'; |
@@ -307,15 +307,15 @@ discard block |
||
| 307 | 307 | |
| 308 | 308 | if ( '.' === dirname( $module ) ) { |
| 309 | 309 | |
| 310 | - $files_to_delete[] = $module_dir . '/' . $module; |
|
| 310 | + $files_to_delete[ ] = $module_dir . '/' . $module; |
|
| 311 | 311 | $data = wordpoints_get_module_data( $module_dir . '/' . $module ); |
| 312 | 312 | |
| 313 | 313 | if ( ! empty( $data ) ) { |
| 314 | 314 | |
| 315 | 315 | $module_info[ $module ] = $data; |
| 316 | - $module_info[ $module ]['is_uninstallable'] = is_uninstallable_wordpoints_module( $module ); |
|
| 316 | + $module_info[ $module ][ 'is_uninstallable' ] = is_uninstallable_wordpoints_module( $module ); |
|
| 317 | 317 | |
| 318 | - if ( ! $module_info[ $module ]['network'] ) { |
|
| 318 | + if ( ! $module_info[ $module ][ 'network' ] ) { |
|
| 319 | 319 | $have_non_network_modules = true; |
| 320 | 320 | } |
| 321 | 321 | } |
@@ -335,9 +335,9 @@ discard block |
||
| 335 | 335 | foreach ( $folder_modules as $module_file => $data ) { |
| 336 | 336 | |
| 337 | 337 | $module_info[ $module_file ] = $data; |
| 338 | - $module_info[ $module_file ]['is_uninstallable'] = is_uninstallable_wordpoints_module( $module ); |
|
| 338 | + $module_info[ $module_file ][ 'is_uninstallable' ] = is_uninstallable_wordpoints_module( $module ); |
|
| 339 | 339 | |
| 340 | - if ( ! $module_info[ $module_file ]['network'] ) { |
|
| 340 | + if ( ! $module_info[ $module_file ][ 'network' ] ) { |
|
| 341 | 341 | $have_non_network_modules = true; |
| 342 | 342 | } |
| 343 | 343 | } |
@@ -376,16 +376,16 @@ discard block |
||
| 376 | 376 | |
| 377 | 377 | foreach ( $module_info as $module ) { |
| 378 | 378 | |
| 379 | - if ( $module['is_uninstallable'] ) { |
|
| 379 | + if ( $module[ 'is_uninstallable' ] ) { |
|
| 380 | 380 | |
| 381 | 381 | // translators: 1. Module name; 2. Module author. |
| 382 | - echo '<li>', wp_kses( sprintf( __( '<strong>%1$s</strong> by <em>%2$s</em> (will also <strong>delete its data</strong>)', 'wordpoints' ), esc_html( $module['name'] ), esc_html( $module['author_name'] ) ), array( 'strong' => array(), 'em' => array() ) ), '</li>'; |
|
| 382 | + echo '<li>', wp_kses( sprintf( __( '<strong>%1$s</strong> by <em>%2$s</em> (will also <strong>delete its data</strong>)', 'wordpoints' ), esc_html( $module[ 'name' ] ), esc_html( $module[ 'author_name' ] ) ), array( 'strong' => array(), 'em' => array() ) ), '</li>'; |
|
| 383 | 383 | $data_to_delete = true; |
| 384 | 384 | |
| 385 | 385 | } else { |
| 386 | 386 | |
| 387 | 387 | // translators: 1. Module name; 2. Module author. |
| 388 | - echo '<li>', wp_kses( sprintf( __( '<strong>%1$s</strong> by <em>%2$s</em>', 'wordpoints' ), esc_html( $module['name'] ), esc_html( $module['author_name'] ) ), array( 'strong' => array(), 'em' => array() ) ), '</li>'; |
|
| 388 | + echo '<li>', wp_kses( sprintf( __( '<strong>%1$s</strong> by <em>%2$s</em>', 'wordpoints' ), esc_html( $module[ 'name' ] ), esc_html( $module[ 'author_name' ] ) ), array( 'strong' => array(), 'em' => array() ) ), '</li>'; |
|
| 389 | 389 | } |
| 390 | 390 | } |
| 391 | 391 | |
@@ -11,9 +11,11 @@ |
||
| 11 | 11 | |
| 12 | 12 | if ( isset( $_POST['clear-recent-list'] ) ) { |
| 13 | 13 | $action = 'clear-recent-list'; |
| 14 | -} elseif ( isset( $_REQUEST['action'] ) && -1 !== (int) $_REQUEST['action'] ) { // WPCS: CSRF OK. |
|
| 14 | +} elseif ( isset( $_REQUEST['action'] ) && -1 !== (int) $_REQUEST['action'] ) { |
|
| 15 | +// WPCS: CSRF OK. |
|
| 15 | 16 | $action = sanitize_key( $_REQUEST['action'] ); |
| 16 | -} elseif ( isset( $_REQUEST['action2'] ) && -1 !== (int) $_REQUEST['action2'] ) { // WPCS: CSRF OK. |
|
| 17 | +} elseif ( isset( $_REQUEST['action2'] ) && -1 !== (int) $_REQUEST['action2'] ) { |
|
| 18 | +// WPCS: CSRF OK. |
|
| 17 | 19 | $action = sanitize_key( $_REQUEST['action2'] ); |
| 18 | 20 | } else { |
| 19 | 21 | $action = ''; |
@@ -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> |
@@ -17,7 +17,8 @@ |
||
| 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'] ) ) ) { |
|
| 21 | +// WPCS: CSRF OK. |
|
| 21 | 22 | |
| 22 | 23 | $component = sanitize_key( $_GET['wordpoints_component'] ); |
| 23 | 24 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | public static function register( $class_name ) { |
| 112 | 112 | |
| 113 | - self::$classes[] = $class_name; |
|
| 113 | + self::$classes[ ] = $class_name; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -286,10 +286,10 @@ discard block |
||
| 286 | 286 | |
| 287 | 287 | $args = $hook_type->get_options(); |
| 288 | 288 | |
| 289 | - $args['_add'] = 'multi'; |
|
| 290 | - $args['_display'] = 'template'; |
|
| 291 | - $args['_multi_num'] = $hook_type->next_hook_id_number(); |
|
| 292 | - $args['_id_slug'] = $i; |
|
| 289 | + $args[ '_add' ] = 'multi'; |
|
| 290 | + $args[ '_display' ] = 'template'; |
|
| 291 | + $args[ '_multi_num' ] = $hook_type->next_hook_id_number(); |
|
| 292 | + $args[ '_id_slug' ] = $i; |
|
| 293 | 293 | |
| 294 | 294 | $hook_type->set_options( $args ); |
| 295 | 295 | |
@@ -338,11 +338,11 @@ discard block |
||
| 338 | 338 | |
| 339 | 339 | $options = $hook_type->get_options(); |
| 340 | 340 | |
| 341 | - $options['_display'] = 'instance'; |
|
| 341 | + $options[ '_display' ] = 'instance'; |
|
| 342 | 342 | |
| 343 | - unset( $options['_add'] ); |
|
| 343 | + unset( $options[ '_add' ] ); |
|
| 344 | 344 | |
| 345 | - $options['_id_slug'] = $slug; |
|
| 345 | + $options[ '_id_slug' ] = $slug; |
|
| 346 | 346 | |
| 347 | 347 | $hook_type->set_options( $options ); |
| 348 | 348 | |
@@ -596,15 +596,15 @@ discard block |
||
| 596 | 596 | |
| 597 | 597 | <p> |
| 598 | 598 | <label for="points-name-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html_x( 'Name:', 'points type', 'wordpoints' ); ?></label> |
| 599 | - <input class="widefat" type="text" id="points-name-<?php echo esc_attr( $slug ); ?>" name="points-name" value="<?php echo esc_attr( $points_type['name'] ); ?>" /> |
|
| 599 | + <input class="widefat" type="text" id="points-name-<?php echo esc_attr( $slug ); ?>" name="points-name" value="<?php echo esc_attr( $points_type[ 'name' ] ); ?>" /> |
|
| 600 | 600 | </p> |
| 601 | 601 | <p> |
| 602 | 602 | <label for="points-prefix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $prefix ); ?></label> |
| 603 | - <input class="widefat" type="text" id="points-prefix-<?php echo esc_attr( $slug ); ?>" name="points-prefix" value="<?php echo esc_attr( $points_type['prefix'] ); ?>" /> |
|
| 603 | + <input class="widefat" type="text" id="points-prefix-<?php echo esc_attr( $slug ); ?>" name="points-prefix" value="<?php echo esc_attr( $points_type[ 'prefix' ] ); ?>" /> |
|
| 604 | 604 | </p> |
| 605 | 605 | <p> |
| 606 | 606 | <label for="points-suffix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $suffix ); ?></label> |
| 607 | - <input class="widefat" type="text" id="points-suffix-<?php echo esc_attr( $slug ); ?>" name="points-suffix" value="<?php echo esc_attr( $points_type['suffix'] ); ?>" /> |
|
| 607 | + <input class="widefat" type="text" id="points-suffix-<?php echo esc_attr( $slug ); ?>" name="points-suffix" value="<?php echo esc_attr( $points_type[ 'suffix' ] ); ?>" /> |
|
| 608 | 608 | </p> |
| 609 | 609 | |
| 610 | 610 | <?php |
@@ -677,28 +677,28 @@ discard block |
||
| 677 | 677 | |
| 678 | 678 | $id_format = $hook_id; |
| 679 | 679 | |
| 680 | - $multi_number = ( isset( $options['_multi_num'] ) ) ? $options['_multi_num'] : ''; |
|
| 681 | - $add_new = ( isset( $options['_add'] ) ) ? $options['_add'] : ''; |
|
| 680 | + $multi_number = ( isset( $options[ '_multi_num' ] ) ) ? $options[ '_multi_num' ] : ''; |
|
| 681 | + $add_new = ( isset( $options[ '_add' ] ) ) ? $options[ '_add' ] : ''; |
|
| 682 | 682 | |
| 683 | 683 | // Prepare the URL query string. |
| 684 | 684 | $query_arg = array( 'edithook' => $id_format ); |
| 685 | 685 | |
| 686 | 686 | if ( $add_new ) { |
| 687 | 687 | |
| 688 | - $query_arg['addnew'] = 1; |
|
| 688 | + $query_arg[ 'addnew' ] = 1; |
|
| 689 | 689 | |
| 690 | 690 | if ( $multi_number ) { |
| 691 | 691 | |
| 692 | - $query_arg['num'] = $multi_number; |
|
| 693 | - $query_arg['base'] = $id_base; |
|
| 692 | + $query_arg[ 'num' ] = $multi_number; |
|
| 693 | + $query_arg[ 'base' ] = $id_base; |
|
| 694 | 694 | } |
| 695 | 695 | |
| 696 | 696 | } else { |
| 697 | 697 | |
| 698 | - $query_arg['points_type'] = $points_type; |
|
| 698 | + $query_arg[ 'points_type' ] = $points_type; |
|
| 699 | 699 | } |
| 700 | 700 | |
| 701 | - if ( isset( $options['_display'] ) && 'template' === $options['_display'] ) { |
|
| 701 | + if ( isset( $options[ '_display' ] ) && 'template' === $options[ '_display' ] ) { |
|
| 702 | 702 | |
| 703 | 703 | /* |
| 704 | 704 | * We aren't outputting the form for a hook, but a template form for this |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | |
| 715 | 715 | ?> |
| 716 | 716 | |
| 717 | - <div id="hook-<?php echo esc_html( $options['_id_slug'] ); ?>_<?php echo esc_attr( $id_format ); ?>" class="hook <?php echo esc_attr( $options['_classname'] ); ?>"> |
|
| 717 | + <div id="hook-<?php echo esc_html( $options[ '_id_slug' ] ); ?>_<?php echo esc_attr( $id_format ); ?>" class="hook <?php echo esc_attr( $options[ '_classname' ] ); ?>"> |
|
| 718 | 718 | <div class="hook-top"> |
| 719 | 719 | <div class="hook-title-action"> |
| 720 | 720 | <a class="hook-action hide-if-no-js" href="#available-hooks"></a> |
@@ -739,8 +739,8 @@ discard block |
||
| 739 | 739 | |
| 740 | 740 | <input type="hidden" name="hook-id" class="hook-id" value="<?php echo esc_attr( $id_format ); ?>" /> |
| 741 | 741 | <input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr( $id_base ); ?>" /> |
| 742 | - <input type="hidden" name="hook-width" class="hook-width" value="<?php echo isset( $options['width'] ) ? esc_attr( $options['width'] ) : ''; ?>" /> |
|
| 743 | - <input type="hidden" name="hook-height" class="hook-height" value="<?php echo isset( $options['height'] ) ? esc_attr( $options['height'] ) : ''; ?>" /> |
|
| 742 | + <input type="hidden" name="hook-width" class="hook-width" value="<?php echo isset( $options[ 'width' ] ) ? esc_attr( $options[ 'width' ] ) : ''; ?>" /> |
|
| 743 | + <input type="hidden" name="hook-height" class="hook-height" value="<?php echo isset( $options[ 'height' ] ) ? esc_attr( $options[ 'height' ] ) : ''; ?>" /> |
|
| 744 | 744 | <input type="hidden" name="hook_number" class="hook_number" value="<?php echo esc_attr( $number ); ?>" /> |
| 745 | 745 | <input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr( $multi_number ); ?>" /> |
| 746 | 746 | <input type="hidden" name="add_new" class="add_new" value="<?php echo esc_attr( $add_new ); ?>" /> |
@@ -760,8 +760,8 @@ discard block |
||
| 760 | 760 | </div> |
| 761 | 761 | |
| 762 | 762 | <div class="hook-description"> |
| 763 | - <?php if ( ! empty( $options['description'] ) ) : ?> |
|
| 764 | - <?php echo esc_html( $options['description'] ); ?> |
|
| 763 | + <?php if ( ! empty( $options[ 'description' ] ) ) : ?> |
|
| 764 | + <?php echo esc_html( $options[ 'description' ] ); ?> |
|
| 765 | 765 | <?php endif; ?> |
| 766 | 766 | </div> |
| 767 | 767 | </div> |
@@ -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 | } |
@@ -117,11 +117,11 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | function wordpoints_add_points_type( $settings ) { |
| 119 | 119 | |
| 120 | - if ( ! is_array( $settings ) || ! isset( $settings['name'] ) ) { |
|
| 120 | + if ( ! is_array( $settings ) || ! isset( $settings[ 'name' ] ) ) { |
|
| 121 | 121 | return false; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - $slug = $settings['name']; |
|
| 124 | + $slug = $settings[ 'name' ]; |
|
| 125 | 125 | $slug = preg_replace( '/\s+/', '-', $slug ); |
| 126 | 126 | $slug = preg_replace( '/-+/', '-', $slug ); |
| 127 | 127 | $slug = trim( $slug, '-' ); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | $points_types = wordpoints_get_points_types(); |
| 167 | 167 | |
| 168 | - if ( ! is_array( $settings ) || ! isset( $points_types[ $slug ], $settings['name'] ) ) { |
|
| 168 | + if ( ! is_array( $settings ) || ! isset( $points_types[ $slug ], $settings[ 'name' ] ) ) { |
|
| 169 | 169 | return false; |
| 170 | 170 | } |
| 171 | 171 | |
@@ -1094,13 +1094,13 @@ discard block |
||
| 1094 | 1094 | , array( '%d' ) |
| 1095 | 1095 | ); |
| 1096 | 1096 | |
| 1097 | - if ( ! isset( $flushed['points_types'][ $log->points_type ], $flushed['user_ids'][ $log->user_id ] ) ) { |
|
| 1097 | + if ( ! isset( $flushed[ 'points_types' ][ $log->points_type ], $flushed[ 'user_ids' ][ $log->user_id ] ) ) { |
|
| 1098 | 1098 | wordpoints_flush_points_logs_caches( |
| 1099 | 1099 | array( 'user_id' => $log->user_id, 'points_type' => $log->points_type ) |
| 1100 | 1100 | ); |
| 1101 | 1101 | |
| 1102 | - $flushed['points_types'][ $log->points_type ] = true; |
|
| 1103 | - $flushed['user_ids'][ $log->user_id ] = true; |
|
| 1102 | + $flushed[ 'points_types' ][ $log->points_type ] = true; |
|
| 1103 | + $flushed[ 'user_ids' ][ $log->user_id ] = true; |
|
| 1104 | 1104 | } |
| 1105 | 1105 | } |
| 1106 | 1106 | |
@@ -1134,9 +1134,9 @@ discard block |
||
| 1134 | 1134 | $cache = array( 'is_max' => false, 'top_users' => array() ); |
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | - $cached_users = count( $cache['top_users'] ); |
|
| 1137 | + $cached_users = count( $cache[ 'top_users' ] ); |
|
| 1138 | 1138 | |
| 1139 | - if ( $num_users > $cached_users && ! $cache['is_max'] ) { |
|
| 1139 | + if ( $num_users > $cached_users && ! $cache[ 'is_max' ] ) { |
|
| 1140 | 1140 | |
| 1141 | 1141 | global $wpdb; |
| 1142 | 1142 | |
@@ -1185,17 +1185,17 @@ discard block |
||
| 1185 | 1185 | return array(); |
| 1186 | 1186 | } |
| 1187 | 1187 | |
| 1188 | - $cache['top_users'] = array_merge( $cache['top_users'], $top_users ); |
|
| 1188 | + $cache[ 'top_users' ] = array_merge( $cache[ 'top_users' ], $top_users ); |
|
| 1189 | 1189 | |
| 1190 | - if ( count( $cache['top_users'] ) < $num_users ) { |
|
| 1191 | - $cache['is_max'] = true; |
|
| 1190 | + if ( count( $cache[ 'top_users' ] ) < $num_users ) { |
|
| 1191 | + $cache[ 'is_max' ] = true; |
|
| 1192 | 1192 | } |
| 1193 | 1193 | |
| 1194 | 1194 | wp_cache_set( $points_type, $cache, 'wordpoints_points_top_users' ); |
| 1195 | 1195 | |
| 1196 | 1196 | } // End if ( not cached ). |
| 1197 | 1197 | |
| 1198 | - return array_slice( $cache['top_users'], 0, $num_users ); |
|
| 1198 | + return array_slice( $cache[ 'top_users' ], 0, $num_users ); |
|
| 1199 | 1199 | } |
| 1200 | 1200 | |
| 1201 | 1201 | /** |
@@ -1226,7 +1226,7 @@ discard block |
||
| 1226 | 1226 | $points_type_name = wordpoints_get_points_type_setting( $points_type, 'name' ); |
| 1227 | 1227 | |
| 1228 | 1228 | if ( ! empty( $points_type_name ) ) { |
| 1229 | - $column_headers['points'] = $points_type_name; |
|
| 1229 | + $column_headers[ 'points' ] = $points_type_name; |
|
| 1230 | 1230 | } |
| 1231 | 1231 | |
| 1232 | 1232 | /** |
@@ -1250,9 +1250,9 @@ discard block |
||
| 1250 | 1250 | <table class="wordpoints-points-top-users <?php echo esc_attr( implode( ' ', $extra_classes ) ); ?>"> |
| 1251 | 1251 | <thead> |
| 1252 | 1252 | <tr> |
| 1253 | - <th scope="col"><?php echo esc_html( $column_headers['position'] ); ?></th> |
|
| 1254 | - <th scope="col"><?php echo esc_html( $column_headers['user'] ); ?></th> |
|
| 1255 | - <th scope="col"><?php echo esc_html( $column_headers['points'] ); ?></th> |
|
| 1253 | + <th scope="col"><?php echo esc_html( $column_headers[ 'position' ] ); ?></th> |
|
| 1254 | + <th scope="col"><?php echo esc_html( $column_headers[ 'user' ] ); ?></th> |
|
| 1255 | + <th scope="col"><?php echo esc_html( $column_headers[ 'points' ] ); ?></th> |
|
| 1256 | 1256 | </tr> |
| 1257 | 1257 | </thead> |
| 1258 | 1258 | <tbody> |
@@ -1310,9 +1310,9 @@ discard block |
||
| 1310 | 1310 | </tbody> |
| 1311 | 1311 | <tfoot> |
| 1312 | 1312 | <tr> |
| 1313 | - <th scope="col"><?php echo esc_html( $column_headers['position'] ); ?></th> |
|
| 1314 | - <th scope="col"><?php echo esc_html( $column_headers['user'] ); ?></th> |
|
| 1315 | - <th scope="col"><?php echo esc_html( $column_headers['points'] ); ?></th> |
|
| 1313 | + <th scope="col"><?php echo esc_html( $column_headers[ 'position' ] ); ?></th> |
|
| 1314 | + <th scope="col"><?php echo esc_html( $column_headers[ 'user' ] ); ?></th> |
|
| 1315 | + <th scope="col"><?php echo esc_html( $column_headers[ 'points' ] ); ?></th> |
|
| 1316 | 1316 | </tr> |
| 1317 | 1317 | </tfoot> |
| 1318 | 1318 | </table> |
@@ -1351,7 +1351,7 @@ discard block |
||
| 1351 | 1351 | $cache = wp_cache_get( $slug, 'wordpoints_points_top_users' ); |
| 1352 | 1352 | |
| 1353 | 1353 | // If there aren't fewer users than the cache holds, we don't need to clear it. |
| 1354 | - if ( ! is_array( $cache ) || ! $cache['is_max'] ) { |
|
| 1354 | + if ( ! is_array( $cache ) || ! $cache[ 'is_max' ] ) { |
|
| 1355 | 1355 | continue; |
| 1356 | 1356 | } |
| 1357 | 1357 | |
@@ -1376,7 +1376,7 @@ discard block |
||
| 1376 | 1376 | $cache = wp_cache_get( $slug, 'wordpoints_points_top_users' ); |
| 1377 | 1377 | |
| 1378 | 1378 | // If this user isn't in the cache, we don't need to clear it. |
| 1379 | - if ( ! is_array( $cache ) || ! in_array( (int) $user_id, array_map( 'intval', $cache['top_users'] ), true ) ) { |
|
| 1379 | + if ( ! is_array( $cache ) || ! in_array( (int) $user_id, array_map( 'intval', $cache[ 'top_users' ] ), true ) ) { |
|
| 1380 | 1380 | continue; |
| 1381 | 1381 | } |
| 1382 | 1382 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | function wordpoints_points_admin_screen_hooks() { |
| 145 | 145 | |
| 146 | - if ( isset( $_GET['edithook'] ) || isset( $_POST['savehook'] ) || isset( $_POST['removehook'] ) ) { // WPCS: CSRF OK. |
|
| 146 | + if ( isset( $_GET[ 'edithook' ] ) || isset( $_POST[ 'savehook' ] ) || isset( $_POST[ 'removehook' ] ) ) { // WPCS: CSRF OK. |
|
| 147 | 147 | |
| 148 | 148 | // - We're doing this without AJAX (JS). |
| 149 | 149 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | function wordpoints_no_js_points_hooks_save() { |
| 208 | 208 | |
| 209 | - if ( ! isset( $_POST['savehook'] ) && ! isset( $_POST['removehook'] ) ) { // WPCS: CSRF OK. |
|
| 209 | + if ( ! isset( $_POST[ 'savehook' ] ) && ! isset( $_POST[ 'removehook' ] ) ) { // WPCS: CSRF OK. |
|
| 210 | 210 | return; |
| 211 | 211 | } |
| 212 | 212 | |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | function wordpoints_points_hook_description_form( $has_form, $instance, $hook ) { |
| 286 | 286 | |
| 287 | - $description = ( isset( $instance['_description'] ) ) ? $instance['_description'] : ''; |
|
| 287 | + $description = ( isset( $instance[ '_description' ] ) ) ? $instance[ '_description' ] : ''; |
|
| 288 | 288 | |
| 289 | 289 | ?> |
| 290 | 290 | |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | ?> |
| 351 | 351 | |
| 352 | 352 | <tr> |
| 353 | - <th scope="row"><?php echo esc_html( $type['name'] ); ?></th> |
|
| 353 | + <th scope="row"><?php echo esc_html( $type[ 'name' ] ); ?></th> |
|
| 354 | 354 | <td> |
| 355 | 355 | <input type="hidden" name="<?php echo esc_attr( "wordpoints_points_old-{$slug}" ); ?>" value="<?php echo esc_attr( $points ); ?>" /> |
| 356 | 356 | <input type="number" name="<?php echo esc_attr( "wordpoints_points-{$slug}" ); ?>" value="<?php echo esc_attr( $points ); ?>" autocomplete="off" /> |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | <tbody> |
| 390 | 390 | <?php foreach ( wordpoints_get_points_types() as $slug => $type ) : ?> |
| 391 | 391 | <tr> |
| 392 | - <th scope="row" style="text-align: left;"><?php echo esc_html( $type['name'] ); ?></th> |
|
| 392 | + <th scope="row" style="text-align: left;"><?php echo esc_html( $type[ 'name' ] ); ?></th> |
|
| 393 | 393 | <td style="text-align: right;"><?php wordpoints_display_points( $user->ID, $slug, 'profile_page' ); ?></td> |
| 394 | 394 | </tr> |
| 395 | 395 | <?php endforeach; ?> |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | if ( |
| 422 | - ! isset( $_POST['wordpoints_points_set_nonce'], $_POST['wordpoints_set_reason'] ) |
|
| 422 | + ! isset( $_POST[ 'wordpoints_points_set_nonce' ], $_POST[ 'wordpoints_set_reason' ] ) |
|
| 423 | 423 | || ! wordpoints_verify_nonce( 'wordpoints_points_set_nonce', 'wordpoints_points_set_profile', null, 'post' ) |
| 424 | 424 | ) { |
| 425 | 425 | return; |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | , 'profile_edit' |
| 445 | 445 | , array( |
| 446 | 446 | 'user_id' => get_current_user_id(), |
| 447 | - 'reason' => sanitize_text_field( wp_unslash( $_POST['wordpoints_set_reason'] ) ), |
|
| 447 | + 'reason' => sanitize_text_field( wp_unslash( $_POST[ 'wordpoints_set_reason' ] ) ), |
|
| 448 | 448 | ) |
| 449 | 449 | ); |
| 450 | 450 | } |
@@ -500,11 +500,11 @@ discard block |
||
| 500 | 500 | function wordpoints_points_admin_settings_save() { |
| 501 | 501 | |
| 502 | 502 | if ( |
| 503 | - isset( $_POST['default_points_type'] ) |
|
| 503 | + isset( $_POST[ 'default_points_type' ] ) |
|
| 504 | 504 | && wordpoints_verify_nonce( 'wordpoints_default_points_type_nonce', 'wordpoints_default_points_type', null, 'post' ) |
| 505 | 505 | ) { |
| 506 | 506 | |
| 507 | - $points_type = sanitize_key( $_POST['default_points_type'] ); |
|
| 507 | + $points_type = sanitize_key( $_POST[ 'default_points_type' ] ); |
|
| 508 | 508 | |
| 509 | 509 | if ( '-1' === $points_type ) { |
| 510 | 510 | |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | function wordpoints_points_admin_notices() { |
| 528 | 528 | |
| 529 | 529 | if ( |
| 530 | - ( ! isset( $_GET['page'] ) || 'wordpoints_points_types' !== $_GET['page'] ) // WPCS: CSRF OK. |
|
| 530 | + ( ! isset( $_GET[ 'page' ] ) || 'wordpoints_points_types' !== $_GET[ 'page' ] ) // WPCS: CSRF OK. |
|
| 531 | 531 | && current_user_can( 'manage_wordpoints_points_types' ) |
| 532 | 532 | && ! wordpoints_get_points_types() |
| 533 | 533 | ) { |
@@ -143,7 +143,8 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | function wordpoints_points_admin_screen_hooks() { |
| 145 | 145 | |
| 146 | - if ( isset( $_GET['edithook'] ) || isset( $_POST['savehook'] ) || isset( $_POST['removehook'] ) ) { // WPCS: CSRF OK. |
|
| 146 | + if ( isset( $_GET['edithook'] ) || isset( $_POST['savehook'] ) || isset( $_POST['removehook'] ) ) { |
|
| 147 | +// WPCS: CSRF OK. |
|
| 147 | 148 | |
| 148 | 149 | // - We're doing this without AJAX (JS). |
| 149 | 150 | |
@@ -206,7 +207,8 @@ discard block |
||
| 206 | 207 | */ |
| 207 | 208 | function wordpoints_no_js_points_hooks_save() { |
| 208 | 209 | |
| 209 | - if ( ! isset( $_POST['savehook'] ) && ! isset( $_POST['removehook'] ) ) { // WPCS: CSRF OK. |
|
| 210 | + if ( ! isset( $_POST['savehook'] ) && ! isset( $_POST['removehook'] ) ) { |
|
| 211 | +// WPCS: CSRF OK. |
|
| 210 | 212 | return; |
| 211 | 213 | } |
| 212 | 214 | |
@@ -290,9 +292,12 @@ discard block |
||
| 290 | 292 | |
| 291 | 293 | <?php if ( $has_form ) : ?> |
| 292 | 294 | <hr /> |
| 293 | - <?php else : ?> |
|
| 295 | + <?php else { |
|
| 296 | + : ?> |
|
| 294 | 297 | <br /> |
| 295 | - <?php endif; ?> |
|
| 298 | + <?php endif; |
|
| 299 | +} |
|
| 300 | +?> |
|
| 296 | 301 | |
| 297 | 302 | <div class="hook-instance-description"> |
| 298 | 303 | <label for="<?php $hook->the_field_id( '_description' ); ?>"><?php echo esc_html_x( 'Description (optional):', 'points hook', 'wordpoints' ); ?></label> |
@@ -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 | |
@@ -7,15 +7,15 @@ discard block |
||
| 7 | 7 | * @since 1.0.0 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -if ( ! isset( $_GET['edithook'] ) ) { // WPCS: CSRF OK. |
|
| 10 | +if ( ! isset( $_GET[ 'edithook' ] ) ) { // WPCS: CSRF OK. |
|
| 11 | 11 | return; |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -$hook_id = sanitize_key( $_GET['edithook'] ); |
|
| 14 | +$hook_id = sanitize_key( $_GET[ 'edithook' ] ); |
|
| 15 | 15 | |
| 16 | 16 | $points_types = wordpoints_get_points_types(); |
| 17 | 17 | |
| 18 | -if ( isset( $_GET['addnew'] ) ) { // WPCS: CSRF OK. |
|
| 18 | +if ( isset( $_GET[ 'addnew' ] ) ) { // WPCS: CSRF OK. |
|
| 19 | 19 | |
| 20 | 20 | // - We are adding a new points hook. |
| 21 | 21 | |
@@ -33,11 +33,11 @@ discard block |
||
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - if ( isset( $_GET['base'], $_GET['num'] ) ) { // WPCS: CSRF OK. |
|
| 36 | + if ( isset( $_GET[ 'base' ], $_GET[ 'num' ] ) ) { // WPCS: CSRF OK. |
|
| 37 | 37 | |
| 38 | 38 | // Copy minimal info from an existing instance of this hook to a new instance. |
| 39 | 39 | $hook = WordPoints_Points_Hooks::get_handler_by_id_base( |
| 40 | - sanitize_key( $_GET['base'] ) // WPCS: CSRF OK. |
|
| 40 | + sanitize_key( $_GET[ 'base' ] ) // WPCS: CSRF OK. |
|
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | 43 | if ( ! $hook ) { |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | return; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - $multi_number = (int) $_GET['num']; |
|
| 53 | + $multi_number = (int) $_GET[ 'num' ]; |
|
| 54 | 54 | $number = 0; |
| 55 | 55 | $hook_id = $hook->get_id( $multi_number ); |
| 56 | 56 | $_hook = $hook; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | // We are editing an existing points hook. |
| 72 | 72 | |
| 73 | - $points_type = isset( $_GET['points_type'] ) ? sanitize_key( $_GET['points_type'] ) : '_inactive_hooks'; // WPCS: CSRF OK. |
|
| 73 | + $points_type = isset( $_GET[ 'points_type' ] ) ? sanitize_key( $_GET[ 'points_type' ] ) : '_inactive_hooks'; // WPCS: CSRF OK. |
|
| 74 | 74 | |
| 75 | 75 | $hook = WordPoints_Points_Hooks::get_handler( $hook_id ); |
| 76 | 76 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | </div> |
| 125 | 125 | <br /> |
| 126 | 126 | <div class="hook-control-actions"> |
| 127 | - <?php if ( isset( $_GET['addnew'] ) ) : // WPCS: CSRF OK. ?> |
|
| 127 | + <?php if ( isset( $_GET[ 'addnew' ] ) ) : // WPCS: CSRF OK. ?> |
|
| 128 | 128 | <a href="<?php echo esc_url( self_admin_url( 'admin.php?page=wordpoints_points_hooks' ) ); ?>" class="button alignleft"><?php esc_html_e( 'Cancel', 'wordpoints' ); ?></a> |
| 129 | 129 | <?php else : |
| 130 | 130 | submit_button( _x( 'Delete', 'points hook', 'wordpoints' ), 'button alignleft', 'removehook', false ); |
@@ -7,7 +7,8 @@ discard block |
||
| 7 | 7 | * @since 1.0.0 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -if ( ! isset( $_GET['edithook'] ) ) { // WPCS: CSRF OK. |
|
| 10 | +if ( ! isset( $_GET['edithook'] ) ) { |
|
| 11 | +// WPCS: CSRF OK. |
|
| 11 | 12 | return; |
| 12 | 13 | } |
| 13 | 14 | |
@@ -15,7 +16,8 @@ discard block |
||
| 15 | 16 | |
| 16 | 17 | $points_types = wordpoints_get_points_types(); |
| 17 | 18 | |
| 18 | -if ( isset( $_GET['addnew'] ) ) { // WPCS: CSRF OK. |
|
| 19 | +if ( isset( $_GET['addnew'] ) ) { |
|
| 20 | +// WPCS: CSRF OK. |
|
| 19 | 21 | |
| 20 | 22 | // - We are adding a new points hook. |
| 21 | 23 | |
@@ -33,7 +35,8 @@ discard block |
||
| 33 | 35 | return; |
| 34 | 36 | } |
| 35 | 37 | |
| 36 | - if ( isset( $_GET['base'], $_GET['num'] ) ) { // WPCS: CSRF OK. |
|
| 38 | + if ( isset( $_GET['base'], $_GET['num'] ) ) { |
|
| 39 | +// WPCS: CSRF OK. |
|
| 37 | 40 | |
| 38 | 41 | // Copy minimal info from an existing instance of this hook to a new instance. |
| 39 | 42 | $hook = WordPoints_Points_Hooks::get_handler_by_id_base( |
@@ -126,8 +129,10 @@ discard block |
||
| 126 | 129 | <div class="hook-control-actions"> |
| 127 | 130 | <?php if ( isset( $_GET['addnew'] ) ) : // WPCS: CSRF OK. ?> |
| 128 | 131 | <a href="<?php echo esc_url( self_admin_url( 'admin.php?page=wordpoints_points_hooks' ) ); ?>" class="button alignleft"><?php esc_html_e( 'Cancel', 'wordpoints' ); ?></a> |
| 129 | - <?php else : |
|
| 132 | + <?php else { |
|
| 133 | + : |
|
| 130 | 134 | submit_button( _x( 'Delete', 'points hook', 'wordpoints' ), 'button alignleft', 'removehook', false ); |
| 135 | +} |
|
| 131 | 136 | endif; |
| 132 | 137 | |
| 133 | 138 | submit_button( __( 'Save Hook', 'wordpoints' ), 'button-primary alignright', 'savehook', false ); |
@@ -43,18 +43,18 @@ discard block |
||
| 43 | 43 | return; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if ( isset( $_GET['message'] ) && isset( $messages[ (int) $_GET['message'] ] ) ) { // WPCS: CSRF OK. |
|
| 46 | + if ( isset( $_GET[ 'message' ] ) && isset( $messages[ (int) $_GET[ 'message' ] ] ) ) { // WPCS: CSRF OK. |
|
| 47 | 47 | |
| 48 | 48 | wordpoints_show_admin_message( |
| 49 | - esc_html( $messages[ (int) $_GET['message'] ] ) // WPCS: CSRF OK. |
|
| 49 | + esc_html( $messages[ (int) $_GET[ 'message' ] ] ) // WPCS: CSRF OK. |
|
| 50 | 50 | , 'success' |
| 51 | 51 | , array( 'dismissible' => true ) |
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | - } elseif ( isset( $_GET['error'] ) && isset( $errors[ (int) $_GET['error'] ] ) ) { // WPCS: CSRF OK. |
|
| 54 | + } elseif ( isset( $_GET[ 'error' ] ) && isset( $errors[ (int) $_GET[ 'error' ] ] ) ) { // WPCS: CSRF OK. |
|
| 55 | 55 | |
| 56 | 56 | wordpoints_show_admin_error( |
| 57 | - esc_html( $errors[ (int) $_GET['error'] ] ) // WPCS: CSRF OK. |
|
| 57 | + esc_html( $errors[ (int) $_GET[ 'error' ] ] ) // WPCS: CSRF OK. |
|
| 58 | 58 | , array( 'dismissible' => true ) |
| 59 | 59 | ); |
| 60 | 60 | } |
@@ -124,8 +124,8 @@ discard block |
||
| 124 | 124 | foreach ( $points_types as $slug => $points_type ) { |
| 125 | 125 | |
| 126 | 126 | $wrap_class = 'hooks-holder-wrap'; |
| 127 | - if ( ! empty( $points_type['class'] ) ) { |
|
| 128 | - $wrap_class .= ' points-type-' . $points_type['class']; |
|
| 127 | + if ( ! empty( $points_type[ 'class' ] ) ) { |
|
| 128 | + $wrap_class .= ' points-type-' . $points_type[ 'class' ]; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if ( $i ) { |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | <div class="<?php echo esc_attr( $wrap_class ); ?>"> |
| 138 | 138 | <div class="points-type-name"> |
| 139 | 139 | <div class="points-type-name-arrow"><br /></div> |
| 140 | - <h2><?php echo esc_html( $points_type['name'] ); ?><span class="spinner"></span></h2> |
|
| 140 | + <h2><?php echo esc_html( $points_type[ 'name' ] ); ?><span class="spinner"></span></h2> |
|
| 141 | 141 | </div> |
| 142 | 142 | <div id="<?php echo esc_attr( $slug ); ?>" class="hooks-sortables"> |
| 143 | 143 | |
@@ -43,7 +43,8 @@ discard block |
||
| 43 | 43 | return; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if ( isset( $_GET['message'] ) && isset( $messages[ (int) $_GET['message'] ] ) ) { // WPCS: CSRF OK. |
|
| 46 | + if ( isset( $_GET['message'] ) && isset( $messages[ (int) $_GET['message'] ] ) ) { |
|
| 47 | +// WPCS: CSRF OK. |
|
| 47 | 48 | |
| 48 | 49 | wordpoints_show_admin_message( |
| 49 | 50 | esc_html( $messages[ (int) $_GET['message'] ] ) // WPCS: CSRF OK. |
@@ -51,7 +52,8 @@ discard block |
||
| 51 | 52 | , array( 'dismissible' => true ) |
| 52 | 53 | ); |
| 53 | 54 | |
| 54 | - } elseif ( isset( $_GET['error'] ) && isset( $errors[ (int) $_GET['error'] ] ) ) { // WPCS: CSRF OK. |
|
| 55 | + } elseif ( isset( $_GET['error'] ) && isset( $errors[ (int) $_GET['error'] ] ) ) { |
|
| 56 | +// WPCS: CSRF OK. |
|
| 55 | 57 | |
| 56 | 58 | wordpoints_show_admin_error( |
| 57 | 59 | esc_html( $errors[ (int) $_GET['error'] ] ) // WPCS: CSRF OK. |