Autor Tópico: Highslide Image Viewer  (Lida 7634 vezes)

0 Membros e 2 Visitantes estão a ver este tópico.

Offline candidosa2

  • Suporte Tecnico
  • Fundador
  • *
  • Mensagens: 5073
  • Rank: 1658
  • Sexo: Masculino
  • Suporte
    • Hosting Moçambique
Highslide Image Viewer
« em: 03 de Setembro de 2009, 23:28 »
Sources/Subs.php

Pesquisar
Código: [Seleccione]
// Cache the output if it took some time...
if (isset($cache_key, $cache_t) && array_sum(explode(' ', microtime())) - array_sum(explode(' ', $cache_t)) > 0.05)
cache_put_data($cache_key, $message, 240);

Adicionar
Código: [Seleccione]
// * Highslide mod
// Disable for signatures & on stats page
if((empty($cache_id) || substr($cache_id, 0, 3) != 'sig') && $context['current_action'] != 'stats')
{
// Grab all linked and non-linked images
if(preg_match_all('~(<a href="([^"]*?)"(?:[^>]*?)>|)(<img src="((?!'. preg_quote($modSettings['smileys_url'], '#') .').*?)"(?:[^>]*?)>)(?:</a>|)~ism'.($context['utf8'] ? 'u' : ''), $message, $images, PREG_SET_ORDER))
{
//  Output key of images - for each match
// 0. entire match
// 1. <a> or blank
// 2. url or blank
// 3. <img>
// 4. imageurl
// 5. Replacement string

// Cycle through each image
foreach($images as $a => $b)
{
// Match images hosted by Imageshack, Photobucket or iPicture.ru
$c = @parse_url($b[4]);
$c = empty($c['host']) ? '' : $c['host'];

// Non-linked images won't have all the data, so make it up
if(empty($b[1]) && empty($b[2])
&& ((preg_match("~<img[^>]*?(width|height)[^>]*?>~ism", $b[3]))
|| (strpos($c, 'imageshack') !== false && preg_match('~(.*?)\.(?:th\.|)(png|gif|jp(e)?g|bmp)$~is'.($context['utf8'] ? 'u' : ''), $b[4]))
|| (strpos($c, 'photobucket') !== false && preg_match('~(.*?)/(?:th_|)([^/]*?)\.(png|gif|jp(e)?g|bmp)$~is'.($context['utf8'] ? 'u' : ''), $b[4]))
|| (strpos($c, 'ipicture') !== false && preg_match('~(.*?)/(?:thumbs|)/([^/]*?)\.(png|gif|jp(e)?g|bmp)$~is'.($context['utf8'] ? 'u' : ''), $b[4]))
)
)
{
$b[1] = '<a href="'.$b[4].'">';
$b[2] = $b[4];
$b[5] = '<a href="'.$b[4].'">'.$b[3].'</a>';
}
else
$b[5] = $b[0];

if(strpos($c, 'imageshack') !== false)
{
// Fix Imageshack thumbnails and for non-direct page links
if(preg_match('~(.*?)\.(?:th\.|)(png|gif|jp(e)?g|bmp)$~is'.($context['utf8'] ? 'u' : ''), $b[4], $out))
{
$out = $out[1].'.'.$out[2];
$d = $b[1];
$b[1] = str_replace($b[2], $out, $b[1]);
$b[2] = $out;
$b[5] = str_replace($d, $b[1], $b[5]);
unset($c, $d, $out);
}
}
elseif(strpos($c, 'photobucket') !== false)
{
// Fix Photobucket thumbnails
if(preg_match('~(.*?)/(?:th_|)([^/]*?)\.(png|gif|jp(e)?g|bmp)$~is'.($context['utf8'] ? 'u' : ''), $b[4], $out))
{
$out = $out[1].'/'.$out[2].'.'.$out[3];
$d = $b[1];
$b[1] = str_replace($b[2], $out, $b[1]);
$b[2] = $out;
$b[5] = str_replace($d, $b[1], $b[5]);
unset($c, $d, $out);
}
}
elseif(strpos($c, 'ipicture') !== false)
{
// Fix iPicture thumbnails
if(preg_match('~(.*?)/(?:thumbs|)/([^/]*?)\.(png|gif|jp(e)?g|bmp)$~is'.($context['utf8'] ? 'u' : ''), $b[4], $out))
{
$out = $out[1].'/'.$out[2].'.'.$out[3];
$d = $b[1];
$b[1] = str_replace($b[2], $out, $b[1]);
$b[2] = $out;
$b[5] = str_replace($d, $b[1], $b[5]);
unset($c, $d, $out);
}
}

// Add rel="highslide"
$c = $b[1];
        // Http links don't use highslide
        if(preg_match('~\.(png|gif|jp(e)?g|bmp)~is', $b[2]))
$b[1] = str_replace($b[2], $b[2].'" class="highslide" rel="highslide', $b[1]);
$b[5] = str_replace($c, $b[1], $b[5]);
$b[5] = str_replace('alt=""', 'alt="' . $b[2] . '"', $b[5]); // Add filename to caption

// Replace the link in the message
$message = str_replace($b[0], $b[5], $message) . '<div class="highslide-heading">' . (!empty($context['subject']) ? $context['subject'] : '') . '</div>';

// Tidy up
unset($a, $b, $c, $d);
}
// Tidy up
unset($a, $b, $links);
}
}
  // Highslide mod *



Themes/teutema/index.template.php

Pesquisar por
Código: [Seleccione]
// If RSS feeds are enabled, advertise the presence of one.

Adicionar
Código: [Seleccione]
// * Highslide mod
echo '<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/Highslide/highslide.js"></script>
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/Highslide/highslide.', $context['user']['language'], '.js"></script>
<link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/Highslide/highslide.css" media="screen" />
<script type="text/javascript">
    hs.graphicsDir = "', $settings['default_theme_url'], '/Highslide/";
    hs.outlineType = "rounded-white";
    hs.captionEval = "this.thumb.alt";
    hs.transitions = ["expand", "crossfade"];
    hs.align = "center";
    hs.creditsText = "";
    hs.creditsHref = "";
    hs.creditsTitle = "";
    if (hs.addSlideshow) hs.addSlideshow({
        interval: 5000,
        repeat: false,
        useControls: true,
fixedControls: false,
        overlayOptions: {
        opacity: 1,
        position: "top right",
        hideOnMouseOut: false
}
    });
  </script>';
// Highslide mod *


/Themes/default/Display.template.php

Pesquisar
Código: [Seleccione]
<a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" border="0" /></a><br />';
Adicionar e trocar por este
Código: [Seleccione]
<a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" class="highslide" rel="highslide"><img src="', $attachment['thumbnail']['href'], '" alt="' , $attachment['name'] , '" id="thumb_', $attachment['id'], '" border="0" /></a><br /><div class="highslide-heading">' , $message['subject'] , '</div>';

Os ficheiros em anexo e colocar /Themes/default