-
Notifications
You must be signed in to change notification settings - Fork 5
/
feeds_jsonpath_parser.module
93 lines (81 loc) · 3.19 KB
/
feeds_jsonpath_parser.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/**
* @file
* Parse a JSON document using JSONPath.
*/
/**
* Defines which commit to checkout from flow/jsonpath.
*/
define('FEEDS_JSONPATH_PARSER_LIBRARY_VERSION', '0.4.0');
/**
* Implements hook_autoload_info().
*/
function feeds_jsonpath_parser_autoload_info() {
$autoloads = array(
'FeedsJSONPathParser' => 'FeedsJSONPathParser.inc',
// Use proper namespace.
'Flow\JSONPath\JSONPath' => 'libraries/JSONPath/src/Flow/JSONPath/JSONPath.php',
'Flow\JSONPath\JSONPathException' => 'libraries/JSONPath/src/Flow/JSONPath/JSONPathException.php',
'Flow\JSONPath\JSONPathLexer' => 'libraries/JSONPath/src/Flow/JSONPath/JSONPathLexer.php',
'Flow\JSONPath\JSONPathToken' => 'libraries/JSONPath/src/Flow/JSONPath/JSONPathToken.php',
'Flow\JSONPath\AccessHelper' => 'libraries/JSONPath/src/Flow/JSONPath/AccessHelper.php',
'Flow\JSONPath\Filters\AbstractFilter' => 'libraries/JSONPath/src/Flow/JSONPath/Filters/AbstractFilter.php',
'Flow\JSONPath\Filters\IndexesFilter' => 'libraries/JSONPath/src/Flow/JSONPath/Filters/IndexesFilter.php',
'Flow\JSONPath\Filters\IndexFilter' => 'libraries/JSONPath/src/Flow/JSONPath/Filters/IndexFilter.php',
'Flow\JSONPath\Filters\QueryMatchFilter' => 'libraries/JSONPath/src/Flow/JSONPath/Filters/QueryMatchFilter.php',
'Flow\JSONPath\Filters\QueryResultFilter' => 'libraries/JSONPath/src/Flow/JSONPath/Filters/QueryResultFilter.php',
'Flow\JSONPath\Filters\RecursiveFilter' => 'libraries/JSONPath/src/Flow/JSONPath/Filters/RecursiveFilter.php',
'Flow\JSONPath\Filters\SliceFilter' => 'libraries/JSONPath/src/Flow/JSONPath/Filters/SliceFilter.php',
);
return $autoloads;
}
/**
* Implements hook_feeds_plugins().
*/
function feeds_jsonpath_parser_feeds_plugins() {
$info['FeedsJSONPathParser'] = array(
'name' => 'JSONPath parser',
'description' => 'Parse JSON files using JSONPath.',
'help' => 'More verbose description here. Will be displayed on processor selection menu.',
'module' => 'feeds_jsonpath_parser',
'handler' => array(
'module' => 'feeds_jsonpath_parser',
'parent' => 'FeedsParser',
'class' => 'FeedsJSONPathParser',
'file' => 'FeedsJSONPathParser.inc',
'path' => backdrop_get_path('module', 'feeds_jsonpath_parser'),
),
);
return $info;
}
/******************* Deprecated below this line ********************************/
/**
* Implements hook_libraries_info().
*
* Remains only for requirements check.
*
* @see feeds_jsonpath_parser.install
*/
function feeds_jsonpath_parser_libraries_info() {
$libraries = array();
$libraries['jsonpath'] = array(
'name' => 'JSONPath',
'vendor url' => 'https://github.com/FlowCommunications/JSONPath',
'download url' => 'https://github.com/FlowCommunications/JSONPath/archive/refs/tags/' . FEEDS_JSONPATH_PARSER_LIBRARY_VERSION . '.zip',
'version' => '0.4.0',
);
return $libraries;
}
/**
* Callback for xautoload.
*
* @see feeds_jsonpath_parser_libraries_info()
*/
function _feeds_jsonpath_parser_xautoload_callback($adapter) {
try {
$adapter->composerJson('composer.json');
}
catch (Exception $e) {
backdrop_set_message($e->getMessage(), 'error', FALSE);
}
}