Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move JHelp to namespace #14232

Merged
merged 1 commit into from
Feb 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions libraries/classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@
JLoader::registerAlias('JRules', '\\Joomla\\Cms\\Access\\Rules', '4.0');

JLoader::registerAlias('JAuthenticationHelper', '\\Joomla\\Cms\\Authentication\\AuthenticationHelper', '4.0');

JLoader::registerAlias('JHelp', '\\Joomla\\Cms\\Help\\Help', '4.0');
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
<?php
/**
* @package Joomla.Libraries
* @subpackage Help
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/

namespace Joomla\Cms\Help;

defined('JPATH_PLATFORM') or die;

/**
* Help system class
*
* @since 1.5
*/
class JHelp
class Help
{
/**
* Create a URL for a given help key reference
Expand All @@ -31,11 +32,11 @@ class JHelp
public static function createUrl($ref, $useComponent = false, $override = null, $component = null)
{
$local = false;
$app = JFactory::getApplication();
$app = \JFactory::getApplication();

if (is_null($component))
{
$component = JApplicationHelper::getComponentName();
$component = \JApplicationHelper::getComponentName();
}

// Determine the location of the help file. At this stage the URL
Expand All @@ -48,7 +49,7 @@ public static function createUrl($ref, $useComponent = false, $override = null,
else
{
// Get the user help URL.
$user = JFactory::getUser();
$user = \JFactory::getUser();
$url = $user->getParam('helpsite');

// If user hasn't specified a help URL, then get the global one.
Expand All @@ -61,7 +62,7 @@ public static function createUrl($ref, $useComponent = false, $override = null,
if ($useComponent)
{
// Look for help URL in component parameters.
$params = JComponentHelper::getParams($component);
$params = \JComponentHelper::getParams($component);
$url = $params->get('helpURL');

if ($url == '')
Expand Down Expand Up @@ -91,13 +92,13 @@ public static function createUrl($ref, $useComponent = false, $override = null,
/*
* Replace substitution codes in the URL.
*/
$lang = JFactory::getLanguage();
$version = new JVersion;
$lang = \JFactory::getLanguage();
$version = new \JVersion;
Copy link
Member

@yvesh yvesh Feb 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you are going to namespace JVersion, JText etc. too, don't you want to start by namespacing the most used / important ones first and then use the namespaced version here ;)

Else you need to go again through each file

$jver = explode('.', $version->getShortVersion());
$jlang = explode('-', $lang->getTag());

$debug = $lang->setDebug(false);
$keyref = JText::_($ref);
$keyref = \JText::_($ref);
$lang->setDebug($debug);

// Replace substitution codes in help URL.
Expand Down