Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bbcode-3205761
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
bbcode-3205761
Commits
590de5f7
Commit
590de5f7
authored
17 years ago
by
naudefj
Browse files
Options
Downloads
Patches
Plain Diff
#163992
by mindless: fix regexp errors/ prevent variable expansion
parent
9fc2c26f
Branches
master
Tags
7.x-3.0
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.txt
+1
-1
1 addition, 1 deletion
README.txt
bbcode-filter.inc
+2
-2
2 additions, 2 deletions
bbcode-filter.inc
bbcode-test.txt
+6
-2
6 additions, 2 deletions
bbcode-test.txt
with
9 additions
and
5 deletions
README.txt
+
1
−
1
View file @
590de5f7
...
...
@@ -65,7 +65,7 @@ Additional tags:
------------------------------------------------------------------------------
Here are some tags that's not part of the official BBCode implementation.
You may want to add them to your bbcode-filter.inc
You may want to add them to your bbcode-filter.inc
file:
- '#\[move(?::\w+)?\](.*?)\[/move(?::\w+)?\]#si' => '<marquee>\\1</marquee>',
...
...
This diff is collapsed.
Click to expand it.
bbcode-filter.inc
+
2
−
2
View file @
590de5f7
...
...
@@ -75,7 +75,7 @@ function _bbcode_filter_process(&$body, $format = -1) {
$arr
=
array
(
'tag'
=>
'size'
,
'pattern'
=>
'#\[\x07=([\d]+)(?::\w+)?\]([^\x07]*)\[/\x07(?::\w+)?\]#esi'
,
'replacement'
=>
'"<span style=\"font-size:". _bbcode_round_size_val(
"$1"
) ."px\">". str
ipslashes("$2"
) ."</span>"'
,
'replacement'
=>
'"<span style=\"font-size:". _bbcode_round_size_val(
\'$1\'
) ."px\">". str
_replace(\'\"\', \'"\', \'$2\'
) ."</span>"'
,
'text'
=>
$body
);
$body
=
_bbcode_replace_nest_tag
(
$arr
);
}
// end processing for [size]
...
...
@@ -127,7 +127,7 @@ function _bbcode_filter_process(&$body, $format = -1) {
// replace to <ol>/<ul> and </ol>/</ul> tags
// It will be better to use &count and do-while, if php 5 or higher.
while
(
preg_match
(
"#\[
\x07
[=]*((?-i)[cds1aAiI])*(?::\w+)?\]([^
\x07
]*)\[/
\x07
(?::\w+)?\]#si"
,
$body
))
{
$body
=
preg_replace
(
"#\[
\x07
[=]*((?-i)[cds1aAiI])*(?::\w+)?\]([^
\x07
]*)\[/
\x07
(?::\w+)?\]#esi"
,
'"<". $l_type[
"$1"
]["tag"] ." class=\"bb-list\" style=\"list-style-type:". $l_type[
"$1"
]["style"] .";\">".
"$2"
."</". $l_type[
"$1"
]["tag"] .">"'
,
$body
);
$body
=
preg_replace
(
"#\[
\x07
[=]*((?-i)[cds1aAiI])*(?::\w+)?\]([^
\x07
]*)\[/
\x07
(?::\w+)?\]#esi"
,
'"<". $l_type[
\'$1\'
]["tag"] ." class=\"bb-list\" style=\"list-style-type:". $l_type[
\'$1\'
]["style"] .";\">".
str_replace(\'\"\', \'"\', \'$2\')
."</". $l_type[
\'$1\'
]["tag"] .">"'
,
$body
);
}
// remove <br /> tags
...
...
This diff is collapsed.
Click to expand it.
bbcode-test.txt
+
6
−
2
View file @
590de5f7
...
...
@@ -22,6 +22,7 @@ Test [size=1]1px[/size] - too small, normalized to 6px
Test [size=12]12px[/size] text
Test [size=24]24px[/size] text
Test [size=100]100px[/size] - too big, normalized to 48px
[size=10] $_SERVER[PHP_SELF] "quoted" \\e\s\c\aped\" [/size] - watch out for eval
[h3]Font faces[/h3]
Test [font=arial]Arial typeface[/font] text
...
...
@@ -172,14 +173,14 @@ Roman uppercase list (list=I):
[*]z
[/list]
Al
f
a lowercase list (list=a):
Al
ph
a lowercase list (list=a):
[list=a]
[*]x
[*]y
[*]z
[/list]
Al
f
a uppercase list (list=A):
Al
ph
a uppercase list (list=A):
[list=A]
[*]x
[*]y
...
...
@@ -217,6 +218,9 @@ Complex nexted list:
[/list]
[/list]
List with php content (watch out for eval):
[list][*] {$var $_SERVER[PHP_SELF] "quoted" \\e\s\c\aped\" [/list]
[h3]Table tags[/h3]
[table]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment