AUBBC

 view release on metacpan or  search on metacpan

AUBBC.pm  view on Meta::CPAN

our $MEMOIZE     = 1;
my $msg          = '';
my $aubbc_error  = '';
my $long_regex   = '[\w\.\/\-\~\@\:\;\=]+(?:\?[\w\~\.\;\:\,\$\-\+\!\*\?\/\=\&\@\#\%]+?)?';
my @do_f         = (1,1,1,1,1,0,0,0,time.$$.'000','',1);
my @key64        = ('A'..'Z','a'..'z',0..9,'+','/');
my %SMILEYS      = ();
my %Build_AUBBC  = ();
my %AUBBC        = (
    aubbc               => 1,
    utf                 => 1,
    smileys             => 1,
    highlight           => 1,
    highlight_function  => \&code_highlight,
    no_bypass           => 0,
    for_links           => 0,
    aubbc_escape        => 1,
    no_img              => 0,
    icon_image          => 1,
    image_hight         => '60',
    image_width         => '90',

AUBBC.pm  view on Meta::CPAN


sub remove_build_tag {
 my ($self,$name,$type) = @_;
 warn 'ENTER remove_build_tag' if $DEBUG_AUBBC;
 delete $Build_AUBBC{$name} if exists $Build_AUBBC{$name} && !$type; # clear one
 %Build_AUBBC = () if $type && !$name; # clear all
}

sub do_unicode{
 warn 'ENTER do_unicode' if $DEBUG_AUBBC;
 $msg =~ s/\[utf:\/\/(\#?\w+)\]/&$1;/g;
}

sub do_smileys {
warn 'ENTER do_smileys' if $DEBUG_AUBBC;
$msg =~
 s/\[$_\]/make_image('',"$AUBBC{images_url}\/smilies\/$SMILEYS{$_}",'','',$_).$AUBBC{image_wrap}/ge
 foreach keys %SMILEYS;
}

sub smiley_hash {

AUBBC.pm  view on Meta::CPAN

 $msg = defined $message ? $message : '';
 if ($msg) {
  check_access();
  $msg = $self->script_escape($msg,'') if $AUBBC{script_escape};
  $msg =~ s/&(?!\#?\w+;)/&/g if $AUBBC{fix_amp};
  if (!$AUBBC{no_bypass} && $msg =~ m/\A\#no/) {
   $do_f[4] = 0 if $msg =~ s/\A\#none//;
   if ($do_f[4]) {
   $do_f[0] = 0 if $msg =~ s/\A\#noubbc//;
   $do_f[1] = 0 if $msg =~ s/\A\#nobuild//;
   $do_f[2] = 0 if $msg =~ s/\A\#noutf//;
   $do_f[3] = 0 if $msg =~ s/\A\#nosmileys//;
   }
   warn 'START no_bypass' if $DEBUG_AUBBC && !$do_f[4];
  }
  if ($do_f[4]) {
   escape_aubbc() if $AUBBC{aubbc_escape};
   if (!$AUBBC{for_links}) {
    do_ubbc($msg) if $do_f[0] && $AUBBC{aubbc};
    do_build_tag() if $do_f[5] && $do_f[1];
   }
   do_unicode() if $do_f[2] && $AUBBC{utf};
   do_smileys() if $do_f[6] && $do_f[3] && $AUBBC{smileys};
  }
 }
 $msg =~ tr/\000//d if $AUBBC{aubbc_escape};
 return $msg;
}

sub fix_message {
 my $txt = shift;
 $txt =~ s/\././g;

AUBBC.pod  view on Meta::CPAN


These settings effect a large part of what the do_all_ubbc method can do and what other
methods can do in do_all_ubbc. some settings are used in many methods

=head2 $aubbc->settings();

This is the method to change them when needed.

     $aubbc->settings(
        aubbc => 1,
        utf => 1,
        smileys => 1,
        highlight => 1,
        # est.....
      );

=head2 aubbc

Enable or Disable Main AUBBC Tags Default 1 is Enabled, 0 is Disable.

=head2 utf

Enable or Disable UTF Tags Default 1 is Enabled, 0 is Disable.

=head2 smileys

Enable or Disable Smiley Tags Default 1 is Enabled, 0 is Disable.

=head2 highlight

Enable or Disable Code Highlight Default 1 is Enabled, 0 is Disable.

AUBBC.pod  view on Meta::CPAN

Enable or Disable User Tags for bypassing hole tag sets Default 0 is Disable, 1 is Enabled.
Bypass tag must be at the very beginning of the message!!!!
Must also be in the order of the "Bypass Tag list:" but not on a new line \n
and if #none is used the other bypass tags will not be removed.

Bypass Tag list:

        #none
        #noaubbc
        #nobuild
        #noutf
        #nosmileys

=head2 for_links

 Enable or Disable Tags for Links Default 0 is Disable, 1 is Enabled.

 Some AUBBC Tags are not good to use in a link like other links.

 If Enabled will only use the UTF and Smiley tags.

AUBBC.pod  view on Meta::CPAN

v1.30 - 09/08/2008 14:12:10

Fixed the function check in add_build_tag(), when the 1.20 changes where made this check was neglected

Edited add_build_tag() Error messages, hopefully they make more sense.

Now add_build_tag() name allows - and _ in it.

v1.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 add_build_tag() to use hash variable, see "Build your own tags" for the new style.

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

CHANGES  view on Meta::CPAN

v1.30 - 09/08/2008 14:12:10

Fixed the function check in add_build_tag(), when the 1.20 changes where made this check was neglected

Edited add_build_tag() Error messages, hopefully they make more sense.

Now add_build_tag() name allows - and _ in it.

v1.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 add_build_tag() to use hash variable, see "Build your own tags" for the new style.

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

README  view on Meta::CPAN


These settings effect a large part of what the do_all_ubbc method can do and what other
methods can do in do_all_ubbc. some settings are used in many methods

=head2 $aubbc->settings();

This is the method to change them when needed.

     $aubbc->settings(
        aubbc => 1,
        utf => 1,
        smileys => 1,
        highlight => 1,
        # est.....
      );

=head2 aubbc

Enable or Disable Main AUBBC Tags Default 1 is Enabled, 0 is Disable.

=head2 utf

Enable or Disable UTF Tags Default 1 is Enabled, 0 is Disable.

=head2 smileys

Enable or Disable Smiley Tags Default 1 is Enabled, 0 is Disable.

=head2 highlight

Enable or Disable Code Highlight Default 1 is Enabled, 0 is Disable.

README  view on Meta::CPAN

Enable or Disable User Tags for bypassing hole tag sets Default 0 is Disable, 1 is Enabled.
Bypass tag must be at the very beginning of the message!!!!
Must also be in the order of the "Bypass Tag list:" but not on a new line \n
and if #none is used the other bypass tags will not be removed.

Bypass Tag list:

        #none
        #noaubbc
        #nobuild
        #noutf
        #nosmileys

=head2 for_links

 Enable or Disable Tags for Links Default 0 is Disable, 1 is Enabled.

 Some AUBBC Tags are not good to use in a link like other links.

 If Enabled will only use the UTF and Smiley tags.

README  view on Meta::CPAN

v1.30 - 09/08/2008 14:12:10

Fixed the function check in add_build_tag(), when the 1.20 changes where made this check was neglected

Edited add_build_tag() Error messages, hopefully they make more sense.

Now add_build_tag() name allows - and _ in it.

v1.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 add_build_tag() to use hash variable, see "Build your own tags" for the new style.

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

examples/bench.pl  view on Meta::CPAN

[left]]Left Align[[/left] = [left]Left Align[/left][br]
[[center]Center Align[[/center] = [center]Center Align[/center][br]
[right]]Right Align[[/right] = [right]Right Align[/right][br]
[[em]Emotion[/em]] = [em]Emotion[/em]
[sup]Sup[/sup][br]
[sub]Sub[/sub][br]
[pre]]Pre[[/pre] = [pre]Pre[/pre][br]
[img]]http://www.google.com/intl/en/images/about_logo.gif[[/img] =
[img]http://www.google.com/intl/en/images/about_logo.gif[/img][br][br]
[url=URL]]Name[[/url] = [url=http://www.google.com]http://www.google.com[/url][br]
http[utf://#58]//google.com = http://google.com[br]
[email]]Email[/email] = [email]some@email.com[/email] Recommended Not to Post your email in a public area[br]
[code]]# Some Code ......
my %hash = ( stuff => { '1' => 1, '2' => 2 }, );
print $hash{stuff}{'1'};[[/code] =
[code]# Some Code ......
my %hash = ( stuff => { '1' => 1, '2' => 2 }, );
print $hash{stuff}{'1'};[/code][br]
[c]]# Some Code ......
my %hash = ( stuff => { '1' => 1, '2' => 2 }, );
print $hash{stuff}{'1'};[/c]] =

examples/bench.pl  view on Meta::CPAN

[*]stuff3
[/list]

[ol]
[li=1].....[/li]
[li].....[/li]
[li].....[/li]
[/ol]

[b]Unicode Support[/b][br]
[utf://#x3A3]] = [utf://#x3A3][br]
[utf://#0931]] = [utf://#0931][br]
[utf://iquest]] = [utf://iquest][br]
EOM


sub create_pb {
use Parse::BBCode;
$loaded{'Parse::BBCode'} = Parse::BBCode->VERSION;
    my $pb = Parse::BBCode->new();
    return $pb;
}

examples/tag_list.cgi  view on Meta::CPAN

[left]]Left Align[[/left] = [left]Left Align[/left][br]
[[center]Center Align[[/center] = [center]Center Align[/center][br]
[right]]Right Align[[/right] = [right]Right Align[/right][br]
[[em]Em[/em]] = [em]Em[/em][br]
[[sup]Sup[/sup]] = [sup]Sup[/sup][br]
[[sub]Sub[/sub]] = [sub]Sub[/sub][br]
[pre]]Pre[[/pre] = [pre]Pre[/pre][br]
[img]]http://www.google.com/intl/en/images/about_logo.gif[[/img] =
[img]http://www.google.com/intl/en/images/about_logo.gif[/img][br][br]
[url=URL]]Name[[/url] = [url=http://www.google.com]http://www.google.com[/url][br]
http[utf://#58]//google.com = http://google.com[br]
[email]]Email[/email] = [email]some@email.com[/email] Recommended Not to Post your email in a public area[br]
[code]]# Some Code ......
my %hash = ( stuff => { '1' => 1, '2' => 2 }, );
print $hash{stuff}{'1'};[[/code] =
[code]# Some Code ......
my %hash = ( stuff => { '1' => 1, '2' => 2 }, );
print $hash{stuff}{'1'};[/code][br]
[c]]# Some Code ......
my %hash = ( stuff => { '1' => 1, '2' => 2 }, );
print $hash{stuff}{'1'};[/c]] =

examples/tag_list.cgi  view on Meta::CPAN

[li].....[/li]
[li].....[/li]
[/ol]
[[list][[*=1].....[[*]....[[/list] =
[list]
[*=1].....
[*]....
[/list][br]
[color=Red]]Color[/color]] = [color=Red]Color[/color][br]
[b]Unicode Support[/b][br]
[utf://#x3A3]] = [utf://#x3A3][br]
[utf://#0931]] = [utf://#0931][br]
[utf://iquest]] = [utf://iquest][br]
 [hr]] = [hr]
[b]Built Tags[/b][br]
[[google://Google] = [google://Google] Search[br]
[[wp://Wikipedia:About] or  [wikipedia://Wikipedia:About] Wikipedia[br]
[[wb://Wikibooks:About] or [wikibooks://Wikibooks:About] Wikibooks[br]
[[wq://Wikiquote:About] or [wikiquote://Wikiquote:About] Wikiquote[br]
[[ws://Wikisource:About_Wikisource] or [wikisource://Wikisource:About_Wikisource] Wikisource[br]
[[cpan://Cpan] = [cpan://Cpan] Cpan Module Search[br]
[[time] = [time]
HTML

test.pl  view on Meta::CPAN

# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'

######################### We start with some black magic to print on failure.

# Change 1..1 below to 1..last_test_to_print .
# (It may become useful if the test is moved to ./t subdirectory.)

my ($count, $message, $setting, $aubbc, $Current_version, %msg) =
 (1, '[br][utf://#x23]', '', '', '', (1 => 'Test good ', 2 => 'Test error ',) );

BEGIN {
 $| = 1;
 print "Test's 1 to 4\n";
}

use AUBBC;
$aubbc = new AUBBC;
{
 # did it load?



( run in 0.272 second using v1.01-cache-2.11-cpan-4d50c553e7e )