New.Proxy - #814
Conversation
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (30.00%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## dev #814 +/- ##
============================================
+ Coverage 26.70% 27.70% +1.00%
- Complexity 5800 5811 +11
============================================
Files 278 278
Lines 24561 24568 +7
============================================
+ Hits 6558 6807 +249
+ Misses 18003 17761 -242 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Please rename the PR according to the standard. |
|
Done |
There was a problem hiding this comment.
Pull request overview
Adds support for routing CleanTalk API requests through a proxy configured via standard WordPress WP_PROXY_* constants, so outbound requests can work in proxied/locked-down hosting environments.
Changes:
- Build a request
$optionsarray inCleantalk\ApbctWP\API::sendRequest()instead of passing only['timeout' => ...]. - Add proxy host/port (and optional credentials) into request options.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Proxy settings from wp-config.php constants. | ||
| if ( defined('WP_PROXY_HOST') && WP_PROXY_HOST !== '' && defined('WP_PROXY_PORT') && WP_PROXY_PORT !== '' ) { | ||
| $options['proxy'] = WP_PROXY_HOST . ':' . WP_PROXY_PORT; // WP HTTP API branch | ||
| $options[CURLOPT_PROXY] = WP_PROXY_HOST; // cURL branch | ||
| $options[CURLOPT_PROXYPORT] = WP_PROXY_PORT; | ||
| if ( defined('WP_PROXY_USERNAME') && WP_PROXY_USERNAME !== '' ) { | ||
| $options[CURLOPT_PROXYUSERPWD] = WP_PROXY_USERNAME . ':' . (defined('WP_PROXY_PASSWORD') ? WP_PROXY_PASSWORD : ''); | ||
| } | ||
| } |
| $options = ['timeout' => $timeout]; | ||
| // Proxy settings from wp-config.php constants. | ||
| $options['proxy'] = WP_PROXY_HOST . ':' . WP_PROXY_PORT; // WP HTTP API branch | ||
| // cURL branch (avoid referencing CURLOPT_* when ext-curl is not available) | ||
| if ( function_exists('curl_init') && defined('CURLOPT_PROXY') && defined('CURLOPT_PROXYPORT') ) { | ||
| $options[CURLOPT_PROXY] = WP_PROXY_HOST; | ||
| $options[CURLOPT_PROXYPORT] = WP_PROXY_PORT; | ||
| if ( defined('WP_PROXY_USERNAME') && WP_PROXY_USERNAME !== '' && defined('CURLOPT_PROXYUSERPWD') ) { | ||
| $options[CURLOPT_PROXYUSERPWD] = WP_PROXY_USERNAME . ':' . (defined('WP_PROXY_PASSWORD') ? WP_PROXY_PASSWORD : ''); | ||
| } | ||
| } |
https://app.doboard.com/1/task/49565