Skip to content

Instantly share code, notes, and snippets.

@mymizan
Created November 23, 2020 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mymizan/61c2be0f6ec0f8fc6eae98ecf922d55d to your computer and use it in GitHub Desktop.
Save mymizan/61c2be0f6ec0f8fc6eae98ecf922d55d to your computer and use it in GitHub Desktop.
<?php
/**
* Disable certain security features on development machines.
*
* @class WOO_MSTORE_SINGLE_DEV_ENV
* @since 3.0.6
*/
class WOO_MSTORE_SINGLE_DEV_ENV {
public function __construct() {
add_action('init', array($this, 'init'), 10, 0);
}
public function init() {
// disable curl SSL validation.
add_filter('http_request_args', array($this, 'disable_ssl_validation'), 10, 2);
add_filter('http_request_reject_unsafe_urls', array($this, 'reject_unsafe_url'), 10, 2);
}
public function disable_ssl_validation( $params, $url ) {
$params['sslverify'] = false;
return $params;
}
public function reject_unsafe_url( $flag, $url ) {
return false;
}
}
$GLOBALS['WOO_MSTORE_SINGLE_DEV_ENV'] = new WOO_MSTORE_SINGLE_DEV_ENV();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment