Changeset 33118
- Timestamp:
- 07/07/2015 11:58:49 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/shortcodes.php
r32867 r33118 310 310 function shortcode_parse_atts($text) { 311 311 $atts = array(); 312 $pattern = '/( \w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/';312 $pattern = '/([\w-]+)\s*=\s*"([^"]*)"(?:\s|$)|([\w-]+)\s*=\s*\'([^\']*)\'(?:\s|$)|([\w-]+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/'; 313 313 $text = preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $text); 314 314 if ( preg_match_all($pattern, $text, $match, PREG_SET_ORDER) ) { -
trunk/tests/phpunit/tests/shortcode.php
r31622 r33118 120 120 } 121 121 122 /** 123 * @ticket 9405 124 */ 125 function test_attr_hyphen() { 126 do_shortcode('[test-shortcode-tag foo="foo" foo-bar="foo-bar" foo-bar-="foo-bar-" -foo-bar="-foo-bar" -foo-bar-="-foo-bar-" foo-bar-baz="foo-bar-baz" -foo-bar-baz="-foo-bar-baz" foo--bar="foo--bar" /]'); 127 $expected_attrs = array( 128 'foo' => 'foo', 129 'foo-bar' => 'foo-bar', 130 'foo-bar-' => 'foo-bar-', 131 '-foo-bar' => '-foo-bar', 132 '-foo-bar-' => '-foo-bar-', 133 'foo-bar-baz' => 'foo-bar-baz', 134 '-foo-bar-baz' => '-foo-bar-baz', 135 'foo--bar' => 'foo--bar', 136 ); 137 $this->assertEquals( $expected_attrs, $this->atts ); 138 } 139 122 140 function test_two_atts() { 123 141 do_shortcode('[test-shortcode-tag foo="asdf" bar="bing" /]');
Note: See TracChangeset
for help on using the changeset viewer.