Skip to content

Instantly share code, notes, and snippets.

View JDGrimes's full-sized avatar

J.D. Grimes JDGrimes

View GitHub Profile
@JDGrimes
JDGrimes / jds-dev-tools.php
Created April 4, 2014 21:13
My development tools
<?php
/**
* Plugin Name: J.D.'s Dev Tools
* Version: 0.9.9-beta-5
* Description: My development tools.
* Author: J.D. Grimes
* Author URI: http://codesymphony.co/
*/
<?php
// Can be called whenever.
function add_admin_notice( $code, $message, $type = 'error' ) {
global $wp_admin_notices;
if ( ! isset( $wp_admin_notices ) )
$wp_admin_notices = array();
$wp_admin_notices[] = array(
@JDGrimes
JDGrimes / class-wordpoints-module.php
Created May 30, 2015 20:31
Module API that never happened
<?php
/**
* Class to provide a bootstrap for modules.
*
* @package WordPoints
* @since 1.10.0
*/
/**
@JDGrimes
JDGrimes / testcase.php
Created June 16, 2015 19:42
backup globals whitelist for PHPUnit test case
/**
* A list of global variables to back up.
*
* @since 2.0.0
*
* @var string|string[]
*/
protected $backup_globals;
/**
* Test that points hooks that don't auto-reverse don't refire after import.
*
* @since 1.0.0
*/
public function test_imported_non_auto_reversing_hook_does_not_refire() {
$legacy_slug = 'comment';
$settings = array(
@JDGrimes
JDGrimes / ExpectedSlashed.php
Created September 13, 2016 13:17
WIP PHPCS sniff for functions that expect slashed data in WordPress
<?php
/**
* Sniff for data that is expected to be slashed.
*
* Some WordPress core functions expect the data passed to them to be slashed, for
* legacy reasons.
*
* @package WordPress-Coding-Standards
* @since 0.10.0
*/
@JDGrimes
JDGrimes / wp-time-test.php
Last active March 31, 2017 20:31
Tests different methods of timezone handling in WordPress.
<?php
class WP_Time_Test extends WP_UnitTestCase {
public function test_strtotime() {
$offset = -5;
update_option( 'gmt_offset', $offset );
update_option( 'timezone_string', 'America/New_York' );
@JDGrimes
JDGrimes / wp-spamshield-bypass-for-edd-sl.php
Created May 26, 2017 19:48
Bypasses WP-SpamShield blocking for Easy Digital Downloads Software Licenses requests.
<?php
/**
* Plugin Name: WP-SpamShield Bypass for EDD SL
* Author: J.D. Grimes
* Author URI: https://codesymphony.co/
* Plugin URI: https://codesymphony.co/
* Version: 1.0.0
* License: GPLv2+
* Description: Bypasses WP-SpamShield blocking for Easy Digital Downloads Software Licenses requests.
@JDGrimes
JDGrimes / debug-hooks.php
Created February 15, 2014 14:42
WordPress plugin providing some functions to debug actions and filters.
<?php
/**
* Plugin Name: Debug Hooks
* Author: J.D. Grimes & Some other guy on the net
* Version: $ver$
* Description: Adds some functions you can use to debug actions and filters.
*/
/**