eZPublishCommunityProject(LegacyStack)  2013.5
ezpLanguageSwitcher Class Reference

Utility class for transforming URLs between siteaccesses. More...

+ Inheritance diagram for ezpLanguageSwitcher:
+ Collaboration diagram for ezpLanguageSwitcher:

Public Member Functions

 __construct ($params=null)
 Constructs a ezpLanguageSwitcherCapable object. More...
 
 destinationUrl ()
 Returns URL alias for the specified $locale More...
 
 process ()
 This is a hook which is called by the language switcher module on implementation classes. More...
 
 setDestinationSiteAccess ($saName)
 Sets the siteaccess name, $saName, we want to redirect to. More...
 

Static Public Member Functions

static setupTranslationSAList ($url=null)
 Creates an array of corresponding language switcher links and logical names. More...
 

Protected Member Functions

 getSiteAccessIni ()
 Get instance siteaccess specific site.ini. More...
 
 isLocaleAvailableAsFallback ()
 Checks if the current content object locale is available in destination siteaccess. More...
 
 isUrlPointingToModule ($url)
 Checks if the given $url points to a module. More...
 

Protected Attributes

 $baseDestinationUrl
 
 $destinationLocale
 
 $destinationSiteAccess
 
 $destinationSiteAccessIni
 
 $origUrl
 
 $queryString
 
 $userParamString
 

Detailed Description

Utility class for transforming URLs between siteaccesses.

This class will generate URLs for various siteaccess, and translate URL-aliases into other languages as necessary.

Constructor & Destructor Documentation

ezpLanguageSwitcher::__construct (   $params = null)

Constructs a ezpLanguageSwitcherCapable object.

The $params array is the module-params array returned in the switchlanguage/to view. In addition, the value in $params['QueryString'] might also be taken into account (if present) to keep the query string while redirecting to another language. This is used to construct the destination URL.

Parameters
array$params
Returns
ezpLanguageSwitcherCapable

Implements ezpLanguageSwitcherCapable.

Member Function Documentation

ezpLanguageSwitcher::destinationUrl ( )

Returns URL alias for the specified $locale

Parameters
string$url
string$locale
Returns
void

Implements ezpLanguageSwitcherCapable.

ezpLanguageSwitcher::getSiteAccessIni ( )
protected

Get instance siteaccess specific site.ini.

Parameters
string$sa
Returns
void

Referenced by destinationUrl(), isLocaleAvailableAsFallback(), and process().

ezpLanguageSwitcher::isLocaleAvailableAsFallback ( )
protected

Checks if the current content object locale is available in destination siteaccess.

This is used to check whether we should pass on the original URL to the destination translation siteaccess, when no translation of an object exists in the destination locale.

If the current content object locale exists as a fallback in the destination siteaccess, the original URL should be available there as well.

Returns
bool

Referenced by destinationUrl().

ezpLanguageSwitcher::isUrlPointingToModule (   $url)
protected

Checks if the given $url points to a module.

We use this method to check whether we should pass on the original URL to the destination translation siteaccess.

Parameters
string$url
Returns
bool

Referenced by destinationUrl().

ezpLanguageSwitcher::process ( )

This is a hook which is called by the language switcher module on implementation classes.

In this implementation it is doing initialisation as an example.

Returns
void

Implements ezpLanguageSwitcherCapable.

ezpLanguageSwitcher::setDestinationSiteAccess (   $saName)

Sets the siteaccess name, $saName, we want to redirect to.

Parameters
string$saName
Returns
void

Implements ezpLanguageSwitcherCapable.

static ezpLanguageSwitcher::setupTranslationSAList (   $url = null)
static

Creates an array of corresponding language switcher links and logical names.

This mapping is set up in site.ini.[RegionalSettings].TranslationSA. The purpose of this method is to assist creation of language switcher links into the available translation siteaccesses on the system.

This is used by the language_switcher template operator.

Parameters
string$url
Returns
void

Implements ezpLanguageSwitcherCapable.

Member Data Documentation

ezpLanguageSwitcher::$baseDestinationUrl
protected
ezpLanguageSwitcher::$destinationLocale
protected
ezpLanguageSwitcher::$destinationSiteAccess
protected

Referenced by destinationUrl().

ezpLanguageSwitcher::$destinationSiteAccessIni
protected

Referenced by getSiteAccessIni().

ezpLanguageSwitcher::$origUrl
protected

Referenced by destinationUrl().

ezpLanguageSwitcher::$queryString
protected

Referenced by destinationUrl().

ezpLanguageSwitcher::$userParamString
protected

Referenced by destinationUrl().


The documentation for this class was generated from the following file: