[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/includes/ -> bbcode.php (summary)

(no description)

File Size: 790 lines (27 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 16 functions

  load_bbcode_template()
  prepare_bbcode_template()
  bbencode_second_pass()
  make_bbcode_uid()
  bbencode_first_pass()
  bbencode_first_pass_pda()
  bbencode_second_pass_code()
  make_clickable()
  undo_make_clickable()
  undo_htmlspecialchars()
  replace_listitems()
  escape_slashes()
  bbcode_array_push()
  bbcode_array_pop()
  smilies_pass()
  smiley_sort()

Functions
Functions that are not part of a class:

load_bbcode_template()   X-Ref
Loads bbcode templates from the bbcode.tpl file of the current template set.
Creates an array, keys are bbcode names like "b_open" or "url", values
are the associated template.
Probably pukes all over the place if there's something really screwed
with the bbcode.tpl file.

Nathan Codding, Sept 26 2001.

prepare_bbcode_template($bbcode_tpl)   X-Ref
Prepares the loaded bbcode templates for insertion into preg_replace()
or str_replace() calls in the bbencode_second_pass functions. This
means replacing template placeholders with the appropriate preg backrefs
or with language vars. NOTE: If you change how the regexps work in
bbencode_second_pass(), you MUST change this function.

Nathan Codding, Sept 26 2001


bbencode_second_pass($text, $uid)   X-Ref
Does second-pass bbencoding. This should be used before displaying the message in
a thread. Assumes the message is already first-pass encoded, and we are given the
correct UID as used in first-pass encoding.


make_bbcode_uid()   X-Ref
No description

bbencode_first_pass($text, $uid)   X-Ref
No description

bbencode_first_pass_pda($text, $uid, $open_tag, $close_tag, $close_tag_new, $mark_lowest_level, $func, $open_regexp_replace = false)   X-Ref
$text - The text to operate on.
$uid - The UID to add to matching tags.
$open_tag - The opening tag to match. Can be an array of opening tags.
$close_tag - The closing tag to match.
$close_tag_new - The closing tag to replace with.
$mark_lowest_level - boolean - should we specially mark the tags that occur
at the lowest level of nesting? (useful for [code], because
we need to match these tags first and transform HTML tags
in their contents..
$func - This variable should contain a string that is the name of a function.
That function will be called when a match is found, and passed 2
parameters: ($text, $uid). The function should return a string.
This is used when some transformation needs to be applied to the
text INSIDE a pair of matching tags. If this variable is FALSE or the
empty string, it will not be executed.
If open_tag is an array, then the pda will try to match pairs consisting of
any element of open_tag followed by close_tag. This allows us to match things
like [list=A]...[/list] and [list=1]...[/list] in one pass of the PDA.

NOTES:    - this function assumes the first character of $text is a space.
- every opening tag and closing tag must be of the [...] format.

bbencode_second_pass_code($text, $uid, $bbcode_tpl)   X-Ref
Does second-pass bbencoding of the [code] tags. This includes
running htmlspecialchars() over the text contained between
any pair of [code] tags that are at the first level of
nesting. Tags at the first level of nesting are indicated
by this format: [code:1:$uid] ... [/code:1:$uid]
Other tags are in this format: [code:$uid] ... [/code:$uid]


make_clickable($text)   X-Ref
Rewritten by Nathan Codding - Feb 6, 2001.
- Goes through the given string, and replaces xxxx://yyyy with an HTML <a> tag linking
to that URL
- Goes through the given string, and replaces www.xxxx.yyyy[zzzz] with an HTML <a> tag linking
to http://www.xxxx.yyyy[/zzzz]
- Goes through the given string, and replaces xxxx@yyyy with an HTML mailto: tag linking
to that email address
- Only matches these 2 patterns either after a space, or at the beginning of a line

Notes: the email one might get annoying - it's easy to make it more restrictive, though.. maybe
have it require something like xxxx@yyyy.zzzz or such. We'll see.

undo_make_clickable($text)   X-Ref
Nathan Codding - Feb 6, 2001
Reverses the effects of make_clickable(), for use in editpost.
- Does not distinguish between "www.xxxx.yyyy" and "http://aaaa.bbbb" type URLs.


undo_htmlspecialchars($input)   X-Ref
Nathan Codding - August 24, 2000.
Takes a string, and does the reverse of the PHP standard function
htmlspecialchars().


replace_listitems($text, $uid)   X-Ref
This is used to change a [*] tag into a [*:$uid] tag as part
of the first-pass bbencoding of [list] tags. It fits the
standard required in order to be passed as a variable
function into bbencode_first_pass_pda().


escape_slashes($input)   X-Ref
Escapes the "/" character with "\/". This is useful when you need
to stick a runtime string into a PREG regexp that is being delimited
with slashes.


bbcode_array_push(&$stack, $value)   X-Ref
This function does exactly what the PHP4 function array_push() does
however, to keep phpBB compatable with PHP 3 we had to come up with our own
method of doing it.
This function was deprecated in phpBB 2.0.18


bbcode_array_pop(&$stack)   X-Ref
This function does exactly what the PHP4 function array_pop() does
however, to keep phpBB compatable with PHP 3 we had to come up with our own
method of doing it.
This function was deprecated in phpBB 2.0.18


smilies_pass($message)   X-Ref
No description

smiley_sort($a, $b)   X-Ref
No description



Generated: Mon Jan 14 19:21:40 2013 Cross-referenced by PHPXref 0.7.1