-
Notifications
You must be signed in to change notification settings - Fork 3
/
plugincore.php
48 lines (43 loc) · 1.54 KB
/
plugincore.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/* Types of plugins are "DOWNLOAD" and "FOOTER" */
function runPlugin($type, $options) {
/* Check if a valid type was passed in */
// use the pluginconfig.php
require 'pluginconfig.php';
if($type == "DOWNLOAD") {
// Download plugin
if(DOWNLOAD != false) {
// call PluginRun() method
require "plugins/" . DOWNLOAD . "/" . str_replace(".plugin", "", DOWNLOAD) . "/plugin.php";
// Provide the plugin with the app's name, link, and summary
return PluginRun($options);
} else {
return false;
}
} else if ($type == "FOOTER") {
// Footer plugin
if(FOOTER != false) {
// Run the plugin
include "plugins/" . FOOTER . "/" . str_replace(".plugin", "", FOOTER) . "/plugin.php";
return true;
} else {
return false;
}
} else {
// Return false so the calling page will know to run the default content
return false;
}
}
/* DOCUMENTATION
- How to make a download plugin:
- Create a blank PHP file inside the plugins/ folder
- Go to pluginconfig.php and define DOWNLOAD to the name of the PHP file you just made
- Add a function to your PHP file called PluginRun($arg)
- This is the entry point for your plugin. When it loads, this method will be called
- $arg is the link to the download, so you can incorportate that into your script
- How to make a footer plugin
- Create a blank PHP file inside the plugins/ folder
- Go to pluginconfig.php and define FOOTER to the name of the PHP file you just made
- Add your plugin code to the file you just made
*/
?>