| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | Plugin Name: Plugin Filter |
|---|
| 4 | Description: Filter dem plugins |
|---|
| 5 | Version: 1.2 |
|---|
| 6 | Author: John Blackbourn |
|---|
| 7 | Author URI: http://lud.icro.us/ |
|---|
| 8 | |
|---|
| 9 | © 2012 John Blackbourn |
|---|
| 10 | |
|---|
| 11 | This program is free software; you can redistribute it and/or modify |
|---|
| 12 | it under the terms of the GNU General Public License as published by |
|---|
| 13 | the Free Software Foundation; either version 2 of the License, or |
|---|
| 14 | (at your option) any later version. |
|---|
| 15 | |
|---|
| 16 | This program is distributed in the hope that it will be useful, |
|---|
| 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 19 | GNU General Public License for more details. |
|---|
| 20 | |
|---|
| 21 | */ |
|---|
| 22 | |
|---|
| 23 | class PluginFilterPlugin { |
|---|
| 24 | |
|---|
| 25 | function __construct() { |
|---|
| 26 | |
|---|
| 27 | add_action( 'admin_head-plugins.php', array( $this, 'output' ) ); |
|---|
| 28 | |
|---|
| 29 | } |
|---|
| 30 | |
|---|
| 31 | function output() { |
|---|
| 32 | ?> |
|---|
| 33 | <script type="text/javascript"> |
|---|
| 34 | |
|---|
| 35 | (function($){ |
|---|
| 36 | |
|---|
| 37 | // Case-insensitive version of :contains() |
|---|
| 38 | $.expr[':'].icontains = function( obj, index, meta, stack ) { |
|---|
| 39 | |
|---|
| 40 | return ( |
|---|
| 41 | obj.textContent || |
|---|
| 42 | obj.innerText || |
|---|
| 43 | $(obj).text() || |
|---|
| 44 | '' |
|---|
| 45 | ).toLowerCase().indexOf(meta[3].toLowerCase()) >= 0; |
|---|
| 46 | |
|---|
| 47 | }; |
|---|
| 48 | |
|---|
| 49 | })(jQuery); |
|---|
| 50 | |
|---|
| 51 | jQuery(function($){ |
|---|
| 52 | |
|---|
| 53 | var tr = $('#the-list').find('tr'); |
|---|
| 54 | |
|---|
| 55 | $('#plugin-search-input').focus().bind('keyup change blur input',function(e){ |
|---|
| 56 | |
|---|
| 57 | if ( $(this).val() ) |
|---|
| 58 | tr.hide().filter(':icontains("' + $(this).val() + '")').show(); |
|---|
| 59 | else |
|---|
| 60 | tr.show(); |
|---|
| 61 | |
|---|
| 62 | }); |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | }); |
|---|
| 66 | |
|---|
| 67 | </script> |
|---|
| 68 | <?php |
|---|
| 69 | } |
|---|
| 70 | |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | if ( !defined( 'ABSPATH' ) ) |
|---|
| 74 | die(); |
|---|
| 75 | |
|---|
| 76 | $pluginfilterplugin = new PluginFilterPlugin; |
|---|