Merge pull request #16957 from woocommerce/helper-filter-installed

Helper: Add a new filter to display only installed extensions
This commit is contained in:
Mike Jolley 2017-09-27 16:32:39 +01:00 committed by GitHub
commit f73acaab33
1 changed files with 9 additions and 0 deletions

View File

@ -330,6 +330,7 @@ class WC_Helper {
'all' => __( 'All', 'woocommerce' ), 'all' => __( 'All', 'woocommerce' ),
'active' => __( 'Active', 'woocommerce' ), 'active' => __( 'Active', 'woocommerce' ),
'inactive' => __( 'Inactive', 'woocommerce' ), 'inactive' => __( 'Inactive', 'woocommerce' ),
'installed' => __( 'Installed', 'woocommerce' ),
'update-available' => __( 'Update Available', 'woocommerce' ), 'update-available' => __( 'Update Available', 'woocommerce' ),
'expiring' => __( 'Expiring Soon', 'woocommerce' ), 'expiring' => __( 'Expiring Soon', 'woocommerce' ),
'expired' => __( 'Expired', 'woocommerce' ), 'expired' => __( 'Expired', 'woocommerce' ),
@ -399,6 +400,14 @@ class WC_Helper {
$subscriptions = wp_list_filter( $subscriptions, array( 'active' => false ) ); $subscriptions = wp_list_filter( $subscriptions, array( 'active' => false ) );
break; break;
case 'installed':
foreach ( $subscriptions as $key => $subscription ) {
if ( empty( $subscription['local']['installed'] ) ) {
unset( $subscriptions[ $key ] );
}
}
break;
case 'update-available': case 'update-available':
$subscriptions = wp_list_filter( $subscriptions, array( 'has_update' => true ) ); $subscriptions = wp_list_filter( $subscriptions, array( 'has_update' => true ) );
break; break;