diff options
-rw-r--r-- | phpBB/composer.lock | 9 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 2 | ||||
-rw-r--r-- | phpBB/includes/functions_content.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/textformatter/s9e/factory.php | 5 | ||||
-rw-r--r-- | tests/functional/posting_test.php | 4 | ||||
-rw-r--r-- | tests/text_formatter/s9e/default_formatting_test.php | 19 | ||||
-rw-r--r-- | tests/text_processing/decode_message_test.php | 8 |
7 files changed, 40 insertions, 9 deletions
diff --git a/phpBB/composer.lock b/phpBB/composer.lock index cff4bd6289..74e554f2f0 100644 --- a/phpBB/composer.lock +++ b/phpBB/composer.lock @@ -220,12 +220,12 @@ "source": { "type": "git", "url": "https://github.com/s9e/TextFormatter.git", - "reference": "326a5a0bbaee59a3d5542fc8e38fe41971931cce" + "reference": "beee0e5693f7ca8ed16a94294acf53b6e6207e7c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/s9e/TextFormatter/zipball/326a5a0bbaee59a3d5542fc8e38fe41971931cce", - "reference": "326a5a0bbaee59a3d5542fc8e38fe41971931cce", + "url": "https://api.github.com/repos/s9e/TextFormatter/zipball/beee0e5693f7ca8ed16a94294acf53b6e6207e7c", + "reference": "beee0e5693f7ca8ed16a94294acf53b6e6207e7c", "shasum": "" }, "require": { @@ -253,6 +253,7 @@ "MIT" ], "description": "Multi-purpose text formatting and markup library. Plugins offer support for BBCodes, Markdown, emoticons, HTML, embedding media (YouTube, etc...), enhanced typography and more.", + "homepage": "https://github.com/s9e/TextFormatter/", "keywords": [ "bbcode", "bbcodes", @@ -270,7 +271,7 @@ "parser", "shortcodes" ], - "time": "2015-07-05 23:13:46" + "time": "2015-07-12 16:53:32" }, { "name": "symfony/config", diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 49fd732bb8..d109fe0648 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2749,7 +2749,7 @@ function get_preg_expression($mode) return array( '#<!\-\- e \-\-><a href="mailto:(.*?)">.*?</a><!\-\- e \-\->#', '#<!\-\- l \-\-><a (?:class="[\w-]+" )?href="(.*?)(?:(&|\?)sid=[0-9a-f]{32})?">.*?</a><!\-\- l \-\->#', - '#<!\-\- ([mw]) \-\-><a (?:class="[\w-]+" )?href="(.*?)">.*?</a><!\-\- \1 \-\->#', + '#<!\-\- ([mw]) \-\-><a (?:class="[\w-]+" )?href="(.*?)">(.*?)</a><!\-\- \1 \-\->#', '#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '#<!\-\- .*? \-\->#s', '#<.*?>#s', diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 5cebc54eb2..fd39c61b14 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -420,7 +420,7 @@ function decode_message(&$message, $bbcode_uid = '') $message = str_replace($match, $replace, $message); $match = get_preg_expression('bbcode_htm'); - $replace = array('\1', '\1', '\2', '\1', '', ''); + $replace = array('\1', '\1', '\3', '\1', '', ''); $message = preg_replace($match, $replace, $message); } diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php index 2f6498197f..2aab97b667 100644 --- a/phpBB/phpbb/textformatter/s9e/factory.php +++ b/phpBB/phpbb/textformatter/s9e/factory.php @@ -324,6 +324,11 @@ class factory implements \phpbb\textformatter\cache_interface $configurator->registeredVars['max_img_height'] = 0; $configurator->registeredVars['max_img_width'] = 0; + // Load the Emoji plugin and modify its tag's template to obey viewsmilies + $configurator->Emoji->setImageSize(18); + $tag = $configurator->Emoji->getTag(); + $tag->template = '<xsl:choose><xsl:when test="$S_VIEWSMILIES">' . str_replace('class="emoji"', 'class="smilies"', $tag->template) . '</xsl:when><xsl:otherwise><xsl:value-of select="."/></xsl:otherwise></xsl:choose>'; + /** * Modify the s9e\TextFormatter configurator after the default settings are set * diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php index e9b62c0b6c..724c42b289 100644 --- a/tests/functional/posting_test.php +++ b/tests/functional/posting_test.php @@ -57,9 +57,9 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case $this->login(); $post = $this->create_topic(2, 'Test Topic 1', 'This is a test topic posted by the testing framework.'); - $this->create_post(2, $post['topic_id'], 'Re: Test Topic 1', "This is a test with these weird characters: \xF0\x9F\x88\xB3 \xF0\x9F\x9A\xB6"); + $this->create_post(2, $post['topic_id'], 'Re: Test Topic 1', "This is a test with these weird characters: \xF0\x9F\x84\x90 \xF0\x9F\x84\x91"); $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); - $this->assertContains("\xF0\x9F\x88\xB3 \xF0\x9F\x9A\xB6", $crawler->text()); + $this->assertContains("\xF0\x9F\x84\x90 \xF0\x9F\x84\x91", $crawler->text()); } public function test_html_entities() diff --git a/tests/text_formatter/s9e/default_formatting_test.php b/tests/text_formatter/s9e/default_formatting_test.php index c67976301f..390bc65264 100644 --- a/tests/text_formatter/s9e/default_formatting_test.php +++ b/tests/text_formatter/s9e/default_formatting_test.php @@ -29,7 +29,7 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case /** * @dataProvider get_default_formatting_tests */ - public function test_default_formatting($original, $expected) + public function test_default_formatting($original, $expected, $setup = null) { $fixture = __DIR__ . '/fixtures/default_formatting.xml'; $container = $this->get_test_case_helpers()->set_s9e_services(null, $fixture); @@ -37,6 +37,11 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case $parser = $container->get('text_formatter.parser'); $renderer = $container->get('text_formatter.renderer'); + if (isset($setup)) + { + call_user_func($setup, $container); + } + $parsed_text = $parser->parse($original); $this->assertSame($expected, $renderer->render($parsed_text)); @@ -263,6 +268,18 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case '[quote=\'[quote="foo"]\']...[/quote]', '<blockquote><div><cite>[quote="foo"] wrote:</cite>...</div></blockquote>' ), + array( + "Emoji: \xF0\x9F\x98\x80", + 'Emoji: <img alt="' . "\xF0\x9F\x98\x80" . '" class="smilies" draggable="false" width="18" height="18" src="//twemoji.maxcdn.com/36x36/1f600.png">' + ), + array( + "Emoji: \xF0\x9F\x98\x80", + "Emoji: \xF0\x9F\x98\x80", + function ($container) + { + $container->get('text_formatter.renderer')->set_viewsmilies(false); + } + ), ); } } diff --git a/tests/text_processing/decode_message_test.php b/tests/text_processing/decode_message_test.php index c9c1da52d5..7de599f2b1 100644 --- a/tests/text_processing/decode_message_test.php +++ b/tests/text_processing/decode_message_test.php @@ -38,6 +38,14 @@ class phpbb_text_processing_decode_message_test extends phpbb_test_case '<!-- s:) --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!-- s:) -->', ':)' ), + array( + '<!-- w --><a class="postlink" href="http://www.phpbb.com">www.phpbb.com</a><!-- w -->', + 'www.phpbb.com' + ), + array( + '<!-- m --><a class="postlink" href="http://www.phpbb.com">http://www.phpbb.com</a><!-- m -->', + 'http://www.phpbb.com' + ), /** * Fails as per PHPBB3-8420 * @link http://tracker.phpbb.com/browse/PHPBB3-8420 |