- md5
- 0e3bdd374af4fe3ce6ab43ea481a6f68
- sha1
- 2e78755fb5180e0cd92f79123937ad13ef12cf33
- sha256
- e6db37dbcf2a7b43f8a4880f381988462ab9a8fa893cac78abcb464e6c93c95a
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @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\Contact\Site\View\Category;
\defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Mail\MailHelper;
use Joomla\CMS\MVC\View\CategoryView;
use Joomla\Component\Contact\Site\Helper\RouteHelper;
/**
* HTML View class for the Contacts component
*
* @since 1.5
*/
class HtmlView extends CategoryView
{
/**
* @var string The name of the extension for the category
* @since 3.2
*/
protected $extension = 'com_contact';
/**
* @var string Default title to use for page title
* @since 3.2
*/
protected $defaultPageTitle = 'COM_CONTACT_DEFAULT_PAGE_TITLE';
/**
* @var string The name of the view to link individual items to
* @since 3.2
*/
protected $viewName = 'contact';
/**
* Run the standard Joomla plugins
*
* @var boolean
* @since 3.5
*/
protected $runPlugins = true;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*/
public function display($tpl = null)
{
parent::commonCategoryDisplay();
// Flag indicates to not add limitstart=0 to URL
$this->pagination->hideEmptyLimitstart = true;
// Prepare the data.
// Compute the contact slug.
foreach ($this->items as $item)
{
$item->slug = $item->alias ? ($item->id . ':' . $item->alias) : $item->id;
$temp = $item->params;
$item->params = clone $this->params;
$item->params->merge($temp);
if ($item->params->get('show_email_headings', 0) == 1)
{
$item->email_to = trim($item->email_to);
if (!empty($item->email_to) && MailHelper::isEmailAddress($item->email_to))
{
$item->email_to = HTMLHelper::_('email.cloak', $item->email_to);
}
else
{
$item->email_to = '';
}
}
}
return parent::display($tpl);
}
/**
* Prepares the document
*
* @return void
*/
protected function prepareDocument()
{
parent::prepareDocument();
$menu = $this->menu;
$id = (int) @$menu->query['id'];
if ($menu && (!isset($menu->query['option']) || $menu->query['option'] != $this->extension || $menu->query['view'] == $this->viewName
|| $id != $this->category->id))
{
$path = array(array('title' => $this->category->title, 'link' => ''));
$category = $this->category->getParent();
while ((!isset($menu->query['option']) || $menu->query['option'] !== 'com_contact' || $menu->query['view'] === 'contact'
|| $id != $category->id) && $category->id > 1)
{
$path[] = array('title' => $category->title, 'link' => RouteHelper::getCategoryRoute($category->id, $category->language));
$category = $category->getParent();
}
$path = array_reverse($path);
foreach ($path as $item)
{
$this->pathway->addItem($item['title'], $item['link']);
}
}
parent::addFeed();
}
}
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.