@@ -47,7 +47,7 @@ |
||
| 47 | 47 | |
| 48 | 48 | foreach ( $points_types as $slug => $settings ) { |
| 49 | 49 | |
| 50 | - $tabs[ $slug ] = $settings['name']; |
|
| 50 | + $tabs[ $slug ] = $settings[ 'name' ]; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | wordpoints_admin_show_tabs( $tabs, 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. |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | protected function verify_atts() { |
| 24 | 24 | |
| 25 | - if ( isset( $this->pairs['points_type'] ) ) { |
|
| 25 | + if ( isset( $this->pairs[ 'points_type' ] ) ) { |
|
| 26 | 26 | |
| 27 | 27 | $points_type = $this->get_points_type(); |
| 28 | 28 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | return $points_type; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - $this->atts['points_type'] = $points_type; |
|
| 33 | + $this->atts[ 'points_type' ] = $points_type; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | return parent::verify_atts(); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | protected function get_points_type() { |
| 52 | 52 | |
| 53 | - $points_type = $this->atts['points_type']; |
|
| 53 | + $points_type = $this->atts[ 'points_type' ]; |
|
| 54 | 54 | |
| 55 | 55 | if ( ! wordpoints_is_points_type( $points_type ) ) { |
| 56 | 56 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | protected function verify_atts() { |
| 42 | 42 | |
| 43 | - if ( ! wordpoints_is_points_logs_query( $this->atts['query'] ) ) { |
|
| 43 | + if ( ! wordpoints_is_points_logs_query( $this->atts[ 'query' ] ) ) { |
|
| 44 | 44 | return sprintf( |
| 45 | 45 | // translators: 1. Attribute name; 2. Shortcode name; 3. Example of proper usage. |
| 46 | 46 | __( 'The “%1$s” attribute of the %2$s shortcode must be the slug of a registered points log query. Example: %3$s.', 'wordpoints' ) |
@@ -50,17 +50,17 @@ discard block |
||
| 50 | 50 | ); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - if ( false === wordpoints_int( $this->atts['paginate'] ) ) { |
|
| 54 | - $this->atts['paginate'] = 1; |
|
| 53 | + if ( false === wordpoints_int( $this->atts[ 'paginate' ] ) ) { |
|
| 54 | + $this->atts[ 'paginate' ] = 1; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | // Back-compat. Needs to stay here "forever" for legacy installs. |
| 58 | - if ( isset( $this->atts['datatables'] ) ) { |
|
| 59 | - $this->atts['paginate'] = wordpoints_int( $this->atts['datatables'] ); |
|
| 58 | + if ( isset( $this->atts[ 'datatables' ] ) ) { |
|
| 59 | + $this->atts[ 'paginate' ] = wordpoints_int( $this->atts[ 'datatables' ] ); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if ( false === wordpoints_int( $this->atts['show_users'] ) ) { |
|
| 63 | - $this->atts['show_users'] = 1; |
|
| 62 | + if ( false === wordpoints_int( $this->atts[ 'show_users' ] ) ) { |
|
| 63 | + $this->atts[ 'show_users' ] = 1; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | return parent::verify_atts(); |
@@ -74,12 +74,12 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | ob_start(); |
| 76 | 76 | wordpoints_show_points_logs_query( |
| 77 | - $this->atts['points_type'] |
|
| 78 | - , $this->atts['query'] |
|
| 77 | + $this->atts[ 'points_type' ] |
|
| 78 | + , $this->atts[ 'query' ] |
|
| 79 | 79 | , array( |
| 80 | - 'paginate' => $this->atts['paginate'], |
|
| 81 | - 'show_users' => $this->atts['show_users'], |
|
| 82 | - 'searchable' => $this->atts['searchable'], |
|
| 80 | + 'paginate' => $this->atts[ 'paginate' ], |
|
| 81 | + 'show_users' => $this->atts[ 'show_users' ], |
|
| 82 | + 'searchable' => $this->atts[ 'searchable' ], |
|
| 83 | 83 | ) |
| 84 | 84 | ); |
| 85 | 85 | |
@@ -37,8 +37,8 @@ |
||
| 37 | 37 | protected function generate() { |
| 38 | 38 | |
| 39 | 39 | return wordpoints_get_formatted_points( |
| 40 | - $this->atts['user_id'] |
|
| 41 | - , $this->atts['points_type'] |
|
| 40 | + $this->atts[ 'user_id' ] |
|
| 41 | + , $this->atts[ 'points_type' ] |
|
| 42 | 42 | , 'points-shortcode' |
| 43 | 43 | ); |
| 44 | 44 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | protected function verify_atts() { |
| 38 | 38 | |
| 39 | - if ( ! wordpoints_posint( $this->atts['users'] ) ) { |
|
| 39 | + if ( ! wordpoints_posint( $this->atts[ 'users' ] ) ) { |
|
| 40 | 40 | return sprintf( |
| 41 | 41 | // translators: 1. Attribute name; 2. Shortcode name; 3. Example of proper usage. |
| 42 | 42 | __( 'The “%1$s” attribute of the %2$s shortcode must be a positive integer. Example: %3$s.', 'wordpoints' ) |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | ob_start(); |
| 59 | 59 | wordpoints_points_show_top_users( |
| 60 | - $this->atts['users'] |
|
| 61 | - , $this->atts['points_type'] |
|
| 60 | + $this->atts[ 'users' ] |
|
| 61 | + , $this->atts[ 'points_type' ] |
|
| 62 | 62 | , 'shortcode' |
| 63 | 63 | ); |
| 64 | 64 | |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | continue; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - $this->restrictions[] = $restriction; |
|
| 60 | + $this->restrictions[ ] = $restriction; |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
@@ -109,7 +109,7 @@ |
||
| 109 | 109 | continue; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - $descriptions[] = sprintf( $string, $entity->get_title() ); |
|
| 112 | + $descriptions[ ] = sprintf( $string, $entity->get_title() ); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | return $descriptions; |
@@ -222,7 +222,8 @@ |
||
| 222 | 222 | |
| 223 | 223 | $search_term = ''; |
| 224 | 224 | |
| 225 | - if ( isset( $_POST['wordpoints_points_logs_search'] ) ) { // WPCS: CSRF OK |
|
| 225 | + if ( isset( $_POST['wordpoints_points_logs_search'] ) ) { |
|
| 226 | +// WPCS: CSRF OK |
|
| 226 | 227 | $search_term = trim( |
| 227 | 228 | sanitize_text_field( |
| 228 | 229 | wp_unslash( $_POST['wordpoints_points_logs_search'] ) // WPCS: CSRF OK |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | ); |
| 80 | 80 | |
| 81 | 81 | if ( ! empty( $points_type_name ) ) { |
| 82 | - $this->column_headings['points'] = $points_type_name; |
|
| 82 | + $this->column_headings[ 'points' ] = $points_type_name; |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | foreach ( array( 'searchable', 'paginate' ) as $arg ) { |
| 89 | 89 | if ( $this->args[ $arg ] ) { |
| 90 | - $extra_classes[] = $arg; |
|
| 90 | + $extra_classes[ ] = $arg; |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
@@ -110,19 +110,19 @@ discard block |
||
| 110 | 110 | ?> |
| 111 | 111 | |
| 112 | 112 | <div class="wordpoints-points-logs-wrapper"> |
| 113 | - <?php if ( $this->args['searchable'] ) : ?> |
|
| 113 | + <?php if ( $this->args[ 'searchable' ] ) : ?> |
|
| 114 | 114 | <?php $this->search_box(); ?> |
| 115 | 115 | <?php endif; ?> |
| 116 | 116 | |
| 117 | 117 | <table class="wordpoints-points-logs widefat <?php echo esc_attr( implode( ' ', $extra_classes ) ); ?>"> |
| 118 | 118 | <thead> |
| 119 | 119 | <tr> |
| 120 | - <?php if ( $this->args['show_users'] ) : ?> |
|
| 121 | - <th scope="col"><?php echo esc_html( $this->column_headings['user'] ); ?></th> |
|
| 120 | + <?php if ( $this->args[ 'show_users' ] ) : ?> |
|
| 121 | + <th scope="col"><?php echo esc_html( $this->column_headings[ 'user' ] ); ?></th> |
|
| 122 | 122 | <?php endif; ?> |
| 123 | - <th scope="col"><?php echo esc_html( $this->column_headings['points'] ); ?></th> |
|
| 124 | - <th scope="col"><?php echo esc_html( $this->column_headings['description'] ); ?></th> |
|
| 125 | - <th scope="col"><?php echo esc_html( $this->column_headings['time'] ); ?></th> |
|
| 123 | + <th scope="col"><?php echo esc_html( $this->column_headings[ 'points' ] ); ?></th> |
|
| 124 | + <th scope="col"><?php echo esc_html( $this->column_headings[ 'description' ] ); ?></th> |
|
| 125 | + <th scope="col"><?php echo esc_html( $this->column_headings[ 'time' ] ); ?></th> |
|
| 126 | 126 | </tr> |
| 127 | 127 | </thead> |
| 128 | 128 | <tbody> |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | ?> |
| 138 | 138 | <tr> |
| 139 | - <td colspan="<?php echo ( $this->args['show_users'] ) ? 4 : 3; ?>"> |
|
| 139 | + <td colspan="<?php echo ( $this->args[ 'show_users' ] ) ? 4 : 3; ?>"> |
|
| 140 | 140 | <?php esc_html_e( 'No matching logs found.', 'wordpoints' ); ?> |
| 141 | 141 | </td> |
| 142 | 142 | </tr> |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | ?> |
| 154 | 154 | |
| 155 | 155 | <tr class="wordpoints-log-id-<?php echo (int) $log->id; ?> <?php echo ( $this->i % 2 ) ? 'odd' : 'even'; ?>"> |
| 156 | - <?php if ( $this->args['show_users'] ) : ?> |
|
| 156 | + <?php if ( $this->args[ 'show_users' ] ) : ?> |
|
| 157 | 157 | <td> |
| 158 | 158 | <?php echo get_avatar( $user->ID, $this->avatar_size ); ?> |
| 159 | 159 | <span class="wordpoints-points-log-user-name"> |
@@ -217,17 +217,17 @@ discard block |
||
| 217 | 217 | </tbody> |
| 218 | 218 | <tfoot> |
| 219 | 219 | <tr> |
| 220 | - <?php if ( $this->args['show_users'] ) : ?> |
|
| 221 | - <th scope="col"><?php echo esc_html( $this->column_headings['user'] ); ?></th> |
|
| 220 | + <?php if ( $this->args[ 'show_users' ] ) : ?> |
|
| 221 | + <th scope="col"><?php echo esc_html( $this->column_headings[ 'user' ] ); ?></th> |
|
| 222 | 222 | <?php endif; ?> |
| 223 | - <th scope="col"><?php echo esc_html( $this->column_headings['points'] ); ?></th> |
|
| 224 | - <th scope="col"><?php echo esc_html( $this->column_headings['description'] ); ?></th> |
|
| 225 | - <th scope="col"><?php echo esc_html( $this->column_headings['time'] ); ?></th> |
|
| 223 | + <th scope="col"><?php echo esc_html( $this->column_headings[ 'points' ] ); ?></th> |
|
| 224 | + <th scope="col"><?php echo esc_html( $this->column_headings[ 'description' ] ); ?></th> |
|
| 225 | + <th scope="col"><?php echo esc_html( $this->column_headings[ 'time' ] ); ?></th> |
|
| 226 | 226 | </tr> |
| 227 | 227 | </tfoot> |
| 228 | 228 | </table> |
| 229 | 229 | |
| 230 | - <?php if ( $this->args['paginate'] ) : ?> |
|
| 230 | + <?php if ( $this->args[ 'paginate' ] ) : ?> |
|
| 231 | 231 | <?php $this->pagination(); ?> |
| 232 | 232 | <?php endif; ?> |
| 233 | 233 | </div> |
@@ -242,10 +242,10 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | $search_term = ''; |
| 244 | 244 | |
| 245 | - if ( isset( $_POST['wordpoints_points_logs_search'] ) ) { // WPCS: CSRF OK |
|
| 245 | + if ( isset( $_POST[ 'wordpoints_points_logs_search' ] ) ) { // WPCS: CSRF OK |
|
| 246 | 246 | $search_term = trim( |
| 247 | 247 | sanitize_text_field( |
| 248 | - wp_unslash( $_POST['wordpoints_points_logs_search'] ) // WPCS: CSRF OK |
|
| 248 | + wp_unslash( $_POST[ 'wordpoints_points_logs_search' ] ) // WPCS: CSRF OK |
|
| 249 | 249 | ) |
| 250 | 250 | ); |
| 251 | 251 | |
@@ -263,10 +263,10 @@ discard block |
||
| 263 | 263 | $page = 1; |
| 264 | 264 | |
| 265 | 265 | if ( |
| 266 | - isset( $_GET['wordpoints_points_logs_page'] ) // WPCS: CSRF OK. |
|
| 267 | - && wordpoints_posint( $_GET['wordpoints_points_logs_page'] ) // WPCS: CSRF OK. |
|
| 266 | + isset( $_GET[ 'wordpoints_points_logs_page' ] ) // WPCS: CSRF OK. |
|
| 267 | + && wordpoints_posint( $_GET[ 'wordpoints_points_logs_page' ] ) // WPCS: CSRF OK. |
|
| 268 | 268 | ) { |
| 269 | - $page = (int) $_GET['wordpoints_points_logs_page']; |
|
| 269 | + $page = (int) $_GET[ 'wordpoints_points_logs_page' ]; |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | return $page; |
@@ -280,10 +280,10 @@ discard block |
||
| 280 | 280 | $per_page = 25; |
| 281 | 281 | |
| 282 | 282 | if ( |
| 283 | - isset( $_GET['wordpoints_points_logs_per_page'] ) // WPCS: CSRF OK. |
|
| 284 | - && wordpoints_posint( $_GET['wordpoints_points_logs_per_page'] ) // WPCS: CSRF OK. |
|
| 283 | + isset( $_GET[ 'wordpoints_points_logs_per_page' ] ) // WPCS: CSRF OK. |
|
| 284 | + && wordpoints_posint( $_GET[ 'wordpoints_points_logs_per_page' ] ) // WPCS: CSRF OK. |
|
| 285 | 285 | ) { |
| 286 | - $per_page = (int) $_GET['wordpoints_points_logs_per_page']; |
|
| 286 | + $per_page = (int) $_GET[ 'wordpoints_points_logs_per_page' ]; |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | return $per_page; |