From 20a1646fc6336635cee89426e3a60bb22cb138de Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Fri, 6 Mar 2015 10:50:05 +0100 Subject: [ticket/11768] Renamed utils PHPBB3-11768 --- phpBB/phpbb/textformatter/utils_interface.php | 58 +++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 phpBB/phpbb/textformatter/utils_interface.php (limited to 'phpBB/phpbb/textformatter/utils_interface.php') diff --git a/phpBB/phpbb/textformatter/utils_interface.php b/phpBB/phpbb/textformatter/utils_interface.php new file mode 100644 index 0000000000..45610f7ecb --- /dev/null +++ b/phpBB/phpbb/textformatter/utils_interface.php @@ -0,0 +1,58 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter; + +/** +* Used to manipulate a parsed text +*/ +interface utils_interface +{ + /** + * Replace BBCodes and other formatting elements with whitespace + * + * NOTE: preserves smilies as text + * + * @param string $text + * @return string + */ + public function clean_formatting($text); + + /** + * Remove given BBCode at given nesting depth + * + * @param string $text Parsed text + * @param string $bbcode_name BBCode's name + * @param integer $depth Minimum nesting depth (number of parents of the same name) + * @return string + */ + public function remove_bbcode($text, $bbcode_name, $depth = 0); + + /** + * Remove BBCodes and other formatting from a parsed text + * + * NOTE: preserves smilies as text + * + * @param string $text + * @return string + */ + public function remove_formatting($text); + + /** + * Return a parsed text to its original form + * + * @param string $text + * @return string + */ + public function unparse($text); +} -- cgit v1.2.1 From 55c3fc02cfe1ce151bfb65c31ec72fc75f9d7872 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Thu, 26 Mar 2015 15:28:04 +0100 Subject: [ticket/11768] Updated utils service Updated docblocks. Removed remove_formatting() because it overlaps with clean_formatting() PHPBB3-11768 --- phpBB/phpbb/textformatter/utils_interface.php | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'phpBB/phpbb/textformatter/utils_interface.php') diff --git a/phpBB/phpbb/textformatter/utils_interface.php b/phpBB/phpbb/textformatter/utils_interface.php index 45610f7ecb..132dc8ece4 100644 --- a/phpBB/phpbb/textformatter/utils_interface.php +++ b/phpBB/phpbb/textformatter/utils_interface.php @@ -23,36 +23,26 @@ interface utils_interface * * NOTE: preserves smilies as text * - * @param string $text - * @return string + * @param string $text Parsed text + * @return string Plain text */ public function clean_formatting($text); /** - * Remove given BBCode at given nesting depth + * Remove given BBCode and its content, at given nesting depth * * @param string $text Parsed text * @param string $bbcode_name BBCode's name * @param integer $depth Minimum nesting depth (number of parents of the same name) - * @return string + * @return string Parsed text */ public function remove_bbcode($text, $bbcode_name, $depth = 0); - /** - * Remove BBCodes and other formatting from a parsed text - * - * NOTE: preserves smilies as text - * - * @param string $text - * @return string - */ - public function remove_formatting($text); - /** * Return a parsed text to its original form * - * @param string $text - * @return string + * @param string $text Parsed text + * @return string Original plain text */ public function unparse($text); } -- cgit v1.2.1 From f5ce9f273829ba470a1348b4314cddb58f552da0 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Sun, 3 May 2015 16:06:42 +0200 Subject: [ticket/13680] Updated quote notifications Added get_quote_authors() to text_formatter.utils service to retrieve the names used in first-level quotes PHPBB3-13680 --- phpBB/phpbb/textformatter/utils_interface.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'phpBB/phpbb/textformatter/utils_interface.php') diff --git a/phpBB/phpbb/textformatter/utils_interface.php b/phpBB/phpbb/textformatter/utils_interface.php index 132dc8ece4..183c426161 100644 --- a/phpBB/phpbb/textformatter/utils_interface.php +++ b/phpBB/phpbb/textformatter/utils_interface.php @@ -28,6 +28,14 @@ interface utils_interface */ public function clean_formatting($text); + /** + * Get a list of quote authors, limited to the first level of quotes + * + * @param string $text Parsed text + * @return string[] List of authors + */ + public function get_quote_authors($text); + /** * Remove given BBCode and its content, at given nesting depth * -- cgit v1.2.1 From f7ad2c2b32b309edba006a8d4b58727b50642ea2 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Fri, 15 May 2015 02:12:52 +0200 Subject: [ticket/13680] Renamed get_quote_authors to get_outermost_quote_authors PHPBB3-13680 --- phpBB/phpbb/textformatter/utils_interface.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/textformatter/utils_interface.php') diff --git a/phpBB/phpbb/textformatter/utils_interface.php b/phpBB/phpbb/textformatter/utils_interface.php index 183c426161..6d3fd13021 100644 --- a/phpBB/phpbb/textformatter/utils_interface.php +++ b/phpBB/phpbb/textformatter/utils_interface.php @@ -29,12 +29,12 @@ interface utils_interface public function clean_formatting($text); /** - * Get a list of quote authors, limited to the first level of quotes + * Get a list of quote authors, limited to the outermost quotes * * @param string $text Parsed text * @return string[] List of authors */ - public function get_quote_authors($text); + public function get_outermost_quote_authors($text); /** * Remove given BBCode and its content, at given nesting depth -- cgit v1.2.1 From 8a077e0e943d87ee1d26b0501f0b9bcc472ab904 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Sun, 17 May 2015 20:15:06 +0200 Subject: [ticket/13847] Move quote generation to text_formatter.utils PHPBB3-13847 --- phpBB/phpbb/textformatter/utils_interface.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'phpBB/phpbb/textformatter/utils_interface.php') diff --git a/phpBB/phpbb/textformatter/utils_interface.php b/phpBB/phpbb/textformatter/utils_interface.php index 6d3fd13021..41a6ba2345 100644 --- a/phpBB/phpbb/textformatter/utils_interface.php +++ b/phpBB/phpbb/textformatter/utils_interface.php @@ -28,6 +28,18 @@ interface utils_interface */ public function clean_formatting($text); + /** + * Create a quote block for given text + * + * Possible attributes: + * - author + * + * @param string $text Quote's text + * @param array $attributes Quote's attributes + * @return string Quote block to be used in a new post/text + */ + public function generate_quote($text, array $attributes = array()); + /** * Get a list of quote authors, limited to the outermost quotes * -- cgit v1.2.1 From c934b8f150c81115062687e59988ca0f78b35c37 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Sat, 20 Jun 2015 17:18:46 +0200 Subject: [ticket/10620] Updated docblock PHPBB3-10620 --- phpBB/phpbb/textformatter/utils_interface.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/textformatter/utils_interface.php') diff --git a/phpBB/phpbb/textformatter/utils_interface.php b/phpBB/phpbb/textformatter/utils_interface.php index 41a6ba2345..4810453cd1 100644 --- a/phpBB/phpbb/textformatter/utils_interface.php +++ b/phpBB/phpbb/textformatter/utils_interface.php @@ -32,7 +32,10 @@ interface utils_interface * Create a quote block for given text * * Possible attributes: - * - author + * - author: author's name (usually a username) + * - post_id: post_id of the post being quoted + * - user_id: user_id of the user being quoted + * - time: timestamp of the original message * * @param string $text Quote's text * @param array $attributes Quote's attributes -- cgit v1.2.1 From f82299b8e445cccfc8bad8cbe6505f3fb50d0f8f Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Fri, 6 Jan 2017 19:52:17 +0100 Subject: [ticket/14962] Introduces a new helper to check emptyness of bbcode texts PHPBB3-14962 --- phpBB/phpbb/textformatter/utils_interface.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'phpBB/phpbb/textformatter/utils_interface.php') diff --git a/phpBB/phpbb/textformatter/utils_interface.php b/phpBB/phpbb/textformatter/utils_interface.php index 4810453cd1..4b7392976a 100644 --- a/phpBB/phpbb/textformatter/utils_interface.php +++ b/phpBB/phpbb/textformatter/utils_interface.php @@ -62,10 +62,18 @@ interface utils_interface public function remove_bbcode($text, $bbcode_name, $depth = 0); /** - * Return a parsed text to its original form - * - * @param string $text Parsed text - * @return string Original plain text - */ + * Return a parsed text to its original form + * + * @param string $text Parsed text + * @return string Original plain text + */ public function unparse($text); + + /** + * Return whether or not a parsed text represent an empty text. + * + * @param string $text Parsed text + * @return bool Tue if the original text is empty + */ + public function is_empty($text); } -- cgit v1.2.1