- Event type:
ObjectCreated
- Suffix:
jpg
AWS_KEY
AWS_SECRET
KRAKEN_SECRET
/** | |
* Time-to-live in seconds for cached requests. | |
*/ | |
const cacheTtl = 300; | |
/** | |
* List of request paths to cache. | |
*/ | |
const cachedPaths = [ |
<?php | |
if ( ! is_admin() ) { | |
add_action( 'parse_query', function( $query ) { | |
if ( $query->is_search ) { | |
unset( $_GET['s'], $_POST['s'], $_REQUEST['s'] ); | |
$query->set( 's', '' ); | |
$query->is_search = false; | |
$query->set_404(); | |
header( $_SERVER[ 'SERVER_PROTOCOL' ] . ' 404 Not Found' ); |
<?php | |
use Aws\S3\S3Client; | |
use ZipStream\ZipStream; // https://github.com/maennchen/ZipStream-PHP | |
use GuzzleHttp\Client as HttpClient; | |
protected function streamAsZip($files) | |
{ | |
$s3 = S3Client::factory('...'); | |
$zip = new ZipStream("foobar.zip"); |
<?php | |
// changes CSS and JavaScript URLs from `css/style.css?ver=1.3.3.7` to `css/style.1.3.3.7.css` | |
if ( ! is_admin() ) { | |
foreach ( array( 'style_loader_src', 'script_loader_src' ) as $filter ) { | |
add_filter( $filter, function( $url ) { | |
// abort if `$url` doesn't start with `WP_CONTENT_URL` |
<?php | |
// increase `timeout` for `api.wordpress.org` requests | |
add_filter( 'http_request_args', function( $request, $url ) { | |
if ( strpos( $url, '://api.wordpress.org/' ) !== false ) { | |
$request[ 'timeout' ] = 15; | |
} | |
return $request; |
<?php | |
// add query string cache buster to W3TC minified stylesheet links | |
add_action( 'init', function() { | |
// is css minify enabled? | |
if ( isset( $GLOBALS[ '_w3tc_ob_callbacks' ][ 'minify' ] ) && $GLOBALS[ '_w3tc_ob_callbacks' ][ 'minify' ][0]->_config->get_cache_option( 'minify.css.enable' ) ) { | |
// store original minify callback | |
$GLOBALS[ '_w3tc_ob_callbacks' ][ 'minify-org' ] = $GLOBALS[ '_w3tc_ob_callbacks' ][ 'minify' ]; |
<?php | |
add_action( 'pre_option_image_default_link_type', function() { | |
return 'none'; // 'file', 'post' or 'none' | |
}); |
<?php | |
add_action( 'template_redirect', function() { | |
global $wp_query; | |
if ( is_home() || $wp_query->is_singular( 'post' ) || $wp_query->is_post_type_archive( 'post' ) ) { | |
header( $_SERVER[ 'SERVER_PROTOCOL' ] . ' 404 Not Found' ); | |
$wp_query->set_404(); | |
} |
I hereby claim:
To claim this, I am signing this object: