mirror of
https://github.com/felixfoertsch/wordpress-dev-env.git
synced 2026-04-18 23:38:37 +02:00
Initial commit
This commit is contained in:
21
wordpress_plugins/debug-bar-cache-lookup/assets/css/dbcl.css
Normal file
21
wordpress_plugins/debug-bar-cache-lookup/assets/css/dbcl.css
Normal file
@@ -0,0 +1,21 @@
|
||||
#dbcl_panel form p{
|
||||
padding:5px;
|
||||
clear:both;
|
||||
}
|
||||
#dbcl_panel form p label{
|
||||
width:50px;
|
||||
display:block;
|
||||
float:left;
|
||||
}
|
||||
|
||||
#dbcl_panel form p input{
|
||||
float:left;
|
||||
width:150px;
|
||||
}
|
||||
|
||||
#dbcl_panel form p.center input{
|
||||
width:200px;
|
||||
}
|
||||
#dbcl_results {
|
||||
margin-top:20px;
|
||||
}
|
||||
20
wordpress_plugins/debug-bar-cache-lookup/assets/js/dbcl.js
Normal file
20
wordpress_plugins/debug-bar-cache-lookup/assets/js/dbcl.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/*global dbcl:false, ajaxurl:false */
|
||||
( function ( $ ) {
|
||||
$( document ).on( 'submit', '#dbcl_form', function ( e ) {
|
||||
e.preventDefault();
|
||||
$( '#dbcl_results' ).empty();
|
||||
var dbcl_data = {
|
||||
action: 'dbcl',
|
||||
dbcl_key: $( '#dbcl_key' ).val(),
|
||||
dbcl_group: $( '#dbcl_group' ).val(),
|
||||
security: dbcl.security
|
||||
};
|
||||
$.post( ajaxurl, dbcl_data, function ( res ) {
|
||||
if ( true === res.success ) {
|
||||
$( '#dbcl_results' ).html( res.data.cache );
|
||||
} else {
|
||||
$( '#dbcl_results' ).html( 'No cache data found.' );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
} )( jQuery );
|
||||
BIN
wordpress_plugins/debug-bar-cache-lookup/assets/screenshot-1.jpg
Normal file
BIN
wordpress_plugins/debug-bar-cache-lookup/assets/screenshot-1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset name="WPized Project">
|
||||
<description>A custom set of rules to check for a WPized WordPress project</description>
|
||||
|
||||
<exclude-pattern>/docroot/wp-admin/*</exclude-pattern>
|
||||
<exclude-pattern>/docroot/wp-includes/*</exclude-pattern>
|
||||
<exclude-pattern>/docroot/wp-*.php</exclude-pattern>
|
||||
<exclude-pattern>/docroot/index.php</exclude-pattern>
|
||||
<exclude-pattern>/docroot/xmlrpc.php</exclude-pattern>
|
||||
<exclude-pattern>/docroot/wp-content/plugins/*</exclude-pattern>
|
||||
|
||||
<rule ref="Squiz.PHP.CommentedOutCode"/>
|
||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
|
||||
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
|
||||
<!--<rule ref="Generic.Commenting.Todo"/>-->
|
||||
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
|
||||
|
||||
<!--
|
||||
We may also want to to include all the rules in a standard
|
||||
-->
|
||||
|
||||
<rule ref="WordPress">
|
||||
|
||||
<!--
|
||||
We may want a middle ground though. The best way to do this is add the
|
||||
entire ruleset, then rule by rule, remove ones that don't suit a project. We
|
||||
can do this by running `phpc ` with the '-s' flag, to see the names of the
|
||||
different Sniffs, as their rules are broken. From here, we can opt to
|
||||
exclude problematic sniffs like so.
|
||||
|
||||
|
||||
<exclude name="WordPress.XSS.EscapeOutput" />
|
||||
|
||||
-->
|
||||
<exclude name="Generic.CodeAnalysis.UnusedFunctionParameter.Found" />
|
||||
<exclude name="Generic.Commenting.Todo.TaskFound" />
|
||||
<exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines" />
|
||||
<exclude name="Squiz.PHP.CommentedOutCode.Found" />
|
||||
<exclude name="Generic.ControlStructures.InlineControlStructure.NotAllowed" />
|
||||
<exclude name="WordPress.Classes.ValidClassName" />
|
||||
<exclude name="PEAR.Functions.FunctionCallSignature" />
|
||||
<exclude name="WordPress.Files.FileName" />
|
||||
<exclude name="WordPress.Arrays.ArrayDeclaration" />
|
||||
<exclude name="WordPress.Arrays.ArrayKeySpacingRestrictions" />
|
||||
<exclude name="WordPress.Functions.FunctionDeclarationArgumentSpacing" />
|
||||
<exclude name="Squiz.Strings.DoubleQuoteUsage" />
|
||||
<exclude name="WordPress.WhiteSpace.OperatorSpacing" />
|
||||
<exclude name="WordPress.WhiteSpace.PhpIndent.Incorrect" />
|
||||
<exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine" />
|
||||
<exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile" />
|
||||
<exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile" />
|
||||
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing" />
|
||||
<exclude name="Generic.WhiteSpace.ScopeIndent" />
|
||||
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent" />
|
||||
<exclude name="WordPress.NamingConventions.ValidFunctionName" />
|
||||
<exclude name="WordPress.PHP.YodaConditions" />
|
||||
<!--<exclude name="WordPress.VIP" />
|
||||
<exclude name="WordPress.PHP" />
|
||||
<exclude name="WordPress.XSS" />-->
|
||||
|
||||
</rule>
|
||||
</ruleset>
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Plugin Name: Debug Bar Cache Lookup
|
||||
* Plugin URI: https://wordpress.org/plugins/debug-bar-cache-lookup/
|
||||
* Description: Look up items in object cache. Requires Debug Bar Plugin.
|
||||
* Version: 0.1.1
|
||||
* Author: Allan Collins
|
||||
* Author URI: http://www.allancollins.net/
|
||||
* License: GPLv2+
|
||||
* Text Domain: dbcl
|
||||
* Domain Path: /languages
|
||||
*/
|
||||
/**
|
||||
* Copyright (c) 2015 Allan Collins (email : allan.collins@10up.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2 or, at
|
||||
* your discretion, any later version, as published by the Free
|
||||
* Software Foundation.
|
||||
*
|
||||
* 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 St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/**
|
||||
* Built using grunt-wp-plugin
|
||||
* Copyright (c) 2013 10up, LLC
|
||||
* https://github.com/10up/grunt-wp-plugin
|
||||
*/
|
||||
// Useful global constants
|
||||
define( 'DBCL_VERSION', '0.1.0' );
|
||||
define( 'DBCL_URL', plugin_dir_url( __FILE__ ) );
|
||||
define( 'DBCL_PATH', dirname( __FILE__ ) . '/' );
|
||||
|
||||
/**
|
||||
* Add the panel to the Debug Bar.
|
||||
*
|
||||
* @param array $panels Array of panel objects.
|
||||
*
|
||||
* @return array Array of panel objects.
|
||||
*/
|
||||
function dbcl_add_panel( $panels ) {
|
||||
require DBCL_PATH . 'includes/class-debug-bar-cache-lookup.php';
|
||||
array_push( $panels, new Debug_Bar_Cache_Lookup() );
|
||||
|
||||
return $panels;
|
||||
}
|
||||
|
||||
add_filter( 'debug_bar_panels', 'dbcl_add_panel' );
|
||||
|
||||
/**
|
||||
* Enqueue JavaScript, localization and stylesheet.
|
||||
*/
|
||||
function dbcl_enqueue() {
|
||||
wp_enqueue_style( 'dbcl-css', DBCL_URL . 'assets/css/dbcl.css', array(), '20150113' );
|
||||
wp_enqueue_script( 'dbcl-js', DBCL_URL . 'assets/js/dbcl.js', array( 'jquery' ), '20150113' );
|
||||
wp_localize_script( 'dbcl-js', 'dbcl', array( 'security' => wp_create_nonce( "dbcl_security" ) ) );
|
||||
}
|
||||
|
||||
add_action( 'debug_bar_enqueue_scripts', 'dbcl_enqueue' );
|
||||
|
||||
/**
|
||||
* Ajax callback that retrieves the cache object information.
|
||||
*/
|
||||
function dbcl_ajax() {
|
||||
check_ajax_referer( 'dbcl_security', 'security' );
|
||||
$dbcl_key = filter_input( INPUT_POST, 'dbcl_key', FILTER_SANITIZE_STRING );
|
||||
$dbcl_group = filter_input( INPUT_POST, 'dbcl_group', FILTER_SANITIZE_STRING );
|
||||
|
||||
$cache = wp_cache_get( $dbcl_key, $dbcl_group );
|
||||
if ( ! $cache ) {
|
||||
return wp_send_json_error();
|
||||
}
|
||||
ob_start();
|
||||
print_r( $cache );
|
||||
$cache = esc_html( ob_get_clean() );
|
||||
|
||||
return wp_send_json_success( array( 'cache' => $cache ) );
|
||||
}
|
||||
|
||||
add_action( 'wp_ajax_dbcl', 'dbcl_ajax' );
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
class Debug_Bar_Cache_Lookup extends Debug_Bar_Panel {
|
||||
|
||||
function init() {
|
||||
$this->title( esc_html__( 'Cache Lookup', 'dbcl' ) );
|
||||
}
|
||||
|
||||
function prerender() {
|
||||
global $wp_object_cache;
|
||||
$this->set_visible( is_object( $wp_object_cache ) && method_exists( $wp_object_cache, 'stats' ) );
|
||||
}
|
||||
|
||||
function render() {
|
||||
include DBCL_PATH . 'views/searchform.php';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
47
wordpress_plugins/debug-bar-cache-lookup/readme.txt
Normal file
47
wordpress_plugins/debug-bar-cache-lookup/readme.txt
Normal file
@@ -0,0 +1,47 @@
|
||||
=== Debug Bar Cache Lookup ===
|
||||
Contributors: collinsinternet
|
||||
Donate link:
|
||||
Tags: debug bar, object cache, memcached, memcache
|
||||
Requires at least: 3.9
|
||||
Tested up to: 4.5
|
||||
Stable tag: 0.1.1
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Look up items in object cache.
|
||||
|
||||
== Description ==
|
||||
Are you running an object cache like memcached? Want to see if cache is working?
|
||||
|
||||
|
||||
== Installation ==
|
||||
|
||||
= Manual Installation =
|
||||
|
||||
1. Upload the entire `/debug-bar-cache-lookup` directory to the `/wp-content/plugins/` directory.
|
||||
2. Activate Debug Bar Cache Lookup through the 'Plugins' menu in WordPress.
|
||||
3. When you activate the Debug Bar plugin, 'Cache Lookup' will be added to debug menu.
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= Why would I need this? =
|
||||
|
||||
Sometimes there are times when you need to verify that an object is being properly cached.
|
||||
Instead of using WP CLI or other tools, you can look it up from within the Debug Bar.
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
1. The 'Cache Lookup'.
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 0.1.1 =
|
||||
* Minor security update.
|
||||
|
||||
= 0.1.0 =
|
||||
* First release
|
||||
|
||||
== Upgrade Notice ==
|
||||
|
||||
= 0.1.1 =
|
||||
Security fixes.
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php /** View for the search form. **/ ?>
|
||||
<div id="dbcl_panel">
|
||||
<form id="dbcl_form">
|
||||
<p>Enter the cache key and cache group:</p>
|
||||
<p>
|
||||
<label for="dbcl_key">Key:</label>
|
||||
<input type="text" id="dbcl_key" name="dbcl_key"> <small>(Example: alloptions)</small>
|
||||
</p>
|
||||
<p>
|
||||
<label for="dbcl_group">Group:</label>
|
||||
<input type="text" id="dbcl_group" name="dbcl_group"> <small>(Example: options)</small>
|
||||
</p>
|
||||
<p class="center"><input type="submit" value="Lookup" class="button button-primary"></p>
|
||||
</form><br/>
|
||||
<pre id="dbcl_results"></pre>
|
||||
</div>
|
||||
Reference in New Issue
Block a user