1 | <?php |
||
13 | class trim_tools |
||
14 | { |
||
15 | /** @var \phpbb\config\config */ |
||
16 | protected $config; |
||
17 | |||
18 | /** @var \phpbb\textformatter\s9e\utils|null */ |
||
19 | protected $text_formatter_utils; |
||
20 | |||
21 | /** @var string|array BBcodes to be removed */ |
||
22 | protected $strip_bbcodes; |
||
23 | |||
24 | /** |
||
25 | * Constructor |
||
26 | * |
||
27 | * @param \phpbb\config\config $config |
||
28 | * @param \phpbb\textformatter\s9e\utils|null $text_formatter_utils |
||
29 | * @access public |
||
30 | */ |
||
31 | public function __construct(\phpbb\config\config $config, \phpbb\textformatter\s9e\utils $text_formatter_utils = null) |
||
36 | |||
37 | /** |
||
38 | * Trim and clean text |
||
39 | * |
||
40 | * @param string $message Message text |
||
41 | * @param int $length The length to trim text to |
||
42 | * @return string Trimmed message text |
||
43 | * @access protected |
||
44 | */ |
||
45 | public function trim_text($message, $length) |
||
59 | |||
60 | /** |
||
61 | * Strip BBCodes, tags and links from text |
||
62 | * |
||
63 | * @param string $message Message text |
||
64 | * @return string Cleaned message text |
||
65 | * @access protected |
||
66 | */ |
||
67 | protected function remove_markup($message) |
||
90 | |||
91 | /** |
||
92 | * Remove specified BBCodes and their contents |
||
93 | * |
||
94 | * @param string $message Message text |
||
95 | * @return string Stripped message text |
||
96 | * @access protected |
||
97 | */ |
||
98 | protected function remove_bbcode_contents($message) |
||
121 | |||
122 | /** |
||
123 | * Remove specified BBCodes and their contents |
||
124 | * Uses recursion to handle nested BBCodes |
||
125 | * This method for b.c. with phpBB 3.1.x |
||
126 | * |
||
127 | * @param string $message Message text |
||
128 | * @return string Stripped message text |
||
129 | * @access protected |
||
130 | */ |
||
131 | protected function remove_bbcode_contents_legacy($message) |
||
148 | |||
149 | /** |
||
150 | * Convert and preserve line breaks |
||
151 | * |
||
152 | * @param string $message Message text |
||
153 | * @return string Message text with line breaks |
||
154 | * @access protected |
||
155 | */ |
||
156 | protected function tp_nl2br($message) |
||
161 | |||
162 | /** |
||
163 | * Is the message s9e formatted |
||
164 | * |
||
165 | * @param string $message Message text |
||
166 | * @return bool True if message is s9e formatted, false otherwise |
||
|
|||
167 | */ |
||
168 | protected function s9e_format($message) |
||
172 | } |
||
173 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.