From 0e5b099287539736f8a906b75a030441afa4918c Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 26 Apr 2013 01:00:13 +0200 Subject: [PATCH] FIX Unquoted shortcodes weren't parsed (fixes #680) Since that used to be the default shortcode notation for our core "insert media" functionality, its important to have this fixed and keep supporting "legacy" content created with 3.0. --- parsers/ShortcodeParser.php | 2 +- tests/parsers/ShortcodeParserTest.php | 8 ++++---- thirdparty/tinymce_ssbuttons/editor_plugin_src.js | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/parsers/ShortcodeParser.php b/parsers/ShortcodeParser.php index 3a17d9bed..9780e51d6 100644 --- a/parsers/ShortcodeParser.php +++ b/parsers/ShortcodeParser.php @@ -151,7 +151,7 @@ class ShortcodeParser { (?: (?:\'([^\']+)\') | # Value surrounded by \' (?:"([^"]+)") | # Value surrounded by " - (\w+) # Bare value + ([^\s,\]]+) # Bare value ) '; diff --git a/tests/parsers/ShortcodeParserTest.php b/tests/parsers/ShortcodeParserTest.php index d90b870bc..1f519fa98 100644 --- a/tests/parsers/ShortcodeParserTest.php +++ b/tests/parsers/ShortcodeParserTest.php @@ -150,13 +150,13 @@ class ShortcodeParserTest extends SapphireTest { } public function testUnquotedArguments() { - $this->assertEquals('', $this->parser->parse('[test_shortcode,foo=bar,baz = buz]')); - $this->assertEquals(array('foo' => 'bar', 'baz' => 'buz'), $this->arguments); + $this->assertEquals('', $this->parser->parse('[test_shortcode,foo=bar!,baz = buz123]')); + $this->assertEquals(array('foo' => 'bar!', 'baz' => 'buz123'), $this->arguments); } public function testSpacesForDelimiter() { - $this->assertEquals('', $this->parser->parse('[test_shortcode foo=bar baz = buz]')); - $this->assertEquals(array('foo' => 'bar', 'baz' => 'buz'), $this->arguments); + $this->assertEquals('', $this->parser->parse('[test_shortcode foo=bar! baz = buz123]')); + $this->assertEquals(array('foo' => 'bar!', 'baz' => 'buz123'), $this->arguments); } public function testSelfClosingTag() { diff --git a/thirdparty/tinymce_ssbuttons/editor_plugin_src.js b/thirdparty/tinymce_ssbuttons/editor_plugin_src.js index 6169922c6..aad2f3cb7 100644 --- a/thirdparty/tinymce_ssbuttons/editor_plugin_src.js +++ b/thirdparty/tinymce_ssbuttons/editor_plugin_src.js @@ -62,10 +62,10 @@ var content = jQuery(o.content); content.find('.ss-htmleditorfield-file.embed').each(function() { var el = jQuery(this); - var shortCode = '[embed width=' + el.data('width') - + ' height=' + el.data('height') - + ' class=' + el.data('cssclass') - + ' thumbnail=' + el.data('thumbnail') + var shortCode = '[embed width="' + el.data('width') + '"' + + ' height="' + el.data('height') + '"' + + ' class="' + el.data('cssclass') + '"' + + ' thumbnail="' + el.data('thumbnail') + '"' + ']' + el.data('url') + '[/embed]'; el.replaceWith(shortCode);