Skip to content

Instantly share code, notes, and snippets.

@kurtpayne
kurtpayne / phpl.sh
Last active April 8, 2019 01:17
WordPress Unit Tests Jenkins Config
#!/bin/bash
find $1 \( -type f -and \( -name "*.php" -or -name "*.inc" -or -name "*.phtml" \) \) -exec php -l {} \; | grep -v "No syntax errors"
@kurtpayne
kurtpayne / class-wp-image-editor-base.php
Created September 6, 2012 18:24
Abstract that thing
<?php
abstract class WP_Image_Editor_Base {
protected $file = false;
protected $size = false;
protected $orig_type = false;
protected $quality = 90;
public function __construct( $filename ) {
xdebug_start_trace();
@kurtpayne
kurtpayne / 6821-resize-unit-test.patch
Created September 12, 2012 23:08
6821 image_resize unit test
Index: tests/image/resize.php
===================================================================
--- tests/image/resize.php (revision 1017)
+++ tests/image/resize.php (working copy)
@@ -123,4 +123,23 @@
unlink($image);
}
+ /**
+ * Try resizing a non-existent image
@kurtpayne
kurtpayne / 6821-unit-tests-3.patch
Created September 21, 2012 22:47
6821 unit tests
Index: includes/mock-image-editor.php
===================================================================
--- includes/mock-image-editor.php (revision 0)
+++ includes/mock-image-editor.php (working copy)
@@ -0,0 +1,38 @@
+<?php
+
+class WP_Image_Editor_Mock extends WP_Image_Editor {
+
+ public static $load_return = true;
@kurtpayne
kurtpayne / 6821-unit-test-super-fun.patch
Created October 30, 2012 19:46
6821 unit test super fun
Index: includes/mock-image-editor.php
===================================================================
--- includes/mock-image-editor.php (revision 1108)
+++ includes/mock-image-editor.php (working copy)
@@ -5,13 +5,12 @@
class WP_Image_Editor_Mock extends WP_Image_Editor {
public static $load_return = true;
- public static $test_return = true;
@kurtpayne
kurtpayne / p3-scanner.php
Created November 20, 2012 20:41
Customize P3's Auto Scan URLs
<?php
/*
Plugin Name: P3 Custom Scanner
Plugin URI: http://inside.godaddy.com/
Description: Customize the pages scanned by P3's auto scan mode
Author: GoDaddy.com
Version: 1.0
Author URI: http://www.godaddy.com/
*/
@kurtpayne
kurtpayne / 3.5.1 output
Last active December 11, 2015 16:19
Unit tests for 3.5.1
kpayne@localhost:/cygdrive/c/wamp/www/wordpress-unit-tests$ svn status
X data/plugins/wordpress-importer
X data/wpcom-themes
X wordpress
Performing status on external item at 'data/wpcom-themes':
Performing status on external item at 'data/plugins/wordpress-importer':
Performing status on external item at 'wordpress':
@kurtpayne
kurtpayne / cookies.php
Created February 6, 2013 17:39
WordPress and cURL cookies
<?php
// Create a cookie file
require_once ABSPATH . 'wp-admin/includes/file.php';
$cookie_file = wp_tempnam();
// Create a callback to let curl save cookies there
$cookie_saver = function( $ch ) use ( $cookie_file ) {
curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie_file );
curl_setopt( $ch, CURLOPT_COOKIEFILE, $cookie_file );
@kurtpayne
kurtpayne / mysql_error_catcher.php
Last active December 20, 2015 15:28
First pass at catching rogue mysql_* calls in themes and plugins.
<?php
set_error_handler( function( $errno, $errstr, $errfile) {
if ( 'wp-db.php' !== basename( $errfile ) ) {
if ( preg_match( '/^(mysql_[a-zA-Z0-9_]+)/', $errstr, $matches ) ) {
_doing_it_wrong( $matches[1], 'Please talk to the database using $wpdb', '3.7' );
return apply_filters( 'wpdb_drivers_raw_mysql_call_trigger_error', true );
}
}
{
"offers": [
{
"response": "upgrade",
"download": "https:\/\/wordpress.org\/wordpress-3.7.1.zip",
"locale": "en_US",
"packages": {
"full": "https:\/\/wordpress.org\/wordpress-3.7.1.zip",
"no_content": "https:\/\/wordpress.org\/wordpress-3.7.1-no-content.zip",
"new_bundled": "https:\/\/wordpress.org\/wordpress-3.7.1-new-bundled.zip",