Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
ezpLanguageSwitcher Class Reference
Inheritance diagram for ezpLanguageSwitcher:

## Public Member Functions
| __construct ( $params=null)
| destinationUrl ()
| setDestinationSiteAccess ( $saName)
| process ()

## Static Public Member Functions
static | setupTranslationSAList ( $url=null)

## Protected Member Functions
| getSiteAccessIni ()
| isUrlPointingToModule ( $url)
| isLocaleAvailableAsFallback ()

## Static Protected Member Functions
static | addPathPrefixIfNeeded ( $url)
static | removePathPrefixIfNeeded (eZINI $saIni, &$url)

## Protected Attributes
| $origUrl
| $userParamString
| $queryString
| $destinationSiteAccess
| $destinationLocale
| $baseDestinationUrl
| $destinationSiteAccessIni

## 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.

Definition at line 18 of file ezplanguageswitcher.php.

## Constructor & Destructor Documentation

## ◆ __construct()

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.

Definition at line 31 of file ezplanguageswitcher.php.

## Member Function Documentation

## ◆ addPathPrefixIfNeeded()

static ezpLanguageSwitcher::addPathPrefixIfNeeded | ( |  | $url | ) |
| static protected

Prepend PathPrefix from the current SA to url, if applicable

Parameters

  string | $url |

Returns
  string The url with pathprefix prepended

Definition at line 116 of file ezplanguageswitcher.php.

References $url.

Referenced by destinationUrl().

## ◆ destinationUrl()

ezpLanguageSwitcher::destinationUrl | ( |  | ) |

Returns URL alias for the specified $locale

Returns
  void

Implements ezpLanguageSwitcherCapable.

Definition at line 164 of file ezplanguageswitcher.php.

References $ini, $origUrl, $queryString, $userParamString, addPathPrefixIfNeeded(), eZContentLanguage\clearPrioritizedLanguages(), getSiteAccessIni(), isUrlPointingToModule(), removePathPrefixIfNeeded(), eZContentLanguage\setPrioritizedLanguages(), and eZSiteAccess\TYPE_URI.

## ◆ getSiteAccessIni()

ezpLanguageSwitcher::getSiteAccessIni | ( |  | ) |
| protected

Get instance siteaccess specific site.ini

Returns
  void

Definition at line 57 of file ezplanguageswitcher.php.

References $destinationSiteAccessIni, and eZSiteAccess\getIni().

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

## ◆ isLocaleAvailableAsFallback()

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

Definition at line 100 of file ezplanguageswitcher.php.

References getSiteAccessIni().

## ◆ isUrlPointingToModule()

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

Definition at line 75 of file ezplanguageswitcher.php.

References $url.

Referenced by destinationUrl().

## ◆ process()

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.

Definition at line 268 of file ezplanguageswitcher.php.

References $indexFile, getSiteAccessIni(), eZSys\indexFile(), eZSys\serverProtocol(), eZURI\transformURI(), and eZSiteAccess\TYPE_URI.

## ◆ removePathPrefixIfNeeded()

static ezpLanguageSwitcher::removePathPrefixIfNeeded | ( | eZINI | $saIni,
|  | & | $url
| ) |  |
| static protected

Remove PathPrefix from url, if applicable (present in siteaccess and matched in url)

Parameters

  eZINI | $saIni | eZINI instance of site.ini for the siteaccess to check
  string | $url |

Returns
  bool true if no PathPrefix exists, or removed from url. false if not removed.

Definition at line 138 of file ezplanguageswitcher.php.

References $url.

Referenced by destinationUrl().

## ◆ setDestinationSiteAccess()

ezpLanguageSwitcher::setDestinationSiteAccess | ( |  | $saName | ) |

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

Parameters

  string | $saName |

Returns
  void

Implements ezpLanguageSwitcherCapable.

Definition at line 255 of file ezplanguageswitcher.php.

## ◆ setupTranslationSAList()

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.

Definition at line 302 of file ezplanguageswitcher.php.

References $ini, $ret, $url, and eZSiteAccess\getIni().

## Member Data Documentation

## ◆ $baseDestinationUrl

ezpLanguageSwitcher::$baseDestinationUrl
| protected

Definition at line 27 of file ezplanguageswitcher.php.

## ◆ $destinationLocale

ezpLanguageSwitcher::$destinationLocale
| protected

Definition at line 25 of file ezplanguageswitcher.php.

## ◆ $destinationSiteAccess

ezpLanguageSwitcher::$destinationSiteAccess
| protected

Definition at line 24 of file ezplanguageswitcher.php.

## ◆ $destinationSiteAccessIni

ezpLanguageSwitcher::$destinationSiteAccessIni
| protected

Definition at line 29 of file ezplanguageswitcher.php.

Referenced by getSiteAccessIni().

## ◆ $origUrl

ezpLanguageSwitcher::$origUrl
| protected

Definition at line 20 of file ezplanguageswitcher.php.

Referenced by destinationUrl().

## ◆ $queryString

ezpLanguageSwitcher::$queryString
| protected

Definition at line 22 of file ezplanguageswitcher.php.

Referenced by destinationUrl().

## ◆ $userParamString

ezpLanguageSwitcher::$userParamString
| protected

Definition at line 21 of file ezplanguageswitcher.php.

Referenced by destinationUrl().

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

- ezplanguageswitcher.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.