1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-29 19:00:26 +02:00

Plugin Addons: e_tohtml.php deprecated in favor of new e_parse.php addon file. TinyMce now disables plugin hooks during parsing.

This commit is contained in:
Cameron
2016-08-01 12:58:03 -07:00
parent a33c752c86
commit 7de9daf9ff
4 changed files with 83 additions and 8 deletions

View File

@@ -154,9 +154,10 @@ class e_parse extends e_parser
array( array(
'defs'=>TRUE, 'constants'=>'full', 'parse_sc'=>TRUE 'defs'=>TRUE, 'constants'=>'full', 'parse_sc'=>TRUE
), ),
// text is parsed by the Wysiwyg editor. eg. TinyMce
'WYSIWYG' => 'WYSIWYG' =>
array( array(
'defs'=>FALSE, 'constants'=>'full', 'parse_sc'=>FALSE, 'wysiwyg'=>TRUE 'hook' => false, 'link_click' => false, 'link_replace' => false, 'retain_nl' => true
), ),
// text is user-entered (i.e. untrusted)'body' or 'bulk' text (e.g. custom page body, content body) // text is user-entered (i.e. untrusted)'body' or 'bulk' text (e.g. custom page body, content body)
'USER_BODY' => 'USER_BODY' =>
@@ -1900,12 +1901,33 @@ class e_parse extends e_parser
$this->e_hook[$hook] = new $hook_class; $this->e_hook[$hook] = new $hook_class;
} }
} }
if(is_object( $this->e_hook[$hook]))
{
$sub_blk = $this->e_hook[$hook]->to_html($sub_blk, $opts['context']); $sub_blk = $this->e_hook[$hook]->to_html($sub_blk, $opts['context']);
} }
} }
} }
if(!empty($pref['e_parse_list']))
{
foreach($pref['e_parse_list'] as $plugin)
{
$hookObj = e107::getAddon($plugin,'e_parse');
if($tmp = e107::callMethod($hookObj, 'toHTML', $sub_blk, $opts['context']))
{
$sub_blk = $tmp;
}
}
}
}
// Word wrap // Word wrap
if ($wrap && !$opts['nobreak']) if ($wrap && !$opts['nobreak'])
{ {
@@ -3186,7 +3208,7 @@ class e_parser
protected $allowedTags = array('html', 'body','div','a','img','table','tr', 'td', 'th', 'tbody', 'thead', 'colgroup', 'b', protected $allowedTags = array('html', 'body','div','a','img','table','tr', 'td', 'th', 'tbody', 'thead', 'colgroup', 'b',
'i', 'pre','code', 'strong', 'u', 'em','ul', 'ol', 'li','img','h1','h2','h3','h4','h5','h6','p', 'i', 'pre','code', 'strong', 'u', 'em','ul', 'ol', 'li','img','h1','h2','h3','h4','h5','h6','p',
'div','pre','section','article', 'blockquote','hgroup','aside','figure','figcaption', 'abbr','span', 'audio', 'video', 'br', 'div','pre','section','article', 'blockquote','hgroup','aside','figure','figcaption', 'abbr','span', 'audio', 'video', 'br',
'small', 'caption', 'noscript', 'hr', 'section', 'iframe' 'small', 'caption', 'noscript', 'hr', 'section', 'iframe', 'sub', 'sup', 'cite'
); );
protected $scriptTags = array('script','applet','form','input','button', 'embed', 'object'); //allowed when $pref['post_script'] is enabled. protected $scriptTags = array('script','applet','form','input','button', 'embed', 'object'); //allowed when $pref['post_script'] is enabled.

View File

@@ -37,8 +37,8 @@ class e107plugin
'e_meta', // @Deprecated 'e_meta', // @Deprecated
'e_emailprint', 'e_emailprint',
'e_frontpage', 'e_frontpage',
'e_latest', // @Deprecated - see e_dashboard 'e_latest', /* @deprecated - see e_dashboard */
'e_status', //@Deprecated - see e_dashboard 'e_status', /* @deprecated - see e_dashboard */
'e_menu', 'e_menu',
'e_search', 'e_search',
'e_shortcode', 'e_shortcode',
@@ -55,8 +55,9 @@ class e107plugin
'e_url', // simple mod-rewrite. 'e_url', // simple mod-rewrite.
'e_mailout', 'e_mailout',
'e_sitelink', // sitelinks generator. 'e_sitelink', // sitelinks generator.
'e_tohtml', 'e_tohtml', /* @deprecated - use e_parse */
'e_featurebox', 'e_featurebox',
'e_parse',
'e_related', 'e_related',
'e_rss', 'e_rss',
'e_upload', 'e_upload',

View File

@@ -0,0 +1,52 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2010 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/linkwords/e_tohtml.php,v $
* $Revision$
* $Date$
* $Author$
*/
if (!defined('e107_INIT')) { exit; }
class _blank_parse
{
/* constructor */
function __construct()
{
}
/**
* @param string $text html/text to be processed.
* @param string $context Current context ie. OLDDEFAULT | BODY | TITLE | SUMMARY | DESCRIPTION | WYSIWYG etc.
* @return string
*/
function toHtml($text, $context='')
{
$text = str_replace('****', '<hr />', $text);
return $text;
}
}
?>

View File

@@ -129,7 +129,7 @@ TEMPL;
//$content = str_replace('\r\n',"<br />",$content); //$content = str_replace('\r\n',"<br />",$content);
//$content = nl2br($content, true); //$content = nl2br($content, true);
$content = $tp->toHtml($content, true); $content = $tp->toHtml($content, true, 'WYSIWYG');
} }
$content = str_replace("{e_BASE}",e_HTTP,$content); // We want {e_BASE} in the final data going to the DB, but not the editor. $content = str_replace("{e_BASE}",e_HTTP,$content); // We want {e_BASE} in the final data going to the DB, but not the editor.
@@ -161,7 +161,7 @@ TEMPL;
//echo $tp->toHtml(str_replace("\n","",$content), true); //echo $tp->toHtml(str_replace("\n","",$content), true);
$content = str_replace("{e_BASE}",e_HTTP, $content); // We want {e_BASE} in the final data going to the DB, but not the editor. $content = str_replace("{e_BASE}",e_HTTP, $content); // We want {e_BASE} in the final data going to the DB, but not the editor.
$content = $tp->toHtml($content, true); $content = $tp->toHtml($content, true, 'WYSIWYG');
$content = str_replace(e_MEDIA_IMAGE,"{e_MEDIA_IMAGE}",$content); $content = str_replace(e_MEDIA_IMAGE,"{e_MEDIA_IMAGE}",$content);
$text = ""; $text = "";