@@ -28,6 +28,15 @@ function nodeinfo_init() {
2828}
2929add_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}
3847add_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 */
0 commit comments