Make WordPress Core

Ticket #38788: 38788.diff

File 38788.diff, 1.1 KB (added by yoavf, 9 years ago)
  • wp-includes/l10n.php

     
    947947 * The default directory is WP_LANG_DIR.
    948948 *
    949949 * @since 3.0.0
     950 * @since 4.7.0 The results are now filtrable.
    950951 *
    951952 * @param string $dir A directory to search for language files.
    952953 *                    Default WP_LANG_DIR.
     
    955956function get_available_languages( $dir = null ) {
    956957        $languages = array();
    957958
    958         $lang_files = glob( ( is_null( $dir) ? WP_LANG_DIR : $dir ) . '/*.mo' );
     959        $lang_files = glob( ( is_null( $dir ) ? WP_LANG_DIR : $dir ) . '/*.mo' );
    959960        if ( $lang_files ) {
    960961                foreach ( $lang_files as $lang_file ) {
    961962                        $lang_file = basename( $lang_file, '.mo' );
     
    966967                }
    967968        }
    968969
    969         return $languages;
     970        /**
     971         * Filters the list of available language codes
     972         *
     973         * @since 4.7.0
     974         *
     975         * @param array $languages An array of language codes or an empty array.
     976         * @param string $dir A directory to search for language files.
     977         */
     978        return apply_filters( 'get_available_languages', $languages, $dir );
    970979}
    971980
    972981/**