Snippi
A super awesome snippet tool.
- 1.
<?php
- 2.
// Load WordPress.
- 3.
require( 'wp-load.php' );
- 4.
- 5.
$filename = sprintf( 'wp-rocket-settings-%s-%s.json', date( 'Y-m-d' ), uniqid() );
- 6.
//$gz = 'gz' . strrev( 'etalfed' );
- 7.
$options = wp_json_encode( get_option( 'wp_rocket_settings' ) ); // do not use get_rocket_option() here.
- 8.
nocache_headers();
- 9.
@header( 'Content-Type: application/json' );
- 10.
@header( 'Content-Disposition: attachment; filename="' . $filename . '"' );
- 11.
@header( 'Content-Transfer-Encoding: binary' );
- 12.
@header( 'Content-Length: ' . strlen( $options ) );
- 13.
@header( 'Connection: close' );
- 14.
echo $options;
- 15.
exit();