Skip to content

Commit 7817de4

Browse files
committed
Add generator object to metadata to link to plugin repository
1 parent e56aa13 commit 7817de4

6 files changed

Lines changed: 52 additions & 7 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
**Tags:** nodeinfo, fediverse, ostatus, diaspora, activitypub
66
**Requires at least:** 4.9
77
**Tested up to:** 6.1
8-
**Stable tag:** 1.0.8
8+
**Stable tag:** 1.0.8
99
**Requires PHP:** 5.6
1010
**License:** MIT
1111
**License URI:** https://opensource.org/licenses/MIT
@@ -26,7 +26,8 @@ Project and support maintained on github at [pfefferle/wordpress-nodeinfo](https
2626

2727
### 1.0.8 ###
2828

29-
* Fix link to WordPress repository.
29+
* fix link to WordPress repository (props @jeherve)
30+
* add generator object to metadata to link to plugin repository
3031

3132
### 1.0.7 ###
3233

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ version: '2'
22
services:
33
db:
44
image: mysql:5.7
5+
platform: linux/x86_64
56
restart: always
67
environment:
78
MYSQL_ROOT_PASSWORD: wordpress
@@ -22,5 +23,6 @@ services:
2223
restart: always
2324
environment:
2425
WORDPRESS_DB_HOST: db:3306
26+
WORDPRESS_DB_USER: wordpress
2527
WORDPRESS_DB_PASSWORD: wordpress
2628
WORDPRESS_DEBUG: 1

includes/class-nodeinfo.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ public function generate_metadata() {
9595

9696
$metadata['email'] = get_option( 'admin_email' );
9797

98+
$metadata['generator'] = array(
99+
'name' => 'NodeInfo WordPress-Plugin',
100+
'version' => nodeinfo_version(),
101+
'repository' => 'https://github.com/pfefferle/wordpress-nodeinfo/'
102+
);
103+
98104
$this->metadata = apply_filters( 'nodeinfo_data_metadata', $metadata, $this->version );
99105
}
100106

languages/nodeinfo.pot

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# Copyright (C) 2022 Matthias Pfefferle
1+
# Copyright (C) 2023 Matthias Pfefferle
22
# This file is distributed under the MIT.
33
msgid ""
44
msgstr ""
5-
"Project-Id-Version: NodeInfo 1.0.7\n"
5+
"Project-Id-Version: NodeInfo 1.0.8\n"
66
"Report-Msgid-Bugs-To: "
77
"https://wordpress.org/support/plugin/wordpress-nodeinfo\n"
8-
"POT-Creation-Date: 2022-11-18 09:45:26+00:00\n"
8+
"POT-Creation-Date: 2023-01-06 17:15:27+00:00\n"
99
"MIME-Version: 1.0\n"
1010
"Content-Type: text/plain; charset=utf-8\n"
1111
"Content-Transfer-Encoding: 8bit\n"
12-
"PO-Revision-Date: 2022-MO-DA HO:MI+ZONE\n"
12+
"PO-Revision-Date: 2023-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"
1515
"X-Generator: grunt-wp-i18n 1.0.3\n"

nodeinfo.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ function nodeinfo_init() {
2828
}
2929
add_action( 'plugins_loaded', 'nodeinfo_init' );
3030

31+
/**
32+
* Plugin Version Number.
33+
*/
34+
function nodeinfo_version() {
35+
$meta = nodeinfo_get_plugin_meta( array( 'Version' => 'Version' ) );
36+
37+
return $meta['Version'];
38+
}
39+
3140
/**
3241
* Add rewrite rules
3342
*/
@@ -37,6 +46,32 @@ function nodeinfo_add_rewrite_rules() {
3746
}
3847
add_action( 'init', 'nodeinfo_add_rewrite_rules', 1 );
3948

49+
/**
50+
* `get_plugin_data` wrapper
51+
*
52+
* @return array the plugin metadata array
53+
*/
54+
function nodeinfo_get_plugin_meta( $default_headers = array() ) {
55+
if ( ! $default_headers ) {
56+
$default_headers = array(
57+
'Name' => 'Plugin Name',
58+
'PluginURI' => 'Plugin URI',
59+
'Version' => 'Version',
60+
'Description' => 'Description',
61+
'Author' => 'Author',
62+
'AuthorURI' => 'Author URI',
63+
'TextDomain' => 'Text Domain',
64+
'DomainPath' => 'Domain Path',
65+
'Network' => 'Network',
66+
'RequiresWP' => 'Requires at least',
67+
'RequiresPHP' => 'Requires PHP',
68+
'UpdateURI' => 'Update URI',
69+
);
70+
}
71+
72+
return get_file_data( __FILE__, $default_headers, 'plugin' );
73+
}
74+
4075
/**
4176
* Flush rewrite rules;
4277
*/

readme.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Project and support maintained on github at [pfefferle/wordpress-nodeinfo](https
2626

2727
= 1.0.8 =
2828

29-
* Fix link to WordPress repository.
29+
* fix link to WordPress repository (props @jeherve)
30+
* add generator object to metadata to link to plugin repository
3031

3132
= 1.0.7 =
3233

0 commit comments

Comments
 (0)