Révision 7707c013
Ajouté par Assos Assos il y a presque 9 ans
drupal7/sites/all/modules/feeds_jsonpath_parser/feeds_jsonpath_parser.module | ||
---|---|---|
1 | 1 |
<?php |
2 |
// $Id: feeds_jsonpath_parser.module,v 1.1.4.1 2011/02/05 18:12:18 twistor Exp $ |
|
3 | 2 |
|
4 | 3 |
/** |
5 | 4 |
* Implements hook_feeds_plugins(). |
... | ... | |
28 | 27 |
function feeds_jsonpath_parser_enable() { |
29 | 28 |
cache_clear_all('plugins:feeds:plugins', 'cache'); |
30 | 29 |
} |
30 |
|
|
31 |
/** |
|
32 |
* Returns the path of the JSONPath library. |
|
33 |
* |
|
34 |
* @return string|bool |
|
35 |
* The relative path of the JSONPath directory, or false if not found. |
|
36 |
*/ |
|
37 |
function feeds_jsonpath_parser_library_path() { |
|
38 |
$libraries_path = module_exists('libraries') ? libraries_get_path('jsonpath') : FALSE; |
|
39 |
if ($libraries_path && is_dir($libraries_path)) { |
|
40 |
$path = $libraries_path; |
|
41 |
} |
|
42 |
elseif (is_dir(DRUPAL_ROOT . '/sites/all/libraries/jsonpath')) { |
|
43 |
$path = DRUPAL_ROOT . '/sites/all/libraries/jsonpath'; |
|
44 |
} |
|
45 |
// This is defined when simpletest downloads the library for us. |
|
46 |
elseif (variable_get('feeds_jsonpath_library_dir')) { |
|
47 |
$path = variable_get('feeds_jsonpath_library_dir'); |
|
48 |
} |
|
49 |
else { |
|
50 |
$search = glob(dirname(__FILE__) . '/jsonpath*.php'); |
|
51 |
return is_array($search) ? reset($search) : FALSE; |
|
52 |
} |
|
53 |
|
|
54 |
if (!isset($path)) { |
|
55 |
return FALSE; |
|
56 |
} |
|
57 |
|
|
58 |
// Newer forks of JSONPath are all modern and fancy with their autoloaders. |
|
59 |
if (is_file($path . '/vendor/autoload.php')) { |
|
60 |
return $path . '/vendor/autoload.php'; |
|
61 |
} |
|
62 |
// Old school. Look for multiple versions. |
|
63 |
foreach (glob($path . '/jsonpath*.php') as $file) { |
|
64 |
return $file; |
|
65 |
} |
|
66 |
|
|
67 |
return FALSE; |
|
68 |
} |
Formats disponibles : Unified diff
Update Feeds JSONPath Parser 7.x-1.0-beta2 -> 7.x-1.0