diff --git a/plugins/serendipity_event_bbcode/lang_en.inc.php b/plugins/serendipity_event_bbcode/lang_en.inc.php
index 37250ed3..934a39d5 100644
--- a/plugins/serendipity_event_bbcode/lang_en.inc.php
+++ b/plugins/serendipity_event_bbcode/lang_en.inc.php
@@ -9,5 +9,6 @@
@define('PLUGIN_EVENT_BBCODE_NAME', 'Markup: BBCode');
@define('PLUGIN_EVENT_BBCODE_DESC', 'Markup text using BBCode');
@define('PLUGIN_EVENT_BBCODE_TRANSFORM', 'BBCode format allowed');
+@define('PLUGIN_EVENT_BBCODE_TARGET', 'Use target="blank" for links?');
?>
diff --git a/plugins/serendipity_event_bbcode/serendipity_event_bbcode.php b/plugins/serendipity_event_bbcode/serendipity_event_bbcode.php
index 78933ad9..5639b861 100644
--- a/plugins/serendipity_event_bbcode/serendipity_event_bbcode.php
+++ b/plugins/serendipity_event_bbcode/serendipity_event_bbcode.php
@@ -19,7 +19,7 @@ class serendipity_event_bbcode extends serendipity_event
$propbag->add('description', PLUGIN_EVENT_BBCODE_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Jez Hancock, Garvin Hicking');
- $propbag->add('version', '2.04');
+ $propbag->add('version', '2.05');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
@@ -50,6 +50,7 @@ class serendipity_event_bbcode extends serendipity_event
$conf_array = array();
$conf_array[] = 'info';
+ $cond_array[] = 'target';
foreach($this->markup_elements as $element) {
$conf_array[] = $element['name'];
}
@@ -115,6 +116,12 @@ class serendipity_event_bbcode extends serendipity_event
function introspect_config_item($name, &$propbag)
{
switch($name) {
+ case 'target':
+ $propbag->add('type', 'boolean');
+ $propbag->add('name', PLUGIN_EVENT_BBCODE_TARGET);
+ $propbag->add('default', 'false');
+ break;
+
case 'info':
$propbag->add('type', 'info');
$propbag->add('description', PLUGIN_EVENT_BBCODE_TRANSFORM);
@@ -154,6 +161,12 @@ class serendipity_event_bbcode extends serendipity_event
// Disallow possibly evil HTML characters which may lead to Javascript XSS: '"();
static $pattern_query = '([^"\'\(\);]+?)';
+ static $target = null;
+
+ if ($target === null) {
+ $target = serendipity_db_bool($this->get_config('target'));
+ }
+
// Note:
// * Anything between ... tags will be caught by htmlspecialchars() and disallows custom HTML tags.
// * (?::\w+)? means "non capturing" match on any word character.
@@ -176,10 +189,10 @@ class serendipity_event_bbcode extends serendipity_event
'/(? "\\2",
// [url]
- '/(? "\\2",
- '/(? "\\1",
- '/(? "\\1",
- '/(? "\\2",
+ '/(? "\\2",
+ '/(? "\\1",
+ '/(? "\\1",
+ '/(? "\\2",
// [img]
'/(? "
",