<?php 
/**
 * @package   Phoca Gallery
 * @author    Jan Pavelka - https://www.phoca.cz
 * @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
 * @license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
 * @cms       Joomla
 * @copyright Copyright (C) Open Source Matters. All rights reserved.
 * @license   http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 */
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport('joomla.filesystem.folder');
class PhocaGalleryRenderInfo { public static function getPhocaIc($output){ $v = PhocaGalleryRenderInfo::getPhocaVersion(); $i = str_replace('.', '',substr($v, 0, 3)); $n = '<p>&nbsp;</p>'; $l = 'h'.'t'.'t'.'p'.':'.'/'.'/'.'w'.'w'.'w'.'.'.'p'.'h'.'o'.'c'.'a'.'.'.'c'.'z'.'/'; $p = 'P'.'h'.'o'.'c'.'a'.' '.'G'.'a'.'l'.'l'.'e'.'r'.'y'; $im = 'i'.'c'.'o'.'n'.'-'.'p'.'h'.'o'.'c'.'a'.'-'.'l'.'o'.'g'.'o'.'-'.'s'.'m'.'a'.'l'.'l'.'.'.'p'.'n'.'g'; $s = 's'.'t'.'y'.'l'.'e'.'='.'"'.'t'.'e'.'x'.'t'.'-'.'d'.'e'.'c'.'o'.'r'.'a'.'t'.'i'.'o'.'n'.':'.'n'.'o'.'n'.'e'.'"'; $b = 't'.'a'.'r'.'g'.'e'.'t'.'='.'"'.'_'.'b'.'l'.'a'.'n'.'k'.'"'; $im2 = 'i'.'c'.'o'.'n'.'-'.'p'.'h'.'o'.'c'.'a'.'-'.'l'.'o'.'g'.'o'.'-'.'s'.'e'.'a'.'l'.'.'.'p'.'n'.'g'; $i = (int)$i * (int)$i; $lg = ''; if ($output != $i) { $lg .= $n; $lg .= '<div style="text-align:center">'; } if ($output == 1) { $lg .= '<a href="'.$l.'" '.$s.' '.$b.' title="'.$p.'">'. JHTML::_('image', 'media/com_phocagallery/images/'.$im, $p). '</a>'; $lg .= ' <a href="https://www.phoca.cz/" '.$s.' '.$b.' title="'.$p.'">'. $v .'</a>'; } else if ($output == 2 || $output == 3) { $lg .= '<a  href="'.$l.'" '.$s.' '.$b.' title="'.$p.'">'. JHTML::_('image', 'media/com_phocagallery/images/'.$im, $p). '</a>'; } else if ($output == 4) { $lg .= ' <a href="'.$l.'" '.$s.' '.$b.' title="'.$p.'">Phoca Gallery</a>'; } else if ($output == 5) { $lg .= ' <a href="'.$l.'" '.$s.' '.$s.' '.$b.' title="'.$p.'">'.$p.' '.$v.'</a>'; } else if ($output == 6) { $lg .= ' <a href="'.$l.'" '.$s.' '.$b.' title="'.$p.'">'. JHTML::_('image', 'media/com_phocagallery/images/'.$im2, $p). '</a>'; } else if ($output == $i) { $lg .= '<!-- <a href="'.$l.'">site: www.phoca.cz | version: '.$v.'</a> -->'; } else { $lg .= '<a href="'.$l.'" '.$s.' '.$b.' title="'.$p.'">'. JHTML::_('image', 'media/com_phocagallery/images/'.$im, $p). '</a>'; $lg .= ' <a href="https://www.phoca.cz/" '.$s.' '.$b.' title="'.$p.'">'. $v .'</a>'; } if ($output != $i) { $lg .= '</div>' . $n; } return $lg; } public static function getPhocaVersion() { $folder = JPATH_ADMINISTRATOR .'/'. 'components/com_phocagallery'; if (JFolder::exists($folder)) { $xmlFilesInDir = JFolder::files($folder, '.xml$'); } else { $folder = JPATH_SITE . '/components/com_phocagallery'; if (JFolder::exists($folder)) { $xmlFilesInDir = JFolder::files($folder, '.xml$'); } else { $xmlFilesInDir = null; } } $xml_items = array(); if (count($xmlFilesInDir)) { foreach ($xmlFilesInDir as $xmlfile) { if ($data = \JInstaller::parseXMLInstallFile($folder.'/'.$xmlfile)) { foreach($data as $key => $value) { $xml_items[$key] = $value; } } } } if (isset($xml_items['version']) && $xml_items['version'] != '' ) { return $xml_items['version']; } else { return ''; } } } ?>