aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/textreparser/row_based_plugin.php
diff options
context:
space:
mode:
authorJoshyPHP <s9e.dev@gmail.com>2015-05-02 01:08:32 +0200
committerJoshyPHP <s9e.dev@gmail.com>2015-05-30 17:26:00 +0200
commitea445ffa4776b7ce0b1d13485f113c7e1ec28af0 (patch)
tree625afbb7e59242706e96b4d4e0b7659a0b1fd8c6 /phpBB/phpbb/textreparser/row_based_plugin.php
parent459f1d4c1f26658c70d29ac7c4e3f3389a973a59 (diff)
downloadforums-ea445ffa4776b7ce0b1d13485f113c7e1ec28af0.tar
forums-ea445ffa4776b7ce0b1d13485f113c7e1ec28af0.tar.gz
forums-ea445ffa4776b7ce0b1d13485f113c7e1ec28af0.tar.bz2
forums-ea445ffa4776b7ce0b1d13485f113c7e1ec28af0.tar.xz
forums-ea445ffa4776b7ce0b1d13485f113c7e1ec28af0.zip
[ticket/13803] Added methods to detect whether a given feature is in use
They test whether a given BBCode was enabled and has been used in a text, or smilies, or magic URLs. PHPBB3-13803
Diffstat (limited to 'phpBB/phpbb/textreparser/row_based_plugin.php')
-rw-r--r--phpBB/phpbb/textreparser/row_based_plugin.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/phpBB/phpbb/textreparser/row_based_plugin.php b/phpBB/phpbb/textreparser/row_based_plugin.php
index 2be0b68411..80525a404e 100644
--- a/phpBB/phpbb/textreparser/row_based_plugin.php
+++ b/phpBB/phpbb/textreparser/row_based_plugin.php
@@ -59,11 +59,20 @@ abstract class row_based_plugin extends base
{
$row += array(
'enable_bbcode' => !empty($row['bbcode_uid']),
- 'enable_smilies' => (strpos($row['text'], '<!-- s') !== false),
- 'enable_magic_url' => (strpos($row['text'], '<!-- m -->') !== false),
+ 'enable_smilies' => $this->guess_smilies($row),
+ 'enable_magic_url' => $this->guess_magic_url($row),
);
}
+ // Those BBCodes are disabled based on context and user permissions and that value is never
+ // stored in the database. Here we test whether they were used in the original text.
+ $bbcodes = array('flash', 'img', 'quote', 'url');
+ foreach ($bbcodes as $bbcode)
+ {
+ $field_name = 'enable_' . $bbcode;
+ $row[$field_name] = $this->guess_bbcode($row, $bbcode);
+ }
+
return $row;
}