/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

  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. defined('_JEXEC') or die;
  10. /**
  11. * Registration view class for Users.
  12. *
  13. * @package Joomla.Site
  14. * @subpackage com_users
  15. * @since 1.6
  16. */
  17. class UsersViewRegistration extends JViewLegacy
  18. {
  19. protected $data;
  20. protected $form;
  21. protected $params;
  22. protected $state;
  23. /**
  24. * Method to display the view.
  25. *
  26. * @param string The template file to include
  27. * @since 1.6
  28. */
  29. public function display($tpl = null)
  30. {
  31. // Get the view data.
  32. $this->data = $this->get('Data');
  33. $this->form = $this->get('Form');
  34. $this->state = $this->get('State');
  35. $this->params = $this->state->get('params');
  36. // Check for errors.
  37. if (count($errors = $this->get('Errors'))) {
  38. JError::raiseError(500, implode('<br />', $errors));
  39. return false;
  40. }
  41. // Check for layout override
  42. $active = JFactory::getApplication()->getMenu()->getActive();
  43. if (isset($active->query['layout'])) {
  44. $this->setLayout($active->query['layout']);
  45. }
  46. //Escape strings for HTML output
  47. $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
  48. $this->prepareDocument();
  49. parent::display($tpl);
  50. }
  51. /**
  52. * Prepares the document.
  53. *
  54. * @since 1.6
  55. */
  56. protected function prepareDocument()
  57. {
  58. $app = JFactory::getApplication();
  59. $menus = $app->getMenu();
  60. $title = null;
  61. // Because the application sets a default page title,
  62. // we need to get it from the menu item itself
  63. $menu = $menus->getActive();
  64. if ($menu) {
  65. $this->params->def('page_heading', $this->params->get('page_title', $menu->title));
  66. } else {
  67. $this->params->def('page_heading', JText::_('COM_USERS_REGISTRATION'));
  68. }
  69. $title = $this->params->get('page_title', '');
  70. if (empty($title)) {
  71. $title = $app->getCfg('sitename');
  72. }
  73. elseif ($app->getCfg('sitename_pagetitles', 0) == 1) {
  74. $title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
  75. }
  76. elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
  77. $title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
  78. }
  79. $this->document->setTitle($title);
  80. if ($this->params->get('menu-meta_description'))
  81. {
  82. $this->document->setDescription($this->params->get('menu-meta_description'));
  83. }
  84. if ($this->params->get('menu-meta_keywords'))
  85. {
  86. $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
  87. }
  88. if ($this->params->get('robots'))
  89. {
  90. $this->document->setMetadata('robots', $this->params->get('robots'));
  91. }
  92. }
  93. }