PageRenderTime 23ms CodeModel.GetById 18ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/components/com_users/views/registration/view.html.php

https://bitbucket.org/eternaware/joomus
PHP | 110 lines | 62 code | 17 blank | 31 comment | 10 complexity | dacfddee7f4ea26bba41eb5994ee6908 MD5 | raw file
Possible License(s): LGPL-2.1
  1<?php
  2/**
  3 * @package     Joomla.Site
  4 * @subpackage  com_users
  5 *
  6 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
  7 * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8 */
  9
 10defined('_JEXEC') or die;
 11
 12/**
 13 * Registration view class for Users.
 14 *
 15 * @package     Joomla.Site
 16 * @subpackage  com_users
 17 * @since       1.6
 18 */
 19class UsersViewRegistration extends JViewLegacy
 20{
 21	protected $data;
 22
 23	protected $form;
 24
 25	protected $params;
 26
 27	protected $state;
 28
 29	/**
 30	 * Method to display the view.
 31	 *
 32	 * @param	string	The template file to include
 33	 * @since	1.6
 34	 */
 35	public function display($tpl = null)
 36	{
 37		// Get the view data.
 38		$this->data		= $this->get('Data');
 39		$this->form		= $this->get('Form');
 40		$this->state	= $this->get('State');
 41		$this->params	= $this->state->get('params');
 42
 43		// Check for errors.
 44		if (count($errors = $this->get('Errors'))) {
 45			JError::raiseError(500, implode('<br />', $errors));
 46			return false;
 47		}
 48
 49		// Check for layout override
 50		$active = JFactory::getApplication()->getMenu()->getActive();
 51		if (isset($active->query['layout'])) {
 52			$this->setLayout($active->query['layout']);
 53		}
 54
 55		//Escape strings for HTML output
 56		$this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
 57
 58		$this->prepareDocument();
 59
 60		parent::display($tpl);
 61	}
 62
 63	/**
 64	 * Prepares the document.
 65	 *
 66	 * @since	1.6
 67	 */
 68	protected function prepareDocument()
 69	{
 70		$app		= JFactory::getApplication();
 71		$menus		= $app->getMenu();
 72		$title 		= null;
 73
 74		// Because the application sets a default page title,
 75		// we need to get it from the menu item itself
 76		$menu = $menus->getActive();
 77		if ($menu) {
 78			$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
 79		} else {
 80			$this->params->def('page_heading', JText::_('COM_USERS_REGISTRATION'));
 81		}
 82
 83		$title = $this->params->get('page_title', '');
 84		if (empty($title)) {
 85			$title = $app->getCfg('sitename');
 86		}
 87		elseif ($app->getCfg('sitename_pagetitles', 0) == 1) {
 88			$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
 89		}
 90		elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
 91			$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
 92		}
 93		$this->document->setTitle($title);
 94
 95		if ($this->params->get('menu-meta_description'))
 96		{
 97			$this->document->setDescription($this->params->get('menu-meta_description'));
 98		}
 99
100		if ($this->params->get('menu-meta_keywords'))
101		{
102			$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
103		}
104
105		if ($this->params->get('robots'))
106		{
107			$this->document->setMetadata('robots', $this->params->get('robots'));
108		}
109	}
110}