Skip to content

Instantly share code, notes, and snippets.

@kurtpayne
kurtpayne / my-plugin.php
Created March 21, 2012 18:56
Test dbDelta
<?php
/*
Plugin Name: My Plugin
Description: Test dbDelta
Version: 0.1
*/
// Upgrade when the admin loads
add_action( 'admin_init', 'myplugin_upgrade' );
@kurtpayne
kurtpayne / make_clickable.patch
Created March 20, 2012 20:38
Patch make_clickable
Index: W:/wordpress-unit-tests/wordpress/wp-includes/formatting.php
===================================================================
--- W:/wordpress-unit-tests/wordpress/wp-includes/formatting.php (revision 20220)
+++ W:/wordpress-unit-tests/wordpress/wp-includes/formatting.php (working copy)
@@ -1484,7 +1484,7 @@
$ret = " $ret "; // Pad with whitespace to simplify the regexes
$url_clickable = '~
- ([\\s(<.,;:!?]) # 1: Leading whitespace, or punctuation
+ ([\\s(<>.,;:!?]) # 1: Leading whitespace, or punctuation
@kurtpayne
kurtpayne / memoization.php
Created March 20, 2012 19:04
PHP Memoization
<?php
function args_to_key($args) {
$tmp = array();
$it = new RecursiveIteratorIterator(new RecursiveArrayIterator($args));
foreach($it as $v) {
if (is_object($v)) {
$tmp[] = spl_object_hash($v);
} elseif (is_scalar($v)) {
$tmp[] = $v;
@kurtpayne
kurtpayne / wp_remote_get.diff
Created March 10, 2012 03:17
Use wp_remote_get instead of curl
Index: github_gist_wordpress_plugin.php
===================================================================
--- github_gist_wordpress_plugin.php (revision 517091)
+++ github_gist_wordpress_plugin.php (working copy)
@@ -46,13 +46,12 @@
}
function get_content_from_url($url) {
- $ch = curl_init();
- curl_setopt($ch,CURLOPT_URL,$url);
<?php
if ( !defined('P3_PATH') )
die( 'Forbidden ');
/**
* Performance Profile Reader
*
* @author GoDaddy.com
* @version 1.0
* @package P3_Profiler
@kurtpayne
kurtpayne / install.php
Created February 21, 2012 00:55
W3TC Autoconfigurator
<?php
// Activate W3 Total Cache
if ( file_exists( WP_PLUGIN_DIR . '/w3-total-cache/w3-total-cache.php' ) )
activate_plugin( WP_PLUGIN_DIR . '/w3-total-cache/w3-total-cache.php' , admin_url() );
// Load host specific W3TC config
if ( defined( 'W3TC_CONFIG_PATH' ) ) {
// Set the configuration path based on the platform's abilities