wordpress-localhost-https-d.../localhost-https-development.php
2024-10-03 15:27:19 +02:00

47 lines
1.3 KiB
PHP

<?php
/**
* Plugin Name: Localhost https Development
* Description: Allows for developing https locally together with other apps.
* Version: 0.1.0
* Author: André Menrath
* Text Domain: localhost-https-dev
* License: AGPL-3.0-or-later
* License URI: https://www.gnu.org/licenses/agpl-3.0.de.html
* Requires PHP: 8.1
*
* Requires at least ActivityPub plugin with version >= 3.2.2. ActivityPub plugin tested up to: 3.2.2.
*
* @license AGPL-3.0-or-later
* @package LocalHost_Https_Dev
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
/**
* Add a filter for http_request_host_is_external
*/
add_filter( 'http_request_host_is_external', 'activitypub_event_bridge_custom_http_request_host_is_external', 10, 3 );
/**
* Add a filter for http_request_host_is_external
*
* @param bool $is_external Whether the request is external.
*/
function activitypub_event_bridge_custom_http_request_host_is_external( $is_external ) {
$is_external = true;
return $is_external;
}
/**
* Don't verify ssl certs for testing.
*/
add_filter( 'https_ssl_verify', 'activitypub_event_bridge_dont_verify_local_dev_https', 10, 3 );
/**
* Do not verify.
*/
function activitypub_event_bridge_dont_verify_local_dev_https() {
return false;
}