Plugin Directory

Changeset 643133


Ignore:
Timestamp:
12/21/2012 09:06:48 PM (13 years ago)
Author:
bmsterling
Message:

Update code; verify working in 3.5

Location:
remove-inactive-widgets/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • remove-inactive-widgets/trunk

    • Property svn:ignore set to
      .git
      .gitignore
  • remove-inactive-widgets/trunk/readme.txt

    r384882 r643133  
    44Tags: widgets, removal, inactive
    55Requires at least: 3.0
    6 Tested up to: 3.1.1
    7 Stable tag: 0.2
     6Tested up to: 3.5
     7Stable tag: 0.2.1
    88
    99This plugin adds a button to the widget's admin page that will delete all inactive widgets.
     
    2828
    2929== Changelog ==
     30
     31- 0.2.1
     32Update code
     33Verify working in 3.5
    3034
    3135= 0.2 =
  • remove-inactive-widgets/trunk/remove-inactive-widgets.php

    r384882 r643133  
    33Plugin Name: Remove Inactive Widgets
    44Plugin URI: http://benjaminsterling.com/wordpress-plugins/remove-inactive-widgets/
    5 Description:
    6 Version: 0.2
     5Description: This plugin adds a button to the widget's admin page that will delete all inactive widgets.
     6Version: 0.2.1
    77Author: Benjamin Sterling
    88Author URI: http://kenzomedia.com
     
    2727
    2828function riw_admin_print_scripts( $arg ){
    29     global $pagenow;
    30     if (is_admin() && $pagenow == 'widgets.php') {
    31         $js = plugins_url('/riw.js', __FILE__ );
    32         wp_enqueue_script("riwscript", $js );
    33     }
     29    global $pagenow;
     30    if (is_admin() && $pagenow == 'widgets.php') {
     31        $js = plugins_url('/riw.js', __FILE__ );
     32        wp_enqueue_script("riwscript", $js );
     33    }
    3434}
    3535
    3636function riw_async(){
    37     $widgets = get_option('sidebars_widgets');
    38     $widgets['wp_inactive_widgets'] = array();
    39     update_option('sidebars_widgets', $widgets);
     37    $widgets = get_option('sidebars_widgets');
     38    $widgets['wp_inactive_widgets'] = array();
     39    update_option('sidebars_widgets', $widgets);
    4040}
    4141
    4242function riw_add_action(){
    43     wp_nonce_field( 'riw_asyncnonce', 'riw_asyncnonce' );
     43    wp_nonce_field( 'riw_asyncnonce', 'riw_asyncnonce' );
    4444}
    4545
  • remove-inactive-widgets/trunk/riw.js

    r384882 r643133  
    11(function( $ ){
    2     $(document)
    3     .ready(
    4         function(){
     2    $(document)
     3    .ready(
     4        function () {
    55
    6         var wp_inactive_widgets = $('#wp_inactive_widgets'),
    7             btn = $('<a href="#" class="button">Remove inactive widgets</a>')
    8                     .insertAfter( wp_inactive_widgets );
    9                    
    10             btn.wrap(
    11                 '<p class="description" style="clear:both;line-height: 26px;">Press the following button will remove all of these inactive widgets </p>'
    12             );
    13                    
    14             btn
    15             .click(
    16                 function(){
    17                     jQuery.post(ajaxurl, {
    18                         action: 'riw_async',
    19                         riw_asyncnonce: jQuery('#riw_asyncnonce').val()
    20                     }, function(data) {
    21                         wp_inactive_widgets.empty();
    22                     });
    23                 }
    24             );
    25         }
    26     );
     6        var
     7            wp_inactive_widgets = $('#wp_inactive_widgets'),
     8            btn                 = $('<a href="#" class="button">Remove inactive widgets</a>')
     9                                        .insertAfter( wp_inactive_widgets );
     10
     11            btn.wrap(
     12                '<p class="description" style="clear:both;line-height: 26px;">Press the following button will remove all of these inactive widgets </p>'
     13            )
     14            .click(
     15                function () {
     16                    $.post(
     17                        ajaxurl, {
     18                            action          : 'riw_async',
     19                            riw_asyncnonce  : $('#riw_asyncnonce').val()
     20                        },
     21                        function (data) {
     22                            wp_inactive_widgets.empty();
     23                        }
     24                    );
     25                }
     26            );
     27        }
     28    );
    2729})(jQuery);
Note: See TracChangeset for help on using the changeset viewer.