| @@ -52,13 +52,15 @@ | ||
| 52 | 52 | public function __construct() { |
| 53 | 53 | global $status, $page; |
| 54 | 54 | |
| 55 | 55 | // Set parent defaults |
| 56 | - parent::__construct( array( | |
| 57 | - 'singular' => esc_html__( 'API Key', 'give' ), // Singular name of the listed records | |
| 58 | - 'plural' => esc_html__( 'API Keys', 'give' ), // Plural name of the listed records | |
| 59 | - 'ajax' => false, // Does this table support ajax? | |
| 60 | - ) ); | |
| 56 | + parent::__construct( | |
| 57 | + array( | |
| 58 | + 'singular' => esc_html__( 'API Key', 'give' ), // Singular name of the listed records | |
| 59 | + 'plural' => esc_html__( 'API Keys', 'give' ), // Plural name of the listed records | |
| 60 | + 'ajax' => false, // Does this table support ajax? | |
| 61 | + ) | |
| 62 | + ); | |
| 61 | 63 | |
| 62 | 64 | $this->query(); |
| 63 | 65 | } |
| 64 | 66 | |
| @@ -132,15 +134,20 @@ | ||
| 132 | 134 | |
| 133 | 135 | if ( apply_filters( 'give_api_log_requests', true ) ) { |
| 134 | 136 | $actions['view'] = sprintf( |
| 135 | 137 | '<a href="%s">%s</a>', |
| 136 | - esc_url( add_query_arg( array( | |
| 137 | - 'section' => 'api_requests', | |
| 138 | - 'post_type' => 'give_forms', | |
| 139 | - 'page' => 'give-tools', | |
| 140 | - 'tab' => 'logs', | |
| 141 | - 's' => $item['email'], | |
| 142 | - ), 'edit.php' ) ), | |
| 138 | + esc_url( | |
| 139 | + add_query_arg( | |
| 140 | + array( | |
| 141 | + 'section' => 'api_requests', | |
| 142 | + 'post_type' => 'give_forms', | |
| 143 | + 'page' => 'give-tools', | |
| 144 | + 'tab' => 'logs', | |
| 145 | + 's' => $item['email'], | |
| 146 | + ), | |
| 147 | + 'edit.php' | |
| 148 | + ) | |
| 149 | + ), | |
| 143 | 150 | esc_html__( 'View API Log', 'give' ) |
| 144 | 151 | ); |
| 145 | 152 | } |
| 146 | 153 | |
| @@ -145,22 +152,36 @@ | ||
| 145 | 152 | } |
| 146 | 153 | |
| 147 | 154 | $actions['reissue'] = sprintf( |
| 148 | 155 | '<a href="%s" class="give-regenerate-api-key">%s</a>', |
| 149 | - esc_url( wp_nonce_url( add_query_arg( array( | |
| 150 | - 'user_id' => $item['id'], | |
| 151 | - 'give_action' => 'process_api_key', | |
| 152 | - 'give_api_process' => 'regenerate', | |
| 153 | - ) ), 'give-api-nonce' ) ), | |
| 156 | + esc_url( | |
| 157 | + wp_nonce_url( | |
| 158 | + add_query_arg( | |
| 159 | + array( | |
| 160 | + 'user_id' => $item['id'], | |
| 161 | + 'give_action' => 'process_api_key', | |
| 162 | + 'give_api_process' => 'regenerate', | |
| 163 | + ) | |
| 164 | + ), | |
| 165 | + 'give-api-nonce' | |
| 166 | + ) | |
| 167 | + ), | |
| 154 | 168 | esc_html__( 'Reissue', 'give' ) |
| 155 | 169 | ); |
| 156 | 170 | $actions['revoke'] = sprintf( |
| 157 | 171 | '<a href="%s" class="give-revoke-api-key give-delete">%s</a>', |
| 158 | - esc_url( wp_nonce_url( add_query_arg( array( | |
| 159 | - 'user_id' => $item['id'], | |
| 160 | - 'give_action' => 'process_api_key', | |
| 161 | - 'give_api_process' => 'revoke', | |
| 162 | - ) ), 'give-api-nonce' ) ), | |
| 172 | + esc_url( | |
| 173 | + wp_nonce_url( | |
| 174 | + add_query_arg( | |
| 175 | + array( | |
| 176 | + 'user_id' => $item['id'], | |
| 177 | + 'give_action' => 'process_api_key', | |
| 178 | + 'give_api_process' => 'revoke', | |
| 179 | + ) | |
| 180 | + ), | |
| 181 | + 'give-api-nonce' | |
| 182 | + ) | |
| 183 | + ), | |
| 163 | 184 | esc_html__( 'Revoke', 'give' ) |
| 164 | 185 | ); |
| 165 | 186 | |
| 166 | 187 | $actions = apply_filters( 'give_api_row_actions', array_filter( $actions ) ); |
| @@ -282,19 +303,21 @@ | ||
| 282 | 303 | * @since 1.1 |
| 283 | 304 | * @return array |
| 284 | 305 | */ |
| 285 | 306 | public function query() { |
| 286 | - $users = get_users( array( | |
| 287 | - 'meta_value' => 'give_user_secret_key', | |
| 288 | - 'number' => $this->per_page, | |
| 289 | - 'offset' => $this->per_page * ( $this->get_paged() - 1 ), | |
| 290 | - ) ); | |
| 307 | + $users = get_users( | |
| 308 | + array( | |
| 309 | + 'meta_value' => 'give_user_secret_key', | |
| 310 | + 'number' => $this->per_page, | |
| 311 | + 'offset' => $this->per_page * ( $this->get_paged() - 1 ), | |
| 312 | + ) | |
| 313 | + ); | |
| 291 | 314 | $keys = array(); |
| 292 | 315 | |
| 293 | 316 | foreach ( $users as $user ) { |
| 294 | 317 | $keys[ $user->ID ]['id'] = $user->ID; |
| 295 | 318 | $keys[ $user->ID ]['email'] = $user->user_email; |
| 296 | - $keys[ $user->ID ]['user'] = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>'; | |
| 319 | + $keys[ $user->ID ]['user'] = '<a href="' . esc_url( add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) ) . '"><strong>' . $user->user_login . '</strong></a>'; | |
| 297 | 320 | |
| 298 | 321 | $keys[ $user->ID ]['key'] = Give()->api->get_user_public_key( $user->ID ); |
| 299 | 322 | $keys[ $user->ID ]['secret'] = Give()->api->get_user_secret_key( $user->ID ); |
| 300 | 323 | $keys[ $user->ID ]['token'] = Give()->api->get_token( $user->ID ); |
| @@ -351,11 +374,13 @@ | ||
| 351 | 374 | $total_items = $this->total_items(); |
| 352 | 375 | |
| 353 | 376 | $this->items = $data; |
| 354 | 377 | |
| 355 | - $this->set_pagination_args( array( | |
| 356 | - 'total_items' => $total_items, | |
| 357 | - 'per_page' => $this->per_page, | |
| 358 | - 'total_pages' => ceil( $total_items / $this->per_page ), | |
| 359 | - ) ); | |
| 378 | + $this->set_pagination_args( | |
| 379 | + array( | |
| 380 | + 'total_items' => $total_items, | |
| 381 | + 'per_page' => $this->per_page, | |
| 382 | + 'total_pages' => ceil( $total_items / $this->per_page ), | |
| 383 | + ) | |
| 384 | + ); | |
| 360 | 385 | } |
| 361 | 386 | } |