PluginProbe ʕ •ᴥ•ʔ
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin / 3.7.0
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin v3.7.0
0.9.6 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.6.0 1.6.2 1.7.0 1.7.1 1.8.0 1.8.1 1.9.0 2.0.0 2.0.1 2.1.1 2.2.1 2.3.1 2.4.0 2.5.0 2.5.1 2.6.0 2.7.0 2.8.0 2.9.0 3.0.1 3.0.2 3.0.3 3.1.0 3.10.0 3.11.0 3.11.1 3.2.0 3.2.1 3.3.0 3.4.0 3.5.0 3.5.1 3.5.2 3.6.1 3.7.0 3.8.0 3.8.2 3.9.0 4.0.1 4.1.0 4.1.1 4.2.0 4.3.0 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.8.0 trunk 0.10.0 0.10.1 0.11.1 0.11.2 0.3.1 0.3.2 0.4 0.4.1 0.4.2 0.5.0 0.5.1 0.5.2 0.6 0.7 0.8 0.8.2 0.8.3 0.8.4 0.8.5 0.8.6 0.8.7 0.9.0 0.9.1 0.9.2 0.9.3 0.9.4 0.9.5
wp-mail-smtp / vendor_prefixed / guzzlehttp / guzzle / src / Utils.php
wp-mail-smtp / vendor_prefixed / guzzlehttp / guzzle / src Last commit date
Cookie 3 years ago Exception 3 years ago Handler 3 years ago Client.php 3 years ago ClientInterface.php 3 years ago HandlerStack.php 3 years ago MessageFormatter.php 3 years ago Middleware.php 3 years ago Pool.php 3 years ago PrepareBodyMiddleware.php 3 years ago RedirectMiddleware.php 3 years ago RequestOptions.php 3 years ago RetryMiddleware.php 3 years ago TransferStats.php 3 years ago UriTemplate.php 3 years ago Utils.php 3 years ago functions.php 3 years ago functions_include.php 3 years ago
Utils.php
83 lines
1 <?php
2
3 namespace WPMailSMTP\Vendor\GuzzleHttp;
4
5 use WPMailSMTP\Vendor\GuzzleHttp\Exception\InvalidArgumentException;
6 use WPMailSMTP\Vendor\Psr\Http\Message\UriInterface;
7 use WPMailSMTP\Vendor\Symfony\Polyfill\Intl\Idn\Idn;
8 final class Utils
9 {
10 /**
11 * Wrapper for the hrtime() or microtime() functions
12 * (depending on the PHP version, one of the two is used)
13 *
14 * @return float|mixed UNIX timestamp
15 *
16 * @internal
17 */
18 public static function currentTime()
19 {
20 return \function_exists('hrtime') ? \hrtime(\true) / 1000000000.0 : \microtime(\true);
21 }
22 /**
23 * @param int $options
24 *
25 * @return UriInterface
26 * @throws InvalidArgumentException
27 *
28 * @internal
29 */
30 public static function idnUriConvert(\WPMailSMTP\Vendor\Psr\Http\Message\UriInterface $uri, $options = 0)
31 {
32 if ($uri->getHost()) {
33 $asciiHost = self::idnToAsci($uri->getHost(), $options, $info);
34 if ($asciiHost === \false) {
35 $errorBitSet = isset($info['errors']) ? $info['errors'] : 0;
36 $errorConstants = \array_filter(\array_keys(\get_defined_constants()), function ($name) {
37 return \substr($name, 0, 11) === 'IDNA_ERROR_';
38 });
39 $errors = [];
40 foreach ($errorConstants as $errorConstant) {
41 if ($errorBitSet & \constant($errorConstant)) {
42 $errors[] = $errorConstant;
43 }
44 }
45 $errorMessage = 'IDN conversion failed';
46 if ($errors) {
47 $errorMessage .= ' (errors: ' . \implode(', ', $errors) . ')';
48 }
49 throw new \WPMailSMTP\Vendor\GuzzleHttp\Exception\InvalidArgumentException($errorMessage);
50 } else {
51 if ($uri->getHost() !== $asciiHost) {
52 // Replace URI only if the ASCII version is different
53 $uri = $uri->withHost($asciiHost);
54 }
55 }
56 }
57 return $uri;
58 }
59 /**
60 * @param string $domain
61 * @param int $options
62 * @param array $info
63 *
64 * @return string|false
65 */
66 private static function idnToAsci($domain, $options, &$info = [])
67 {
68 if (\preg_match('%^[ -~]+$%', $domain) === 1) {
69 return $domain;
70 }
71 if (\extension_loaded('intl') && \defined('INTL_IDNA_VARIANT_UTS46')) {
72 return \idn_to_ascii($domain, $options, \INTL_IDNA_VARIANT_UTS46, $info);
73 }
74 /*
75 * The Idn class is marked as @internal. Verify that class and method exists.
76 */
77 if (\method_exists(\WPMailSMTP\Vendor\Symfony\Polyfill\Intl\Idn\Idn::class, 'idn_to_ascii')) {
78 return \WPMailSMTP\Vendor\Symfony\Polyfill\Intl\Idn\Idn::idn_to_ascii($domain, $options, \WPMailSMTP\Vendor\Symfony\Polyfill\Intl\Idn\Idn::INTL_IDNA_VARIANT_UTS46, $info);
79 }
80 throw new \RuntimeException('ext-intl or symfony/polyfill-intl-idn not loaded or too old');
81 }
82 }
83