Skip to content

Commit 6dcb3fb

Browse files
authored
Merge pull request #36 from bkraul/develop-2.0.x
Incorporate PR from FSD-Christian-ISSS
2 parents 73150de + 5115a96 commit 6dcb3fb

29 files changed

+2434
-2433
lines changed

BBCodePlus/BBCodePlus.php

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function register() {
1919
$this->name = plugin_lang_get( 'title' );
2020
$this->description = plugin_lang_get( 'description' );
2121
$this->page = 'config';
22-
$this->version = '2.0.16';
22+
$this->version = '2.0.17';
2323

2424
$this->requires['MantisCore'] = '2.0.0';
2525
# this plugin can coexist with MantisCoreFormatting.
@@ -70,14 +70,16 @@ function resources( $p_event ) {
7070
}
7171
}
7272

73+
# turn off formatting options.
74+
config_set_global("html_make_links", false);
75+
7376
# includes.
7477
$resources = '<link rel="stylesheet" type="text/css" href="' . plugin_file( 'bbcodeplus.css' ) . '" />';
7578
$resources .= '<script type="text/javascript" src="' . plugin_file( 'bbcodeplus-init.js' ) . '"></script>';
7679

7780
if ( ON == plugin_config_get( 'process_markitup' ) ) {
7881
$resources .= '<link rel="stylesheet" type="text/css" href="' . plugin_file( 'markitup/skins/' . plugin_config_get( 'markitup_skin' ) . '/style.css' ) . '" />';
7982
$resources .= '<link rel="stylesheet" type="text/css" href="' . plugin_file( 'markitup/sets/mantis/style.css' ) . '" />';
80-
//$resources .= '<script type="text/javascript" src="' . plugin_file( 'jquery_migrate_min.js' ) . '"></script>';
8183
$resources .= '<script type="text/javascript" src="' . plugin_file( 'markitup/jquery_markitup.js' ) . '"></script>';
8284
$resources .= '<script type="text/javascript" src="' . plugin_file( 'markitup/sets/mantis/set.js' ) . '"></script>';
8385
$resources .= '<script type="text/javascript" src="' . plugin_file( 'markitup-init.js' ) . '"></script>';
@@ -234,12 +236,12 @@ function string_process_bbcode( $p_string, $p_multiline = TRUE ) {
234236
$t_extra_link_tags = 'target="_blank"';
235237

236238
# if there are any expressed links, images convert them to bbcode.
237-
$p_string = preg_replace( "/^((http|https|ftp):\/\/[a-z0-9;\/\?:@=\&\$\-_\.\+!*'\(\),~%#]+)/i", "[url]$1[/url]", $p_string );
238-
$p_string = preg_replace( "/([^='\"(\[url\]|\[img\])])((http|https|ftp):\/\/[a-z0-9;\/\?:@=\&\$\-_\.\+!*'\(\),~%#]+)/i", "$1[url]$2[/url]", $p_string );
239+
$p_string = preg_replace( "/^((http|https|ftp|file):\/\/[a-z0-9;\/\?:@=\&\$\-_\.\+!*'\(\),~%#\|]+)/i", "[url]$1[/url]", $p_string );
240+
$p_string = preg_replace( "/([^='\"(\[url\]|\[img\])])((http|https|ftp|file):\/\/[a-z0-9;\/\?:@=\&\$\-_\.\+!*'\(\),~%#\|]+)/i", "$1[url]$2[/url]", $p_string );
239241

240242
$t_search[] = "/\[img\]((http|https|ftp):\/\/[a-z0-9;\/\?:@=\&\$\-_\.\+!*'\(\),~%# ]+?)\[\/img\]/is";
241243
$t_search[] = "/\[img\]([.]*[a-z0-9;\/\?:@=\&\$\-_\.\+!*'\(\),~%# ]+?)\[\/img\]/is";
242-
$t_search[] = "/\[url\]((http|https|ftp|mailto):\/\/([a-z0-9\.\-@:]+)[a-z0-9;\/\?:@=\&\$\-_\.\+!*'\(\),\#%~ ]*?)\[\/url\]/is";
244+
$t_search[] = "/\[url\]((http|https|ftp|mailto|file):\/\/([\/a-z0-9\.\-@:]+)[a-z0-9;\/\?:@=\&\$\-_\.\+!*'\(\),\#%~\| ]*?)\[\/url\]/is";
243245
$t_search[] = "/\[url=((http|https|ftp|mailto):\/\/[^\]]+?)\](.+?)\[\/url\]/is";
244246
$t_search[] = "/\[url=([a-z0-9;\/\?:@=\&\$\-_\.\+!*'\(\),~%# ]+?)\](.+?)\[\/url\]/is";
245247
$t_search[] = "/\[email\]([a-z0-9\-_\.\+]+@[a-z0-9\-]+\.[a-z0-9\-\.]+?)\[\/email\]/is";
@@ -312,16 +314,16 @@ function string_process_bbcode( $p_string, $p_multiline = TRUE ) {
312314

313315
# code=lang
314316
$p_string = preg_replace_callback('/\[code=(\w+)\](.+)\[\/code\]/imsU',
315-
function ($m) {
317+
create_function('$m', '
316318
return "<pre><code class=\"language-" . strtolower($m[1]) . "\">" . $m[2] . "</code></pre>";
317-
}
319+
')
318320
, $p_string);
319321

320322
# code=lang start=n
321323
$p_string = preg_replace_callback('/\[code=(\w+)\ start=([0-9]+)\](.+)\[\/code\]/imsU',
322-
function ($m) {
324+
create_function('$m', '
323325
return "<pre class=\"line-numbers\" data-start=\"" . $m[2] . "\"><code class=\"language-" . strtolower($m[1]) . "\">" . $m[3] . "</code></pre>";
324-
}
326+
')
325327
, $p_string);
326328

327329
# process quotes.
@@ -434,16 +436,16 @@ function string_strip_bbcode( $p_string, $p_multiline = TRUE ) {
434436

435437
# code=lang
436438
$p_string = preg_replace_callback('/\[code=(\w+)\](.+)\[\/code\]/imsU',
437-
function ($m) {
439+
create_function('$m', '
438440
return $m[2];
439-
}
441+
')
440442
, $p_string);
441443

442444
# code=lang start=n
443445
$p_string = preg_replace_callback('/\[code=(\w+)\ start=([0-9]+)\](.+)\[\/code\]/imsU',
444-
function ($m) {
446+
create_function('$m', '
445447
return $m[3];
446-
}
448+
')
447449
, $p_string);
448450

449451
# process quotes.
@@ -480,9 +482,9 @@ function restore_pre_code_tags( $p_string, $p_multiline = true ) {
480482
$tags = implode( '|', $tags );
481483

482484
$t_string = preg_replace_callback('/&lt;(' . $tags . ')(.*?)&gt;/ui',
483-
function($m) {
485+
create_function('$m', '
484486
return "<" . $m[1] . str_replace("&quot;", "\"", $m[2]) . ">";
485-
}
487+
')
486488
, $t_string);
487489

488490
$t_string = preg_replace( '/&lt;\/(' . $tags . ')\s*&gt;/ui', '</\\1>', $t_string );

BBCodePlus/files/bbcodeplus.css

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
div.bbcodeplus-quote {
2-
border: solid #c0c0c0 1px;
3-
padding: 10px;
4-
background-color: #d8d8d8;
5-
}
6-
7-
pre {
8-
border: 1px solid silver;
9-
margin: 0 0 1.5em 0;
10-
overflow: auto;
11-
padding-left: 10px;
12-
}
13-
14-
code span {
15-
font-family: Consolas,Monaco,"Andale Mono","Ubuntu Mono",monospace;
16-
font-size: 1em;
17-
}
18-
19-
.bbcodeplus-list {
20-
margin-left: 0px;
21-
padding-left: 1.2em;
22-
}
23-
24-
.bbcodeplus-bullet-list {
25-
margin-left: 0px;
26-
padding-left: 1.2em;
27-
list-style-type: square;
28-
}
29-
30-
.bbcodeplus-preview {
31-
height:100%;
32-
width:100%;
33-
font-family: 'Open Sans', sans-serif;
34-
font-size: 13px;
35-
}
36-
37-
.bbcodeplus-preview-body {
38-
background-image:none !important;
39-
margin: 10px 10px;
40-
}
1+
div.bbcodeplus-quote {
2+
border: solid #c0c0c0 1px;
3+
padding: 10px;
4+
background-color: #d8d8d8;
5+
}
6+
7+
pre {
8+
border: 1px solid silver;
9+
margin: 0 0 1.5em 0;
10+
overflow: auto;
11+
padding-left: 10px;
12+
}
13+
14+
code span {
15+
font-family: Consolas,Monaco,"Andale Mono","Ubuntu Mono",monospace;
16+
font-size: 1em;
17+
}
18+
19+
.bbcodeplus-list {
20+
margin-left: 0px;
21+
padding-left: 1.2em;
22+
}
23+
24+
.bbcodeplus-bullet-list {
25+
margin-left: 0px;
26+
padding-left: 1.2em;
27+
list-style-type: square;
28+
}
29+
30+
.bbcodeplus-preview {
31+
height:100%;
32+
width:100%;
33+
font-family: 'Open Sans', sans-serif;
34+
font-size: 13px;
35+
}
36+
37+
.bbcodeplus-preview-body {
38+
background-image:none !important;
39+
margin: 10px 10px;
40+
}

BBCodePlus/files/jquery_migrate_min.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

BBCodePlus/files/markitup-init.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
// declare the path to the previewer using the plugin file processor.
55
mySettings.previewParserPath = "./plugin.php?page=BBCodePlus/preview.php";
6-
76
// apply to proper text areas.
87
if ( $("textarea[name='bugnote_text']") )
98
$("textarea[name='bugnote_text']").markItUp(mySettings);
@@ -13,6 +12,8 @@
1312
$("textarea[name='steps_to_reproduce']").markItUp(mySettings);
1413
if ( $("textarea[name='additional_info']") )
1514
$("textarea[name='additional_info']").markItUp(mySettings);
15+
if ( $("textarea[name='additional_information']") )
16+
$("textarea[name='additional_information']").markItUp(mySettings);
1617
if ( $("textarea[name='body']") )
1718
$("textarea[name='body']").markItUp( mySettings );
1819

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
// ----------------------------------------------------------------------------
2-
// markItUp!
3-
// ----------------------------------------------------------------------------
4-
// Copyright (C) 2011 Jay Salvat
5-
// http://markitup.jaysalvat.com/
6-
// ----------------------------------------------------------------------------
7-
// Html tags
8-
// http://en.wikipedia.org/wiki/html
9-
// ----------------------------------------------------------------------------
10-
// Basic set. Feel free to add more tags
11-
// ----------------------------------------------------------------------------
12-
var mySettings = {
13-
onShiftEnter: {keepDefault:false, replaceWith:'<br />\n'},
14-
onCtrlEnter: {keepDefault:false, openWith:'\n<p>', closeWith:'</p>'},
15-
onTab: {keepDefault:false, replaceWith:' '},
16-
markupSet: [
17-
{name:'Bold', key:'B', openWith:'(!(<strong>|!|<b>)!)', closeWith:'(!(</strong>|!|</b>)!)' },
18-
{name:'Italic', key:'I', openWith:'(!(<em>|!|<i>)!)', closeWith:'(!(</em>|!|</i>)!)' },
19-
{name:'Stroke through', key:'S', openWith:'<del>', closeWith:'</del>' },
20-
{separator:'---------------' },
21-
{name:'Bulleted List', openWith:' <li>', closeWith:'</li>', multiline:true, openBlockWith:'<ul>\n', closeBlockWith:'\n</ul>'},
22-
{name:'Numeric List', openWith:' <li>', closeWith:'</li>', multiline:true, openBlockWith:'<ol>\n', closeBlockWith:'\n</ol>'},
23-
{separator:'---------------' },
24-
{name:'Picture', key:'P', replaceWith:'<img src="[![Source:!:http://]!]" alt="[![Alternative text]!]" />' },
25-
{name:'Link', key:'L', openWith:'<a href="[![Link:!:http://]!]"(!( title="[![Title]!]")!)>', closeWith:'</a>', placeHolder:'Your text to link...' },
26-
{separator:'---------------' },
27-
{name:'Clean', className:'clean', replaceWith:function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } },
28-
{name:'Preview', className:'preview', call:'preview'}
29-
]
30-
}
1+
// ----------------------------------------------------------------------------
2+
// markItUp!
3+
// ----------------------------------------------------------------------------
4+
// Copyright (C) 2011 Jay Salvat
5+
// http://markitup.jaysalvat.com/
6+
// ----------------------------------------------------------------------------
7+
// Html tags
8+
// http://en.wikipedia.org/wiki/html
9+
// ----------------------------------------------------------------------------
10+
// Basic set. Feel free to add more tags
11+
// ----------------------------------------------------------------------------
12+
var mySettings = {
13+
onShiftEnter: {keepDefault:false, replaceWith:'<br />\n'},
14+
onCtrlEnter: {keepDefault:false, openWith:'\n<p>', closeWith:'</p>'},
15+
onTab: {keepDefault:false, replaceWith:' '},
16+
markupSet: [
17+
{name:'Bold', key:'B', openWith:'(!(<strong>|!|<b>)!)', closeWith:'(!(</strong>|!|</b>)!)' },
18+
{name:'Italic', key:'I', openWith:'(!(<em>|!|<i>)!)', closeWith:'(!(</em>|!|</i>)!)' },
19+
{name:'Stroke through', key:'S', openWith:'<del>', closeWith:'</del>' },
20+
{separator:'---------------' },
21+
{name:'Bulleted List', openWith:' <li>', closeWith:'</li>', multiline:true, openBlockWith:'<ul>\n', closeBlockWith:'\n</ul>'},
22+
{name:'Numeric List', openWith:' <li>', closeWith:'</li>', multiline:true, openBlockWith:'<ol>\n', closeBlockWith:'\n</ol>'},
23+
{separator:'---------------' },
24+
{name:'Picture', key:'P', replaceWith:'<img src="[![Source:!:http://]!]" alt="[![Alternative text]!]" />' },
25+
{name:'Link', key:'L', openWith:'<a href="[![Link:!:http://]!]"(!( title="[![Title]!]")!)>', closeWith:'</a>', placeHolder:'Your text to link...' },
26+
{separator:'---------------' },
27+
{name:'Clean', className:'clean', replaceWith:function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } },
28+
{name:'Preview', className:'preview', call:'preview'}
29+
]
30+
}
Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
/* -------------------------------------------------------------------
2-
// markItUp!
3-
// By Jay Salvat - http://markitup.jaysalvat.com/
4-
// ------------------------------------------------------------------*/
5-
.markItUp .markItUpButton1 a {
6-
background-image:url(images/bold.png);
7-
}
8-
.markItUp .markItUpButton2 a {
9-
background-image:url(images/italic.png);
10-
}
11-
.markItUp .markItUpButton3 a {
12-
background-image:url(images/stroke.png);
13-
}
14-
15-
.markItUp .markItUpButton4 a {
16-
background-image:url(images/list-bullet.png);
17-
}
18-
.markItUp .markItUpButton5 a {
19-
background-image:url(images/list-numeric.png);
20-
}
21-
22-
.markItUp .markItUpButton6 a {
23-
background-image:url(images/picture.png);
24-
}
25-
.markItUp .markItUpButton7 a {
26-
background-image:url(images/link.png);
27-
}
28-
29-
.markItUp .markItUpButton8 a {
30-
background-image:url(images/clean.png);
31-
}
32-
.markItUp .preview a {
33-
background-image:url(images/preview.png);
34-
}
1+
/* -------------------------------------------------------------------
2+
// markItUp!
3+
// By Jay Salvat - http://markitup.jaysalvat.com/
4+
// ------------------------------------------------------------------*/
5+
.markItUp .markItUpButton1 a {
6+
background-image:url(images/bold.png);
7+
}
8+
.markItUp .markItUpButton2 a {
9+
background-image:url(images/italic.png);
10+
}
11+
.markItUp .markItUpButton3 a {
12+
background-image:url(images/stroke.png);
13+
}
14+
15+
.markItUp .markItUpButton4 a {
16+
background-image:url(images/list-bullet.png);
17+
}
18+
.markItUp .markItUpButton5 a {
19+
background-image:url(images/list-numeric.png);
20+
}
21+
22+
.markItUp .markItUpButton6 a {
23+
background-image:url(images/picture.png);
24+
}
25+
.markItUp .markItUpButton7 a {
26+
background-image:url(images/link.png);
27+
}
28+
29+
.markItUp .markItUpButton8 a {
30+
background-image:url(images/clean.png);
31+
}
32+
.markItUp .preview a {
33+
background-image:url(images/preview.png);
34+
}

0 commit comments

Comments
 (0)