Skip to content

Instantly share code, notes, and snippets.

@stas
stas / crontab
Created August 1, 2012 12:51
WordPress tests svn git mirror scripts
*/1 * * * * stas ( cd /home/stas/wordpress-tests && ./update.sh ) >/dev/null 2>&1
@stas
stas / phantomjs_require.js
Created May 20, 2012 16:37
Phantom Nodify RequireJS support
// Lightweight implementation of Require.js AMD methods
// to make it work in a PhantomJS Node-ish environment
// You can map existin modules to requirejs_modules
// Ex.:
// `requirejs_modules['jquery'] = jQuery;`
// Require.js modules cache
exports.requirejs_modules = {};
// Make Require.js#requirejs work
@stas
stas / integration.js
Created April 23, 2012 11:16
An attempt to implement todomvc specs
describe('Todos Specifications', function() {
var title = 'Be awesome!';
var enterEvent = $.Event('keyup', { keyCode: 13 });
var main = document.getElementById('main');
var footer = document.getElementById('footer');
it('should not create an empty todo', function() {
$('#new-todo').val(' ');
$('#new-todo').trigger(enterEvent);
@stas
stas / phantomjs_mocha_runner.js
Created April 5, 2012 09:32
Phantom Nodify Mocha Runner
var app_libs = '/relative/path/to/your/other/js/libs/';
var nodify = '..' + app_libs + '/phantomjs-nodify/nodify.js';
phantom.injectJs(nodify);
nodify.run(
function() {
var fs = require('fs');
require.paths.push(fs.workingDirectory + app_libs);
diff --git wp-includes/media.php wp-includes/media.php
index e3b9008..757999d 100644
--- wp-includes/media.php
+++ wp-includes/media.php
@@ -725,6 +725,17 @@ add_shortcode('caption', 'img_caption_shortcode');
*/
function img_caption_shortcode($attr, $content = null) {
+ // Backwards compatibility for < v3.4.0 shortcode
+ if ( !isset( $attr['caption'] ) ) {
diff --git wp-includes/media.php wp-includes/media.php
index e3b9008..5958d37 100644
--- wp-includes/media.php
+++ wp-includes/media.php
@@ -726,7 +726,7 @@ add_shortcode('caption', 'img_caption_shortcode');
function img_caption_shortcode($attr, $content = null) {
// Allow plugins/themes to override the default caption template.
- $output = apply_filters('img_caption_shortcode', '', $attr, $content);
+ $output = apply_filters( 'img_caption_shortcode', '', $attr, do_shortcode( $content) );
diff --git a/wp-includes/media.php b/wp-includes/media.php
index e3b9008..2f0a586 100644
--- a/wp-includes/media.php
+++ b/wp-includes/media.php
@@ -743,12 +743,20 @@ function img_caption_shortcode($attr, $content = null) {
if ( $id ) $id = 'id="' . esc_attr($id) . '" ';
return '<div ' . $id . 'class="wp-caption ' . esc_attr($align) . '" style="width: ' . (10 + (int) $width) . 'px">'
- . do_shortcode( $content ) . '<p class="wp-caption-text">' . $caption . '</p></div>';
+ . do_shortcode( $content ) . '<p class="wp-caption-text">' . do_shortcode( $caption ) . '</p></div>';
<?php
/*
Plugin Name: TEST_DFW
Plugin URI: http://wordpress.org/extend/plugins/test_dfw/
Description: Test_dfw Description
Version: 0.1
Author: sushkov
Author URI: http://wordpress.org/extend/plugins/test_dfw/
*/
?>
@stas
stas / firewall.sh
Created February 6, 2012 15:49
iptables boilerplate, because no one did this till now
#!/bin/bash
IFNET="eth0"
IPNET="8.8.8.8"
PORTS="20 21 25 80 8000 8888 12000 12001 12002 12003"
BANLIST="64.205.0.18"
if [ "$1" = "start" ]; then
echo "Starting firewall..."
@stas
stas / post-receive.sh
Created February 4, 2012 21:18
Heroku like deployment git hooks
#!/bin/bash
# (Re)spawn the application
function spawn () {
local ps_name=$1
local spawn_cmd=$2
local pids=`ps -C $ps_name -o pid=`
if [ ${#pids} -ne 0 ]
then
echo "Sending TERM to $pids..."