/shared/codes.php
PHP | 4537 lines | 2349 code | 800 blank | 1388 comment | 419 complexity | f92ed821b33a69f7ff4014c9e52ef3da MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- <?php
- /**
- * Transform some text containing UBB-like code sequences.
- *
- * @todo CDATA for proxy http://javascript.about.com/library/blxhtml.htm
- * @todo [files] - most recent files, in a compact list
- * @todo [files=section:<id>] - files attached in the given section
- * @todo [links] - most recent links, in a compact list
- * @todo [links=section:<id>] - links attached in the given section
- * @todo for [read, add hits aside
- * @todo add a code to link images with clickable maps
- * @todo replace marquee with our own customizable scroller
- * @todo WiKi rendering for lists
- *
- * This module uses the Skin class for the actual rendering.
- *
- * Basic codes, demonstrated into [link]codes/basic.php[/link]:
- * - **...** - wiki bold text
- * - [b]...[/b] - bold text
- * - //...// - italics
- * - [i]...[/i] - italics
- * - __...__ - underlined
- * - [u]...[/u] - underlined
- * - ##...## - monospace
- * - [code]...[/code] - a short sample of fixed-size text (e.g. a file name)
- * - [color]...[/color] - change font color
- * - [tiny]...[/tiny] - tiny size
- * - [small]...[/small] - small size
- * - [big]...[/big] - big size
- * - [huge]...[/huge] - huge size
- * - [subscript]...[/subscript] - subscript
- * - [superscript]...[/superscript] - superscript
- * - ++...++ - inserted
- * - [inserted]...[/inserted] - inserted
- * - --...-- - deleted
- * - [deleted]...[/deleted] - deleted
- * - [flag]...[/flag] - draw attention
- * - [lang=xy]...[/lang] - show some text only on matching language
- * - [style=sans-serif]...[/style] - use a sans-serif font
- * - [style=serif]...[/style] - use a serif font
- * - [style=cursive]...[/style] - mimic hand writing
- * - [style=comic]...[/style] - make it funny
- * - [style=fantasy]...[/style] - guess what will appear
- * - [style=my_style]...[/style] - translated to <span class="my_style">...</span>
- *
- * @see codes/basic.php
- *
- * Block codes, demonstrated in [link]codes/blocks.php[/link]:
- * - [indent]...[/indent] - shift text to the right
- * - [center]...[/center] - some centered text
- * - [right]...[/right] - some right-aligned text
- * - [decorated]...[/decorated] - some pretty paragraphs
- * - [caution]...[/caution] - a warning paragraph
- * - [note]...[/note] - a noticeable paragraph
- * - [php]...[/php] - a snippet of php
- * - [snippet]...[/snippet] - a snippet of fixed font data
- * - [quote]...[/quote] - a block of quoted text
- * - [folded]...[/folded] - click to view its content, or to fold it away
- * - [folded=foo bar]...[/folded] - with title 'foo bar'
- * - [unfolded]...[/unfolded] - click to fold
- * - [unfolded=foo bar]...[/unfolded] - with title 'foo bar'
- * - [sidebar]...[/sidebar] - a nice box aside
- * - [sidebar=foo bar]...[/sidebar] - with title 'foo bar'
- * - [scroller]...[/scroller] - some scrolling text
- *
- * @see codes/blocks.php
- *
- * List codes, demonstrated in [link]codes/lists.php[/link]:
- * - [*] - for simple lists
- * - [list]...[/list] - bulleted list
- * - [list=1]...[/list] - numbered list, use numbers
- * - [list=a]...[/list] - numbered list, use letters
- * - [list=A]...[/list] - numbered list, use capital letters
- * - [list=i]...[/list] - numbered list, use roman numbers
- * - [list=I]...[/list] - numbered list, use upper case roman numbers
- *
- * @see codes/lists.php
- *
- * Codes for links, demonstrated in [link]codes/links.php[/link]:
- * - <url> - <a href="url">url</a> or <a href="url" class="external">url</a>
- * - [link]<url>[/link] - <a href="url">url</a> or <a href="url" class="external">url</a>
- * - [<label>|<url>] - <a href="url">label</a> or <a href="url" class="external">label</a>
- * - [link=<label>]<url>[/link] - <a href="url">label</a> or <a href="url" class="external">label</a>
- * - [url]<url>[/url] - deprecated by [link]
- * - [url=<url>]<label>[/url] - deprecated by [link]
- * - [button=<label>|<url>] - build simple buttons with css
- * - [click=<label>|<url>] - a button that counts clicks
- * - [clicks=<url>] - lists people who have clicked
- * - <address> - <a href="mailto:address" class="email">address</a>
- * - [email]<address>[/email] - <a href="mailto:address" class="email">address</a>
- * - [email=<name>]<address>[/email] - <a href="mailto:address" class="email">name</a>
- * - [go=<name>, <label>] - trigger the selector on 'name'
- * - [[<name>, <label>]] - Wiki selector
- * - [article=<id>] - use article title as link label
- * - [article=<id>, foo bar] - with label 'foo bar'
- * - [article.description=<id>] - insert article description
- * - [form=<id>] - use form title as link label
- * - [form=<id>, foo bar] - with label 'foo bar'
- * - [next=<id>] - shortcut to next article
- * - [next=<id>, foo bar] - with label 'foo bar'
- * - [previous=<id>] - shortcut to previous article
- * - [previous=<id>, foo bar] - with label 'foo bar'
- * - [random] - pick up one page randomly
- * - [random=<section:id>] - one page in this section
- * - [section=<id>] - use section title as link label
- * - [section=<id>, foo bar] - with label 'foo bar'
- * - [category=<id>] - use category title as link label
- * - [category=<id>, foo bar] - with label 'foo bar'
- * - [category.description=<id>] - insert category description
- * - [decision=<id>] - use decision id in link label
- * - [decision=<id>, foo bar] - with label 'foo bar'
- * - [user=<id>] - use nick name as link label
- * - [user=<id>, foo bar] - with label 'foo bar'
- * - [server=<id>] - use server title as link label
- * - [server=<id>, foo bar] - with label 'foo bar'
- * - [file=<id>] - use file title as link label
- * - [file=<id>, foo bar] - with label 'foo bar'
- * - [download=<id>] - a link to download a file
- * - [download=<id>, foo bar] - with label 'foo bar'
- * - [comment=<id>] - use comment id in link label
- * - [comment=<id>, foo bar] - with label 'foo bar'
- * - [script]<path/script.php>[/script] - to the phpDoc page for script 'path/script.php'
- * - [search] - a search form
- * - [search=<word>] - hit Enter to search for 'word'
- * - [action=<id>] - use action title as link label
- * - [action=<id>, foo bar] - with label 'foo bar'
- * - [wikipedia=<keyword] - search Wikipedia
- * - [wikipedia=<keyword, foo bar] - search Wikipedia, with label 'foo bar'
- *
- * @see codes/links.php
- *
- * Titles and questions, demonstrated in [link]codes/titles.php[/link]:
- * - [toc] - table of contents
- * - ==...== - a level 1 headline
- * - [title]...[/title] - a level 1 headline, put in the table of contents
- * - ===...=== - a level 2 headline
- * - [subtitle]...[/subtitle] - a level 2 headline
- * - [header1]...[/header1] - a level 1 headline
- * - [header2]...[/header2] - a level 2 headline
- * - [header3]...[/header3] - a level 3 headline
- * - [header4]...[/header4] - a level 4 headline
- * - [header5]...[/header5] - a level 5 headline
- * - [toq] - the table of questions for this page
- * - [question]...[/question] - a question-title
- * - [question] - a simple question
- * - [answer] - some answer in a FAQ
- *
- * @see codes/titles.php
- *
- * Tables, demonstrated in [link]codes/tables.php[/link]:
- * - [table]...[/table] - one simple table
- * - [table=grid]...[/table] - add a grid
- * - [table].[body].[/table] - a table with headers
- * - [csv]...[/csv] - import some data from Excel
- * - [csv=;]...[/csv] - import some data from Excel
- * - [table.json] - format a table as json
- *
- * @see codes/tables.php
- *
- * Live codes, demonstrated in [link]codes/live.php[/link]:
- * - [sections] - site map
- * - [sections=section:<id>] - sub-sections
- * - [sections=self] - sections assigned to current surfer
- * - [sections=user:<id>] - sections assigned to given user
- * - [categories] - category tree
- * - [categories=category:<id>] - sub-categories
- * - [categories=self] - categories assigned to current surfer
- * - [categories=user:<id>] - categories assigned to given user
- * - [published] - most recent published pages, in a compact list
- * - [published=section:<id>] - articles published most recently in the given section
- * - [published=category:<id>] - articles published most recently in the given category
- * - [published=user:<id>] - articles published most recently created by given user
- * - [published.decorated=self, 20] - 20 most recent pages from current surfer, as a decorated list
- * - [updated] - most recent updated pages, in a compact list
- * - [updated=section:<id>] - articles updated most recently in the given section
- * - [updated=category:<id>] - articles updated most recently in the given category
- * - [updated=user:<id>] - articles updated most recently created by given user
- * - [updated.simple=self, 12] - articles updated most recently created by current surfer, as a simple list
- * - [read] - most read articles, in a compact list
- * - [read=section:<id>] - articles of fame in the given section
- * - [read=self] - personal hits
- * - [read=user:<id>] - personal hits
- * - [voted] - most voted articles, in a compact list
- * - [voted=section:<id>] - articles of fame in the given section
- * - [voted=self] - personal hits
- * - [voted=user:<id>] - personal hits
- * - [collections] - list available collections
- * - [users=present] - list of users present on site
- *
- * @see codes/live.php
- *
- * Widgets, demonstrated in [link]codes/widgets.php[/link]:
- * - [newsfeed=url] - integrate a newsfeed dynamically
- * - [newsfeed.embed=url] - integrate a newsfeed dynamically
- * - [twitter=id] - twitter updates of one person
- * - [tsearch=token] - twitter search on a given topic
- * - [iframe=<width>, <height>]<url>[/iframe] - include some external page
- * - [freemind] - a Freemind map of site content
- * - [freemind=section:<id>] - a Freemind map of a section and its content
- * - [freemind=section:<id>, width, height] - a Freemind map of a section and its content
- * - [cloud] - the tags used at this site
- * - [cloud=12] - maximum count of tags used at this site
- * - [calendar] - events for this month
- * - [calendar=section:<id>] - dates in one section
- * - [locations=all] - newest locations
- * - [locations=users] - map user locations on Google maps
- * - [location=latitude, longitude, label] - to build a dynamic map
- *
- * @see codes/widgets.php
- *
- * Miscellaneous codes, demonstrated in [link]codes/misc.php[/link]:
- * - [chart]...[/chart] - draw a dynamic chart
- * - [hint=<help popup]...[/hint] - <acronym tite="help popup">...</acronym>
- * - [nl] - new line
- * - ----... - line break
- * - [---] or [___] - horizontal rule
- * - [new] - something new
- * - [popular] - people love it
- * - [be] - country flag
- * - [ca] - country flag
- * - [ch] - country flag
- * - [de] - country flag
- * - [en] - country flag
- * - [es] - country flag
- * - [fr] - country flag
- * - [gb] - country flag
- * - [gr] - country flag
- * - [it] - country flag
- * - [pt] - country flag
- * - [us] - country flag
- *
- * @see codes/misc.php
- *
- * In-line elements:
- * - [embed=<id>, <width>, <height>, <flashparams>] - embed a multimedia file
- * - [embed=<id>, window] - render a multimedia file in a separate window
- * - [freemind=<id>] - a Freemind map out of given file
- * - [sound=<id>] - play a sound
- * - [image=<id>] - an inline image
- * - [image=<id>,left] - a left-aligned image
- * - [image=<id>,center] - a centered image
- * - [image=<id>,right] - a right-aligned image
- * - [image]src[/image]
- * - [image=<alt>]src[/image]
- * - [images=<id1>, <id2>, ...] - a stack of images
- * - [img]src[/img] (deprecated)
- * - [img=<alt>]src[/img] (deprecated)
- * - [table=<id>] - an inline table
- * - [location=<id>] - embed a map
- * - [location=<id>, foo bar] - with label 'foo bar'
- * - [clear] - to introduce breaks after floating elements
- *
- * @link http://www.estvideo.com/dew/index/2005/02/16/370-player-flash-mp3-leger-comme-une-plume the dewplayer page
- *
- * Other codes:
- * - [menu=label]url[/menu] -> one of the main menu command
- * - [submenu=label]url[/submenu] -> one of the second-level menu commands
- * - [escape]...[/escape]
- * - [anonymous]...[/anonymous] -> for non-logged people only
- * - [restricted]...[/restricted] -> for logged members only
- * - [hidden]...[/hidden] -> for associates only
- * - [parameter=name] -> value of one attribute of the global context
- *
- *
- * This script attempts to fight bbCode code injections by filtering strings to be used
- * as [code]src[/code] or as [code]href[/code] attributes (Thank you Mordread).
- *
- * @author Bernard Paques
- * @author Mordread Wallas
- * @author GnapZ
- * @author Alain Lesage (Lasares)
- * @tester Viviane Zaniroli
- * @tester Agnes
- * @tester Pat
- * @tester Guillaume Perez
- * @tester Fw_crocodile
- * @tester Christian Piercot
- * @tester Christian Loubechine
- * @reference
- * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License
- */
- Class Codes {
- /**
- * beautify some text for final rendering
- *
- * This function is used to transform some text before sending it back to the browser.
- * It actually performs following analysis:
- * - implicit formatting
- * - formatting codes
- * - smileys
- *
- * If the keyword [escape][formatted][/escape] appears at the first line of text,
- * or if options have the keyword ##formatted##, no implicit formatting is performed.
- *
- * If the keyword [escape][hardcoded][/escape] appears at the first line of text,
- * or if options have the keyword ##hardcoded##, the only transformation is is new lines to breaks.
- *
- * If options feature the keyword ##compact##, then YACS codes that may
- * generate big objects are removed, such as [escape][table]...[/table][/escape]
- * and [escape][location][/escape].
- *
- * @param string the text to beautify
- * @param string the set of options that apply to this text
- * @return the beautified text
- *
- * @see articles/view.php
- */
- function &beautify($text, $options='') {
- global $context;
- // save CPU cycles
- $text = trim($text);
- if(!$text)
- return $text;
- //
- // looking for compact content
- //
- if(preg_match('/\bcompact\b/i', $options))
- $text = preg_replace(array('/\[table.+?\/table\]/', '/\[location.+?\]/'), '', $text);
- //
- // implicit formatting
- //
- // new lines will have to be checked
- $new_lines = 'proceed';
- // text is already formatted
- if(!strncmp($text, '[formatted]', 11)) {
- $new_lines = 'none';
- $text = substr($text, 11);
- // text is already formatted (through options)
- } elseif(preg_match('/\bformatted\b/i', $options))
- $new_lines = 'none';
- // newlines are hard coded
- elseif(!strncmp($text, '[hardcoded]', 11)) {
- $new_lines = 'hardcoded';
- $text = substr($text, 11);
- // newlines are hard coded (through options)
- } elseif(preg_match('/\bhardcoded\b/i', $options))
- $new_lines = 'hardcoded';
- // implicit formatting
- else
- $text =& Codes::beautify_implied($text, 'text');
- //
- // translate codes
- //
- // render codes
- $text =& Codes::render($text);
- // render smileys after codes, else it will break escaped strings
- if(is_callable(array('Smileys', 'render_smileys')))
- $text =& Smileys::render_smileys($text);
- // relocate images
- $text = str_replace('"skins/', '"'.$context['path_to_root'].'skins/', $text);
- //
- // adjust end of lines
- //
- // newlines are hard coded
- if($new_lines == 'hardcoded')
- $text = nl2br($text);
- // implicit formatting
- elseif($new_lines == 'proceed')
- $text =& Codes::beautify_implied($text, 'newlines');
- return $text;
- }
- /**
- * beautify some text in the extra panel
- *
- * @param string the text to beautify
- * @return the beautified text
- *
- * @see articles/view.php
- */
- function &beautify_extra($text) {
- global $context;
- $search = array();
- $replace = array();
- // [box.extra=title]...[/box]
- $search[] = '/\[box\.(extra)=([^\]]+?)\](.*?)\[\/box\]/ise';
- $replace[] = "Skin::build_box(stripslashes('$2'), stripslashes('$3'), '$1')";
- // [box.navigation=title]...[/box]
- $search[] = '/\[box\.(navigation)=([^\]]+?)\](.*?)\[\/box\]/ise';
- $replace[] = "Skin::build_box(stripslashes('$2'), stripslashes('$3'), '$1')";
- // process all codes
- $text = preg_replace($search, $replace, $text);
- // regular rendering
- $text =& Codes::beautify($text);
- return $text;
- }
- /**
- * render some basic formatting
- *
- * - suppress multiple newlines
- * - render empty lines
- * - render simple bulleted lines
- * - make URL clickable (http://..., www.foo.bar, foo.bar@foo.com)
- *
- * Now this function looks for the keyword [escape] in order
- * to avoid for formatting pre-formatted areas.
- *
- * For example, if you type:
- * [snippet]
- * hello
- * world
- *
- * how are
- * you doing?
- *
- * - my first item
- * - my second item
- *
- * > quoted from
- * > a previous message
- * [/snippet]
- *
- * This will be rendered visually in the browser as:
- * [snippet]
- * hello world
- *
- * how are you doing?
- *
- * - my first item
- * - my second item
- *
- * > quoted from
- * > a previous message
- * [/snippet]
- *
- * @param string the text to transform
- * @param sring either 'text' or 'newlines'
- * @return the modified string
- */
- function &beautify_implied($text, $variant='text') {
- // streamline newlines, even if this has been done elsewhere
- $text = str_replace(array("\r\n", "\r"), "\n", $text);
- // only change end of lines
- if($variant == 'newlines') {
- // formatting patterns
- $search = array(
- "|<br\s*/>\n+|i", /* don't insert additional \n after <br /> */
- "|\n\n+|i" /* force an html space between paragraphs */
- );
- $replace = array(
- BR,
- BR.BR
- );
- // change everything, except new lines
- } else {
- // formatting patterns
- $search = array(
- "|</h1>\n+|i", /* strip \n after title */
- "|</h2>\n+|i",
- "|</h3>\n+|i",
- "|</h4>\n+|i",
- '/http:\/\/www\.youtube\.com\/watch\?v=([a-zA-Z0-9]+)/i', // YouTube link
- "#^([a-z]+?)://([a-z0-9_\-\.\~\/@&;:=%$\?]+)#ie", /* make URL clickable */
- "#([\n\t ])([a-z]+?)://([a-z0-9_\-\.\~\/@&;:=%$\?]+)#ie", /* make URL clickable */
- "#([\n\t \(])www\.([a-z0-9\-]+)\.([a-z0-9_\-\.\~]+)((?:/[^,< \r\n\)]*)?)#ie", /* web server */
- "/^\<p\>(-|\*)\s+(.+)\<\/p\>$/im", /* lists hard-coded with -, *, ¤, or • -- no space ahead */
- "/^(-|\*)\s+(.+)$/m", /* lists hard-coded with -, *, ¤, or • -- no space ahead */
- "/\n[ \t]*(From|To|cc|bcc|Subject|Date):(\s*)/i", /* common message headers */
- "|\n[ \t]*>(\s*)|i", /* quoted by > */
- "|\n[ \t]*\|(\s*)|i", /* quoted by | */
- "#([\n\t ])(mailto:|)([a-z0-9_\-\.\~]+?)@([a-z0-9_\-\.\~]+\.[a-z0-9_\-\.\~]+)([\n\t ]*)#ie" /* mail address*/
- );
- $replace = array(
- "</h1>",
- "</h2>",
- "</h3>",
- "</h4>",
- '<iframe class="youtube-player" type="text/html" width="445" height="364" src="http://www.youtube.com/embed/$1" frameborder="0"></iframe>', // YouTube link
- "Skin::build_link('$1://$2', '$1://$2')",
- "'$1'.Skin::build_link('$2://$3', '$2://$3')",
- "'$1'.Skin::build_link('http://www.$2.$3$4', 'www.$2.$3$4')",
- "<ul><li>$2</li></ul>",
- "<ul><li>$2</li></ul>",
- BR."$1:$2",
- BR.">$1",
- BR."|$1",
- "'$1'.Skin::build_link('mailto:$3@$4', '$3@$4', 'email').'$5'"
- );
- }
- // preserve escaped areas
- $text = str_replace(array('[escape]', '[/escape]', '[list]', '[/list]', '[php]', '[/php]', '[snippet]', '[/snippet]'),
- array('<escape>', '</escape>', '<list>', '</list>', '<php>', '</php>', '<snippet>', '</snippet>'), $text);
- // locate pre-formatted areas
- $areas = preg_split('/<(code|escape|list|php|snippet|pre)>(.*?)<\/\1>/is', trim($text), -1, PREG_SPLIT_DELIM_CAPTURE);
- // format only adequate areas
- $index = 0;
- $formatted = '';
- $inside = FALSE;
- $target = '';
- foreach($areas as $area) {
- switch($index%3) {
- case 0: // area to be formatted
- // do not rewrite tags
- $items = preg_split('/<(.+?)>/is', $area, -1, PREG_SPLIT_DELIM_CAPTURE);
- $where = 0;
- foreach($items as $item) {
- switch($where%2) {
- case 0: // outside a tag
- if($inside)
- $target .= $item;
- else
- $formatted .= preg_replace($search, $replace, $item);
- break;
- case 1: // inside a tag
- // inside or outside a link
- if($inside && !strncmp($item, '/a', 2)) {
- $formatted .= preg_replace($search, $replace, $target).'<'.$item.'>';
- $target = '';
- $inside = FALSE;
- } elseif($inside)
- $target .= '<'.$item.'>';
- elseif(!strncmp($item, 'a ', 2)) {
- $formatted .= '<'.$item.'>';
- $inside = TRUE;
- } else
- $formatted .= '<'.$item.'>';
- break;
- }
- $where++;
- }
- break;
- case 1: // area boundary
- $tag = $area;
- break;
- case 2: // pre-formatted area - left unmodified
- // inside a link, or regular text
- if($inside)
- $target .= '<'.$tag.'>'.$area.'</'.$tag.'>';
- else
- $formatted .= '<'.$tag.'>'.$area.'</'.$tag.'>';
- break;
- }
- $index++;
- }
- // post-optimization
- if($variant == 'text')
- $formatted = preg_replace('#</ul>\n{0,1}<ul>#', '', $formatted);
- $formatted = preg_replace('#\n\n+<ul#', "\n<ul", $formatted);
- // restore escaped areas
- $formatted = str_replace(array('<escape>', '</escape>', '<list>', '</list>', '<php>', '</php>', '<snippet>', '</snippet>'),
- array('[escape]', '[/escape]', '[list]', '[/list]', '[php]', '[/php]', '[snippet]', '[/snippet]'), $formatted);
- return $formatted;
- }
- /**
- * format an introduction
- *
- * @param string raw introduction
- * @return string finalized title
- */
- function &beautify_introduction($text) {
- // render codes
- $output =& Codes::render($text);
- // render smileys after codes, else it will break escaped strings
- if(is_callable(array('Smileys', 'render_smileys')))
- $output =& Smileys::render_smileys($output);
- // return by reference
- return $output;
- }
- /**
- * format a title
- *
- * New lines and images are the only things accepted in titles.
- * The goal is to provide a faster service than beautify()
- *
- * @param string raw title
- * @return string finalized title
- */
- function &beautify_title($text) {
- // suppress pairing codes
- $output =& Codes::strip($text);
- // the only code transformed in titles
- $output = str_replace(array('[nl]', '[NL]'), '<br />', $output);
- // remove everything, except links, breaks and images, and selected tags
- $output = strip_tags($output, '<a><abbr><acronym><b><big><br><code><del><div><dfn><em><i><img><ins><p><q><small><span><strong><sub><sup><tt><u>');
- // return by reference
- return $output;
- }
- /**
- * determine if a code is already in some text
- *
- * @param string the text to check
- * @param string code to check (e.g., 'embed')
- * @param int the id of the object
- * @return boolean TRUE if the code is present, false otherwise
- */
- function check_embedded($text, $code, $id) {
- // we check the string of digits
- $id = strval($id);
- // parse the full string
- $count = strlen($text);
- $position = 0;
- // look for '[embed' or similar
- while(($position = strpos($text, '['.$code, $position)) !== FALSE) {
- $position += 1+strlen($code);
- // parse remaining chars
- while($position < $count) {
- // digits just follow the '=' sign
- if($text[$position] == '=') {
- $position++;
- // exact match
- if(($position + 2 + strlen($id) < $count) && !strcmp(substr($text, $position, strlen($id)), $id))
- return TRUE;
- // not in this code, look at next one
- break;
- // malformed code
- } elseif($text[$position] == ']') {
- $position++;
- break;
- }
- // next char
- $position++;
- }
- }
- // not found
- return FALSE;
- }
- /**
- * delete a code if it is present in some text
- *
- * @param string the text to check
- * @param string code to check (e.g., 'embed')
- * @param int the id of the object
- * @return string the resulting string
- */
- function delete_embedded($text, $code, $id) {
- // we check the string of digits
- $id = strval($id);
- // parse the full string
- $count = strlen($text);
- $position = 0;
- // look for '[embed' or similar
- while(($position = strpos($text, '['.$code, $position)) !== FALSE) {
- // we have to take everything before that point
- $prefix = $position;
- // next char
- $position += 1+strlen($code);
- // parse remaining chars
- while($position < $count) {
- // digits just follow the '=' sign
- if($text[$position] == '=') {
- $position++;
- // exact match
- if(($position + strlen($id) <= $count) && !strcmp(substr($text, $position, strlen($id)), $id)) {
- $position += strlen($id);
- // look for ']'
- while($position < $count) {
- if($text[$position] == ']') {
- $position++;
- break;
- }
- $position++;
- }
- // do the deletion
- $modified = '';
- if($prefix > 0)
- $modified .= substr($text, 0, $prefix);
- if($position < $count)
- $modified .= substr($text, $position, $count-$position);
- return $modified;
- }
- // not in this code, look at next one
- break;
- // malformed code
- } elseif($text[$position] == ']') {
- $position++;
- break;
- }
- // next char
- $position++;
- }
- }
- // not found
- return $text;
- }
- /**
- * fix line breaks introduced by FCKEditor
- *
- * This function moves unclosed tags to the beginning of content.
- *
- * @param string input
- * @return string original or modified content
- */
- function &fix_tags($text) {
- // look for opening tag at content end
- $last_open = strrpos($text, '<p>');
- $last_close = strrpos($text, '</p');
- if($last_open && (($last_close === FALSE) || ($last_open > $last_close))) {
- // trail
- $trail = '';
- if(strlen($text) > $last_open + 3)
- $trail = substr($text, $last_open + 3);
- // move it to content start to restore pairing tags
- $text = '<p>'.substr($text, 0, $last_open).$trail;
- }
- // also fix broken img tags, if any
- $text = preg_replace('/\<(img[^\<\/]+)\>/i', '<\\1 />', $text);
- // remove slashes added by preg_replace -- only for double quotes
- $text = str_replace('\"', '"', $text);
- // done
- return $text;
- }
- /**
- * get the value of one global parameter
- *
- * @param string name of the parameter
- * @param mixed default value, if any
- * @return the actual value of this parameter, else the default value, else ''
- */
- function &get_parameter($name, $default='') {
- global $context;
- if(isset($context[$name])) {
- $output =& $context[$name];
- return $output;
- }
- $output = $default;
- return $output;
- }
- /**
- * reset global variables used for rendering
- *
- * This function should be called between the processing of different articles in a loop
- *
- * @param string the target URL for this rendering (e.g., 'articles/view.php/123')
- */
- function initialize($main_target=NULL) {
- global $context;
- if($main_target)
- $context['self_url'] = $context['url_to_root'].$main_target;
- }
- /**
- * list all ids matching some code
- *
- * @param string the text to check
- * @param string code to check (e.g., 'embed')
- * @return array the list of matching ids
- */
- function list_embedded($text, $code='embed') {
- // all ids we have found
- $ids = array();
- // parse the full string
- $count = strlen($text);
- $position = 0;
- // look for '[embed' or similar
- while(($position = strpos($text, '['.$code, $position)) !== FALSE) {
- $position += 1+strlen($code);
- // parse remaining chars
- while($position < $count) {
- // digits just follow the '=' sign
- if($text[$position] == '=') {
- $position++;
- // capture all digits
- $id = '';
- while($position < $count) {
- if(($text[$position] >= '0') && ($text[$position] <= '9')) {
- $id .= $text[$position];
- $position++;
- } else
- break;
- }
- // save this id
- if(strlen($id))
- $ids[] = $id;
- // look at next code
- break;
- // malformed code
- } elseif($text[$position] == ']') {
- $position++;
- break;
- }
- // next char
- $position++;
- }
- }
- // job done
- return $ids;
- }
- /**
- * transform codes to html
- *
- * [php]
- * // build the page
- * $context['text'] .= ...
- *
- * // transform codes
- * $context['text'] = Codes::render($context['text']);
- *
- * // final rendering
- * render_skin();
- * [/php]
- *
- * @param string the input string
- * @return string the transformed string
- */
- function &render($text) {
- global $context;
- // streamline newlines, even if this has been done elsewhere
- $text = str_replace(array("\r\n", "\r"), "\n", $text);
- // prevent wysiwyg editors to bracket our own tags
- $text = preg_replace('/^<p>(\[.+\])<\/p>$/m', '\\1', $text);
- // initialize only once
- static $pattern;
- if(!isset($pattern)) {
- // $pattern[] = ;
- // $replace[] = ;
- //
- // $pattern[] = ;
- // $replace[] = ;
- //
- // $pattern[] = ;
- // $replace[] = ;
- //
- // $pattern[] = ;
- // $replace[] = ;
- //
- // $pattern[] = ;
- // $replace[] = ;
- $pattern = array(
- "|<!-- .* -->|i", // remove HTML comments
- '/\[escape\](.*?)\[\/escape\]/ise', // [escape]...[/escape] (before everything)
- '/\[php\](.*?)\[\/php\]/ise', // [php]...[/php]
- '/\[snippet\](.*?)\[\/snippet\]/ise', // [snippet]...[/snippet]
- '/(\[page\].*)$/is', // [page] (provide only the first one)
- '/\[hidden\](.*?)\[\/hidden\]/ise', // [hidden]...[/hidden] (save some cycles if at the beginning)
- '/\[restricted\](.*?)\[\/restricted\]/ise', // [restricted]...[/restricted] (save some cycles if at the beginning)
- '/\[anonymous\](.*?)\[\/anonymous\]/ise', // [anonymous]...[/anonymous] (save some cycles if at the beginning)
- '/\[parameter=([^\]]+?)\]/ise', // [parameter=<name>]
- '/\[lang=([^\]]+?)\](.*?)\[\/lang\]/ise', // [lang=xy]...[/lang]
- '/\[csv=(.)\](.*?)\[\/csv\]/ise', // [csv=;]...[/csv] (before [table])
- '/\[csv\](.*?)\[\/csv\]/ise', // [csv]...[/csv] (before [table])
- '/\[table=([^\]]+?)\](.*?)\[\/table\]/ise', // [table=variant]...[/table]
- '/\[table\](.*?)\[\/table\]/ise', // [table]...[/table]
- '/\[images=([^\]]+?)\]/ie', // [images=<ids>] (before other links)
- '/\[image\](.*?)\[\/image\]/ise', // [image]src[/image]
- '/\[image=([^\]]+?)\](.*?)\[\/image\]/ise', // [image=alt]src[/image]
- '/\[img\](.*?)\[\/img\]/ise', // [img]src[/img]
- '/\[img=([^\]]+?)\](.*?)\[\/img\]/ise', // [img=alt]src[/img]
- '/\[image=([^\]]+?)\]/ie', // [image=<id>]
- '/##(\S.*?\S)##/is', // ##...##
- '/\[code\](.*?)\[\/code\]/is', // [code]...[/code]
- '/\[indent\](.*?)\[\/indent\]/ise', // [indent]...[/indent]
- '/\[quote\](.*?)\[\/quote\]/ise', // [quote]...[/quote]
- '/\[folded=([^\]]+?)\](.*?)\[\/folded\]\s*/ise', // [folded=...]...[/folded]
- '/\[folded\](.*?)\[\/folded\]\s*/ise', // [folded]...[/folded]
- '/\[folder=([^\]]+?)\](.*?)\[\/folder\]\s*/ise', // [folder=...]...[/folder]
- '/\[folder\](.*?)\[\/folder\]\s*/ise', // [folder]...[/folder]
- '/\[unfolded=([^\]]+?)\](.*?)\[\/unfolded\]\s*/ise', // [unfolded=...]...[/unfolded]
- '/\[unfolded\](.*?)\[\/unfolded\]\s*/ise', // [unfolded]...[/unfolded]
- '/\[sidebar=([^\]]+?)\](.*?)\[\/sidebar\]\s*/ise', // [sidebar=...]...[/sidebar]
- '/\[sidebar\](.*?)\[\/sidebar\]\s*/ise', // [sidebar]...[/sidebar]
- '/\[note\](.*?)\[\/note\]\s*/ise', // [note]...[/note]
- '/\[caution\](.*?)\[\/caution\]\s*/ise', // [caution]...[/caution]
- '/\[search=([^\]]+?)\]/ise', // [search=words]
- '/\[search\]/ise', // [search]
- '/\[cloud=(\d+?)\]/ise', // [cloud=12]
- '/\[cloud\]/ise', // [cloud]
- '/\[collections\]/ise', // [collections]
- '/\[login=([^\]]+?)\]/is', // [login=words] --obsoleted
- '/\[login\]/is', // [login] --obsoleted
- '/\[center\](.*?)\[\/center\]/ise', // [center]...[/center]
- '/\[right\](.*?)\[\/right\]/ise', // [right]...[/right]
- '/\[decorated\](.*?)\[\/decorated\]/ise',// [decorated]...[/decorated]
- '/\[style=([^\]]+?)\](.*?)\[\/style\]/ise', // [style=variant]...[/style]
- '/\[hint=([^\]]+?)\](.*?)\[\/hint\]/is', // [hint=help]...[/hint]
- '/\[tiny\](.*?)\[\/tiny\]/ise', // [tiny]...[/tiny]
- '/\[small\](.*?)\[\/small\]/ise', // [small]...[/small]
- '/\[big\](.*?)\[\/big\]/ise', // [big]...[/big]
- '/\[huge\](.*?)\[\/huge\]/ise', // [huge]...[/huge]
- '/\[subscript\](.*?)\[\/subscript\]/is',// [subscript]...[/subscript]
- '/\[superscript\](.*?)\[\/superscript\]/is',// [superscript]...[/superscript]
- '/\+\+(\S.*?\S)\+\+/is', // ++...++
- '/\[(---+|___+)\]\s*/ise', // [---], [___] --- before inserted
- '/^-----*/me', // ----
- '/\[inserted\](.*?)\[\/inserted\]/is', // [inserted]...[/inserted]
- '/ --(\S.*?\S)--/is', // --...--
- '/\[deleted\](.*?)\[\/deleted\]/is', // [deleted]...[/deleted]
- '/\*\*(\S.*?\S)\*\*/is', // **...**
- '/\[b\](.*?)\[\/b\]/is', // [b]...[/b]
- '/ \/\/(\S.*?\w)\/\//is', // //...//
- '/\[i\](.*?)\[\/i\]/is', // [i]...[/i]
- '/__(\S.*?\S)__/is', // __...__
- '/\[u\](.*?)\[\/u\]/is', // [u]...[/u]
- '/\[color=([^\]]+?)\](.*?)\[\/color\]/is', // [color=<color>]...[/color]
- '/\[new\]/ie', // [new]
- '/\[popular\]/ie', // [popular]
- '/\[flag=([^\]]+?)\]/ie', // [flag=<flag>]
- '/\[flag\](.*?)\[\/flag\]/ise', // [flag]...[/flag]
- '/\[list\](.*?)\[\/list\]/ise', // [list]...[/list]
- '/\[list=([^\]]+?)\](.*?)\[\/list\]/ise', // [list=1]...[/list]
- '/\n\n+[ \t]*\[\*\][ \t]*/ie', // [*] (outside [list]...[/list])
- '/\n?[ \t]*\[\*\][ \t]*/ie',
- '/\[li\](.*?)\[\/li\]/is', // [li]...[/li] (outside [list]...[/list])
- '/\[chart=([^\]]+?)\](.*?)\[\/chart\]/ise', // [chart=<width>, <height>, <params>]...[/chart]
- '/\[embed=([^\]]+?)\]/ie', // [embed=<id>, <width>, <height>, <params>] or [embed=<id>, window]
- '/\[flash=([^\]]+?)\]/ie', // [flash=<id>, <width>, <height>, <params>] or [flash=<id>, window]
- '/\[sound=([^\]]+?)\]/ie', // [sound=<id>]
- '/\[go=([^\]]+?)\]/ie', // [go=<name>]
- '/\[\[([^\]]+?)\]\]/ie', // [[<name>]]
- '/\[article\.description=([^\]]+?)\]/ie', // [article.description=<id>]
- '/\[article=([^\]]+?)\]/ie', // [article=<id>] or [article=<id>, title]
- '/\[next=([^\]]+?)\]/ie', // [next=<id>]
- '/\[previous=([^\]]+?)\]/ie', // [previous=<id>]
- '/\[random\]/ie', // [random]
- '/\[random\.description=([^\]]+?)\]/ie', // [random.description=section:<id>]
- '/\[random=([^\]]+?)\]/ie', // [random=section:<id>] or [random=category:<id>]
- '/\[form=([^\]]+?)\]/ie', // [form=<id>] or [form=<id>, title]
- '/\[section=([^\]]+?)\]/ie', // [section=<id>] or [section=<id>, title]
- '/\[category\.description=([^\]]+?)\]\n*/ise', // [category.description=<id>]
- '/\[category=([^\]]+?)\]/ie', // [category=<id>] or [category=<id>, title]
- '/\[user=([^\]]+?)\]/ie', // [user=<id>] or [user=<id>, title]
- '/\[server=([^\]]+?)\]/ie', // [server=<id>]
- '/\[file=([^\]]+?)\]/ie', // [file=<id>] or [file=<id>, title]
- '/\[download=([^\]]+?)\]/ie', // [download=<id>] or [download=<id>, title]
- '/\[action=([^\]]+?)\]/ie', // [action=<id>]
- '/\[comment=([^\]]+?)\]/ie', // [comment=<id>] or [comment=<id>, title]
- '/\[decision=([^\]]+?)\]/ie', // [decision=<id>] or [decision=<id>, title]
- '/\[url=([^\]]+?)\](.*?)\[\/url\]/ise', // [url=url]label[/url] (deprecated by [link])
- '/\[url\](.*?)\[\/url\]/ise', // [url]url[/url] (deprecated by [link])
- '/\[link=([^\]]+?)\](.*?)\[\/link\]/ise', // [link=label]url[/link]
- '/\[link\](.*?)\[\/link\]/ise', // [link]url[/link]
- '/\[button=([^\]]+?)\](.*?)\[\/button\]/ise', // [button=label]url[/button]
- '/\[button=([^\|]+?)\|([^\]]+?)]/ise', // [button=label|url]
- '/\[click=([^\|]+?)\|([^\]]+?)]/ise', // [click=label|url]
- '/\[clicks=([^\]]+?)]/ise', // [clicks=url]
- '/\[script\](.*?)\[\/script\]/ise', // [script]url[/script]
- '/\[menu\](.*?)\[\/menu\]\n*/ise', // [menu]url[/menu]
- '/\[menu=([^\]]+?)\](.*?)\[\/menu\]\n{0,1}/ise', // [menu=label]url[/menu]
- '/\[submenu\](.*?)\[\/submenu\]\n{0,1}/ise', // [submenu]url[/submenu]
- '/\[submenu=([^\]]+?)\](.*?)\[\/submenu\]\n*/ise', // [submenu=label]url[/submenu]
- '/\[email=([^\]]+?)\](.*?)\[\/email\]/ise', // [email=label]url[/email]
- '/\[email\](.*?)\[\/email\]/ise', // [email]url[/email]
- '/\[([^ ][^\]\|]+?[^ ])\|([^ ][^\]]+?[^ ])\]/ise', // [label|url]
- '/\[question\](.*?)\[\/question\]\n*/ise', // [question]...[/question]
- '/\[question\]/ise', // [question]
- '/\[answer\]/ise', // [answer]
- '/\[newsfeed=([^\]]+?)\]/ise', // [newsfeed=url]
- '/\[newsfeed\.([^=\]]+?)=([^\]]+?)\]/ise', // [newsfeed.variant=url]
- '/\[twitter=([^\]]+?)\]/ise', // [twitter=id]
- '/\[tsearch=([^\]]+?)\]/ise', // [tsearch=id]
- '/\[retweet\]/ise', // [retweet]
- '/\[iframe\](.*?)\[\/iframe\]/ise', // [iframe]<url>[/iframe]
- '/\[iframe=([^\]]+?)\](.*?)\[\/iframe\]/ise', // [iframe=<width>, <height>]<url>[/iframe]
- '/\[scroller\](.*?)\[\/scroller\]/ise', // [scroller]...[/scroller]
- '/\[toq\]\n*/ise', // [toq] (table of questions)
- '/\[title\](.*?)\[\/title\]\n*/is', // [title]...[/title]
- '/\[subtitle\](.*?)\[\/subtitle\]\n*/is', // [subtitle]...[/subtitle]
- '/\[(header[1-5])\](.*?)\[\/\1\]\n*/ise', // [header1]...[/header1] ... [header5]...[/header5]
- '/^======(\S.*?\S)======/me', // ======...====== level 5 headline
- '/<(br \/|p)>======(\S.*?\S)======<(br \/|\/p)>/me', // ======...====== level 5 headline
- '/^=====(\S.*?\S)=====/me', // =====...===== level 4 headline
- '/<(br \/|p)>=====(\S.*?\S)=====<(br \/|\/p)>/me', // =====...===== level 4 headline
- '/^====(\S.*?\S)====/me', // ====...==== level 3 headline
- '/<(br \/|p)>====(\S.*?\S)====<(br \/|\/p)>/me', // ====...==== level 3 headline
- '/^===(\S.*?\S)===/me', // ===...=== level 2 headline
- '/<(br \/|p)>===(\S.*?\S)===<(br \/|\/p)>/me', // ===...=== level 2 headline
- '/^==(\S.*?\S)==/me', // ==...== level 1 headline
- '/<(br \/|p)>==(\S.*?\S)==<(br \/|\/p)>/me', // ==...== level 1 headline
- '/\[toc\]\n*/ise', // [toc] (table of content)
- '/\[published\.([^\]=]+?)=([^\]]+?)\]\n*/ise', // [published.decorated=section:4029]
- '/\[published\.([^\]]+?)\]\n*/ise', // [published.decorated]
- '/\[published=([^\]]+?)\]\n*/ise', // [published=section:4029]
- '/\[published\]\n*/ise', // [published]
- '/\[read\.([^\]=]+?)=([^\]]+?)\]\n*/ise', // [read.decorated=section:4029]
- '/\[read\.([^\]]+?)\]\n*/ise', // [read.decorated]
- '/\[read=([^\]]+?)\]\n*/ise', // [read=section:4029]
- '/\[read\]\n*/ise', // [read]
- '/\[updated\.([^\]=]+?)=([^\]]+?)\]\n*/ise', // [updated.simple=section:4029] (a list of recent updates)
- '/\[updated\.([^\]]+?)\]\n*/ise', // [updated.simple] (a list of recent updates)
- '/\[updated=([^\]]+?)\]\n*/ise', // [updated=section:4029] (a compact list of recent updates)
- '/\[updated\]\n*/ise', // [updated] (a compact list of recent updates)
- '/\[voted\.([^\]=]+?)=([^\]]+?)\]\n*/ise', // [voted.decorated=section:4029]
- '/\[voted\.([^\]]+?)\]\n*/ise', // [voted.decorated]
- '/\[voted=([^\]]+?)\]\n*/ise', // [voted=section:4029]
- '/\[voted\]\n*/ise', // [voted]
- '/\[freemind\]\n*/ise', // [freemind] (a mind map of site content)
- '/\[freemind=([^\]]+?)\]\n*/ise', // [freemind=section:4029] (a mind map of section content)
- '/\[sections\]\n*/ise', // [sections] (site map)
- '/\[sections\.([^\]=]+?)\]\n*/ise', // [sections.folded] (site map)
- '/\[sections=([^\]]+?)\]\n*/ise', // [sections=section:4029] (sub-sections)
- '/\[sections\.([^\]=]+?)=([^\]]+?)\]\n*/ise', // [sections.simple=self] (assigned)
- '/\[categories\]\n*/ise', // [categories] (category tree)
- '/\[categories\.([^\]=]+?)\]\n*/ise', // [categories.folded] (category tree)
- '/\[categories=([^\]]+?)\]\n*/ise', // [categories=section:4029] (sub-categories)
- '/\[categories\.([^\]=]+?)=([^\]]+?)\]\n*/ise', // [categories.simple=self] (assigned)
- '/\[calendar\]\n*/ise', // [calendar]
- '/\[calendar=([^\]]+?)\]\n*/ise', // [calendar=section:4029]
- '/\[users=([^\]]+?)\]/ie', // [users=present]
- '/\[news=([^\]]+?)\]/ise', // [news=flash]
- '/\[table=([^\]]+?)\]/ise', // [table=<id>]
- '/\[table\.([^=\]]+?)=([^\]]+?)\]/ise', // [table.json=<id>] [table.timeplot=<id>]
- '/\[locations=([^\]]+?)\]/ise', // [locations=<id>]
- '/\[location=([^\]]+?)\]/ise', // [location=<id>]
- '/\[wikipedia=([^\]]+?)\]/ise', // [wikipedia=keyword] or [wikipedia=keyword, title]
- '/\[digraph\](.*?)\[\/digraph\]/ise', // [digraph]url[/digraph]
- '/\[be\]/i', // [be] belgian flag
- '/\[ca\]/i', // [ca] canadian flag
- '/\[ch\]/i', // [ch] swiss flag
- '/\[de\]/i', // [de] german flag
- '/\[en\]/i', // [en] english flag
- '/\[es\]/i', // [es] spanish flag
- '/\[fr\]/i', // [fr] french flag
- '/\[gb\]/i', // [gb] gb flag
- '/\[gr\]/i', // [gr] greek flag
- '/\[it\]/i', // [it] italian flag
- '/\[pt\]/i', // [pt] portuguese flag
- '/\[us\]/i', // [pt] us flag
- '/\[clear\]\n*/i', // [clear]
- '/\[nl\]\n*/si', // [nl] (after tables)
- '/\[br\]/i' // [br] (deprecated by [nl])
- );
- }
- // initialize only once
- static $replace;
- if(!isset($replace)) {
- $replace = array(
- '', // delete HTML comments
- "Codes::render_escaped(Codes::fix_tags('$1'))", // [escape]...[/escape]
- "Codes::render_pre(Codes::fix_tags('$1'), 'php')", // [php]...[/php]
- "Codes::render_pre(Codes::fix_tags('$1'), 'snippet')", // [snippet]...[/snippet]
- '', // [page]
- "Codes::render_hidden(Codes::fix_tags('$1'), 'hidden')", // [hidden]...[/hidden]
- "Codes::render_hidden(Codes::fix_tags('$1'), 'restricted')", // [restricted]...[/restricted]
- "Codes::render_hidden(Codes::fix_tags('$1'), 'anonymous')", // [anonymous]...[/anonymous]
- "Codes::get_parameter('\\1')", // [parameter=<name>]
- "i18n::filter(Codes::fix_tags('$2'), '$1')", // [lang=xy]...[/lang]
- "utf8::encode(str_replace('$1', '|', utf8::from_unicode(Codes::fix_tags('$2'))))", // [csv=;]...[/csv]
- "str_replace(',', '|', Codes::fix_tags('$1'))", // [csv]...[/csv]
- "Codes::render_static_table(Codes::fix_tags('$2'), '$1')", // [table=variant]...[/table]
- "Codes::render_static_table(Codes::fix_tags('$1'), '')", // [table]...[/table]
- "Codes::render_object('images', '$1')", // [images=<ids>]
- "'<div class=\"external_image\"><img src=\"'.encode_link('$1').'\" alt=\"\" /></div>'", // [image]src[/image]
- "'<div class=\"external_image\"><img src=\"'.encode_link('$2').'\" alt=\"'.encode_link('$1').'\" /></div>'", // [image=alt]src[/image]
- "'<div class=\"external_image\"><img src=\"'.encode_link('$1').'\" alt=\"\" /></div>'", // [img]src[/img]
- "'<div class=\"external_image\"><img src=\"'.encode_link('$2').'\" alt=\"'.encode_link('$1').'\" /></div>'", // [img=alt]src[/img]
- "Codes::render_object('image', Codes::fix_tags('$1'))", // [image=<id>]
- '<code>\\1</code>', // ##...##
- '<code>\\1</code>', // [code]...[/code]
- "Skin::build_block(Codes::fix_tags('$1'), 'indent')", // [indent]...[indent]
- "Skin::build_block(Codes::fix_tags('$1'), 'quote')", // [quote]...[/quote]
- "Skin::build_box('$1', Codes::fix_tags('$2'), 'folded')", // [folded=title]...[/folded]
- "Skin::build_box(NULL, Codes::fix_tags('$1'), 'folded')", // [folded]...[/folded]
- "Skin::build_box('$1', Codes::fix_tags('$2'), 'folded')", // [folder=title]...[/folder]
- "Skin::build_box(NULL, Codes::fix_tags('$1'), 'folded')", // [folder]...[/folder]
- "Skin::build_box('$1', Codes::fix_tags('$2'), 'unfolded')", // [unfolded=title]...[/unfolded]
- "Skin::build_box(NULL, Codes::fix_tags('$1'), 'unfolded')", // [unfolded]...[/unfolded]
- "Skin::build_box('$1', Codes::fix_tags('$2'), 'sidebar')", // [sidebar=title]...[/sidebar]
- "Skin::build_box(NULL, Codes::fix_tags('$1'), 'sidebar')", // [sidebar]...[/sidebar]
- "Skin::build_block(Codes::fix_tags('$1'), 'note')", // [note]...[/note]
- "Skin::build_block(Codes::fix_tags('$1'), 'caution')", // [caution]...[/caution]
- "Skin::build_block('$1', 'search')", // [search=<words>]
- "Skin::build_block(NULL, 'search')", // [search]
- "Codes::render_cloud('$1')", // [cloud=12]
- "Codes::render_cloud(20)", // [cloud]
- "Codes::render_collections()", // [collections]
- '', // [login=<words>] --obsoleted
- '', // [login] --obsoleted
- "Skin::build_block(Codes::fix_tags('$1'), 'center')", // [center]...[/center]
- "Skin::build_block(Codes::fix_tags('$1'), 'right')", // [right]...[/right]
- "Skin::build_block(Codes::fix_tags('$1'), 'decorated')", // [decorated]...[/decorated]
- "Skin::build_block(Codes::fix_tags('$2'), '$1')", // [style=variant]...[/style]
- '<acronym title="\\1">\\2</acronym>', // [hint=help]...[/hint]
- "Skin::build_block(Codes::fix_tags('$1'), 'tiny')", // [tiny]...[/tiny]
- "Skin::build_block(Codes::fix_tags('$1'), 'small')", // [small]...[/small]
- "Skin::build_block(Codes::fix_tags('$1'), 'big')", // [big]...[/big]
- "Skin::build_block(Codes::fix_tags('$1'), 'huge')", // [huge]...[/huge]
- '<sub>\\1</sub>', // [subscript]...[/subscript]
- '<sup>\\1</sup>', // [superscript]...[/superscript]
- '<ins>\\1</ins>', // ++...++
- "HORIZONTAL_RULER", // [---], [___]
- "HORIZONTAL_RULER", // ----
- '<ins>\\1</ins>', // [inserted]...[/inserted]
- ' <del>\\1</del>', // --...--
- '<del>\\1</del>', // [deleted]...[/deleted]
- '<b>\\1</b>', // **...**
- '<b>\\1</b>', // [b]...[/b]
- ' <i>\\1</i>', // //...//
- '<i>\\1</i>', // [i]...[/i]
- '<span style="text-decoration: underline">\\1</span>', // __...__
- '<span style="text-decoration: underline">\\1</span>', // [u]...[/u]
- '<span style="color: \\1">\\2</span>', // [color]...[/color]
- "NEW_FLAG", // [new]
- "POPULAR_FLAG", // [popular]
- "Skin::build_flag('\\1')", // [flag=....]
- "Skin::build_flag('\\1')", // [flag]...[/flag]
- "Codes::render_list(Codes::fix_tags('$1'), NULL)", // [list]...[/list]
- "Codes::render_list(Codes::fix_tags('$2'), '$1')", // [list=?]...[/list]
- "BR.BR.BULLET_IMG.' '", // standalone [*]
- "BR.BULLET_IMG.' '",
- '<li>\\1</li>', // [li]...[/li]
- "Codes::render_chart(Codes::fix_tags('$2'), '$1')", // [chart=<width>, <height>, <params>]...[/chart]
- "Codes::render_embed(Codes::fix_tags('$1'))", // [embed=<id>, <width>, <height>, <params>]
- "Codes::render_embed(Codes::fix_tags('$1'))", // [flash=<id>, <width>, <height>, <params>] -- obsoleted by 'embed'
- "Codes::render_object('sound', Codes::fix_tags('$1'))", // [sound=<id>]
- "Codes::render_object('go', Codes::fix_tags('$1'))", // [go=<name>]
- "Codes::render_object('go', Codes::fix_tags('$1'))", // [[<name>]]
- "Codes::render_object('article.description', Codes::fix_tags('$1'))",// [article.description=<id>]
- "Codes::render_object('article', Codes::fix_tags('$1'))", // [article=<id>]
- "Codes::render_object('next', Codes::fix_tags('$1'))", // [next=<id>]
- "Codes::render_object('previous', Codes::fix_tags('$1'))", // [previous=<id>]
- "Codes::render_random()", // [random]
- "Codes::render_random('$1', 'description')", // [random.description=section:<id>]
- "Codes::render_random('$1')", // [random=section:<id>]
- "Codes::render_object('form', Codes::fix_tags('$1'))", // [form=<id>]
- "Codes::render_object('section', Codes::fix_tags('$1'))", // [section=<id>]
- "Codes::render_object('category.description', '$1')", // [category.description=<id>]
- "Codes::render_object('category', Codes::fix_tags('$1'))", // [category=<id>]
- "Codes::render_object('user', Codes::fix_tags('$1'))", // [user=<id>]
- "Codes::render_object('server', Codes::fix_tags('$1'))", // [server=<id>]
- "Codes::render_object('file', Codes::fix_tags('$1'))", // [file=<id>] or [file=<id>, title]
- "Codes::render_object('download', Codes::fix_tags('$1'))", // [download=<id>] or [download=<id>, title]
- "Codes::render_object('action', Codes::fix_tags('$1'))", // [action=<id>]
- "Codes::render_object('comment',…
Large files files are truncated, but you can click here to view the full file