Skip to content

Instantly share code, notes, and snippets.

@stas
stas / deps-manager.class
Created October 5, 2011 19:31
WordPress Plugins Dependency Manger
<?php
require_once ABSPATH . '/wp-admin/includes/file.php';
require_once ABSPATH . '/wp-admin/includes/plugin.php';
require_once ABSPATH . '/wp-admin/includes/plugin-install.php';
require_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.php';
/**
* Main Deps Manager Class
*/
require 'gettext/tools.rb'
require 'tenjin'
require 'ruby_parser'
require 'gettext_i18n_rails/ruby_gettext_extractor'
begin
require 'gettext/tools/rgettext'
rescue LoadError #version prior to 2.0
require 'gettext/rgettext'
<?php
/*
Plugin Name: Courseware Hacks
*/
function cw_hack_tabs() {
global $wp_filter;
foreach ( reset( $wp_filter['courseware_group_nav_options'] ) as $k => $v ){
$klass = reset( $v['function'] );
$method = end( $v['function'] );
# Memcache
memcache_options = {
:compression => false,
:username => ENV['MEMCACHE_USERNAME'],
:password => ENV['MEMCACHE_PASSWORD'],
:servers => ENV['MEMCACHE_SERVERS'].split(',')
}
Ramaze::Cache.options.session = Ramaze::Cache::MemCache
Ramaze::Cache.options.settings = Ramaze::Cache::MemCache
Ramaze::Cache.options.view = Ramaze::Cache::MemCache
# Setup Memcache
['session', 'settings', 'view'].each do |option|
Ramaze::Cache.options.send(
option + '=',
Ramaze::Cache::MemCache.using(
:compression => false,
:username => ENV['MEMCACHE_USERNAME'],
:password => ENV['MEMCACHE_PASSWORD'],
:servers => ENV['MEMCACHE_SERVERS'].split(',')
)
@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..."
@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..."
<?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/
*/
?>
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>';
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) );