/** * Updates the sitewide comments widget. * * @uses ClassBlogs_Plugins_Aggregation_SitewideComments to clear the cached widget */ public function update($new, $old) { // Update the widget options $instance = $old; $instance['max_comments'] = absint(ClassBlogs_Utils::sanitize_user_input($new['max_comments'])); $instance['max_comments_per_blog'] = absint(ClassBlogs_Utils::sanitize_user_input($new['max_comments_per_blog'])); $instance['meta_format'] = ClassBlogs_Utils::sanitize_user_input($new['meta_format']); $instance['show_excerpt'] = ClassBlogs_Utils::checkbox_as_bool($new, 'show_excerpt'); $instance['title'] = ClassBlogs_Utils::sanitize_user_input($new['title']); // Clear the cached sidebar widget $plugin = ClassBlogs::get_plugin('sitewide_comments'); $plugin->clear_cached_widget(); return $instance; }
/** * Handles the admin page logic for the sitewide posts plugin. * * @access private * @since 0.2 */ public function _options_admin_page() { if ($_POST) { check_admin_referer($this->get_uid()); $options = $this->get_options(); $options['root_excerpt_words'] = absint(ClassBlogs_Utils::sanitize_user_input($_POST['root_excerpt_words'])); $options['root_show_posts'] = ClassBlogs_Utils::checkbox_as_bool($_POST, 'root_show_posts'); $options['root_strip_formatting'] = ClassBlogs_Utils::checkbox_as_bool($_POST, 'root_strip_formatting'); $options['root_use_excerpt'] = ClassBlogs_Utils::checkbox_as_bool($_POST, 'root_use_excerpt'); $this->update_options($options); ClassBlogs_Admin::show_admin_message(__('Your sitewide post options have been updated', 'classblogs')); } ?> <div class="wrap"> <?php ClassBlogs_Admin::show_admin_icon(); ?> <h2><?php _e('Student Post Options', 'classblogs'); ?> </h2> <p> <?php _e('This page allows you to control options that will affect the display of student posts on the home page of the root blog.', 'classblogs'); ?> </p> <form method="post" action=""> <table class="form-table"> <tr valign="top"> <th scope="row"><?php _e('Show Student Posts On Root Blog', 'classblogs'); ?> </th> <td> <input type="checkbox" name="root_show_posts" id="root-show-posts" <?php echo $this->option_to_selected_attribute('root_show_posts'); ?> /> <label for="root-show-posts"><?php _e('Enabled', 'classblogs'); ?> </label> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Remove Post Formatting', 'classblogs'); ?> </th> <td> <input type="checkbox" name="root_strip_formatting" id="root-strip-formatting" <?php echo $this->option_to_selected_attribute('root_strip_formatting'); ?> /> <label for="root-strip-formatting"><?php _e('Enabled', 'classblogs'); ?> </label> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Only Show Post Excerpt', 'classblogs'); ?> </th> <td> <input type="checkbox" name="root_use_excerpt" id="root-use-excerpt" <?php echo $this->option_to_selected_attribute('root_use_excerpt'); ?> /> <label for="root-use-excerpt"><?php _e('Enabled', 'classblogs'); ?> </label><br /><br /> <input type="text" name="root_excerpt_words" id="root-excerpt-words" value="<?php echo esc_attr($this->get_option('root_excerpt_words')); ?> " size="4" /><br /> <label for="root-excerpt-words"><?php _e('Excerpt length (in words)', 'classblogs'); ?> </label> </td> </tr> </table> <?php nxt_nonce_field($this->get_uid()); ?> <p class="submit"><input type="submit" class="button-primary" name="Submit" value="<?php _e('Update Student Post Options', 'classblogs'); ?> " /></p> </form> </div> <?php }