diff --git a/phpBB/composer.json b/phpBB/composer.json index dff91be482..80de236511 100644 --- a/phpBB/composer.json +++ b/phpBB/composer.json @@ -35,7 +35,7 @@ "marc1706/fast-image-size": "^1.1", "paragonie/random_compat": "^1.4", "patchwork/utf8": "^1.1", - "s9e/text-formatter": "~0.11.0", + "s9e/text-formatter": "~0.13.0", "symfony/config": "~3.1", "symfony/console": "~3.1", "symfony/debug": "~3.1", diff --git a/phpBB/composer.lock b/phpBB/composer.lock index 83ba3f7c7f..12bfa61780 100644 --- a/phpBB/composer.lock +++ b/phpBB/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "9261bee54d8a45fece3e7c83db74e1e0", - "content-hash": "725640e42155cd1f599ef3cc504ee22f", + "hash": "8e1c75ec0aaf938fb328165209dbb9e2", + "content-hash": "aa8d6a47717887456a0066a1320811e0", "packages": [ { "name": "bantu/ini-get-wrapper", @@ -1143,27 +1143,27 @@ }, { "name": "s9e/text-formatter", - "version": "0.11.2", + "version": "0.13.1", "source": { "type": "git", "url": "https://github.com/s9e/TextFormatter.git", - "reference": "735a56076e29348d838ce6c2658996daae86718f" + "reference": "804ed8fdfa9fd0c8d99f5a33000d4f7e5ed90c6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/s9e/TextFormatter/zipball/735a56076e29348d838ce6c2658996daae86718f", - "reference": "735a56076e29348d838ce6c2658996daae86718f", + "url": "https://api.github.com/repos/s9e/TextFormatter/zipball/804ed8fdfa9fd0c8d99f5a33000d4f7e5ed90c6f", + "reference": "804ed8fdfa9fd0c8d99f5a33000d4f7e5ed90c6f", "shasum": "" }, "require": { "ext-dom": "*", "ext-filter": "*", "lib-pcre": ">=7.2", - "php": ">=5.3.3" + "php": ">=5.4.7" }, "require-dev": { "matthiasmullie/minify": "*", - "php": ">=5.3.3", + "php": ">=5.4.7", "s9e/regexp-builder": ">=1.3.0" }, "suggest": { @@ -1204,7 +1204,7 @@ "parser", "shortcodes" ], - "time": "2017-10-02 16:58:51" + "time": "2017-12-10 00:55:53" }, { "name": "seld/cli-prompt", diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php index 5b1c89c4db..1e85856898 100644 --- a/phpBB/phpbb/textformatter/s9e/factory.php +++ b/phpBB/phpbb/textformatter/s9e/factory.php @@ -266,7 +266,8 @@ class factory implements \phpbb\textformatter\cache_interface ->addParameterByName('logger') ->addParameterByName('max_img_height') ->addParameterByName('max_img_width') - ->markAsSafeAsURL(); + ->markAsSafeAsURL() + ->setJS('UrlFilter.filter'); // Add default BBCodes foreach ($this->get_default_bbcodes($configurator) as $bbcode) @@ -355,8 +356,6 @@ class factory implements \phpbb\textformatter\cache_interface $configurator->registeredVars['max_img_width'] = 0; // Load the Emoji plugin and modify its tag's template to obey viewsmilies - $configurator->Emoji->omitImageSize(); - $configurator->Emoji->useSVG(); $tag = $configurator->Emoji->getTag(); $tag->template = '' . str_replace('class="emoji"', 'class="emoji smilies"', $tag->template) . ''; diff --git a/phpBB/phpbb/textformatter/s9e/parser.php b/phpBB/phpbb/textformatter/s9e/parser.php index 05ddfffa11..3698dca224 100644 --- a/phpBB/phpbb/textformatter/s9e/parser.php +++ b/phpBB/phpbb/textformatter/s9e/parser.php @@ -13,7 +13,7 @@ namespace phpbb\textformatter\s9e; -use s9e\TextFormatter\Parser\BuiltInFilters; +use s9e\TextFormatter\Parser\AttributeFilters\UrlFilter; use s9e\TextFormatter\Parser\Logger; /** @@ -196,7 +196,7 @@ class parser implements \phpbb\textformatter\parser_interface public function get_errors() { $errors = array(); - foreach ($this->parser->getLogger()->get() as $entry) + foreach ($this->parser->getLogger()->getLogs() as $entry) { list(, $msg, $context) = $entry; @@ -365,7 +365,7 @@ class parser implements \phpbb\textformatter\parser_interface static public function filter_img_url($url, array $url_config, Logger $logger, $max_height, $max_width) { // Validate the URL - $url = BuiltInFilters::filterUrl($url, $url_config, $logger); + $url = UrlFilter::filter($url, $url_config, $logger); if ($url === false) { return false; diff --git a/tests/text_formatter/s9e/default_formatting_test.php b/tests/text_formatter/s9e/default_formatting_test.php index a0c57214e4..8887b9daee 100644 --- a/tests/text_formatter/s9e/default_formatting_test.php +++ b/tests/text_formatter/s9e/default_formatting_test.php @@ -50,27 +50,27 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case return array( array( '[b]bold[/b]', - 'bold' + 'bold' ), array( '[u]underlined[/u]', - 'underlined' + 'underlined' ), array( '[i]italic[/i]', - 'italic' + 'italic' ), array( '[color=#FF0000]colored[/color]', - 'colored' + 'colored' ), array( '[color=red]colored[/color]', - 'colored' + 'colored' ), array( '[size=75]smaller[/size]', - 'smaller' + 'smaller' ), array( '[quote]quoted[/quote]', @@ -102,31 +102,31 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case ), array( '[list=1][*]item[/list]', - '
  1. item
' + '
  1. item
' ), array( '[list=a][*]item[/list]', - '
  1. item
' + '
  1. item
' ), array( '[list=i][*]item[/list]', - '
  1. item
' + '
  1. item
' ), array( '[list=I][*]item[/list]', - '
  1. item
' + '
  1. item
' ), array( '[list=disc][*]item[/list]', - '' + '' ), array( '[list=circle][*]item[/list]', - '' + '' ), array( '[list=square][*]item[/list]', - '' + '' ), array( '[img]https://area51.phpbb.com/images/area51.png[/img]', @@ -180,17 +180,17 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case array( // Allow textual bbcodes in textual bbcodes '[b]bold [i]bold + italic[/i][/b]', - 'bold bold + italic' + 'bold bold + italic' ), array( // Allow textual bbcodes in url with description '[url=https://area51.phpbb.com/]Area51 [i]italic[/i][/url]', - 'Area51 italic' + 'Area51 italic' ), array( // Allow url with description in textual bbcodes '[i]italic [url=https://area51.phpbb.com/]Area51[/url][/i]', - 'italic Area51' + 'italic Area51' ), array( // Do not parse textual bbcodes in code @@ -205,7 +205,7 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case array( // Textual bbcode nesting into textual bbcode '[b]bold [i]bold + italic[/b] italic[/i]', - 'bold bold + italic italic' + 'bold bold + italic italic' ), array( "[code]\tline1\n line2[/code]", @@ -298,7 +298,7 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case ), array( "Emoji: \xF0\x9F\x98\x80", - 'Emoji: ' . ' + 'Emoji: ' . ' ), array( "Emoji: \xF0\x9F\x98\x80", diff --git a/tests/text_processing/tickets_data/PHPBB3-10122.html b/tests/text_processing/tickets_data/PHPBB3-10122.html index f0fb6115b2..0803c895a8 100644 --- a/tests/text_processing/tickets_data/PHPBB3-10122.html +++ b/tests/text_processing/tickets_data/PHPBB3-10122.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-10268.html b/tests/text_processing/tickets_data/PHPBB3-10268.html index c89e63f9a3..13b71b4823 100644 --- a/tests/text_processing/tickets_data/PHPBB3-10268.html +++ b/tests/text_processing/tickets_data/PHPBB3-10268.html @@ -1,4 +1,4 @@
http://phpbb.com wrote:...
http://phpbb.com wrote:...
-http://phpbb.com
- http://phpbb.com
+http://phpbb.com
+ http://phpbb.com
diff --git a/tests/text_processing/tickets_data/PHPBB3-13641.html b/tests/text_processing/tickets_data/PHPBB3-13641.html index 1bd1c06dbb..2646bc0ea5 100644 --- a/tests/text_processing/tickets_data/PHPBB3-13641.html +++ b/tests/text_processing/tickets_data/PHPBB3-13641.html @@ -1 +1 @@ -[color=#FF0000] - red \ No newline at end of file +[color=#FF0000] - red \ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-13921.html b/tests/text_processing/tickets_data/PHPBB3-13921.html index 6a9dc7f504..690668ef28 100644 --- a/tests/text_processing/tickets_data/PHPBB3-13921.html +++ b/tests/text_processing/tickets_data/PHPBB3-13921.html @@ -1 +1 @@ -
xxx
\ No newline at end of file +
xxx
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-14706.html b/tests/text_processing/tickets_data/PHPBB3-14706.html index b8f74c9e93..23b3304485 100644 --- a/tests/text_processing/tickets_data/PHPBB3-14706.html +++ b/tests/text_processing/tickets_data/PHPBB3-14706.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-14790.html b/tests/text_processing/tickets_data/PHPBB3-14790.html index 7624b2d36c..5384098e1b 100644 --- a/tests/text_processing/tickets_data/PHPBB3-14790.html +++ b/tests/text_processing/tickets_data/PHPBB3-14790.html @@ -1,4 +1,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-14846.html b/tests/text_processing/tickets_data/PHPBB3-14846.html index 461ca25bc6..bd4455781b 100644 --- a/tests/text_processing/tickets_data/PHPBB3-14846.html +++ b/tests/text_processing/tickets_data/PHPBB3-14846.html @@ -1 +1 @@ -
moderator text
- Mickroz
\ No newline at end of file +
moderator text
- Mickroz
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-15348.html b/tests/text_processing/tickets_data/PHPBB3-15348.html index e65925ec28..5d44c07899 100644 --- a/tests/text_processing/tickets_data/PHPBB3-15348.html +++ b/tests/text_processing/tickets_data/PHPBB3-15348.html @@ -1 +1 @@ -:o k: :ok: \ No newline at end of file +:o k: :ok: \ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-8419.html b/tests/text_processing/tickets_data/PHPBB3-8419.html index 38df626a94..df91e9df50 100644 --- a/tests/text_processing/tickets_data/PHPBB3-8419.html +++ b/tests/text_processing/tickets_data/PHPBB3-8419.html @@ -1 +1 @@ -przykład \ No newline at end of file +przykład \ No newline at end of file