- md5
- 33a52a447d2d69215db447caa9c44a8c
- sha1
- a7d0599f0333b91e8eb16c0160c0c3a2acbeae55
- sha256
- e8548c24dc73922ac6e30e4ae31e7958457d4ebc88ba0af6d4a863f302721876
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
<?php
/**
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* HTML Article View class for the Weblinks component
*
* @package Joomla.Site
* @subpackage com_weblinks
* @since 1.5
*/
class WeblinksViewForm extends JViewLegacy
{
protected $form;
protected $item;
protected $return_page;
protected $state;
public function display($tpl = null)
{
$user = JFactory::getUser();
// Get model data.
$this->state = $this->get('State');
$this->item = $this->get('Item');
$this->form = $this->get('Form');
$this->return_page = $this->get('ReturnPage');
if (empty($this->item->id))
{
$authorised = ($user->authorise('core.create', 'com_weblinks') || (count($user->getAuthorisedCategories('com_weblinks', 'core.create'))));
}
else
{
$authorised = $user->authorise('core.edit', 'com_weblinks.category.'.$this->item->catid);
}
if ($authorised !== true)
{
JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
return false;
}
if (!empty($this->item))
{
$this->form->bind($this->item);
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
// Create a shortcut to the parameters.
$params = &$this->state->params;
//Escape strings for HTML output
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
$this->params = $params;
$this->user = $user;
$this->_prepareDocument();
parent::display($tpl);
}
/**
* Prepares the document
*/
protected function _prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if (empty($this->item->id))
{
$head = JText::_('COM_WEBLINKS_FORM_SUBMIT_WEBLINK');
}
else
{
$head = JText::_('COM_WEBLINKS_FORM_EDIT_WEBLINK');
}
if ($menu)
{
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
}
else
{
$this->params->def('page_heading', $head);
}
$title = $this->params->def('page_title', $head);
if ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
}
$this->document->setTitle($title);
if ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots', $this->params->get('robots'));
}
}
}
The same content is in 5 releases, Joomla 3.3.2 to 3.3.6. See them all, or every version of this file.