|
11 | 11 | * Possible variables: |
12 | 12 | * |
13 | 13 | * <txp:variable name="json-repo-XXX" /> (where XXX is either homepage, bitbucket, github, gitlab - variable stores URL of project at that repo) |
| 14 | + * <txp:variable name="json-require-plugin" /> (name of a plugin this plugin requires to be installed) |
| 15 | + * <txp:variable name="json-require-match" /> (version match text of plugin this plugin requires to be installed) |
| 16 | + * <txp:variable name="json-require-version" /> (version a plugin this plugin requires to be installed) |
14 | 17 | * <txp:variable name="json-beta-version" /> (latest semver of beta release) |
15 | 18 | * <txp:variable name="json-beta-manifest" /> (does plugin beta release have a manifest.json file?) |
16 | 19 | * <txp:variable name="json-beta-date" /> (date of latest PHP download beta release) |
@@ -46,6 +49,39 @@ if (is_readable($file)) { |
46 | 49 | } |
47 | 50 | } |
48 | 51 |
|
| 52 | + if (!empty($json->require)) { |
| 53 | + foreach ($json->require as $rplug => $rver) { |
| 54 | + $vars['require-plug-name'] = '<txp:variable name="json-require-plugin">'.txpspecialchars($rplug).'</txp:variable>'; |
| 55 | + |
| 56 | + preg_match('/([\<\=\>]+)?([\d.]+)/', $rver, $matches); |
| 57 | + $matchType = 'equal'; |
| 58 | + |
| 59 | + switch ($matches[1]) { |
| 60 | + case '>': |
| 61 | + $matchType = 'greater than'; |
| 62 | + break; |
| 63 | + case '>=': |
| 64 | + $matchType = 'at least'; |
| 65 | + break; |
| 66 | + case '<': |
| 67 | + $matchType = 'less than'; |
| 68 | + break; |
| 69 | + case '<=': |
| 70 | + $matchType = 'no greater than'; |
| 71 | + break; |
| 72 | + case '=': |
| 73 | + default: |
| 74 | + $matchType = 'equal'; |
| 75 | + break; |
| 76 | + } |
| 77 | + |
| 78 | + $plain_ver = $matches[2]; |
| 79 | + |
| 80 | + $vars['require-plug-match'] = '<txp:variable name="json-require-match">'.txpspecialchars($matchType).'</txp:variable>'; |
| 81 | + $vars['require-plug-version'] = '<txp:variable name="json-require-version">'.txpspecialchars($plain_ver).'</txp:variable>'; |
| 82 | + } |
| 83 | + } |
| 84 | + |
49 | 85 | if (!empty($json->beta)) { |
50 | 86 | $vars['beta-version'] = '<txp:variable name="json-beta-version">'.txpspecialchars($json->beta->version).'</txp:variable>'; |
51 | 87 |
|
|
0 commit comments