/** * Alias of {@link wp_unregister_widget_control()}. * * @since 2.2.0 * @deprecated 2.8.0 * @deprecated Use wp_unregister_widget_control() * @see wp_unregister_widget_control() * * @param int|string $id Widget ID. */ function unregister_widget_control($id) { _deprecated_function(__FUNCTION__, '2.8', 'wp_unregister_widget_control()'); return wp_unregister_widget_control($id); }
/** * Remove widget from sidebar. * * @since 2.2.0 * * @param int|string $id Widget ID. */ function wp_unregister_sidebar_widget($id) { /** * Fires just before a widget is removed from a sidebar. * * @since 3.0.0 * * @param int $id The widget ID. */ do_action('wp_unregister_sidebar_widget', $id); wp_register_sidebar_widget($id, '', ''); wp_unregister_widget_control($id); }
/** * Remove widget from sidebar. * * @since 2.2.0 * * @param int|string $id Widget ID. */ function wp_unregister_sidebar_widget($id) { do_action('wp_unregister_sidebar_widget', $id); wp_register_sidebar_widget($id, '', ''); wp_unregister_widget_control($id); }
/** * Alias of {@link wp_unregister_widget_control()}. * * @since 2.2.0 * @see wp_unregister_widget_control() * * @param int|string $id Widget ID. */ function unregister_widget_control($id) { return wp_unregister_widget_control($id); }
function barthelme_widgets_init() { if (!function_exists('register_sidebars')) { return; } $p = array('before_title' => "<h3 class='widgettitle'>", 'after_title' => "</h3>\n"); register_sidebars(1, $p); // Finished intializing Widgets plugin, now let's load the Barthelme default widgets; first, Barthelme search widget $widget_ops = array('classname' => 'widget_search', 'description' => __("A search form for your blog (Barthelme)", "barthelme")); wp_register_sidebar_widget('search', __('Search', 'barthelme'), 'widget_barthelme_search', $widget_ops); wp_unregister_widget_control('search'); wp_register_widget_control('search', __('Search', 'barthelme'), 'widget_barthelme_search_control'); // Barthelme Meta widget $widget_ops = array('classname' => 'widget_meta', 'description' => __("Log in/out and administration links (Barthelme)", "barthelme")); wp_register_sidebar_widget('meta', __('Meta', 'barthelme'), 'widget_barthelme_meta', $widget_ops); wp_unregister_widget_control('meta'); wp_register_widget_control('meta', __('Meta'), 'wp_widget_meta_control'); //Barthelme Home Link widget $widget_ops = array('classname' => 'widget_home_link', 'description' => __("Link to the front page when elsewhere (Barthelme)", "barthelme")); wp_register_sidebar_widget('home_link', __('Home Link', 'barthelme'), 'widget_barthelme_homelink', $widget_ops); wp_register_widget_control('home_link', __('Home Link', 'barthelme'), 'widget_barthelme_homelink_control'); //Barthelme RSS Links widget $widget_ops = array('classname' => 'widget_rss_links', 'description' => __("RSS links for both posts and comments (Barthelme)", "barthelme")); wp_register_sidebar_widget('rss_links', __('RSS Links', 'barthelme'), 'widget_barthelme_rsslinks', $widget_ops); wp_register_widget_control('rss_links', __('RSS Links', 'barthelme'), 'widget_barthelme_rsslinks_control'); }
/** * Remove widget from sidebar. * * @since 2.2.0 * * @param int|string $id Widget ID. */ function wp_unregister_sidebar_widget($id) { wp_register_sidebar_widget($id, '', ''); wp_unregister_widget_control($id); }
function pageOptions() { // Update or reset options if (isset($_POST['updateoptions'])) { foreach ((array) $this->options as $key => $value) { $newval = isset($_POST[$key]) ? stripslashes($_POST[$key]) : '0'; if ($newval != $value) { $this->setOption($key, $newval); } } $this->saveOptions(); $this->message = __('Options saved', 'wpkitcn'); $this->status = 'updated'; } if (isset($_POST['deletealloptions'])) { wp_unregister_sidebar_widget('wkc_advanced_blogroll'); wp_unregister_widget_control('wkc_advanced_blogroll'); wp_unregister_sidebar_widget('wkc_most_active_commentors'); wp_unregister_widget_control('wkc_most_active_commentors'); wp_unregister_sidebar_widget('wkc_most_commented'); wp_unregister_widget_control('wkc_most_commented'); wp_unregister_sidebar_widget('wkc_random_posts'); wp_unregister_widget_control('wkc_random_posts'); wp_unregister_sidebar_widget('wkc_recent_commentors'); wp_unregister_widget_control('wkc_recent_commentors'); wp_unregister_sidebar_widget('wkc_recent_comments'); wp_unregister_widget_control('wkc_recent_comments'); delete_option($this->db_options); delete_option('widget_wkc_advanced_blogroll'); delete_option('widget_wkc_most_active_commentors'); delete_option('widget_wkc_most_commented_posts'); delete_option('widget_wkc_random_posts'); delete_option('widget_wkc_recent_commentors'); delete_option('widget_wkc_recent_comments'); deactivate_plugins('wp-kit-cn/wp-kit-cn.php'); $this->message = __('Options of WP Kit CN have been removed, and the plugin has been deactivated.', 'wpkitcn'); } $this->displayMessage(); ?> <style type="text/css"> legend {display:none!important;} fieldset {border:0 none;margin:0;padding:0;} </style> <div class="wrap"> <h2><?php _e('WP Kit CN Options', 'wpkitcn'); ?> </h2> <p><?php _e('Visit the <a href="http://sexywp.com/wp-kit-cn.htm">plugin\'s homepage</a> for further details. If you find a bug, or have a fantastic idea for this plugin, <a href="mailto:charlestang@foxmail.com">ask me</a> !', 'wpkitcn'); ?> </p> <form method="post" action="<?php echo $this->admin_base_url . 'wkc_options'; ?> "> <table class="form-table"> <tbody> <tr> <th scope="row"><?php _e('Auto Excerpt Settings', 'wpkitcn'); ?> </th> <td><fieldset> <legend><?php _e('Auto Excerpt Settings', 'wpkitcn'); ?> </legend> <input type="hidden" name="enable_excerpt_algorithm" id="enable_excerpt_algorithm" value="0" /> <p><label for="enable_excerpt_algorithm"><input type="checkbox" name="enable_excerpt_algorithm" id="enable_excerpt_algorithm" value="1" <?php echo $this->options['enable_excerpt_algorithm'] ? 'checked="checked"' : ''; ?> /><?php _e('Enable the Excerpt Algorithm', 'wpkitcn'); ?> </label></p> <p><?php _e('The excerpt algorithm in this plugin will replace the original excerpt algorithm. This algorithm allows you customize how many paragraphs or how many words you want use to excerpt the post.', 'wpkitcn'); ?> </p> <p><label for="excerpt_words_number"> <?php _e('How many words?', 'wpkitcn'); ?> </label> <input type="text" name="excerpt_words_number" id="excerpt_words_number" value="<?php echo $this->options['excerpt_words_number']; ?> " size="5" /> <?php _e('words.', 'wpkitcn'); ?> </p> <p><label for="excerpt_paragraphs_number"> <?php _e('or How many paragraphs?', 'wpkitcn'); ?> </label> <input type="text" name="excerpt_paragraphs_number" id="excerpt_paragraphs_number" value="<?php echo $this->options['excerpt_paragraphs_number']; ?> " size="5" /> <?php _e('paragraphs.', 'wpkitcn'); ?> </p> </fieldset></td> </tr> <tr> <th scope="row"><?php _e('Feed Enhancement', 'wpkitcn'); ?> </th> <td> <fieldset> <legend><?php _e('Related Posts Settings', 'wpkitcn'); ?> </legend> <input type="hidden" name="add_related_posts_to_feed" id="add_related_posts_to_feed" value="0" /> <p><label for="add_related_posts_to_feed"> <input type="checkbox" name="add_related_posts_to_feed" id="add_related_posts_to_feed" value="1" <?php echo $this->options['add_related_posts_to_feed'] ? 'checked="checked"' : ''; ?> /><?php _e('Add related posts list to your feed.', 'wpkitcn'); ?> </label></p> <p><label for="related_posts_list_title"> <?php _e('The title of related posts\' list', 'wpkitcn'); ?> </label> <input type="text" name="related_posts_list_title" id="related_posts_list_title" value="<?php echo $this->options['related_posts_list_title']; ?> "> </p> <p><label for="no_related_posts_tips"> <?php _e('No related post, then show: ', 'wpkitcn'); ?> </label> <input type="text" name="no_related_posts_tips" id="no_related_posts_tips" value="<?php echo $this->options['no_related_posts_tips']; ?> "> </p> <p><label for="display_order_of_related_posts_list"> <?php _e('The display order of related posts\' list', 'wpkitcn'); ?> </label> <input type="text" name="display_order_of_related_posts_list" id="display_order_of_related_posts_list" value="<?php echo $this->options['display_order_of_related_posts_list']; ?> " /> </p> </fieldset> <fieldset> <legend><?php _e('Add Recent Comments to Feed', 'wpkitcn'); ?> </legend> <input type="hidden" name="add_recent_comments_to_feed" id="add_recent_comments_to_feed" value="0" /> <p><label for="add_recent_comments_to_feed"><input type="checkbox" name="add_recent_comments_to_feed" id="add_recent_comments_to_feed" value="1" <?php echo $this->options['add_recent_comments_to_feed'] ? 'checked="checked"' : ''; ?> /><?php _e('Add recent comments list to your feed.', 'wpkitcn'); ?> </label></p> <p><label for="recent_comments_list_title"><?php _e('The title of recent comments\' list', 'wpkitcn'); ?> </label><input type="text" name="recent_comments_list_title" id="recent_comments_list_title" value="<?php echo $this->options['recent_comments_list_title']; ?> "></p> <p><label for="display_order_of_recent_commets_list"><?php _e('The display order of recent comments\' list', 'wpkitcn'); ?> </label><input type="text" name="display_order_of_recent_comments_list" id="display_order_of_recent_comments_list" value="<?php echo $this->options['display_order_of_recent_comments_list']; ?> " /></p> </fieldset> </td> </tr> </tbody> </table> <input type="hidden" name="action" value="update" /> <p class="submit"> <input type="submit" name="updateoptions" value="<?php _e('Save Changes', 'wpkitcn'); ?> " /> </p> <h3><?php _e("Uninstall", 'wpkitcn'); ?> </h3> <p><?php _e("Click the button, the options of this plugin will be removed, include the widget.", 'wpkitcn'); ?> </p> <p class="submit"> <input type="submit" name="deletealloptions" value="<?php _e('Delete All Options', 'wpkitcn'); ?> " /> </p> </form> <?php $this->printAdminFooter(); ?> </div><!--/wrap--> <?php }
function sandbox_widgets_init() { if (!function_exists('register_sidebars')) { return; } // Formats the Sandbox widgets, adding readability-improving whitespace $p = array('before_widget' => "\n\t\t\t" . '<li id="%1$s" class="widget %2$s">', 'after_widget' => "\n\t\t\t</li>\n", 'before_title' => "\n\t\t\t\t" . '<h3 class="widgettitle">', 'after_title' => "</h3>\n"); // Table for how many? Two? This way, please. register_sidebars(2, $p); // Finished intializing Widgets plugin, now let's load the Sandbox default widgets; first, Sandbox search widget $widget_ops = array('classname' => 'widget_search', 'description' => __("A search form for your blog (Sandbox)", "sandbox")); wp_register_sidebar_widget('search', __('Search', 'sandbox'), 'widget_sandbox_search', $widget_ops); wp_unregister_widget_control('search'); // We're being Sandbox-specific; remove WP default wp_register_widget_control('search', __('Search', 'sandbox'), 'widget_sandbox_search_control'); // Sandbox Meta widget $widget_ops = array('classname' => 'widget_meta', 'description' => __("Log in/out and administration links (Sandbox)", "sandbox")); wp_register_sidebar_widget('meta', __('Meta', 'sandbox'), 'widget_sandbox_meta', $widget_ops); wp_unregister_widget_control('meta'); // We're being Sandbox-specific; remove WP default wp_register_widget_control('meta', __('Meta', 'sandbox'), 'wp_widget_meta_control'); //Sandbox RSS Links widget $widget_ops = array('classname' => 'widget_rss_links', 'description' => __("RSS links for both posts and comments (Sandbox)", "sandbox")); wp_register_sidebar_widget('rss_links', __('RSS Links', 'sandbox'), 'widget_sandbox_rsslinks', $widget_ops); wp_register_widget_control('rss_links', __('RSS Links', 'sandbox'), 'widget_sandbox_rsslinks_control'); }