1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-07 15:16:30 +02:00

TinyMce Youtube plugin fix and better BC check in parser.

This commit is contained in:
Cameron
2013-03-19 03:31:20 -07:00
parent e86f651a65
commit ff756111ae
2 changed files with 11 additions and 13 deletions

View File

@@ -32,25 +32,23 @@ if($_POST['mode'] == 'tohtml')
// $content = e107::getBB()->htmltoBBcode($content); //XXX This breaks inserted images from media-manager. :/
e107::getBB()->setClass($_SESSION['media_category']);
if(check_class($pref['post_html'])) // raw HTML within [html] tags.
if(check_class($pref['post_html'])) // raw HTML within [html] tags.
{
// Quick and dirty.
if(strstr($content,"[img]") || strstr($content, "[b]") || strstr($content, "[link") || strstr($content, "[youtube")) // BC - convert old BB code text to html.
if(strstr($content,"[html]") === false) // BC - convert old BB code text to html.
{
e107::getBB()->clearClass();
$content = str_replace('\r\n',"<br />",$content);
$content = nl2br($content, true);
$content = nl2br($content, true); // replace any that were missed.
$content = $tp->toHtml($content, true);
}
$content = str_replace("{e_BASE}","",$content); // We want {e_BASE} in the final data going to the DB, but not the editor.
$srch = array("<!-- bbcode-html-start -->","<!-- bbcode-html-end -->","[html]","[/html]");
$content = str_replace($srch,"",$content);
$content = e107::getBB()->parseBBCodes($content); // parse the <bbcode> tag so we see the HTML equivalent while editing!
$content = str_replace("{e_BASE}","",$content); // We want {e_BASE} in the final data going to the DB, but not the editor.
$srch = array("<!-- bbcode-html-start -->","<!-- bbcode-html-end -->","[html]","[/html]");
$content = str_replace($srch,"",$content);
$content = e107::getBB()->parseBBCodes($content); // parse the <bbcode> tag so we see the HTML equivalent while editing!
echo $content;
}
else // bbcode Mode.

View File

@@ -12,7 +12,7 @@ e107::css('inline',"
.sizeblock { display:inline-block; width: 180px; margin:6px; font-size:14px}
input[type='radio'] { vertical-align: middle; padding-right:10px; }
.e-footer-info { color: silver }
body { background-color: #EEEEEE }
label { vertical-align:middle; line-height:12px}
");
@@ -68,7 +68,7 @@ $(document).ready(function()
}
var html = '<iframe width=\"'+ w +'\" height=\"'+ h +'\" src=\"http://www.youtube.com/embed/YNrn-7zjmYw\" frameborder=\"0\" allowfullscreen></iframe>';
var html = '<iframe width=\"'+ w +'\" height=\"'+ h +'\" src=\"http://www.youtube.com/embed/' + code + '\" frameborder=\"0\" allowfullscreen></iframe>';
tinyMCEPopup.editor.execCommand('mceInsertContent', false, html);
tinyMCEPopup.close();