Plugin Info

From Osclass
Jump to: navigation, search

Each plugin needs to include a presentation card. This info must be added at the top of the index.php file of your plugin.

/*

Plugin Name: My Plugin
Plugin URI: myPlugin.com
Description: This is my plugin.
Version: 1.0
Author: me
Author URI: me.com
Short Name: myPlugin
Plugin update URI: my-plugin-update
*/

To retrieve the data you need, first tell php which file to look in.

$pluginInfo = osc_plugin_get_info('myPlugin/index.php');

Once you tell php which file to look for, it will load data into an array which is stored under the variable $pluginInfo.

Now we can echo our data like this:

echo $pluginInfo['plugin_name'];
echo $pluginInfo['plugin_uri'];
echo $pluginInfo['description'];
echo $pluginInfo['version'];
echo $pluginInfo['author'];
echo $pluginInfo['author_uri'];
echo $pluginInfo['short_name'];
echo $pluginInfo['filename'];


Below are the results of the above code.

My Plugin
myPlugin.com
This is my plugin.
1.0
me
me.com
myPlugin
myPlugin/index.php

This is all it takes to retrieve the plugin info and use it within your Osclass plugin.