$on ) { if ( ! $on && ! empty( $input[ $id ] ) ) { $forced[] = $id; } } wp_safe_redirect( add_query_arg( array( 'page' => self::PAGE, 'updated' => 1, 'forced' => implode( ',', $forced ), ), admin_url( 'admin.php' ) ) ); exit; } /** * Modules sorted into the groups of the Settings side menu. * * @return array group label => array( id => manifest ). */ public static function grouped() { $labels = SettingsPage::group_labels(); $grouped = array(); $all = Modules::all(); foreach ( SettingsPage::GROUPS as $group => $ids ) { foreach ( $ids as $id ) { if ( isset( $all[ $id ] ) ) { $grouped[ $labels[ $group ] ][ $id ] = $all[ $id ]; unset( $all[ $id ] ); } } } if ( $all ) { $grouped[ $labels['more'] ] = $all; } return $grouped; } public function render() { if ( ! current_user_can( 'manage_woocommerce' ) ) { return; } $switches = Modules::switches(); // phpcs:disable WordPress.Security.NonceVerification.Recommended $updated = ! empty( $_GET['updated'] ); $forced = isset( $_GET['forced'] ) ? array_filter( explode( ',', sanitize_text_field( wp_unslash( $_GET['forced'] ) ) ) ) : array(); // phpcs:enable ?>