]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
save the data from TinyMCE
authorEvan Prodromou <evan@status.net>
Thu, 11 Mar 2010 16:31:54 +0000 (11:31 -0500)
committerEvan Prodromou <evan@status.net>
Sun, 21 Mar 2010 22:41:37 +0000 (17:41 -0500)
plugins/TinyMCE/TinyMCEPlugin.php

index 1d9d4a2882e0482b884bc1e7fa1a95ac9ad6a90e..c0fd8506ed704c85d9b96bb264ee90bf6242a482 100644 (file)
@@ -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');