AUBBC
view release on metacpan or search on metacpan
my $name = shift;
defined $name && exists &{$name} && (ref $name eq 'CODE' || ref $name eq '')
? return \&{$name}
: return '';
}
sub add_build_tag {
my ($self,%NewTag) = @_;
warn 'ENTER add_build_tag' if $DEBUG_AUBBC;
$NewTag{function2} = $NewTag{function} || 'undefined!';
$NewTag{function} = check_subroutine($NewTag{function},'')
if $NewTag{type} ne '4';
$self->aubbc_error("Usage: add_build_tag - function 'Undefined subroutine' => $NewTag{function2}")
if ! $NewTag{function};
if ($NewTag{function}) {
$NewTag{pattern} = 'l' if $NewTag{type} eq '3' || $NewTag{type} eq '4';
if ($NewTag{type} && $NewTag{name} =~ m/\A[\w\-]+\z/ && $NewTag{pattern} =~ m/\A[lns_:\-,]+|all\z/) {
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
type 4 this will use style [name] but will work different then the other built settings
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
Note: For the build tags leaving the variables blank will default level to 0 and
error to the $AUBBC::BAD_MESSAGE string.
Usage:
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
been a bug in past versions if an undefined variable was used after a defined message was
converted. was going to allow do_all_ubbc to pass the last message but decided
other people may see that as a bug.
Improvement - in do_all_ubbc moved if $do_flag[4] for no_bypass to a better spot
Improvement - in do_all_ubbc moved if for for_links to a better spot
Improvement - changed tags left,right and center to only convert balanced tags
v3.00 - 09/14/2010
Improvement - moved the pattern building code from do_build_tag to add_build_tag
so it only runs one time
Improvement - in add_build_tag using a hash array to store the build tag data so
there is no need to use split in do_build_tag
Improvement - in do_all_ubbc moved script_escape to a location where one call
to the function is needed
Improvement - in do_all_ubbc added check for undefined "$message" variable
Improvement - in script_escape added check for undefined "$text" variable
Improvement - in html_to_text added check for undefined "$html" variable
Improvement - in escape_aubbc converting the brackets one time with the html
code name so the filter will only need to run one time in do_all_ubbc. This
also fixes one bug in escape_aubbc
Removed - In script_escape removed the \cM regex, it is very rare that anyone will need
it so it wont be missed.
v2.0 - 10/07/2008 13:52:11
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
been a bug in past versions if an undefined variable was used after a defined message was
converted. was going to allow do_all_ubbc to pass the last message but decided
other people may see that as a bug.
Improvement - in do_all_ubbc moved if $do_flag[4] for no_bypass to a better spot
Improvement - in do_all_ubbc moved if for for_links to a better spot
Improvement - changed tags left,right and center to only convert balanced tags
v3.00 - 09/14/2010
Improvement - moved the pattern building code from do_build_tag to add_build_tag
so it only runs one time
Improvement - in add_build_tag using a hash array to store the build tag data so
there is no need to use split in do_build_tag
Improvement - in do_all_ubbc moved script_escape to a location where one call
to the function is needed
Improvement - in do_all_ubbc added check for undefined "$message" variable
Improvement - in script_escape added check for undefined "$text" variable
Improvement - in html_to_text added check for undefined "$html" variable
Improvement - in escape_aubbc converting the brackets one time with the html
code name so the filter will only need to run one time in do_all_ubbc. This
also fixes one bug in escape_aubbc
Removed - In script_escape removed the \cM regex, it is very rare that anyone will need
it so it wont be missed.
v2.0 - 10/07/2008 13:52:11
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
type 4 this will use style [name] but will work different then the other built settings
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
Note: For the build tags leaving the variables blank will default level to 0 and
error to the $AUBBC::BAD_MESSAGE string.
Usage:
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
been a bug in past versions if an undefined variable was used after a defined message was
converted. was going to allow do_all_ubbc to pass the last message but decided
other people may see that as a bug.
Improvement - in do_all_ubbc moved if $do_flag[4] for no_bypass to a better spot
Improvement - in do_all_ubbc moved if for for_links to a better spot
Improvement - changed tags left,right and center to only convert balanced tags
v3.00 - 09/14/2010
Improvement - moved the pattern building code from do_build_tag to add_build_tag
so it only runs one time
Improvement - in add_build_tag using a hash array to store the build tag data so
there is no need to use split in do_build_tag
Improvement - in do_all_ubbc moved script_escape to a location where one call
to the function is needed
Improvement - in do_all_ubbc added check for undefined "$message" variable
Improvement - in script_escape added check for undefined "$text" variable
Improvement - in html_to_text added check for undefined "$html" variable
Improvement - in escape_aubbc converting the brackets one time with the html
code name so the filter will only need to run one time in do_all_ubbc. This
also fixes one bug in escape_aubbc
Removed - In script_escape removed the \cM regex, it is very rare that anyone will need
it so it wont be missed.
v2.0 - 10/07/2008 13:52:11
( run in 1.110 second using v1.01-cache-2.11-cpan-d80b1682f3f )