We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22815
    • 1,097 Posts
    Yes, form tags get removed. What is your test?
      No, I don't know what OpenGeek's saying half the time either.
      MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
      Forum: Where to post threads about add-ons | Forum Rules
      Like MODx? donate (and/or share your resources)
      Like me? See my Amazon wishlist
      MODx "Most Promising CMS" - so appropriate!
      • 1341
      • 20 Posts
      <p lang="fr"> into <p lang="fr" xml:lang="fr">

      and

      <font face="Arial"> into <span style="font-family:Arial;">
        • 22815
        • 1,097 Posts
        Hmmn. I get
        <p lang="fr"> into <p>

        and

        <font face="Arial"> into <span>

        which is clearly doing something, if not quite the right thing.

        Can you please make sure that you’re not using the rich text editor (change editor, and untick Rich Text from the document so that it remembers that)? Because the only way I can see this not changing stuff would be if it wasn’t seeing it as HTML but encoded characters.
          No, I don&#39;t know what OpenGeek&#39;s saying half the time either.
          MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
          Forum: Where to post threads about add-ons | Forum Rules
          Like MODx? donate (and/or share your resources)
          Like me? See my Amazon wishlist
          MODx "Most Promising CMS" - so appropriate!
          • 1341
          • 20 Posts
          How insidious:

          <p lang=\"fr\">Francais</p>


          Bonk! I encountered exactly the same problem when I was working on a plugin for WordPress. We’ll have to stripslash it, process, then addslashes.

          Also, we need to find the event for QuickEdit, as HTML Purifier does not seem to be called when that editor is used.
            • 1341
            • 20 Posts
            So here’s the plugin, but it doesn’t cover QuickEdit.

            $e = &$modx->Event;
            if ($e->name == 'OnBeforeDocFormSave') {
                global $content;
                
                set_include_path('../assets/plugins/htmlpurifier/library/' . PATH_SEPARATOR . get_include_path());
                include_once 'HTMLPurifier.php';
                $purifier = new HTMLPurifier();
                
                static $magic_quotes = null;
                if ($magic_quotes === null) {
                    // this is an ugly hack because this hook hasn't
                    // had the backslashes removed yet when magic_quotes_gpc is on,
                    // but HTMLPurifier must not have the quotes slashed.
                    $magic_quotes = get_magic_quotes_gpc();
                }
                
                if ($magic_quotes) $content = stripslashes($content);
                $content = $purifier->purify($content);
                if ($magic_quotes) $content = addslashes($content);
            }
              • 22815
              • 1,097 Posts
              Aha.

              I’m off to bed now, so testing that and finding the QE details will have to wait. (But first, I’ll uninstall this plugin from my site before I forget..)

              This Purifier is interesting. I’m going to look into adding it to the "import" routine, as this would be a particular time-saver when converting existing sites into MODx (and because that’s another point of entry for document content).

              If we are to package this up as a plugin and add it to our Repository, how much of htmlpurifier-1.0.1.zip do we need to include? I’d like to just include CREDITS, LICENSE and library (ie everything that would go up into a MODx site) and invite people to download the whole thing from your site if they wanted the demos and favicons etc. Is that OK with you?
                No, I don&#39;t know what OpenGeek&#39;s saying half the time either.
                MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
                Forum: Where to post threads about add-ons | Forum Rules
                Like MODx? donate (and/or share your resources)
                Like me? See my Amazon wishlist
                MODx "Most Promising CMS" - so appropriate!
                • 1341
                • 20 Posts
                But first, I’ll uninstall this plugin from my site before I forget.

                You were testing on a live site? Naughty naughty tongue The import routine sounds savvy.

                If we are to package this up as a plugin and add it to our Repository, how much of htmlpurifier-1.0.1.zip do we need to include? I’d like to just include CREDITS, LICENSE and library (ie everything that would go up into a MODx site) and invite people to download the whole thing from your site if they wanted the demos and favicons etc. Is that OK with you?

                Yeah, of course. I should really start releasing a lite version too.
                  • 6726
                  • 7,075 Posts
                  Waow, guys, you’ve been busy !

                  Really amazing speed grin

                  I’ll give the code above a test run... this could really be the answer to the html gibberish we’re getting from FCK and aliases...
                    .: COO - Commerce Guys - Community Driven Innovation :.


                    MODx est l&#39;outil id
                    • 22815
                    • 1,097 Posts
                    Quote from: Ambush at Sep 06, 2006, 01:05 AM

                    But first, I’ll uninstall this plugin from my site before I forget.
                    You were testing on a live site? Naughty naughty tongue
                    My personal site, which is the only 0.9.2.1 "nobody else uses it" playground I had available.

                    Is it possible to have multiple configs and specify which to use? I can envisage it being useful to filter guest-entered content (like comments) more strictly than authorised-users.
                      No, I don&#39;t know what OpenGeek&#39;s saying half the time either.
                      MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
                      Forum: Where to post threads about add-ons | Forum Rules
                      Like MODx? donate (and/or share your resources)
                      Like me? See my Amazon wishlist
                      MODx "Most Promising CMS" - so appropriate!
                      • 6726
                      • 7,075 Posts
                      Okay... so I gave the latest code a try.

                      Since I am french, I encountered yet another problem, unfortunately... the purifier sure does remove all the rubish out of the copied pasted Word document (except br xhtml tag), but I have a BIG problem with character encoding : it messes all the accented characters é è à... etc. (french in MODx is currently set as ISO-8859-1 e.g latin1).

                      I’ll try to use the utf-8 mod for french language and test it out, but I’d bet it’s gonna work.
                      I’ll keep you posted.
                        .: COO - Commerce Guys - Community Driven Innovation :.


                        MODx est l&#39;outil id