- md5
- 29b5e0b50e94f1660d8c65a0491bf45e
- sha1
- f6d0c796cfad2c05df3b749cea5599a43cf9f771
- sha256
- 85f575f37dd346115f817b1980a2917b3a0076c60d7b8cfafaf913bc66bd1a01
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
<?php
/**
* @package Joomla.Administrator
* @subpackage com_templates
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Templates\Administrator\Service\HTML;
\defined('_JEXEC') or die;
use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
/**
* Html helper class.
*
* @since 1.6
*/
class Templates
{
/**
* Display the thumb for the template.
*
* @param string $template The name of the template.
* @param integer $clientId The application client ID the template applies to
*
* @return string The html string
*
* @since 1.6
*/
public function thumb($template, $clientId = 0)
{
$client = ApplicationHelper::getClientInfo($clientId);
$basePath = $client->path . '/templates/' . $template;
$thumb = $basePath . '/template_thumbnail.png';
$preview = $basePath . '/template_preview.png';
$html = '';
if (file_exists($thumb))
{
$clientPath = ($clientId == 0) ? '' : 'administrator/';
$thumb = $clientPath . 'templates/' . $template . '/template_thumbnail.png';
$html = HTMLHelper::_('image', $thumb, Text::_('COM_TEMPLATES_PREVIEW'));
if (file_exists($preview))
{
$html = '<button type="button" data-target="#' . $template . '-Modal" class="thumbnail float-left" data-toggle="modal" title="'. Text::_('COM_TEMPLATES_CLICK_TO_ENLARGE') . '">' . $html . '</button>';
}
}
return $html;
}
/**
* Renders the html for the modal linked to thumb.
*
* @param string $template The name of the template.
* @param integer $clientId The application client ID the template applies to
*
* @return string The html string
*
* @since 3.4
*/
public function thumbModal($template, $clientId = 0)
{
$client = ApplicationHelper::getClientInfo($clientId);
$basePath = $client->path . '/templates/' . $template;
$baseUrl = ($clientId == 0) ? Uri::root(true) : Uri::root(true) . '/administrator';
$thumb = $basePath . '/template_thumbnail.png';
$preview = $basePath . '/template_preview.png';
$html = '';
if (file_exists($thumb) && file_exists($preview))
{
$preview = $baseUrl . '/templates/' . $template . '/template_preview.png';
$footer = '<button type="button" class="btn btn-secondary" data-dismiss="modal">'
. Text::_('JTOOLBAR_CLOSE') . '</button>';
$html .= HTMLHelper::_(
'bootstrap.renderModal',
$template . '-Modal',
array(
'title' => Text::sprintf('COM_TEMPLATES_SCREENSHOT', ucfirst($template)),
'height' => '500px',
'width' => '800px',
'footer' => $footer,
),
$body = '<div><img src="' . $preview . '" style="max-width:100%" alt="' . $template . '"></div>'
);
}
return $html;
}
}
The same content is in 5 releases, Joomla 4.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.