-
Notifications
You must be signed in to change notification settings - Fork 92
Plugin Development
Starting with GamePanelX V3 there is now a plugins system. It is designed very similar to WordPress, so if you've made a WordPress plugin before, you should feel right at home.
There are plugin hooks all over gamepanelx, in specific places, so that users can make their plugin do it's thing in the right spot.
See all the available Action Hooks: List of all plugin hooks
Plugins go in the /plugins folder. They should be uploaded in the proper structure, which is: /plugins/my_plugin123/my_plugin123.php. "my_plugin123" is just an example, it can be anything, "coolplugin", or "ryansplugin". Don't use spaces!
PHP "/plugins/my_plugin123/my_plugin123.php" example:
function cool_home_hello() { echo "<b>First plugin!</b> This is some text that can show up on the home page, above the icons."; } // We set the action "home_top" to run our function "cool_home_hello". This makes sure the function runs in the right place. $this->set_action('home_top','cool_home_hello'); ?>
Plugin Icon: "/plugins/my_plugin123/icon.png" - Save this as a 64px X 64px PNG icon. If saved here, your icon will show up properly in the plugins list.
Plugin Information: "/plugins/my_plugin123/plugin.json.txt" - You can provide a nice name and description for your plugin by creating this JSON file in your plugin directory. The file should be a well-formatted JSON file, with structure like this:
{ "name":"My Plugin 123", "intname":"my_plugin123", "description":"This is my first plugin that will display some text on the home page." }
If your plugin needs to access $_POST or $_GET data, this is stripped out via the ajax.php page. You must use $GPXIN as a substitute for $_POST and $_GET. If the URL contains "?somevar=2", you would use:
$somevar = $GPXIN['somevar'];
Regardless if you're expecting POST or GET, you still use $GPXIN as it handles both. $GPXIN automatically escapes data for SQL injection etc, so you do not need to use mysql_real_escape_string() or addslashes().