A php class of UBB

Source: Internet
Author: User
The following are the source code call methods: & #36; unewEncodeQ3boy (); echo & #36; u-& gt; ubbEncode (& #36; _ POST [OK]); & lt; formmethodpostaction & gt; & lt; textareanameokrows6cols60 & gt; & lt; textare:

$ U = new EncodeQ3boy ();

Echo $ u-> ubbEncode ($ _ POST ["OK"]);

/*
Text Encode Class
Write by q3boy 2003.3.10
Usage:
$ Eq = new EncodeQ3boy ($ str); initialization class
// The ubbEncode parameter is as follows:
$ Eq-> url = true; // enable automatic url resolution; default value: false
$ Eq-> html = true; // enable HTML encoding (processing <,>, full-width/halfwidth space, tab, line feed). The default value is true.
$ Eq-> image = true; // enable image tag resolution. the default value is true.
$ Eq-> font = true; // enable font tag parsing default value: true
$ Eq-> element = true; // enable external element resolution. the default value is true.
$ Eq-> flash = true; // enable the default value of true for Flash resolution
$ Eq-> php = true; // enable syntax highlighting. the default value is true.
// The ubbEncode parameter ends.
Echo ($ eq-> getImageOpener (); // js functions required for auto scaling of output images
Echo $ eq-> htmlEncode (); // output the string encoded by ubb
Echo "";
Echo $ eq-> ubbEncode (); // output the ubb encoded string
Echo "";
Echo $ eq-> removeHtml (); // output the string for removing the html tag
Echo "";
Echo $ eq-> ubbEncode (); // output the string to remove the ubb tag
Support ubb label list:
Image:
Insert image
[Limg] http://www.aaa.com/aaa.gif#/limg]
[Rimg] http://www.aaa.com/aaa.gif#/rimg]
[Cimg] http://www.aaa.com/aaa.gif?/cimg]
Text Control class:
[Br] line feed
[B] bold words [B]
[I] italics [I]
[U] underline [u]
[S] strikethrough [s]
[Sub] text subscript [sub]
[Sup] text tagging [sup]
[Left] left-aligned text [left]
[Right] right-aligned text [right]
[Center] text center [center]
[Align = (left | center | right)] align
)] Text size [size]
[Font = (font) [font]
[Color = (text color)] [color]

    Unordered list

        Ordered list

            Ordered list (the list method is (abc, 123, I II III ))

                Ordered list (count from num)

                  [Li] list Unit items [li]
                  External element class:
                  Link
                  Link text
                  Email address
                  Description text email address
                  Reference block [/quote]
                  [Iframe] interpolation frame address [/iframe]
                  [Iframe = (interpolation frame height)] interpolation frame address [/iframe]
                  [Swf] flash animation address [/swf]
                  [Swf = width, height] flash animation address [/swf]
                  Code block:

                  [Php] [/php]
                  [Code block name] [/code]
                  [Php code block name] [/php]
                  To highlight using php syntax, add" "Tag
                  */
                  Class EncodeQ3boy {
                  Var $ str = "";
                  Var $ iconpath = "/image/icon"; // icon file path
                  Var $ imagepath = "/upfiles/article"; // default path of the image file
                  Var $ tagfoot = 'border = "1" style = "cursor: hand" '; // additional attributes of the image file
                  Var $ url = false; // automatic url resolution
                  Var $ html = true; // HTML encoding
                  Var $ image = true; // Parse image labels
                  Var $ font = true; // font label
                  Var $ element = true; // external element
                  Var $ flash = true; // Flash
                  Var $ php = true; // syntax highlighted
                  Function EncodeQ3boy ($ str = '', $ imgph = ''){
                  If ($ str ){
                  $ Str = strtr ($ str, array ("nr" => "n", "rn" => "n", "r" => "n ", "" => ""));
                  $ This-> str = $ str;
                  }
                  If ($ imgph) $ this-> imagepath = $ imgph;
                  }
                  Function getImageOpener (){
                  Return"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.