WP Mail SMTP by WPForms - Version 2.0.1

Version Description

  • 2020-05-07 =
  • Changed: Improved description of the "Do Not Send" plugin option.
  • Fixed: Due to Pepipost API changes we now convert new lines so they are preserved in plain text emails.
  • Fixed: Downgrade internal Guzzle dependency to 6.4 to temporarily fix compatibility issues with WordPress and Guzzle 6.5. Affects Gmail mailer.
Download this release

Release Info

Developer slaFFik
Plugin Icon 128x128 WP Mail SMTP by WPForms
Version 2.0.1
Comparing to
See all releases

Code changes from version 2.0.0 to 2.0.1

Files changed (39) hide show
  1. assets/languages/wp-mail-smtp.pot +13 -13
  2. readme.txt +6 -1
  3. src/Admin/Pages/MiscTab.php +224 -219
  4. src/Providers/PepipostAPI/Mailer.php +4 -1
  5. vendor/composer/autoload_files.php +0 -3
  6. vendor/composer/autoload_psr4.php +0 -3
  7. vendor/composer/autoload_static.php +0 -18
  8. vendor/guzzlehttp/guzzle/src/Client.php +6 -86
  9. vendor/guzzlehttp/guzzle/src/ClientInterface.php +2 -5
  10. vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php +2 -4
  11. vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php +3 -3
  12. vendor/guzzlehttp/guzzle/src/Exception/RequestException.php +30 -5
  13. vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php +5 -10
  14. vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php +5 -20
  15. vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php +1 -6
  16. vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php +3 -4
  17. vendor/guzzlehttp/guzzle/src/HandlerStack.php +1 -5
  18. vendor/guzzlehttp/guzzle/src/MessageFormatter.php +0 -5
  19. vendor/guzzlehttp/guzzle/src/Pool.php +1 -12
  20. vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php +0 -5
  21. vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php +4 -22
  22. vendor/guzzlehttp/guzzle/src/RequestOptions.php +0 -8
  23. vendor/guzzlehttp/guzzle/src/RetryMiddleware.php +2 -15
  24. vendor/guzzlehttp/guzzle/src/TransferStats.php +6 -6
  25. vendor/guzzlehttp/guzzle/src/Utils.php +0 -67
  26. vendor/guzzlehttp/guzzle/src/functions.php +14 -2
  27. vendor/symfony/polyfill-intl-idn/Idn.php +0 -283
  28. vendor/symfony/polyfill-intl-idn/LICENSE +0 -19
  29. vendor/symfony/polyfill-intl-idn/bootstrap.php +0 -61
  30. vendor/symfony/polyfill-mbstring/LICENSE +0 -19
  31. vendor/symfony/polyfill-mbstring/Mbstring.php +0 -847
  32. vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php +0 -1096
  33. vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php +0 -5
  34. vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php +0 -1104
  35. vendor/symfony/polyfill-mbstring/bootstrap.php +0 -64
  36. vendor/symfony/polyfill-php72/LICENSE +0 -19
  37. vendor/symfony/polyfill-php72/Php72.php +0 -216
  38. vendor/symfony/polyfill-php72/bootstrap.php +0 -36
  39. wp_mail_smtp.php +2 -2
assets/languages/wp-mail-smtp.pot CHANGED
@@ -1,13 +1,13 @@
1
msgid ""
2
msgstr ""
3
- "Project-Id-Version: WP Mail SMTP 2.0.0\n"
4
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-mail-smtp\n"
5
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
6
"Language-Team: LANGUAGE <LL@li.org>\n"
7
"MIME-Version: 1.0\n"
8
"Content-Type: text/plain; charset=UTF-8\n"
9
"Content-Transfer-Encoding: 8bit\n"
10
- "POT-Creation-Date: 2020-04-27T12:51:41+03:00\n"
11
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12
"X-Generator: WP-CLI 2.4.0\n"
13
"X-Domain: wp-mail-smtp\n"
@@ -465,45 +465,45 @@ msgstr ""
465
msgid "The value of this field was set using a constant %1$s most likely inside %2$s of your WordPress installation."
466
msgstr ""
467
468
- #. translators: %1$s - constant to use; %2$s - file to put that constant in.
469
#: src/Admin/Pages/MiscTab.php:92
470
- msgid "If you want to disable using a constant, put %1$s in your %2$s file."
471
msgstr ""
472
473
- #: src/Admin/Pages/MiscTab.php:106
474
msgid "Hide Announcements"
475
msgstr ""
476
477
- #: src/Admin/Pages/MiscTab.php:115
478
msgid "Check this if you would like to hide plugin announcements and update details."
479
msgstr ""
480
481
- #: src/Admin/Pages/MiscTab.php:125
482
msgid "Hide Email Delivery Errors"
483
msgstr ""
484
485
- #: src/Admin/Pages/MiscTab.php:141
486
msgid "Check this if you would like to hide warnings alerting of email delivery errors."
487
msgstr ""
488
489
#. translators: %s - filter that was used to disabled.
490
- #: src/Admin/Pages/MiscTab.php:148
491
msgid "Email Delivery Errors were disabled using a %s filter."
492
msgstr ""
493
494
- #: src/Admin/Pages/MiscTab.php:157
495
msgid "<strong>This is not recommended</strong> and should only be done for staging or development sites."
496
msgstr ""
497
498
- #: src/Admin/Pages/MiscTab.php:172
499
msgid "Uninstall WP Mail SMTP"
500
msgstr ""
501
502
- #: src/Admin/Pages/MiscTab.php:180
503
msgid "Check this if you would like to remove ALL WP Mail SMTP data upon plugin deletion. All settings will be unrecoverable."
504
msgstr ""
505
506
- #: src/Admin/Pages/MiscTab.php:215
507
#: src/Admin/Pages/SettingsTab.php:540
508
msgid "Settings were successfully saved."
509
msgstr ""
1
msgid ""
2
msgstr ""
3
+ "Project-Id-Version: WP Mail SMTP 2.0.1\n"
4
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-mail-smtp\n"
5
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
6
"Language-Team: LANGUAGE <LL@li.org>\n"
7
"MIME-Version: 1.0\n"
8
"Content-Type: text/plain; charset=UTF-8\n"
9
"Content-Transfer-Encoding: 8bit\n"
10
+ "POT-Creation-Date: 2020-05-07T15:56:11+03:00\n"
11
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12
"X-Generator: WP-CLI 2.4.0\n"
13
"X-Domain: wp-mail-smtp\n"
465
msgid "The value of this field was set using a constant %1$s most likely inside %2$s of your WordPress installation."
466
msgstr ""
467
468
+ #. translators: %s - file to put that constant in.
469
#: src/Admin/Pages/MiscTab.php:92
470
+ msgid "If you want to enable this option using constants, put the lines below to your %s file:"
471
msgstr ""
472
473
+ #: src/Admin/Pages/MiscTab.php:111
474
msgid "Hide Announcements"
475
msgstr ""
476
477
+ #: src/Admin/Pages/MiscTab.php:120
478
msgid "Check this if you would like to hide plugin announcements and update details."
479
msgstr ""
480
481
+ #: src/Admin/Pages/MiscTab.php:130
482
msgid "Hide Email Delivery Errors"
483
msgstr ""
484
485
+ #: src/Admin/Pages/MiscTab.php:146
486
msgid "Check this if you would like to hide warnings alerting of email delivery errors."
487
msgstr ""
488
489
#. translators: %s - filter that was used to disabled.
490
+ #: src/Admin/Pages/MiscTab.php:153
491
msgid "Email Delivery Errors were disabled using a %s filter."
492
msgstr ""
493
494
+ #: src/Admin/Pages/MiscTab.php:162
495
msgid "<strong>This is not recommended</strong> and should only be done for staging or development sites."
496
msgstr ""
497
498
+ #: src/Admin/Pages/MiscTab.php:177
499
msgid "Uninstall WP Mail SMTP"
500
msgstr ""
501
502
+ #: src/Admin/Pages/MiscTab.php:185
503
msgid "Check this if you would like to remove ALL WP Mail SMTP data upon plugin deletion. All settings will be unrecoverable."
504
msgstr ""
505
506
+ #: src/Admin/Pages/MiscTab.php:220
507
#: src/Admin/Pages/SettingsTab.php:540
508
msgid "Settings were successfully saved."
509
msgstr ""
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: wpforms, jaredatch, smub, slaFFik
3
Tags: smtp, wp mail smtp, wordpress smtp, gmail smtp, sendgrid smtp, mailgun smtp, mail, mailer, phpmailer, wp_mail, email, mailgun, sengrid, gmail, pepipost, sendinblue, wp smtp
4
Requires at least: 4.9
5
Tested up to: 5.4
6
- Stable tag: 2.0.0
7
Requires PHP: 5.5.0
8
9
The most popular WordPress SMTP and PHP Mailer plugin. Trusted by over 1 million sites.
@@ -229,6 +229,11 @@ By all means please contact us to discuss features or options you'd like to see
229
230
== Changelog ==
231
232
= 2.0.0 - 2020-04-27 =
233
* IMPORTANT: Support for PHP 5.2-5.4 has been discontinued. If you are running one of those versions, you MUST upgrade PHP before installing or upgrading to WP Mail SMTP v2.0. Failure to do that will disable WP Mail SMTP functionality.
234
* Added: new mailer - SMTP.com integration.
3
Tags: smtp, wp mail smtp, wordpress smtp, gmail smtp, sendgrid smtp, mailgun smtp, mail, mailer, phpmailer, wp_mail, email, mailgun, sengrid, gmail, pepipost, sendinblue, wp smtp
4
Requires at least: 4.9
5
Tested up to: 5.4
6
+ Stable tag: 2.0.1
7
Requires PHP: 5.5.0
8
9
The most popular WordPress SMTP and PHP Mailer plugin. Trusted by over 1 million sites.
229
230
== Changelog ==
231
232
+ = 2.0.1 - 2020-05-07 =
233
+ * Changed: Improved description of the "Do Not Send" plugin option.
234
+ * Fixed: Due to Pepipost API changes we now convert new lines so they are preserved in plain text emails.
235
+ * Fixed: Downgrade internal Guzzle dependency to 6.4 to temporarily fix compatibility issues with WordPress and Guzzle 6.5. Affects Gmail mailer.
236
+
237
= 2.0.0 - 2020-04-27 =
238
* IMPORTANT: Support for PHP 5.2-5.4 has been discontinued. If you are running one of those versions, you MUST upgrade PHP before installing or upgrading to WP Mail SMTP v2.0. Failure to do that will disable WP Mail SMTP functionality.
239
* Added: new mailer - SMTP.com integration.
src/Admin/Pages/MiscTab.php CHANGED
@@ -1,219 +1,224 @@
1
- <?php
2
-
3
- namespace WPMailSMTP\Admin\Pages;
4
-
5
- use WPMailSMTP\Admin\PageAbstract;
6
- use WPMailSMTP\Options;
7
- use WPMailSMTP\WP;
8
-
9
- /**
10
- * Class MiscTab is part of Area, displays different plugin-related settings of the plugin (not related to emails).
11
- *
12
- * @since 1.0.0
13
- */
14
- class MiscTab extends PageAbstract {
15
- /**
16
- * @var string Slug of a tab.
17
- */
18
- protected $slug = 'misc';
19
-
20
- /**
21
- * @inheritdoc
22
- */
23
- public function get_label() {
24
- return esc_html__( 'Misc', 'wp-mail-smtp' );
25
- }
26
-
27
- /**
28
- * @inheritdoc
29
- */
30
- public function get_title() {
31
- return $this->get_label();
32
- }
33
-
34
- /**
35
- * @inheritdoc
36
- */
37
- public function display() {
38
-
39
- $options = new Options();
40
- ?>
41
-
42
- <form method="POST" action="">
43
- <?php $this->wp_nonce_field(); ?>
44
-
45
- <!-- Section Title -->
46
- <div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-content wp-mail-smtp-clear section-heading no-desc" id="wp-mail-smtp-setting-row-email-heading">
47
- <div class="wp-mail-smtp-setting-field">
48
- <h2><?php echo $this->get_title(); ?></h2>
49
- </div>
50
- </div>
51
-
52
- <!-- Do not send -->
53
- <div id="wp-mail-smtp-setting-row-do_not_send" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear">
54
- <div class="wp-mail-smtp-setting-label">
55
- <label for="wp-mail-smtp-setting-do_not_send">
56
- <?php esc_html_e( 'Do Not Send', 'wp-mail-smtp' ); ?>
57
- </label>
58
- </div>
59
- <div class="wp-mail-smtp-setting-field">
60
- <input name="wp-mail-smtp[general][do_not_send]" type="checkbox" value="true" id="wp-mail-smtp-setting-do_not_send"
61
- <?php echo $options->is_const_defined( 'general', 'do_not_send' ) ? 'disabled' : ''; ?>
62
- <?php checked( true, $options->get( 'general', 'do_not_send' ) ); ?>
63
- >
64
- <label for="wp-mail-smtp-setting-do_not_send">
65
- <?php esc_html_e( 'Check this if you would like to stop sending all emails.', 'wp-mail-smtp' ); ?>
66
- </label>
67
- <p class="desc">
68
- <?php
69
- printf(
70
- wp_kses(
71
- __( 'Some plugins, like BuddyPress and Events Manager, are using their own email delivery solutions. By default, this option does not block their emails, as those plugins do not use default <code>wp_mail()</code> function to send emails.', 'wp-mail-smtp' ),
72
- array(
73
- 'code' => array(),
74
- )
75
- )
76
- );
77
- ?>
78
- <br>
79
- <?php esc_html_e( 'You will need to consult with their documentation to switch them to use default WordPress email delivery.', 'wp-mail-smtp' ); ?>
80
- <br>
81
- <?php esc_html_e( 'Test emails are allowed to be sent, regardless of this option.', 'wp-mail-smtp' ); ?>
82
- <br>
83
- <?php
84
- if ( $options->is_const_defined( 'general', 'do_not_send' ) ) {
85
- printf( /* translators: %1$s - constant that was used; %2$s - file where it was used. */
86
- esc_html__( 'The value of this field was set using a constant %1$s most likely inside %2$s of your WordPress installation.', 'wp-mail-smtp' ),
87
- '<code>WPMS_DO_NOT_SEND</code>',
88
- '<code>wp-config.php</code>'
89
- );
90
- } else {
91
- printf( /* translators: %1$s - constant to use; %2$s - file to put that constant in. */
92
- esc_html__( 'If you want to disable using a constant, put %1$s in your %2$s file.', 'wp-mail-smtp' ),
93
- '<code>define( \'WPMS_DO_NOT_SEND\', true );</code>',
94
- '<code>wp-config.php</code>'
95
- );
96
- }
97
- ?>
98
- </p>
99
- </div>
100
- </div>
101
-
102
- <!-- Hide Announcements -->
103
- <div id="wp-mail-smtp-setting-row-am_notifications_hidden" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear">
104
- <div class="wp-mail-smtp-setting-label">
105
- <label for="wp-mail-smtp-setting-am_notifications_hidden">
106
- <?php esc_html_e( 'Hide Announcements', 'wp-mail-smtp' ); ?>
107
- </label>
108
- </div>
109
- <div class="wp-mail-smtp-setting-field">
110
- <input name="wp-mail-smtp[general][am_notifications_hidden]" type="checkbox"
111
- value="true" <?php checked( true, $options->get( 'general', 'am_notifications_hidden' ) ); ?>
112
- id="wp-mail-smtp-setting-am_notifications_hidden"
113
- >
114
- <label for="wp-mail-smtp-setting-am_notifications_hidden">
115
- <?php esc_html_e( 'Check this if you would like to hide plugin announcements and update details.', 'wp-mail-smtp' ); ?>
116
- </label>
117
- </div>
118
- </div>
119
-
120
- <!-- Hide Email Delivery Errors -->
121
- <div id="wp-mail-smtp-setting-row-email_delivery_errors_hidden"
122
- class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear">
123
- <div class="wp-mail-smtp-setting-label">
124
- <label for="wp-mail-smtp-setting-email_delivery_errors_hidden">
125
- <?php esc_html_e( 'Hide Email Delivery Errors', 'wp-mail-smtp' ); ?>
126
- </label>
127
- </div>
128
- <div class="wp-mail-smtp-setting-field">
129
- <?php
130
- $is_hard_disabled = has_filter( 'wp_mail_smtp_admin_is_error_delivery_notice_enabled' ) && ! wp_mail_smtp()->get_admin()->is_error_delivery_notice_enabled();
131
- ?>
132
- <?php if ( $is_hard_disabled ) : ?>
133
- <input type="checkbox" disabled checked id="wp-mail-smtp-setting-email_delivery_errors_hidden">
134
- <?php else : ?>
135
- <input name="wp-mail-smtp[general][email_delivery_errors_hidden]" type="checkbox" value="true"
136
- <?php checked( true, $options->get( 'general', 'email_delivery_errors_hidden' ) ); ?>
137
- id="wp-mail-smtp-setting-email_delivery_errors_hidden">
138
- <?php endif; ?>
139
-
140
- <label for="wp-mail-smtp-setting-email_delivery_errors_hidden">
141
- <?php esc_html_e( 'Check this if you would like to hide warnings alerting of email delivery errors.', 'wp-mail-smtp' ); ?>
142
- </label>
143
-
144
- <?php if ( $is_hard_disabled ) : ?>
145
- <p class="desc">
146
- <?php
147
- printf( /* translators: %s - filter that was used to disabled. */
148
- esc_html__( 'Email Delivery Errors were disabled using a %s filter.', 'wp-mail-smtp' ),
149
- '<code>wp_mail_smtp_admin_is_error_delivery_notice_enabled</code>'
150
- );
151
- ?>
152
- </p>
153
- <?php else : ?>
154
- <p class="desc">
155
- <?php
156
- echo wp_kses(
157
- __( '<strong>This is not recommended</strong> and should only be done for staging or development sites.', 'wp-mail-smtp' ),
158
- array(
159
- 'strong' => true,
160
- )
161
- );
162
- ?>
163
- </p>
164
- <?php endif; ?>
165
- </div>
166
- </div>
167
-
168
- <!-- Uninstall -->
169
- <div id="wp-mail-smtp-setting-row-uninstall" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear">
170
- <div class="wp-mail-smtp-setting-label">
171
- <label for="wp-mail-smtp-setting-uninstall">
172
- <?php esc_html_e( 'Uninstall WP Mail SMTP', 'wp-mail-smtp' ); ?>
173
- </label>
174
- </div>
175
- <div class="wp-mail-smtp-setting-field">
176
- <input name="wp-mail-smtp[general][uninstall]" type="checkbox"
177
- value="true" <?php checked( true, $options->get( 'general', 'uninstall' ) ); ?>
178
- id="wp-mail-smtp-setting-uninstall">
179
- <label for="wp-mail-smtp-setting-uninstall">
180
- <?php esc_html_e( 'Check this if you would like to remove ALL WP Mail SMTP data upon plugin deletion. All settings will be unrecoverable.', 'wp-mail-smtp' ); ?>
181
- </label>
182
- </div>
183
- </div>
184
-
185
- <?php $this->display_save_btn(); ?>
186
-
187
- </form>
188
-
189
- <?php
190
- }
191
-
192
- /**
193
- * @inheritdoc
194
- */
195
- public function process_post( $data ) {
196
-
197
- $this->check_admin_referer();
198
-
199
- $options = new Options();
200
-
201
- // Unchecked checkboxes doesn't exist in $_POST, so we need to ensure we actually have them in data to save.
202
- if ( empty( $data['general']['am_notifications_hidden'] ) ) {
203
- $data['general']['am_notifications_hidden'] = false;
204
- }
205
- if ( empty( $data['general']['uninstall'] ) ) {
206
- $data['general']['uninstall'] = false;
207
- }
208
-
209
- $to_save = array_merge( $options->get_all(), $data );
210
-
211
- // All the sanitization is done there.
212
- $options->set( $to_save );
213
-
214
- WP::add_admin_notice(
215
- esc_html__( 'Settings were successfully saved.', 'wp-mail-smtp' ),
216
- WP::ADMIN_NOTICE_SUCCESS
217
- );
218
- }
219
- }
1
+ <?php
2
+
3
+ namespace WPMailSMTP\Admin\Pages;
4
+
5
+ use WPMailSMTP\Admin\PageAbstract;
6
+ use WPMailSMTP\Options;
7
+ use WPMailSMTP\WP;
8
+
9
+ /**
10
+ * Class MiscTab is part of Area, displays different plugin-related settings of the plugin (not related to emails).
11
+ *
12
+ * @since 1.0.0
13
+ */
14
+ class MiscTab extends PageAbstract {
15
+ /**
16
+ * @var string Slug of a tab.
17
+ */
18
+ protected $slug = 'misc';
19
+
20
+ /**
21
+ * @inheritdoc
22
+ */
23
+ public function get_label() {
24
+ return esc_html__( 'Misc', 'wp-mail-smtp' );
25
+ }
26
+
27
+ /**
28
+ * @inheritdoc
29
+ */
30
+ public function get_title() {
31
+ return $this->get_label();
32
+ }
33
+
34
+ /**
35
+ * @inheritdoc
36
+ */
37
+ public function display() {
38
+
39
+ $options = new Options();
40
+ ?>
41
+
42
+ <form method="POST" action="">
43
+ <?php $this->wp_nonce_field(); ?>
44
+
45
+ <!-- Section Title -->
46
+ <div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-content wp-mail-smtp-clear section-heading no-desc" id="wp-mail-smtp-setting-row-email-heading">
47
+ <div class="wp-mail-smtp-setting-field">
48
+ <h2><?php echo $this->get_title(); ?></h2>
49
+ </div>
50
+ </div>
51
+
52
+ <!-- Do not send -->
53
+ <div id="wp-mail-smtp-setting-row-do_not_send" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear">
54
+ <div class="wp-mail-smtp-setting-label">
55
+ <label for="wp-mail-smtp-setting-do_not_send">
56
+ <?php esc_html_e( 'Do Not Send', 'wp-mail-smtp' ); ?>
57
+ </label>
58
+ </div>
59
+ <div class="wp-mail-smtp-setting-field">
60
+ <input name="wp-mail-smtp[general][do_not_send]" type="checkbox" value="true" id="wp-mail-smtp-setting-do_not_send"
61
+ <?php echo $options->is_const_defined( 'general', 'do_not_send' ) ? 'disabled' : ''; ?>
62
+ <?php checked( true, $options->get( 'general', 'do_not_send' ) ); ?>
63
+ >
64
+ <label for="wp-mail-smtp-setting-do_not_send">
65
+ <?php esc_html_e( 'Check this if you would like to stop sending all emails.', 'wp-mail-smtp' ); ?>
66
+ </label>
67
+ <p class="desc">
68
+ <?php
69
+ printf(
70
+ wp_kses(
71
+ __( 'Some plugins, like BuddyPress and Events Manager, are using their own email delivery solutions. By default, this option does not block their emails, as those plugins do not use default <code>wp_mail()</code> function to send emails.', 'wp-mail-smtp' ),
72
+ array(
73
+ 'code' => array(),
74
+ )
75
+ )
76
+ );
77
+ ?>
78
+ <br>
79
+ <?php esc_html_e( 'You will need to consult with their documentation to switch them to use default WordPress email delivery.', 'wp-mail-smtp' ); ?>
80
+ <br>
81
+ <?php esc_html_e( 'Test emails are allowed to be sent, regardless of this option.', 'wp-mail-smtp' ); ?>
82
+ <br>
83
+ <?php
84
+ if ( $options->is_const_defined( 'general', 'do_not_send' ) ) {
85
+ printf( /* translators: %1$s - constant that was used; %2$s - file where it was used. */
86
+ esc_html__( 'The value of this field was set using a constant %1$s most likely inside %2$s of your WordPress installation.', 'wp-mail-smtp' ),
87
+ '<code>WPMS_DO_NOT_SEND</code>',
88
+ '<code>wp-config.php</code>'
89
+ );
90
+ } else {
91
+ printf( /* translators: %s - file to put that constant in. */
92
+ esc_html__( 'If you want to enable this option using constants, put the lines below to your %s file:', 'wp-mail-smtp' ),
93
+ '<code>wp-config.php</code>'
94
+ );
95
+ }
96
+ ?>
97
+ </p>
98
+ <?php if ( ! $options->is_const_defined( 'general', 'do_not_send' ) ) : ?>
99
+ <pre>
100
+ define( 'WPMS_ON', true );
101
+ define( 'WPMS_DO_NOT_SEND', true );
102
+ </pre>
103
+ <?php endif; ?>
104
+ </div>
105
+ </div>
106
+
107
+ <!-- Hide Announcements -->
108
+ <div id="wp-mail-smtp-setting-row-am_notifications_hidden" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear">
109
+ <div class="wp-mail-smtp-setting-label">
110
+ <label for="wp-mail-smtp-setting-am_notifications_hidden">
111
+ <?php esc_html_e( 'Hide Announcements', 'wp-mail-smtp' ); ?>
112
+ </label>
113
+ </div>
114
+ <div class="wp-mail-smtp-setting-field">
115
+ <input name="wp-mail-smtp[general][am_notifications_hidden]" type="checkbox"
116
+ value="true" <?php checked( true, $options->get( 'general', 'am_notifications_hidden' ) ); ?>
117
+ id="wp-mail-smtp-setting-am_notifications_hidden"
118
+ >
119
+ <label for="wp-mail-smtp-setting-am_notifications_hidden">
120
+ <?php esc_html_e( 'Check this if you would like to hide plugin announcements and update details.', 'wp-mail-smtp' ); ?>
121
+ </label>
122
+ </div>
123
+ </div>
124
+
125
+ <!-- Hide Email Delivery Errors -->
126
+ <div id="wp-mail-smtp-setting-row-email_delivery_errors_hidden"
127
+ class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear">
128
+ <div class="wp-mail-smtp-setting-label">
129
+ <label for="wp-mail-smtp-setting-email_delivery_errors_hidden">
130
+ <?php esc_html_e( 'Hide Email Delivery Errors', 'wp-mail-smtp' ); ?>
131
+ </label>
132
+ </div>
133
+ <div class="wp-mail-smtp-setting-field">
134
+ <?php
135
+ $is_hard_disabled = has_filter( 'wp_mail_smtp_admin_is_error_delivery_notice_enabled' ) && ! wp_mail_smtp()->get_admin()->is_error_delivery_notice_enabled();
136
+ ?>
137
+ <?php if ( $is_hard_disabled ) : ?>
138
+ <input type="checkbox" disabled checked id="wp-mail-smtp-setting-email_delivery_errors_hidden">
139
+ <?php else : ?>
140
+ <input name="wp-mail-smtp[general][email_delivery_errors_hidden]" type="checkbox" value="true"
141
+ <?php checked( true, $options->get( 'general', 'email_delivery_errors_hidden' ) ); ?>
142
+ id="wp-mail-smtp-setting-email_delivery_errors_hidden">
143
+ <?php endif; ?>
144
+
145
+ <label for="wp-mail-smtp-setting-email_delivery_errors_hidden">
146
+ <?php esc_html_e( 'Check this if you would like to hide warnings alerting of email delivery errors.', 'wp-mail-smtp' ); ?>
147
+ </label>
148
+
149
+ <?php if ( $is_hard_disabled ) : ?>
150
+ <p class="desc">
151
+ <?php
152
+ printf( /* translators: %s - filter that was used to disabled. */
153
+ esc_html__( 'Email Delivery Errors were disabled using a %s filter.', 'wp-mail-smtp' ),
154
+ '<code>wp_mail_smtp_admin_is_error_delivery_notice_enabled</code>'
155
+ );
156
+ ?>
157
+ </p>
158
+ <?php else : ?>
159
+ <p class="desc">
160
+ <?php
161
+ echo wp_kses(
162
+ __( '<strong>This is not recommended</strong> and should only be done for staging or development sites.', 'wp-mail-smtp' ),
163
+ array(
164
+ 'strong' => true,
165
+ )
166
+ );
167
+ ?>
168
+ </p>
169
+ <?php endif; ?>
170
+ </div>
171
+ </div>
172
+
173
+ <!-- Uninstall -->
174
+ <div id="wp-mail-smtp-setting-row-uninstall" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear">
175
+ <div class="wp-mail-smtp-setting-label">
176
+ <label for="wp-mail-smtp-setting-uninstall">
177
+ <?php esc_html_e( 'Uninstall WP Mail SMTP', 'wp-mail-smtp' ); ?>
178
+ </label>
179
+ </div>
180
+ <div class="wp-mail-smtp-setting-field">
181
+ <input name="wp-mail-smtp[general][uninstall]" type="checkbox"
182
+ value="true" <?php checked( true, $options->get( 'general', 'uninstall' ) ); ?>
183
+ id="wp-mail-smtp-setting-uninstall">
184
+ <label for="wp-mail-smtp-setting-uninstall">
185
+ <?php esc_html_e( 'Check this if you would like to remove ALL WP Mail SMTP data upon plugin deletion. All settings will be unrecoverable.', 'wp-mail-smtp' ); ?>
186
+ </label>
187
+ </div>
188
+ </div>
189
+
190
+ <?php $this->display_save_btn(); ?>
191
+
192
+ </form>
193
+
194
+ <?php
195
+ }
196
+
197
+ /**
198
+ * @inheritdoc
199
+ */
200
+ public function process_post( $data ) {
201
+
202
+ $this->check_admin_referer();
203
+
204
+ $options = new Options();
205
+
206
+ // Unchecked checkboxes doesn't exist in $_POST, so we need to ensure we actually have them in data to save.
207
+ if ( empty( $data['general']['am_notifications_hidden'] ) ) {
208
+ $data['general']['am_notifications_hidden'] = false;
209
+ }
210
+ if ( empty( $data['general']['uninstall'] ) ) {
211
+ $data['general']['uninstall'] = false;
212
+ }
213
+
214
+ $to_save = array_merge( $options->get_all(), $data );
215
+
216
+ // All the sanitization is done there.
217
+ $options->set( $to_save );
218
+
219
+ WP::add_admin_notice(
220
+ esc_html__( 'Settings were successfully saved.', 'wp-mail-smtp' ),
221
+ WP::ADMIN_NOTICE_SUCCESS
222
+ );
223
+ }
224
+ }
src/Providers/PepipostAPI/Mailer.php CHANGED
@@ -186,6 +186,8 @@ class Mailer extends MailerAbstract {
186
187
if ( $type === 'html' ) {
188
$content_type = 'text/html';
189
}
190
191
$data[] = array(
@@ -204,7 +206,8 @@ class Mailer extends MailerAbstract {
204
$data['value'] = $content;
205
206
if ( $this->phpmailer->ContentType === 'text/plain' ) {
207
- $data['type'] = 'text/plain';
208
}
209
210
$this->set_body_param(
186
187
if ( $type === 'html' ) {
188
$content_type = 'text/html';
189
+ } else {
190
+ $content_value = nl2br( $content_value );
191
}
192
193
$data[] = array(
206
$data['value'] = $content;
207
208
if ( $this->phpmailer->ContentType === 'text/plain' ) {
209
+ $data['type'] = 'text/plain';
210
+ $data['value'] = nl2br( $data['value'] );
211
}
212
213
$this->set_body_param(
vendor/composer/autoload_files.php CHANGED
@@ -9,9 +9,6 @@ return array(
9
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
10
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
11
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
12
- '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
13
- '25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php',
14
- 'f598d06aa772fa33d905e87be6398fb1' => $vendorDir . '/symfony/polyfill-intl-idn/bootstrap.php',
15
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
16
'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
17
);
9
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
10
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
11
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
12
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
13
'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
14
);
vendor/composer/autoload_psr4.php CHANGED
@@ -8,9 +8,6 @@ $baseDir = dirname($vendorDir);
8
return array(
9
'phpseclib\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
10
'WPMailSMTP\\' => array($baseDir . '/src'),
11
- 'Symfony\\Polyfill\\Php72\\' => array($vendorDir . '/symfony/polyfill-php72'),
12
- 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
13
- 'Symfony\\Polyfill\\Intl\\Idn\\' => array($vendorDir . '/symfony/polyfill-intl-idn'),
14
'SendinBlue\\Client\\' => array($vendorDir . '/sendinblue/api-v3-sdk/lib'),
15
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
16
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
8
return array(
9
'phpseclib\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
10
'WPMailSMTP\\' => array($baseDir . '/src'),
11
'SendinBlue\\Client\\' => array($vendorDir . '/sendinblue/api-v3-sdk/lib'),
12
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
13
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
vendor/composer/autoload_static.php CHANGED
@@ -10,9 +10,6 @@ class ComposerStaticInit72f613a3d0c2cc77892490951b6e5352
10
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
11
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
12
'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
13
- '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
14
- '25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php',
15
- 'f598d06aa772fa33d905e87be6398fb1' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/bootstrap.php',
16
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
17
'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
18
);
@@ -28,9 +25,6 @@ class ComposerStaticInit72f613a3d0c2cc77892490951b6e5352
28
),
29
'S' =>
30
array (
31
- 'Symfony\\Polyfill\\Php72\\' => 23,
32
- 'Symfony\\Polyfill\\Mbstring\\' => 26,
33
- 'Symfony\\Polyfill\\Intl\\Idn\\' => 26,
34
'SendinBlue\\Client\\' => 18,
35
),
36
'P' =>
@@ -69,18 +63,6 @@ class ComposerStaticInit72f613a3d0c2cc77892490951b6e5352
69
array (
70
0 => __DIR__ . '/../..' . '/src',
71
),
72
- 'Symfony\\Polyfill\\Php72\\' =>
73
- array (
74
- 0 => __DIR__ . '/..' . '/symfony/polyfill-php72',
75
- ),
76
- 'Symfony\\Polyfill\\Mbstring\\' =>
77
- array (
78
- 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
79
- ),
80
- 'Symfony\\Polyfill\\Intl\\Idn\\' =>
81
- array (
82
- 0 => __DIR__ . '/..' . '/symfony/polyfill-intl-idn',
83
- ),
84
'SendinBlue\\Client\\' =>
85
array (
86
0 => __DIR__ . '/..' . '/sendinblue/api-v3-sdk/lib',
10
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
11
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
12
'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
13
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
14
'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
15
);
25
),
26
'S' =>
27
array (
28
'SendinBlue\\Client\\' => 18,
29
),
30
'P' =>
63
array (
64
0 => __DIR__ . '/../..' . '/src',
65
),
66
'SendinBlue\\Client\\' =>
67
array (
68
0 => __DIR__ . '/..' . '/sendinblue/api-v3-sdk/lib',
vendor/guzzlehttp/guzzle/src/Client.php CHANGED
@@ -2,12 +2,11 @@
2
namespace GuzzleHttp;
3
4
use GuzzleHttp\Cookie\CookieJar;
5
- use GuzzleHttp\Exception\InvalidArgumentException;
6
use GuzzleHttp\Promise;
7
use GuzzleHttp\Psr7;
8
use Psr\Http\Message\RequestInterface;
9
use Psr\Http\Message\ResponseInterface;
10
- use Psr\Http\Message\UriInterface;
11
12
/**
13
* @method ResponseInterface get(string|UriInterface $uri, array $options = [])
@@ -76,12 +75,6 @@ class Client implements ClientInterface
76
$this->configureDefaults($config);
77
}
78
79
- /**
80
- * @param string $method
81
- * @param array $args
82
- *
83
- * @return Promise\PromiseInterface
84
- */
85
public function __call($method, $args)
86
{
87
if (count($args) < 1) {
@@ -96,14 +89,6 @@ class Client implements ClientInterface
96
: $this->request($method, $uri, $opts);
97
}
98
99
- /**
100
- * Asynchronously send an HTTP request.
101
- *
102
- * @param array $options Request options to apply to the given
103
- * request and to the transfer. See \GuzzleHttp\RequestOptions.
104
- *
105
- * @return Promise\PromiseInterface
106
- */
107
public function sendAsync(RequestInterface $request, array $options = [])
108
{
109
// Merge the base URI into the request URI if needed.
@@ -115,35 +100,12 @@ class Client implements ClientInterface
115
);
116
}
117
118
- /**
119
- * Send an HTTP request.
120
- *
121
- * @param array $options Request options to apply to the given
122
- * request and to the transfer. See \GuzzleHttp\RequestOptions.
123
- *
124
- * @return ResponseInterface
125
- * @throws GuzzleException
126
- */
127
public function send(RequestInterface $request, array $options = [])
128
{
129
$options[RequestOptions::SYNCHRONOUS] = true;
130
return $this->sendAsync($request, $options)->wait();
131
}
132
133
- /**
134
- * Create and send an asynchronous HTTP request.
135
- *
136
- * Use an absolute path to override the base path of the client, or a
137
- * relative path to append to the base path of the client. The URL can
138
- * contain the query string as well. Use an array to provide a URL
139
- * template and additional variables to use in the URL template expansion.
140
- *
141
- * @param string $method HTTP method
142
- * @param string|UriInterface $uri URI object or string.
143
- * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions.
144
- *
145
- * @return Promise\PromiseInterface
146
- */
147
public function requestAsync($method, $uri = '', array $options = [])
148
{
149
$options = $this->prepareDefaults($options);
@@ -163,37 +125,12 @@ class Client implements ClientInterface
163
return $this->transfer($request, $options);
164
}
165
166
- /**
167
- * Create and send an HTTP request.
168
- *
169
- * Use an absolute path to override the base path of the client, or a
170
- * relative path to append to the base path of the client. The URL can
171
- * contain the query string as well.
172
- *
173
- * @param string $method HTTP method.
174
- * @param string|UriInterface $uri URI object or string.
175
- * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions.
176
- *
177
- * @return ResponseInterface
178
- * @throws GuzzleException
179
- */
180
public function request($method, $uri = '', array $options = [])
181
{
182
$options[RequestOptions::SYNCHRONOUS] = true;
183
return $this->requestAsync($method, $uri, $options)->wait();
184
}
185
186
- /**
187
- * Get a client configuration option.
188
- *
189
- * These options include default request options of the client, a "handler"
190
- * (if utilized by the concrete client), and a "base_uri" if utilized by
191
- * the concrete client.
192
- *
193
- * @param string|null $option The config option to retrieve.
194
- *
195
- * @return mixed
196
- */
197
public function getConfig($option = null)
198
{
199
return $option === null
@@ -201,11 +138,6 @@ class Client implements ClientInterface
201
: (isset($this->config[$option]) ? $this->config[$option] : null);
202
}
203
204
- /**
205
- * @param string|null $uri
206
- *
207
- * @return UriInterface
208
- */
209
private function buildUri($uri, array $config)
210
{
211
// for BC we accept null which would otherwise fail in uri_for
@@ -215,11 +147,6 @@ class Client implements ClientInterface
215
$uri = Psr7\UriResolver::resolve(Psr7\uri_for($config['base_uri']), $uri);
216
}
217
218
- if (isset($config['idn_conversion']) && ($config['idn_conversion'] !== false)) {
219
- $idnOptions = ($config['idn_conversion'] === true) ? IDNA_DEFAULT : $config['idn_conversion'];
220
- $uri = Utils::idnUriConvert($uri, $idnOptions);
221
- }
222
-
223
return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri;
224
}
225
@@ -227,7 +154,6 @@ class Client implements ClientInterface
227
* Configures the default options for a client.
228
*
229
* @param array $config
230
- * @return void
231
*/
232
private function configureDefaults(array $config)
233
{
@@ -236,8 +162,7 @@ class Client implements ClientInterface
236
'http_errors' => true,
237
'decode_content' => true,
238
'verify' => true,
239
- 'cookies' => false,
240
- 'idn_conversion' => true,
241
];
242
243
// Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set.
@@ -245,7 +170,7 @@ class Client implements ClientInterface
245
// We can only trust the HTTP_PROXY environment variable in a CLI
246
// process due to the fact that PHP has no reliable mechanism to
247
// get environment variables that start with "HTTP_".
248
- if (php_sapi_name() === 'cli' && getenv('HTTP_PROXY')) {
249
$defaults['proxy']['http'] = getenv('HTTP_PROXY');
250
}
251
@@ -300,7 +225,7 @@ class Client implements ClientInterface
300
if (array_key_exists('headers', $options)) {
301
// Allows default headers to be unset.
302
if ($options['headers'] === null) {
303
- $defaults['_conditional'] = [];
304
unset($options['headers']);
305
} elseif (!is_array($options['headers'])) {
306
throw new \InvalidArgumentException('headers must be an array');
@@ -326,7 +251,8 @@ class Client implements ClientInterface
326
* The URI of the request is not modified and the request options are used
327
* as-is without merging in default options.
328
*
329
- * @param array $options See \GuzzleHttp\RequestOptions.
330
*
331
* @return Promise\PromiseInterface
332
*/
@@ -345,7 +271,6 @@ class Client implements ClientInterface
345
}
346
347
$request = $this->applyOptions($request, $options);
348
- /** @var HandlerStack $handler */
349
$handler = $options['handler'];
350
351
try {
@@ -486,11 +411,6 @@ class Client implements ClientInterface
486
return $request;
487
}
488
489
- /**
490
- * Throw Exception with pre-set message.
491
- * @return void
492
- * @throws InvalidArgumentException Invalid body.
493
- */
494
private function invalidBody()
495
{
496
throw new \InvalidArgumentException('Passing in the "body" request '
2
namespace GuzzleHttp;
3
4
use GuzzleHttp\Cookie\CookieJar;
5
use GuzzleHttp\Promise;
6
use GuzzleHttp\Psr7;
7
+ use Psr\Http\Message\UriInterface;
8
use Psr\Http\Message\RequestInterface;
9
use Psr\Http\Message\ResponseInterface;
10
11
/**
12
* @method ResponseInterface get(string|UriInterface $uri, array $options = [])
75
$this->configureDefaults($config);
76
}
77
78
public function __call($method, $args)
79
{
80
if (count($args) < 1) {
89
: $this->request($method, $uri, $opts);
90
}
91
92
public function sendAsync(RequestInterface $request, array $options = [])
93
{
94
// Merge the base URI into the request URI if needed.
100
);
101
}
102
103
public function send(RequestInterface $request, array $options = [])
104
{
105
$options[RequestOptions::SYNCHRONOUS] = true;
106
return $this->sendAsync($request, $options)->wait();
107
}
108
109
public function requestAsync($method, $uri = '', array $options = [])
110
{
111
$options = $this->prepareDefaults($options);
125
return $this->transfer($request, $options);
126
}
127
128
public function request($method, $uri = '', array $options = [])
129
{
130
$options[RequestOptions::SYNCHRONOUS] = true;
131
return $this->requestAsync($method, $uri, $options)->wait();
132
}
133
134
public function getConfig($option = null)
135
{
136
return $option === null
138
: (isset($this->config[$option]) ? $this->config[$option] : null);
139
}
140
141
private function buildUri($uri, array $config)
142
{
143
// for BC we accept null which would otherwise fail in uri_for
147
$uri = Psr7\UriResolver::resolve(Psr7\uri_for($config['base_uri']), $uri);
148
}
149
150
return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri;
151
}
152
154
* Configures the default options for a client.
155
*
156
* @param array $config
157
*/
158
private function configureDefaults(array $config)
159
{
162
'http_errors' => true,
163
'decode_content' => true,
164
'verify' => true,
165
+ 'cookies' => false
166
];
167
168
// Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set.
170
// We can only trust the HTTP_PROXY environment variable in a CLI
171
// process due to the fact that PHP has no reliable mechanism to
172
// get environment variables that start with "HTTP_".
173
+ if (php_sapi_name() == 'cli' && getenv('HTTP_PROXY')) {
174
$defaults['proxy']['http'] = getenv('HTTP_PROXY');
175
}
176
225
if (array_key_exists('headers', $options)) {
226
// Allows default headers to be unset.
227
if ($options['headers'] === null) {
228
+ $defaults['_conditional'] = null;
229
unset($options['headers']);
230
} elseif (!is_array($options['headers'])) {
231
throw new \InvalidArgumentException('headers must be an array');
251
* The URI of the request is not modified and the request options are used
252
* as-is without merging in default options.
253
*
254
+ * @param RequestInterface $request
255
+ * @param array $options
256
*
257
* @return Promise\PromiseInterface
258
*/
271
}
272
273
$request = $this->applyOptions($request, $options);
274
$handler = $options['handler'];
275
276
try {
411
return $request;
412
}
413
414
private function invalidBody()
415
{
416
throw new \InvalidArgumentException('Passing in the "body" request '
vendor/guzzlehttp/guzzle/src/ClientInterface.php CHANGED
@@ -1,8 +1,8 @@
1
<?php
2
namespace GuzzleHttp;
3
4
- use GuzzleHttp\Exception\GuzzleException;
5
use GuzzleHttp\Promise\PromiseInterface;
6
use Psr\Http\Message\RequestInterface;
7
use Psr\Http\Message\ResponseInterface;
8
use Psr\Http\Message\UriInterface;
@@ -12,10 +12,7 @@ use Psr\Http\Message\UriInterface;
12
*/
13
interface ClientInterface
14
{
15
- /**
16
- * @deprecated Will be removed in Guzzle 7.0.0
17
- */
18
- const VERSION = '6.5.3';
19
20
/**
21
* Send an HTTP request.
1
<?php
2
namespace GuzzleHttp;
3
4
use GuzzleHttp\Promise\PromiseInterface;
5
+ use GuzzleHttp\Exception\GuzzleException;
6
use Psr\Http\Message\RequestInterface;
7
use Psr\Http\Message\ResponseInterface;
8
use Psr\Http\Message\UriInterface;
12
*/
13
interface ClientInterface
14
{
15
+ const VERSION = '6.4.1';
16
17
/**
18
* Send an HTTP request.
vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php CHANGED
@@ -94,8 +94,8 @@ class CookieJar implements CookieJarInterface
94
*/
95
public function getCookieByName($name)
96
{
97
- // don't allow a non string name
98
- if ($name === null || !is_scalar($name)) {
99
return null;
100
}
101
foreach ($this->cookies as $cookie) {
@@ -103,8 +103,6 @@ class CookieJar implements CookieJarInterface
103
return $cookie;
104
}
105
}
106
-
107
- return null;
108
}
109
110
public function toArray()
94
*/
95
public function getCookieByName($name)
96
{
97
+ // don't allow a null name
98
+ if ($name === null) {
99
return null;
100
}
101
foreach ($this->cookies as $cookie) {
103
return $cookie;
104
}
105
}
106
}
107
108
public function toArray()
vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php CHANGED
@@ -58,9 +58,9 @@ interface CookieJarInterface extends \Countable, \IteratorAggregate
58
* arguments, then the cookie with the specified name, path and domain is
59
* removed.
60
*
61
- * @param string|null $domain Clears cookies matching a domain
62
- * @param string|null $path Clears cookies matching a domain and path
63
- * @param string|null $name Clears cookies matching a domain, path, and name
64
*
65
* @return CookieJarInterface
66
*/
58
* arguments, then the cookie with the specified name, path and domain is
59
* removed.
60
*
61
+ * @param string $domain Clears cookies matching a domain
62
+ * @param string $path Clears cookies matching a domain and path
63
+ * @param string $name Clears cookies matching a domain, path, and name
64
*
65
* @return CookieJarInterface
66
*/
vendor/guzzlehttp/guzzle/src/Exception/RequestException.php CHANGED
@@ -1,9 +1,9 @@
1
<?php
2
namespace GuzzleHttp\Exception;
3
4
- use GuzzleHttp\Promise\PromiseInterface;
5
use Psr\Http\Message\RequestInterface;
6
use Psr\Http\Message\ResponseInterface;
7
use Psr\Http\Message\UriInterface;
8
9
/**
@@ -14,7 +14,7 @@ class RequestException extends TransferException
14
/** @var RequestInterface */
15
private $request;
16
17
- /** @var ResponseInterface|null */
18
private $response;
19
20
/** @var array */
@@ -124,17 +124,42 @@ class RequestException extends TransferException
124
*/
125
public static function getResponseBodySummary(ResponseInterface $response)
126
{
127
- return \GuzzleHttp\Psr7\get_message_body_summary($response);
128
}
129
130
/**
131
- * Obfuscates URI if there is a username and a password present
132
*
133
* @param UriInterface $uri
134
*
135
* @return UriInterface
136
*/
137
- private static function obfuscateUri(UriInterface $uri)
138
{
139
$userInfo = $uri->getUserInfo();
140
1
<?php
2
namespace GuzzleHttp\Exception;
3
4
use Psr\Http\Message\RequestInterface;
5
use Psr\Http\Message\ResponseInterface;
6
+ use GuzzleHttp\Promise\PromiseInterface;
7
use Psr\Http\Message\UriInterface;
8
9
/**
14
/** @var RequestInterface */
15
private $request;
16
17
+ /** @var ResponseInterface */
18
private $response;
19
20
/** @var array */
124
*/
125
public static function getResponseBodySummary(ResponseInterface $response)
126
{
127
+ $body = $response->getBody();
128
+
129
+ if (!$body->isSeekable() || !$body->isReadable()) {
130
+ return null;
131
+ }
132
+
133
+ $size = $body->getSize();
134
+
135
+ if ($size === 0) {
136
+ return null;
137
+ }
138
+
139
+ $summary = $body->read(120);
140
+ $body->rewind();
141
+
142
+ if ($size > 120) {
143
+ $summary .= ' (truncated...)';
144
+ }
145
+
146
+ // Matches any printable character, including unicode characters:
147
+ // letters, marks, numbers, punctuation, spacing, and separators.
148
+ if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/', $summary)) {
149
+ return null;
150
+ }
151
+
152
+ return $summary;
153
}
154
155
/**
156
+ * Obfuscates URI if there is an username and a password present
157
*
158
* @param UriInterface $uri
159
*
160
* @return UriInterface
161
*/
162
+ private static function obfuscateUri($uri)
163
{
164
$userInfo = $uri->getUserInfo();
165
vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php CHANGED
@@ -1,8 +1,8 @@
1
<?php
2
namespace GuzzleHttp\Handler;
3
4
- use GuzzleHttp\Exception\ConnectException;
5
use GuzzleHttp\Exception\RequestException;
6
use GuzzleHttp\Promise\FulfilledPromise;
7
use GuzzleHttp\Psr7;
8
use GuzzleHttp\Psr7\LazyOpenStream;
@@ -454,16 +454,11 @@ class CurlFactory implements CurlFactoryInterface
454
}
455
456
if (isset($options['ssl_key'])) {
457
- if (is_array($options['ssl_key'])) {
458
- if (count($options['ssl_key']) === 2) {
459
- list($sslKey, $conf[CURLOPT_SSLKEYPASSWD]) = $options['ssl_key'];
460
- } else {
461
- list($sslKey) = $options['ssl_key'];
462
- }
463
}
464
-
465
- $sslKey = isset($sslKey) ? $sslKey: $options['ssl_key'];
466
-
467
if (!file_exists($sslKey)) {
468
throw new \InvalidArgumentException(
469
"SSL private key not found: {$sslKey}"
1
<?php
2
namespace GuzzleHttp\Handler;
3
4
use GuzzleHttp\Exception\RequestException;
5
+ use GuzzleHttp\Exception\ConnectException;
6
use GuzzleHttp\Promise\FulfilledPromise;
7
use GuzzleHttp\Psr7;
8
use GuzzleHttp\Psr7\LazyOpenStream;
454
}
455
456
if (isset($options['ssl_key'])) {
457
+ $sslKey = $options['ssl_key'];
458
+ if (is_array($sslKey)) {
459
+ $conf[CURLOPT_SSLKEYPASSWD] = $sslKey[1];
460
+ $sslKey = $sslKey[0];
461
}
462
if (!file_exists($sslKey)) {
463
throw new \InvalidArgumentException(
464
"SSL private key not found: {$sslKey}"
vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php CHANGED
@@ -1,10 +1,9 @@
1
<?php
2
namespace GuzzleHttp\Handler;
3
4
- use GuzzleHttp\Exception\InvalidArgumentException;
5
use GuzzleHttp\Promise as P;
6
use GuzzleHttp\Promise\Promise;
7
- use GuzzleHttp\Utils;
8
use Psr\Http\Message\RequestInterface;
9
10
/**
@@ -24,7 +23,6 @@ class CurlMultiHandler
24
private $active;
25
private $handles = [];
26
private $delays = [];
27
- private $options = [];
28
29
/**
30
* This handler accepts the following options:
@@ -32,8 +30,6 @@ class CurlMultiHandler
32
* - handle_factory: An optional factory used to create curl handles
33
* - select_timeout: Optional timeout (in seconds) to block before timing
34
* out while selecting curl handles. Defaults to 1 second.
35
- * - options: An associative array of CURLMOPT_* options and
36
- * corresponding values for curl_multi_setopt()
37
*
38
* @param array $options
39
*/
@@ -49,23 +45,12 @@ class CurlMultiHandler
49
} else {
50
$this->selectTimeout = 1;
51
}
52
-
53
- $this->options = isset($options['options']) ? $options['options'] : [];
54
}
55
56
public function __get($name)
57
{
58
if ($name === '_mh') {
59
- $this->_mh = curl_multi_init();
60
-
61
- foreach ($this->options as $option => $value) {
62
- // A warning is raised in case of a wrong option.
63
- curl_multi_setopt($this->_mh, $option, $value);
64
- }
65
-
66
- // Further calls to _mh will return the value directly, without entering the
67
- // __get() method at all.
68
- return $this->_mh;
69
}
70
71
throw new \BadMethodCallException();
@@ -103,7 +88,7 @@ class CurlMultiHandler
103
{
104
// Add any delayed handles if needed.
105
if ($this->delays) {
106
- $currentTime = Utils::currentTime();
107
foreach ($this->delays as $id => $delay) {
108
if ($currentTime >= $delay) {
109
unset($this->delays[$id]);
@@ -155,7 +140,7 @@ class CurlMultiHandler
155
if (empty($easy->options['delay'])) {
156
curl_multi_add_handle($this->_mh, $easy->handle);
157
} else {
158
- $this->delays[$id] = Utils::currentTime() + ($easy->options['delay'] / 1000);
159
}
160
}
161
@@ -207,7 +192,7 @@ class CurlMultiHandler
207
208
private function timeToNext()
209
{
210
- $currentTime = Utils::currentTime();
211
$nextTime = PHP_INT_MAX;
212
foreach ($this->delays as $time) {
213
if ($time < $nextTime) {
1
<?php
2
namespace GuzzleHttp\Handler;
3
4
use GuzzleHttp\Promise as P;
5
use GuzzleHttp\Promise\Promise;
6
+ use GuzzleHttp\Psr7;
7
use Psr\Http\Message\RequestInterface;
8
9
/**
23
private $active;
24
private $handles = [];
25
private $delays = [];
26
27
/**
28
* This handler accepts the following options:
30
* - handle_factory: An optional factory used to create curl handles
31
* - select_timeout: Optional timeout (in seconds) to block before timing
32
* out while selecting curl handles. Defaults to 1 second.
33
*
34
* @param array $options
35
*/
45
} else {
46
$this->selectTimeout = 1;
47
}
48
}
49
50
public function __get($name)
51
{
52
if ($name === '_mh') {
53
+ return $this->_mh = curl_multi_init();
54
}
55
56
throw new \BadMethodCallException();
88
{
89
// Add any delayed handles if needed.
90
if ($this->delays) {
91
+ $currentTime = \GuzzleHttp\_current_time();
92
foreach ($this->delays as $id => $delay) {
93
if ($currentTime >= $delay) {
94
unset($this->delays[$id]);
140
if (empty($easy->options['delay'])) {
141
curl_multi_add_handle($this->_mh, $easy->handle);
142
} else {
143
+ $this->delays[$id] = \GuzzleHttp\_current_time() + ($easy->options['delay'] / 1000);
144
}
145
}
146
192
193
private function timeToNext()
194
{
195
+ $currentTime = \GuzzleHttp\_current_time();
196
$nextTime = PHP_INT_MAX;
197
foreach ($this->delays as $time) {
198
if ($time < $nextTime) {
vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php CHANGED
@@ -66,7 +66,7 @@ class MockHandler implements \Countable
66
throw new \OutOfBoundsException('Mock queue is empty');
67
}
68
69
- if (isset($options['delay']) && is_numeric($options['delay'])) {
70
usleep($options['delay'] * 1000);
71
}
72
@@ -175,11 +175,6 @@ class MockHandler implements \Countable
175
return count($this->queue);
176
}
177
178
- public function reset()
179
- {
180
- $this->queue = [];
181
- }
182
-
183
private function invokeStats(
184
RequestInterface $request,
185
array $options,
66
throw new \OutOfBoundsException('Mock queue is empty');
67
}
68
69
+ if (isset($options['delay'])) {
70
usleep($options['delay'] * 1000);
71
}
72
175
return count($this->queue);
176
}
177
178
private function invokeStats(
179
RequestInterface $request,
180
array $options,
vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php CHANGED
@@ -1,13 +1,12 @@
1
<?php
2
namespace GuzzleHttp\Handler;
3
4
- use GuzzleHttp\Exception\ConnectException;
5
use GuzzleHttp\Exception\RequestException;
6
use GuzzleHttp\Promise\FulfilledPromise;
7
use GuzzleHttp\Promise\PromiseInterface;
8
use GuzzleHttp\Psr7;
9
use GuzzleHttp\TransferStats;
10
- use GuzzleHttp\Utils;
11
use Psr\Http\Message\RequestInterface;
12
use Psr\Http\Message\ResponseInterface;
13
use Psr\Http\Message\StreamInterface;
@@ -34,7 +33,7 @@ class StreamHandler
34
usleep($options['delay'] * 1000);
35
}
36
37
- $startTime = isset($options['on_stats']) ? Utils::currentTime() : null;
38
39
try {
40
// Does not support the expect header.
@@ -83,7 +82,7 @@ class StreamHandler
83
$stats = new TransferStats(
84
$request,
85
$response,
86
- Utils::currentTime() - $startTime,
87
$error,
88
[]
89
);
1
<?php
2
namespace GuzzleHttp\Handler;
3
4
use GuzzleHttp\Exception\RequestException;
5
+ use GuzzleHttp\Exception\ConnectException;
6
use GuzzleHttp\Promise\FulfilledPromise;
7
use GuzzleHttp\Promise\PromiseInterface;
8
use GuzzleHttp\Psr7;
9
use GuzzleHttp\TransferStats;
10
use Psr\Http\Message\RequestInterface;
11
use Psr\Http\Message\ResponseInterface;
12
use Psr\Http\Message\StreamInterface;
33
usleep($options['delay'] * 1000);
34
}
35
36
+ $startTime = isset($options['on_stats']) ? \GuzzleHttp\_current_time() : null;
37
38
try {
39
// Does not support the expect header.
82
$stats = new TransferStats(
83
$request,
84
$response,
85
+ \GuzzleHttp\_current_time() - $startTime,
86
$error,
87
[]
88
);
vendor/guzzlehttp/guzzle/src/HandlerStack.php CHANGED
@@ -1,9 +1,7 @@
1
<?php
2
namespace GuzzleHttp;
3
4
- use GuzzleHttp\Promise\PromiseInterface;
5
use Psr\Http\Message\RequestInterface;
6
- use Psr\Http\Message\ResponseInterface;
7
8
/**
9
* Creates a composed Guzzle handler function by stacking middlewares on top of
@@ -11,7 +9,7 @@ use Psr\Http\Message\ResponseInterface;
11
*/
12
class HandlerStack
13
{
14
- /** @var callable|null */
15
private $handler;
16
17
/** @var array */
@@ -61,8 +59,6 @@ class HandlerStack
61
*
62
* @param RequestInterface $request
63
* @param array $options
64
- *
65
- * @return ResponseInterface|PromiseInterface
66
*/
67
public function __invoke(RequestInterface $request, array $options)
68
{
1
<?php
2
namespace GuzzleHttp;
3
4
use Psr\Http\Message\RequestInterface;
5
6
/**
7
* Creates a composed Guzzle handler function by stacking middlewares on top of
9
*/
10
class HandlerStack
11
{
12
+ /** @var callable */
13
private $handler;
14
15
/** @var array */
59
*
60
* @param RequestInterface $request
61
* @param array $options
62
*/
63
public function __invoke(RequestInterface $request, array $options)
64
{
vendor/guzzlehttp/guzzle/src/MessageFormatter.php CHANGED
@@ -168,11 +168,6 @@ class MessageFormatter
168
);
169
}
170
171
- /**
172
- * Get headers from message as string
173
- *
174
- * @return string
175
- */
176
private function headers(MessageInterface $message)
177
{
178
$result = '';
168
);
169
}
170
171
private function headers(MessageInterface $message)
172
{
173
$result = '';
vendor/guzzlehttp/guzzle/src/Pool.php CHANGED
@@ -1,10 +1,9 @@
1
<?php
2
namespace GuzzleHttp;
3
4
- use GuzzleHttp\Promise\EachPromise;
5
- use GuzzleHttp\Promise\PromiseInterface;
6
use GuzzleHttp\Promise\PromisorInterface;
7
use Psr\Http\Message\RequestInterface;
8
9
/**
10
* Sends an iterator of requests concurrently using a capped pool size.
@@ -70,11 +69,6 @@ class Pool implements PromisorInterface
70
$this->each = new EachPromise($requests(), $config);
71
}
72
73
- /**
74
- * Get promise
75
- *
76
- * @return PromiseInterface
77
- */
78
public function promise()
79
{
80
return $this->each->promise();
@@ -112,11 +106,6 @@ class Pool implements PromisorInterface
112
return $res;
113
}
114
115
- /**
116
- * Execute callback(s)
117
- *
118
- * @return void
119
- */
120
private static function cmpCallback(array &$options, $name, array &$results)
121
{
122
if (!isset($options[$name])) {
1
<?php
2
namespace GuzzleHttp;
3
4
use GuzzleHttp\Promise\PromisorInterface;
5
use Psr\Http\Message\RequestInterface;
6
+ use GuzzleHttp\Promise\EachPromise;
7
8
/**
9
* Sends an iterator of requests concurrently using a capped pool size.
69
$this->each = new EachPromise($requests(), $config);
70
}
71
72
public function promise()
73
{
74
return $this->each->promise();
106
return $res;
107
}
108
109
private static function cmpCallback(array &$options, $name, array &$results)
110
{
111
if (!isset($options[$name])) {
vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php CHANGED
@@ -66,11 +66,6 @@ class PrepareBodyMiddleware
66
return $fn(Psr7\modify_request($request, $modify), $options);
67
}
68
69
- /**
70
- * Add expect header
71
- *
72
- * @return void
73
- */
74
private function addExpectHeader(
75
RequestInterface $request,
76
array $options,
66
return $fn(Psr7\modify_request($request, $modify), $options);
67
}
68
69
private function addExpectHeader(
70
RequestInterface $request,
71
array $options,
vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php CHANGED
@@ -13,7 +13,7 @@ use Psr\Http\Message\UriInterface;
13
* Request redirect middleware.
14
*
15
* Apply this middleware like other middleware using
16
- * {@see \GuzzleHttp\Middleware::redirect()}.
17
*/
18
class RedirectMiddleware
19
{
@@ -76,7 +76,7 @@ class RedirectMiddleware
76
/**
77
* @param RequestInterface $request
78
* @param array $options
79
- * @param ResponseInterface $response
80
*
81
* @return ResponseInterface|PromiseInterface
82
*/
@@ -118,11 +118,6 @@ class RedirectMiddleware
118
return $promise;
119
}
120
121
- /**
122
- * Enable tracking on promise.
123
- *
124
- * @return PromiseInterface
125
- */
126
private function withTracking(PromiseInterface $promise, $uri, $statusCode)
127
{
128
return $promise->then(
@@ -140,13 +135,6 @@ class RedirectMiddleware
140
);
141
}
142
143
- /**
144
- * Check for too many redirects
145
- *
146
- * @return void
147
- *
148
- * @throws TooManyRedirectsException Too many redirects.
149
- */
150
private function guardMax(RequestInterface $request, array &$options)
151
{
152
$current = isset($options['__redirect_count'])
@@ -184,19 +172,13 @@ class RedirectMiddleware
184
// would do.
185
$statusCode = $response->getStatusCode();
186
if ($statusCode == 303 ||
187
- ($statusCode <= 302 && !$options['allow_redirects']['strict'])
188
) {
189
$modify['method'] = 'GET';
190
$modify['body'] = '';
191
}
192
193
- $uri = $this->redirectUri($request, $response, $protocols);
194
- if (isset($options['idn_conversion']) && ($options['idn_conversion'] !== false)) {
195
- $idnOptions = ($options['idn_conversion'] === true) ? IDNA_DEFAULT : $options['idn_conversion'];
196
- $uri = Utils::idnUriConvert($uri, $idnOptions);
197
- }
198
-
199
- $modify['uri'] = $uri;
200
Psr7\rewind_body($request);
201
202
// Add the Referer header if it is told to do so and only
13
* Request redirect middleware.
14
*
15
* Apply this middleware like other middleware using
16
+ * {@see GuzzleHttp\Middleware::redirect()}.
17
*/
18
class RedirectMiddleware
19
{
76
/**
77
* @param RequestInterface $request
78
* @param array $options
79
+ * @param ResponseInterface|PromiseInterface $response
80
*
81
* @return ResponseInterface|PromiseInterface
82
*/
118
return $promise;
119
}
120
121
private function withTracking(PromiseInterface $promise, $uri, $statusCode)
122
{
123
return $promise->then(
135
);
136
}
137
138
private function guardMax(RequestInterface $request, array &$options)
139
{
140
$current = isset($options['__redirect_count'])
172
// would do.
173
$statusCode = $response->getStatusCode();
174
if ($statusCode == 303 ||
175
+ ($statusCode <= 302 && $request->getBody() && !$options['allow_redirects']['strict'])
176
) {
177
$modify['method'] = 'GET';
178
$modify['body'] = '';
179
}
180
181
+ $modify['uri'] = $this->redirectUri($request, $response, $protocols);
182
Psr7\rewind_body($request);
183
184
// Add the Referer header if it is told to do so and only
vendor/guzzlehttp/guzzle/src/RequestOptions.php CHANGED
@@ -132,14 +132,6 @@ final class RequestOptions
132
*/
133
const HTTP_ERRORS = 'http_errors';
134
135
- /**
136
- * idn: (bool|int, default=true) A combination of IDNA_* constants for
137
- * idn_to_ascii() PHP's function (see "options" parameter). Set to false to
138
- * disable IDN support completely, or to true to use the default
139
- * configuration (IDNA_DEFAULT constant).
140
- */
141
- const IDN_CONVERSION = 'idn_conversion';
142
-
143
/**
144
* json: (mixed) Adds JSON data to a request. The provided value is JSON
145
* encoded and a Content-Type header of application/json will be added to
132
*/
133
const HTTP_ERRORS = 'http_errors';
134
135
/**
136
* json: (mixed) Adds JSON data to a request. The provided value is JSON
137
* encoded and a Content-Type header of application/json will be added to
vendor/guzzlehttp/guzzle/src/RetryMiddleware.php CHANGED
@@ -47,11 +47,11 @@ class RetryMiddleware
47
*
48
* @param int $retries
49
*
50
- * @return int milliseconds.
51
*/
52
public static function exponentialDelay($retries)
53
{
54
- return (int) pow(2, $retries - 1) * 1000;
55
}
56
57
/**
@@ -74,11 +74,6 @@ class RetryMiddleware
74
);
75
}
76
77
- /**
78
- * Execute fulfilled closure
79
- *
80
- * @return mixed
81
- */
82
private function onFulfilled(RequestInterface $req, array $options)
83
{
84
return function ($value) use ($req, $options) {
@@ -95,11 +90,6 @@ class RetryMiddleware
95
};
96
}
97
98
- /**
99
- * Execute rejected closure
100
- *
101
- * @return callable
102
- */
103
private function onRejected(RequestInterface $req, array $options)
104
{
105
return function ($reason) use ($req, $options) {
@@ -116,9 +106,6 @@ class RetryMiddleware
116
};
117
}
118
119
- /**
120
- * @return self
121
- */
122
private function doRetry(RequestInterface $request, array $options, ResponseInterface $response = null)
123
{
124
$options['delay'] = call_user_func($this->delay, ++$options['retries'], $response);
47
*
48
* @param int $retries
49
*
50
+ * @return int
51
*/
52
public static function exponentialDelay($retries)
53
{
54
+ return (int) pow(2, $retries - 1);
55
}
56
57
/**
74
);
75
}
76
77
private function onFulfilled(RequestInterface $req, array $options)
78
{
79
return function ($value) use ($req, $options) {
90
};
91
}
92
93
private function onRejected(RequestInterface $req, array $options)
94
{
95
return function ($reason) use ($req, $options) {
106
};
107
}
108
109
private function doRetry(RequestInterface $request, array $options, ResponseInterface $response = null)
110
{
111
$options['delay'] = call_user_func($this->delay, ++$options['retries'], $response);
vendor/guzzlehttp/guzzle/src/TransferStats.php CHANGED
@@ -18,11 +18,11 @@ final class TransferStats
18
private $handlerErrorData;
19
20
/**
21
- * @param RequestInterface $request Request that was sent.
22
- * @param ResponseInterface|null $response Response received (if any)
23
- * @param float|null $transferTime Total handler transfer time.
24
- * @param mixed $handlerErrorData Handler error data.
25
- * @param array $handlerStats Handler specific stats.
26
*/
27
public function __construct(
28
RequestInterface $request,
@@ -93,7 +93,7 @@ final class TransferStats
93
/**
94
* Get the estimated time the request was being transferred by the handler.
95
*
96
- * @return float|null Time in seconds.
97
*/
98
public function getTransferTime()
99
{
18
private $handlerErrorData;
19
20
/**
21
+ * @param RequestInterface $request Request that was sent.
22
+ * @param ResponseInterface $response Response received (if any)
23
+ * @param float|null $transferTime Total handler transfer time.
24
+ * @param mixed $handlerErrorData Handler error data.
25
+ * @param array $handlerStats Handler specific stats.
26
*/
27
public function __construct(
28
RequestInterface $request,
93
/**
94
* Get the estimated time the request was being transferred by the handler.
95
*
96
+ * @return float Time in seconds.
97
*/
98
public function getTransferTime()
99
{
vendor/guzzlehttp/guzzle/src/Utils.php DELETED
@@ -1,67 +0,0 @@
1
- <?php
2
- namespace GuzzleHttp;
3
-
4
- use GuzzleHttp\Exception\InvalidArgumentException;
5
- use Psr\Http\Message\UriInterface;
6
-
7
- final class Utils
8
- {
9
- /**
10
- * Wrapper for the hrtime() or microtime() functions
11
- * (depending on the PHP version, one of the two is used)
12
- *
13
- * @return float|mixed UNIX timestamp
14
- *
15
- * @internal
16
- */
17
- public static function currentTime()
18
- {
19
- return function_exists('hrtime') ? hrtime(true) / 1e9 : microtime(true);
20
- }
21
-
22
- /**
23
- * @param int $options
24
- *
25
- * @return UriInterface
26
- * @throws InvalidArgumentException
27
- *
28
- * @internal
29
- */
30
- public static function idnUriConvert(UriInterface $uri, $options = 0)
31
- {
32
- if ($uri->getHost()) {
33
- $idnaVariant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : 0;
34
- $asciiHost = $idnaVariant === 0
35
- ? idn_to_ascii($uri->getHost(), $options)
36
- : idn_to_ascii($uri->getHost(), $options, $idnaVariant, $info);
37
- if ($asciiHost === false) {
38
- $errorBitSet = isset($info['errors']) ? $info['errors'] : 0;
39
-
40
- $errorConstants = array_filter(array_keys(get_defined_constants()), function ($name) {
41
- return substr($name, 0, 11) === 'IDNA_ERROR_';
42
- });
43
-
44
- $errors = [];
45
- foreach ($errorConstants as $errorConstant) {
46
- if ($errorBitSet & constant($errorConstant)) {
47
- $errors[] = $errorConstant;
48
- }
49
- }
50
-
51
- $errorMessage = 'IDN conversion failed';
52
- if ($errors) {
53
- $errorMessage .= ' (errors: ' . implode(', ', $errors) . ')';
54
- }
55
-
56
- throw new InvalidArgumentException($errorMessage);
57
- } else {
58
- if ($uri->getHost() !== $asciiHost) {
59
- // Replace URI only if the ASCII version is different
60
- $uri = $uri->withHost($asciiHost);
61
- }
62
- }
63
- }
64
-
65
- return $uri;
66
- }
67
- }
vendor/guzzlehttp/guzzle/src/functions.php CHANGED
@@ -56,7 +56,7 @@ function describe_type($input)
56
/**
57
* Parses an array of header lines into an associative array of headers.
58
*
59
- * @param iterable $lines Header lines array of strings in the following
60
* format: "Name: Value"
61
* @return array
62
*/
@@ -97,8 +97,8 @@ function debug_resource($value = null)
97
*
98
* The returned handler is not wrapped by any default middlewares.
99
*
100
- * @return callable Returns the best handler for the given system.
101
* @throws \RuntimeException if no viable Handler is available.
102
*/
103
function choose_handler()
104
{
@@ -332,3 +332,15 @@ function json_encode($value, $options = 0, $depth = 512)
332
333
return $json;
334
}
56
/**
57
* Parses an array of header lines into an associative array of headers.
58
*
59
+ * @param array $lines Header lines array of strings in the following
60
* format: "Name: Value"
61
* @return array
62
*/
97
*
98
* The returned handler is not wrapped by any default middlewares.
99
*
100
* @throws \RuntimeException if no viable Handler is available.
101
+ * @return callable Returns the best handler for the given system.
102
*/
103
function choose_handler()
104
{
332
333
return $json;
334
}
335
+
336
+ /**
337
+ * Wrapper for the hrtime() or microtime() functions
338
+ * (depending on the PHP version, one of the two is used)
339
+ *
340
+ * @return float|mixed UNIX timestamp
341
+ * @internal
342
+ */
343
+ function _current_time()
344
+ {
345
+ return function_exists('hrtime') ? hrtime(true) / 1e9 : microtime(true);
346
+ }
vendor/symfony/polyfill-intl-idn/Idn.php DELETED
@@ -1,283 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * Copyright (c) 2014 TrueServer B.V.
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is furnished
11
- * to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in all
14
- * copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- * THE SOFTWARE.
23
- *
24
- * Originally forked from
25
- * https://github.com/true/php-punycode/blob/v2.1.1/src/Punycode.php
26
- */
27
-
28
- namespace Symfony\Polyfill\Intl\Idn;
29
-
30
- /**
31
- * Partial intl implementation in pure PHP.
32
- *
33
- * Implemented:
34
- * - idn_to_ascii - Convert domain name to IDNA ASCII form
35
- * - idn_to_utf8 - Convert domain name from IDNA ASCII to Unicode
36
- *
37
- * @author Renan Gonçalves <renan.saddam@gmail.com>
38
- * @author Sebastian Kroczek <sk@xbug.de>
39
- * @author Dmitry Lukashin <dmitry@lukashin.ru>
40
- * @author Laurent Bassin <laurent@bassin.info>
41
- *
42
- * @internal
43
- */
44
- final class Idn
45
- {
46
- const INTL_IDNA_VARIANT_2003 = 0;
47
- const INTL_IDNA_VARIANT_UTS46 = 1;
48
-
49
- private static $encodeTable = array(
50
- 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
51
- 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
52
- 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
53
- );
54
-
55
- private static $decodeTable = array(
56
- 'a' => 0, 'b' => 1, 'c' => 2, 'd' => 3, 'e' => 4, 'f' => 5,
57
- 'g' => 6, 'h' => 7, 'i' => 8, 'j' => 9, 'k' => 10, 'l' => 11,
58
- 'm' => 12, 'n' => 13, 'o' => 14, 'p' => 15, 'q' => 16, 'r' => 17,
59
- 's' => 18, 't' => 19, 'u' => 20, 'v' => 21, 'w' => 22, 'x' => 23,
60
- 'y' => 24, 'z' => 25, '0' => 26, '1' => 27, '2' => 28, '3' => 29,
61
- '4' => 30, '5' => 31, '6' => 32, '7' => 33, '8' => 34, '9' => 35,
62
- );
63
-
64
- public static function idn_to_ascii($domain, $options, $variant, &$idna_info = array())
65
- {
66
- if (\PHP_VERSION_ID >= 70200 && self::INTL_IDNA_VARIANT_2003 === $variant) {
67
- @trigger_error('idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated', E_USER_DEPRECATED);
68
- }
69
-
70
- if (self::INTL_IDNA_VARIANT_UTS46 === $variant) {
71
- $domain = mb_strtolower($domain, 'utf-8');
72
- }
73
-
74
- $parts = explode('.', $domain);
75
-
76
- foreach ($parts as $i => &$part) {
77
- if ('' === $part && \count($parts) > 1 + $i) {
78
- return false;
79
- }
80
- if (false === $part = self::encodePart($part)) {
81
- return false;
82
- }
83
- }
84
-
85
- $output = implode('.', $parts);
86
-
87
- $idna_info = array(
88
- 'result' => \strlen($output) > 255 ? false : $output,
89
- 'isTransitionalDifferent' => false,
90
- 'errors' => 0,
91
- );
92
-
93
- return $idna_info['result'];
94
- }
95
-
96
- public static function idn_to_utf8($domain, $options, $variant, &$idna_info = array())
97
- {
98
- if (\PHP_VERSION_ID >= 70200 && self::INTL_IDNA_VARIANT_2003 === $variant) {
99
- @trigger_error('idn_to_utf8(): INTL_IDNA_VARIANT_2003 is deprecated', E_USER_DEPRECATED);
100
- }
101
-
102
- $parts = explode('.', $domain);
103
-
104
- foreach ($parts as &$part) {
105
- $length = \strlen($part);
106
- if ($length < 1 || 63 < $length) {
107
- continue;
108
- }
109
- if (0 !== strpos($part, 'xn--')) {
110
- continue;
111
- }
112
-
113
- $part = substr($part, 4);
114
- $part = self::decodePart($part);
115
- }
116
-
117
- $output = implode('.', $parts);
118
-
119
- $idna_info = array(
120
- 'result' => \strlen($output) > 255 ? false : $output,
121
- 'isTransitionalDifferent' => false,
122
- 'errors' => 0,
123
- );
124
-
125
- return $idna_info['result'];
126
- }
127
-
128
- private static function encodePart($input)
129
- {
130
- $codePoints = self::listCodePoints($input);
131
-
132
- $n = 128;
133
- $bias = 72;
134
- $delta = 0;
135
- $h = $b = \count($codePoints['basic']);
136
-
137
- $output = '';
138
- foreach ($codePoints['basic'] as $code) {
139
- $output .= mb_chr($code, 'utf-8');
140
- }
141
- if ($input === $output) {
142
- return $output;
143
- }
144
- if ($b > 0) {
145
- $output .= '-';
146
- }
147
-
148
- $codePoints['nonBasic'] = array_unique($codePoints['nonBasic']);
149
- sort($codePoints['nonBasic']);
150
-
151
- $i = 0;
152
- $length = mb_strlen($input, 'utf-8');
153
- while ($h < $length) {
154
- $m = $codePoints['nonBasic'][$i++];
155
- $delta += ($m - $n) * ($h + 1);
156
- $n = $m;
157
-
158
- foreach ($codePoints['all'] as $c) {
159
- if ($c < $n || $c < 128) {
160
- ++$delta;
161
- }
162
- if ($c === $n) {
163
- $q = $delta;
164
- for ($k = 36;; $k += 36) {
165
- $t = self::calculateThreshold($k, $bias);
166
- if ($q < $t) {
167
- break;
168
- }
169
-
170
- $code = $t + (($q - $t) % (36 - $t));
171
- $output .= self::$encodeTable[$code];
172
-
173
- $q = ($q - $t) / (36 - $t);
174
- }
175
-
176
- $output .= self::$encodeTable[$q];
177
- $bias = self::adapt($delta, $h + 1, ($h === $b));
178
- $delta = 0;
179
- ++$h;
180
- }
181
- }
182
-
183
- ++$delta;
184
- ++$n;
185
- }
186
-
187
- $output = 'xn--'.$output;
188
-
189
- return \strlen($output) < 1 || 63 < \strlen($output) ? false : strtolower($output);
190
- }
191
-
192
- private static function listCodePoints($input)
193
- {
194
- $codePoints = array(
195
- 'all' => array(),
196
- 'basic' => array(),
197
- 'nonBasic' => array(),
198
- );
199
-
200
- $length = mb_strlen($input, 'utf-8');
201
- for ($i = 0; $i < $length; ++$i) {
202
- $char = mb_substr($input, $i, 1, 'utf-8');
203
- $code = mb_ord($char, 'utf-8');
204
- if ($code < 128) {
205
- $codePoints['all'][] = $codePoints['basic'][] = $code;
206
- } else {
207
- $codePoints['all'][] = $codePoints['nonBasic'][] = $code;
208
- }
209
- }
210
-
211
- return $codePoints;
212
- }
213
-
214
- private static function calculateThreshold($k, $bias)
215
- {
216
- if ($k <= $bias + 1) {
217
- return 1;
218
- }
219
- if ($k >= $bias + 26) {
220
- return 26;
221
- }
222
-
223
- return $k - $bias;
224
- }
225
-
226
- private static function adapt($delta, $numPoints, $firstTime)
227
- {
228
- $delta = (int) ($firstTime ? $delta / 700 : $delta / 2);
229
- $delta += (int) ($delta / $numPoints);
230
-
231
- $k = 0;
232
- while ($delta > 35 * 13) {
233
- $delta = (int) ($delta / 35);
234
- $k = $k + 36;
235
- }
236
-
237
- return $k + (int) (36 * $delta / ($delta + 38));
238
- }
239
-
240
- private static function decodePart($input)
241
- {
242
- $n = 128;
243
- $i = 0;
244
- $bias = 72;
245
- $output = '';
246
-
247
- $pos = strrpos($input, '-');
248
- if (false !== $pos) {
249
- $output = substr($input, 0, $pos++);
250
- } else {
251
- $pos = 0;
252
- }
253
-
254
- $outputLength = \strlen($output);
255
- $inputLength = \strlen($input);
256
-
257
- while ($pos < $inputLength) {
258
- $oldi = $i;
259
- $w = 1;
260
-
261
- for ($k = 36;; $k += 36) {
262
- $digit = self::$decodeTable[$input[$pos++]];
263
- $i += $digit * $w;
264
- $t = self::calculateThreshold($k, $bias);
265
-
266
- if ($digit < $t) {
267
- break;
268
- }
269
-
270
- $w *= 36 - $t;
271
- }
272
-
273
- $bias = self::adapt($i - $oldi, ++$outputLength, 0 === $oldi);
274
- $n = $n + (int) ($i / $outputLength);
275
- $i = $i % $outputLength;
276
- $output = mb_substr($output, 0, $i, 'utf-8').mb_chr($n, 'utf-8').mb_substr($output, $i, $outputLength - 1, 'utf-8');
277
-
278
- ++$i;
279
- }
280
-
281
- return $output;
282
- }
283
- }
vendor/symfony/polyfill-intl-idn/LICENSE DELETED
@@ -1,19 +0,0 @@
1
- Copyright (c) 2018-2019 Fabien Potencier
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is furnished
8
- to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- THE SOFTWARE.
vendor/symfony/polyfill-intl-idn/bootstrap.php DELETED
@@ -1,61 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Symfony\Polyfill\Intl\Idn as p;
13
-
14
- if (!defined('IDNA_DEFAULT')) {
15
- define('U_IDNA_PROHIBITED_ERROR', 66560);
16
- define('U_IDNA_ERROR_START', 66560);
17
- define('U_IDNA_UNASSIGNED_ERROR', 66561);
18
- define('U_IDNA_CHECK_BIDI_ERROR', 66562);
19
- define('U_IDNA_STD3_ASCII_RULES_ERROR', 66563);
20
- define('U_IDNA_ACE_PREFIX_ERROR', 66564);
21
- define('U_IDNA_VERIFICATION_ERROR', 66565);
22
- define('U_IDNA_LABEL_TOO_LONG_ERROR', 66566);
23
- define('U_IDNA_ZERO_LENGTH_LABEL_ERROR', 66567);
24
- define('U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR', 66568);
25
- define('U_IDNA_ERROR_LIMIT', 66569);
26
- define('U_STRINGPREP_PROHIBITED_ERROR', 66560);
27
- define('U_STRINGPREP_UNASSIGNED_ERROR', 66561);
28
- define('U_STRINGPREP_CHECK_BIDI_ERROR', 66562);
29
- define('IDNA_DEFAULT', 0);
30
- define('IDNA_ALLOW_UNASSIGNED', 1);
31
- define('IDNA_USE_STD3_RULES', 2);
32
- define('IDNA_CHECK_BIDI', 4);
33
- define('IDNA_CHECK_CONTEXTJ', 8);
34
- define('IDNA_NONTRANSITIONAL_TO_ASCII', 16);
35
- define('IDNA_NONTRANSITIONAL_TO_UNICODE', 32);
36
- define('INTL_IDNA_VARIANT_2003', 0);
37
- define('INTL_IDNA_VARIANT_UTS46', 1);
38
- define('IDNA_ERROR_EMPTY_LABEL', 1);
39
- define('IDNA_ERROR_LABEL_TOO_LONG', 2);
40
- define('IDNA_ERROR_DOMAIN_NAME_TOO_LONG', 4);
41
- define('IDNA_ERROR_LEADING_HYPHEN', 8);
42
- define('IDNA_ERROR_TRAILING_HYPHEN', 16);
43
- define('IDNA_ERROR_HYPHEN_3_4', 32);
44
- define('IDNA_ERROR_LEADING_COMBINING_MARK', 64);
45
- define('IDNA_ERROR_DISALLOWED', 128);
46
- define('IDNA_ERROR_PUNYCODE', 256);
47
- define('IDNA_ERROR_LABEL_HAS_DOT', 512);
48
- define('IDNA_ERROR_INVALID_ACE_LABEL', 1024);
49
- define('IDNA_ERROR_BIDI', 2048);
50
- define('IDNA_ERROR_CONTEXTJ', 4096);
51
- }
52
-
53
- if (!function_exists('idn_to_ascii')) {
54
- if (PHP_VERSION_ID < 70400) {
55
- function idn_to_ascii($domain, $options = IDNA_DEFAULT, $variant = INTL_IDNA_VARIANT_2003, &$idna_info = array()) { return p\Idn::idn_to_ascii($domain, $options, $variant, $idna_info); }
56
- function idn_to_utf8($domain, $options = IDNA_DEFAULT, $variant = INTL_IDNA_VARIANT_2003, &$idna_info = array()) { return p\Idn::idn_to_utf8($domain, $options, $variant, $idna_info); }
57
- } else {
58
- function idn_to_ascii($domain, $options = IDNA_DEFAULT, $variant = INTL_IDNA_VARIANT_UTS46, &$idna_info = array()) { return p\Idn::idn_to_ascii($domain, $options, $variant, $idna_info); }
59
- function idn_to_utf8($domain, $options = IDNA_DEFAULT, $variant = INTL_IDNA_VARIANT_UTS46, &$idna_info = array()) { return p\Idn::idn_to_utf8($domain, $options, $variant, $idna_info); }
60
- }
61
- }
vendor/symfony/polyfill-mbstring/LICENSE DELETED
@@ -1,19 +0,0 @@
1
- Copyright (c) 2015-2019 Fabien Potencier
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is furnished
8
- to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- THE SOFTWARE.
vendor/symfony/polyfill-mbstring/Mbstring.php DELETED
@@ -1,847 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Polyfill\Mbstring;
13
-
14
- /**
15
- * Partial mbstring implementation in PHP, iconv based, UTF-8 centric.
16
- *
17
- * Implemented:
18
- * - mb_chr - Returns a specific character from its Unicode code point
19
- * - mb_convert_encoding - Convert character encoding
20
- * - mb_convert_variables - Convert character code in variable(s)
21
- * - mb_decode_mimeheader - Decode string in MIME header field
22
- * - mb_encode_mimeheader - Encode string for MIME header XXX NATIVE IMPLEMENTATION IS REALLY BUGGED
23
- * - mb_decode_numericentity - Decode HTML numeric string reference to character
24
- * - mb_encode_numericentity - Encode character to HTML numeric string reference
25
- * - mb_convert_case - Perform case folding on a string
26
- * - mb_detect_encoding - Detect character encoding
27
- * - mb_get_info - Get internal settings of mbstring
28
- * - mb_http_input - Detect HTTP input character encoding
29
- * - mb_http_output - Set/Get HTTP output character encoding
30
- * - mb_internal_encoding - Set/Get internal character encoding
31
- * - mb_list_encodings - Returns an array of all supported encodings
32
- * - mb_ord - Returns the Unicode code point of a character
33
- * - mb_output_handler - Callback function converts character encoding in output buffer
34
- * - mb_scrub - Replaces ill-formed byte sequences with substitute characters
35
- * - mb_strlen - Get string length
36
- * - mb_strpos - Find position of first occurrence of string in a string
37
- * - mb_strrpos - Find position of last occurrence of a string in a string
38
- * - mb_str_split - Convert a string to an array
39
- * - mb_strtolower - Make a string lowercase
40
- * - mb_strtoupper - Make a string uppercase
41
- * - mb_substitute_character - Set/Get substitution character
42
- * - mb_substr - Get part of string
43
- * - mb_stripos - Finds position of first occurrence of a string within another, case insensitive
44
- * - mb_stristr - Finds first occurrence of a string within another, case insensitive
45
- * - mb_strrchr - Finds the last occurrence of a character in a string within another
46
- * - mb_strrichr - Finds the last occurrence of a character in a string within another, case insensitive
47
- * - mb_strripos - Finds position of last occurrence of a string within another, case insensitive
48
- * - mb_strstr - Finds first occurrence of a string within another
49
- * - mb_strwidth - Return width of string
50
- * - mb_substr_count - Count the number of substring occurrences
51
- *
52
- * Not implemented:
53
- * - mb_convert_kana - Convert "kana" one from another ("zen-kaku", "han-kaku" and more)
54
- * - mb_ereg_* - Regular expression with multibyte support
55
- * - mb_parse_str - Parse GET/POST/COOKIE data and set global variable
56
- * - mb_preferred_mime_name - Get MIME charset string
57
- * - mb_regex_encoding - Returns current encoding for multibyte regex as string
58
- * - mb_regex_set_options - Set/Get the default options for mbregex functions
59
- * - mb_send_mail - Send encoded mail
60
- * - mb_split - Split multibyte string using regular expression
61
- * - mb_strcut - Get part of string
62
- * - mb_strimwidth - Get truncated string with specified width
63
- *
64
- * @author Nicolas Grekas <p@tchwork.com>
65
- *
66
- * @internal
67
- */
68
- final class Mbstring
69
- {
70
- const MB_CASE_FOLD = PHP_INT_MAX;
71
-
72
- private static $encodingList = array('ASCII', 'UTF-8');
73
- private static $language = 'neutral';
74
- private static $internalEncoding = 'UTF-8';
75
- private static $caseFold = array(
76
- array('µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"),
77
- array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'),
78
- );
79
-
80
- public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
81
- {
82
- if (\is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
83
- $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
84
- } else {
85
- $fromEncoding = self::getEncoding($fromEncoding);
86
- }
87
-
88
- $toEncoding = self::getEncoding($toEncoding);
89
-
90
- if ('BASE64' === $fromEncoding) {
91
- $s = base64_decode($s);
92
- $fromEncoding = $toEncoding;
93
- }
94
-
95
- if ('BASE64' === $toEncoding) {
96
- return base64_encode($s);
97
- }
98
-
99
- if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
100
- if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
101
- $fromEncoding = 'Windows-1252';
102
- }
103
- if ('UTF-8' !== $fromEncoding) {
104
- $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
105
- }
106
-
107
- return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
108
- }
109
-
110
- if ('HTML-ENTITIES' === $fromEncoding) {
111
- $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
112
- $fromEncoding = 'UTF-8';
113
- }
114
-
115
- return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
116
- }
117
-
118
- public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
119
- {
120
- $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
121
-
122
- $ok = true;
123
- array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
124
- if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
125
- $ok = false;
126
- }
127
- });
128
-
129
- return $ok ? $fromEncoding : false;
130
- }
131
-
132
- public static function mb_decode_mimeheader($s)
133
- {
134
- return iconv_mime_decode($s, 2, self::$internalEncoding);
135
- }
136
-
137
- public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
138
- {
139
- trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
140
- }
141
-
142
- public static function mb_decode_numericentity($s, $convmap, $encoding = null)
143
- {
144
- if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
145
- trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
146
-
147
- return null;
148
- }
149
-
150
- if (!\is_array($convmap) || !$convmap) {
151
- return false;
152
- }
153
-
154
- if (null !== $encoding && !\is_scalar($encoding)) {
155
- trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
156
-
157
- return ''; // Instead of null (cf. mb_encode_numericentity).
158
- }
159
-
160
- $s = (string) $s;
161
- if ('' === $s) {
162
- return '';
163
- }
164
-
165
- $encoding = self::getEncoding($encoding);
166
-
167
- if ('UTF-8' === $encoding) {
168
- $encoding = null;
169
- if (!preg_match('//u', $s)) {
170
- $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
171
- }
172
- } else {
173
- $s = iconv($encoding, 'UTF-8//IGNORE', $s);
174