web/wp-includes/shortcodes.php
changeset 204 09a1c134465b
parent 194 32102edaa81b
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
   175 	global $shortcode_tags;
   175 	global $shortcode_tags;
   176 	$tagnames = array_keys($shortcode_tags);
   176 	$tagnames = array_keys($shortcode_tags);
   177 	$tagregexp = join( '|', array_map('preg_quote', $tagnames) );
   177 	$tagregexp = join( '|', array_map('preg_quote', $tagnames) );
   178 
   178 
   179 	// WARNING! Do not change this regex without changing do_shortcode_tag() and strip_shortcode_tag()
   179 	// WARNING! Do not change this regex without changing do_shortcode_tag() and strip_shortcode_tag()
       
   180 	// Also, see shortcode_unautop() and shortcode.js.
   180 	return
   181 	return
   181 		  '\\['                              // Opening bracket
   182 		  '\\['                              // Opening bracket
   182 		. '(\\[?)'                           // 1: Optional second opening bracket for escaping shortcodes: [[tag]]
   183 		. '(\\[?)'                           // 1: Optional second opening bracket for escaping shortcodes: [[tag]]
   183 		. "($tagregexp)"                     // 2: Shortcode name
   184 		. "($tagregexp)"                     // 2: Shortcode name
   184 		. '\\b'                              // Word boundary
   185 		. '(?![\\w-])'                       // Not followed by word character or hyphen
   185 		. '('                                // 3: Unroll the loop: Inside the opening shortcode tag
   186 		. '('                                // 3: Unroll the loop: Inside the opening shortcode tag
   186 		.     '[^\\]\\/]*'                   // Not a closing bracket or forward slash
   187 		.     '[^\\]\\/]*'                   // Not a closing bracket or forward slash
   187 		.     '(?:'
   188 		.     '(?:'
   188 		.         '\\/(?!\\])'               // A forward slash not followed by a closing bracket
   189 		.         '\\/(?!\\])'               // A forward slash not followed by a closing bracket
   189 		.         '[^\\]\\/]*'               // Not a closing bracket or forward slash
   190 		.         '[^\\]\\/]*'               // Not a closing bracket or forward slash