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 | |
/** | |
* Check if transient cache exist, else set it. | |
* | |
* Refactored by https://github.com/charmoney for PHP_CodeSniffer WordPress Standards compliance and WP_Error handling. | |
* | |
* @see https://since1979.dev/snippet-008-using-transients-to-cache-data/ | |
* | |
* @uses get_transient() https://developer.wordpress.org/reference/functions/get_transient/ | |
* @uses is_callable() https://www.php.net/manual/en/function.is-callable.php |
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 | |
/* | |
* The ActionScheduler WordPress plugin removes 20 complete & canceled status actions older than | |
* the filtered `action_scheduler_retention_period` value in seconds. In large scale applications | |
* generating more than 20 actions per minute on average, this can cause run away growth of the | |
* wp_actionscheduler_actions and wp_actionscheduler_logs tables. | |
* | |
* This gist adds a second cleanup pass every time AS normally cleans up & runs the queue. | |
* | |
* No support provided. No warranties expressed or implied. |
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 | |
/** | |
* Determine if the current request is SSL. Set $_SERVER['HTTPS'] for WordPress' build in is_ssl(). | |
* | |
* @return True if the site uses ssl directly or through a load balancer | |
*/ | |
function greenpeace_is_ssl() { | |
$is_ssl = (isset( $_SERVER['HTTPS'] ) && 'on' === $_SERVER['HTTPS'] ) | |
|| (isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' === $_SERVER['HTTP_X_FORWARDED_PROTO']) |
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('rocket_htaccess_mod_expires', 'wp_rocket_adjust_html_expire_dreampress'); | |
/** | |
* Adjust expiration on HTML to prevent issue with Varnish cache | |
* | |
* @param string $rules htaccess rules. | |
* @return Updated htaccess rules | |
*/ | |
function wp_rocket_adjust_html_expire_dreampress( $rules ) { |
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 | |
/** | |
* Parse and process a CSV file using the Goodby CSV library, | |
* using a header row as associative array keys for the data | |
* | |
* https://github.com/goodby/csv | |
* @param string $csv_path Path to the CSV file | |
*/ | |
function process_csv($csv_path) { |