From 496fb8b60b3028b352b8dfe7b46e882ec6fb1ca9 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 8 Jul 2014 00:07:44 +0200 Subject: [PATCH] [ticket/293] Use trimmessage as composer dependency B3P-293 --- composer.json | 3 +- composer.lock | 44 ++++++++++++++++++- includes/functions.php | 4 +- tests/functional/portal_announcement_test.php | 5 --- 4 files changed, 47 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 78cfc993..2ea3c360 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,8 @@ }], "require": { "php": ">=5.3.3", - "satooshi/php-coveralls": "dev-master" + "satooshi/php-coveralls": "dev-master", + "nickvergessen/phpbb-tool-trimmessage": "1.3.*" }, "extra": { "display-name": "Board3 Portal", diff --git a/composer.lock b/composer.lock index cb9e8dfd..f4b6423a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "dfb16d726d1c31c44d9dab2f34cc1d8d", + "hash": "913c7bb36f43b871d1e5596aad308cf3", "packages": [ { "name": "guzzle/guzzle", @@ -98,6 +98,48 @@ ], "time": "2014-05-07 17:04:22" }, + { + "name": "nickvergessen/phpbb-tool-trimmessage", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/nickvergessen/phpbb-tool-trimmessage.git", + "reference": "2a3d8273dc1238dd06454688bcb6496f62f66c3b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nickvergessen/phpbb-tool-trimmessage/zipball/2a3d8273dc1238dd06454688bcb6496f62f66c3b", + "reference": "2a3d8273dc1238dd06454688bcb6496f62f66c3b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "4.1.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0" + ], + "authors": [ + { + "name": "Joas Schilling", + "email": "nickvergessen@gmx.de", + "homepage": "https://github.com/nickvergessen", + "role": "Developer" + } + ], + "description": "This tool contains a class, that is able to trim a message from the phpbb message_parser to a maximum length without breaking the bbcodes/smilies and links.", + "homepage": "https://github.com/nickvergessen/phpbb-tool-trimmessage", + "time": "2014-07-06 19:42:34" + }, { "name": "psr/log", "version": "1.0.0", diff --git a/includes/functions.php b/includes/functions.php index 6a4b0eac..3dc643ae 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -400,9 +400,9 @@ function character_limit(&$title, $limit = 0) */ function get_sub_taged_string($message, $bbcode_uid, $length) { - if (class_exists('\nickvergessen\trimmessage\trim_message')) + if (class_exists('\Nickvergessen\TrimMessage\TrimMessage')) { - $trim = new \nickvergessen\trimmessage\trim_message($message, $bbcode_uid, $length); + $trim = new \Nickvergessen\TrimMessage\TrimMessage($message, $bbcode_uid, $length); $message = $trim->message(); unset($trim); } diff --git a/tests/functional/portal_announcement_test.php b/tests/functional/portal_announcement_test.php index d9e012a6..bde49813 100644 --- a/tests/functional/portal_announcement_test.php +++ b/tests/functional/portal_announcement_test.php @@ -59,11 +59,6 @@ class phpbb_functional_portal_announcement_test extends \board3\portal\tests\tes public function test_shortened_message() { - if (!class_exists('\nickvergessen\trimmessage\trim_message')) - { - $this->markTestSkipped('trimmessage is not available for testing.'); - } - // Create topic as announcement $data = $this->create_topic(2, 'Portal-announce-global', str_repeat('This is a global announcement for the portal', 6), array( 'topic_type' => POST_GLOBAL,