Beispiel #1
0
function remove_wp_dashboard_widgets()
{
    wp_unregister_sidebar_widget('dashboard_primary');
    wp_unregister_sidebar_widget('dashboard_secondary');
    wp_unregister_sidebar_widget('dashboard_plugins');
    wp_unregister_sidebar_widget('dashboard_recent_comments');
    wp_unregister_sidebar_widget('dashboard_recent_drafts');
    remove_meta_box('dashboard_primary', 'dashboard', 'side');
    remove_meta_box('dashboard_secondary', 'dashboard', 'side');
    remove_meta_box('dashboard_plugins', 'dashboard', 'normal');
    remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
    remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side');
}
Beispiel #2
0
/**
 * Alias of {@link wp_unregister_sidebar_widget()}.
 *
 * @since 2.2.0
 * @deprecated 2.8.0
 * @deprecated Use wp_unregister_sidebar_widget()
 * @see wp_unregister_sidebar_widget()
 *
 * @param int|string $id Widget ID.
 */
function unregister_sidebar_widget($id)
{
    _deprecated_function(__FUNCTION__, '2.8', 'wp_unregister_sidebar_widget()');
    return wp_unregister_sidebar_widget($id);
}
add_filter('previous_posts_link_attributes', 'bouquets_boutonnieres_more_get_previous_posts_link_attributes');
/*********************
CLIENT UX FUNCTIONS
*********************/
//Extend permisitons for the 'editor' role (used for client accounts)
function bouquets_boutonnieres_more_increase_editor_permissions()
{
    $role = get_role('editor');
    $role->add_cap('gform_full_access');
    // Gives editors access to Gravity Forms
    $role->add_cap('edit_theme_options');
    // Gives editors access to widgets & menus
}
add_action('admin_init', 'bouquets_boutonnieres_more_increase_editor_permissions');
// Removes the Powered By WPEngine widget
wp_unregister_sidebar_widget('wpe_widget_powered_by');
//Remove some of the admin bar links to keep from confusing client admins
function bouquets_boutonnieres_more_remove_admin_bar_links()
{
    global $wp_admin_bar;
    $wp_admin_bar->remove_menu('wp-logo');
    // Remove Wordpress Logo From Admin Bar
    $wp_admin_bar->remove_menu('wpseo-menu');
    // Remove SEO from Admin Bar
}
add_action('wp_before_admin_bar_render', 'bouquets_boutonnieres_more_remove_admin_bar_links');
// Custom Backend Footer
function bouquets_boutonnieres_more_custom_admin_footer()
{
    echo '<span id="footer-thankyou">Developed by <a href="//www.hallme.com/" target="_blank">Hall Internet Marketing</a></span>. Built using <a href="//github.com/hallme/scaffolding" target="_blank">scaffolding</a> a fork of <a href="//themble.com/bones" target="_blank">bones</a>.';
}
Beispiel #4
0
/**
 * Alias of {@link wp_unregister_sidebar_widget()}.
 *
 * @see wp_unregister_sidebar_widget()
 *
 * @since 2.2.0
 *
 * @param int|string $id Widget ID.
 */
function unregister_sidebar_widget($id)
{
    return wp_unregister_sidebar_widget($id);
}
 function on_deactivate_widgets()
 {
     global $wp_widget_factory, $wp_registered_widgets;
     array_map('register_widget', $this->widgets_xtreme);
     foreach ($wp_widget_factory->widgets as $class => $value) {
         $this->widgets_all[] = $class;
         //register custom widgets for later handling
         if (!in_array($class, $this->widgets_wordpress) && !in_array($class, $this->widgets_xtreme)) {
             $this->widgets_custom[] = $class;
         }
         if (in_array($class, $this->options['widgets-disabled']) || $this->options['general_permission'] === false && !in_array($class, $this->options['widgets-general-enabled'])) {
             unregister_widget($class);
             continue;
         }
     }
     foreach ($wp_registered_widgets as $id => $value) {
         if (!in_array($id, $this->widgets_wordpress) && !in_array($id, $this->widgets_xtreme)) {
             $this->widgets_all[] = $id;
             $this->widgets_deprecated[] = $id;
         }
         if (in_array($id, $this->options['widgets-disabled']) || $this->options['general_permission'] === false && !in_array($id, $this->options['widgets-general-enabled'])) {
             $this->widgets_deprecated_off[$id] = array('name' => $value['name'], 'description' => $value['description']);
             wp_unregister_sidebar_widget($id);
         }
     }
 }
<?php

function bfa_widget_calendar($args)
{
    extract($args);
    $options = get_option('bfa_widget_calendar');
    $title = apply_filters('widget_title', $options['title']);
    echo $before_widget;
    if (!empty($title)) {
        echo $before_title . $title . $after_title;
    }
    echo '<div id="calendar_wrap">';
    get_calendar();
    echo '</div>';
    if (!empty($title)) {
        echo $after_widget;
    } else {
        echo "</div>";
    }
}
// unregister old / register new calendar widget
$widget_ops = array('classname' => 'widget_calendar', 'description' => __("A calendar of your blog's posts", "atahualpa"));
wp_unregister_sidebar_widget('calendar', __('Calendar', 'atahualpa'), 'wp_widget_calendar', $widget_ops);
wp_register_sidebar_widget('calendar', __('Calendar', 'atahualpa'), 'bfa_widget_calendar', $widget_ops);
 /**
  * Deactivate the plugin
  **/
 public static function deactivate()
 {
     wp_unregister_sidebar_widget('simple_signup_form');
 }
Beispiel #8
0
 /**
  * Deactivate the plugin
  **/
 public static function deactivate()
 {
     wp_unregister_sidebar_widget('modal_survey');
     unregister_setting('modal_survey-group', 'setting_display_once');
     unregister_setting('modal_survey-group', 'setting_display_once_per_filled');
     unregister_setting('modal_survey-group', 'setting_keep_settings');
     unregister_setting('modal_survey-group', 'setting_minify');
     unregister_setting('modal_survey-group', 'setting_pdf_header');
     unregister_setting('modal_survey-group', 'setting_plugininit');
 }
 function uncode_add_widget_most_recommended_posts()
 {
     wp_unregister_sidebar_widget('most_recommended_posts');
 }
     // This is the correct way to loop over the directory. //
     while (false !== ($file = readdir($handle))) {
         if ($file != '.' && $file != '..') {
             unlink($filedir[0] . $file);
         }
     }
     closedir($handle);
     rmdir($filedir[0]);
     echo '<li>' . __('eShop template files deleted', 'eshop') . '</li>';
 }
 //unregister widgets
 wp_unregister_sidebar_widget('eshop_widget');
 wp_unregister_sidebar_widget('eshop_pay_widget');
 wp_unregister_sidebar_widget('eshop_products_widget');
 wp_unregister_sidebar_widget('eshop_cart_widget');
 wp_unregister_sidebar_widget('eshop_search_widget');
 unregister_widget('eshop_widget');
 unregister_widget('eshop_pay_widget');
 unregister_widget('eshop_products_widget');
 unregister_widget('eshop_cart_widget');
 unregister_widget('eshop_search_widget');
 delete_option('widget_eshop_widget');
 delete_option('widget_eshop_pay_widget');
 delete_option('widget_eshop_products_widget');
 delete_option('widget_eshop_cart_widget');
 delete_option('widget_eshop_search_widget');
 echo '<li>' . __('Widgets - deleted', 'eshop') . '</li>';
 //clear the cron
 wp_clear_scheduled_hook('eshop_event');
 //remove eshop capability
 remove_eshop_caps();
 function replace_widget_output_callback()
 {
     global $wp_registered_widgets;
     // Get widget logic options and check visibility settings
     if (empty($this->context_options)) {
         $this->context_options = get_option($this->options_name);
     }
     foreach ($wp_registered_widgets as $widget_id => $widget_data) {
         // Check if widget will be shown
         if (isset($this->context_options[$widget_id])) {
             $do_show = $this->check_widget_visibility($this->context_options[$widget_id]);
         }
         if (isset($do_show) && !$do_show) {
             // If not shown, remove it temporeraly from the list of existing widgets
             wp_unregister_sidebar_widget($widget_id);
         } else {
             //if (!$wp_registered_widgets[$widget_id]['params'][0]['widget_id']) {
             // Save the original widget id
             $wp_registered_widgets[$widget_id]['params'][]['widget_id'] = $widget_id;
             // Store original widget callbacks
             $wp_registered_widgets[$widget_id]['callback_original_wc'] = $wp_registered_widgets[$widget_id]['callback'];
             $wp_registered_widgets[$widget_id]['callback'] = array($this, 'replace_widget_output');
         }
     }
 }
    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 
    }