class WP_Http_Encoding {
/**
* Compress raw string using the deflate format.
*
* Supports the RFC 1951 standard.
*
* @since 2.8.0
*
* @param string $raw String to compress.
* @param int $level Optional. Compression level, 9 is highest. Default 9.
* @param string $supports Optional, not used. When implemented it will choose
* the right compression based on what the server supports.
* @return string|false Compressed string on success, false on failure.
*/
public static function compress( $raw, $level = 9, $supports = null ) {
return gzdeflate( $raw, $level );
}
/**
* Decompression of deflated string.
*
* Will attempt to decompress using the RFC 1950 standard, and if that fails
* then the RFC 1951 standard deflate will be attempted. Finally, the RFC
* 1952 standard gzip decode will be attempted. If all fail, then the
* original compressed string will be returned.
*
* @since 2.8.0
*
* @param string $compressed String to decompress.
* @param int $length The optional length of the compressed data.
* @return string|false Decompressed string on success, false on failure.
*/
public static function decompress( $compressed, $length = null ) {
if ( empty( $compressed ) ) {
return $compressed;
}
$decompressed = @gzinflate( $compressed );
if ( false !== $decompressed ) {
return $decompressed;
}
$decompressed = self::compatible_gzinflate( $compressed );
if ( false !== $decompressed ) {
return $decompressed;
}
$decompressed = @gzuncompress( $compressed );
if ( false !== $decompressed ) {
return $decompressed;
}
if ( function_exists( 'gzdecode' ) ) {
$decompressed = @gzdecode( $compressed );
if ( false !== $decompressed ) {
return $decompressed;
}
}
return $compressed;
}
/**
* Decompression of deflated string while staying compatible with the majority of servers.
*
* Certain Servers will return deflated data with headers which PHP's gzinflate()
* function cannot handle out of the box. The following function has been created from
* various snippets on the gzinflate() PHP documentation.
*
* Warning: Magic numbers within. Due to the potential different formats that the compressed
* data may be returned in, some "magic offsets" are needed to ensure proper decompression
* takes place. For a simple pragmatic way to determine the magic offset in use, see:
* https://core.trac.wordpress.org/ticket/18273
*
* @since 2.8.1
*
* @link https://core.trac.wordpress.org/ticket/18273
* @link https://www.php.net/manual/en/function.gzinflate.php#70875
* @link https://www.php.net/manual/en/function.gzinflate.php#77336
*
* @param string $gz_data String to decompress.
* @return string|false Decompressed string on success, false on failure.
*/
public static function compatible_gzinflate( $gz_data ) {
// Compressed data might contain a full header, if so strip it for gzinflate().
if ( str_starts_with( $gz_data, "\x1f\x8b\x08" ) ) {
$i = 10;
$flg = ord( substr( $gz_data, 3, 1 ) );
if ( $flg > 0 ) {
if ( $flg & 4 ) {
list($xlen) = unpack( 'v', substr( $gz_data, $i, 2 ) );
$i = $i + 2 + $xlen;
}
if ( $flg & 8 ) {
$i = strpos( $gz_data, "\0", $i ) + 1;
}
if ( $flg & 16 ) {
$i = strpos( $gz_data, "\0", $i ) + 1;
}
if ( $flg & 2 ) {
$i = $i + 2;
}
}
$decompressed = @gzinflate( substr( $gz_data, $i, -8 ) );
if ( false !== $decompressed ) {
return $decompressed;
}
}
// Compressed data from java.util.zip.Deflater amongst others.
$decompressed = @gzinflate( substr( $gz_data, 2 ) );
if ( false !== $decompressed ) {
return $decompressed;
}
return false;
}
/**
* What encoding types to accept and their priority values.
*
* @since 2.8.0
*
* @param string $url
* @param array $args
* @return string Types of encoding to accept.
*/
public static function accept_encoding( $url, $args ) {
$type = array();
$compression_enabled = self::is_available();
if ( ! $args['decompress'] ) { // Decompression specifically disabled.
$compression_enabled = false;
} elseif ( $args['stream'] ) { // Disable when streaming to file.
$compression_enabled = false;
} elseif ( isset( $args['limit_response_size'] ) ) { // If only partial content is being requested, we won't be able to decompress it.
$compression_enabled = false;
}
if ( $compression_enabled ) {
if ( function_exists( 'gzinflate' ) ) {
$type[] = 'deflate;q=1.0';
}
if ( function_exists( 'gzuncompress' ) ) {
$type[] = 'compress;q=0.5';
}
if ( function_exists( 'gzdecode' ) ) {
$type[] = 'gzip;q=0.5';
}
}
/**
* Filters the allowed encoding types.
*
* @since 3.6.0
*
* @param string[] $type Array of what encoding types to accept and their priority values.
* @param string $url URL of the HTTP request.
* @param array $args HTTP request arguments.
*/
$type = apply_filters( 'wp_http_accept_encoding', $type, $url, $args );
return implode( ', ', $type );
}
/**
* What encoding the content used when it was compressed to send in the headers.
*
* @since 2.8.0
*
* @return string Content-Encoding string to send in the header.
*/
public static function content_encoding() {
return 'deflate';
}
/**
* Whether the content be decoded based on the headers.
*
* @since 2.8.0
*
* @param array|string $headers All of the available headers.
* @return bool
*/
public static function should_decode( $headers ) {
if ( is_array( $headers ) ) {
if ( array_key_exists( 'content-encoding', $headers ) && ! empty( $headers['content-encoding'] ) ) {
return true;
}
} elseif ( is_string( $headers ) ) {
return ( stripos( $headers, 'content-encoding:' ) !== false );
}
return false;
}
/**
* Whether decompression and compression are supported by the PHP version.
*
* Each function is tested instead of checking for the zlib extension, to
* ensure that the functions all exist in the PHP version and aren't
* disabled.
*
* @since 2.8.0
*
* @return bool
*/
public static function is_available() {
return ( function_exists( 'gzuncompress' ) || function_exists( 'gzdeflate' ) || function_exists( 'gzinflate' ) );
}
}
“When Talk Is Not Enough”
Finding Relief Without Reliving It
About Jim Mc Aninch
Trauma Care & Recovery Coach | Founder of UR Energywellness
With over 39 years in continuous recovery and more than 30 years supporting others through trauma and emotional distress, Jim Mc Aninch brings deep personal insight and professional expertise to every session.
He’s worked across high-intensity environments — including addiction clinics, emergency response teams, and military service — helping individuals find emotional balance and long-term recovery.
Jim specializes in non-verbal trauma resolution using a client-centered approach that is safe, structured, and effective — even when words fall short.
The F.A.S.T.–A.I.D.E.™ Method
A practical framework for emotional healing – no storytelling required.
Jim co -developed with Tom Greenhalgh the F.A.S.T.–A.I.D.E.™ model to help people process trauma without needing to relive it. This structured method gently clears emotional distress while empowering the client with tools for long-term resilience.
F.A.S.T.–A.I.D.E.™ stands for:
Foster Rapport – Build trust and connection
Assess Status – Understand what’s happening right now
Stabilize – Calm and center before proceeding
Treat – Address distress through non-verbal energy techniques
Asses – Review, repeat, and refine treatment
Instruct – Support with hydration, grounding, and aftercare
Details/Depart – Create a plan for moving forward
Even You – Prioritize self-care and client safety
This method has been recommended by leading voices in energy psychology and used in residential treatment centers with great success.
Why Work With Jim?
Jim has supported:
✔ First responders & 911 dispatchers
✔ Veterans & military families
✔ Individuals in addiction recovery
✔ Survivors of industrial accidents & emotional trauma
His experience includes:
30+ years as a Certified Employee Assistance Professional (CEAP)
30 years with Pittsburgh’s CISM team
11 years in the U.S. Navy, Naval Mine Warfare Division
15 years with the Association of Energy Psychology’s Ethics Committee
Tools, Certifications & Healing Modalities
Jim integrates a range of proven energy psychology and somatic tools, tailored to each person’s nervous system and emotional needs:
Certifications include:
Certified Trauma Responder (CTR)
Thought Field Therapy Lifestyle Coach
NES Health Practitioner
Energy4Life Coach
Emotion Code & Body Code
Psych-K (Basic & Advanced)
Certified Advanced Recovery Coach – Recovery Academy
Measurement Tools:
Heart Quest (HRV – Heart Rate Variability)
Brain Gauge
Bio-Well Scan
NES Health Scan
“If you can’t measure progress, how do you know it’s working?”
Who This Is For?
You’ve been through therapy but still feel stuck.
You’re in recovery but struggling with underlying trauma.
You can’t talk about what happened — or don’t want to.
You want real results, not just temporary relief.
Ready to take the next step in your healing journey — without having to relive the past?