This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class relative_URI { | |
function relative_URI() { | |
add_action('get_header', array(&$this, 'get_header'), 1); | |
add_action('wp_footer', array(&$this, 'wp_footer'), 99999); | |
} | |
function replace_relative_URI($content) { | |
$home_url = trailingslashit(get_home_url('/')); | |
$parsed = parse_url($home_url); | |
$replace = $parsed['scheme'] . '://' . $parsed['host']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('template_redirect', function(){ | |
if ( headers_sent() ) { | |
return; | |
} | |
do_action('wp_enqueue_scripts'); | |
foreach( array('style' => wp_styles(), 'script' => wp_scripts()) as $as => $wp_links ) { | |
$link = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DIST_IDS=$(aws cloudfront list-distributions | jq -r '.DistributionList.Items[] | select(.IsIPV6Enabled == false) | .Id') | |
for DIST_ID in ${DIST_IDS}; do | |
ETAG=$(aws cloudfront get-distribution --id ${DIST_ID} | jq -r '.ETag') | |
CONFIG_JSON=$(mktemp) | |
jq -s '.[0] * .[1]' <(aws cloudfront get-distribution --id "${DIST_ID}" | jq '.Distribution.DistributionConfig') <(echo '{"IsIPV6Enabled": true}') > ${CONFIG_JSON} | |
aws cloudfront update-distribution --id ${DIST_ID} --distribution-config file://${CONFIG_JSON} --if-match ${ETAG} | |
rm -f ${CONFIG_JSON} | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
SHELLDIR=`dirname ${0}` | |
SHELLDIR=`cd ${SHELLDIR}; pwd` | |
SHELLNAME=`basename $0` | |
LOG_DIR="/var/log" | |
LOG_SAVE_PERIOD=14 | |
LOG_FILE="${LOG_DIR}/${SHELLNAME}.log" | |
AZ=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | jq -r '.prefixes[] | select(.service=="CLOUDFRONT") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo /opt/local/provision | |
$ nginx -v | |
nginx version: nginx/1.13.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'wp_is_mobile', function( $is_mobile ) { | |
// CloudFront でスマートフォンと判定された場合、true を返す。 | |
if ( isset($_SERVER['HTTP_CLOUDFRONT_IS_MOBILE_VIEWER']) && "true" === $_SERVER['HTTP_CLOUDFRONT_IS_MOBILE_VIEWER'] ) { | |
$is_mobile = true; | |
} | |
// CloudFront でタブレットと判定された場合、true を返す。 | |
// (タブレットはPCと同じ扱いにしたい場合は、$is_mobile を false にする | |
if ( isset($_SERVER['HTTP_CLOUDFRONT_IS_TABLET_VIEWER']) && "true" === $_SERVER['HTTP_CLOUDFRONT_IS_TABLET_VIEWER'] ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// CloudFront で Cookie key wordpress_last_visit をオリジンに渡すようにしておくこと | |
add_action( 'plugins_loaded', function(){ | |
if ( is_user_logged_in() ) { | |
setcookie( 'wordpress_last_visit', time() ); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
wp_cache_delete ( 'alloptions', 'options' ); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: WP CF7 to Backlog | |
Plugin URI: | |
Description: | |
Author: wokamoto | |
Version: 0.0.1 | |
*/ | |
include_once( ABSPATH . WPINC . '/class-IXR.php' ); |