Source for file _formatting.php
Documentation is available at _formatting.php
* This is b2evolution's formatting config file
* This file sets how b2evolution will parse and format texts (posts, comments, etc.)
* Last significant changes to this file: version 0.9.0.6
* b2evolution - {@link http://b2evolution.net/}
* Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
* @copyright (c)2003-2005 by Francois PLANQUE - {@link http://fplanque.net/}
if( !defined('DB_USER') ) die( 'Please, do not access this page directly.' );
# Choose the formatting options for your posts:
$use_balanceTags =
1; // 0,1 automatically balance unmatched tags in posts and comments.
# Choose formatting options for comments
# 'never' : option will never be used
# 'opt-in' : option will be used only if user explicitely asks for it
# 'opt-out' : option will be used by default, but user can refuse
# 'always' : option will always be used
$comments_use_autobr =
'opt-out'; // automatically change line breaks to <br />
* Validity & Security Checking
* Posts and comments should be checked to see if they contain valid XHTML code
* and no invalid code (javascript, styles, CSS, etc...)
# Html checking will validate posts and comments to a subset of valid XHTML.
# This will also do much cleaner security checking than the next option.
# Note: This option requires the PHP XML module. If your PHP installation doesn't have it
# disable html_checker and use security_checker.
# Security checking will check for illegal javascript hacks in posts/comments
# and for CSS in comments. However, this may be a bit harsh on your posts :]
$use_security_checker =
0;
# WARNING: disabling both $use_html_checker and $use_security_checker is suicidal !
* The params are defined twice: once for the posts and once for the comments.
* Typically you'll be more restrictive on comments.
* Adapted from XHTML-1.0-Transitional/Strict by fplanque
* http://www.w3.org/TR/2002/REC-xhtml1-20020801/dtds.html#a_dtd_XHTML-1.0-Strict
// DEFINITION of allowed XHTML code for POSTS (posted in the backoffice)
// define('E_special_pre', 'br span bdo'); // Strict
// define('E_special', E_special_pre.' img'); // Strict
define('E_special_extra', 'img' ); // Transitional
define('E_special_basic', 'br span bdo' ); // Transitional
define('E_special', E_special_basic.
' '.
E_special_extra ); // Transitional
// define('E_fontstyle', 'tt i b big small'); // Strict
define('E_fontstyle_extra', 'big small font' ); // Transitional
define('E_fontstyle_basic', 'tt i b u s strike' ); // Transitional
define('E_fontstyle', E_fontstyle_basic.
' '.
E_fontstyle_extra ); // Transitional
// define('E_phrase', 'em strong dfn code q samp kbd var cite abbr acronym sub sup'); // Strict
define('E_phrase_extra', 'sub sup'); // Transitional
define('E_phrase_basic', 'em strong dfn code q samp kbd var cite abbr acronym'); // Transitional
define('E_phrase', E_phrase_basic.
' '.
E_phrase_extra ); // Transitional
define('E_misc_inline', 'ins del');
define('E_misc', E_misc_inline);
define('E_inline', 'a '.
E_special.
' '.
E_fontstyle.
' '.
E_phrase );
define('E_Iinline', '#PCDATA '.
E_inline.
' '.
E_misc_inline );
define('E_heading', 'h1 h2 h3 h4 h5 h6');
// define('E_list', 'ul ol dl'); // Strict
define('E_list', 'ul ol dl menu dir'); // Transitional
// define('E_blocktext', 'pre hr blockquote address'); // Strict
define('E_blocktext', 'pre hr blockquote address center'); // Transitional
define('E_block', 'p '.
E_heading.
' div '.
E_list.
' '.
E_blocktext.
' fieldset table');
// define('E_Bblock', E_block.' '.E_misc ); // Strict only
define('E_Flow', '#PCDATA '.
E_block.
' '.
E_inline.
' '.
E_misc );
define('E_a_content', '#PCDATA '.
E_special.
' '.
E_fontstyle.
' '.
E_phrase.
' '.
E_misc_inline );
// define('E_pre_content', '#PCDATA a '.E_fontstyle.' '.E_phrase.' '.E_special_pre.' '.E_misc_inline ); // Strict
define('E_pre_content', '#PCDATA a '.
E_special_basic.
' '.
E_fontstyle_basic.
' '.
E_phrase_basic.
' '.
E_misc_inline ); // Transitional
// Allowed Attribute classes
define('A_coreattrs', 'class title');
define('A_i18n', 'lang xml:lang dir');
define('A_attrs', A_coreattrs.
' '.
A_i18n);
define('A_TextAlign', 'align'); // Transitional only
define('A_cellhalign', 'align char charoff');
define('A_cellvalign', 'valign');
// Array showing what tags are allowed and what their allowed subtags are.
'body' =>
E_Flow, // Remember this is not a true body, just a post body
'menu' =>
'li', // Transitional only
'dir' =>
'li', // Transitional only
// 'address' => E_Iinline, // Strict
// 'blockquote' => E_Bblock, // Strict
'blockquote' =>
E_Flow, // Transitional
'center' =>
E_Flow, // Transitional only
'table' =>
'caption col colgroup thead tfoot tbody tr',
// Array showing allowed attributes for tags
$allowed_attribues =
array
// 'div' => A_attrs, // Strict
// 'p' => A_attrs, // Strict
// 'h1' => A_attrs, // Strict
// 'h2' => A_attrs, // Strict
// 'h3' => A_attrs, // Strict
// 'h4' => A_attrs, // Strict
// 'h5' => A_attrs, // Strict
// 'h6' => A_attrs, // Strict
// 'ul' => A_attrs, // Strict
'ul' =>
A_attrs.
' type compact', // Transitional
// 'ol' => A_attrs, // Strict
'ol' =>
A_attrs.
' type compact start', // Transitional
'menu' =>
A_attrs.
' compact', // Transitional only
'dir' =>
A_attrs.
' compact', // Transitional only
// 'li' => A_attrs, // Strict
'li' =>
A_attrs.
' type value', // Transitional
// 'dl' => A_attrs, // Strict
'dl' =>
A_attrs.
' compact', // Transitional
// 'hr' => A_attrs, // Strict
'hr' =>
A_attrs.
' align noshade size width', // Transitional
// 'pre' => A_attrs.' xml:space', // Strict
'pre' =>
A_attrs.
' width xml:space', // Transitional
'center' =>
A_attrs, // Transitional only
// 'a' => A_attrs.' charset type href hreflang rel rev shape coords', // Strict
'a' =>
A_attrs.
' charset type href hreflang rel rev shape coords target', // Transitional
// 'br' => A_coreattrs, // Strict
'u' =>
A_attrs, // Transitional only
's' =>
A_attrs, // Transitional only
'strike' =>
A_attrs, // Transitional only
// 'img' => A_attrs.' src alt longdesc height width usemap ismap', // Strict
'img' =>
A_attrs.
' src alt name longdesc height width usemap ismap align border hspace vspace', // Transitional
//'legend' => A_attrs, // Strict
'legend' =>
A_attrs.
' align', // Transitional
// 'table' => A_attrs.' summary width border frame rules cellspacing cellpadding', // Strict
'table' =>
A_attrs.
' summary width border frame rules cellspacing cellpadding align bgcolor', // Transitional
// 'caption' => A_attrs, // Strict
'caption' =>
A_attrs.
' align', // Transitional
'colgroup' =>
A_attrs.
' span width cellhalign cellvalign',
'col' =>
A_attrs.
' span width cellhalign cellvalign',
// 'tr' => A_attrs.' '.A_cellhalign.' '.A_cellvalign, // Strict
// 'th' => A_attrs.' abbr axis headers scope rowspan colspan'.A_cellhalign.' '.A_cellvalign, // Strict
// 'td' => A_attrs.' abbr axis headers scope rowspan colspan'.A_cellhalign.' '.A_cellvalign, // Strict
$allowed_uri_scheme =
array
// DEFINITION of allowed XHTML code for COMMENTS (posted from the public blog pages)
# here is a list of the tags that are allowed in the comments.
# all tags not in this list will be filtered out anyway before we do any checking
$comment_allowed_tags =
'<p><ul><ol><li><dl><dt><dd><address><blockquote><ins><del><span><bdo><br><em><strong><dfn><code><samp><kdb><var><cite><abbr><acronym><q><sub><sup><tt><i><b><big><small>';
// Allowed Entity classes
define('C_E_special_pre', 'br span bdo');
define('C_E_special', C_E_special_pre);
define('C_E_fontstyle', 'tt i b big small');
define('C_E_phrase', 'em strong dfn code q samp kbd var cite abbr acronym sub sup');
define('C_E_misc_inline', 'ins del');
define('C_E_misc', C_E_misc_inline);
define('C_E_inline', 'a '.
C_E_special.
' '.
C_E_fontstyle.
' '.
C_E_phrase );
define('C_E_Iinline', '#PCDATA '.
C_E_inline.
' '.
C_E_misc_inline );
define('C_E_list', 'ul ol dl');
define('C_E_blocktext', 'hr blockquote address');
define('C_E_block', 'p '.
C_E_heading.
' div '.
C_E_list.
' '.
C_E_blocktext.
' table');
define('C_E_Bblock', C_E_block.
' '.
C_E_misc );
define('C_E_Flow', '#PCDATA '.
C_E_block.
' '.
C_E_inline.
' '.
C_E_misc );
define('C_E_a_content', '#PCDATA '.
C_E_special.
' '.
C_E_fontstyle.
' '.
C_E_phrase.
' '.
C_E_misc_inline );
define('C_E_pre_content', '#PCDATA a '.
C_E_fontstyle.
' '.
C_E_phrase.
' '.
C_E_special_pre.
' '.
C_E_misc_inline );
// Allowed Attribute classes
define('C_A_coreattrs', 'class title');
define('C_A_i18n', 'lang xml:lang dir');
define('C_A_attrs', C_A_coreattrs.
' '.
C_A_i18n);
define('C_A_cellhalign', 'align char charoff');
define('C_A_cellvalign', 'valign');
// Array showing what tags are allowed and what their allowed subtags are.
$comments_allowed_tags =
array
'body' =>
E_Flow, // Remember this is not a true body, just a comment body
// 'blockquote' => C_E_Bblock, // XHTML-1.0-Strict
'blockquote' =>
C_E_Flow, // XHTML-1.0-Transitional
// 'a' => C_E_a_content, // Allowing this will call for a whole lot of comment spam!!!
// Array showing allowed attributes for tags
$comments_allowed_attribues =
array
'a' =>
C_A_attrs.
' charset type href hreflang rel rev shape coords',
* URI schemes allowed for URLs in comments and user profiles:
$comments_allowed_uri_scheme =
array
// Array showing URI attributes
# Translation of HTML entities and special characters
// '–' => ' ', '—' => ' ', '‘' => ' ', '’' => ' ',
// '“' => ' ', '”' => ' ', '•' => ' ', '€' => ' ',
'<' =>
'<', '>' =>
'>',
'&sp;' =>
' ', '!' =>
'!', '"' =>
'"', '#' =>
'#',
'$' =>
'$', '%' =>
'%', '&' =>
'&', ''' =>
''',
'(' =>
'(', ')' =>
')',
'*' =>
'*', '+' =>
'+', ',' =>
',', '‐' =>
'-',
'−' =>
'-', '.' =>
'.', '/' =>
'/', ':' =>
':',
';' =>
';', '<' =>
'<',
'=' =>
'=', '>' =>
'>', '?' =>
'?', '@' =>
'@',
'[' =>
'[', '\' =>
'\', ']' =>
']', 'ˆ' =>
'^',
'_' =>
'_', '―' =>
'_',
'`' =>
'`', '{' =>
'{', '|' =>
'|', '}' =>
'}',
'˜' =>
'~', '‚' =>
'‚', '„' =>
'„',
'&ldots;' =>
'…', 'Š' =>
'Š', '‹' =>
'‹', 'Œ' =>
'Œ',
'‘' =>
'‘', '’' =>
'‘', '’' =>
'’',
'“' =>
'“', '”' =>
'“', '”' =>
'”', '•' =>
'•',
'–' =>
'–', '&endash;' =>
'–', '—' =>
'—', '&emdash;' =>
'—',
'˜' =>
'˜', '™' =>
'™',
'š' =>
'š', '›' =>
'›', 'œ' =>
'œ', 'Ÿ' =>
'Ÿ',
' ' =>
' ', '¡' =>
'¡', '¢' =>
'¢', '£' =>
'£',
'¤' =>
'¤', '¥' =>
'¥',
'¦' =>
'¦', '&brkbar;' =>
'¦', '§' =>
'§', '¨' =>
'¨',
'¨' =>
'¨', '©' =>
'©', 'ª' =>
'ª', '«' =>
'«',
'¬' =>
'¬', '­' =>
'­',
'®' =>
'®', '¯' =>
'¯', '&hibar;' =>
'¯', '°' =>
'°',
'±' =>
'±', '²' =>
'²', '³' =>
'³', '´' =>
'´',
'µ' =>
'µ', '¶' =>
'¶',
'·' =>
'·', '¸' =>
'¸', '¹' =>
'¹', 'º' =>
'º',
'»' =>
'»', '¼' =>
'¼', '½' =>
'½', '½' =>
'½',
'¾' =>
'¾', '¿' =>
'¿',
'À' =>
'À', 'Á' =>
'Á', 'Â' =>
'Â', 'Ã' =>
'Ã',
'Ä' =>
'Ä', 'Å' =>
'Å', 'Æ' =>
'Æ', 'Ç' =>
'Ç',
'È' =>
'È', 'É' =>
'É',
'Ê' =>
'Ê', 'Ë' =>
'Ë', 'Ì' =>
'Ì', 'Í' =>
'Í',
'Î' =>
'Î', 'Ï' =>
'Ï', 'Ð' =>
'Ð', 'Ñ' =>
'Ñ',
'Ò' =>
'Ò', 'Ó' =>
'Ó',
'Ô' =>
'Ô', 'Õ' =>
'Õ', 'Ö' =>
'Ö', '×' =>
'×',
'Ø' =>
'Ø', 'Ù' =>
'Ù', 'Ú' =>
'Ú', 'Û' =>
'Û',
'Ü' =>
'Ü', 'Ý' =>
'Ý',
'Þ' =>
'Þ', 'ß' =>
'ß', 'à' =>
'à', 'á' =>
'á',
'â' =>
'â', 'ã' =>
'ã', 'ä' =>
'ä', 'å' =>
'å',
'æ' =>
'æ', 'ç' =>
'ç',
'è' =>
'è', 'é' =>
'é', 'ê' =>
'ê', 'ë' =>
'ë',
'ì' =>
'ì', 'í' =>
'í', 'î' =>
'î', 'ï' =>
'ï',
'ð' =>
'ð', 'ñ' =>
'ñ',
'ò' =>
'ò', 'ó' =>
'ó', 'ô' =>
'ô', 'õ' =>
'õ',
'ö' =>
'ö', '÷' =>
'÷', 'ø' =>
'ø', 'ù' =>
'ù',
'ú' =>
'ú', 'û' =>
'û',
'ü' =>
'ü', 'ý' =>
'ý', 'þ' =>
'þ', 'ÿ' =>
'ÿ',
'Œ' =>
'Œ', 'œ' =>
'œ', 'Š' =>
'Š', 'š' =>
'š',
'Ÿ' =>
'Ÿ', 'ƒ' =>
'ƒ',
'ˆ' =>
'ˆ', '˜' =>
'˜', 'Α' =>
'Α', 'Β' =>
'Β',
'Γ' =>
'Γ', 'Δ' =>
'Δ', 'Ε' =>
'Ε', 'Ζ' =>
'Ζ',
'Η' =>
'Η', 'Θ' =>
'Θ',
'Ι' =>
'Ι', 'Κ' =>
'Κ', 'Λ' =>
'Λ',
'Μ' =>
'Μ', 'Ν' =>
'Ν', 'Ξ' =>
'Ξ',
'Ο' =>
'Ο', 'Π' =>
'Π', 'Ρ' =>
'Ρ', 'Σ' =>
'Σ',
'Τ' =>
'Τ', 'Υ' =>
'Υ', 'Φ' =>
'Φ',
'Χ' =>
'Χ', 'Ψ' =>
'Ψ', 'Ω' =>
'Ω',
'α' =>
'α', 'β' =>
'β', 'γ' =>
'γ', 'δ' =>
'δ',
'ε' =>
'ε', 'ζ' =>
'ζ', 'η' =>
'η',
'θ' =>
'θ', 'ι' =>
'ι', 'κ' =>
'κ', 'λ' =>
'λ',
'μ' =>
'μ', 'ν' =>
'ν', 'ξ' =>
'ξ',
'ο' =>
'ο', 'π' =>
'π', 'ρ' =>
'ρ', 'ς' =>
'ς',
'σ' =>
'σ', 'τ' =>
'τ', 'υ' =>
'υ', 'φ' =>
'φ',
'χ' =>
'χ', 'ψ' =>
'ψ',
'ω' =>
'ω', 'ϑ' =>
'ϑ', 'ϒ' =>
'ϒ', 'ϖ' =>
'ϖ',
' ' =>
' ', ' ' =>
' ', ' ' =>
' ', '‌' =>
'‌',
'‍' =>
'‍', '‎' =>
'‎',
'‏' =>
'‏', '–' =>
'–', '—' =>
'—', '‘' =>
'‘',
'’' =>
'’', '‚' =>
'‚', '“' =>
'“', '”' =>
'”',
'„' =>
'„', '†' =>
'†',
'‡' =>
'‡', '•' =>
'•', '…' =>
'…', '‰' =>
'‰',
'′' =>
'′', '″' =>
'″', '‹' =>
'‹', '›' =>
'›',
'‾' =>
'‾', '⁄' =>
'⁄',
'€' =>
'€', 'ℑ' =>
'ℑ', '℘' =>
'℘', 'ℜ' =>
'ℜ',
'™' =>
'™', 'ℵ' =>
'ℵ', '←' =>
'←', '↑' =>
'↑',
'→' =>
'→', '↓' =>
'↓',
'↔' =>
'↔', '↵' =>
'↵', '⇐' =>
'⇐', '⇑' =>
'⇑',
'⇒' =>
'⇒', '⇓' =>
'⇓', '⇔' =>
'⇔', '∀' =>
'∀',
'∂' =>
'∂', '∃' =>
'∃',
'∅' =>
'∅', '∇' =>
'∇', '∈' =>
'∈', '∉' =>
'∉',
'∋' =>
'∋', '∏' =>
'∏', '∑' =>
'∑', '−' =>
'−',
'∗' =>
'∗', '√' =>
'√',
'∝' =>
'∝', '∞' =>
'∞', '∠' =>
'∠', '∧' =>
'∧',
'∨' =>
'∨', '∩' =>
'∩', '∪' =>
'∪', '∫' =>
'∫',
'∴' =>
'∴', '∼' =>
'∼',
'≅' =>
'≅', '≈' =>
'≈', '≠' =>
'≠', '≡' =>
'≡',
'≤' =>
'≤', '≥' =>
'≥', '⊂' =>
'⊂', '⊃' =>
'⊃',
'⊄' =>
'⊄', '⊆' =>
'⊆',
'⊇' =>
'⊇', '⊕' =>
'⊕', '⊗' =>
'⊗', '⊥' =>
'⊥',
'⋅' =>
'⋅', '⌈' =>
'⌈', '⌉' =>
'⌉', '⌊' =>
'⌊',
'⌋' =>
'⌋', '⟨' =>
'〈',
'⟩' =>
'〉', '◊' =>
'◊', '♠' =>
'♠', '♣' =>
'♣',
'♥' =>
'♥', '♦' =>
'♦'
# Translation of invalid Unicode references range to valid range
# these are Windows CP1252 specific characters
# they would look weird on non-Windows browsers
# if you've ever pasted text from MSWord, you'll understand
$b2_htmltranswinuni =
array(
'€' =>
'€', // the Euro sign
# ** RSS syndication options **
# these options are used by rdf.php (1.0), rss.php (0.92), and rss2.php (2.0)
# length (in words) of excerpts in the RSS feed? 0=unlimited
# Note: this will not apply to html content!