From 3e9b80d5ef7e90cc37adfe4617bb163ef1a1e15b Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 19 Feb 2008 06:52:30 +0000 Subject: [PATCH] Support positional attributes in shortcodes. Props tellyworth. fixes #5914 git-svn-id: http://svn.automattic.com/wordpress/trunk@6911 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/shortcodes.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-includes/shortcodes.php b/wp-includes/shortcodes.php index a51255cac9..1913d0f103 100644 --- a/wp-includes/shortcodes.php +++ b/wp-includes/shortcodes.php @@ -97,7 +97,7 @@ function do_shortcode_tag($m) { function shortcode_parse_atts($text) { $atts = array(); - $pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)/'; + $pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/'; if ( preg_match_all($pattern, $text, $match, PREG_SET_ORDER) ) { foreach ($match as $m) { if (!empty($m[1])) @@ -106,6 +106,10 @@ function shortcode_parse_atts($text) { $atts[strtolower($m[3])] = stripcslashes($m[4]); elseif (!empty($m[5])) $atts[strtolower($m[5])] = stripcslashes($m[6]); + elseif (isset($m[7]) and strlen($m[7])) + $atts[] = stripcslashes($m[7]); + elseif (isset($m[8])) + $atts[] = stripcslashes($m[8]); } } return $atts;