You are here

function _yandex_metrics_reports_idna_decode in Yandex.Metrics 8.3

Same name and namespace in other branches
  1. 8.2 yandex_metrics_reports/yandex_metrics_reports.module \_yandex_metrics_reports_idna_decode()
  2. 6.2 yandex_metrics_reports/yandex_metrics_reports.module \_yandex_metrics_reports_idna_decode()
  3. 7.3 yandex_metrics_reports/yandex_metrics_reports.module \_yandex_metrics_reports_idna_decode()
  4. 7.2 yandex_metrics_reports/yandex_metrics_reports.module \_yandex_metrics_reports_idna_decode()

Decode ASCII 'xn--*' domain name to Unicode national domain name.

Used idna_convert module if it's installed or idna_convert class created by Matthias Sommerfeld <mso@phlylabs.de> and licensed under LGPL.

See also

http://www.phpclasses.org/package/1509-PHP-Convert-from-and-to-IDNA-Puny...

1 call to _yandex_metrics_reports_idna_decode()
yandex_metrics_reports_get_counter_for_current_site in yandex_metrics_reports/yandex_metrics_reports.module
Gets counter ID for the current site from Yandex.Metrica.

File

yandex_metrics_reports/yandex_metrics_reports.module, line 501
The main code of Yandex.Metrics Reports module.

Code

function _yandex_metrics_reports_idna_decode($domain) {

  // Use idna_convert module function if it's available.
  if (function_exists('idna_convert_decode')) {
    return idna_convert_decode($domain);
  }
  $idna_library_path = _yandex_metrics_reports_get_idna_library_path();

  // Library has not been found.
  if ($idna_library_path == FALSE) {
    return $domain;
  }
  require_once $idna_library_path;
  $idn = new idna_convert();
  return $idn
    ->decode($domain);
}