function ppn_upgrade_page() { $ppn_install = ppn_install(); ?> <div class="wrap"> <h2><?php _e('Peter\'s Post Notes: status', 'peters_post_notes'); ?> </h2> <p><?php _e('The only purpose of this settings page is to install the database tables when manually upgrading the plugin.', 'peters_post_notes'); ?> </p> <?php if (empty($ppn_install)) { print __('<p>Database tables for this plugin are properly installed.</p>', 'peters_post_notes'); } else { print $ppn_install; } ?> </div> <?php }
function ppn_options_page() { $ppn_process_submit = ppn_install(); if (isset($_POST['ppn_settingssubmit'])) { $ppn_process_submit = ppnFunctionCollection::submit_settings(); } // Settings that can be updated $ppn_settings = ppnFunctionCollection::get_settings(); ?> <div class="wrap"> <h2><?php _e('Peter\'s Post Notes settings', 'peters_post_notes'); ?> </h2> <?php if (is_array($ppn_process_submit) && count($ppn_process_submit)) { print '<div id="message" class="updated fade">' . "\n"; print $ppn_process_submit[1]; print '</div>' . "\n"; } ?> <form name="ppn_settingsform" action="<?php print '?page=' . basename(__FILE__); ?> " method="post"> <table class="widefat"> <tr> <td> <p><strong><?php _e('Which types of notes to show on the Dashboard', 'peters_post_notes'); ?> </strong></p> </td> <td> <select name="ppn_show_which_notes"> <option value="related"<?php if ('related' == $ppn_settings['show_which_notes']) { print ' selected="selected"'; } ?> ><?php _e("Relevant notes including the current user's notes", 'peters_post_notes'); ?> </option> <option value="others"<?php if ('others' == $ppn_settings['show_which_notes']) { print ' selected="selected"'; } ?> ><?php _e("Relevant notes excluding the current user's notes", 'peters_post_notes'); ?> </option> <option value="all"<?php if ('all' == $ppn_settings['show_which_notes']) { print ' selected="selected"'; } ?> ><?php _e("All notes", 'peters_post_notes'); ?> </option> </select> </td> </tr> <tr> <td> <p><strong><?php _e('How many recent notes to display on the Dashboard. 0 = unlimited', 'peters_post_notes'); ?> </strong></p> </td> <td> <input name="ppn_num_notes_limit" type="text" size="3" value="<?php print intval($ppn_settings['num_notes_limit']); ?> " /> </td> </tr> <tr> <td> <p><strong><?php _e('Character set on your site. In most cases this is "UTF-8"', 'peters_post_notes'); ?> </strong></p> </td> <td> <input name="ppn_charset" type="text" size="10" value="<?php print htmlspecialchars($ppn_settings['charset']); ?> " /> </td> </tr> <tr> <td> <p><strong><?php _e('Show "Add note" text area for post within publish panel', 'peters_post_notes'); ?> </strong></p> </td> <td> <select name="ppn_add_post_note_in_publish_panel"> <option value="1"<?php if ($ppn_settings['add_post_note_in_publish_panel']) { print ' selected="selected"'; } ?> ><?php _e('Yes', 'peters_post_notes'); ?> </option> <option value="0"<?php if (!$ppn_settings['add_post_note_in_publish_panel']) { print ' selected="selected"'; } ?> ><?php _e('No', 'peters_post_notes'); ?> </option> </select> </td> </tr> <tr> <td> <p><strong><?php _e('Roles that are allowed to view all notes (used when the global setting is to only show relevant notes)', 'peters_post_notes'); ?> </strong></p> </td> <td> <?php $ppn_role_names = ppnFunctionCollection::get_role_names(); foreach ($ppn_role_names as $ppn_role_name) { print '<p><label><input name="ppn_super_roles[]" type="checkbox" value="' . $ppn_role_name . '"'; if (in_array($ppn_role_name, $ppn_settings['super_roles'])) { print ' checked="checked"'; } print ' /> ' . $ppn_role_name . '</label></p>'; } ?> </td> </tr> <tr> <td> <p><strong><?php _e('Capabilities that are allowed to view all notes (used when the global setting is to only show relevant notes)', 'peters_post_notes'); ?> </strong></p> </td> <td> <?php $ppn_level_names = ppnFunctionCollection::get_level_names(); print '<p><select name="ppn_super_caps[]" multiple="multiple" size="10">'; foreach ($ppn_level_names as $ppn_level_name) { print '<option value="' . $ppn_level_name . '"'; if (in_array($ppn_level_name, $ppn_settings['super_caps'])) { print ' selected="selected"'; } print '>' . $ppn_level_name . '</option>'; } print '</select></p>'; ?> </td> </tr> <tr> <td> <p><strong><?php _e('Roles that are allowed to edit all notes (they must also be allowed to view the notes)', 'peters_post_notes'); ?> </strong></p> </td> <td> <?php if (!isset($ppn_role_names)) { $ppn_role_names = ppnFunctionCollection::get_role_names(); } foreach ($ppn_role_names as $ppn_role_name) { print '<p><label><input name="ppn_superedit_roles[]" type="checkbox" value="' . $ppn_role_name . '"'; if (in_array($ppn_role_name, $ppn_settings['superedit_roles'])) { print ' checked="checked"'; } print ' /> ' . $ppn_role_name . '</label></p>'; } ?> </td> </tr> <tr> <td> <p><strong><?php _e('Capabilities that are allowed to edit all notes (they must also be allowed to view the notes)', 'peters_post_notes'); ?> </strong></p> </td> <td> <?php if (!isset($ppn_level_names)) { $ppn_level_names = ppnFunctionCollection::get_level_names(); } print '<p><select name="ppn_superedit_caps[]" multiple="multiple" size="10">'; foreach ($ppn_level_names as $ppn_level_name) { print '<option value="' . $ppn_level_name . '"'; if (in_array($ppn_level_name, $ppn_settings['superedit_caps'])) { print ' selected="selected"'; } print '>' . $ppn_level_name . '</option>'; } print '</select></p>'; ?> </td> </tr> <tr> <td> <p><strong><?php _e('List of post types on which post notes should be enabled', 'peters_post_notes'); ?> </strong></p> </td> <td> <?php $ppn_post_types = get_post_types(); foreach ($ppn_post_types as $ppn_post_type) { // Don't show revisions, attachments, or navigation menu items, as they're not traditional posts if (!in_array($ppn_post_type, array('revision', 'attachment', 'nav_menu_item'))) { print '<p><label><input name="ppn_post_types[]" type="checkbox" value="' . $ppn_post_type . '"'; if (in_array($ppn_post_type, $ppn_settings['post_types'])) { print ' checked="checked"'; } print ' /> ' . $ppn_post_type . '</label></p>'; } } ?> </td> </tr> <tr> <td> <p><strong><?php _e('Allow the same set of HTML tags in notes as are allowed in WordPress comments', 'peters_post_notes'); ?> </strong></p> </td> <td> <select name="ppn_allow_html"> <option value="0"<?php if (!$ppn_settings['allow_html']) { print ' selected="selected"'; } ?> ><?php _e('No', 'peters_post_notes'); ?> </option> <option value="1"<?php if ($ppn_settings['allow_html']) { print ' selected="selected"'; } ?> ><?php _e('Yes', 'peters_post_notes'); ?> </option> </select> </td> </tr> <tr> <td> <p><strong><?php _e('Show "Latest note" column in the "Manage posts" page', 'peters_post_notes'); ?> </strong></p> </td> <td> <select name="ppn_show_latest_notes_column"> <option value="1"<?php if ($ppn_settings['show_latest_notes_column']) { print ' selected="selected"'; } ?> ><?php _e('Yes', 'peters_post_notes'); ?> </option> <option value="0"<?php if (!$ppn_settings['show_latest_notes_column']) { print ' selected="selected"'; } ?> ><?php _e('No', 'peters_post_notes'); ?> </option> </select> </td> </tr> <tr> <td> <p><strong><?php _e('Capability required to add a general note. (Otherwise users can only add a private note.)', 'peters_post_notes'); ?> </strong></p> </td> <td> <?php if (!isset($ppn_level_names)) { $ppn_level_names = ppnFunctionCollection::get_level_names(); } print '<p><select name="ppn_general_notes_required_capability">'; foreach ($ppn_level_names as $ppn_level_name) { print '<option value="' . $ppn_level_name . '"'; if ($ppn_level_name == $ppn_settings['general_notes_required_capability']) { print ' selected="selected"'; } print '>' . $ppn_level_name . '</option>'; } print '</select></p>'; ?> </td> </tr> </table> <p class="submit"><input name="ppn_settingssubmit" type="submit" value="<?php _e('Update', 'peters_post_notes'); ?> " /></p> </form> </div> <?php }