function feeds_jsonpath_parser_load_library in Feeds JSONPath Parser 7
Loads the jsonpath library.
2 calls to feeds_jsonpath_parser_load_library()
- FeedsJSONPathParser::loadLibrary in ./
FeedsJSONPathParser.inc - Loads the necessary library.
- feeds_jsonpath_parser_requirements in ./
feeds_jsonpath_parser.install - Implements hook_requirements().
File
- ./
feeds_jsonpath_parser.module, line 69
Code
function feeds_jsonpath_parser_load_library() {
// Check first to see if the class is loaded some other way like composer.
if (!class_exists('\\Flow\\JSONPath\\JSONPath', TRUE)) {
// If not, then we should have libraries installed.
if (!module_exists('libraries')) {
return FALSE;
}
$library = libraries_load('jsonpath');
if ($library['loaded'] === FALSE) {
return FALSE;
}
// We need to make sure that what is said to be the library here is actually
// the one we wanted because they may have left the old one here.
if (!class_exists('\\Flow\\JSONPath\\JSONPath', TRUE)) {
return FALSE;
}
}
return TRUE;
}