Skip to content

Commit a379c9b

Browse files
committed
phpHasManifest check in JSON output
1 parent 8ef36ce commit a379c9b

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/templates/forms/misc/json_card_reader.txp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
*
1313
* <txp:variable name="json-repo-XXX" /> (where XXX is either homepage, bitbucket, github, gitlab - variable stores URL of project at that repo)
1414
* <txp:variable name="json-beta-version" /> (latest semver of beta release)
15+
* <txp:variable name="json-beta-manifest" /> (does plugin beta release have a manifest.json file?)
1516
* <txp:variable name="json-beta-date" /> (date of latest PHP download beta release)
1617
* <txp:variable name="json-beta-php" /> (URL of latest PHP download beta release)
1718
* <txp:variable name="json-beta-txt" /> (URL of latest TXT download beta release)
1819
* <txp:variable name="json-stable-version" /> (latest semver of stable release)
20+
* <txp:variable name="json-stable-manifest" /> (does plugin beta release have a manifest.json file?)
1921
* <txp:variable name="json-stable-date" /> (date of latest PHP download stable release)
2022
* <txp:variable name="json-stable-php" /> (URL of latest PHP download stable release)
2123
* <txp:variable name="json-stable-txt" /> (URL of latest TXT download stable release)
@@ -48,6 +50,10 @@ if (is_readable($file)) {
4850
if (!empty($json->beta)) {
4951
$vars['beta-version'] = '<txp:variable name="json-beta-version">'.txpspecialchars($json->beta->version).'</txp:variable>';
5052

53+
if (!empty($json->beta->phpHasManifest)) {
54+
$vars['beta-manifest'] = '<txp:variable name="json-beta-manifest">'.txpspecialchars($json->beta->phpHasManifest).'</txp:variable>';
55+
}
56+
5157
if (!empty($json->beta->datePublished)) {
5258
$vars['beta-version-date'] = '<txp:variable name="json-beta-date">'.txpspecialchars($json->beta->datePublished).'</txp:variable>';
5359
}
@@ -64,6 +70,10 @@ if (is_readable($file)) {
6470
if (!empty($json->stable)) {
6571
$vars['stable-version'] = '<txp:variable name="json-stable-version">'.txpspecialchars($json->stable->version).'</txp:variable>';
6672

73+
if (!empty($json->stable->phpHasManifest)) {
74+
$vars['stable-manifest'] = '<txp:variable name="json-stable-manifest">'.txpspecialchars($json->stable->phpHasManifest).'</txp:variable>';
75+
}
76+
6777
if (!empty($json->stable->datePublished)) {
6878
$vars['stable-version-date'] = '<txp:variable name="json-stable-date">'.txpspecialchars($json->stable->datePublished).'</txp:variable>';
6979
}

src/templates/pages/plugins.txp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<txp:if_variable name="json-latest-is-beta">
1313
"beta": {
1414
"version": "<txp:variable name="json-beta-version" escape="json" />",
15+
<txp:if_variable name="json-beta-manifest">"phpHasManifest": 1,</txp:if_variable>
1516
<txp:if_custom_field name="max-txp-version-verified-beta">"verifiedMaxTxpCompatibility": "<txp:custom_field name="max-txp-version-verified-beta" escape="json" />",</txp:if_custom_field>
1617
<txp:if_variable name="json-beta-date">"datePublished": "<txp:variable name="json-beta-date" escape="json" />",</txp:if_variable>
1718
<txp:if_variable name="json-beta-txt">"endpointUrl": "<txp:variable name="json-beta-txt" escape="json" />"<txp:else />"endpointUrl": "<txp:variable name="json-beta-php" escape="json" />"</txp:if_variable>
@@ -20,6 +21,7 @@
2021
<txp:if_variable name="json-stable-version">
2122
"stable": {
2223
"version": "<txp:variable name="json-stable-version" escape="json" />",
24+
<txp:if_variable name="json-stable-manifest">"phpHasManifest": 1,</txp:if_variable>
2325
<txp:if_custom_field name="max-txp-version-verified">"verifiedMaxTxpCompatibility": "<txp:custom_field name="max-txp-version-verified" escape="json" />",</txp:if_custom_field>
2426
<txp:if_custom_field name="min-txp-version-verified">"verifiedMinTxpCompatibility": "<txp:custom_field name="min-txp-version-verified" escape="json" />",</txp:if_custom_field>
2527
<txp:if_variable name="json-stable-date">"datePublished": "<txp:variable name="json-stable-date" escape="json" />",</txp:if_variable>
@@ -28,6 +30,7 @@
2830
<txp:else />
2931
"beta": {
3032
"version": "<txp:variable name="json-beta-version" escape="json" />",
33+
<txp:if_variable name="json-beta-manifest">"phpHasManifest": 1,</txp:if_variable>
3134
<txp:if_custom_field name="max-txp-version-verified-beta">"verifiedMaxTxpCompatibility": "<txp:custom_field name="max-txp-version-verified-beta" escape="json" />",</txp:if_custom_field>
3235
<txp:if_custom_field name="min-txp-version-verified">"verifiedMinTxpCompatibility": "<txp:custom_field name="min-txp-version-verified" escape="json" />",</txp:if_custom_field>
3336
<txp:if_variable name="json-beta-date">"datePublished": "<txp:variable name="json-beta-date" escape="json" />",</txp:if_variable>
@@ -46,6 +49,12 @@ if (!empty($json2['legacy'])) {
4649
foreach ($txpBlock as $txpver => $endpointData) {
4750
$newJson['legacy'][$txpver]['version'] = txpspecialchars($endpointData['version']);
4851

52+
if (!empty($endpointData['phpHasManifest'])) {
53+
if ($endpointData['phpHasManifest'] = 1) {
54+
$newJson['legacy'][$txpver]['phpHasManifest'] = txpspecialchars($endpointData['phpHasManifest']);
55+
}
56+
}
57+
4958
if (!empty($endpointData['datePublished'])) {
5059
$newJson['legacy'][$txpver]['datePublished'] = txpspecialchars($endpointData['datePublished']);
5160
}

0 commit comments

Comments
 (0)