| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * SquirrelMail Demo Plugin |
| 5 | * @copyright 2006-2010 The SquirrelMail Project Team |
| 6 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
| 7 | * @version $Id$ |
| 8 | * @package plugins |
| 9 | * @subpackage demo |
| 10 | */ |
| 11 | |
| 12 | |
| 13 | |
| 14 | /** |
| 15 | * Register this plugin with SquirrelMail |
| 16 | * |
| 17 | * @return void |
| 18 | * |
| 19 | */ |
| 20 | function squirrelmail_plugin_init_demo() |
| 21 | { |
| 22 | //FIXME: put *ALL* SM hooks in here... which includes template_construct hooks for any templates that have plugin output sections in them... and put them all in the right order |
| 23 | //FIXME: many hooks have examples in the original demo plugin in trunk/plugins/demo |
| 24 | |
| 25 | global $squirrelmail_plugin_hooks; |
| 26 | |
| 27 | //FIXME: this hook not yet implemented below |
| 28 | $squirrelmail_plugin_hooks['login_cookie']['demo'] |
| 29 | = 'demo_login_cookie'; |
| 30 | |
| 31 | //FIXME: not all of the above hooks are yet implemented below |
| 32 | $squirrelmail_plugin_hooks['login_bottom']['demo'] |
| 33 | = 'demo_login_bottom'; |
| 34 | |
| 35 | //FIXME: this template may have more plugin output sections that are not yet implemented below |
| 36 | $squirrelmail_plugin_hooks['template_construct_page_header.tpl']['demo'] |
| 37 | = 'demo_page_header_template'; |
| 38 | |
| 39 | $squirrelmail_plugin_hooks['optpage_register_block']['demo'] |
| 40 | = 'demo_option_link'; |
| 41 | |
| 42 | $squirrelmail_plugin_hooks['configtest']['demo'] |
| 43 | = 'demo_check_configuration'; |
| 44 | } |
| 45 | |
| 46 | |
| 47 | |
| 48 | /** |
| 49 | * Returns info about this plugin |
| 50 | * |
| 51 | * @return array An array of plugin information. |
| 52 | * |
| 53 | */ |
| 54 | function demo_info() |
| 55 | { |
| 56 | |
| 57 | return array( |
| 58 | 'english_name' => 'Demo', |
| 59 | 'version' => 'CORE', |
| 60 | 'summary' => 'This plugin provides test/sample code for many of the hook points in the SquirrelMail core.', |
| 61 | 'details' => 'This plugin provides test/sample code for many of the hook points in the SquirrelMail core.', |
| 62 | 'requires_configuration' => 0, |
| 63 | 'requires_source_patch' => 0, |
| 64 | ); |
| 65 | |
| 66 | } |
| 67 | |
| 68 | |
| 69 | |
| 70 | /** |
| 71 | * Returns version info about this plugin |
| 72 | * |
| 73 | */ |
| 74 | function demo_version() |
| 75 | { |
| 76 | $info = demo_info(); |
| 77 | return $info['version']; |
| 78 | } |
| 79 | |
| 80 | |
| 81 | |
| 82 | /** |
| 83 | * Add link to menu at top of content pane |
| 84 | * |
| 85 | * @return void |
| 86 | * |
| 87 | */ |
| 88 | function demo_page_header_template() |
| 89 | { |
| 90 | include_once(SM_PATH . 'plugins/demo/functions.php'); |
| 91 | return demo_page_header_template_do(); |
| 92 | } |
| 93 | |
| 94 | |
| 95 | |
| 96 | /** |
| 97 | * Inserts an option block in the main SM options page |
| 98 | * |
| 99 | * @return void |
| 100 | * |
| 101 | */ |
| 102 | function demo_option_link() |
| 103 | { |
| 104 | include_once(SM_PATH . 'plugins/demo/functions.php'); |
| 105 | demo_option_link_do(); |
| 106 | } |
| 107 | |
| 108 | |
| 109 | |
| 110 | /** |
| 111 | * Validate that this plugin is configured correctly |
| 112 | * |
| 113 | * @return boolean Whether or not there was a |
| 114 | * configuration error for this plugin. |
| 115 | * |
| 116 | */ |
| 117 | function demo_check_configuration() |
| 118 | { |
| 119 | include_once(SM_PATH . 'plugins/demo/functions.php'); |
| 120 | return demo_check_configuration_do(); |
| 121 | } |
| 122 | |
| 123 | |
| 124 | |