diff --git a/src/wp-includes/class-wp-textdomain-registry.php b/src/wp-includes/class-wp-textdomain-registry.php
index 99d72eb7a3..8450bb672c 100644
a
|
b
|
class WP_Textdomain_Registry { |
226 | 226 | private function set_cached_mo_files( $path ) { |
227 | 227 | $this->cached_mo_files[ $path ] = array(); |
228 | 228 | |
229 | | $mo_files = glob( $path . '/*.mo' ); |
| 229 | /** |
| 230 | * Filters the .mo files retrieved from a specified path. |
| 231 | * |
| 232 | * This filter allows you to change the way .mo files are fetched from a given path. |
| 233 | * This can be useful in situations where the directory contains a large number of files |
| 234 | * and the default glob() function becomes expensive in terms of performance. |
| 235 | * |
| 236 | * @since TBD |
| 237 | * |
| 238 | * @param null|array $mo_files Null by default, allowing the usual glob() function to run. If a non-null value |
| 239 | * is returned by the filter, this value is used instead of running glob(). |
| 240 | * Should be an array of .mo files if not null. |
| 241 | * @param string $path The path from which .mo files are being fetched. |
| 242 | **/ |
| 243 | $mo_files = apply_filters( 'get_mo_files_from_path', null, $path ); |
| 244 | if ( null === $mo_files ) { |
| 245 | $mo_files = glob( $path . '/*.mo' ); |
| 246 | } |
230 | 247 | |
231 | 248 | if ( $mo_files ) { |
232 | 249 | $this->cached_mo_files[ $path ] = $mo_files; |