JBoss.orgCommunity Documentation

BBCode Configuration

The BBCode plug-in component defines default BBCode data in the .xml file, including BBCode tags, for example, I, B, U, SIZE, COLOR.

When the BBCode Service runs, it will get values returned from the BBCode plug-in component to initialize default BBCode data.

Configuration of default BBCode data

The default BBCode data is configured in the bbcodes-configuration.xml file.

In particular, at runtime of BBCode Service, the BBCode plug-in component is called. Then, the bbcodes-configuration.xml file will be executed, and the component-plugin named registerBBCodePlugin will be referred to org.exoplatform.ks.bbcode.spi.BBCodePlugin to execute some objects that will generate default data.



<component-plugin>
  <name>forum.default.bbcodes</name>
  <set-method>registerBBCodePlugin</set-method>
  <type>org.exoplatform.ks.bbcode.spi.BBCodePlugin</type>
  <description>default supported BBCodes</description>
  <init-params>
    <object-param>
      <name>I</name>
      <description>set text in italic</description>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>I</string>
        </field>
        <field name="replacement">
          <string>&lt;i&gt;{param}&lt;/i&gt;</string>
        </field>
        <field name="description">
          <string>Set text in italic</string>
        </field>
        <field name="example">
          <string>[I]This text is italic[/I]</string>
        </field>
        <field name="isOption">
          <string>false</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object> 
    </object-param>

    <object-param>
      <name>B</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>B</string>
        </field>
        <field name="replacement">
          <string>&lt;strong&gt;{param}&lt;/strong&gt;</string>
        </field>
        <field name="description">
          <string>Set text in bold</string>
        </field>
        <field name="example">
          <string>[B]This text is bold[/B]</string>
        </field>
        <field name="isOption">
          <string>false</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>U</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>U</string>
        </field>
        <field name="replacement">
          <string>&lt;u&gt;{param}&lt;/u&gt;</string>
        </field>
        <field name="description">
          <string>Set text in underline</string>
        </field>
        <field name="example">
          <string>[U]This text is underline[/U]</string>
        </field>
        <field name="isOption">
          <string>false</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>COLOR</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>COLOR</string>
        </field>
        <field name="replacement">
          <string>&lt;font color="{option}"&gt;{param}&lt;/font&gt;</string>
        </field>
        <field name="description">
          <string>The [color=option] tag allows you to change the color of your text.</string>
        </field>
        <field name="example">
          <string>[COLOR=blue]This text is blue[/COLOR]</string>
        </field>
        <field name="isOption">
          <string>true</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>SIZE</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>SIZE</string>
        </field>
        <field name="replacement">
          <string>&lt;font size="{option}"&gt;{param}&lt;/font&gt;</string>
        </field>
        <field name="description">
          <string>The [size=option] tag allows you to change the size of your text.</string>
        </field>
        <field name="example">
          <string>[size=+2]this text is two sizes larger than normal[/size]</string>
        </field>
        <field name="isOption">
          <string>true</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>FONT</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>FONT</string>
        </field>
        <field name="replacement">
          <string>&lt;font face="{option}"&gt;{param}&lt;/font&gt;</string>
        </field>
        <field name="description">
          <string>The [font=option] tag allows you to change the font of your text.</string>
        </field>
        <field name="example">
          <string>[font=courier]this text is in the courier font[/font]</string>
        </field>
        <field name="isOption">
          <string>true</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>HIGHLIGHT</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>HIGHLIGHT</string>
        </field>
        <field name="replacement">
          <string>&lt;span style="font-weight: bold; color: blue;"&gt;{param}&lt;/span&gt;</string>
        </field>
        <field name="description">
          <string>The [highlight] tag allows you to make highlight of your text.</string>
        </field>
        <field name="example">
          <string>[highlight]this text is highlighted[/highlight]</string>
        </field>
        <field name="isOption">
          <string>false</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>LEFT</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>LEFT</string>
        </field>
        <field name="replacement">
          <string>&lt;div align="left"&gt;{param}&lt;/div&gt;</string>
        </field>
        <field name="description">
          <string>The [left] tag allows aligntment text to left. </string>
        </field>
        <field name="example">
          <string>[LEFT]This text is left-aligned[/LEFT]</string>
        </field>
        <field name="isOption">
          <string>false</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>RIGHT</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>RIGHT</string>
        </field>
        <field name="replacement">
          <string>&lt;div align="right"&gt;{param}&lt;/div&gt;</string>
        </field>
        <field name="description">
          <string>The [right] tag allows aligntment text to right.</string>
        </field>
        <field name="example">
          <string>[RIGHT]example[/RIGHT]</string>
        </field>
        <field name="isOption">
          <string>[RIGHT]this text is right-aligned[/RIGHT]</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>CENTER</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>CENTER</string>
        </field>
        <field name="replacement">
          <string>&lt;div align="center"&gt;{param}&lt;/div&gt;</string>
        </field>
        <field name="description">
          <string>The [center] allows aligntment text to center.</string>
        </field>
        <field name="example">
          <string>[CENTER]this text is center-aligned[/CENTER]</string>
        </field>
        <field name="isOption">
          <string>false</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>JUSTIFY</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>JUSTIFY</string>
        </field>
        <field name="replacement">
          <string>&lt;div align="justify"&gt;{param}&lt;/div&gt;</string>
        </field>
        <field name="description">
          <string>The [justify] tag allows aligntment text to justify.</string>
        </field>
        <field name="example">
          <string>[JUSTIFY]this text is justify-aligned[/JUSTIFY]</string>
        </field>
        <field name="isOption">
          <string>false</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>EMAIL</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>EMAIL</string>
        </field>
        <field name="replacement">
          <string>&lt;a href="mailto:{param}"&gt;{param}&lt;/a&gt;</string>
        </field>
        <field name="description">
          <string>The [email] tag allows you to link to an email address.</string>
        </field>
        <field name="example">
          <string>[email]demo@example.com[/email]</string>
        </field>
        <field name="isOption">
          <string>false</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>EMAIL-OPT</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>EMAIL</string>
        </field>
        <field name="replacement">
          <string>&lt;a href="mailto:{option}"&gt;{param}&lt;/a&gt;</string>
        </field>
        <field name="description">
          <string>The [email=option] tag allows link to an email address and use an optional parameter to 'name' of this link.</string>
        </field>
        <field name="example">
          <string>[email=demo@example.com]Click Here to Email me[/email] </string>
        </field>
        <field name="isOption">
          <string>true</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>URL</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>URL</string>
        </field>
        <field name="replacement">
          <string>&lt;a target='_blank' href="{param}"&gt;{param}&lt;/a&gt;</string>
        </field>
        <field name="description">
          <string>The [url] tag allows link to other websites and files.</string>
        </field>
        <field name="example">
          <string>[URL]http://www.exoplatform.com[/URL]</string>
        </field>
        <field name="isOption">
          <string>false</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>URL-OPT</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>URL</string>
        </field>
        <field name="replacement">
          <string>&lt;a target='_blank' href="{option}"&gt;{param}&lt;/a&gt;</string>
        </field>
        <field name="description">
          <string>The [url=option] tag allows link to other websites and files and usean optional parameter to 'name' of thislink.</string>
        </field>
        <field name="example">
          <string>[URL=http://www.exoplatform.com]Click goto exoplatform website.[/URL]</string>
        </field>
        <field name="isOption">
          <string>true</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>GOTO</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>GOTO</string>
        </field>
        <field name="replacement">
          <string>&lt;a href="{option}"&gt;{param}&lt;/a&gt;</string>
        </field>
        <field name="description">
          <string>Allows goto directly to link instead of open a new window or a new tab. </string>
        </field>
        <field name="example">
          <string>[goto=http://www.exoplatform.com]Goto this link.[/goto]&gt;</string>
        </field>
        <field name="isOption">
          <string>true</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>LIST</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>LIST</string>
        </field>
        <field name="replacement">
          <string>You can not define this bbcode tag. It is defined by the developer.</string>
        </field>
        <field name="description">
          <string>The [list] tag allows create simple, each bullet is denoted by the [*] tag.</string>
        </field>
        <field name="example">
          <string>[list][*]list item 1[*]list item 2[/list]</string>
        </field>
        <field name="isOption">
          <string>false</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>LIST-OPT</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>LIST</string>
        </field>
        <field name="replacement">
          <string>You can not define this bbcode tag. It is defined by the developer.</string>
        </field>
        <field name="description">
          <string>The [list=option] tag allows create bulleted lists specifying an option. Within the value portion, each bullet is denoted by the [*] tag.</string>
        </field>
        <field name="example">
          <string>[list=1][*]list item 1[*]list item 2[/list]</string>
        </field>
        <field name="isOption">
          <string>true</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>IMG</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>IMG</string>
        </field>
        <field name="replacement">
          <string>&lt;img border="0" alt="" src="{param}" class="inlineimg"/&gt;</string>
        </field>
        <field name="description">
          <string>The [img] tag allows you to shows the image indicated by {url}</string>
        </field>
        <field name="example">
          <string>[url=http://www.google.com.vn] [img]http://groups.google.com.vn/groups/img/3nb/groups_medium_vi.gif[/img] [/url]</string>
        </field>
        <field name="isOption">
          <string>false</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>QUOTE</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>QUOTE</string>
        </field>
        <field name="replacement">
          <string>&lt;div style="background:#ededf7; border:1px solid #d8d8d8; padding:6px 6px 6px 15px; margin:2px 0px;"&gt;{param}&lt;/div&gt;</string>
        </field>
        <field name="description">
          <string>The [quote] tag allows attribute content of post.</string>
        </field>
        <field name="example">
          <string>[quote]Lorem ipsum dolor sit amet[/quote]</string>
        </field>
        <field name="isOption">
          <string>false</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>QUOTE-OPT</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>QUOTE</string>
        </field>
        <field name="replacement">
          <string>&lt;div style="background:#ededf7; border:1px solid #d8d8d8; padding:6px 6px 6px 15px; margin:2px 0px;"&gt;&lt;div&gt;Originally Posted by &lt;strong&gt;{option}&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;{param}&lt;/div&gt;&lt;/div&gt;</string>
        </field>
        <field name="description">
          <string>The [quote=option] tag allows attibute content and user name of poster.</string>
        </field>
        <field name="example">
          <string>[quote=John Doe]Lorem ipsum dolor sit amet[/quote]</string>
        </field>
        <field name="isOption">
          <string>true</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>CODE</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>CODE</string>
        </field>
        <field name="replacement">
          <string>&lt;div style="background:#ededed; border:1px inset #7b7b7b; margin:5px; overflow:auto;"&gt;&lt;pre style="margin: 0px; padding: 0px; overflow: auto; text-align: left;" dir="ltr"&gt;&lt;div&gt;{param}&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</string>
        </field>
        <field name="description">
          <string>The [code] tag allows you to view source code html.</string>
        </field>
        <field name="example">
          <string>[code]&lt;div&gt;some text or code html&lt;/div&gt;[/code]</string>
        </field>
        <field name="isOption">
          <string>false</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>CSS</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>CSS</string>
        </field>
        <field name="replacement">
          <string>&lt;span class="{option}"&gt;{param}&lt;/span&gt;</string>
        </field>
        <field name="description">
          <string>The [css=option] tag allows you to add div tag and set class Name for this it.</string>
        </field>
        <field name="example">
          <string>[css=highlight]Text is highlight[/css]</string>
        </field>
        <field name="isOption">
          <string>true</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>

    <object-param>
      <name>SLIDESHARE</name>
      <description/>
      <object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
        <field name="tagName">
          <string>SLIDESHARE</string>
        </field>
        <field name="replacement">
          <string>
          &lt;div style="width:425px; height:355px;" align="center"&gt;
          &lt;object style="margin:0px" width="425" height="355"&gt;
            &lt;param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc={option}&amp;rel=0"/&gt;
            &lt;param name="allowFullScreen" value="true"/&gt;
            &lt;param name="allowScriptAccess" value="always"/&gt;
            &lt;embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc={option}&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"&gt;
            &lt;/embed&gt;
          &lt;/object&gt;
          &lt;strong&gt;{param}&lt;/strong&gt;&lt;/div&gt;
          </string>
        </field>
        <field name="description">
          <string>The [SLIDESHARE=option] tag allows you to run slide in slidesharecdn.com site.</string>
        </field>
        <field name="example">
          <string>[SLIDESHARE=slideId]My slide[/SLIDESHARE]</string>
        </field>
        <field name="isOption">
          <string>true</string>
        </field>
        <field name="isActive">
          <string>true</string>
        </field>
      </object>
    </object-param>
  </init-params>
</component-plugin>
Name Set method Type Description
forum.default.bbcodes registerBBCodePlugin org.exoplatform.ks.bbcode. spi.BBCodePlugin Define formats for data displayed on UI.


<object type="org.exoplatform.ks.bbcode.spi.BBCodeData">
  <field name="tagName">
    <string>I</string>
  </field>
  <field name="replacement">
    <string>&lt;i&gt;{param}&lt;/i&gt;</string>
  </field>
  <field name="description">
    <string>Set text in italic</string>
  </field>
  <field name="example">
    <string>[I]This text is italic[/I]</string>
  </field>
  <field name="isOption">
    <string>false</string>
  </field>
  <field name="isActive">
    <string>true</string>
  </field>
</object> 


<field name="tagName">
  <string>I</string>
</field>
<field name="replacement">
  <string>&lt;i&gt;{param}&lt;/i&gt;</string>
</field>
<field name="description">
  <string>Set text in italic</string>
</field>
<field name="example">
  <string>[I]This text is italic[/I]</string>
</field>
<field name="isOption">
  <string>false</string>
</field>
<field name="isActive">
  <string>true</string>
</field>

In which:

Field name Value Description
tagName string The text for the BBCode, which is put between two square brackets ([ ]). For example, for the bold tag, if you type [b], the BBCode tag will be b without any square brackets ([ ]).
replacement string The HTML code that replaces the BBCode entered by the user. Make sure that you include '{param}' (without quotes) to insert the text between opening and closing BBCode tags, and '{option}' for the parameter within the BBCode tag. You can only use option if 'Use Option' is selected.
description string The piece of text to describe the BBCode tag, including HTML tags if you want.
example string The sample piece of BBCode to use as an example for the particular BBCode. For example, to demonstrate the usage of [b] tag, enter [b]text[/b].
isOption true, false Select the [tag=option] [/tag] style tag, rather than just a [tag][/tag] style tag. This function will be created if you select this option.
isActive true, false Activate the BBCode tag.