english/libraries/joomla/language/help.php
/**
	 * Create a URL for a given help key reference
	 *
	 * @param   string   $ref           The name of the help screen (its key reference)
	 * @param   boolean  $useComponent  Use the help file in the component directory
	 * @param   string   $override      Use this URL instead of any other
	 * @param   string   $component     Name of component (or null for current component)
	 *
	 * @return  string
	 *
	 * @since   11.1
	 */
Create a URL for a given help key reference
@param   string   $ref           The name of the help screen (its key reference)
@param   boolean  $useComponent  Use the help file in the component directory
@param   string   $override      Use this URL instead of any other
@param   string   $component     Name of component (or null for current component)

@return  string


Create a URL for a given help key reference @param string $ref The name of the help screen ( its key reference ) @param boolean $useComponent Use the help file in the component directory @param string $override Use this URL instead of any other @param string $component Name of component ( or null for current component ) @return string
static function createURL($ref, $useComponent = false, $override = null, $component = null)
	{
		$local	= false;
		$app	= JFactory::getApplication();
		if (is_null($component)) {
			$component = JApplicationHelper::getComponentName();
		}
		if ($override) {
			$url = $override;
		}
		else {
			$user		= JFactory::getUser();
			$url		= $user->getParam('helpsite');
			if ($url == '') {
				$url	= $app->getCfg('helpurl');
			}
			if ($useComponent) {
				$params = JComponentHelper::getParams( $component );
				$url = $params->get('helpURL');
				if ($url == '') {
					$local = true;
					$url = 'components/{component}/help/{language}/{keyref}';
				}
			}
			if (!$url) {
				$local = true;
				$url = 'help/{language}/{keyref}';
			}
		}
		if ($local) {
			if (!preg_match('#\.html$|\.xml$#i', $ref)) {
					$url .= '.html';
			}
		}
		$lang		= JFactory::getLanguage();
		$version 	= new JVersion;
		$jver		= explode( '.', $version->getShortVersion() );
		$jlang		= explode( '-', $lang->getTag() );
		$debug		= $lang->setDebug(false);
		$keyref     = JText::_($ref);
		$lang->setDebug($debug);
		$search = array(
			'{app}',			
			'{component}',		
			'{keyref}',			
			'{language}',		
			'{langcode}',		
			'{langregion}',		
			'{major}',			
			'{minor}',			
			'{maintenance}'		
		);
		$replace = array(
			$app->getName(),	
			$component,			
			$keyref,			
			$lang->getTag(),	
			$jlang[0],			
			$jlang[1],			
			$jver[0],			
			$jver[1],			
			$jver[2]			
		);
		if ($local) {
			$try = str_replace($search, $replace, $url);
			jimport('joomla.filesystem.file');
			if (!JFile::exists(JPATH_BASE.'/'.$try)) {
				$replace[3] = 'en-GB';
				$replace[4] = 'en';
				$replace[5] = 'GB';
			}
		}
		$url = str_replace($search, $replace, $url);
		return $url;
	}
static function createURL ( $ ref , $ useComponent = false , $ override = null , $ component = null ) { $ local = false ; $ app = JFactory :: getApplication ( ) ; if ( is_null ( $ component ) ) { $ component = JApplicationHelper :: getComponentName ( ) ; } if ( $ override ) { $ url = $ override ; } else { $ user = JFactory :: getUser ( ) ; $ url = $ user -> getParam ( 'helpsite' ) ; if ( $ url == '' ) { $ url = $ app -> getCfg ( 'helpurl' ) ; } if ( $ useComponent ) { $ params = JComponentHelper :: getParams ( $ component ) ; $ url = $ params -> get ( 'helpURL' ) ; if ( $ url == '' ) { $ local = true ; $ url = 'components/{component}/help/{language}/{keyref}' ; } } if ( ! $ url ) { $ local = true ; $ url = 'help/{language}/{keyref}' ; } } if ( $ local ) { if ( ! preg_match ( '#\.html$|\.xml$#i' , $ ref ) ) { $ url .= '.html' ; } } $ lang = JFactory :: getLanguage ( ) ; $ version = new JVersion ; $ jver = explode ( '.' , $ version -> getShortVersion ( ) ) ; $ jlang = explode ( '-' , $ lang -> getTag ( ) ) ; $ debug = $ lang -> setDebug ( false ) ; $ keyref = JText :: _ ( $ ref ) ; $ lang -> setDebug ( $ debug ) ; $ search = array ( '{app}' , '{component}' , '{keyref}' , '{language}' , '{langcode}' , '{langregion}' , '{major}' , '{minor}' , '{maintenance}' ) ; $ replace = array ( $ app -> getName ( ) , $ component , $ keyref , $ lang -> getTag ( ) , $ jlang [ 0 ] , $ jlang [ 1 ] , $ jver [ 0 ] , $ jver [ 1 ] , $ jver [ 2 ] ) ; if ( $ local ) { $ try = str_replace ( $ search , $ replace , $ url ) ; jimport ( 'joomla.filesystem.file' ) ; if ( ! JFile :: exists ( JPATH_BASE . '/' . $ try ) ) { $ replace [ 3 ] = 'en-GB' ; $ replace [ 4 ] = 'en' ; $ replace [ 5 ] = 'GB' ; } } $ url = str_replace ( $ search , $ replace , $ url ) ; return $ url ; }
Create a URL for a given help key reference
 @param   string   $ref           The name of the help screen (its key reference)
 @param   boolean  $useComponent  Use the help file in the component directory
 @param   string   $override      Use this URL instead of any other
 @param   string   $component     Name of component (or null for current component)
Create a URL for a given help key reference @param string $ref The name of the help screen ( its key reference ) @param boolean $useComponent Use the help file in the component directory @param string $override Use this URL instead of any other @param string $component Name of component ( or null for current component )
//  Determine the location of the help file.  At this stage the URL //  can contain substitution codes that will be replaced later. // Get the user help URL. // If user hasn't specified a help URL, then get the global one. // Component help URL overrides user and global. // Look for help URL in component parameters. // Set up a local help URL. // If the URL is local then make sure we have a valid file extension on the URL. /*
		 *  Replace substitution codes in the URL.
		 */ // Replace substitution codes in help URL. // Application name (eg. 'Administrator') // Component name (eg. 'com_content') // Help screen key reference // Full language code (eg. 'en-GB') // Short language code (eg. 'en') // Region code (eg. 'GB') // Joomla major version number // Joomla minor version number // Joomla maintenance version number // {app} // {component} // {keyref} // {language} // {langcode} // {langregion} // {major} // {minor} // {maintenance} // If the help file is local then check it exists. // If it doesn't then fallback to English.