Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



_get_wptexturize_shortcode_regex ›

Seit4.4.0
Veraltetn/v
_get_wptexturize_shortcode_regex ( $tagnames )
Zugriff:
  • private
Parameter:
  • (array) $tagnames List of shortcodes to find.
    Erforderlich: Ja
Gibt zurück:
  • (string) The regular expression
Definiert in:
Codex:

Retrieve the regular expression for shortcodes.



Quellcode

function _get_wptexturize_shortcode_regex( $tagnames ) {
	$tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) );
	$tagregexp = "(?:$tagregexp)(?=[\\s\\]\\/])"; // Excerpt of get_shortcode_regex().
	// phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound -- don't remove regex indentation
	$regex =
		'\['              // Find start of shortcode.
		. '[\/\[]?'         // Shortcodes may begin with [/ or [[
		. $tagregexp        // Only match registered shortcodes, because performance.
		. '(?:'
		.     '[^\[\]<>]+'  // Shortcodes do not contain other shortcodes. Quantifier critical.
		. '|'
		.     '<[^\[\]>]*>' // HTML elements permitted. Prevents matching ] before >.
		. ')*+'             // Possessive critical.
		. '\]'              // Find end of shortcode.
		. '\]?';            // Shortcodes may end with ]]
	// phpcs:enable

	return $regex;
}