| @@ -93,4 +93,21 @@ | ||
| 93 | 93 | $sitemap_entry['loc'] = equivalent_wp_url( $sitemap_entry['loc'] ); |
| 94 | 94 | |
| 95 | 95 | return $sitemap_entry; |
| 96 | 96 | } |
| 97 | + | |
| 98 | +/** | |
| 99 | + * Check if a string has a file extension. | |
| 100 | + * | |
| 101 | + * @param string $string The string to check. | |
| 102 | + * @return boolean | |
| 103 | + */ | |
| 104 | +function has_file_extension( $string ) { | |
| 105 | + $file_extension_pattern = '/\.[a-zA-Z0-9]+$/'; | |
| 106 | + | |
| 107 | + if ( preg_match( $file_extension_pattern, $string ) ) { | |
| 108 | + return true; | |
| 109 | + } else { | |
| 110 | + return false; // String does not have a file extension. | |
| 111 | + } | |
| 112 | +} | |
| 113 | + | |