Last active
March 21, 2021 18:35
-
-
Save afragen/a30b7766d8eb1aa22018130dfd5034f4 to your computer and use it in GitHub Desktop.
A simple plugin for adding filters/code for plugin testing.
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: Site Testing | |
* Plugin URI: https://gist.github.com/afragen/a30b7766d8eb1aa22018130dfd5034f4 | |
* Description: This plugin is used for site testing. | |
* Version: 0.4 | |
* Author: Andy Fragen | |
* License: MIT | |
* Requires at least: 5.2 | |
* Requires PHP: 7.1 | |
* Gist Plugin URI: https://gist.github.com/afragen/a30b7766d8eb1aa22018130dfd5034f4 | |
*/ | |
/** | |
* Git Updater filter testing. | |
*/ | |
add_filter( | |
'gu_override_dot_org', | |
function ( $overrides ) { | |
return array_merge( | |
$overrides, | |
[ | |
'wp-simple-calendar/wp-simple-calendar.php', | |
// 'the-events-calendar/the-events-calendar.php', | |
] | |
); | |
} | |
); | |
// Test for entering negative number, absint() should convert to positive integer. | |
// Default return is 1. | |
add_filter( | |
'gu_number_rollbacks', | |
function() { | |
return -2; | |
} | |
); | |
// Fix for mailgun and GitHub Updater. | |
// add_filter( | |
// 'gu_unset_auth_header', | |
// function ( $hosts ) { | |
// return array_merge( $hosts, [ 'api.mailgun.net' ] ); | |
// } | |
// ); | |
// add_filter( 'github_updater_disable_wpcron', '__return_true' ); | |
/** | |
* Git Remote Updater filter testing. | |
*/ | |
add_filter( | |
'git_remote_updater_remove_site_data', | |
function () { | |
return [ 'caldera-forms' ]; | |
} | |
); | |
// Shorten transient timeout for testing, default is 5 minutes. | |
add_filter( | |
'git_remote_updater_repo_transient_timeout', | |
function () { | |
return 5; | |
} | |
); | |
/** | |
* WP Debugging filter testing. | |
*/ | |
add_filter( | |
'wp_debugging_add_constants', | |
function ( $added_constants ) { | |
$my_constants = [ | |
'ITSEC_DEBUG' => [ 'value' => 'true' ], | |
]; | |
return array_merge( $added_constants, $my_constants ); | |
}, | |
10, | |
1 | |
); | |
/** | |
* Add CPT Featured Image WP Recipe testing. | |
*/ | |
add_filter( | |
'acfi_wprm_cpt_slug', | |
function ( $cpt_slug ) { | |
// $cpt_slug = 'test'; | |
return $cpt_slug; | |
} | |
); | |
/** | |
* Miscellaneous. | |
*/ | |
// Fixes https://core.trac.wordpress.org/ticket/25239. | |
add_action( | |
'init', | |
function () { | |
$wp_version = get_bloginfo( 'version' ); | |
if ( defined( 'WP_CLI' ) && WP_CLI | |
&& version_compare( $wp_version, '5.5-RC2', '<' ) | |
) { | |
$_SERVER['SERVER_NAME'] = isset( $_SERVER['SERVER_NAME'] ) ? $_SERVER['SERVER_NAME'] : parse_url( network_home_url(), PHP_URL_HOST ); | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment