Gruby refaktor

This commit is contained in:
2026-02-05 12:06:38 +01:00
parent 998f4348f3
commit af828068a9
18 changed files with 3093 additions and 2696 deletions
+33
View File
@@ -0,0 +1,33 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Add GPX support to WordPress Media Library.
*
* @param array $mimes Allowed mime types.
* @return array Modified mime types.
*/
function mystat_add_gpx_mime_type( $mimes ) {
$mimes['gpx'] = 'application/gpx+xml';
return $mimes;
}
/**
* Bypasses WordPress's strict file type check for GPX files.
* This is needed because WordPress can be overly cautious with XML-based files.
*
* @param array $data File data.
* @param string $file Full path to the file.
* @param string $filename The filename.
* @param array $mimes Mime types.
* @return array Modified file data.
*/
function mystat_fix_gpx_upload_permission( $data, $file, $filename, $mimes ) {
if ( strtolower( pathinfo( $filename, PATHINFO_EXTENSION ) ) === 'gpx' ) {
$data['ext'] = 'gpx';
$data['type'] = 'application/gpx+xml';
}
return $data;
}