wp/wp-includes/l10n.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
--- a/wp/wp-includes/l10n.php	Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-includes/l10n.php	Wed Sep 21 18:19:35 2022 +0200
@@ -31,13 +31,7 @@
 	global $locale, $wp_local_package;
 
 	if ( isset( $locale ) ) {
-		/**
-		 * Filters the locale ID of the WordPress installation.
-		 *
-		 * @since 1.5.0
-		 *
-		 * @param string $locale The locale ID.
-		 */
+		/** This filter is documented in wp-includes/l10n.php */
 		return apply_filters( 'locale', $locale );
 	}
 
@@ -76,7 +70,13 @@
 		$locale = 'en_US';
 	}
 
-	/** This filter is documented in wp-includes/l10n.php */
+	/**
+	 * Filters the locale ID of the WordPress installation.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $locale The locale ID.
+	 */
 	return apply_filters( 'locale', $locale );
 }
 
@@ -934,9 +934,9 @@
  * @since 1.5.0
  * @since 4.6.0 The function now tries to load the .mo file from the languages directory first.
  *
- * @param string $domain Text domain. Unique identifier for retrieving translated strings.
- * @param string $path   Optional. Path to the directory containing the .mo file.
- *                       Default false.
+ * @param string       $domain Text domain. Unique identifier for retrieving translated strings.
+ * @param string|false $path   Optional. Path to the directory containing the .mo file.
+ *                             Default false.
  * @return bool True when textdomain is successfully loaded, false otherwise.
  */
 function load_theme_textdomain( $domain, $path = false ) {
@@ -974,9 +974,9 @@
  *
  * @since 2.9.0
  *
- * @param string $domain Text domain. Unique identifier for retrieving translated strings.
- * @param string $path   Optional. Path to the directory containing the .mo file.
- *                       Default false.
+ * @param string       $domain Text domain. Unique identifier for retrieving translated strings.
+ * @param string|false $path   Optional. Path to the directory containing the .mo file.
+ *                             Default false.
  * @return bool True when the theme textdomain is successfully loaded, false otherwise.
  */
 function load_child_theme_textdomain( $domain, $path = false ) {
@@ -998,8 +998,8 @@
  * @param string $handle Name of the script to register a translation domain to.
  * @param string $domain Optional. Text domain. Default 'default'.
  * @param string $path   Optional. The full file path to the directory containing translation files.
- * @return string|false False if the script textdomain could not be loaded, the translated strings
- *                      in JSON encoding otherwise.
+ * @return string|false The translated strings in JSON encoding on success,
+ *                      false if the script textdomain could not be loaded.
  */
 function load_script_textdomain( $handle, $domain = 'default', $path = null ) {
 	$wp_scripts = wp_scripts();
@@ -1040,7 +1040,7 @@
 	// If the host is the same or it's a relative URL.
 	if (
 		( ! isset( $content_url['path'] ) || strpos( $src_url['path'], $content_url['path'] ) === 0 ) &&
-		( ! isset( $src_url['host'] ) || $src_url['host'] === $content_url['host'] )
+		( ! isset( $src_url['host'] ) || ! isset( $content_url['host'] ) || $src_url['host'] === $content_url['host'] )
 	) {
 		// Make the src relative the specific plugin or theme.
 		if ( isset( $content_url['path'] ) ) {
@@ -1057,7 +1057,7 @@
 		$relative = implode( '/', $relative );
 	} elseif (
 		( ! isset( $plugins_url['path'] ) || strpos( $src_url['path'], $plugins_url['path'] ) === 0 ) &&
-		( ! isset( $src_url['host'] ) || $src_url['host'] === $plugins_url['host'] )
+		( ! isset( $src_url['host'] ) || ! isset( $plugins_url['host'] ) || $src_url['host'] === $plugins_url['host'] )
 	) {
 		// Make the src relative the specific plugin.
 		if ( isset( $plugins_url['path'] ) ) {
@@ -1072,7 +1072,7 @@
 
 		$relative = array_slice( $relative, 1 ); // Remove <plugin name>.
 		$relative = implode( '/', $relative );
-	} elseif ( ! isset( $src_url['host'] ) || $src_url['host'] === $site_url['host'] ) {
+	} elseif ( ! isset( $src_url['host'] ) || ! isset( $site_url['host'] ) || $src_url['host'] === $site_url['host'] ) {
 		if ( ! isset( $site_url['path'] ) ) {
 			$relative = trim( $src_url['path'], '/' );
 		} elseif ( ( strpos( $src_url['path'], trailingslashit( $site_url['path'] ) ) === 0 ) ) {
@@ -1129,7 +1129,8 @@
  * @param string|false $file   Path to the translation file to load. False if there isn't one.
  * @param string       $handle Name of the script to register a translation domain to.
  * @param string       $domain The text domain.
- * @return string|false The JSON-encoded translated strings for the given script handle and text domain. False if there are none.
+ * @return string|false The JSON-encoded translated strings for the given script handle and text domain.
+ *                      False if there are none.
  */
 function load_script_translations( $file, $handle, $domain ) {
 	/**
@@ -1617,7 +1618,7 @@
 
 	// Combine the output string.
 	$output  = sprintf( '<select name="%s" id="%s">', esc_attr( $parsed_args['name'] ), esc_attr( $parsed_args['id'] ) );
-	$output .= join( "\n", $structure );
+	$output .= implode( "\n", $structure );
 	$output .= '</select>';
 
 	if ( $parsed_args['echo'] ) {