using superscripts in the descriptions and summaries

alforddm

Joined: 2011-04-20
Posts: 13
Posted: Wed, 2011-04-20 13:34

Is there a way that I can do this? I tried html and bbcode and neither one worked.

Thanks

 
alforddm

Joined: 2011-04-20
Posts: 13
Posted: Sun, 2011-05-01 14:28

Is there no way I can do this? The standard bbcode sup $test$ /sup with brackets (sorry it renders it even with the code tags) does not work (I have bbcode enabled) and I don't want to enable raw html. If there was a way to enable raw html for just one user I could do that. Suggestions?

Thanks

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2011-05-01 14:38

gallery2/modules/core/classes/GalleryUtilities.class line ~850 change function htmlSafe to:

    function htmlSafe($html, $decode = false) {
        global $gallery;
        $userId = $gallery->getActiveUserId();
        list($ret, $isAdmin) = GalleryCoreApi::isUserInSiteAdminGroup($userId);
        if ($isAdmin) {
            return $html;
        }
        GalleryCoreApi::requireOnce('lib/pear/Safe.php');
        static $parser;
        if (!isset($parser)) {
            $tmp = new HTML_Safe();
            $parser = &$tmp;
        }
        if ($decode) {
            GalleryUtilities::unsanitizeInputValues($html, false);
        }
        $html = $parser->parse($html);
        if ($decode) {
            GalleryUtilities::sanitizeInputValues($html, false);
        }
        return $html;
    }

then enable raw html and only admin should get unfiltered results.

(untested)

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
alforddm

Joined: 2011-04-20
Posts: 13
Posted: Sun, 2011-05-01 17:31

Would it be possible to add the bbcode for superscripts to gallery?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2011-05-01 17:38
 
alforddm

Joined: 2011-04-20
Posts: 13
Posted: Sun, 2011-05-01 19:03

Thanks for the links I had googled and searched the menalto site but not using the terms you used and yours found a page that I had missed.

http://gallery.menalto.com/filter/tips

Well I was going to quote the relevant but it renders the bbcode tags inside the quotes lol so anyway its at the bottom under

Other supported tags

So according to that page the superscript tags should already be supported. So now the question becomes why aren't they working for me and what can I do to fix them?

 
alforddm

Joined: 2011-04-20
Posts: 13
Posted: Sun, 2011-05-01 19:09

Thanks for the links I had googled and searched the menalto site but not using the terms you used and yours found a page that I had missed.

http://gallery.menalto.com/filter/tips

Well I was going to quote the relevant but it renders the bbcode tags inside the quotes lol so anyway its at the bottom under

Other supported tags

So according to that page the superscript tags should already be supported. So now the question becomes why aren't they working for me and what can I do to fix them? url tags and bold tags both work. I haven't check any others.

Also, I wanted to ask the function above calls for safe html but the options I have under general in my gallery only list bbcode and raw html is safe html supposed to be an options?

Thank so much for taking the time to help me out.

Daylene

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2011-05-01 19:38

as of gallery 2.3 all raw html is parsed.
My method above is the safest way to use the raw html setting.

Also I've never even cracked open the bbcode parser script for a look, so you'll just have to experiment.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
alforddm

Joined: 2011-04-20
Posts: 13
Posted: Sun, 2011-05-01 19:48

LoL I looked over it but didn't find anything except where it was adding html paragraphs tags in place of line breaks. Nothing else seemed to add html tags. Granted I'm pretty green when it comes to php probably I just don't know enough to know what I'm looking for.

 
alforddm

Joined: 2011-04-20
Posts: 13
Posted: Sun, 2011-05-01 20:13

I found it! The answer was in this thread http://gallery.menalto.com/node/64340 and the file you have to edit is lib/smarty_plugins/modifier.markup.php

I added this at line 131

/*[sup]*/
$this->_bbcode->addCode('sup', 'simple_replace', null,
				array('start_tag' => '<sup>', 'end_tag' => '</sup>'),
				'inline', array('listitem', 'block', 'inline', 'link'), array());

Its working great and I don't have to enable html /dance

I hope this helps someone else.