-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdebug-bar-transients.php
More file actions
73 lines (65 loc) · 2.09 KB
/
debug-bar-transients.php
File metadata and controls
73 lines (65 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/**
* Plugin Name: Debug Bar Transients
* Version: 0.4
* Description: Adds information about the WordPress Transient API to Debug Bar.
* Author: Dominik Schilling
* Author URI: http://wphelper.de/
* Plugin URI: http://wpgrafie.de/wp-plugins/debug-bar-transient/en/
*
* Text Domain: ds-debug-bar-transients
* Domain Path: /lang
*
* License: GPLv2 or later
*
* Copyright (C) 2011-2013 Dominik Schilling
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**
* Don't call this file directly.
*/
if ( ! class_exists( 'WP' ) ) {
die();
}
/**
* Adds panel, as defined in the included class, to Debug Bar.
*
* @param $panels array
* @return array
*/
function ds_add_debug_bar_transients_panel( $panels ) {
if ( ! class_exists( 'DS_Debug_Bar_Transients' ) ) {
include( 'class-debug-bar-transients.php' );
$panels[] = new DS_Debug_Bar_Transients();
}
return $panels;
}
add_filter( 'debug_bar_panels', 'ds_add_debug_bar_transients_panel' );
/**
* Adds the AJAX callback function for deleting a transient from the Debug Bar.
*/
function ds_ajax_delete_transient() {
if ( ! is_super_admin() )
die( '-1' );
check_ajax_referer( 'ds-delete-transient' );
if ( empty( $_POST['transient-type'] ) )
$ret = delete_transient( $_POST['transient-name'] );
else
$ret = delete_site_transient( $_POST['transient-name'] );
$ret = $ret ? '1' : '0';
die( $ret );
}
add_action( 'wp_ajax_ds_delete_transient', 'ds_ajax_delete_transient' );