diff options
author | Evan Prodromou <evan@status.net> | 2010-03-11 11:31:54 -0500 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-03-21 17:41:37 -0500 |
commit | dfa785e9ae6116e51fcab96d36288334f0503970 (patch) | |
tree | a15374db4cfbd77d7df37e35ae42aed3bc888f7b | |
parent | 7c7d42b5f1c3c9cea62b4a73a97e07cea25f8d30 (diff) |
save the data from TinyMCE
-rw-r--r-- | plugins/TinyMCE/TinyMCEPlugin.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/plugins/TinyMCE/TinyMCEPlugin.php b/plugins/TinyMCE/TinyMCEPlugin.php index 1d9d4a288..c0fd8506e 100644 --- a/plugins/TinyMCE/TinyMCEPlugin.php +++ b/plugins/TinyMCE/TinyMCEPlugin.php @@ -49,6 +49,8 @@ if (!defined('STATUSNET')) { class TinyMCEPlugin extends Plugin { + var $html; + function onEndShowScripts($action) { if (common_logged_in()) { @@ -76,6 +78,39 @@ class TinyMCEPlugin extends Plugin return true; } + function onArgsInitialize(&$args) + { + if (!array_key_exists('action', $args) || + $args['action'] != 'newnotice') { + return true; + } + + $raw = $args['status_textarea']; + + require_once INSTALLDIR.'/extlib/htmLawed/htmLawed.php'; + + $config = array('safe' => 1, + 'deny_attribute' => 'id,style,on*'); + + $this->html = htmLawed($raw, $config); + + $text = html_entity_decode(strip_tags($this->html)); + + $args['status_textarea'] = $text; + + return true; + } + + function onStartNoticeSave($notice) + { + if (!empty($this->html)) { + // Stomp on any rendering + $notice->rendered = $this->html; + } + + return true; + } + function _inlineScript() { $path = common_path('plugins/TinyMCE/js/tiny_mce.js'); |