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
/** | |
* Executes an OPTIMIZE TABLE statement on all WordPress database | |
* tables. | |
*/ | |
public static function saotn_wpdb_optimizer() { | |
global $wpdb; | |
$tables = $wpdb->get_col( "SHOW TABLES" ); | |
foreach ( $tables as $table ) { | |
$wpdb->query( "OPTIMIZE TABLE $table" ); | |
} |
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 | |
/** | |
* PHP/cURL function to check a web site status. If HTTP status is not 200 or 302, or | |
* the requests takes longer than 10 seconds, the website is unreachable. | |
* | |
* Follow me on Twitter: @Jan_Reilink | |
* | |
* @param string $url URL that must be checked | |
*/ | |
function url_test($url) { |
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: Saotn Database Table Optimizer | |
* Plugin URI: https://www.saotn.org | |
* Description: Optimizes WordPress database behind the scenes by executing an OPTIMIZE TABLE statement on all MySQL tables, 'daily' or 'hourly'. Please <a rel="nofollow" target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4EFPSXA623NZA" title="donate to Sysadmins of the North">donate $2.50 USD</a> through PayPal to support me in my research time and hosting costs. | |
* Version: 1.0.2 | |
* Author: Jan Reilink | |
* Author URI: https://www.saotn.org | |
* License: GPLv2 | |
*/ |
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
# blacklistcheck.ps1 - PowerShell script to check | |
# an IP address blacklist status | |
# | |
# Follow me on Twitter: @Jan_Reilink | |
# | |
# Steps: | |
# 1. IPv4 IP address input from the command-line: | |
# .\blacklistcheck.ps1 1.2.3.4 | |
# 2. reverse the IP address: 1.2.3.4 becomes 4.3.2.1 | |
# 3. append the blacklist zone, e.g .cbl.abuseat.org. |
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 | |
/* | |
* enqueue adsbygoogle.js in the footer & | |
* create a WordPress shortcode with your Google AdSense code | |
* follow me on Twitter: @Jan_Reilink | |
*/ | |
function saotn_loadAdsByGoogleJs() { | |
wp_register_script( 'google-adsense', '//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js', '', '', true ); | |
wp_enqueue_script( 'google-adsense' ); |
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 | |
function saotn_post_prerender_prefetch() { | |
/* follow me on Twitter: @Jan_Reilink */ | |
$next_post = get_next_post(); | |
$prev_post = get_previous_post(); | |
if ( !empty( $next_post ) ) { | |
echo '<link rel="prefetch" href="'.get_permalink( $next_post->ID ).'" /> | |
<link rel="prerender" href="'.get_permalink( $next_post->ID ).'" />'; | |
} | |
if ( !empty( $prev_post ) ) { |
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 | |
/** | |
* Disable PHP script execution for WordPress wp-content/uploads folder. | |
* - based off the WordPress permalinks rewrite code | |
* | |
* - https://www.saotn.org/secure-wordpress-uploads-folder-disable-php-execution/ | |
* - follow me on twitter: @Jan_Reilink | |
* | |
* don't allow this file to be loaded directly | |
*/ |
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 | |
/* | |
* https://www.saotn.org/enable-http-strict-transport-security-hsts-on-iis/ | |
* follow me on Twitter: @Jan_Reilink | |
*/ | |
add_action( 'send_headers', 'saotn_add_hsts_header' ); | |
function saotn_add_hsts_header() { | |
header( 'Strict-Transport-Security: max-age=31536000; includeSubDomains; preload' ); | |
} |
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
--- cache_enabler_disk.class.php.org 2016-09-26 07:24:22.000000000 +0200 | |
+++ cache_enabler_disk.class.php 2016-10-24 16:33:54.145108306 +0200 | |
@@ -24,7 +24,9 @@ | |
*/ | |
const FILE_HTML = 'index.html'; | |
+ const FILE_HTML_MOBILE = 'index-mobile.html'; | |
const FILE_GZIP = 'index.html.gz'; | |
+ const FILE_GZIP_MOBILE = 'index-mobile.html.gz'; | |
const FILE_WEBP_HTML = 'index-webp.html'; |
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: Make Read Only & Clear Read Only WordPress | |
* Plugin URI: https://www.saotn.org | |
* Description: Makes all WordPress files read-only after updates, and writable just before updates. This should ease WordPress updates when it's read-only on the file system. Please donate <a rel="nofollow" target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=J24FGGU96YSUY" title="donate to Sysadmins of the North in Dollars">$2.50 USD</a> (or <a rel="nofollow" target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QLX4RPPL3L8LY" title="donate to Sysadmins of the North in Euros">€ 2,50 Euro</a>) through PayPal to support me in my research time and hosting costs. | |
* Network: True | |
* Version: 1.0 | |
* Author: Jan Reilink | |
* Author URI: https://www.saotn.org | |
* License: GPLv2 |
OlderNewer