(%s)', esc_html( $label_plural ) . ' (%s)' )
);
}
// quit without changes if no new options
if ( empty( $new_mime_types ) ) {
return $mime_types;
}
// sort if more than 1 option
if ( 1 < count( $new_mime_types ) ) {
// create type=>label array for easy sorting
$type_labels = array();
foreach( $new_mime_types as $type => $data ) {
$type_labels[ $type ] = $data[0];
}
// sort labels case-insensitive in natural order
natcasesort( $type_labels );
// rebuild options in sorted order
$sorted_mime_types = array();
foreach( array_keys( $type_labels ) as $mtype ) {
foreach( $new_mime_types as $type => $data ) {
if ( $type == $mtype ) {
$sorted_mime_types[ $type ] = $data;
break;
}
}
}
// return sorted options
return array_merge( $mime_types, $sorted_mime_types );
} else {
// return options
return array_merge( $mime_types, $new_mime_types );
}
}
/**
* Loads the translation file
*
* @since 1.0.0
* @access public
*/
public function load_plugin_textdomain() {
load_plugin_textdomain(
'all-mime-type-options',
false,
dirname( plugin_basename( __FILE__ ) ) . '/languages/'
);
}
/**
* Shortens filter menu visually if long option labels on media library page
*
* @since 1.0.0
* @access public
*/
public function print_css() {
echo '';
print "\n";
}
}
// create class instance
$amto_all_mime_type_options = new All_Mime_Type_Options();