email working - remove clients - preview polish

This commit is contained in:
stack_admn committed 2026-11-01 21:41:37 -08:00
1 parent 2b1424d127
commit da83beaec3
19 files changed
+1342 -1060

No files matched your search

+25 -3
View File
@@ -44,10 +44,11 @@ class HSSM_API_Client {
$full_url = trailingslashit( $api_url ) . $endpoint;
$args = array(
'timeout' => 15,
'headers' => array(
'timeout' => 15,
'sslverify' => $this->should_verify_ssl( $full_url ),
'headers' => array(
'X-HSSM-API-Key' => $api_key,
'Accept' => 'application/json',
'Accept' => 'application/json',
),
);
@@ -82,6 +83,27 @@ class HSSM_API_Client {
*
* @since 1.1.0
*/
/**
* Verify SSL except on local Local/WP Engine hosts with self-signed certs.
*
* @since 1.1.3
* @param string $url Request URL.
* @return bool
*/
private function should_verify_ssl( $url ) {
$host = wp_parse_url( $url, PHP_URL_HOST );
$local_hosts = array( 'localhost', '127.0.0.1' );
$is_local = in_array( $host, $local_hosts, true ) || ( is_string( $host ) && preg_match( '/\.local$/', $host ) );
/**
* Filter whether the client API should verify SSL certificates.
*
* @param bool $verify Whether to verify SSL. False for *.local hosts.
* @param string $url Request URL.
*/
return (bool) apply_filters( 'hssm_api_sslverify', ! $is_local, $url );
}
public function clear_cache() {
$site_slug = get_option( 'hssm_client_site_slug' );
if ( ! empty( $site_slug ) ) {