]>
Commit | Line | Data |
---|---|---|
bc3b1ecc | 1 | <?php |
c7c81523 VP |
2 | /* |
3 | --======-- Example Plugin --=======-- | |
bc3b1ecc | 4 | |
c7c81523 VP |
5 | Below are the credentials needed. |
6 | You must specify them in this format. | |
7 | The only things that are not mandatory | |
8 | are icons and screenshots. the rest | |
9 | are mandatory or your plugin will not | |
10 | be accepted. | |
11 | ||
12 | */ | |
14e92008 | 13 | /** |
848473ee VP |
14 | @title Example Plugin |
15 | @author Valware | |
c7d77d67 | 16 | @description This plugin adds an example page and does nothing special by itself. Have a nice day! |
25b3e860 | 17 | @contact valerie@valware.co.uk |
848473ee | 18 | @version 1.0 |
25b3e860 VP |
19 | @tested 0.9 |
20 | @minver 0.9 | |
21 | @maxver * | |
22 | @license GPLv3 | |
d9dc2480 | 23 | @icon https://github.com/unrealircd/unrealircd-webpanel-plugins/blob/main/example_plugin/screenshots/example_icon.png?raw=true |
492d41aa | 24 | @screenshot https://github.com/unrealircd/unrealircd-webpanel-plugins/blob/main/example_plugin/screenshots/example_plugin.jpg?raw=true |
b42d9161 | 25 | @screenshot https://github.com/unrealircd/unrealircd-webpanel-plugins/blob/main/example_plugin/screenshots/example_plugin2.jpg?raw=true |
14e92008 VP |
26 | */ |
27 | ||
bc3b1ecc VP |
28 | class example_plugin |
29 | { | |
c7c81523 VP |
30 | /* You must specify these here for internal use |
31 | * All of these are mandatory or your plugin will not work. | |
32 | */ | |
33 | public $name = "Example plugin"; // Name of your plugin | |
34 | public $author = "Valware"; // Name or handle of your lovely self | |
35 | public $version = "1.0"; // Version of this plugin | |
36 | public $description = "An example plugin to show how to make stuff"; // Description of your beautiful plugin | |
37 | public $email = "v.a.pond@outlook.com"; // An email people can contact you with in case of problems | |
bc3b1ecc | 38 | |
c7c81523 VP |
39 | /** This is run on plugin load. You can add hooks and initialize whatever databases |
40 | * that you think you might need. | |
41 | */ | |
bc3b1ecc VP |
42 | function __construct() |
43 | { | |
c7c81523 VP |
44 | /**The hook for the navigation bar. |
45 | * The first argument is the HOOKTYPE we're using. In this case | |
46 | * we're using NAVBAR to add our page to the navigation bar. | |
47 | * For a full list of hooks, see this page: | |
48 | * https://github.com/unrealircd/unrealircd-webpanel/blob/main/Classes/class-hook.php | |
49 | * | |
50 | * The second argument references the function you want to include | |
51 | * in your hooked function. In this example we are referencing a | |
52 | * method (function) in this class (example_plugin) | |
53 | */ | |
bc3b1ecc VP |
54 | Hook::func(HOOKTYPE_NAVBAR, 'example_plugin::add_navbar'); |
55 | } | |
56 | ||
c7c81523 VP |
57 | /** This is the method (function) that we have hooked. |
58 | * Now we can do things. Make sure to check the relevant hooks | |
59 | * for the right variables to use. | |
60 | * We use variable reference (&) on this hook | |
61 | */ | |
bc3b1ecc VP |
62 | public static function add_navbar(&$pages) |
63 | { | |
64 | $page_name = "Example"; | |
65 | $page_link = "plugins/example_plugin/example.php"; | |
66 | $pages[$page_name] = $page_link; | |
67 | } | |
68 | } | |
69 |