bbp_admin_repair_list( $type = 'repair' )
Get the array of the repairs to show in a list table.
Description Description
Uses known filters to reduce the registered results down to the most finite set of tools.
Return Return
(array) Repair list of options
Source Source
File: includes/admin/tools/common.php
function bbp_admin_repair_list( $type = 'repair' ) {
// Define empty array
$repair_list = array();
// Get the available tools
$list = bbp_get_admin_repair_tools( $type );
// Get pending upgrades
$pending = bbp_get_pending_upgrades();
// Search
$search = ! empty( $_GET['s'] )
? stripslashes( $_GET['s'] )
: '';
// Status
$status = ! empty( $_GET['status'] )
? sanitize_key( $_GET['status'] )
: '';
// Overhead
$overhead = ! empty( $_GET['overhead'] )
? sanitize_key( $_GET['overhead'] )
: '';
// Component
$component = ! empty( $_GET['components'] )
? sanitize_key( $_GET['components'] )
: '';
// Version
$version = ! empty( $_GET['version'] )
? sanitize_text_field( $_GET['version'] )
: '';
// Orderby
$orderby = ! empty( $_GET['orderby'] )
? sanitize_key( $_GET['orderby'] )
: 'priority';
// Order
$order = ! empty( $_GET['order'] ) && in_array( strtolower( $_GET['order'] ), array( 'asc', 'desc' ), true )
? strtolower( $_GET['order'] )
: 'asc';
// Overhead filter
if ( ! empty( $overhead ) ) {
$list = wp_list_filter( $list, array( 'overhead' => $overhead ) );
}
if ( count( $list ) ) {
// Loop through and key by priority for sorting
foreach ( $list as $id => $tool ) {
// Status filter
if ( ! empty( $status ) && ( 'pending' === $status ) ) {
if ( ! in_array( $id, (array) $pending, true ) ) {
continue;
}
}
// Component filter
if ( ! empty( $component ) ) {
if ( ! in_array( $component, (array) $tool['components'], true ) ) {
continue;
}
}
// Version filter
if ( ! empty( $version ) ) {
if ( ! in_array( $version, (array) $tool['version'], true ) ) {
continue;
}
}
// Search
if ( ! empty( $search ) ) {
if ( ! strstr( strtolower( $tool['title'] ), strtolower( $search ) ) ) {
continue;
}
}
// Add to repair list
$repair_list[ $tool['priority'] ] = array(
'id' => sanitize_key( $id ),
'type' => $tool['type'],
'title' => $tool['title'],
'priority' => $tool['priority'],
'description' => $tool['description'],
'callback' => $tool['callback'],
'overhead' => $tool['overhead'],
'version' => $tool['version'],
'components' => $tool['components']
);
}
}
// Sort
$retval = wp_list_sort( $repair_list, $orderby, $order, true );
// Filter & return
return (array) apply_filters( 'bbp_repair_list', $retval );
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |