twitter widget

andymedia

Joined: 2009-01-02
Posts: 88
Posted: Mon, 2013-02-11 20:53

Hello

I was wondering if anyone can help me, i want to instead a twitter widget onto the front page of my site http://www.crayfordmedia.com under the facebook buttom image.

Gallery URL = http://www.crayfordmedia.com/gallery2/main.php
Gallery version = 2.3 core 1.3.0
API = Core 7.54, Module 3.9, Theme 2.6, Embed 1.5
PHP version = 5.2.17 cgi-fcgi
Webserver = Apache/2.4.3 (Unix)
Database = mysqlt 5.5.30-log, lock.system=flock
Toolkits = Exif, Getid3, LinkItemToolkit, Thumbnail, ImageMagick, Gd
Acceleration = full/21600, full/21600
Operating system = Linux web246.extendcp.co.uk 2.6.32-220.13.1.el6.x86_64 #1 SMP Thu Mar 29 11:46:40 EDT 2012 x86_64
Default theme = carbon
gettext = enabled
Locale = en_GB
Browser = Mozilla/5.0 (Windows NT 6.0; rv:18.0) Gecko/20100101 Firefox/18.0
Rows in GalleryAccessMap table = 209
Rows in GalleryAccessSubscriberMap table = 97890
Rows in GalleryUser table = 117
Rows in GalleryItem table = 97745
Rows in GalleryAlbumItem table = 425
Rows in GalleryCacheMap table = 8927

This is the widget -

<a class="twitter-timeline" href="https://twitter.com/Crayfordmedia" data-widget-id="301062807040950272">Tweets by @Crayfordmedia</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>

How do i change it to fit into the coding used in gallery?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2013-02-11 22:19

Set Gallery admin -> General settings -> Embedded Markup -> Raw HTML

Then edit gallery2/modules/core/classes/GalleryUtilities.class -> function htmlSafe line ~850 to look like this:

    function htmlSafe($html, $decode = false) {
        list($ret, $isAnon) = GalleryCoreApi::isAnonymousUser();
        if (!$ret && !$isAnon) {
            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;
    }

Now you can add any html and gallery won't filter it.

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Tue, 2013-02-12 17:00

Alternatively, you could copy and paste the code into an appropriate tpl file in gallery2/themes/carbon/templates without changing any core files.

theme.tpl is a good place if you want to appear on every page. You will just need to find where you want it to appear.

You will need to edit the code so that it reads:

<a class="twitter-timeline" href="https://twitter.com/Crayfordmedia" data-widget-id="301062807040950272">Tweets by @Crayfordmedia</a>
{literal}<script type="text/javascript">!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>{/literal}

Navigate to http://www.crayfordmedia.com/gallery2/lib/support and clear your caches.

--
dakanji.com