29
0
mirror of https://github.com/joomla/joomla-cms.git synced 2024-06-29 16:43:42 +00:00

Optimised page title handling

git-svn-id: http://joomlacode.org/svn/joomla/development/trunk@8843 6f6e1ebd-4c2b-0410-823f-f34bde69bce9
This commit is contained in:
Johan Janssens 2007-09-12 01:30:07 +00:00
parent 38e43b5bd1
commit 1721d8b502
29 changed files with 144 additions and 202 deletions

View File

@ -43,6 +43,7 @@ Legend:
^ Refactored JUser to use JObject setError and improved flexibility of the user data
store through JUser::getTable function. This change allows to easily extend the user
database tables
^ Renamed JSite::getPageParameters to getParams to maintain consistency
11-Sep-2007 Nur Aini Rakhmawati
# Fixed [#6104] Components menu with invalid + duplicate id attributes

View File

@ -149,7 +149,7 @@ class ContactController extends JController
// Passed Validation: Process the contact plugins to integrate with other applications
$results = $dispatcher->trigger( 'onSubmitContact', array( &$contact, &$post ) );
$pparams = &$mainframe->getPageParameters('com_contact');
$pparams = &$mainframe->getParams('com_contact');
if (!$pparams->get( 'custom_reply' ))
{
$MailFrom = $mainframe->getCfg('mailfrom');
@ -218,7 +218,7 @@ class ContactController extends JController
$contact->load($contactId);
// Get the contact detail parameters
$pparams = &$mainframe->getPageParameters('com_contact');
$pparams = &$mainframe->getParams('com_contact');
// Should we show the vcard?
if ($pparams->get('allow_vcard', 0))
@ -317,7 +317,7 @@ class ContactController extends JController
// Get params and component configurations
$params = new JParameter($contact->params);
$pparams = &$mainframe->getPageParameters('com_contact');
$pparams = &$mainframe->getParams('com_contact');
// check for session cookie
$sessionCheck = $pparams->get( 'validate_session', 1 );

View File

@ -32,11 +32,7 @@ class ContactViewCategory extends JView
$model = &$this->getModel();
$document =& JFactory::getDocument();
// Get the parameters of the active menu item
$menus =& JSite::getMenu();
$menu = $menus->getActive();
$pparams = &$mainframe->getPageParameters('com_contact');
$pparams = &$mainframe->getParams('com_contact');
// Selected Request vars
$categoryId = JRequest::getVar('catid', 0, '', 'int');
@ -45,9 +41,6 @@ class ContactViewCategory extends JView
$filter_order = JRequest::getVar('filter_order', 'cd.ordering', '', 'cmd');
$filter_order_Dir = JRequest::getVar('filter_order_Dir', 'ASC', '', 'word');
// Set some defaults against system variables
$pparams->def('page_title', $menu->name);
// query options
$options['aid'] = $user->get('aid', 0);
$options['category_id'] = $categoryId;

View File

@ -36,9 +36,7 @@ class ContactViewContact extends JView
$menus = &JSite::getMenu();
$menu = $menus->getActive();
$pparams = &$mainframe->getPageParameters('com_contact');
$pparams->def('page_title', $menu->name );
$pparams = &$mainframe->getParams();
// Push a model into the view
$model = &$this->getModel();

View File

@ -54,7 +54,7 @@ class ContentModelArchive extends JModel
if (empty($this->_data))
{
// Get the page/component configuration
$params = &$mainframe->getPageParameters();
$params = &$mainframe->getParams();
// Get the pagination request variables
$limit = JRequest::getVar('limit', $params->get('display_num', 20), '', 'int');
@ -90,7 +90,7 @@ class ContentModelArchive extends JModel
{
global $mainframe;
// Get the page/component configuration
$params = &$mainframe->getPageParameters();
$params = &$mainframe->getParams();
// If voting is turned on, get voting data as well for the content items
$voting = ContentHelperQuery::buildVotingQuery($params);
@ -176,7 +176,7 @@ class ContentModelArchive extends JModel
$filter = $db->getEscaped($filter);
// Get the page/component configuration
$params = &$mainframe->getPageParameters();
$params = &$mainframe->getParams();
switch ($params->get('filter_type', 'title'))
{
case 'title' :

View File

@ -460,7 +460,7 @@ class ContentModelArticle extends JModel
if (empty($this->_article))
{
// Get the page/component configuration
$params = &$mainframe->getPageParameters();
$params = &$mainframe->getParams();
// If voting is turned on, get voting data as well for the article
$voting = ContentHelperQuery::buildVotingQuery($params);
@ -521,7 +521,7 @@ class ContentModelArticle extends JModel
}
// Get the page/component configuration
$params = clone($mainframe->getPageParameters('com_content'));
$params = clone($mainframe->getParams('com_content'));
// Merge article parameters into the page configuration
$aparams = new JParameter($this->_article->attribs);

View File

@ -252,7 +252,7 @@ class ContentModelCategory extends JModel
$user =& JFactory::getUser();
// Get the page/component configuration
$params = &$mainframe->getPageParameters();
$params = &$mainframe->getParams();
$noauth = !$params->get('show_noauth');
$gid = (int) $user->get('aid', 0);
@ -343,7 +343,7 @@ class ContentModelCategory extends JModel
{
global $mainframe;
// Get the page/component configuration
$params = &$mainframe->getPageParameters();
$params = &$mainframe->getParams();
// If voting is turned on, get voting data as well for the content items
$voting = ContentHelperQuery::buildVotingQuery($params);
@ -372,7 +372,7 @@ class ContentModelCategory extends JModel
{
global $mainframe;
// Get the page/component configuration
$params = &$mainframe->getPageParameters();
$params = &$mainframe->getParams();
$filter_order = JRequest::getCmd('filter_order');
$filter_order_Dir = JRequest::getWord('filter_order_Dir');
@ -424,7 +424,7 @@ class ContentModelCategory extends JModel
$now = $jnow->toMySQL();
// Get the page/component configuration
$params = &$mainframe->getPageParameters();
$params = &$mainframe->getParams();
$noauth = !$params->get('show_noauth');
$nullDate = $this->_db->getNullDate();

View File

@ -117,7 +117,7 @@ class ContentModelFrontpage extends JModel
{
global $mainframe;
// Get the page/component configuration
$params = &$mainframe->getPageParameters();
$params = &$mainframe->getParams();
// Voting is turned on, get voting data as well for the content items
$voting = ContentHelperQuery::buildVotingQuery($params);
@ -151,7 +151,7 @@ class ContentModelFrontpage extends JModel
{
global $mainframe;
// Get the page/component configuration
$params = &$mainframe->getPageParameters();
$params = &$mainframe->getParams();
if (!is_object($params)) {
$params = &JComponentHelper::getParams('com_content');
}
@ -180,7 +180,7 @@ class ContentModelFrontpage extends JModel
$now = $jnow->toMySQL();
// Get the page/component configuration
$params = &$mainframe->getPageParameters();
$params = &$mainframe->getParams();
$noauth = !$params->get('show_noauth');
$nullDate = $this->_db->getNullDate();

View File

@ -259,7 +259,7 @@ class ContentModelSection extends JModel
{
$user =& JFactory::getUser();
$params = &$mainframe->getPageParameters();
$params = &$mainframe->getParams();
$noauth = !$params->get('show_noauth');
$gid = $user->get('aid', 0);
@ -403,7 +403,7 @@ class ContentModelSection extends JModel
global $mainframe;
// Get the page/component configuration
$params = &$mainframe->getPageParameters();
$params = &$mainframe->getParams();
// If voting is turned on, get voting data as well for the content items
$voting = ContentHelperQuery::buildVotingQuery($params);
@ -478,7 +478,7 @@ class ContentModelSection extends JModel
$now = $jnow->toMySQL();
// Get the page/component configuration
$params = &$mainframe->getPageParameters();
$params = &$mainframe->getParams();
$noauth = !$params->get('show_noauth');
$nullDate = $this->_db->getNullDate();

View File

@ -38,15 +38,10 @@ class ContentViewArchive extends ContentView
// Initialize some variables
$user =& JFactory::getUser();
$document =& JFactory::getDocument();
$pathway =& $mainframe->getPathway();
// Get the menu item object
$menus = &JSite::getMenu();
$menu = $menus->getActive();
// Get the page/component configuration
$params = &$mainframe->getPageParameters('com_content');
$params = &$mainframe->getParams('com_content');
// Request variables
$task = JRequest::getCmd('task');
@ -64,8 +59,6 @@ class ContentViewArchive extends ContentView
// Add item to pathway
$pathway->addItem(JText::_('Archive'), '');
$document->setTitle($menu->name);
$params->def('filter', 1);
$params->def('filter_type', 'title');

View File

@ -31,7 +31,7 @@ class ContentViewCategory extends JView
global $mainframe;
$doc =& JFactory::getDocument();
$params =& $mainframe->getPageParameters();
$params =& $mainframe->getParams();
$doc->link = JURI::base().JRoute::_('index.php?option=com_content&view=category&id='.JRequest::getVar('id',null, '', 'int'));
// Get some data from the model

View File

@ -32,7 +32,6 @@ class ContentViewCategory extends ContentView
// Initialize some variables
$user =& JFactory::getUser();
$document =& JFactory::getDocument();
$uri =& JFactory::getURI();
$pathway =& $mainframe->getPathway();
@ -41,7 +40,7 @@ class ContentViewCategory extends ContentView
$menu = $menus->getActive();
// Get the page/component configuration
$params = &$mainframe->getPageParameters('com_content');
$params = &$mainframe->getParams('com_content');
// Request variables
$task = JRequest::getCmd('task');
@ -84,10 +83,7 @@ class ContentViewCategory extends ContentView
$pathway->addItem($category->title, '');
}
$document->setTitle($menu->name);
$params->def('date_format', JText::_('DATE_FORMAT_LC1'));
$params->def('page_title', $menu->name);
jimport('joomla.html.pagination');
$pagination = new JPagination($total, $limitstart, $limit - $links);

View File

@ -34,7 +34,7 @@ class ContentViewFrontpage extends JView
// parameters
$db =& JFactory::getDBO();
$document =& JFactory::getDocument();
$params =& $mainframe->getPageParameters();
$params =& $mainframe->getParams();
$document->link = JURI::base().JRoute::_('index.php?option=com_content&view=frontpage');
// Get some data from the model

View File

@ -40,15 +40,10 @@ class ContentViewFrontpage extends ContentView
$limit = JRequest::getVar('limit', 5, '', 'int');
$limitstart = JRequest::getVar('limitstart', 0, '', 'int');
// Get the menu item object
$menus = &JSite::getMenu();
$menu = $menus->getActive();
// Get the page/component configuration
$params = &$mainframe->getPageParameters('com_content');
$params = &$mainframe->getParams();
// parameters
$title = $params->def('page_title', $mainframe->getCfg('sitename' ));
$intro = $params->def('num_intro_articles', 4);
$leading = $params->def('num_leading_articles', 1);
$links = $params->def('num_links', 4);
@ -57,7 +52,6 @@ class ContentViewFrontpage extends ContentView
$descrip_image = $params->def('show_description_image',1);
$params->set('show_intro', 1);
$params->def('page_title', $menu->name);
$limit = $intro + $leading + $links;
JRequest::setVar('limit', (int) $limit);
@ -82,9 +76,6 @@ class ContentViewFrontpage extends ContentView
$document->addHeadLink(JRoute::_($link.'&type=atom'), 'alternate', 'rel', $attribs);
}
$document = &JFactory::getDocument();
$document->setTitle($title);
jimport('joomla.html.pagination');
$this->pagination = new JPagination($total, $limitstart, $limit - $links);

View File

@ -31,7 +31,7 @@ class ContentViewSection extends JView
{
global $mainframe;
$doc =& JFactory::getDocument();
$params =& $mainframe->getPageParameters();
$params =& $mainframe->getParams();
// Get some data from the model
JRequest::setVar('limit', $mainframe->getCfg('feed_limit'));

View File

@ -35,12 +35,8 @@ class ContentViewSection extends ContentView
$user =& JFactory::getUser();
$document =& JFactory::getDocument();
// Get the menu item object
$menus = &JSite::getMenu();
$menu = $menus->getActive();
// Get the page/component configuration
$params = &$mainframe->getPageParameters('com_content');
$params = &$mainframe->getParams();
// Request variables
$limit = JRequest::getVar('limit', $params->get('display_num'), '', 'int');
@ -75,19 +71,13 @@ class ContentViewSection extends ContentView
$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
$document->addHeadLink(JRoute::_($link.'&type=atom'), 'alternate', 'rel', $attribs);
}
// Set the page title
if (!empty ($menu->name)) {
$document->setTitle($menu->name);
}
for($i = 0; $i < count($categories); $i++)
{
$category =& $categories[$i];
$category->link = JRoute::_('index.php?view=category&id='.$category->slug);
}
$params->def('page_title', $menu->name);
if ($total == 0) {
$params->set('show_categories', false);
}

View File

@ -0,0 +1,80 @@
<?php
/**
* @version $Id: media.php 8660 2007-08-30 23:53:21Z louis $
* @package Joomla
* @subpackage Massmail
* @copyright Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant to the
* GNU General Public License, and as distributed it includes or is derivative
* of works licensed under the GNU General Public License or other free or open
* source software licenses. See COPYRIGHT.php for copyright notices and
* details.
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
jimport( 'joomla.application.component.controller' );
/**
* Media Manager Component Controller
*
* @package Joomla
* @subpackage Media
* @version 1.5
*/
class MediaController extends JController
{
/**
* Display the view
*/
function display()
{
global $mainframe;
$vName = JRequest::getCmd('view', 'images');
switch ($vName)
{
case 'imagesList':
$mName = 'list';
$vLayout = JRequest::getCmd( 'layout', 'default' );
break;
case 'images':
default:
$vLayout = JRequest::getCmd( 'layout', 'default' );
$mName = 'manager';
$vName = 'images';
break;
}
$document = &JFactory::getDocument();
$vType = $document->getType();
// Get/Create the view
$view = &$this->getView( $vName, $vType);
$view->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'views'.DS.$vName.DS.'tmpl');
// Get/Create the model
if ($model = &$this->getModel($mName)) {
// Push the model into the view (as default)
$view->setModel($model, true);
}
// Set the layout
$view->setLayout($vLayout);
// Display the view
$view->display();
}
function ftpValidate()
{
// Set FTP credentials, if given
jimport('joomla.client.helper');
JClientHelper::setCredentialsFromRequest('ftp');
}
}

View File

@ -31,72 +31,12 @@ define('COM_MEDIA_BASEURL', JURI::base().$params->get('image_path', 'images/stor
// Load the admin HTML view
require_once( JPATH_COMPONENT_ADMINISTRATOR.DS.'helpers'.DS.'media.php' );
jimport( 'joomla.application.component.controller' );
/**
* Media Manager Component Controller
*
* @package Joomla
* @subpackage Media
* @version 1.5
*/
class MediaController extends JController
{
/**
* Display the view
*/
function display()
{
global $mainframe;
$vName = JRequest::getCmd('view', 'images');
switch ($vName)
{
case 'imagesList':
$mName = 'list';
$vLayout = JRequest::getCmd( 'layout', 'default' );
break;
case 'images':
default:
$vLayout = JRequest::getCmd( 'layout', 'default' );
$mName = 'manager';
$vName = 'images';
break;
}
$document = &JFactory::getDocument();
$vType = $document->getType();
// Get/Create the view
$view = &$this->getView( $vName, $vType);
$view->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'views'.DS.$vName.DS.'tmpl');
// Get/Create the model
if ($model = &$this->getModel($mName)) {
// Push the model into the view (as default)
$view->setModel($model, true);
}
// Set the layout
$view->setLayout($vLayout);
// Display the view
$view->display();
}
function ftpValidate()
{
// Set FTP credentials, if given
jimport('joomla.client.helper');
JClientHelper::setCredentialsFromRequest('ftp');
}
}
// Require the base controller
require_once (JPATH_COMPONENT.DS.'controller.php');
$cmd = JRequest::getCmd('task', null);
if (strpos($cmd, '.') != false && false) {
if (strpos($cmd, '.') != false && false)
{
// We have a defined controller/task pair -- lets split them out
list($controllerName, $task) = explode('.', $cmd);
@ -110,7 +50,9 @@ if (strpos($cmd, '.') != false && false) {
} else {
JError::raiseError(500, 'Invalid Controller');
}
} else {
}
else
{
// Base controller, just set the task :)
$controllerName = null;
$task = $cmd;

View File

@ -32,21 +32,11 @@ class NewsfeedsViewCategories extends JView
{
global $mainframe;
$document = &JFactory::getDocument();
// Load the menu object and parameters
$menus = &JSite::getMenu();
$menu = $menus->getActive();
$params = &$mainframe->getPageParameters();
$params = &$mainframe->getParams();
$categories =& $this->get('data');
// Parameters
$params->def( 'page_title', $menu->name );
// Set the page title
$document->setTitle($params->get('page_title'));
for($i = 0; $i < count($categories); $i++)
{
$category =& $categories[$i];

View File

@ -38,16 +38,13 @@ class NewsfeedsViewCategory extends JView
// Get the parameters of the active menu item
$menus = &JSite::getMenu();
$menu = $menus->getActive();
$params = &$mainframe->getPageParameters();
$params = &$mainframe->getParams();
$category = $this->get('category');
$items = $this->get('data');
$total = $this->get('total');
$pagination = &$this->get('pagination');
// Parameters
$params->def( 'page_title', $menu->name );
// Set page title per category
$document->setTitle( $category->title. ' - '. $params->get( 'page_title'));

View File

@ -46,7 +46,7 @@ class NewsfeedsViewNewsfeed extends JView
// Get the current menu item
$menus = &JSite::getMenu();
$menu = $menus->getActive();
$params = &$mainframe->getPageParameters();
$params = &$mainframe->getParams();
//get the newsfeed
$newsfeed =& $this->get('data');
@ -84,13 +84,9 @@ class NewsfeedsViewNewsfeed extends JView
// feed elements
$newsfeed->items = array_slice($newsfeed->items, 0, $newsfeed->numarticles);
// Adds parameter handling
$params->def( 'page_title', $menu->name );
// Set page title per category
$document->setTitle( $newsfeed->name . ' - '. $params->get( 'page_title'));
//set breadcrumbs
if($menu->query['view'] != 'newsfeed')
{

View File

@ -47,9 +47,7 @@ class PollViewPoll extends JView
}
// Adds parameter handling
$menu =& JSite::getMenu();
$item = $menu->getActive();
$params = $mainframe->getPageParameters();
$params = $mainframe->getParams();
//Set page title information
$document->setTitle($poll->title);

View File

@ -34,7 +34,6 @@ class SearchViewSearch extends JView
require_once(JPATH_COMPONENT_ADMINISTRATOR.DS.'helpers'.DS.'search.php' );
// Initialize some variables
$document =& JFactory::getDocument();
$pathway =& $mainframe->getPathway();
$uri =& JFactory::getURI();
@ -47,17 +46,8 @@ class SearchViewSearch extends JView
$state = &$this->get('state');
$searchword = $state->get('keyword');
// Set page title information
$document->setTitle(JText::_('Search'));
// Get the parameters of the active menu item
$menus = &JSite::getMenu();
$menu = $menus->getActive();
$params = &$mainframe->getPageParameters();
if(isset($menu)) {
$params->def( 'page_title', $menu->name );
}
$params = &$mainframe->getParams();
// built select lists
$orders = array();

View File

@ -55,17 +55,7 @@ class UserViewUser extends JView
global $mainframe;
$user =& JFactory::getUser();
$document =& JFactory::getDocument();
// Get the parameters of the active menu item
$menu = &JSite::getMenu();
$item = $menu->getActive();
// Set page title
if ( isset($item->name) ) {
$document->setTitle( $item->name );
}
// check to see if Frontend User Params have been enabled
$usersConfig = &JComponentHelper::getParams( 'com_users' );
$check = $usersConfig->get('frontend_userparams');

View File

@ -33,23 +33,16 @@ class WeblinksViewCategories extends JView
$document =& JFactory::getDocument();
$menu = &JSite::getMenu();
$item = $menu->getActive();
$categories =& $this->get('data');
$total =& $this->get('total');
$state =& $this->get('state');
// Get the page/component configuration
$params = &$mainframe->getPageParameters();
$params = &$mainframe->getParams();
// Set some defaults if not set for params
$params->def('page_title', $item->name);
$params->def('comp_description', JText::_('WEBLINKS_DESC'));
// Set the page title
$document->setTitle($params->get('page_title'));
// Define image tag attributes
if ($params->get('image') != -1)
{

View File

@ -48,7 +48,7 @@ class WeblinksViewCategory extends JView
$state = &$this->get('state');
// Get the page/component configuration
$params = &$mainframe->getPageParameters();
$params = &$mainframe->getParams();
$category->total = $total;
@ -80,7 +80,6 @@ class WeblinksViewCategory extends JView
$lists['order'] = $state->get('filter_order');
// Set some defaults if not set for params
$params->def('page_title', $menu->name);
$params->def('com_description', JText::_('WEBLINKS_DESC'));
// Define image tag attributes

View File

@ -25,12 +25,6 @@ class WrapperViewWrapper extends JView
{
function display( $tpl = null )
{
// Get the parameters of the active menu item
$menus = &JSite::getMenu();
$menu = $menus->getActive();
$this->params->def( 'page_title', $menu->name );
// auto height control
if ( $this->params->def( 'height_auto' ) ) {
$this->wrapper->load = 'onload="iFrameHeight()"';

View File

@ -48,7 +48,7 @@ class WrapperController
$menu = $menus->getActive();
// Get the page/component configuration
$params = &$mainframe->getPageParameters();
$params = &$mainframe->getParams();
//set page title
$document->setTitle($menu->name);

View File

@ -91,6 +91,7 @@ class JSite extends JApplication
$document =& JFactory::getDocument();
$user =& JFactory::getUser();
$router =& $this->getRouter();
$params =& $this->getParams();
switch($document->getType())
{
@ -117,8 +118,8 @@ class JSite extends JApplication
}
$document->setTitle( $this->getCfg('sitename' ));
$document->setDescription( $this->getCfg('MetaDesc') );
$document->setTitle( $params->get('page_title') );
$document->setDescription( $params->get('page_description') );
$contents = JComponentHelper::renderComponent($component);
$document->setBuffer( $contents, 'component');
@ -201,16 +202,17 @@ class JSite extends JApplication
}
/**
* Get Page Parameters
* Get the appliaction parameters
*
* @return object The page parameters object
* @return object The parameters object
* @since 1.5
*/
function &getPageParameters($option=null)
function &getParams($option = null)
{
static $params;
if (!is_object($params)) {
if (!is_object($params))
{
// Get component parameters
if (!$option) {
$option = JRequest::getCmd('option');
@ -220,11 +222,20 @@ class JSite extends JApplication
// Get menu parameters
$menus = &JSite::getMenu();
$menu = $menus->getActive();
$title = $this->getCfg('sitename' );
$description = $this->getCfg('MetaDesc');
// Lets cascade the parameters if we have menu item parameters
if (is_object($menu)) {
if (is_object($menu))
{
$params->merge(new JParameter($menu->params));
$title = $menu->name;
}
$params->def( 'page_title' , $title );
$params->def( 'page_description', $description );
}
return $params;