[wp-hackers] Improving Plugin (and Theme) metadata
Knut-Olav Hoven
hovenko at linpro.no
Sat Feb 9 12:09:25 GMT 2008
On Thursday 24 January 2008 23:17:04 Peter Westwood wrote:
> Hi All.
>
> Firstly apologies for starting a new thread but the old one has grown a
> bit and I want to try and refocus the discussion a bit.
Looks like this thread has also grown "a bit" too ;)
>
>[...]
>
> Example metadata.php file:
>
> <?php
>
> load_plugin_textdomain();
>
> register_plugin( plugin_filename.php,
> ~ __('Description'),
> ~ __('Plugin Name'),
> ~ 'http://example.com',
> ~ 'Joe Bloggs',
> ~ 'http://joe.bloggs.name'),);
>
> //The End
> ?>
Something that is not PHP code should not be in PHP code. It should be in a
configuration file.
I use YAML for all my configuration, it's easy to read and write and there are
good parsers for it available.
A proposal:
---
name: My Plugin
description: >
My Plugin is a very nice
plugin for Wordpress.
author:
name: Knut-Olav Hoven
url: http://www.hoven.ws/
.locales:
nb:
name: Mitt Innstikk
description: >
Mitt Innstikk er et fint
tillegg til WordPress.
# END
When parsed using SPYC we get the following data structure:
Array
(
[0] => --
[name] => My Plugin
[description] => Plugin is a very nice plugin for Wordpress.
[author] => Array
(
[name] => Knut-Olav Hoven
[url] => http://www.hoven.ws/
)
[.locales] => Array
(
[nb] => Array
(
[name] => Mitt Innstikk
[description] => Mitt Innstikk er et fint tillegg til
WordPress.
)
)
)
This provides default data, with posibility to override it with data from the
locale of choice.
Other data that can go into this file is:
- version numbers
- release date
- changelog
- plugin url
- compatible with (wordpress versions)
--
Knut-Olav Hoven
Systemutvikler mob: +47 986 71 700
Linpro AS http://www.linpro.no/
More information about the wp-hackers
mailing list