30 $accepts = explode(
',', $accept );
33 foreach ( $accepts as $i => $a ) {
34 if ( !preg_match(
'!^([^\s/;]+)/([^;\s]+)\s*(?:;(.*))?$!D', trim( $a ),
$matches ) ) {
42 foreach ( $kvps as $kv ) {
43 [ $key, $val ] = explode(
'=', trim( $kv ), 2 );
44 $key = strtolower( trim( $key ) );
49 if ( $val && $val[0] ===
'"' && $val[ strlen( $val ) - 1 ] ===
'"' ) {
50 $val = substr( $val, 1, strlen( $val ) - 2 );
66 usort( $ret,
static function ( $a, $b ) {
67 if ( $b[
'q'] > $a[
'q'] ) {
69 } elseif ( $b[
'q'] === $a[
'q'] ) {
70 return $a[
'i'] - $b[
'i'];