Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Don't update this plugin
*
* This prevents you from being prompted to update if there's a public plugin
* with the same name.
*
* @author Phil Wylie
* @link http://link.from.pw/1cFfcFZ
* @param array $r Request arguments
@mindctrl
mindctrl / readme.php
Last active August 29, 2015 14:01 — forked from sudar/readme.php
Automatically update a download's version number and change log using a readme.txt file with the Easy Digital Downloads Software Licensing extension.
<?php
/*
Plugin Name: EDD Readme Parsing Enhancements
Description: Updates a Download's current version and change log fields when using the readme.txt parsing feature in Easy Digital Downloads.
*/
/**
* Filters the EDD readme.txt parser response and updates the
* download's current version and change log fields.
*/
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.
<?php
function ttf_get_make_stats() {
// Make remote request to WP.org
$response = wp_remote_post(
'http://api.wordpress.org/themes/info/1.0/',
array(
'body' => array(
'action' => 'theme_information',
'request' => serialize( (object) array(
<?php
/**
* Integrate Imager.js with WordPress
*
* Imager.js is BBC's solution for serving responsive and retina images, without
* the double payload issues that affect other solutions. For more information:
*
* https://github.com/BBC-News/Imager.js/
*
* This collection of functions modifies the output of WordPress's
function random_lipsum($amount = 1, $what = 'paras') {
$start = rand(0,30);
return simplexml_load_file("http://www.lipsum.com/feed/xml?amount=$amount&what=$what&start=$start")->lipsum;
}
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.
INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
<?php
/*
Plugin Name: WP_Rewrite endpoints demo
Description: A plugin giving example usage of the WP_Rewrite endpoint API
Plugin URI: http://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/
Author: Jon Cave
Author URI: http://joncave.co.uk/
*/
function makeplugins_endpoints_add_endpoint() {

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.