| Server IP : 46.105.57.169 / Your IP : 216.73.216.144 Web Server : Apache System : Linux webd003.cluster120.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : maitricfuz ( 93378) PHP Version : 8.4.10 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/maitricfuz/www/new-saint-martin/plugins/slideshowck/google/helper/ |
Upload File : |
<?php
/**
* @name Slideshow CK
* @copyright Copyright (C) 2019. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @author Cedric Keiflin - https://www.template-creator.com - https://www.joomlack.fr
*/
// No direct access
defined('_JEXEC') or die;
/**
* Helper Class.
*/
class SlideshowckHelpersourceGoogle {
private static $params;
/**
* Static variable used to determin whether the plugin is running or not
* @var boolean
*/
public static $running;
public static function getItems(&$params) {
self::$params = $params;
$url = $params->get('google_album_url', '', 'raw');
$url = htmlspecialchars_decode($url);
if (! $url) {
\Joomla\CMS\Language\Text::_('SLIDESHOWCK_GOOGLE_EMPTY_URL');
return false;
}
// setup cache to speedup the page load
$timeInterval = $params->get('google_timeinterval', '1', 'int');
if ($timeInterval < 1) $timeInterval = 1;
$timeInterval = $timeInterval * 60;
$cache = \Joomla\CMS\Factory::getCache('mod_slideshowck.google', '');
$cache->setCaching(true);
$key = $url;
$cacheContent = $cache->get($key);
$dev = false;
// set timer to get the new data from the source
self::$running = true;
$lastRun = (int) $cache->get($key . '.time', 0);
$currentTime = time();
$numberMinutes = ($currentTime - $lastRun) / 60;
if (! empty($cacheContent) && $numberMinutes < $timeInterval && $dev !== true)
{
$items = $cacheContent;
} else {
if (ini_get('allow_url_fopen') && function_exists('file_get_contents')) {
$response = file_get_contents($url);
}
// look for curl
if ($response == '' && extension_loaded('curl')) {
$ch = curl_init();
$timeout = 30;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$response = curl_exec($ch);
curl_close($ch);
}
if ( $response ) {
preg_match_all('@\["AF1Q.*?",\["(.*?)"\,@', $response, $urls);
if(isset($urls[1])) $photos = $urls[1];
}
if(isset($urls[1])) {
$photos = $urls[1];
} else {
\Joomla\CMS\Language\Text::_('SLIDESHOWCK_GOOGLE_NO_GOOGLE_PHOTO');
return;
}
$items = Array();
$i = 0;
foreach ($photos as & $photo) {
if (strpos($photo, 'https') !== 0) continue;
$item = SlideshowckHelper::initItem();
$item->image = $photo;
if ($params->get('linkautoimage', '0') === '1') $item->link = $photo . '=s2500';
$items[$i] = $item;
$i++;
}
$cache->store($items, $key);
$cache->store($currentTime, $key . '.time');
}
return $items;
}
}