Location: PHPKode > projects > BBCode Class > bbcode-class/doc.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  <title>BBCode Class Documentation</title>
  <meta http-equiv="content-type"
 content="text/html; charset=ISO-8859-1">
<div style="text-align: center;">      
<h1>BBCode Class Documentation</h1>
      For version 1.0.0<br>
<hr width="100%" size="2">      
<div style="text-align: left;">      
        <li><a href="#overview">Overview</a><br>
     <li><a href="#functions">Functions</a></li>
       <li><a href="#add_alias">add_alias</a></li>
       <li><a href="#add_tag">add_tag</a></li>
      <li><a href="#change_setting">change_setting</a></li>
     <li><a href="#export_definition">export_definition</a></li>
     <li><a href="#get_data">get_data</a></li>
     <li><a href="#import_definition">import_definition</a></li>
     <li><a href="#parse_bbcode">parse_bbcode</a></li>
   <li><a href="#settings">Settings</a></li>
     <li><a href="#enced">enced</a><br>
<h2><a name="overview"></a>Overview</h2>
<div style="margin-left: 40px;">      
      BBCode Class<br>
      Class for parsing of BBCode.<br>
      Leif K-Brooks (<a href="mailto:hide@address.com">hide@address.com</a>)<br>
<h2><a name="functions"></a>Functions</h2>
<div style="margin-left: 40px;">   
<h3><a name="add_alias"></a>$succeeded=<a>$bbcode-&gt;</a>add_alias($name,$aliasof)</h3>
   Adds a tag that is an alias of another tag.&nbsp; For example<br>
   Adds an alias of the "img" tag named "image". &nbsp;This function returns 
 true on success, false on failure.<br>
<h3><a name="add_tag"></a>$error=<a>$bbcode-&gt;</a>add_tag($params)</h3>
   Adds a tag to the current BBCode definition. &nbsp;It returns an error 
message  if adding did not succeed, otherwise it returns an empty string.<br>
<p>The $params argument is an associative array with parameters to the function.<br>
    <p>This argument specifies what the tag will be called. &nbsp;For a tag 
 that will be used as [b], for example, this would be "b".</p>
   (defaults to false)<br>
    <p>This argument is a boolean. &nbsp;True means the tag has a parameter 
 ([tag=parameter] for example), false means it doesn't ([tag] for example)</p>
    <p>The HTML that the start tag is replaced with. &nbsp;"%%P%%" is replaced 
 by the tag's parameter. &nbsp;For a [b] tag, this would be "&lt;b&gt;".</p>
   (required for complex HtmlBegin)<br>
    <p>The HTML that the end tag is replaced with. &nbsp;For a [b] tag, this 
 would be "&lt;/b&gt;".<br>
    <p>The class attempts to determine HtmlEnd from the HtmlBegin parameter 
 if HtmlEnd isn't specified, but you should always specify this as it has 
trouble with anything more complex than a single tag with no parameters.</p>
   (defaults to "[^\]]+")<br>
    <p>A PCRE-fragment to determine if the parameter is valid. &nbsp;It is 
 highly reccomened that you do not allow "]" to be in the parameter, as it 
 tends to be confused with the tag's ending.</p>
   (defaults to empty array)<br>
    <p>Associative array of PCRE replacments to do on the parameter, with 
 the keys being the search values and the values being the replacment.</p>
   (defaults to true)<br>
    <p>Boolean for whether there is an end tag. &nbsp;If it is set to true, 
 the class ensures that all tags are ended.</p>
<h3><a name="change_setting"></a><a>$bbcode-&gt;</a>change_setting($name,$value)</h3>
   Changes the <a href="#settings">setting</a> named $name to $value.<br>
<h3><a name="export_definition"></a><a>$bbcode-&gt;</a>export_definition()</h3>
  Returns the a serialized copy of the current tag definition, ready to be
 imported with <a href="#import_definition">import_definition</a>.<br>
<h3><a name="get_data"></a>$data=<a>$bbcode-&gt;</a>get_data($name)</h3>
  Returns an array of the data of the tag named $name. &nbsp;Note that if 
$name is an alias, the "Name" property will be the alias's name.<br>
<h3><a name="import_definition"></a>$succeeded=<a>$bbcode-&gt;</a>import_definition($definition,$mode)</h3>
  Imports a tag definition from the <a href="#export_definition">export_definition</a>
  Appends $definition to the current definition, using&nbsp; $definition's
 tag for duplicates.</li>
  Prepends $definition to the current definition, using the current definition
 for duplicates.</li>
  Removes the current defintion and adds $definition.<br>
<h3><a name="parse_bbcode">$result=$bbcode-&gt;parse_bbcode($text)</a></h3>
  Parses $text according to the current BBCode definition, and returns the
<h2><a name="settings"></a>Settings</h2>
<div style="margin-left: 40px;">These settings change how certain features 
behave. &nbsp;They can be set with the <a href="#change_setting">change_setting</a> 
<h3><a name="enced"></a>enced</h3>
 (defaults to true)<br>
 Boolean for whether or not strings passes to the <a
 href="#parse_bbcode">parse_bbcode</a> function are html-encoded.<br>
Return current item: BBCode Class