You are here

function _search_api_elasticsearch_elastica_autoload in Search API Elasticsearch 7

Autoloader for the Elastica classes.

3 string references to '_search_api_elasticsearch_elastica_autoload'
drush_download_elastica in modules/elastica/search_api_elasticsearch_elastica.drush.inc
Command to download the Elastica PHP Library.
search_api_elasticsearch_elastica_loaded in modules/elastica/search_api_elasticsearch_elastica.module
Check if the Elastica library is loaded.
search_api_elasticsearch_elastica_requirements in modules/elastica/search_api_elasticsearch_elastica.install
Implements hook_requirements().

File

modules/elastica/search_api_elasticsearch_elastica.module, line 97
Provides an elasticsearch-based service class for the Search API.

Code

function _search_api_elasticsearch_elastica_autoload($name) {
  static $lookup_cache = array();
  if (isset($lookup_cache[$name])) {
    return $lookup_cache[$name];
  }
  elseif (drupal_substr($name, 0, 8) == 'Elastica') {
    $path = _search_api_elasticsearch_elastica_path();
    if (file_exists($file_path = $path . '/' . str_replace('\\', '/', $name) . '.php')) {
      require_once $file_path;
      $lookup_cache[$name] = TRUE;
      return TRUE;
    }
  }
  $lookup_cache[$name] = FALSE;
  return FALSE;
}