WC_Helper::_filter()
Filter an array of subscriptions by $filter.
Method of the class: WC_Helper{}
No Hooks.
Return
null
. Nothing (null).
Usage
$result = WC_Helper::_filter( $subscriptions, $filter );
- $subscriptions(array) (required) (passed by reference — &)
- The subscriptions array, passed by ref.
- $filter(string) (required)
- The filter.
WC_Helper::_filter() WC Helper:: filter code WC 9.2.3
private static function _filter( &$subscriptions, $filter ) { switch ( $filter ) { case 'active': $subscriptions = wp_list_filter( $subscriptions, array( 'active' => true ) ); break; case 'inactive': $subscriptions = wp_list_filter( $subscriptions, array( 'active' => false ) ); break; case 'installed': foreach ( $subscriptions as $key => $subscription ) { if ( empty( $subscription['local']['installed'] ) ) { unset( $subscriptions[ $key ] ); } } break; case 'update-available': $subscriptions = wp_list_filter( $subscriptions, array( 'has_update' => true ) ); break; case 'expiring': $subscriptions = wp_list_filter( $subscriptions, array( 'expiring' => true ) ); break; case 'expired': $subscriptions = wp_list_filter( $subscriptions, array( 'expired' => true ) ); break; case 'download': foreach ( $subscriptions as $key => $subscription ) { if ( $subscription['local']['installed'] || $subscription['expired'] ) { unset( $subscriptions[ $key ] ); } } break; } }