You are here

public static function FeedsExJsonUtility::jsonPathLibraryPath in Feeds extensible parsers 7

Returns the path of the JSONPath library.

Return value

string|false|array The root-relative path to the JSONPath include(s), or false on failure.

1 call to FeedsExJsonUtility::jsonPathLibraryPath()
FeedsExJsonUtility::loadJsonPathUsingPath in src/Json/Utility.php
Tries to load the jsonpath library by looking for a path.

File

src/Json/Utility.php, line 119
Contains FeedsExJsonUtility.

Class

FeedsExJsonUtility
Various helpers for handling JSON.

Code

public static function jsonPathLibraryPath() {
  $libraries_path = module_exists('libraries') ? libraries_get_path('jsonpath') : FALSE;
  if ($libraries_path && is_dir($libraries_path)) {
    $path = $libraries_path;
  }
  elseif (is_dir(DRUPAL_ROOT . '/sites/all/libraries/jsonpath')) {
    $path = 'sites/all/libraries/jsonpath';
  }
  if (!isset($path)) {
    if (is_file(DRUPAL_ROOT . '/vendor/autoload.php')) {

      // This can exist when running tests on drupal.org.
      return 'vendor/autoload.php';
    }
    return FALSE;
  }

  // Check if there is an autoload file. There is one when the library is
  // installed with Composer in /sites/all/libraries/jsonpath.
  if (is_file($path . '/vendor/autoload.php')) {
    return $path . '/vendor/autoload.php';
  }
  return FALSE;
}