4 * Description: This addon is deprecated and has been replaced with the "Advanced Features" setting. Admins should remove this addon when their core code is updated to include advanced feature settings.
6 * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
12 function editplain_install() {
14 register_hook('plugin_settings', 'addon/editplain/editplain.php', 'editplain_settings');
15 register_hook('plugin_settings_post', 'addon/editplain/editplain.php', 'editplain_settings_post');
17 logger("installed editplain");
21 function editplain_uninstall() {
23 unregister_hook('plugin_settings', 'addon/editplain/editplain.php', 'editplain_settings');
24 unregister_hook('plugin_settings_post', 'addon/editplain/editplain.php', 'editplain_settings_post');
27 logger("removed editplain");
34 * Callback from the settings post function.
35 * $post contains the $_POST array.
36 * We will make sure we've got a valid user account
37 * and if so set our configuration setting for this person.
41 function editplain_settings_post($a,$post) {
42 if(! local_user() || (! x($_POST,'editplain-submit')))
44 set_pconfig(local_user(),'system','plaintext',intval($_POST['editplain']));
46 info( t('Editplain settings updated.') . EOL);
52 * Called from the Plugin Setting form.
53 * Add our own settings info to the page.
59 function editplain_settings(&$a,&$s) {
64 /* Add our stylesheet to the page so we can make our settings look nice */
66 $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/editplain/editplain.css' . '" media="all" />' . "\r\n";
68 /* Get the current state of our config variable */
70 $enabled = get_pconfig(local_user(),'system','plaintext');
71 $checked = (($enabled) ? ' checked="checked" ' : '');
73 /* Add some HTML to the existing form */
75 $s .= '<div class="settings-block">';
76 $s .= '<h3>' . t('Editplain Settings') . '</h3>';
77 $s .= '<div id="editplain-enable-wrapper">';
78 $s .= '<label id="editplain-enable-label" for="editplain-checkbox">' . t('Disable richtext status editor') . '</label>';
79 $s .= '<input id="editplain-checkbox" type="checkbox" name="editplain" value="1" ' . $checked . '/>';
80 $s .= '</div><div class="clear"></div>';
82 /* provide a submit button */
84 $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="editplain-submit" class="settings-submit" value="' . t('Submit') . '" /></div></div>';