Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
☕️

Jan Reilink Digiover

💭
☕️
View GitHub Profile
@Digiover
Digiover / use-http11-in-wordpress.php
Created Apr 30, 2020
Forces HTTP/1.1 for outgoing connections in WordPress instead of HTTP 1.0
View use-http11-in-wordpress.php
<?php
/**
* Plugin Name: Use HTTP/1.1 in WordPress
* Plugin URI: https://www.saotn.org/
* Donate URI: https://www.paypal.me/jreilink
* Description: MU Plugin. Forces HTTP/1.1 for outgoing connections in WordPress instead of HTTP 1.0
* Network: True
* Version: 1.0
* Author: Jan Reilink
* Author URI: https://www.saotn.org
@Digiover
Digiover / saotn-flush-memcached.php
Last active Nov 12, 2018
Flush PHP memcacheD cache in WordPress - Flushes PHP memcached cache upon publish_post action. By clearing the opcode cache in memory you immediately can see a new or changed post
View saotn-flush-memcached.php
<?php
/**
* Plugin Name: Flush MemcacheD cache
* Plugin URI: https://www.saotn.org/
* Donate URI: https://www.paypal.me/jreilink
* Description: Flushes PHP memcached cache upon publish_post action. By clearing the opcode cache in memory you immediately can see a new or changed post. Use as a Must-Use Plugin.
* Network: True
* Version: 1.2
* Author: Jan Reilink
* Author URI: https://www.saotn.org
@Digiover
Digiover / clear-opcode-caches.php
Last active Nov 12, 2018
WordPress: Clear PHP opcode caches before updates are applied, ease the updating process (https://www.saotn.org/wordpress-plugin-flush-php-opcache/)
View clear-opcode-caches.php
<?php
/**
* Plugin Name: Clear PHP opcode caches
* Plugin URI: https://www.saotn.org/wordpress-plugin-flush-php-opcache/
* Donate URI: https://www.paypal.me/jreilink
* Description: Purges various PHP opcode and user caches. Currently it tries to clear / purge / flush PHP OPcache and WinCache caches from your web server's memory. This should ease WordPress updates and plugin activation / deactivation.
* Network: True
* Version: 1.2
* Author: Jan Reilink
* Author URI: https://www.saotn.org
@Digiover
Digiover / web.config
Created Jan 16, 2018
ASP.NET set httpOnly and RequireSSL cookies
View web.config
<httpCookies httpOnlyCookies="true" requireSSL="true" />
<!-- With domain: <httpCookies domain="www.saotn.org" httpOnlyCookies="true" requireSSL="true" /> -->
@Digiover
Digiover / web.config
Created Jan 16, 2018
Encrypt ASP.NET ViewState
View web.config
<machineKey
validationKey="AutoGenerate,IsolateApps"
decryptionKey="AutoGenerate,IsolateApps"
validation="AES" decryption="Auto"
/>
@Digiover
Digiover / make-readonly.php
Last active Nov 23, 2016
Make WordPress writable before, and read-only after, WordPress updates with this MU-Plugin
View make-readonly.php
<?php
/**
* Plugin Name: Make Read Only &amp; 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&amp;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&amp;hosted_button_id=QLX4RPPL3L8LY" title="donate to Sysadmins of the North in Euros">&euro; 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
@Digiover
Digiover / cache_enabler_disk.class.php.patch
Created Oct 25, 2016
Diff for cache_enabler_disk.class.php to add wp_is_mobile() support to KeyCDN's Cache Enabler plugin
View cache_enabler_disk.class.php.patch
--- 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';
@Digiover
Digiover / add-hsts-to-wordpress.php
Last active Oct 7, 2016
Add HSTS to WordPress using a send_headers action
View add-hsts-to-wordpress.php
<?php
/*
* https://www.saotn.org/enable-http-strict-transport-security-hsts-on-iis/
* follow me on Twitter: @HertogJanR
*/
add_action( 'send_headers', 'saotn_add_hsts_header' );
function saotn_add_hsts_header() {
header( 'Strict-Transport-Security: max-age=31536000; includeSubDomains; preload' );
}
@Digiover
Digiover / disable_php_script_execution.php
Created Aug 29, 2016
Function to disable PHP script execution for WordPress wp-content/uploads folder
View disable_php_script_execution.php
<?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: @HertogJanR
*
* don't allow this file to be loaded directly
*/
@Digiover
Digiover / Enfold-WordPress-theme-no-session-support.php
Last active Oct 30, 2017
Kriesi Enfold theme - remove session support, if not using Enfold's breadcrumbs
View Enfold-WordPress-theme-no-session-support.php
<?php
add_theme_support('avia_no_session_support');