You are here

function _yandex_metrics_get_idna_library_path in Yandex.Metrics 7

Same name and namespace in other branches
  1. 6 yandex_metrics.module \_yandex_metrics_get_idna_library_path()

Returns path of idna_convert class.

Return value

bool|string

1 call to _yandex_metrics_get_idna_library_path()
_yandex_metrics_idna_decode in ./yandex_metrics.module
Decode ASCII 'xn--*' domain name to Unicode national domain name if it is possible. Used idna_convert class created by Matthias Sommerfeld <mso@phlylabs.de> and licensed under LGPL.

File

./yandex_metrics.module, line 1271
The main code of Yandex.Metrics module.

Code

function _yandex_metrics_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",
      '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;
}