You are here

function _yandex_metrics_reports_get_idna_library_path in Yandex.Metrics 8.3

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

Returns path of idna_convert class.

1 call to _yandex_metrics_reports_get_idna_library_path()
_yandex_metrics_reports_idna_decode in yandex_metrics_reports/yandex_metrics_reports.module
Decode ASCII 'xn--*' domain name to Unicode national domain name.

File

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

Code

function _yandex_metrics_reports_get_idna_library_path() {
  $file = 'idna_convert.class.php';
  $library = 'idna_convert';
  if (module_exists('libraries') && file_exists(libraries_get_path($library) . "/{$file}")) {
    return libraries_get_path($library) . "/{$file}";
  }
  else {
    $paths = array(
      drupal_get_path('module', 'yandex_metrics'),
      drupal_get_path('module', 'yandex_metrics') . "/libraries",
      drupal_get_path('module', 'yandex_metrics_reports'),
      drupal_get_path('module', 'yandex_metrics_reports') . "/libraries",
      'profiles/' . variable_get('install_profile', 'default') . '/libraries',
      'profiles/' . variable_get('install_profile', 'default') . '/libraries/' . $library,
      'sites/all/libraries',
      'sites/all/libraries/' . $library,
    );
    foreach ($paths as $library_path) {
      $path = $library_path . "/{$file}";
      if (file_exists($path)) {
        return $path;
      }
    }
  }
  return FALSE;
}