AUBBC
view release on metacpan or search on metacpan
234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265$msg
=~ s/\[(?:c|code)=(.+?)\](?s)(.+?)\[\/(?:c|code)\]/code_tag($2, $1)/ge;
$do_f
[9] =
''
if
$do_f
[9];
$msg
=~ s/\[(img|right_img|left_img)\](.+?)\[\/img\]/fix_image($1, $2)/ge
if
!
$AUBBC
{no_img};
$msg
=~ s/\[email\](?![\w\.\-\&\+]+\@[\w\.\-]+).+?\[\/email\]/\[<font color=red>
$BAD_MESSAGE
<\/font>\]email/g;
$AUBBC
{protect_email}
?
$msg
=~ s/\[email\]([\w\.\-\&\+]+\@[\w\.\-]+)\[\/email\]/protect_email($1)/ge
:
$msg
=~ s/\[email\]([\w\.\-\&\+]+\@[\w\.\-]+)\[\/email\]/link_check(
"mailto:$1"
,$1,
''
,
''
)/ge;
$msg
=~ s/\[color=([\w
#]+)\](?s)(.+?)\[\/color\]/<span style="color:$1;">$2<\/span>/g;
1
while
$msg
=~
s/\[quote=([\w\s]+)\](?s)(.+?)\[\/quote\]/<div
$AUBBC
{quote_class}><small><strong>$1:<\/strong><\/small><br
$AUBBC
{html_type}>
$2<\/div>
$AUBBC
{quote_extra}/g;
1
while
$msg
=~
s/\[quote\](?s)(.+?)\[\/quote\]/<div
$AUBBC
{quote_class}>$1<\/div>
$AUBBC
{quote_extra}/g;
$msg
=~ s/\[(left|right|center)\](?s)(.+?)\[\/\1\]/<div style=\"text-align: $1;\">$2<\/div>/g;
$msg
=~ s/\[li=(\d+)\](?s)(.+?)\[\/li\]/<li value=
"$1"
>$2<\/li>/g;
$msg
=~ s/\[u\](?s)(.+?)\[\/u\]/<span style=
"text-decoration: underline;"
>$1<\/span>/g;
$msg
=~ s/\[strike\](?s)(.+?)\[\/strike\]/<span style=
"text-decoration: line-through;"
>$1<\/span>/g;
$msg
=~ s/\[([bh]r)\]/<$1
$AUBBC
{html_type}>/g;
$msg
=~ s/\[list\](?s)(.+?)\[\/list\]/fix_list($1)/ge;
1
while
$msg
=~
s/\[(blockquote|big|h[123456]|[ou]l|li|em|pre|s(?:mall|trong|u[bp])|[bip])\](?s)(.+?)\[\/\1\]/<$1>$2<\/$1>/g;
$msg
=~ s/(<\/?(?:ol|ul|li|hr)\s?\/?>)\r?\n?<br(?:\s?\/)?>/$1/g;
$msg
=~ s/\[url=(\w+\:\/\/
$long_regex
)\](.+?)\[\/url\]/link_check($1,fix_message($2),
''
,1)/ge;
$msg
=~ s/(?<!["=\.\/\
'\[\{\;])((?:\b\w+\b\:\/\/)$long_regex)/link_check($1,$1,'
',1)/ge;
326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417Default is
'html'
and the only other support is
'xhtml'
=head2 fix_amp
Default is 1 Enabled and the only other setting is 0 to Disable.
This setting finds all the & that need to covert to the amp; html code name
so the w3c xhtml validation checks ok.
=head2 line_break
Enable line_break "<br>\n" Default 1 , 2 is for the "<br>" older style
that has no new line, 0 is Disable.
This will turn any new line \n to the HTML line break <br>\n or <br> by the script_escape method and the other way around
with the html_to_text method.
=head2 code_class
Default is '' and this allows a custom class, style and/or JavaScript to be used in any of the [code] [c] tags.
must have a space before the text.
example:
code_class => ' class="quote"',
code_class => ' class="quote" onclick="....."',
=head2 code_extra
Default is '' and this is for a custom message, code, image, est.. to be used after the [code] [c] tags.
example:
code_extra => 'Codes may not reflect what is in the current version.',
code_extra => '<div style="clear: left"> </div>',
=head2 code_download
Default is '^Download above code^' this message will
be the links name. the link will open a JavaScript popup window and write the
code in it to be copyed or printed. A new JavaScript function was
added to the js_print method called MyCodePrint.
To turn off set this to ''
example:
code_download => 'Click here to get above code.',
code_download => '',
=head2 href_class
Default is '' and this allows a custom class, style and/or JavaScript to be used in the [url] tags.
must have a space before the text.
example:
href_class => ' class="url"',
href_class => ' class="url" onclick="....."',
=head2 quote_class
Default is '' and this allows a custom class, style and/or JavaScript to be used in the [quote] tags.
must have a space before the text.
example:
quote_class => ' class="quote"',
quote_class => ' class="quote" onclick="....."',
=head2 quote_extra
Default is '' and this is for a custom message, code, image, est.. to be used after a [quote] tags.
example:
quote_extra => 'QUOTES AND SAYINGS DISPLAYED ON THIS BLOG ARE NOT WRITTEN BY THE AUTHOR OF THE BLOG.',
quote_extra => '<div style="clear: left"> </div>',
=head2 script_escape
This will turn on or off the sanitizer/escape security for the hole message.
Default is 1 on and 0 for Disable.
Notes: 1)The code highlighter works best with an escaped character format like the
script_escape => 1 setting can provide.
515516517518519520521522523524525526527528529530531532533534535536537538pattern - limited to
'all'
or
'l,n,-,:,_,s'
'all'
= anything but [ or ]
'l'
=
'a-z'
'n'
=
'0-9'
's'
=
' '
'-'
=
'-'
':'
=
':'
'_'
=
'_'
type - 1 is style [name://pattern], 2 is style [name]pattern[/name], 3 is style [name],
the
next
setting
for
type the function will not be used to run Perl subroutines and
will replace the text
with
what text is
defined
in the function setting, the setting is
see function below on how type 4 works
function - a pre-
defined
subroutine that receives the matched pattern, tag name and returns what you want,
unless
type is set to 4 then it will replace the tag
with
what text is in the function.
Note:
if
the function returns undefined,
''
or 0 the tag will not be changed.
level - the array number of the security level
error - the text or HTML to show
if
user
has
no
access
724725726727728729730731732733734735736737738739740741742743744v4.03 - 02/03/2011
Addition - New Object method aubbc_error . Developers can now controle
if
or
when
to handle errors, see the POD
'Error Message'
for
usage.
Fixed - All built-in tags only convert balanced tags so
no
unbalanced HTML can
be produced
Fixed - Bug in code_highlight a highlight regex needed to be changed
after
version 4.01 to support the Parser style.
Improvement - Small restructure of add_build_tag and change the
'all'
setting
of
'pattern'
to allow more.
v4.02 - 11/28/2010
Fixed - The element ID
for
the code download started at 1
for
every instance this
will force the browser to take priority to load the first ID it reads. The fix
starts the counter at
'time.$$.000'
to
try
to produce a more unique ID
for
each
instance.
785786787788789790791792793794795796797798799800801802803804805806807808809810811Addition - AUBBC::make_link(
$link
,
$name
,
$javascript
,
$target
) this is useful enough
to mention once.
Improvement - After lots of testing I have removed all /o in the regex. One main
reason is Memoize provides enough speed.
v3.13 - 09/30/2010
Addition - do_ubbc New built-in tag [list][*=1]... [*]... [/list], This will
follow XHTML or HTML Transitional element style and XHTML or HTML Strict will not
support the elements that tag [*=1] in the [list] will produce
Addition - do_ubbc New built-in tag [em]Hello[/em]
Addition - New value
for
setting line_break 2
for
old <br style. This effects script_escape.
Addition - This module now uses Memoize
for
a massive speed improvement.
If you thought it was fast
before
, I hope your sitting down
when
you bench this version. LOL
Addition - added setting highlight_function to replace the highlighting method
of AUBBC
with
a costume one.
Fixed - in do_ubbc the line breaks was invalidating HTML
for
List Block elements
Improvement - in do_all_ubbc changed defining
$msg
each
time
. there could have
833834835836837838839840841842843844845846847848849850851852853of all the Perl BBcode modules. BBCode::Parser Parse::BBCode HTML::BBCode HTML::BBReverse
Fixed - fixed a line break and new line sandbox bug
Improvement - Massive speed improvement to the hole module and
no
features lost.
changed new
for
faster loading, the module uses vars
for
some variables,
re-spaced the hole code.
v2.10 - 08/31/2010 11:17:13
different then the other built functions. Type 4 will
the text
defined
in
function and not point to a
defined
Perl subroutine.
Addition - added line_break setting to have control over the script_escape and
html_to_text methods converting html line break <br> and new line \n
Addition - added fix_amp this setting finds all the & that need to covert to the amp; html code name
so the w3c xhtml validation checks ok.
Addition - added no_img this setting will allow some control
for
using [img] tags
917918919920921922923924925926927928929930931932933934935936937938939v1.20 - 09/07/2008 09:23:09
Fixed bug that bypassed utf tag converter
if
square bracket wasn't detected
Fixed Makefile.PL
v1.10 - 09/02/2008 09:49:46
Added two more tags [big]..[/big] and [small]..[/small].
Removed utf tag style [ux23] and [u://0931] to make more tag names available.
Changed the way functions should work
for
built tags, the custom function
for
built tags will receive the tag name and data of the tag. This is so one function can handle many tags.
Removed other site tags and setting other_sites_pattern, an example of them are in
"Build your own tags"
Removed [
time
] tag, example in
"Build your own tags"
.
Email now allows names
with
& sign
Now every message that is passed to do_all_ubbc() gets escaped
before
being returned
if
script_escape is Enabled.
272829303132333435363738394041424344454647v4.03 - 02/03/2011
Addition - New Object method aubbc_error . Developers can now controle
if
or
when
to handle errors, see the POD
'Error Message'
for
usage.
Fixed - All built-in tags only convert balanced tags so
no
unbalanced HTML can
be produced
Fixed - Bug in code_highlight a highlight regex needed to be changed
after
version 4.01 to support the Parser style.
Improvement - Small restructure of add_build_tag and change the
'all'
setting
of
'pattern'
to allow more.
v4.02 - 11/28/2010
Fixed - The element ID
for
the code download started at 1
for
every instance this
will force the browser to take priority to load the first ID it reads. The fix
starts the counter at
'time.$$.000'
to
try
to produce a more unique ID
for
each
instance.
888990919293949596979899100101102103104105106107108109110111112113114Addition - AUBBC::make_link(
$link
,
$name
,
$javascript
,
$target
) this is useful enough
to mention once.
Improvement - After lots of testing I have removed all /o in the regex. One main
reason is Memoize provides enough speed.
v3.13 - 09/30/2010
Addition - do_ubbc New built-in tag [list][*=1]... [*]... [/list], This will
follow XHTML or HTML Transitional element style and XHTML or HTML Strict will not
support the elements that tag [*=1] in the [list] will produce
Addition - do_ubbc New built-in tag [em]Hello[/em]
Addition - New value
for
setting line_break 2
for
old <br style. This effects script_escape.
Addition - This module now uses Memoize
for
a massive speed improvement.
If you thought it was fast
before
, I hope your sitting down
when
you bench this version. LOL
Addition - added setting highlight_function to replace the highlighting method
of AUBBC
with
a costume one.
Fixed - in do_ubbc the line breaks was invalidating HTML
for
List Block elements
Improvement - in do_all_ubbc changed defining
$msg
each
time
. there could have
136137138139140141142143144145146147148149150151152153154155156of all the Perl BBcode modules. BBCode::Parser Parse::BBCode HTML::BBCode HTML::BBReverse
Fixed - fixed a line break and new line sandbox bug
Improvement - Massive speed improvement to the hole module and
no
features lost.
changed new
for
faster loading, the module uses vars
for
some variables,
re-spaced the hole code.
v2.10 - 08/31/2010 11:17:13
different then the other built functions. Type 4 will
the text
defined
in
function and not point to a
defined
Perl subroutine.
Addition - added line_break setting to have control over the script_escape and
html_to_text methods converting html line break <br> and new line \n
Addition - added fix_amp this setting finds all the & that need to covert to the amp; html code name
so the w3c xhtml validation checks ok.
Addition - added no_img this setting will allow some control
for
using [img] tags
220221222223224225226227228229230231232233234235236237238239240241242v1.20 - 09/07/2008 09:23:09
Fixed bug that bypassed utf tag converter
if
square bracket wasn't detected
Fixed Makefile.PL
v1.10 - 09/02/2008 09:49:46
Added two more tags [big]..[/big] and [small]..[/small].
Removed utf tag style [ux23] and [u://0931] to make more tag names available.
Changed the way functions should work
for
built tags, the custom function
for
built tags will receive the tag name and data of the tag. This is so one function can handle many tags.
Removed other site tags and setting other_sites_pattern, an example of them are in
"Build your own tags"
Removed [
time
] tag, example in
"Build your own tags"
.
Email now allows names
with
& sign
Now every message that is passed to do_all_ubbc() gets escaped
before
being returned
if
script_escape is Enabled.
326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417Default is
'html'
and the only other support is
'xhtml'
=head2 fix_amp
Default is 1 Enabled and the only other setting is 0 to Disable.
This setting finds all the & that need to covert to the amp; html code name
so the w3c xhtml validation checks ok.
=head2 line_break
Enable line_break "<br>\n" Default 1 , 2 is for the "<br>" older style
that has no new line, 0 is Disable.
This will turn any new line \n to the HTML line break <br>\n or <br> by the script_escape method and the other way around
with the html_to_text method.
=head2 code_class
Default is '' and this allows a custom class, style and/or JavaScript to be used in any of the [code] [c] tags.
must have a space before the text.
example:
code_class => ' class="quote"',
code_class => ' class="quote" onclick="....."',
=head2 code_extra
Default is '' and this is for a custom message, code, image, est.. to be used after the [code] [c] tags.
example:
code_extra => 'Codes may not reflect what is in the current version.',
code_extra => '<div style="clear: left"> </div>',
=head2 code_download
Default is '^Download above code^' this message will
be the links name. the link will open a JavaScript popup window and write the
code in it to be copyed or printed. A new JavaScript function was
added to the js_print method called MyCodePrint.
To turn off set this to ''
example:
code_download => 'Click here to get above code.',
code_download => '',
=head2 href_class
Default is '' and this allows a custom class, style and/or JavaScript to be used in the [url] tags.
must have a space before the text.
example:
href_class => ' class="url"',
href_class => ' class="url" onclick="....."',
=head2 quote_class
Default is '' and this allows a custom class, style and/or JavaScript to be used in the [quote] tags.
must have a space before the text.
example:
quote_class => ' class="quote"',
quote_class => ' class="quote" onclick="....."',
=head2 quote_extra
Default is '' and this is for a custom message, code, image, est.. to be used after a [quote] tags.
example:
quote_extra => 'QUOTES AND SAYINGS DISPLAYED ON THIS BLOG ARE NOT WRITTEN BY THE AUTHOR OF THE BLOG.',
quote_extra => '<div style="clear: left"> </div>',
=head2 script_escape
This will turn on or off the sanitizer/escape security for the hole message.
Default is 1 on and 0 for Disable.
Notes: 1)The code highlighter works best with an escaped character format like the
script_escape => 1 setting can provide.
515516517518519520521522523524525526527528529530531532533534535536537538pattern - limited to
'all'
or
'l,n,-,:,_,s'
'all'
= anything but [ or ]
'l'
=
'a-z'
'n'
=
'0-9'
's'
=
' '
'-'
=
'-'
':'
=
':'
'_'
=
'_'
type - 1 is style [name://pattern], 2 is style [name]pattern[/name], 3 is style [name],
the
next
setting
for
type the function will not be used to run Perl subroutines and
will replace the text
with
what text is
defined
in the function setting, the setting is
see function below on how type 4 works
function - a pre-
defined
subroutine that receives the matched pattern, tag name and returns what you want,
unless
type is set to 4 then it will replace the tag
with
what text is in the function.
Note:
if
the function returns undefined,
''
or 0 the tag will not be changed.
level - the array number of the security level
error - the text or HTML to show
if
user
has
no
access
724725726727728729730731732733734735736737738739740741742743744v4.03 - 02/03/2011
Addition - New Object method aubbc_error . Developers can now controle
if
or
when
to handle errors, see the POD
'Error Message'
for
usage.
Fixed - All built-in tags only convert balanced tags so
no
unbalanced HTML can
be produced
Fixed - Bug in code_highlight a highlight regex needed to be changed
after
version 4.01 to support the Parser style.
Improvement - Small restructure of add_build_tag and change the
'all'
setting
of
'pattern'
to allow more.
v4.02 - 11/28/2010
Fixed - The element ID
for
the code download started at 1
for
every instance this
will force the browser to take priority to load the first ID it reads. The fix
starts the counter at
'time.$$.000'
to
try
to produce a more unique ID
for
each
instance.
785786787788789790791792793794795796797798799800801802803804805806807808809810811Addition - AUBBC::make_link(
$link
,
$name
,
$javascript
,
$target
) this is useful enough
to mention once.
Improvement - After lots of testing I have removed all /o in the regex. One main
reason is Memoize provides enough speed.
v3.13 - 09/30/2010
Addition - do_ubbc New built-in tag [list][*=1]... [*]... [/list], This will
follow XHTML or HTML Transitional element style and XHTML or HTML Strict will not
support the elements that tag [*=1] in the [list] will produce
Addition - do_ubbc New built-in tag [em]Hello[/em]
Addition - New value
for
setting line_break 2
for
old <br style. This effects script_escape.
Addition - This module now uses Memoize
for
a massive speed improvement.
If you thought it was fast
before
, I hope your sitting down
when
you bench this version. LOL
Addition - added setting highlight_function to replace the highlighting method
of AUBBC
with
a costume one.
Fixed - in do_ubbc the line breaks was invalidating HTML
for
List Block elements
Improvement - in do_all_ubbc changed defining
$msg
each
time
. there could have
833834835836837838839840841842843844845846847848849850851852853of all the Perl BBcode modules. BBCode::Parser Parse::BBCode HTML::BBCode HTML::BBReverse
Fixed - fixed a line break and new line sandbox bug
Improvement - Massive speed improvement to the hole module and
no
features lost.
changed new
for
faster loading, the module uses vars
for
some variables,
re-spaced the hole code.
v2.10 - 08/31/2010 11:17:13
different then the other built functions. Type 4 will
the text
defined
in
function and not point to a
defined
Perl subroutine.
Addition - added line_break setting to have control over the script_escape and
html_to_text methods converting html line break <br> and new line \n
Addition - added fix_amp this setting finds all the & that need to covert to the amp; html code name
so the w3c xhtml validation checks ok.
Addition - added no_img this setting will allow some control
for
using [img] tags
917918919920921922923924925926927928929930931932933934935936937938939v1.20 - 09/07/2008 09:23:09
Fixed bug that bypassed utf tag converter
if
square bracket wasn't detected
Fixed Makefile.PL
v1.10 - 09/02/2008 09:49:46
Added two more tags [big]..[/big] and [small]..[/small].
Removed utf tag style [ux23] and [u://0931] to make more tag names available.
Changed the way functions should work
for
built tags, the custom function
for
built tags will receive the tag name and data of the tag. This is so one function can handle many tags.
Removed other site tags and setting other_sites_pattern, an example of them are in
"Build your own tags"
Removed [
time
] tag, example in
"Build your own tags"
.
Email now allows names
with
& sign
Now every message that is passed to do_all_ubbc() gets escaped
before
being returned
if
script_escape is Enabled.
examples/tag_list.cgi view on Meta::CPAN
4567891011121314151617181920212223242526use
warnings;
#use lib '../';
use
AUBBC;
my
$aubbc
= AUBBC->new();
# Change some default settings
$aubbc
->settings(
protect_email
=> 4,
html_type
=>
'xhtml'
,
code_class
=>
' class="codepost"'
,
code_extra
=>
'<div style="clear: left"> </div>'
,
quote_class
=>
' class="quote"'
,
quote_extra
=>
'<div style="clear: left"> </div>'
,
highlight_class1
=>
' class="highlightclass1"'
,
highlight_class2
=>
' class="highlightclass2"'
,
highlight_class3
=>
' class="highlightclass1"'
,
highlight_class4
=>
' class="highlightclass1"'
,
highlight_class5
=>
' class="highlightclass5"'
,
highlight_class6
=>
' class="highlightclass6"'
,
highlight_class7
=>
' class="highlightclass7"'
,
highlight_class8
=>
' class="highlightclass5"'
,
highlight_class9
=>
' class="highlightclass5"'
,
);
examples/tag_list.cgi view on Meta::CPAN
140141142143144145146147148149150151152153154155156157158159160<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<head>
<title>AUBBC.pm Tag List</title>
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=iso-8859-1"
/>
</head>
<body>
<script type=
"text/javascript"
src=
"?js_print"
>
</script>
<style type=
"text/css"
>
.codepost {
background-color:
#ffffff;
width: 80%;
height: auto;
white-space: nowrap;
overflow: scroll;
padding-left: 2px;
padding-bottom: 5px;
margin: 0;
top: 0;
examples/tag_list.cgi view on Meta::CPAN
177178179180181182183184185186187188189190191192193194195196197color :
#990000;
font-weight : normal;
font-size : 10pt;
text-decoration : none;
font-family : Courier New, Latha, sans-serif;
}
.highlightclass2 {
color :
#0000CC;
font-weight : normal;
font-size : 10pt;
font-style: italic;
text-decoration : none;
font-family : Courier New, Latha, sans-serif;
}
.highlightclass5 {
color :
#0000CC;
font-weight : normal;
font-size : 10pt;
text-decoration : none;
font-family : Courier New, Latha, sans-serif;
}
examples/tag_list.cgi view on Meta::CPAN
202203204205206207208209210211212213214215216217218219220221text-decoration : none;
font-family : Courier New, Latha, sans-serif;
}
.highlightclass7 {
color :
#009900;
font-weight : normal;
font-size : 10pt;
text-decoration : none;
font-family : Courier New, Latha, sans-serif;
}
</style>
$message
</body>
</html>
HTML
exit
;
}
sub
other_sites {
my
(
$tag_name
,
$text_from_AUBBC
) =
@_
;
( run in 0.290 second using v1.01-cache-2.11-cpan-bb97c1e446a )