mirror of
https://github.com/e107inc/e107.git
synced 2025-08-08 07:36:32 +02:00
Some TinyMce fixes.
This commit is contained in:
@@ -9,8 +9,8 @@
|
|||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic usage [h=2]text[/h]
|
* Basic usage [h=2]text[/h] // this will break things.
|
||||||
* The same [h]text[/h] as heading number defaults to '2'
|
* The same [h]text[/h] as heading number defaults to '2' // this won't.
|
||||||
* Advanced usage [h=2|class=className&id=element-id&style=some: style; and: moresStyle]text[/h]
|
* Advanced usage [h=2|class=className&id=element-id&style=some: style; and: moresStyle]text[/h]
|
||||||
* 'class' defaults to 'bbcode' (if left empty)
|
* 'class' defaults to 'bbcode' (if left empty)
|
||||||
*/
|
*/
|
||||||
@@ -45,9 +45,12 @@ class bb_h extends e_bb_base
|
|||||||
}
|
}
|
||||||
if($safe)
|
if($safe)
|
||||||
{
|
{
|
||||||
return '[h='.$h.'|'.eHelper::buildAttr($safe).']'.$code_text.'[/h]';
|
return '[h'.$h.'|'.eHelper::buildAttr($safe).']'.$code_text.'[/h'.$h.']';
|
||||||
}
|
}
|
||||||
return '[h='.$h.']'.$code_text.'[/h]';
|
return '[h'.$h.']'.$code_text.'[/h'.$h.']';
|
||||||
|
|
||||||
|
// IMPORTANT: Using '[h=2]' with a non-matching closing tag etc will cause major issues with TinyMce.
|
||||||
|
// It is cleaner to use [h2], [h3] etc. TODO - Batch BBcodes. ;-)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -487,6 +487,7 @@ class e107_db_debug {
|
|||||||
$text .= "\$_SERVER['PHP_SELF']: '".$_SERVER['PHP_SELF']."'<br />";
|
$text .= "\$_SERVER['PHP_SELF']: '".$_SERVER['PHP_SELF']."'<br />";
|
||||||
$text .= "\$_SERVER['DOCUMENT_ROOT']: '".$_SERVER['DOCUMENT_ROOT']."'<br />";
|
$text .= "\$_SERVER['DOCUMENT_ROOT']: '".$_SERVER['DOCUMENT_ROOT']."'<br />";
|
||||||
$text .= "\$_SERVER['HTTP_HOST']: '".$_SERVER['HTTP_HOST']."'<br />";
|
$text .= "\$_SERVER['HTTP_HOST']: '".$_SERVER['HTTP_HOST']."'<br />";
|
||||||
|
$text .= "Active Theme Layout: '".THEME_LAYOUT."'<br />";
|
||||||
|
|
||||||
|
|
||||||
$text .= "<pre>";
|
$text .= "<pre>";
|
||||||
|
@@ -43,24 +43,29 @@
|
|||||||
s = s.replace(re, str);
|
s = s.replace(re, str);
|
||||||
};
|
};
|
||||||
|
|
||||||
// rep(/<td>([\s\S]*?)<\/td>/gim,"[td]$1[/td]\n"); // verified
|
//return s;
|
||||||
// rep(/<tr>([\s\S]*?)<\/tr>/gim,"[tr]$1[/tr]\n"); // verified
|
|
||||||
// rep(/<table>([\s\S]*?)<\/table>/gim,"[table]$1[/table]\n"); // verified
|
|
||||||
|
|
||||||
|
rep(/<table(.*)>/gim, "[table]");
|
||||||
|
rep(/<\/table>/gim, "[/table]");
|
||||||
|
rep(/<td>/gim, "[td]");
|
||||||
|
rep(/<\/td>/gim, "[/td]");
|
||||||
|
rep(/<tr>/gim, "[tr]");
|
||||||
|
rep(/<\/tr>/gim, "[/tr]");
|
||||||
|
rep(/<tbody>/gim, "[tbody]");
|
||||||
|
rep(/<\/tbody>/gim, "[/tbody]");
|
||||||
|
|
||||||
|
|
||||||
return s;
|
|
||||||
|
|
||||||
rep(/<div style="text-align: center;">([\s\S]*)<\/div>/gi,"[center]$1[/center]"); // verified
|
rep(/<div style="text-align: center;">([\s\S]*)<\/div>/gi,"[center]$1[/center]"); // verified
|
||||||
|
|
||||||
|
rep(/<li>/gi, "[*]"); // verified
|
||||||
|
rep(/<\/li>/gi, ""); // verified
|
||||||
|
rep(/<ul>([\s\S]*?)<\/ul>/gim, "[list]$1[/list]\n"); // verified
|
||||||
|
|
||||||
rep(/<li>/gi,"[*]"); // verified
|
|
||||||
rep(/<\/li>/gi,""); // verified
|
|
||||||
rep(/<ul>([\s\S]*?)<\/ul>/gim,"[list]$1[/list]\n"); // verified
|
|
||||||
rep(/<ol .* style=\'list-style-type:\s*([\w]*).*\'>([\s\S]*)<\/ol>/gim,"[list=$1]$2[/list]\n"); // verified
|
rep(/<ol .* style=\'list-style-type:\s*([\w]*).*\'>([\s\S]*)<\/ol>/gim,"[list=$1]$2[/list]\n"); // verified
|
||||||
rep(/<ol>([\s\S]*?)<\/ol>/gim,"[list=decimal]$1[/list]\n"); // verified
|
rep(/<ol>([\s\S]*?)<\/ol>/gim,"[list=decimal]$1[/list]\n"); // verified
|
||||||
rep(/<span style="color: (#?.*?);">([\s\S]*)<\/span>/gi,"[color=$1]$2[/color]"); // verified
|
rep(/<span style="color: (#?.*?);">([\s\S]*)<\/span>/gi,"[color=$1]$2[/color]"); // verified
|
||||||
|
rep(/<h2>/gim, "[h]"); // verified
|
||||||
|
rep(/<\/h2>/gim, "[/h]"); // verified
|
||||||
|
|
||||||
|
|
||||||
// example: <strong> to [b]
|
// example: <strong> to [b]
|
||||||
@@ -95,9 +100,17 @@
|
|||||||
rep(/<u>/gi,"[u]");
|
rep(/<u>/gi,"[u]");
|
||||||
rep(/<blockquote[^>]*>/gi,"[quote]");
|
rep(/<blockquote[^>]*>/gi,"[quote]");
|
||||||
rep(/<\/blockquote>/gi,"[/quote]");
|
rep(/<\/blockquote>/gi,"[/quote]");
|
||||||
rep(/<br \/>/gi,"\n");
|
|
||||||
rep(/<br\/>/gi,"\n");
|
// Compromise - but BC issues for sure.
|
||||||
rep(/<br>/gi,"\n");
|
rep(/<br \/>/gi,"[br]");
|
||||||
|
rep(/<br\/>/gi,"[br]");
|
||||||
|
rep(/<br>/gi,"[br]");
|
||||||
|
|
||||||
|
// rep(/<br \/>/gi,"\n");
|
||||||
|
// rep(/<br\/>/gi,"\n");
|
||||||
|
// rep(/<br>/gi,"\n");
|
||||||
|
|
||||||
|
|
||||||
rep(/<p>/gi,"");
|
rep(/<p>/gi,"");
|
||||||
rep(/<\/p>/gi,"\n");
|
rep(/<\/p>/gi,"\n");
|
||||||
rep(/ /gi," ");
|
rep(/ /gi," ");
|
||||||
@@ -120,16 +133,42 @@
|
|||||||
s = s.replace(re, str);
|
s = s.replace(re, str);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// example: [b] to <strong>
|
// example: [b] to <strong>
|
||||||
|
|
||||||
|
// rep(/<ul>(\r|\n)?/gim, "<ul>"); // remove line-breaks
|
||||||
|
// rep(/<\/li>(\r|\n)?/gim, "</li>"); // remove line-breaks
|
||||||
|
// rep(/<\/ul>(\r|\n)?/gim, "</ul>"); // remove line-breaks
|
||||||
|
|
||||||
|
rep(/\[table]/gim, "<table>");
|
||||||
|
rep(/\[\/table]/gim, "</table>");
|
||||||
|
rep(/\[td]/gim, "<td>");
|
||||||
|
rep(/\[\/td]/gim, "</td>");
|
||||||
|
rep(/\[tr]/gim, "<tr>");
|
||||||
|
rep(/\[\/tr]/gim, "</tr>");
|
||||||
|
rep(/\[tbody]/gim, "<tbody>");
|
||||||
|
rep(/\[\/tbody]/gim, "</tbody>");
|
||||||
|
|
||||||
|
rep(/\[h]/gim, "<h2>"); // verified
|
||||||
|
rep(/\[\/h]/gim, "</h2>"); // verified
|
||||||
|
|
||||||
|
// rep(/(\[list=.*\])\\*([\s\S]*)(\[\/list])(\n|\r)/gim,"<ol>$2</ol>"); // verified
|
||||||
|
rep(/(\[list\])\\*([\s\S]*)(\[\/list])(\n|\r)?/gim,"<ul>$2</ul>");// verified
|
||||||
|
|
||||||
rep(/(\[list=.*\])\\*([\s\S]*)(\[\/list])/gim,"<ol>$2</ol>"); // verified
|
|
||||||
rep(/(\[list\])\\*([\s\S]*)(\[\/list])/gim,"<ul>$2</ul>");// verified
|
|
||||||
rep(/^ *?\[\*\](.*)/gim,"<li>$1</li>");
|
rep(/^ *?\[\*\](.*)/gim,"<li>$1</li>");
|
||||||
|
|
||||||
|
|
||||||
rep(/\[center\]([\s\S]*)\[\/center\]/gi,"<div style=\"text-align:center\">$1</div>"); // verified
|
rep(/\[center\]([\s\S]*)\[\/center\]/gi,"<div style=\"text-align:center\">$1</div>"); // verified
|
||||||
rep(/\[color=(.*?)\]([\s\S]*)\[\/color\]/gi,"<span style=\"color: $1;\">$2<\/span>"); // verified
|
rep(/\[color=(.*?)\]([\s\S]*)\[\/color\]/gi,"<span style=\"color: $1;\">$2<\/span>"); // verified
|
||||||
|
// rep(/\[list](\r|\n)/gim, '[list]'); // remove breaks from [list]
|
||||||
|
|
||||||
|
rep(/\[br]/gi,"<br />"); // compromise
|
||||||
|
// rep(/\n/gi,"<br \/>"); // breaks lists.. need a regex to exclude everything between [list]...[/list]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//rep( /(?<!(\[list]))\r|\n/gim,"<br />" )
|
||||||
|
|
||||||
// rep(/\n/gi,"<br \/>"); // breaks lists.. need a regex to exclude everything between [list]...[/list]
|
|
||||||
|
|
||||||
rep(/\[b\]/gi,"<strong>");
|
rep(/\[b\]/gi,"<strong>");
|
||||||
rep(/\[\/b\]/gi,"</strong>");
|
rep(/\[\/b\]/gi,"</strong>");
|
||||||
@@ -145,6 +184,8 @@
|
|||||||
rep(/\[code\](.*?)\[\/code\]/gi,"<span class=\"codeStyle\">$1</span> ");
|
rep(/\[code\](.*?)\[\/code\]/gi,"<span class=\"codeStyle\">$1</span> ");
|
||||||
rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<span class=\"quoteStyle\">$1</span> ");
|
rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<span class=\"quoteStyle\">$1</span> ");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// e107 FIXME!
|
// e107 FIXME!
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user