wp/wp-includes/shortcodes.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 21 48c4eec2b7e6
--- a/wp/wp-includes/shortcodes.php	Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-includes/shortcodes.php	Wed Sep 21 18:19:35 2022 +0200
@@ -64,15 +64,25 @@
 	global $shortcode_tags;
 
 	if ( '' === trim( $tag ) ) {
-		$message = __( 'Invalid shortcode name: Empty name given.' );
-		_doing_it_wrong( __FUNCTION__, $message, '4.4.0' );
+		_doing_it_wrong(
+			__FUNCTION__,
+			__( 'Invalid shortcode name: Empty name given.' ),
+			'4.4.0'
+		);
 		return;
 	}
 
 	if ( 0 !== preg_match( '@[<>&/\[\]\x00-\x20=]@', $tag ) ) {
-		/* translators: 1: Shortcode name, 2: Space-separated list of reserved characters. */
-		$message = sprintf( __( 'Invalid shortcode name: %1$s. Do not use spaces or reserved characters: %2$s' ), $tag, '& / < > [ ] =' );
-		_doing_it_wrong( __FUNCTION__, $message, '4.4.0' );
+		_doing_it_wrong(
+			__FUNCTION__,
+			sprintf(
+				/* translators: 1: Shortcode name, 2: Space-separated list of reserved characters. */
+				__( 'Invalid shortcode name: %1$s. Do not use spaces or reserved characters: %2$s' ),
+				$tag,
+				'& / < > [ ] ='
+			),
+			'4.4.0'
+		);
 		return;
 	}
 
@@ -252,7 +262,7 @@
 	if ( empty( $tagnames ) ) {
 		$tagnames = array_keys( $shortcode_tags );
 	}
-	$tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) );
+	$tagregexp = implode( '|', array_map( 'preg_quote', $tagnames ) );
 
 	// WARNING! Do not change this regex without changing do_shortcode_tag() and strip_shortcode_tag().
 	// Also, see shortcode_unautop() and shortcode.js.
@@ -292,15 +302,15 @@
 /**
  * Regular Expression callable for do_shortcode() for calling shortcode hook.
  *
- * @see get_shortcode_regex for details of the match array contents.
+ * @see get_shortcode_regex() for details of the match array contents.
  *
  * @since 2.5.0
  * @access private
  *
  * @global array $shortcode_tags
  *
- * @param array $m Regular expression match array
- * @return string|false False on failure.
+ * @param array $m Regular expression match array.
+ * @return string|false Shortcode output on success, false on failure.
  */
 function do_shortcode_tag( $m ) {
 	global $shortcode_tags;
@@ -314,9 +324,12 @@
 	$attr = shortcode_parse_atts( $m[3] );
 
 	if ( ! is_callable( $shortcode_tags[ $tag ] ) ) {
-		/* translators: %s: Shortcode tag. */
-		$message = sprintf( __( 'Attempting to parse a shortcode without a valid callback: %s' ), $tag );
-		_doing_it_wrong( __FUNCTION__, $message, '4.3.0' );
+		_doing_it_wrong(
+			__FUNCTION__,
+			/* translators: %s: Shortcode tag. */
+			sprintf( __( 'Attempting to parse a shortcode without a valid callback: %s' ), $tag ),
+			'4.3.0'
+		);
 		return $m[0];
 	}