plugin updates
This commit is contained in:
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 32 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"><g><g><path d="M18.19,14.262c-0.129,0.001 -0.258,-0.042 -0.366,-0.127c-0.231,-0.184 -0.291,-0.515 -0.137,-0.767c0.038,-0.063 3.788,-6.316 1.853,-9.433c-0.404,-0.651 -0.858,-0.993 -1.348,-1.018c-0.951,-0.042 -1.992,1.022 -2.312,1.438c-0.112,0.142 -0.283,0.226 -0.464,0.226c-0.323,-0 -0.589,-0.266 -0.589,-0.59c0,-0.128 0.042,-0.252 0.119,-0.355c0.063,-0.08 1.536,-1.981 3.305,-1.896c0.898,0.045 1.669,0.574 2.289,1.573c1.45,2.334 0.429,5.813 -0.579,8.159c1.049,-0.727 2.344,-1.442 3.58,-1.635c0.326,-0.048 0.623,0.171 0.674,0.492c0.004,0.03 0.007,0.06 0.007,0.091c-0,0.289 -0.213,0.537 -0.499,0.582c-2.306,0.358 -5.093,3.065 -5.12,3.092c-0.11,0.108 -0.259,0.168 -0.413,0.168l0,0Z" style="fill:#7cb1f4;fill-rule:nonzero;"/><path d="M3.68,9.303c0,0.315 -0.082,0.594 -0.248,0.841c-0.165,0.247 -0.404,0.438 -0.715,0.572c-0.311,0.135 -0.673,0.204 -1.096,0.204c-0.35,-0 -0.639,-0.024 -0.88,-0.068c-0.241,-0.043 -0.485,-0.13 -0.741,-0.248l0,-1.222c0.271,0.135 0.552,0.236 0.842,0.314c0.289,0.079 0.56,0.113 0.805,0.113c0.21,0 0.365,-0.035 0.463,-0.105c0.098,-0.071 0.148,-0.162 0.148,-0.27c0.001,-0.065 -0.02,-0.129 -0.06,-0.182c-0.039,-0.052 -0.103,-0.105 -0.19,-0.158c-0.087,-0.053 -0.32,-0.161 -0.699,-0.326c-0.343,-0.151 -0.599,-0.297 -0.774,-0.438c-0.175,-0.141 -0.298,-0.303 -0.381,-0.486c-0.083,-0.183 -0.124,-0.399 -0.124,-0.65c-0,-0.471 0.176,-0.832 0.528,-1.094c0.353,-0.261 0.837,-0.392 1.452,-0.392c0.544,-0 1.099,0.121 1.664,0.364l-0.435,1.059c-0.491,-0.217 -0.915,-0.326 -1.272,-0.326c-0.185,-0 -0.319,0.031 -0.403,0.094c-0.084,0.062 -0.126,0.14 -0.126,0.235c0,0.099 0.053,0.189 0.16,0.267c0.107,0.079 0.396,0.223 0.868,0.431c0.453,0.197 0.767,0.408 0.943,0.634c0.177,0.225 0.265,0.51 0.265,0.853l0.006,-0.016Zm2.954,1.541l-1.074,-3.656l-0.033,-0l0.076,1.451l0,2.205l-1.258,0l0,-5.076l1.891,0l1.096,3.604l0.028,0l1.077,-3.604l1.894,0l0,5.076l-1.308,0l0,-2.225l0.006,-0.386l0.048,-1.038l-0.032,0l-1.06,3.649l-1.351,0Zm6.85,0l-1.419,0l-0,-3.955l-1.283,0l-0,-1.121l3.982,-0l-0,1.121l-1.279,0l-0.001,3.955Zm5.697,-3.465c0,0.567 -0.174,1.005 -0.519,1.314c-0.346,0.309 -0.842,0.463 -1.476,0.463l-0.399,0l0,1.684l-1.419,0l-0,-5.076l1.818,0c0.663,0 1.161,0.141 1.495,0.421c0.333,0.28 0.5,0.678 0.5,1.195l0,-0.001Zm-2.401,0.66l0.266,-0c0.213,-0 0.383,-0.058 0.505,-0.174c0.122,-0.116 0.189,-0.275 0.189,-0.479c-0,-0.343 -0.197,-0.514 -0.589,-0.514l-0.371,-0l0,1.167Zm7.259,-0.167l2.268,-0l-0,2.736c-0.616,0.203 -1.293,0.305 -2.03,0.305c-0.81,0 -1.436,-0.227 -1.878,-0.68c-0.441,-0.453 -0.663,-1.1 -0.663,-1.941c0,-0.819 0.243,-1.457 0.726,-1.913c0.483,-0.456 1.162,-0.684 2.034,-0.684c0.314,0 0.628,0.031 0.936,0.091c0.296,0.057 0.55,0.137 0.767,0.229l-0.449,1.076c-0.378,-0.18 -0.794,-0.271 -1.247,-0.271c-0.414,0 -0.735,0.131 -0.961,0.391c-0.226,0.26 -0.339,0.633 -0.339,1.116c-0,0.471 0.102,0.836 0.307,1.085c0.205,0.249 0.5,0.373 0.885,0.373c0.211,0 0.405,-0.019 0.582,-0.059l0,-0.795l-0.938,0l0,-1.059Zm7.961,0.427c-0,0.855 -0.216,1.504 -0.65,1.948c-0.434,0.445 -1.069,0.667 -1.905,0.667c-0.825,-0 -1.456,-0.223 -1.896,-0.673c-0.44,-0.45 -0.66,-1.098 -0.66,-1.952c0,-0.841 0.219,-1.49 0.657,-1.935c0.437,-0.445 1.073,-0.669 1.906,-0.669c0.836,0 1.47,0.222 1.901,0.664c0.431,0.441 0.644,1.097 0.644,1.95l0.003,0Zm-3.615,0c-0,0.982 0.353,1.473 1.06,1.473c0.359,-0 0.626,-0.119 0.8,-0.358c0.173,-0.238 0.26,-0.61 0.26,-1.11c-0,-0.507 -0.088,-0.882 -0.264,-1.124c-0.175,-0.242 -0.439,-0.37 -0.789,-0.37c-0.712,-0 -1.067,0.495 -1.067,1.486l-0,0.003Z" style="fill:#222a35;fill-rule:nonzero;"/></g></g></svg>
|
||||
|
After Width: | Height: | Size: 3.9 KiB |
@@ -284,6 +284,19 @@ WPMailSMTP.Admin.Settings = WPMailSMTP.Admin.Settings || ( function( document, w
|
||||
|
||||
app.education.rateLimitUpgrade();
|
||||
} );
|
||||
|
||||
// Obfuscated fields
|
||||
$( '.wp-mail-smtp-btn[data-clear-field]' ).on( 'click', function( e ) {
|
||||
var $button = $( this );
|
||||
var fieldId = $button.attr( 'data-clear-field' );
|
||||
var $field = $( `#${fieldId}` );
|
||||
|
||||
$field.prop( 'disabled', false );
|
||||
$field.attr( 'name', $field.attr( 'data-name' ) );
|
||||
$field.removeAttr( 'value' );
|
||||
$field.focus();
|
||||
$button.remove();
|
||||
} );
|
||||
},
|
||||
|
||||
education: {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -151,12 +151,11 @@ $generated_i18n_strings = array(
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepPluginFeatures.vue:15
|
||||
__( 'Make sure you\'re getting the most out of WP Mail SMTP. Just check all of the features you\'d like to use, and we\'ll go ahead and enable those for you.', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepHelpImprove.vue:16
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepConfigureEmailLogs.vue:15
|
||||
__( 'Save and Continue', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepHelpImprove.vue:18
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepConfigureEmailLogs.vue:16
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepImport.vue:16
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepLicense.vue:18
|
||||
__( 'Previous Step', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepPluginFeatures.vue:214
|
||||
@@ -222,7 +221,8 @@ $generated_i18n_strings = array(
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Mailgun.vue:15
|
||||
__( 'Domain Name', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Mailgun.vue:16
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/SparkPost.vue:15
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Zoho.vue:16
|
||||
__( 'Region', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Mailgun.vue:18
|
||||
@@ -237,54 +237,47 @@ $generated_i18n_strings = array(
|
||||
/* Translators: Link to the Mailgun documentation. */
|
||||
__( 'Define which endpoint you want to use for sending messages. If you are operating under EU laws, you may be required to use EU region. %1$sMore information%2$s on Mailgun.com.', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Gmail.vue:21
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Mailgun.vue:23
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/SparkPost.vue:18
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Zoho.vue:22
|
||||
__( 'From Name', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Gmail.vue:22
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Mailgun.vue:24
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/SparkPost.vue:19
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Zoho.vue:23
|
||||
__( 'Force From Name', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Gmail.vue:23
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Mailgun.vue:25
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Outlook.vue:23
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/SparkPost.vue:20
|
||||
__( 'From Email', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Gmail.vue:25
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Mailgun.vue:26
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Outlook.vue:25
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/SparkPost.vue:21
|
||||
__( 'Force From Email', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Gmail.vue:24
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Mailgun.vue:27
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/SparkPost.vue:22
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Zoho.vue:24
|
||||
__( 'If enabled, the From Name setting above will be used for all emails, ignoring values set by other plugins.', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Gmail.vue:26
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Mailgun.vue:28
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Outlook.vue:26
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/SparkPost.vue:23
|
||||
__( 'If enabled, the From Email setting above will be used for all emails, ignoring values set by other plugins.', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Gmail.vue:27
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Mailgun.vue:29
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/SparkPost.vue:24
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Zoho.vue:25
|
||||
__( 'The name that emails are sent from.', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Mailgun.vue:30
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Outlook.vue:24
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/SparkPost.vue:25
|
||||
__( 'The email address that emails are sent from.', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Mailgun.vue:31
|
||||
__( 'Read how to set up Mailgun', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Mailgun.vue:36
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/SparkPost.vue:31
|
||||
__( 'US', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Mailgun.vue:40
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/SparkPost.vue:35
|
||||
__( 'EU', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/Steps.vue:12
|
||||
__( 'Close and exit the Setup Wizard', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Sendgrid.vue:13
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/SparkPost.vue:14
|
||||
__( 'API Key', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Sendgrid.vue:14
|
||||
@@ -318,8 +311,6 @@ $generated_i18n_strings = array(
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepConfigureMailer.vue:14
|
||||
__( 'Below, we\'ll show you all of the settings required to set up this mailer.', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/settings/components/input/SettingsInputLongCheckbox.vue:20
|
||||
// Reference: src/modules/settings/components/input/SettingsInputNumber.vue:64
|
||||
// Reference: src/modules/settings/components/input/SettingsInputSelect.vue:38
|
||||
// Reference: src/modules/settings/components/input/SettingsInputSwitch.vue:39
|
||||
// Reference: src/modules/settings/components/input/SettingsInputText.vue:69
|
||||
@@ -367,9 +358,7 @@ $generated_i18n_strings = array(
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepImport.vue:14
|
||||
__( 'Import Data and Continue', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepHelpImprove.vue:17
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepImport.vue:15
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepLicense.vue:17
|
||||
__( 'Skip this Step', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepImport.vue:20
|
||||
@@ -458,17 +447,16 @@ $generated_i18n_strings = array(
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Zoho.vue:17
|
||||
__( 'The data center location used by your Zoho account.', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Gmail.vue:17
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Zoho.vue:18
|
||||
__( 'Client ID', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Gmail.vue:18
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Zoho.vue:19
|
||||
__( 'Client Secret', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Outlook.vue:17
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Zoho.vue:20
|
||||
__( 'Redirect URI', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Gmail.vue:20
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Outlook.vue:18
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Zoho.vue:21
|
||||
__( 'Authorization', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Zoho.vue:26
|
||||
@@ -649,17 +637,17 @@ $generated_i18n_strings = array(
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepChooseMailer.vue:13
|
||||
__( 'Choose Your SMTP Mailer', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepChooseMailer.vue:140
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepChooseMailer.vue:147
|
||||
__( 'Mailer', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepChooseMailer.vue:15
|
||||
/* Translators: Link to the SMTP Mailer docs page. */
|
||||
__( 'Which mailer would you like to use to send emails? Not sure which mailer to choose? Check out our %1$scomplete mailer guide%2$s for details on each option.', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepChooseMailer.vue:150
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepChooseMailer.vue:157
|
||||
__( 'I Understand, Continue', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepChooseMailer.vue:151
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepChooseMailer.vue:158
|
||||
__( 'Choose a Different Mailer', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepChooseMailer.vue:18
|
||||
@@ -668,7 +656,7 @@ $generated_i18n_strings = array(
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepChooseMailer.vue:19
|
||||
__( 'Your mailer is already configured in a WP Mail SMTP constant, so the options below have been disabled. To change your mailer, please edit or remove the <code>WPMS_MAILER</code> constant in your <code>wp-config.php</code> file.', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepChooseMailer.vue:195
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepChooseMailer.vue:202
|
||||
__( 'is a PRO Feature', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepChooseMailer.vue:71
|
||||
@@ -717,14 +705,12 @@ $generated_i18n_strings = array(
|
||||
__( 'Enter your license key below to unlock plugin updates!', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepLicense.vue:28
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Gmail.vue:44
|
||||
__( 'Verify License Key', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepLicense.vue:28
|
||||
__( 'Connect', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepLicense.vue:29
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Gmail.vue:45
|
||||
__( 'The License Key format is incorrect. Please enter a valid key and try again.', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepLicense.vue:30
|
||||
@@ -734,19 +720,15 @@ $generated_i18n_strings = array(
|
||||
__( 'Pro badge', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepLicense.vue:39
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Gmail.vue:43
|
||||
__( 'License key input', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepLicense.vue:40
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Gmail.vue:42
|
||||
__( 'Paste your license key here', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepLicense.vue:76
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Gmail.vue:141
|
||||
__( 'Successful Verification!', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepLicense.vue:86
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Gmail.vue:151
|
||||
__( 'Verification Error!', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/Gmail.vue:19
|
||||
@@ -1010,6 +992,13 @@ $generated_i18n_strings = array(
|
||||
__( 'We\'re sorry, One-Click Setup for Google Mailer is not available on your plan. Please upgrade to the Pro plan to unlock all these awesome features.', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/WizardStepPluginFeatures.vue:23
|
||||
__( 'Install the WPForms plugin and create beautiful contact forms with just a few clicks.', 'wp-mail-smtp' )
|
||||
__( 'Install the WPForms plugin and create beautiful contact forms with just a few clicks.', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/SMTP2GO.vue:15
|
||||
/* Translators: Link to the SMTP2GO API settings. */
|
||||
__( 'Generate an API key on the Sending → API Keys page in your %1$scontrol panel%2$s.', 'wp-mail-smtp' ),
|
||||
|
||||
// Reference: src/modules/setup-wizard/components/steps/configure-mailer/SMTP2GO.vue:24
|
||||
__( 'Read how to set up SMTP2GO', 'wp-mail-smtp' )
|
||||
);
|
||||
/* THIS IS THE END OF THE GENERATED FILE */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"><path d="M13.09,32c-0.33,0.001 -0.66,-0.108 -0.935,-0.326c-0.591,-0.469 -0.743,-1.314 -0.352,-1.959c0.097,-0.161 9.68,-16.138 4.735,-24.101c-1.033,-1.662 -2.191,-2.537 -3.443,-2.6c-2.43,-0.109 -5.089,2.61 -5.907,3.674c-0.285,0.37 -0.726,0.587 -1.193,0.587c-0.826,0 -1.505,-0.679 -1.505,-1.505c-0,-0.332 0.109,-0.655 0.312,-0.918c0.159,-0.207 3.923,-5.063 8.443,-4.845c2.297,0.115 4.265,1.467 5.85,4.018c3.704,5.963 1.097,14.852 -1.481,20.847c2.681,-1.858 5.991,-3.686 9.149,-4.177c0.832,-0.124 1.592,0.435 1.719,1.255c0.127,0.82 -0.435,1.592 -1.255,1.719c-5.892,0.916 -13.012,7.832 -13.083,7.902c-0.281,0.276 -0.66,0.429 -1.053,0.429l-0.001,-0Z" style="fill:#7cb1f4;fill-rule:nonzero;"/></svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -2,8 +2,8 @@
|
||||
Contributors: wpforms, jaredatch, smub, slaFFik, capuderg
|
||||
Tags: smtp, email, gmail, outlook, email logs
|
||||
Requires at least: 5.5
|
||||
Tested up to: 6.4
|
||||
Stable tag: 4.0.1
|
||||
Tested up to: 6.6
|
||||
Stable tag: 4.1.0
|
||||
Requires PHP: 7.2
|
||||
|
||||
Make email delivery easy for WordPress. Connect with SMTP, Gmail, Outlook, SendGrid, Mailgun, SES, Zoho, + more. Rated #1 WordPress SMTP Email plugin.
|
||||
@@ -51,15 +51,16 @@ WP Mail SMTP plugin includes many different SMTP mailers:
|
||||
1. SendLayer <strong>(#1 Recommended)</strong>
|
||||
2. SMTP.com <strong>(Recommended)</strong>
|
||||
3. Brevo (formerly Sendinblue) SMTP <strong>(Recommended)</strong>
|
||||
4. Mailgun SMTP
|
||||
5. SendGrid SMTP
|
||||
6. Postmark SMTP
|
||||
7. SparkPost SMTP
|
||||
8. Gmail SMTP (Gmail, Google Workspace, G Suite)
|
||||
9. Microsoft SMTP (Outlook.com and Office 365) [[Pro]](https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteplugin&utm_content=readme)
|
||||
10. Amazon SES SMTP [[Pro]](https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteplugin&utm_content=readme)
|
||||
11. Zoho Mail SMTP [[Pro]](https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteplugin&utm_content=readme)
|
||||
12. Other SMTP
|
||||
4. Gmail SMTP (Gmail, Google Workspace, G Suite)
|
||||
5. Mailgun SMTP
|
||||
6. SendGrid SMTP
|
||||
7. Postmark SMTP
|
||||
8. SparkPost SMTP
|
||||
9. SMTP2GO
|
||||
10. Microsoft SMTP (Outlook.com and Office 365) [[Pro]](https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteplugin&utm_content=readme)
|
||||
11. Amazon SES SMTP [[Pro]](https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteplugin&utm_content=readme)
|
||||
12. Zoho Mail SMTP [[Pro]](https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteplugin&utm_content=readme)
|
||||
13. Other SMTP
|
||||
|
||||
For most options, you can specify the "from name" and "email address" for outgoing emails too.
|
||||
|
||||
@@ -135,7 +136,7 @@ Get statistics about WordPress emails, including how many emails are being sent
|
||||
|
||||
### Email Alerts
|
||||
|
||||
If your emails stop sending, get notified instantly via Slack, SMS/ Twilio, webhooks, or email (via secure API).
|
||||
If your emails stop sending, get notified instantly via Slack, Microsoft Teams, SMS/ Twilio, webhooks, or email (via secure API).
|
||||
|
||||
In combination with our email logging and resending features, Email Alerts ensure that no important email will ever be lost.
|
||||
|
||||
@@ -196,7 +197,7 @@ You can try the [free version of WPForms plugin](https://wordpress.org/plugins/w
|
||||
1. Install WP Mail SMTP by WPForms either via the WordPress.org plugin repository or by uploading the files to your server. (See instructions on [how to install a WordPress plugin](http://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/))
|
||||
2. Activate WP Mail SMTP by WPForms.
|
||||
3. Navigate to the Settings area of WP Mail SMTP in the WordPress admin.
|
||||
4. Choose your SMTP option (SMTP.com, Brevo (formerly Sendinblue), Mailgun SMTP, SendGrid SMTP, Postmark, SparkPost, Gmail SMTP, or Other SMTP) and follow the instructions to set it up.
|
||||
4. Choose your SMTP option (SendLayer, SMTP.com, Brevo (formerly Sendinblue), Gmail SMTP, Mailgun SMTP, SendGrid SMTP, Postmark, SparkPost, SMTP2GO, or Other SMTP) and follow the instructions to set it up.
|
||||
5. Need more help? Get support with [WP Mail SMTP PRO](https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteplugin&utm_content=readme).
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
@@ -232,6 +233,18 @@ Their email deliverability experts are constantly at work optimizing the reliabi
|
||||
|
||||
Read our [Brevo documentation](https://wpmailsmtp.com/docs/how-to-set-up-the-sendinblue-mailer-in-wp-mail-smtp/?utm_source=wprepo&utm_medium=link&utm_campaign=liteplugin&utm_content=readme) for more details.
|
||||
|
||||
**Gmail SMTP (Gmail, Google Workspace, G Suite)**
|
||||
|
||||
Often bloggers and small business owners don't want to use third-party SMTP services. Well you can use your Gmail or Google Workspace (also known as G Suite/Google Apps) account for SMTP emails.
|
||||
|
||||
This allows you to use your [professional email address](http://www.wpbeginner.com/beginners-guide/how-to-setup-a-professional-email-address-with-gmail-and-google-apps/) and improve email deliverability.
|
||||
|
||||
Unlike other Gmail SMTP plugins, our Gmail SMTP option uses OAuth to authenticate your Google account, keeping your login information 100% secure.
|
||||
|
||||
Our plugin also offers the "One-Click Setup" option, which allows you to start sending emails from your Gmail account with just a few clicks. It eliminates the need to manually configure your own Google App, which is a technical and time-consuming process.
|
||||
|
||||
Read our [Gmail documentation](https://wpmailsmtp.com/docs/how-to-set-up-the-gmail-mailer-in-wp-mail-smtp/?utm_source=wprepo&utm_medium=link&utm_campaign=liteplugin&utm_content=readme) for more details.
|
||||
|
||||
**Mailgun SMTP**
|
||||
|
||||
Mailgun SMTP is a popular SMTP service provider that allows you to send large quantities of emails. They provide 5,000 free emails per month for 3 months.
|
||||
@@ -258,17 +271,11 @@ SparkPost is a transactional email provider that's trusted by big brands and sma
|
||||
|
||||
Read our [SparkPost documentation](https://wpmailsmtp.com/docs/how-to-set-up-the-sparkpost-mailer-in-wp-mail-smtp/?utm_source=wprepo&utm_medium=link&utm_campaign=liteplugin&utm_content=readme) for more details.
|
||||
|
||||
**Gmail SMTP (Gmail, Google Workspace, G Suite)**
|
||||
**SMTP2GO**
|
||||
|
||||
Often bloggers and small business owners don't want to use third-party SMTP services. Well you can use your Gmail or Google Workspace (also known as G Suite/Google Apps) account for SMTP emails.
|
||||
SMTP2GO is a transactional email provider that offers a robust and reliable email delivery service with global infrastructure, real-time analytics, and advanced security features. If you're just starting out, you can use SMTP2GO's free plan to send up to 1000 emails per month.
|
||||
|
||||
This allows you to use your [professional email address](http://www.wpbeginner.com/beginners-guide/how-to-setup-a-professional-email-address-with-gmail-and-google-apps/) and improve email deliverability.
|
||||
|
||||
Unlike other Gmail SMTP plugins, our Gmail SMTP option uses OAuth to authenticate your Google account, keeping your login information 100% secure.
|
||||
|
||||
Our plugin also offers the "One-Click Setup" option, which allows you to start sending emails from your Gmail account with just a few clicks. It eliminates the need to manually configure your own Google App, which is a technical and time-consuming process.
|
||||
|
||||
Read our [Gmail documentation](https://wpmailsmtp.com/docs/how-to-set-up-the-gmail-mailer-in-wp-mail-smtp/?utm_source=wprepo&utm_medium=link&utm_campaign=liteplugin&utm_content=readme) for more details.
|
||||
Read our [SMTP2GO documentation](https://wpmailsmtp.com/docs/how-to-set-up-the-smtp2go-mailer-in-wp-mail-smtp/?utm_source=wprepo&utm_medium=link&utm_campaign=liteplugin&utm_content=readme) for more details.
|
||||
|
||||
**Microsoft SMTP (Outlook.com and Office 365)**
|
||||
|
||||
@@ -349,7 +356,7 @@ We know that majority of people do not speak English, so we professionally trans
|
||||
|
||||
The WP Mail SMTP team takes security very seriously. Not only does the plugin follow all security best practices, but we have several options available to ensure your site is safe and secure.
|
||||
|
||||
- Direct SMTP mailer integrations (recommended), such as SendLayer, SMTP.com, Brevo (formerly Sendinblue), Mailgun, SendGrid, Postmark and SparkPost, use the official provider APIs. This means you never enter your username or password in the plugin settings and these credentials are not stored in the database. Instead, we use tokens or API keys which are much more secure.
|
||||
- Direct SMTP mailer integrations (recommended), such as SendLayer, SMTP.com, Brevo (formerly Sendinblue), Mailgun, SendGrid, Postmark, SparkPost and SMTP2GO, use the official provider APIs. This means you never enter your username or password in the plugin settings and these credentials are not stored in the database. Instead, we use tokens or API keys which are much more secure.
|
||||
|
||||
- When using Other SMTP mailer, we provide the option to insert your password in your `wp-config.php` file, so it's not visible in your WordPress settings or saved in the database.
|
||||
|
||||
@@ -385,6 +392,12 @@ By all means please contact us to discuss features or options you'd like to see
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 4.1.0 - 2024-07-17 =
|
||||
- Added: New transactional mailer: SMTP2GO.
|
||||
- Changed: Recurring email queue tasks are now removed after completion.
|
||||
- Fixed: Wrong namespace in PHP 8.0x Symfony polyfills.
|
||||
- Fixed: All pending background tasks are now canceled on plugin deactivation.
|
||||
|
||||
= 4.0.1 - 2024-02-29 =
|
||||
- Added: Optimized Email Sending - move email sending requests in the background process and speed up your site.
|
||||
- Added: Automatic database table structure migrations after plugin update.
|
||||
@@ -405,7 +418,7 @@ By all means please contact us to discuss features or options you'd like to see
|
||||
- Fixed: Compatibility issue with Action Scheduler lower than 3.3.0.
|
||||
|
||||
= 3.10.0 - 2023-11-08 =
|
||||
- Added: Filter that allows to use self website Google OAuth redirect URL.
|
||||
- Added: Filter that allows to use your website's URL for Google OAuth redirect URL.
|
||||
- Changed: Improve plugin settings UI, by changing checkboxes to toggles and some dividers cleanup.
|
||||
- Changed: Replaced moment.js library to the WP Core's bundled one.
|
||||
- Fixed: Translation strings on the Dashboard widget.
|
||||
|
||||
@@ -1401,7 +1401,7 @@ class Area {
|
||||
array_filter(
|
||||
$submenu[ self::SLUG ],
|
||||
function ( $item ) {
|
||||
return strpos( $item[2], 'https://wpmailsmtp.com/lite-upgrade' ) !== false;
|
||||
return strpos( urldecode( $item[2] ), 'wpmailsmtp.com/lite-upgrade' ) !== false;
|
||||
}
|
||||
)
|
||||
);
|
||||
@@ -1418,6 +1418,15 @@ class Area {
|
||||
} else {
|
||||
$submenu[ self::SLUG ][ $upgrade_link_position ][] = 'wp-mail-smtp-sidebar-upgrade-pro';
|
||||
}
|
||||
|
||||
$current_screen = get_current_screen();
|
||||
$upgrade_utm_content = $current_screen === null ? 'Upgrade to Pro' : 'Upgrade to Pro - ' . $current_screen->base;
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
$upgrade_utm_content = empty( $_GET['tab'] ) ? $upgrade_utm_content : $upgrade_utm_content . ' -- ' . sanitize_key( $_GET['tab'] );
|
||||
|
||||
// Add the correct utm_content to the menu item.
|
||||
$submenu[ self::SLUG ][ $upgrade_link_position ][2] =
|
||||
esc_url( wp_mail_smtp()->get_upgrade_link( [ 'medium' => 'admin-menu', 'content' => $upgrade_utm_content ] ) ); // phpcs:ignore WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound
|
||||
// phpcs:enable WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
|
||||
// Output inline styles.
|
||||
|
||||
@@ -57,6 +57,10 @@ class Education {
|
||||
return;
|
||||
}
|
||||
|
||||
$current_screen = get_current_screen();
|
||||
$upgrade_utm_content = $current_screen === null ? 'Upgrade to Pro' : 'Upgrade to Pro - ' . $current_screen->base;
|
||||
$upgrade_utm_content = empty( $_GET['tab'] ) ? $upgrade_utm_content : $upgrade_utm_content . ' -- ' . sanitize_key( $_GET['tab'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
|
||||
printf(
|
||||
'<div id="wp-mail-smtp-notice-bar">
|
||||
<div class="wp-mail-smtp-notice-bar-container">
|
||||
@@ -67,7 +71,7 @@ class Education {
|
||||
wp_kses(
|
||||
sprintf( /* translators: %s - WPMailSMTP.com Upgrade page URL. */
|
||||
__( 'You’re using WP Mail SMTP Lite. To unlock more features, consider <a href="%s" target="_blank" rel="noopener noreferrer">upgrading to Pro</a>.', 'wp-mail-smtp' ),
|
||||
wp_mail_smtp()->get_upgrade_link( [ 'medium' => 'notice-bar' ] )
|
||||
wp_mail_smtp()->get_upgrade_link( [ 'medium' => 'notice-bar', 'content' => $upgrade_utm_content ] ) // phpcs:ignore WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound
|
||||
),
|
||||
[
|
||||
'a' => [
|
||||
|
||||
@@ -187,6 +187,35 @@ class AlertsTab extends PageAbstract {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-alert">
|
||||
<div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-content section-heading">
|
||||
<div class="wp-mail-smtp-setting-field">
|
||||
<h3><?php esc_html_e( 'Microsoft Teams', 'wp-mail-smtp' ); ?></h3>
|
||||
<p class="desc"><?php esc_html_e( 'Paste in the Microsoft Teams webhook URL you’d like to use to receive alerts when email sending fails. Read our documentation on setting up Microsoft Teams alerts.', 'wp-mail-smtp' ); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox-toggle">
|
||||
<div class="wp-mail-smtp-setting-label">
|
||||
<label><?php esc_html_e( 'Microsoft Teams Alerts', 'wp-mail-smtp' ); ?></label>
|
||||
</div>
|
||||
<div class="wp-mail-smtp-setting-field">
|
||||
<?php
|
||||
UI::toggle();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-alert-options">
|
||||
<div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-alert-connection-options">
|
||||
<div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text">
|
||||
<div class="wp-mail-smtp-setting-label">
|
||||
<label><?php esc_html_e( 'Webhook URL', 'wp-mail-smtp' ); ?></label>
|
||||
</div>
|
||||
<div class="wp-mail-smtp-setting-field"><input type="text"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-alert">
|
||||
<div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-content section-heading">
|
||||
<div class="wp-mail-smtp-setting-field">
|
||||
|
||||
@@ -94,7 +94,7 @@ class Connect {
|
||||
'endpoint' => admin_url( 'admin-ajax.php' ),
|
||||
'version' => WPMS_PLUGIN_VER,
|
||||
'siteurl' => admin_url(),
|
||||
'homeurl' => home_url(),
|
||||
'homeurl' => site_url(),
|
||||
'redirect' => rawurldecode( base64_encode( $redirect ) ), // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
|
||||
'v' => 2,
|
||||
],
|
||||
|
||||
@@ -202,17 +202,6 @@ class DBRepair {
|
||||
$reasons = array_filter( $reasons ); // Filtering out the empty values.
|
||||
|
||||
if ( ! empty( $reasons ) ) {
|
||||
$msg = sprintf(
|
||||
wp_kses( /* translators: %1$s: Singular/Plural string, %2$s - the error messages from the migrations for the missing tables. */
|
||||
__( 'The following DB %1$s still missing. <br />%2$s', 'wp-mail-smtp' ),
|
||||
[
|
||||
'br' => [],
|
||||
]
|
||||
),
|
||||
_n( 'Table is', 'Tables are', count( $missing_tables ), 'wp-mail-smtp' ),
|
||||
implode( '<br/>', $reasons )
|
||||
);
|
||||
|
||||
$msg = sprintf(
|
||||
wp_kses(
|
||||
_n( 'The following DB table is still missing.', 'The following DB tables are still missing.', count( $missing_tables ), 'wp-mail-smtp' ) . '<br />%s',
|
||||
|
||||
@@ -31,6 +31,7 @@ class Helpers {
|
||||
'mailgun',
|
||||
'postmark',
|
||||
'sparkpost',
|
||||
'smtp2go',
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
@@ -66,4 +66,53 @@ class UI {
|
||||
</label>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Output an obfuscated password field.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @param array $args Field attributes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function hidden_password_field( $args ) { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh
|
||||
|
||||
$args = wp_parse_args(
|
||||
$args,
|
||||
[
|
||||
'name' => '',
|
||||
'id' => '',
|
||||
'value' => '',
|
||||
'clear_text' => esc_html__( 'Remove', 'wp-mail-smtp' ),
|
||||
]
|
||||
);
|
||||
|
||||
$value = str_repeat( '*', strlen( $args['value'] ) );
|
||||
|
||||
// phpcs:disable Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace
|
||||
?>
|
||||
|
||||
<div class="wp-mail-smtp-input-btn-row">
|
||||
|
||||
<input type="password"
|
||||
spellcheck="false"
|
||||
autocomplete="new-password"
|
||||
<?php if ( ! empty( $value ) ) : ?>disabled<?php endif; ?>
|
||||
<?php if ( ! empty( $args['name'] && empty( $value ) ) ) : ?>name="<?php echo esc_attr( $args['name'] ); ?>"<?php endif; ?>
|
||||
<?php if ( ! empty( $args['name'] ) ) : ?>data-name="<?php echo esc_attr( $args['name'] ); ?>"<?php endif; ?>
|
||||
<?php if ( ! empty( $args['id'] ) ) : ?>id="<?php echo esc_attr( $args['id'] ); ?>"<?php endif; ?>
|
||||
<?php if ( ! empty( $value ) ) : ?>value="<?php echo esc_attr( $value ); ?>"<?php endif; ?>/>
|
||||
|
||||
<?php if ( ! empty( $value ) ) : ?>
|
||||
|
||||
<button type="button"
|
||||
class="wp-mail-smtp-btn wp-mail-smtp-btn-md wp-mail-smtp-btn-grey"
|
||||
data-clear-field="<?php echo esc_attr( $args['id'] ); ?>"><?php echo esc_html( $args['clear_text'] ); ?></button>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php
|
||||
// phpcs:enable Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +92,9 @@ class Options {
|
||||
'sendlayer' => [
|
||||
'api_key',
|
||||
],
|
||||
'smtp2go' => [
|
||||
'api_key',
|
||||
],
|
||||
'pepipostapi' => [
|
||||
'api_key',
|
||||
],
|
||||
@@ -146,6 +149,7 @@ class Options {
|
||||
'sendgrid',
|
||||
'sparkpost',
|
||||
'zoho',
|
||||
'smtp2go',
|
||||
'smtp',
|
||||
'pepipost',
|
||||
'pepipostapi',
|
||||
@@ -714,6 +718,16 @@ class Options {
|
||||
|
||||
break;
|
||||
|
||||
case 'smtp2go':
|
||||
switch ( $key ) {
|
||||
case 'api_key':
|
||||
/** @noinspection PhpUndefinedConstantInspection */
|
||||
$return = $this->is_const_defined( $group, $key ) ? WPMS_SMTP2GO_API_KEY : $value;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'pepipostapi':
|
||||
switch ( $key ) {
|
||||
case 'api_key':
|
||||
@@ -740,6 +754,15 @@ class Options {
|
||||
|
||||
break;
|
||||
|
||||
case 'alert_teams_webhook':
|
||||
switch ( $key ) {
|
||||
case 'connections':
|
||||
$return = $this->is_const_defined( $group, $key ) ? [ [ 'webhook_url' => WPMS_ALERT_TEAMS_WEBHOOK_URL ] ] : $value;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'alert_twilio_sms':
|
||||
switch ( $key ) {
|
||||
case 'connections':
|
||||
@@ -1053,6 +1076,15 @@ class Options {
|
||||
|
||||
break;
|
||||
|
||||
case 'smtp2go':
|
||||
switch ( $key ) {
|
||||
case 'api_key':
|
||||
$return = defined( 'WPMS_SMTP2GO_API_KEY' ) && WPMS_SMTP2GO_API_KEY;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'pepipostapi':
|
||||
switch ( $key ) {
|
||||
case 'api_key':
|
||||
@@ -1080,6 +1112,15 @@ class Options {
|
||||
|
||||
break;
|
||||
|
||||
case 'alert_teams_webhook':
|
||||
switch ( $key ) {
|
||||
case 'connections':
|
||||
$return = defined( 'WPMS_ALERT_TEAMS_WEBHOOK_URL' ) && WPMS_ALERT_TEAMS_WEBHOOK_URL;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'alert_twilio_sms':
|
||||
switch ( $key ) {
|
||||
case 'connections':
|
||||
@@ -1319,7 +1360,7 @@ class Options {
|
||||
}
|
||||
break;
|
||||
|
||||
case 'api_key': // mailgun/sendgrid/sendinblue/pepipostapi/smtpcom/sparkpost/sendlayer.
|
||||
case 'api_key': // mailgun/sendgrid/sendinblue/pepipostapi/smtpcom/sparkpost/sendlayer/smtp2go.
|
||||
case 'domain': // mailgun/zoho/sendgrid/sendinblue.
|
||||
case 'client_id': // gmail/outlook/amazonses/zoho.
|
||||
case 'client_secret': // gmail/outlook/amazonses/zoho.
|
||||
|
||||
@@ -20,6 +20,7 @@ class Loader {
|
||||
* @since 1.0.0
|
||||
* @since 1.6.0 Added Sendinblue.
|
||||
* @since 1.7.0 Added AmazonSES/Outlook as indication of the Pro mailers.
|
||||
* @since 4.1.0 Added SMTP2GO.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
@@ -35,6 +36,7 @@ class Loader {
|
||||
'pepipostapi' => 'WPMailSMTP\Providers\PepipostAPI\\',
|
||||
'postmark' => 'WPMailSMTP\Providers\Postmark\\',
|
||||
'sendgrid' => 'WPMailSMTP\Providers\Sendgrid\\',
|
||||
'smtp2go' => 'WPMailSMTP\Providers\SMTP2GO\\',
|
||||
'sparkpost' => 'WPMailSMTP\Providers\SparkPost\\',
|
||||
'zoho' => 'WPMailSMTP\Providers\Zoho\\',
|
||||
'smtp' => 'WPMailSMTP\Providers\SMTP\\',
|
||||
|
||||
@@ -380,10 +380,21 @@ abstract class OptionsAbstract implements OptionsInterface {
|
||||
<?php esc_html_e( 'All the defined constants will stop working and you will be able to change all the values on this page.', 'wp-mail-smtp' ); ?>
|
||||
</p>
|
||||
<?php else : ?>
|
||||
<input name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][pass]" type="password"
|
||||
value="<?php echo esc_attr( $this->connection_options->get( $this->get_slug(), 'pass' ) ); ?>"
|
||||
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-pass" spellcheck="false" autocomplete="new-password"
|
||||
/>
|
||||
|
||||
<?php
|
||||
$slug = $this->get_slug();
|
||||
$value = $this->connection_options->get( $slug, 'pass' );
|
||||
|
||||
UI::hidden_password_field(
|
||||
[
|
||||
'name' => "wp-mail-smtp[{$slug}][pass]",
|
||||
'id' => "wp-mail-smtp-setting-{$slug}-pass",
|
||||
'value' => $value,
|
||||
'clear_text' => esc_html__( 'Remove Password', 'wp-mail-smtp' ),
|
||||
]
|
||||
);
|
||||
?>
|
||||
|
||||
<p class="desc">
|
||||
<?php esc_html_e( 'The password is encrypted in the database, but for improved security we recommend using your site\'s WordPress configuration file to set your password.', 'wp-mail-smtp' ); ?>
|
||||
<br>
|
||||
|
||||
@@ -0,0 +1,485 @@
|
||||
<?php
|
||||
|
||||
namespace WPMailSMTP\Providers\SMTP2GO;
|
||||
|
||||
use WPMailSMTP\Helpers\Helpers;
|
||||
use WPMailSMTP\Providers\MailerAbstract;
|
||||
use WPMailSMTP\WP;
|
||||
|
||||
/**
|
||||
* Class Mailer.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*/
|
||||
class Mailer extends MailerAbstract {
|
||||
|
||||
/**
|
||||
* Which response code from HTTP provider is considered to be successful?
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $email_sent_code = 200;
|
||||
|
||||
|
||||
/**
|
||||
* URL to make an API request to.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $url = 'https://api.smtp2go.com/v3/email/send';
|
||||
|
||||
/**
|
||||
* Mailer constructor.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @param MailCatcherInterface $phpmailer The MailCatcher object.
|
||||
* @param ConnectionInterface $connection The Connection object.
|
||||
*/
|
||||
public function __construct( $phpmailer, $connection = null ) {
|
||||
|
||||
// We want to prefill everything from MailCatcher class, which extends PHPMailer.
|
||||
parent::__construct( $phpmailer, $connection );
|
||||
|
||||
// Set mailer specific headers.
|
||||
$this->set_header( 'X-Smtp2go-Api-Key', $this->connection_options->get( $this->mailer, 'api_key' ) );
|
||||
$this->set_header( 'Accept', 'application/json' );
|
||||
$this->set_header( 'Content-Type', 'application/json' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Redefine the way custom headers are processed for this mailer - they should be in body.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @param array $headers Headers array.
|
||||
*/
|
||||
public function set_headers( $headers ) {
|
||||
|
||||
foreach ( $headers as $header ) {
|
||||
$name = isset( $header[0] ) ? $header[0] : false;
|
||||
$value = isset( $header[1] ) ? $header[1] : false;
|
||||
|
||||
$this->set_body_header( $name, $value );
|
||||
}
|
||||
|
||||
// Add custom header.
|
||||
$this->set_body_header( 'X-Mailer', 'WPMailSMTP/Mailer/' . $this->mailer . ' ' . WPMS_PLUGIN_VER );
|
||||
}
|
||||
|
||||
/**
|
||||
* This mailer supports email-related custom headers inside a body of the message.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @param string $name Header name.
|
||||
* @param string $value Header value.
|
||||
*/
|
||||
public function set_body_header( $name, $value ) {
|
||||
|
||||
$name = sanitize_text_field( $name );
|
||||
|
||||
if ( empty( $name ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$headers = isset( $this->body['custom_headers'] ) ? (array) $this->body['custom_headers'] : [];
|
||||
|
||||
// Index by key to remove duplicates.
|
||||
$headers = wp_list_pluck( $headers, 'value', 'header' );
|
||||
|
||||
// Sanitize headers.
|
||||
$headers[ $name ] = $this->sanitize_header_value( $name, $value );
|
||||
|
||||
// Turn headers into a list of header => value entries.
|
||||
$data = array_reduce(
|
||||
array_keys( $headers ),
|
||||
function ( $data, $header ) use ( $headers ) {
|
||||
|
||||
$data[] = [
|
||||
'header' => $header,
|
||||
'value' => $headers[ $header ],
|
||||
];
|
||||
|
||||
return $data;
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
$this->body['custom_headers'] = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the From information for an email.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @param string $email The sender email address.
|
||||
* @param string $name The sender name.
|
||||
*/
|
||||
public function set_from( $email, $name ) {
|
||||
|
||||
if ( ! filter_var( $email, FILTER_VALIDATE_EMAIL ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->set_body_param(
|
||||
[
|
||||
'sender' => $this->address_format( [ $email, $name ] ),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set email recipients: to, cc, bcc.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @param array $recipients Email recipients.
|
||||
*/
|
||||
public function set_recipients( $recipients ) { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh
|
||||
|
||||
if ( empty( $recipients ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Allow only these recipient types.
|
||||
$allowed_types = [ 'to', 'cc', 'bcc' ];
|
||||
$data = [];
|
||||
|
||||
foreach ( $recipients as $type => $emails ) {
|
||||
if (
|
||||
! in_array( $type, $allowed_types, true ) ||
|
||||
empty( $emails ) ||
|
||||
! is_array( $emails )
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Iterate over all emails for each type.
|
||||
// There might be multiple cc/to/bcc emails.
|
||||
foreach ( $emails as $email ) {
|
||||
if ( ! isset( $email[0] ) || ! filter_var( $email[0], FILTER_VALIDATE_EMAIL ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$data[ $type ][] = $this->address_format( $email );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $data ) ) {
|
||||
$this->set_body_param( $data );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Doesn't support this.
|
||||
* So we do nothing.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @param array $emails Reply To email addresses.
|
||||
*/
|
||||
public function set_reply_to( $emails ) {}
|
||||
|
||||
/**
|
||||
* Set email subject.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @param string $subject Email subject.
|
||||
*/
|
||||
public function set_subject( $subject ) {
|
||||
|
||||
$this->set_body_param(
|
||||
[
|
||||
'subject' => $subject,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set email content.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @param string|array $content Email content.
|
||||
*/
|
||||
public function set_content( $content ) {
|
||||
|
||||
if ( empty( $content ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( is_array( $content ) ) {
|
||||
if ( ! empty( $content['text'] ) ) {
|
||||
$this->set_body_param(
|
||||
[
|
||||
'text_body' => $content['text'],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! empty( $content['html'] ) ) {
|
||||
$this->set_body_param(
|
||||
[
|
||||
'html_body' => $content['html'],
|
||||
]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if ( $this->phpmailer->ContentType === 'text/plain' ) {
|
||||
$this->set_body_param(
|
||||
[
|
||||
'text_body' => $content,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$this->set_body_param(
|
||||
[
|
||||
'html_body' => $content,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set attachments for an email.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @param array $attachments Attachments array.
|
||||
*/
|
||||
public function set_attachments( $attachments ) { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh
|
||||
|
||||
if ( empty( $attachments ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = [];
|
||||
|
||||
// Split attachments into "attachments" and "inlines" groups.
|
||||
foreach ( $attachments as $attachment ) {
|
||||
$mode = in_array( $attachment[6], [ 'inline', 'attachment' ], true ) ? $attachment[6] : 'attachment';
|
||||
|
||||
if ( $mode === 'inline' ) {
|
||||
$data['inlines'][] = $attachment;
|
||||
} else {
|
||||
$data['attachments'][] = $attachment;
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare attachments.
|
||||
foreach ( $data as $disposition => $attachments ) {
|
||||
$data[ $disposition ] = $this->prepare_attachments( $attachments );
|
||||
}
|
||||
|
||||
if ( ! empty( $data ) ) {
|
||||
$this->set_body_param( $data );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Doesn't support this.
|
||||
* So we do nothing.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @param string $email Return Path email address.
|
||||
*/
|
||||
public function set_return_path( $email ) {}
|
||||
|
||||
/**
|
||||
* Redefine the way email body is returned.
|
||||
* By default, we are sending an array of data.
|
||||
* SMTP2GO requires a JSON, so we encode the body.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*/
|
||||
public function get_body() {
|
||||
|
||||
$body = parent::get_body();
|
||||
|
||||
return wp_json_encode( $body );
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare attachments data.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @param array $attachments Array of attachments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function prepare_attachments( $attachments ) {
|
||||
|
||||
$data = [];
|
||||
|
||||
foreach ( $attachments as $attachment ) {
|
||||
$file = $this->get_attachment_file_content( $attachment );
|
||||
|
||||
if ( $file === false ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$filetype = str_replace( ';', '', trim( $attachment[4] ) );
|
||||
|
||||
$data[] = [
|
||||
'filename' => empty( $attachment[2] ) ? 'file-' . wp_hash( microtime() ) . '.' . $filetype : trim( $attachment[2] ),
|
||||
// phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
|
||||
'fileblob' => base64_encode( $file ),
|
||||
'mimetype' => $attachment[4],
|
||||
];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* We might need to do something after the email was sent to the API.
|
||||
* In this method we preprocess the response from the API.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @param mixed $response Response data.
|
||||
*/
|
||||
protected function process_response( $response ) {
|
||||
|
||||
parent::process_response( $response );
|
||||
|
||||
if (
|
||||
! is_wp_error( $response ) &&
|
||||
! empty( $this->response['body']->data ) &&
|
||||
! empty( $this->response['body']->data->email_id )
|
||||
) {
|
||||
$this->phpmailer->addCustomHeader( 'X-Msg-ID', $this->response['body']->data->email_id );
|
||||
$this->verify_sent_status = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the email is sent or not.
|
||||
* We check response code and a non-empty `email_id` field in the response body.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_email_sent() {
|
||||
|
||||
$is_sent = false;
|
||||
|
||||
if (
|
||||
wp_remote_retrieve_response_code( $this->response ) === $this->email_sent_code &&
|
||||
! empty( $this->response['body']->data ) &&
|
||||
! empty( $this->response['body']->data->email_id )
|
||||
) {
|
||||
$is_sent = true;
|
||||
}
|
||||
|
||||
// phpcs:disable WPForms.Comments.Since.MissingPhpDoc, WPForms.PHP.ValidateHooks.InvalidHookName
|
||||
|
||||
/** This filter is documented in src/Providers/MailerAbstract.php. */
|
||||
return apply_filters( 'wp_mail_smtp_providers_mailer_is_email_sent', $is_sent, $this->mailer );
|
||||
// phpcs:enable WPForms.Comments.Since.MissingPhpDoc, WPForms.PHP.ValidateHooks.InvalidHookName
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a SMTP2GO-specific response with a helpful error.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_response_error() { // phpcs:ignore Generic.Metrics.NestingLevel.MaxExceeded, Generic.Metrics.CyclomaticComplexity.TooHigh
|
||||
|
||||
$error_text[] = $this->error_message;
|
||||
|
||||
if ( ! empty( $this->response ) ) {
|
||||
$body = wp_remote_retrieve_body( $this->response );
|
||||
|
||||
if ( ! empty( $body->data ) ) {
|
||||
if ( ! empty( $body->data->failures ) ) {
|
||||
foreach ( $body->data->failures as $error ) {
|
||||
$error_text[] = Helpers::format_error_message( $error );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $body->data->error ) ) {
|
||||
$error_code = ! empty( $body->data->error_code ) ? $body->data->error_code : '';
|
||||
|
||||
$error_text[] = Helpers::format_error_message( $body->data->error, $error_code );
|
||||
}
|
||||
|
||||
if ( ! empty( $body->data->field_validation_errors ) ) {
|
||||
$message = '';
|
||||
$code = '';
|
||||
|
||||
if ( ! empty( $body->data->field_validation_errors->message ) ) {
|
||||
$message = $body->data->field_validation_errors->message;
|
||||
}
|
||||
|
||||
if ( ! empty( $body->data->field_validation_errors->fieldname ) ) {
|
||||
$code = $body->data->field_validation_errors->fieldname;
|
||||
}
|
||||
|
||||
if ( ! empty( $message ) ) {
|
||||
$error_text[] = Helpers::format_error_message( $message, $code );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$error_text[] = WP::wp_remote_get_response_error_message( $this->response );
|
||||
}
|
||||
}
|
||||
|
||||
return implode( WP::EOL, array_map( 'esc_textarea', array_filter( $error_text ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the mailer has all its settings correctly set up and saved.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_mailer_complete() {
|
||||
|
||||
$options = $this->connection_options->get_group( $this->mailer );
|
||||
|
||||
// API key is the only required option.
|
||||
if ( ! empty( $options['api_key'] ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare address param.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @param array $address Address array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function address_format( $address ) {
|
||||
|
||||
$email = isset( $address[0] ) ? $address[0] : false;
|
||||
$name = isset( $address[1] ) ? $address[1] : false;
|
||||
|
||||
$result = $email;
|
||||
|
||||
if ( ! empty( $name ) ) {
|
||||
$result = "{$name} <{$email}>";
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
namespace WPMailSMTP\Providers\SMTP2GO;
|
||||
|
||||
use WPMailSMTP\ConnectionInterface;
|
||||
use WPMailSMTP\Providers\OptionsAbstract;
|
||||
|
||||
/**
|
||||
* Class Options.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*/
|
||||
class Options extends OptionsAbstract {
|
||||
|
||||
/**
|
||||
* Mailer slug.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*/
|
||||
const SLUG = 'smtp2go';
|
||||
|
||||
/**
|
||||
* Options constructor.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @param ConnectionInterface $connection The Connection object.
|
||||
*/
|
||||
public function __construct( $connection = null ) {
|
||||
|
||||
if ( is_null( $connection ) ) {
|
||||
$connection = wp_mail_smtp()->get_connections_manager()->get_primary_connection();
|
||||
}
|
||||
|
||||
$description = sprintf(
|
||||
wp_kses( /* translators: %1$s - URL to SMTP2GO.com site. */
|
||||
__( '<a href="%1$s" target="_blank" rel="noopener noreferrer">SMTP2GO</a> provides a robust and reliable email delivery service with global infrastructure, real-time analytics, and advanced security features. If you\'re just starting out, you can use SMTP2GO\'s free plan to send up to 1000 emails per month.', 'wp-mail-smtp' ) .
|
||||
'<br><br>' .
|
||||
/* translators: %2$s - URL to wpmailsmtp.com doc. */
|
||||
__( 'To get started, read our <a href="%2$s" target="_blank" rel="noopener noreferrer">SMTP2GO documentation</a>.', 'wp-mail-smtp' ),
|
||||
[
|
||||
'strong' => true,
|
||||
'br' => true,
|
||||
'a' => [
|
||||
'href' => true,
|
||||
'rel' => true,
|
||||
'target' => true,
|
||||
],
|
||||
]
|
||||
),
|
||||
'https://www.smtp2go.com/',
|
||||
esc_url( wp_mail_smtp()->get_utm_url( 'https://wpmailsmtp.com/docs/how-to-set-up-the-smtp2go-mailer-in-wp-mail-smtp/', 'SMTP2GO documentation' ) )
|
||||
);
|
||||
|
||||
parent::__construct(
|
||||
[
|
||||
'logo_url' => wp_mail_smtp()->assets_url . '/images/providers/smtp2go.svg',
|
||||
'slug' => self::SLUG,
|
||||
'title' => esc_html__( 'SMTP2GO', 'wp-mail-smtp' ),
|
||||
'php' => '5.6',
|
||||
'description' => $description,
|
||||
'supports' => [
|
||||
'from_email' => true,
|
||||
'from_name' => true,
|
||||
'return_path' => false,
|
||||
'from_email_force' => true,
|
||||
'from_name_force' => true,
|
||||
],
|
||||
],
|
||||
$connection
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the mailer provider options.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*/
|
||||
public function display_options() {
|
||||
|
||||
// Do not display options if PHP version is not correct.
|
||||
if ( ! $this->is_php_correct() ) {
|
||||
$this->display_php_warning();
|
||||
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- API Key -->
|
||||
<div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"
|
||||
class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
|
||||
<div class="wp-mail-smtp-setting-label">
|
||||
<label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"><?php esc_html_e( 'API Key', 'wp-mail-smtp' ); ?></label>
|
||||
</div>
|
||||
<div class="wp-mail-smtp-setting-field">
|
||||
<?php if ( $this->connection_options->is_const_defined( $this->get_slug(), 'api_key' ) ) : ?>
|
||||
<input type="text" disabled value="****************************************"
|
||||
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"
|
||||
/>
|
||||
<?php $this->display_const_set_message( 'WPMS_SMTP2GO_API_KEY' ); ?>
|
||||
<?php else : ?>
|
||||
<input type="password" spellcheck="false"
|
||||
name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][api_key]"
|
||||
value="<?php echo esc_attr( $this->connection_options->get( $this->get_slug(), 'api_key' ) ); ?>"
|
||||
id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"
|
||||
/>
|
||||
<?php endif; ?>
|
||||
|
||||
<p class="desc">
|
||||
<?php
|
||||
printf( /* translators: %s - link to get an API Key. */
|
||||
esc_html__( 'Generate an API key on the Sending → API Keys page in your %s.', 'wp-mail-smtp' ),
|
||||
'<a href="https://app.smtp2go.com/" target="_blank" rel="noopener noreferrer">' .
|
||||
esc_html__( 'control panel', 'wp-mail-smtp' ) .
|
||||
'</a>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -72,6 +72,13 @@ class Options extends OptionsAbstract {
|
||||
'title' => esc_html__( 'SendLayer', 'wp-mail-smtp' ),
|
||||
'description' => $description,
|
||||
'recommended' => true,
|
||||
'supports' => [
|
||||
'from_email' => true,
|
||||
'from_name' => true,
|
||||
'return_path' => false,
|
||||
'from_email_force' => true,
|
||||
'from_name_force' => true,
|
||||
],
|
||||
],
|
||||
$connection
|
||||
);
|
||||
|
||||
@@ -39,6 +39,9 @@ class ProcessQueueTask extends Task {
|
||||
// Register the action handler.
|
||||
add_action( self::ACTION, [ $this, 'process' ] );
|
||||
|
||||
// Cleanup completed task occurrences.
|
||||
add_action( 'action_scheduler_after_process_queue', [ $this, 'cleanup' ] );
|
||||
|
||||
// Exit if this task the queue is disabled, or it's already scheduled.
|
||||
if (
|
||||
! wp_mail_smtp()->get_queue()->is_enabled() ||
|
||||
@@ -68,4 +71,14 @@ class ProcessQueueTask extends Task {
|
||||
$this->cancel_force();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanup completed tasks.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*/
|
||||
public function cleanup() {
|
||||
|
||||
$this->remove_completed( 10 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,9 @@ class SendEnqueuedEmailTask extends Task {
|
||||
|
||||
// Register the action handler.
|
||||
add_action( self::ACTION, [ $this, 'process' ] );
|
||||
|
||||
// Cleanup completed task occurrences.
|
||||
add_action( 'action_scheduler_after_process_queue', [ $this, 'cleanup' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,4 +84,14 @@ class SendEnqueuedEmailTask extends Task {
|
||||
|
||||
wp_mail_smtp()->get_queue()->send_email( $email_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanup completed tasks.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*/
|
||||
public function cleanup() {
|
||||
|
||||
$this->remove_completed( 10 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,4 +353,27 @@ class Task {
|
||||
|
||||
add_action( 'shutdown', [ $this, 'cancel' ], PHP_INT_MAX );
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove completed occurrences of this task.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @param int $limit The amount of rows to remove.
|
||||
*/
|
||||
protected function remove_completed( $limit = 0 ) {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$limit = max( 0, intval( $limit ) );
|
||||
$query = 'DELETE FROM ' . $wpdb->prefix . 'actionscheduler_actions WHERE hook = "' . $this->action . '" AND status = "complete"';
|
||||
|
||||
if ( $limit > 0 ) {
|
||||
$query .= " LIMIT {$limit}";
|
||||
}
|
||||
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
|
||||
$wpdb->query( $query );
|
||||
// phpcs:enable WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,9 @@ class Tasks {
|
||||
|
||||
// Remove scheduled action meta after action execution.
|
||||
add_action( 'action_scheduler_after_execute', [ $this, 'clear_action_meta' ], PHP_INT_MAX, 2 );
|
||||
|
||||
// Cancel tasks on plugin deactivation.
|
||||
register_deactivation_hook( WPMS_PLUGIN_FILE, [ $this, 'cancel_all' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit473736c55a35b9a077f93cfc42f4bbf5::getLoader();
|
||||
return ComposerAutoloaderInitea20e5ba29b28036ad195e4916a7fbdc::getLoader();
|
||||
|
||||
@@ -15,6 +15,7 @@ return array(
|
||||
'Composer\\Installers\\BaseInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/BaseInstaller.php',
|
||||
'Composer\\Installers\\BitrixInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/BitrixInstaller.php',
|
||||
'Composer\\Installers\\BonefishInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/BonefishInstaller.php',
|
||||
'Composer\\Installers\\BotbleInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/BotbleInstaller.php',
|
||||
'Composer\\Installers\\CakePHPInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CakePHPInstaller.php',
|
||||
'Composer\\Installers\\ChefInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ChefInstaller.php',
|
||||
'Composer\\Installers\\CiviCrmInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CiviCrmInstaller.php',
|
||||
@@ -22,6 +23,7 @@ return array(
|
||||
'Composer\\Installers\\CockpitInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CockpitInstaller.php',
|
||||
'Composer\\Installers\\CodeIgniterInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php',
|
||||
'Composer\\Installers\\Concrete5Installer' => $vendorDir . '/composer/installers/src/Composer/Installers/Concrete5Installer.php',
|
||||
'Composer\\Installers\\ConcreteCMSInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ConcreteCMSInstaller.php',
|
||||
'Composer\\Installers\\CroogoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CroogoInstaller.php',
|
||||
'Composer\\Installers\\DecibelInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DecibelInstaller.php',
|
||||
'Composer\\Installers\\DframeInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DframeInstaller.php',
|
||||
@@ -32,6 +34,7 @@ return array(
|
||||
'Composer\\Installers\\EliasisInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/EliasisInstaller.php',
|
||||
'Composer\\Installers\\ExpressionEngineInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php',
|
||||
'Composer\\Installers\\EzPlatformInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/EzPlatformInstaller.php',
|
||||
'Composer\\Installers\\ForkCMSInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ForkCMSInstaller.php',
|
||||
'Composer\\Installers\\FuelInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/FuelInstaller.php',
|
||||
'Composer\\Installers\\FuelphpInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/FuelphpInstaller.php',
|
||||
'Composer\\Installers\\GravInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/GravInstaller.php',
|
||||
@@ -195,6 +198,8 @@ return array(
|
||||
'WPMailSMTP\\Pro\\Alerts\\Providers\\Email\\Options' => $baseDir . '/src/Pro/Alerts/Providers/Email/Options.php',
|
||||
'WPMailSMTP\\Pro\\Alerts\\Providers\\SlackWebhook\\Handler' => $baseDir . '/src/Pro/Alerts/Providers/SlackWebhook/Handler.php',
|
||||
'WPMailSMTP\\Pro\\Alerts\\Providers\\SlackWebhook\\Options' => $baseDir . '/src/Pro/Alerts/Providers/SlackWebhook/Options.php',
|
||||
'WPMailSMTP\\Pro\\Alerts\\Providers\\TeamsWebhook\\Handler' => $baseDir . '/src/Pro/Alerts/Providers/TeamsWebhook/Handler.php',
|
||||
'WPMailSMTP\\Pro\\Alerts\\Providers\\TeamsWebhook\\Options' => $baseDir . '/src/Pro/Alerts/Providers/TeamsWebhook/Options.php',
|
||||
'WPMailSMTP\\Pro\\Alerts\\Providers\\TwilioSMS\\Handler' => $baseDir . '/src/Pro/Alerts/Providers/TwilioSMS/Handler.php',
|
||||
'WPMailSMTP\\Pro\\Alerts\\Providers\\TwilioSMS\\Options' => $baseDir . '/src/Pro/Alerts/Providers/TwilioSMS/Options.php',
|
||||
'WPMailSMTP\\Pro\\BackupConnections\\Admin\\SettingsTab' => $baseDir . '/src/Pro/BackupConnections/Admin/SettingsTab.php',
|
||||
@@ -223,6 +228,7 @@ return array(
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\DeliveryVerification\\DeliveryVerification' => $baseDir . '/src/Pro/Emails/Logs/DeliveryVerification/DeliveryVerification.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\DeliveryVerification\\Mailgun\\DeliveryVerifier' => $baseDir . '/src/Pro/Emails/Logs/DeliveryVerification/Mailgun/DeliveryVerifier.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\DeliveryVerification\\Postmark\\DeliveryVerifier' => $baseDir . '/src/Pro/Emails/Logs/DeliveryVerification/Postmark/DeliveryVerifier.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\DeliveryVerification\\SMTP2GO\\DeliveryVerifier' => $baseDir . '/src/Pro/Emails/Logs/DeliveryVerification/SMTP2GO/DeliveryVerifier.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\DeliveryVerification\\SMTPcom\\DeliveryVerifier' => $baseDir . '/src/Pro/Emails/Logs/DeliveryVerification/SMTPcom/DeliveryVerifier.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\DeliveryVerification\\Sendinblue\\DeliveryVerifier' => $baseDir . '/src/Pro/Emails/Logs/DeliveryVerification/Sendinblue/DeliveryVerifier.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\DeliveryVerification\\Sendlayer\\DeliveryVerifier' => $baseDir . '/src/Pro/Emails/Logs/DeliveryVerification/Sendlayer/DeliveryVerifier.php',
|
||||
@@ -282,6 +288,10 @@ return array(
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\Webhooks\\Providers\\Postmark\\Processor' => $baseDir . '/src/Pro/Emails/Logs/Webhooks/Providers/Postmark/Processor.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\Webhooks\\Providers\\Postmark\\Provider' => $baseDir . '/src/Pro/Emails/Logs/Webhooks/Providers/Postmark/Provider.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\Webhooks\\Providers\\Postmark\\Subscriber' => $baseDir . '/src/Pro/Emails/Logs/Webhooks/Providers/Postmark/Subscriber.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\Webhooks\\Providers\\SMTP2GO\\Events\\Failed' => $baseDir . '/src/Pro/Emails/Logs/Webhooks/Providers/SMTP2GO/Events/Failed.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\Webhooks\\Providers\\SMTP2GO\\Processor' => $baseDir . '/src/Pro/Emails/Logs/Webhooks/Providers/SMTP2GO/Processor.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\Webhooks\\Providers\\SMTP2GO\\Provider' => $baseDir . '/src/Pro/Emails/Logs/Webhooks/Providers/SMTP2GO/Provider.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\Webhooks\\Providers\\SMTP2GO\\Subscriber' => $baseDir . '/src/Pro/Emails/Logs/Webhooks/Providers/SMTP2GO/Subscriber.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\Webhooks\\Providers\\SMTPcom\\Events\\Failed' => $baseDir . '/src/Pro/Emails/Logs/Webhooks/Providers/SMTPcom/Events/Failed.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\Webhooks\\Providers\\SMTPcom\\Processor' => $baseDir . '/src/Pro/Emails/Logs/Webhooks/Providers/SMTPcom/Processor.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\Webhooks\\Providers\\SMTPcom\\Provider' => $baseDir . '/src/Pro/Emails/Logs/Webhooks/Providers/SMTPcom/Provider.php',
|
||||
@@ -344,6 +354,7 @@ return array(
|
||||
'WPMailSMTP\\Pro\\Tasks\\Logs\\Mailgun\\VerifySentStatusTask' => $baseDir . '/src/Pro/Tasks/Logs/Mailgun/VerifySentStatusTask.php',
|
||||
'WPMailSMTP\\Pro\\Tasks\\Logs\\Postmark\\VerifySentStatusTask' => $baseDir . '/src/Pro/Tasks/Logs/Postmark/VerifySentStatusTask.php',
|
||||
'WPMailSMTP\\Pro\\Tasks\\Logs\\ResendTask' => $baseDir . '/src/Pro/Tasks/Logs/ResendTask.php',
|
||||
'WPMailSMTP\\Pro\\Tasks\\Logs\\SMTP2GO\\VerifySentStatusTask' => $baseDir . '/src/Pro/Tasks/Logs/SMTP2GO/VerifySentStatusTask.php',
|
||||
'WPMailSMTP\\Pro\\Tasks\\Logs\\SMTPcom\\VerifySentStatusTask' => $baseDir . '/src/Pro/Tasks/Logs/SMTPcom/VerifySentStatusTask.php',
|
||||
'WPMailSMTP\\Pro\\Tasks\\Logs\\Sendinblue\\VerifySentStatusTask' => $baseDir . '/src/Pro/Tasks/Logs/Sendinblue/VerifySentStatusTask.php',
|
||||
'WPMailSMTP\\Pro\\Tasks\\Logs\\Sendlayer\\VerifySentStatusTask' => $baseDir . '/src/Pro/Tasks/Logs/Sendlayer/VerifySentStatusTask.php',
|
||||
@@ -377,6 +388,8 @@ return array(
|
||||
'WPMailSMTP\\Providers\\Pepipost\\Options' => $baseDir . '/src/Providers/Pepipost/Options.php',
|
||||
'WPMailSMTP\\Providers\\Postmark\\Mailer' => $baseDir . '/src/Providers/Postmark/Mailer.php',
|
||||
'WPMailSMTP\\Providers\\Postmark\\Options' => $baseDir . '/src/Providers/Postmark/Options.php',
|
||||
'WPMailSMTP\\Providers\\SMTP2GO\\Mailer' => $baseDir . '/src/Providers/SMTP2GO/Mailer.php',
|
||||
'WPMailSMTP\\Providers\\SMTP2GO\\Options' => $baseDir . '/src/Providers/SMTP2GO/Options.php',
|
||||
'WPMailSMTP\\Providers\\SMTP\\Mailer' => $baseDir . '/src/Providers/SMTP/Mailer.php',
|
||||
'WPMailSMTP\\Providers\\SMTP\\Options' => $baseDir . '/src/Providers/SMTP/Options.php',
|
||||
'WPMailSMTP\\Providers\\SMTPcom\\Mailer' => $baseDir . '/src/Providers/SMTPcom/Mailer.php',
|
||||
@@ -644,17 +657,22 @@ return array(
|
||||
'WPMailSMTP\\Vendor\\GuzzleHttp\\RetryMiddleware' => $baseDir . '/vendor_prefixed/guzzlehttp/guzzle/src/RetryMiddleware.php',
|
||||
'WPMailSMTP\\Vendor\\GuzzleHttp\\TransferStats' => $baseDir . '/vendor_prefixed/guzzlehttp/guzzle/src/TransferStats.php',
|
||||
'WPMailSMTP\\Vendor\\GuzzleHttp\\Utils' => $baseDir . '/vendor_prefixed/guzzlehttp/guzzle/src/Utils.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Attribute\\AsMonologProcessor' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Attribute/AsMonologProcessor.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\DateTimeImmutable' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/DateTimeImmutable.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\ErrorHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/ErrorHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\ChromePHPFormatter' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\ElasticaFormatter' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\ElasticsearchFormatter' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/ElasticsearchFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\FlowdockFormatter' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\FluentdFormatter' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\FormatterInterface' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\GelfMessageFormatter' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\GoogleCloudLoggingFormatter' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/GoogleCloudLoggingFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\HtmlFormatter' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\JsonFormatter' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\LineFormatter' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/LineFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\LogglyFormatter' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\LogmaticFormatter' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/LogmaticFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\LogstashFormatter' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\MongoDBFormatter' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\NormalizerFormatter' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php',
|
||||
@@ -673,8 +691,10 @@ return array(
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\DeduplicationHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\DoctrineCouchDBHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\DynamoDbHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\ElasticSearchHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\ElasticaHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/ElasticaHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\ElasticsearchHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/ElasticsearchHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\ErrorLogHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\FallbackGroupHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/FallbackGroupHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\FilterHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/FilterHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\FingersCrossedHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\FingersCrossed\\ActivationStrategyInterface' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php',
|
||||
@@ -687,45 +707,55 @@ return array(
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\FormattableHandlerTrait' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/FormattableHandlerTrait.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\GelfHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/GelfHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\GroupHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/GroupHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\Handler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/Handler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\HandlerInterface' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/HandlerInterface.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\HandlerWrapper' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\HipChatHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/HipChatHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\IFTTTHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\InsightOpsHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\LogEntriesHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\LogglyHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/LogglyHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\LogmaticHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/LogmaticHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\MailHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/MailHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\MandrillHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/MandrillHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\MissingExtensionException' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\MongoDBHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\NativeMailerHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\NewRelicHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\NoopHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/NoopHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\NullHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/NullHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\OverflowHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/OverflowHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\PHPConsoleHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\ProcessHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/ProcessHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\ProcessableHandlerInterface' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/ProcessableHandlerInterface.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\ProcessableHandlerTrait' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/ProcessableHandlerTrait.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\PsrHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/PsrHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\PushoverHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/PushoverHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\RavenHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/RavenHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\RedisHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/RedisHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\RedisPubSubHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/RedisPubSubHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\RollbarHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/RollbarHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\RotatingFileHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SamplingHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SamplingHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SendGridHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SendGridHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SlackHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SlackHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SlackWebhookHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\Slack\\SlackRecord' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SlackbotHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SocketHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SocketHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SqsHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SqsHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\StreamHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/StreamHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SwiftMailerHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SymfonyMailerHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SymfonyMailerHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SyslogHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SyslogHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SyslogUdpHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SyslogUdp\\UdpSocket' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\TelegramBotHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/TelegramBotHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\TestHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/TestHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\WebRequestRecognizerTrait' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/WebRequestRecognizerTrait.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\WhatFailureGroupHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\ZendMonitorHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\LogRecord' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/LogRecord.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Logger' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Logger.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Processor\\GitProcessor' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Processor/GitProcessor.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Processor\\HostnameProcessor' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Processor/HostnameProcessor.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Processor\\IntrospectionProcessor' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Processor\\MemoryPeakUsageProcessor' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Processor\\MemoryProcessor' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php',
|
||||
@@ -740,6 +770,7 @@ return array(
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Registry' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Registry.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\ResettableInterface' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/ResettableInterface.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\SignalHandler' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/SignalHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Test\\TestCase' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Test/TestCase.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Utils' => $baseDir . '/vendor_prefixed/monolog/monolog/src/Monolog/Utils.php',
|
||||
'WPMailSMTP\\Vendor\\ParagonIE\\ConstantTime\\Base32' => $baseDir . '/vendor_prefixed/paragonie/constant_time_encoding/src/Base32.php',
|
||||
'WPMailSMTP\\Vendor\\ParagonIE\\ConstantTime\\Base32Hex' => $baseDir . '/vendor_prefixed/paragonie/constant_time_encoding/src/Base32Hex.php',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit473736c55a35b9a077f93cfc42f4bbf5
|
||||
class ComposerAutoloaderInitea20e5ba29b28036ad195e4916a7fbdc
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@@ -22,17 +22,17 @@ class ComposerAutoloaderInit473736c55a35b9a077f93cfc42f4bbf5
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit473736c55a35b9a077f93cfc42f4bbf5', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitea20e5ba29b28036ad195e4916a7fbdc', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit473736c55a35b9a077f93cfc42f4bbf5', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitea20e5ba29b28036ad195e4916a7fbdc', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit473736c55a35b9a077f93cfc42f4bbf5::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitea20e5ba29b28036ad195e4916a7fbdc::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit473736c55a35b9a077f93cfc42f4bbf5::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitea20e5ba29b28036ad195e4916a7fbdc::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit473736c55a35b9a077f93cfc42f4bbf5
|
||||
class ComposerStaticInitea20e5ba29b28036ad195e4916a7fbdc
|
||||
{
|
||||
public static $files = array (
|
||||
'2bb094e40611cb5eccea789f32aff634' => __DIR__ . '/../..' . '/vendor_prefixed/symfony/polyfill-mbstring/bootstrap.php',
|
||||
@@ -46,6 +46,7 @@ class ComposerStaticInit473736c55a35b9a077f93cfc42f4bbf5
|
||||
'Composer\\Installers\\BaseInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/BaseInstaller.php',
|
||||
'Composer\\Installers\\BitrixInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/BitrixInstaller.php',
|
||||
'Composer\\Installers\\BonefishInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/BonefishInstaller.php',
|
||||
'Composer\\Installers\\BotbleInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/BotbleInstaller.php',
|
||||
'Composer\\Installers\\CakePHPInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CakePHPInstaller.php',
|
||||
'Composer\\Installers\\ChefInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ChefInstaller.php',
|
||||
'Composer\\Installers\\CiviCrmInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CiviCrmInstaller.php',
|
||||
@@ -53,6 +54,7 @@ class ComposerStaticInit473736c55a35b9a077f93cfc42f4bbf5
|
||||
'Composer\\Installers\\CockpitInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CockpitInstaller.php',
|
||||
'Composer\\Installers\\CodeIgniterInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php',
|
||||
'Composer\\Installers\\Concrete5Installer' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/Concrete5Installer.php',
|
||||
'Composer\\Installers\\ConcreteCMSInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ConcreteCMSInstaller.php',
|
||||
'Composer\\Installers\\CroogoInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CroogoInstaller.php',
|
||||
'Composer\\Installers\\DecibelInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/DecibelInstaller.php',
|
||||
'Composer\\Installers\\DframeInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/DframeInstaller.php',
|
||||
@@ -63,6 +65,7 @@ class ComposerStaticInit473736c55a35b9a077f93cfc42f4bbf5
|
||||
'Composer\\Installers\\EliasisInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/EliasisInstaller.php',
|
||||
'Composer\\Installers\\ExpressionEngineInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php',
|
||||
'Composer\\Installers\\EzPlatformInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/EzPlatformInstaller.php',
|
||||
'Composer\\Installers\\ForkCMSInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ForkCMSInstaller.php',
|
||||
'Composer\\Installers\\FuelInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/FuelInstaller.php',
|
||||
'Composer\\Installers\\FuelphpInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/FuelphpInstaller.php',
|
||||
'Composer\\Installers\\GravInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/GravInstaller.php',
|
||||
@@ -226,6 +229,8 @@ class ComposerStaticInit473736c55a35b9a077f93cfc42f4bbf5
|
||||
'WPMailSMTP\\Pro\\Alerts\\Providers\\Email\\Options' => __DIR__ . '/../..' . '/src/Pro/Alerts/Providers/Email/Options.php',
|
||||
'WPMailSMTP\\Pro\\Alerts\\Providers\\SlackWebhook\\Handler' => __DIR__ . '/../..' . '/src/Pro/Alerts/Providers/SlackWebhook/Handler.php',
|
||||
'WPMailSMTP\\Pro\\Alerts\\Providers\\SlackWebhook\\Options' => __DIR__ . '/../..' . '/src/Pro/Alerts/Providers/SlackWebhook/Options.php',
|
||||
'WPMailSMTP\\Pro\\Alerts\\Providers\\TeamsWebhook\\Handler' => __DIR__ . '/../..' . '/src/Pro/Alerts/Providers/TeamsWebhook/Handler.php',
|
||||
'WPMailSMTP\\Pro\\Alerts\\Providers\\TeamsWebhook\\Options' => __DIR__ . '/../..' . '/src/Pro/Alerts/Providers/TeamsWebhook/Options.php',
|
||||
'WPMailSMTP\\Pro\\Alerts\\Providers\\TwilioSMS\\Handler' => __DIR__ . '/../..' . '/src/Pro/Alerts/Providers/TwilioSMS/Handler.php',
|
||||
'WPMailSMTP\\Pro\\Alerts\\Providers\\TwilioSMS\\Options' => __DIR__ . '/../..' . '/src/Pro/Alerts/Providers/TwilioSMS/Options.php',
|
||||
'WPMailSMTP\\Pro\\BackupConnections\\Admin\\SettingsTab' => __DIR__ . '/../..' . '/src/Pro/BackupConnections/Admin/SettingsTab.php',
|
||||
@@ -254,6 +259,7 @@ class ComposerStaticInit473736c55a35b9a077f93cfc42f4bbf5
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\DeliveryVerification\\DeliveryVerification' => __DIR__ . '/../..' . '/src/Pro/Emails/Logs/DeliveryVerification/DeliveryVerification.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\DeliveryVerification\\Mailgun\\DeliveryVerifier' => __DIR__ . '/../..' . '/src/Pro/Emails/Logs/DeliveryVerification/Mailgun/DeliveryVerifier.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\DeliveryVerification\\Postmark\\DeliveryVerifier' => __DIR__ . '/../..' . '/src/Pro/Emails/Logs/DeliveryVerification/Postmark/DeliveryVerifier.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\DeliveryVerification\\SMTP2GO\\DeliveryVerifier' => __DIR__ . '/../..' . '/src/Pro/Emails/Logs/DeliveryVerification/SMTP2GO/DeliveryVerifier.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\DeliveryVerification\\SMTPcom\\DeliveryVerifier' => __DIR__ . '/../..' . '/src/Pro/Emails/Logs/DeliveryVerification/SMTPcom/DeliveryVerifier.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\DeliveryVerification\\Sendinblue\\DeliveryVerifier' => __DIR__ . '/../..' . '/src/Pro/Emails/Logs/DeliveryVerification/Sendinblue/DeliveryVerifier.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\DeliveryVerification\\Sendlayer\\DeliveryVerifier' => __DIR__ . '/../..' . '/src/Pro/Emails/Logs/DeliveryVerification/Sendlayer/DeliveryVerifier.php',
|
||||
@@ -313,6 +319,10 @@ class ComposerStaticInit473736c55a35b9a077f93cfc42f4bbf5
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\Webhooks\\Providers\\Postmark\\Processor' => __DIR__ . '/../..' . '/src/Pro/Emails/Logs/Webhooks/Providers/Postmark/Processor.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\Webhooks\\Providers\\Postmark\\Provider' => __DIR__ . '/../..' . '/src/Pro/Emails/Logs/Webhooks/Providers/Postmark/Provider.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\Webhooks\\Providers\\Postmark\\Subscriber' => __DIR__ . '/../..' . '/src/Pro/Emails/Logs/Webhooks/Providers/Postmark/Subscriber.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\Webhooks\\Providers\\SMTP2GO\\Events\\Failed' => __DIR__ . '/../..' . '/src/Pro/Emails/Logs/Webhooks/Providers/SMTP2GO/Events/Failed.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\Webhooks\\Providers\\SMTP2GO\\Processor' => __DIR__ . '/../..' . '/src/Pro/Emails/Logs/Webhooks/Providers/SMTP2GO/Processor.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\Webhooks\\Providers\\SMTP2GO\\Provider' => __DIR__ . '/../..' . '/src/Pro/Emails/Logs/Webhooks/Providers/SMTP2GO/Provider.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\Webhooks\\Providers\\SMTP2GO\\Subscriber' => __DIR__ . '/../..' . '/src/Pro/Emails/Logs/Webhooks/Providers/SMTP2GO/Subscriber.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\Webhooks\\Providers\\SMTPcom\\Events\\Failed' => __DIR__ . '/../..' . '/src/Pro/Emails/Logs/Webhooks/Providers/SMTPcom/Events/Failed.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\Webhooks\\Providers\\SMTPcom\\Processor' => __DIR__ . '/../..' . '/src/Pro/Emails/Logs/Webhooks/Providers/SMTPcom/Processor.php',
|
||||
'WPMailSMTP\\Pro\\Emails\\Logs\\Webhooks\\Providers\\SMTPcom\\Provider' => __DIR__ . '/../..' . '/src/Pro/Emails/Logs/Webhooks/Providers/SMTPcom/Provider.php',
|
||||
@@ -375,6 +385,7 @@ class ComposerStaticInit473736c55a35b9a077f93cfc42f4bbf5
|
||||
'WPMailSMTP\\Pro\\Tasks\\Logs\\Mailgun\\VerifySentStatusTask' => __DIR__ . '/../..' . '/src/Pro/Tasks/Logs/Mailgun/VerifySentStatusTask.php',
|
||||
'WPMailSMTP\\Pro\\Tasks\\Logs\\Postmark\\VerifySentStatusTask' => __DIR__ . '/../..' . '/src/Pro/Tasks/Logs/Postmark/VerifySentStatusTask.php',
|
||||
'WPMailSMTP\\Pro\\Tasks\\Logs\\ResendTask' => __DIR__ . '/../..' . '/src/Pro/Tasks/Logs/ResendTask.php',
|
||||
'WPMailSMTP\\Pro\\Tasks\\Logs\\SMTP2GO\\VerifySentStatusTask' => __DIR__ . '/../..' . '/src/Pro/Tasks/Logs/SMTP2GO/VerifySentStatusTask.php',
|
||||
'WPMailSMTP\\Pro\\Tasks\\Logs\\SMTPcom\\VerifySentStatusTask' => __DIR__ . '/../..' . '/src/Pro/Tasks/Logs/SMTPcom/VerifySentStatusTask.php',
|
||||
'WPMailSMTP\\Pro\\Tasks\\Logs\\Sendinblue\\VerifySentStatusTask' => __DIR__ . '/../..' . '/src/Pro/Tasks/Logs/Sendinblue/VerifySentStatusTask.php',
|
||||
'WPMailSMTP\\Pro\\Tasks\\Logs\\Sendlayer\\VerifySentStatusTask' => __DIR__ . '/../..' . '/src/Pro/Tasks/Logs/Sendlayer/VerifySentStatusTask.php',
|
||||
@@ -408,6 +419,8 @@ class ComposerStaticInit473736c55a35b9a077f93cfc42f4bbf5
|
||||
'WPMailSMTP\\Providers\\Pepipost\\Options' => __DIR__ . '/../..' . '/src/Providers/Pepipost/Options.php',
|
||||
'WPMailSMTP\\Providers\\Postmark\\Mailer' => __DIR__ . '/../..' . '/src/Providers/Postmark/Mailer.php',
|
||||
'WPMailSMTP\\Providers\\Postmark\\Options' => __DIR__ . '/../..' . '/src/Providers/Postmark/Options.php',
|
||||
'WPMailSMTP\\Providers\\SMTP2GO\\Mailer' => __DIR__ . '/../..' . '/src/Providers/SMTP2GO/Mailer.php',
|
||||
'WPMailSMTP\\Providers\\SMTP2GO\\Options' => __DIR__ . '/../..' . '/src/Providers/SMTP2GO/Options.php',
|
||||
'WPMailSMTP\\Providers\\SMTP\\Mailer' => __DIR__ . '/../..' . '/src/Providers/SMTP/Mailer.php',
|
||||
'WPMailSMTP\\Providers\\SMTP\\Options' => __DIR__ . '/../..' . '/src/Providers/SMTP/Options.php',
|
||||
'WPMailSMTP\\Providers\\SMTPcom\\Mailer' => __DIR__ . '/../..' . '/src/Providers/SMTPcom/Mailer.php',
|
||||
@@ -675,17 +688,22 @@ class ComposerStaticInit473736c55a35b9a077f93cfc42f4bbf5
|
||||
'WPMailSMTP\\Vendor\\GuzzleHttp\\RetryMiddleware' => __DIR__ . '/../..' . '/vendor_prefixed/guzzlehttp/guzzle/src/RetryMiddleware.php',
|
||||
'WPMailSMTP\\Vendor\\GuzzleHttp\\TransferStats' => __DIR__ . '/../..' . '/vendor_prefixed/guzzlehttp/guzzle/src/TransferStats.php',
|
||||
'WPMailSMTP\\Vendor\\GuzzleHttp\\Utils' => __DIR__ . '/../..' . '/vendor_prefixed/guzzlehttp/guzzle/src/Utils.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Attribute\\AsMonologProcessor' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Attribute/AsMonologProcessor.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\DateTimeImmutable' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/DateTimeImmutable.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\ErrorHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/ErrorHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\ChromePHPFormatter' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\ElasticaFormatter' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\ElasticsearchFormatter' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/ElasticsearchFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\FlowdockFormatter' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\FluentdFormatter' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\FormatterInterface' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\GelfMessageFormatter' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\GoogleCloudLoggingFormatter' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/GoogleCloudLoggingFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\HtmlFormatter' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\JsonFormatter' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\LineFormatter' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/LineFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\LogglyFormatter' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\LogmaticFormatter' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/LogmaticFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\LogstashFormatter' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\MongoDBFormatter' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Formatter\\NormalizerFormatter' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php',
|
||||
@@ -704,8 +722,10 @@ class ComposerStaticInit473736c55a35b9a077f93cfc42f4bbf5
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\DeduplicationHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\DoctrineCouchDBHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\DynamoDbHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\ElasticSearchHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\ElasticaHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/ElasticaHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\ElasticsearchHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/ElasticsearchHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\ErrorLogHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\FallbackGroupHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/FallbackGroupHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\FilterHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/FilterHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\FingersCrossedHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\FingersCrossed\\ActivationStrategyInterface' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php',
|
||||
@@ -718,45 +738,55 @@ class ComposerStaticInit473736c55a35b9a077f93cfc42f4bbf5
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\FormattableHandlerTrait' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/FormattableHandlerTrait.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\GelfHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/GelfHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\GroupHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/GroupHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\Handler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/Handler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\HandlerInterface' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/HandlerInterface.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\HandlerWrapper' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\HipChatHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/HipChatHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\IFTTTHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\InsightOpsHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\LogEntriesHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\LogglyHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/LogglyHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\LogmaticHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/LogmaticHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\MailHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/MailHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\MandrillHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/MandrillHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\MissingExtensionException' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\MongoDBHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\NativeMailerHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\NewRelicHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\NoopHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/NoopHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\NullHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/NullHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\OverflowHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/OverflowHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\PHPConsoleHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\ProcessHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/ProcessHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\ProcessableHandlerInterface' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/ProcessableHandlerInterface.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\ProcessableHandlerTrait' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/ProcessableHandlerTrait.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\PsrHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/PsrHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\PushoverHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/PushoverHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\RavenHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/RavenHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\RedisHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/RedisHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\RedisPubSubHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/RedisPubSubHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\RollbarHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/RollbarHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\RotatingFileHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SamplingHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SamplingHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SendGridHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SendGridHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SlackHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SlackHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SlackWebhookHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\Slack\\SlackRecord' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SlackbotHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SocketHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SocketHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SqsHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SqsHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\StreamHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/StreamHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SwiftMailerHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SymfonyMailerHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SymfonyMailerHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SyslogHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SyslogHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SyslogUdpHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\SyslogUdp\\UdpSocket' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\TelegramBotHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/TelegramBotHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\TestHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/TestHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\WebRequestRecognizerTrait' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/WebRequestRecognizerTrait.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\WhatFailureGroupHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Handler\\ZendMonitorHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\LogRecord' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/LogRecord.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Logger' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Logger.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Processor\\GitProcessor' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Processor/GitProcessor.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Processor\\HostnameProcessor' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Processor/HostnameProcessor.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Processor\\IntrospectionProcessor' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Processor\\MemoryPeakUsageProcessor' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Processor\\MemoryProcessor' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php',
|
||||
@@ -771,6 +801,7 @@ class ComposerStaticInit473736c55a35b9a077f93cfc42f4bbf5
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Registry' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Registry.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\ResettableInterface' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/ResettableInterface.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\SignalHandler' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/SignalHandler.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Test\\TestCase' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Test/TestCase.php',
|
||||
'WPMailSMTP\\Vendor\\Monolog\\Utils' => __DIR__ . '/../..' . '/vendor_prefixed/monolog/monolog/src/Monolog/Utils.php',
|
||||
'WPMailSMTP\\Vendor\\ParagonIE\\ConstantTime\\Base32' => __DIR__ . '/../..' . '/vendor_prefixed/paragonie/constant_time_encoding/src/Base32.php',
|
||||
'WPMailSMTP\\Vendor\\ParagonIE\\ConstantTime\\Base32Hex' => __DIR__ . '/../..' . '/vendor_prefixed/paragonie/constant_time_encoding/src/Base32Hex.php',
|
||||
@@ -829,9 +860,9 @@ class ComposerStaticInit473736c55a35b9a077f93cfc42f4bbf5
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit473736c55a35b9a077f93cfc42f4bbf5::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit473736c55a35b9a077f93cfc42f4bbf5::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit473736c55a35b9a077f93cfc42f4bbf5::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitea20e5ba29b28036ad195e4916a7fbdc::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitea20e5ba29b28036ad195e4916a7fbdc::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitea20e5ba29b28036ad195e4916a7fbdc::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php return array(
|
||||
'root' => array(
|
||||
'name' => 'awesomemotive/wp-mail-smtp',
|
||||
'pretty_version' => 'dev-4.0.1-release',
|
||||
'version' => 'dev-4.0.1-release',
|
||||
'reference' => 'd8bdf3838b23f2697ddf1e6e717d6974202fe306',
|
||||
'pretty_version' => 'dev-4.1.0-release',
|
||||
'version' => 'dev-4.1.0-release',
|
||||
'reference' => 'b9a0881c73b14ba7a3944f70abecda295d994fe6',
|
||||
'type' => 'wordpress-plugin',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
@@ -11,18 +11,18 @@
|
||||
),
|
||||
'versions' => array(
|
||||
'awesomemotive/wp-mail-smtp' => array(
|
||||
'pretty_version' => 'dev-4.0.1-release',
|
||||
'version' => 'dev-4.0.1-release',
|
||||
'reference' => 'd8bdf3838b23f2697ddf1e6e717d6974202fe306',
|
||||
'pretty_version' => 'dev-4.1.0-release',
|
||||
'version' => 'dev-4.1.0-release',
|
||||
'reference' => 'b9a0881c73b14ba7a3944f70abecda295d994fe6',
|
||||
'type' => 'wordpress-plugin',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'composer/installers' => array(
|
||||
'pretty_version' => 'v2.2.0',
|
||||
'version' => '2.2.0.0',
|
||||
'reference' => 'c29dc4b93137acb82734f672c37e029dfbd95b35',
|
||||
'pretty_version' => 'v2.3.0',
|
||||
'version' => '2.3.0.0',
|
||||
'reference' => '12fb2dfe5e16183de69e784a7b84046c43d97e8e',
|
||||
'type' => 'composer-plugin',
|
||||
'install_path' => __DIR__ . '/./installers',
|
||||
'aliases' => array(),
|
||||
@@ -92,18 +92,18 @@
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'monolog/monolog' => array(
|
||||
'pretty_version' => '1.27.1',
|
||||
'version' => '1.27.1.0',
|
||||
'reference' => '904713c5929655dc9b97288b69cfeedad610c9a1',
|
||||
'pretty_version' => '2.9.3',
|
||||
'version' => '2.9.3.0',
|
||||
'reference' => 'a30bfe2e142720dfa990d0a7e573997f5d884215',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../monolog/monolog',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'paragonie/constant_time_encoding' => array(
|
||||
'pretty_version' => 'v2.6.3',
|
||||
'version' => '2.6.3.0',
|
||||
'reference' => '58c3f47f650c94ec05a151692652a868995d2938',
|
||||
'pretty_version' => 'v2.7.0',
|
||||
'version' => '2.7.0.0',
|
||||
'reference' => '52a0d99e69f56b9ec27ace92ba56897fe6993105',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../paragonie/constant_time_encoding',
|
||||
'aliases' => array(),
|
||||
@@ -119,9 +119,9 @@
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'phpseclib/phpseclib' => array(
|
||||
'pretty_version' => '3.0.34',
|
||||
'version' => '3.0.34.0',
|
||||
'reference' => '56c79f16a6ae17e42089c06a2144467acc35348a',
|
||||
'pretty_version' => '3.0.39',
|
||||
'version' => '3.0.39.0',
|
||||
'reference' => '211ebc399c6e73c225a018435fe5ae209d1d1485',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../phpseclib/phpseclib',
|
||||
'aliases' => array(),
|
||||
@@ -193,7 +193,7 @@
|
||||
'psr/log-implementation' => array(
|
||||
'dev_requirement' => false,
|
||||
'provided' => array(
|
||||
0 => '1.0.0',
|
||||
0 => '1.0.0 || 2.0.0 || 3.0.0',
|
||||
),
|
||||
),
|
||||
'ralouphie/getallheaders' => array(
|
||||
@@ -215,36 +215,36 @@
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'symfony/polyfill-intl-idn' => array(
|
||||
'pretty_version' => 'v1.28.0',
|
||||
'version' => '1.28.0.0',
|
||||
'reference' => 'ecaafce9f77234a6a449d29e49267ba10499116d',
|
||||
'pretty_version' => 'v1.29.0',
|
||||
'version' => '1.29.0.0',
|
||||
'reference' => 'a287ed7475f85bf6f61890146edbc932c0fff919',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../symfony/polyfill-intl-idn',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'symfony/polyfill-intl-normalizer' => array(
|
||||
'pretty_version' => 'v1.28.0',
|
||||
'version' => '1.28.0.0',
|
||||
'reference' => '8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92',
|
||||
'pretty_version' => 'v1.29.0',
|
||||
'version' => '1.29.0.0',
|
||||
'reference' => 'bc45c394692b948b4d383a08d7753968bed9a83d',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../symfony/polyfill-intl-normalizer',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'symfony/polyfill-mbstring' => array(
|
||||
'pretty_version' => 'v1.28.0',
|
||||
'version' => '1.28.0.0',
|
||||
'reference' => '42292d99c55abe617799667f454222c54c60e229',
|
||||
'pretty_version' => 'v1.29.0',
|
||||
'version' => '1.29.0.0',
|
||||
'reference' => '9773676c8a1bb1f8d4340a62efe641cf76eda7ec',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'symfony/polyfill-php72' => array(
|
||||
'pretty_version' => 'v1.28.0',
|
||||
'version' => '1.28.0.0',
|
||||
'reference' => '70f4aebd92afca2f865444d30a4d2151c13c3179',
|
||||
'pretty_version' => 'v1.29.0',
|
||||
'version' => '1.29.0.0',
|
||||
'reference' => '861391a8da9a04cbad2d232ddd9e4893220d6e25',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../symfony/polyfill-php72',
|
||||
'aliases' => array(),
|
||||
@@ -260,9 +260,9 @@
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'woocommerce/action-scheduler' => array(
|
||||
'pretty_version' => '3.7.1',
|
||||
'version' => '3.7.1.0',
|
||||
'reference' => 'bdaecb016e0358065a8bf76a41fdd60772cacaa5',
|
||||
'pretty_version' => '3.7.4',
|
||||
'version' => '3.7.4.0',
|
||||
'reference' => '5fb655253dc004bb7a6d840da807f0949aea8bcd',
|
||||
'type' => 'wordpress-plugin',
|
||||
'install_path' => __DIR__ . '/../woocommerce/action-scheduler',
|
||||
'aliases' => array(),
|
||||
|
||||
Vendored
+8
-8
@@ -5,10 +5,10 @@
|
||||
* Description: A robust scheduling library for use in WordPress plugins.
|
||||
* Author: Automattic
|
||||
* Author URI: https://automattic.com/
|
||||
* Version: 3.7.1
|
||||
* Version: 3.7.4
|
||||
* License: GPLv3
|
||||
* Requires at least: 6.2
|
||||
* Tested up to: 6.4
|
||||
* Tested up to: 6.5
|
||||
* Requires PHP: 5.6
|
||||
*
|
||||
* Copyright 2019 Automattic, Inc. (https://automattic.com/contact/)
|
||||
@@ -29,29 +29,29 @@
|
||||
* @package ActionScheduler
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'action_scheduler_register_3_dot_7_dot_1' ) && function_exists( 'add_action' ) ) { // WRCS: DEFINED_VERSION.
|
||||
if ( ! function_exists( 'action_scheduler_register_3_dot_7_dot_4' ) && function_exists( 'add_action' ) ) { // WRCS: DEFINED_VERSION.
|
||||
|
||||
if ( ! class_exists( 'ActionScheduler_Versions', false ) ) {
|
||||
require_once __DIR__ . '/classes/ActionScheduler_Versions.php';
|
||||
add_action( 'plugins_loaded', array( 'ActionScheduler_Versions', 'initialize_latest_version' ), 1, 0 );
|
||||
}
|
||||
|
||||
add_action( 'plugins_loaded', 'action_scheduler_register_3_dot_7_dot_1', 0, 0 ); // WRCS: DEFINED_VERSION.
|
||||
add_action( 'plugins_loaded', 'action_scheduler_register_3_dot_7_dot_4', 0, 0 ); // WRCS: DEFINED_VERSION.
|
||||
|
||||
// phpcs:disable Generic.Functions.OpeningFunctionBraceKernighanRitchie.ContentAfterBrace
|
||||
/**
|
||||
* Registers this version of Action Scheduler.
|
||||
*/
|
||||
function action_scheduler_register_3_dot_7_dot_1() { // WRCS: DEFINED_VERSION.
|
||||
function action_scheduler_register_3_dot_7_dot_4() { // WRCS: DEFINED_VERSION.
|
||||
$versions = ActionScheduler_Versions::instance();
|
||||
$versions->register( '3.7.1', 'action_scheduler_initialize_3_dot_7_dot_1' ); // WRCS: DEFINED_VERSION.
|
||||
$versions->register( '3.7.4', 'action_scheduler_initialize_3_dot_7_dot_4' ); // WRCS: DEFINED_VERSION.
|
||||
}
|
||||
|
||||
// phpcs:disable Generic.Functions.OpeningFunctionBraceKernighanRitchie.ContentAfterBrace
|
||||
/**
|
||||
* Initializes this version of Action Scheduler.
|
||||
*/
|
||||
function action_scheduler_initialize_3_dot_7_dot_1() { // WRCS: DEFINED_VERSION.
|
||||
function action_scheduler_initialize_3_dot_7_dot_4() { // WRCS: DEFINED_VERSION.
|
||||
// A final safety check is required even here, because historic versions of Action Scheduler
|
||||
// followed a different pattern (in some unusual cases, we could reach this point and the
|
||||
// ActionScheduler class is already defined—so we need to guard against that).
|
||||
@@ -63,7 +63,7 @@ if ( ! function_exists( 'action_scheduler_register_3_dot_7_dot_1' ) && function_
|
||||
|
||||
// Support usage in themes - load this version if no plugin has loaded a version yet.
|
||||
if ( did_action( 'plugins_loaded' ) && ! doing_action( 'plugins_loaded' ) && ! class_exists( 'ActionScheduler', false ) ) {
|
||||
action_scheduler_initialize_3_dot_7_dot_1(); // WRCS: DEFINED_VERSION.
|
||||
action_scheduler_initialize_3_dot_7_dot_4(); // WRCS: DEFINED_VERSION.
|
||||
do_action( 'action_scheduler_pre_theme_init' );
|
||||
ActionScheduler_Versions::initialize_latest_version();
|
||||
}
|
||||
|
||||
+17
-3
@@ -1,15 +1,29 @@
|
||||
*** Changelog ***
|
||||
|
||||
= 3.7.1 - 2023-12-13 =
|
||||
* Release/3.7.0.
|
||||
= 3.7.4 - 2024-04-05 =
|
||||
* Give a clear description of how the $unique parameter works.
|
||||
* Merge release/3.7.3 into trunk.
|
||||
* Preserve the tab field if set.
|
||||
* Tweak - WP 6.5 compatibility.
|
||||
|
||||
= 3.7.3 - 2024-03-20 =
|
||||
* Do not iterate over all of GET when building form in list table.
|
||||
* Fix a few issues reported by PCP (Plugin Check Plugin).
|
||||
* Try to save actions as unique even when the store doesn't support it.
|
||||
* Tweak - WP 6.4 compatibility.
|
||||
* Update "Tested up to" tag to WordPress 6.5.
|
||||
* update version in package-lock.json.
|
||||
|
||||
= 3.7.2 - 2024-02-14 =
|
||||
* No longer user variables in `_n()` translation function.
|
||||
|
||||
= 3.7.1 - 2023-12-13 =
|
||||
* update semver to 5.7.2 because of a security vulnerability in 5.7.1.
|
||||
|
||||
= 3.7.0 - 2023-11-20 =
|
||||
* Important: starting with this release, Action Scheduler follows an L-2 version policy (WordPress, and consequently PHP).
|
||||
* Add extended indexes for hook_status_scheduled_date_gmt and status_sheduled_date_gmt.
|
||||
* Catch and log exceptions thrown when actions can't be created, e.g. under a corrupt database schema.
|
||||
* Release/3.6.4.
|
||||
* Tweak - WP 6.4 compatibility.
|
||||
* Update unit tests for upcoming dependency version policy.
|
||||
* make sure hook action_scheduler_failed_execution can access original exception object.
|
||||
|
||||
+21
-2
@@ -351,7 +351,26 @@ class ActionScheduler_ActionFactory {
|
||||
*/
|
||||
protected function store_unique_action( ActionScheduler_Action $action ) {
|
||||
$store = ActionScheduler_Store::instance();
|
||||
return method_exists( $store, 'save_unique_action' ) ?
|
||||
$store->save_unique_action( $action ) : $store->save_action( $action );
|
||||
if ( method_exists( $store, 'save_unique_action' ) ) {
|
||||
return $store->save_unique_action( $action );
|
||||
} else {
|
||||
/**
|
||||
* Fallback to non-unique action if the store doesn't support unique actions.
|
||||
* We try to save the action as unique, accepting that there might be a race condition.
|
||||
* This is likely still better than givinig up on unique actions entirely.
|
||||
*/
|
||||
$existing_action_id = (int) $store->find_action(
|
||||
$action->get_hook(),
|
||||
array(
|
||||
'args' => $action->get_args(),
|
||||
'status' => ActionScheduler_Store::STATUS_PENDING,
|
||||
'group' => $action->get_group(),
|
||||
)
|
||||
);
|
||||
if ( $existing_action_id > 0 ) {
|
||||
return 0;
|
||||
}
|
||||
return $store->save_action( $action );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -192,8 +192,8 @@ class ActionScheduler_AdminView extends ActionScheduler_AdminView_Deprecated {
|
||||
# Print notice.
|
||||
echo '<div class="notice notice-warning"><p>';
|
||||
printf(
|
||||
// translators: 1) is the number of affected actions, 2) is a link to an admin screen.
|
||||
_n(
|
||||
// translators: 1) is the number of affected actions, 2) is a link to an admin screen.
|
||||
'<strong>Action Scheduler:</strong> %1$d <a href="%2$s">past-due action</a> found; something may be wrong. <a href="https://actionscheduler.org/faq/#my-site-has-past-due-actions-what-can-i-do" target="_blank">Read documentation »</a>',
|
||||
'<strong>Action Scheduler:</strong> %1$d <a href="%2$s">past-due actions</a> found; something may be wrong. <a href="https://actionscheduler.org/faq/#my-site-has-past-due-actions-what-can-i-do" target="_blank">Read documentation »</a>',
|
||||
$num_pastdue_actions,
|
||||
@@ -224,6 +224,7 @@ class ActionScheduler_AdminView extends ActionScheduler_AdminView_Deprecated {
|
||||
'id' => 'action_scheduler_about',
|
||||
'title' => __( 'About', 'action-scheduler' ),
|
||||
'content' =>
|
||||
// translators: %s is the Action Scheduler version.
|
||||
'<h2>' . sprintf( __( 'About Action Scheduler %s', 'action-scheduler' ), $as_version ) . '</h2>' .
|
||||
'<p>' .
|
||||
__( 'Action Scheduler is a scalable, traceable job queue for background processing large sets of actions. Action Scheduler works by triggering an action hook to run at some time in the future. Scheduled actions can also be scheduled to run on a recurring schedule.', 'action-scheduler' ) .
|
||||
|
||||
+1
-1
@@ -234,7 +234,7 @@ class ActionScheduler_ListTable extends ActionScheduler_Abstract_ListTable {
|
||||
if ( ! empty( $output ) ) {
|
||||
$output .= ' ';
|
||||
}
|
||||
$output .= sprintf( _n( self::$time_periods[ $time_period_index ]['names'][0], self::$time_periods[ $time_period_index ]['names'][1], $periods_in_interval, 'action-scheduler' ), $periods_in_interval );
|
||||
$output .= sprintf( translate_nooped_plural( self::$time_periods[ $time_period_index ]['names'], $periods_in_interval, 'action-scheduler' ), $periods_in_interval );
|
||||
$seconds_remaining -= $periods_in_interval * self::$time_periods[ $time_period_index ]['seconds'];
|
||||
$periods_included++;
|
||||
}
|
||||
|
||||
+26
-5
@@ -313,6 +313,24 @@ abstract class ActionScheduler_Abstract_ListTable extends WP_List_Table {
|
||||
return "ORDER BY {$orderby} {$order}";
|
||||
}
|
||||
|
||||
/**
|
||||
* Querystring arguments to persist between form submissions.
|
||||
*
|
||||
* @since 3.7.3
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
protected function get_request_query_args_to_persist() {
|
||||
return array_merge(
|
||||
$this->sort_by,
|
||||
array(
|
||||
'page',
|
||||
'status',
|
||||
'tab',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the sortable column specified for this request to order the results by, if any.
|
||||
*
|
||||
@@ -682,8 +700,8 @@ abstract class ActionScheduler_Abstract_ListTable extends WP_List_Table {
|
||||
|
||||
// Translated status labels.
|
||||
$status_labels = ActionScheduler_Store::instance()->get_status_labels();
|
||||
$status_labels['all'] = _x( 'All', 'status labels', 'action-scheduler' );
|
||||
$status_labels['past-due'] = _x( 'Past-due', 'status labels', 'action-scheduler' );
|
||||
$status_labels['all'] = esc_html_x( 'All', 'status labels', 'action-scheduler' );
|
||||
$status_labels['past-due'] = esc_html_x( 'Past-due', 'status labels', 'action-scheduler' );
|
||||
|
||||
foreach ( $this->status_counts as $status_slug => $count ) {
|
||||
|
||||
@@ -717,12 +735,15 @@ abstract class ActionScheduler_Abstract_ListTable extends WP_List_Table {
|
||||
*/
|
||||
protected function display_table() {
|
||||
echo '<form id="' . esc_attr( $this->_args['plural'] ) . '-filter" method="get">';
|
||||
foreach ( $_GET as $key => $value ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
if ( '_' === $key[0] || 'paged' === $key || 'ID' === $key ) {
|
||||
foreach ( $this->get_request_query_args_to_persist() as $arg ) {
|
||||
$arg_value = isset( $_GET[ $arg ] ) ? sanitize_text_field( wp_unslash( $_GET[ $arg ] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
if ( ! $arg_value ) {
|
||||
continue;
|
||||
}
|
||||
echo '<input type="hidden" name="' . esc_attr( $key ) . '" value="' . esc_attr( $value ) . '" />';
|
||||
|
||||
echo '<input type="hidden" name="' . esc_attr( $arg ) . '" value="' . esc_attr( $arg_value ) . '" />';
|
||||
}
|
||||
|
||||
if ( ! empty( $this->search_by ) ) {
|
||||
echo $this->search_box( $this->get_search_box_button_text(), 'plugin' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
|
||||
+2
-1
@@ -325,7 +325,8 @@ abstract class ActionScheduler_Store extends ActionScheduler_Store_Deprecated {
|
||||
* @throws InvalidArgumentException When json encoded args is too long.
|
||||
*/
|
||||
protected function validate_action( ActionScheduler_Action $action ) {
|
||||
if ( strlen( json_encode( $action->get_args() ) ) > static::$max_args_length ) {
|
||||
if ( strlen( wp_json_encode( $action->get_args() ) ) > static::$max_args_length ) {
|
||||
// translators: %d is a number (maximum length of action arguments).
|
||||
throw new InvalidArgumentException( sprintf( __( 'ActionScheduler_Action::$args too long. To ensure the args column can be indexed, action args should not be more than %d characters when encoded as JSON.', 'action-scheduler' ), static::$max_args_length ) );
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -69,7 +69,7 @@ abstract class ActionScheduler_TimezoneHelper {
|
||||
// Last try, guess timezone string manually.
|
||||
foreach ( timezone_abbreviations_list() as $abbr ) {
|
||||
foreach ( $abbr as $city ) {
|
||||
if ( (bool) date( 'I' ) === (bool) $city['dst'] && $city['timezone_id'] && intval( $city['offset'] ) === $utc_offset ) {
|
||||
if ( (bool) date( 'I' ) === (bool) $city['dst'] && $city['timezone_id'] && intval( $city['offset'] ) === $utc_offset ) { // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date -- we are actually interested in the runtime timezone.
|
||||
return $city['timezone_id'];
|
||||
}
|
||||
}
|
||||
@@ -122,7 +122,7 @@ abstract class ActionScheduler_TimezoneHelper {
|
||||
|
||||
// Try mapping to the first abbreviation we can find.
|
||||
if ( false === $tzstring ) {
|
||||
$is_dst = date( 'I' );
|
||||
$is_dst = date( 'I' ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date -- we are actually interested in the runtime timezone.
|
||||
foreach ( timezone_abbreviations_list() as $abbr ) {
|
||||
foreach ( $abbr as $city ) {
|
||||
if ( $city['dst'] == $is_dst && $city['offset'] == $gmt_offset ) {
|
||||
|
||||
+5
-4
@@ -146,7 +146,7 @@ class ActionScheduler_DBStore extends ActionScheduler_Store {
|
||||
$column_sql = '`' . implode( '`, `', $columns ) . '`';
|
||||
$placeholder_sql = implode( ', ', $placeholders );
|
||||
$where_clause = $this->build_where_clause_for_insert( $data, $table_name, $unique );
|
||||
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $column_sql and $where_clause are already prepared. $placeholder_sql is hardcoded.
|
||||
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare -- $column_sql and $where_clause are already prepared. $placeholder_sql is hardcoded.
|
||||
$insert_query = $wpdb->prepare(
|
||||
"
|
||||
INSERT INTO $table_name ( $column_sql )
|
||||
@@ -181,7 +181,7 @@ WHERE ( $where_clause ) IS NULL",
|
||||
);
|
||||
$pending_status_placeholders = implode( ', ', array_fill( 0, count( $pending_statuses ), '%s' ) );
|
||||
|
||||
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $pending_status_placeholders is hardcoded.
|
||||
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQLPlaceholders.ReplacementsWrongNumber -- $pending_status_placeholders is hardcoded.
|
||||
$where_clause = $wpdb->prepare(
|
||||
"
|
||||
SELECT action_id FROM $table_name
|
||||
@@ -480,7 +480,7 @@ AND `group_id` = %d
|
||||
case 'like':
|
||||
foreach ( $query['args'] as $key => $value ) {
|
||||
$sql .= ' AND a.args LIKE %s';
|
||||
$json_partial = $wpdb->esc_like( trim( json_encode( array( $key => $value ) ), '{}' ) );
|
||||
$json_partial = $wpdb->esc_like( trim( wp_json_encode( array( $key => $value ) ), '{}' ) );
|
||||
$sql_params[] = "%{$json_partial}%";
|
||||
}
|
||||
break;
|
||||
@@ -1031,7 +1031,7 @@ AND `group_id` = %d
|
||||
$row_updates = 0;
|
||||
if ( count( $action_ids ) > 0 ) {
|
||||
$action_id_string = implode( ',', array_map( 'absint', $action_ids ) );
|
||||
$row_updates = $wpdb->query( "UPDATE {$wpdb->actionscheduler_actions} SET claim_id = 0 WHERE action_id IN ({$action_id_string})" ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||
$row_updates = $wpdb->query( "UPDATE {$wpdb->actionscheduler_actions} SET claim_id = 0 WHERE action_id IN ({$action_id_string})" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
|
||||
}
|
||||
|
||||
$wpdb->delete( $wpdb->actionscheduler_claims, array( 'claim_id' => $claim->get_id() ), array( '%d' ) );
|
||||
@@ -1039,6 +1039,7 @@ AND `group_id` = %d
|
||||
if ( $row_updates < count( $action_ids ) ) {
|
||||
throw new RuntimeException(
|
||||
sprintf(
|
||||
// translators: %d is an id.
|
||||
__( 'Unable to release actions from claim id %d.', 'action-scheduler' ),
|
||||
$claim->get_id()
|
||||
)
|
||||
|
||||
+2
-2
@@ -690,7 +690,7 @@ class ActionScheduler_wpPostStore extends ActionScheduler_Store {
|
||||
$params[] = $limit;
|
||||
|
||||
// Run the query and gather results.
|
||||
$rows_affected = $wpdb->query( $wpdb->prepare( "{$update} {$where} {$order}", $params ) ); // phpcs:ignore // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare
|
||||
$rows_affected = $wpdb->query( $wpdb->prepare( "{$update} {$where} {$order}", $params ) ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare
|
||||
|
||||
if ( false === $rows_affected ) {
|
||||
throw new RuntimeException( __( 'Unable to claim actions. Database error.', 'action-scheduler' ) );
|
||||
@@ -725,7 +725,7 @@ class ActionScheduler_wpPostStore extends ActionScheduler_Store {
|
||||
'post_status' => ActionScheduler_Store::STATUS_PENDING,
|
||||
'has_password' => false,
|
||||
'posts_per_page' => $limit * 3,
|
||||
'suppress_filters' => true,
|
||||
'suppress_filters' => true, // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.SuppressFilters_suppress_filters
|
||||
'no_found_rows' => true,
|
||||
'orderby' => array(
|
||||
'menu_order' => 'ASC',
|
||||
|
||||
+1
@@ -92,6 +92,7 @@ class ActionMigrator {
|
||||
|
||||
$test_action = $this->source->fetch_action( $source_action_id );
|
||||
if ( ! is_a( $test_action, 'ActionScheduler_NullAction' ) ) {
|
||||
// translators: %s is an action ID.
|
||||
throw new \RuntimeException( sprintf( __( 'Unable to remove source migrated action %s', 'action-scheduler' ), $source_action_id ) );
|
||||
}
|
||||
do_action( 'action_scheduler/migrated_action', $source_action_id, $destination_action_id, $this->source, $this->destination );
|
||||
|
||||
+1
@@ -41,6 +41,7 @@ class ActionScheduler_DBStoreMigrator extends ActionScheduler_DBStore {
|
||||
|
||||
return $action_id;
|
||||
} catch ( \Exception $e ) {
|
||||
// translators: %s is an error message.
|
||||
throw new \RuntimeException( sprintf( __( 'Error saving action: %s', 'action-scheduler' ), $e->getMessage() ), 0 );
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -11,7 +11,7 @@
|
||||
* @param string $hook The hook to trigger.
|
||||
* @param array $args Arguments to pass when the hook triggers.
|
||||
* @param string $group The group to assign this job to.
|
||||
* @param bool $unique Whether the action should be unique.
|
||||
* @param bool $unique Whether the action should be unique. It will not be scheduled if another pending or running action has the same hook and group parameters.
|
||||
* @param int $priority Lower values take precedence over higher values. Defaults to 10, with acceptable values falling in the range 0-255.
|
||||
*
|
||||
* @return int The action ID. Zero if there was an error scheduling the action.
|
||||
@@ -60,7 +60,7 @@ function as_enqueue_async_action( $hook, $args = array(), $group = '', $unique =
|
||||
* @param string $hook The hook to trigger.
|
||||
* @param array $args Arguments to pass when the hook triggers.
|
||||
* @param string $group The group to assign this job to.
|
||||
* @param bool $unique Whether the action should be unique.
|
||||
* @param bool $unique Whether the action should be unique. It will not be scheduled if another pending or running action has the same hook and group parameters.
|
||||
* @param int $priority Lower values take precedence over higher values. Defaults to 10, with acceptable values falling in the range 0-255.
|
||||
*
|
||||
* @return int The action ID. Zero if there was an error scheduling the action.
|
||||
@@ -112,7 +112,7 @@ function as_schedule_single_action( $timestamp, $hook, $args = array(), $group =
|
||||
* @param string $hook The hook to trigger.
|
||||
* @param array $args Arguments to pass when the hook triggers.
|
||||
* @param string $group The group to assign this job to.
|
||||
* @param bool $unique Whether the action should be unique.
|
||||
* @param bool $unique Whether the action should be unique. It will not be scheduled if another pending or running action has the same hook and group parameters.
|
||||
* @param int $priority Lower values take precedence over higher values. Defaults to 10, with acceptable values falling in the range 0-255.
|
||||
*
|
||||
* @return int The action ID. Zero if there was an error scheduling the action.
|
||||
@@ -197,7 +197,7 @@ function as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook,
|
||||
* @param string $hook The hook to trigger.
|
||||
* @param array $args Arguments to pass when the hook triggers.
|
||||
* @param string $group The group to assign this job to.
|
||||
* @param bool $unique Whether the action should be unique.
|
||||
* @param bool $unique Whether the action should be unique. It will not be scheduled if another pending or running action has the same hook and group parameters.
|
||||
* @param int $priority Lower values take precedence over higher values. Defaults to 10, with acceptable values falling in the range 0-255.
|
||||
*
|
||||
* @return int The action ID. Zero if there was an error scheduling the action.
|
||||
|
||||
+19
-5
@@ -1,10 +1,10 @@
|
||||
=== Action Scheduler ===
|
||||
Contributors: Automattic, wpmuguru, claudiosanches, peterfabian1000, vedjain, jamosova, obliviousharmony, konamiman, sadowski, royho, barryhughes-1
|
||||
Tags: scheduler, cron
|
||||
Stable tag: 3.7.1
|
||||
Stable tag: 3.7.4
|
||||
License: GPLv3
|
||||
Requires at least: 6.2
|
||||
Tested up to: 6.4
|
||||
Tested up to: 6.5
|
||||
Requires PHP: 5.6
|
||||
|
||||
Action Scheduler - Job Queue for WordPress
|
||||
@@ -47,16 +47,30 @@ Collaboration is cool. We'd love to work with you to improve Action Scheduler. [
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 3.7.1 - 2023-12-13 =
|
||||
* Release/3.7.0.
|
||||
= 3.7.4 - 2024-04-05 =
|
||||
* Give a clear description of how the $unique parameter works.
|
||||
* Merge release/3.7.3 into trunk.
|
||||
* Preserve the tab field if set.
|
||||
* Tweak - WP 6.5 compatibility.
|
||||
|
||||
= 3.7.3 - 2024-03-20 =
|
||||
* Do not iterate over all of GET when building form in list table.
|
||||
* Fix a few issues reported by PCP (Plugin Check Plugin).
|
||||
* Try to save actions as unique even when the store doesn't support it.
|
||||
* Tweak - WP 6.4 compatibility.
|
||||
* Update "Tested up to" tag to WordPress 6.5.
|
||||
* update version in package-lock.json.
|
||||
|
||||
= 3.7.2 - 2024-02-14 =
|
||||
* No longer user variables in `_n()` translation function.
|
||||
|
||||
= 3.7.1 - 2023-12-13 =
|
||||
* update semver to 5.7.2 because of a security vulnerability in 5.7.1.
|
||||
|
||||
= 3.7.0 - 2023-11-20 =
|
||||
* Important: starting with this release, Action Scheduler follows an L-2 version policy (WordPress, and consequently PHP).
|
||||
* Add extended indexes for hook_status_scheduled_date_gmt and status_sheduled_date_gmt.
|
||||
* Catch and log exceptions thrown when actions can't be created, e.g. under a corrupt database schema.
|
||||
* Release/3.6.4.
|
||||
* Tweak - WP 6.4 compatibility.
|
||||
* Update unit tests for upcoming dependency version policy.
|
||||
* make sure hook action_scheduler_failed_execution can access original exception object.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2011-2016 Jordi Boggiano
|
||||
Copyright (c) 2011-2020 Jordi Boggiano
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace WPMailSMTP\Vendor\Monolog\Attribute;
|
||||
|
||||
/**
|
||||
* A reusable attribute to help configure a class or a method as a processor.
|
||||
*
|
||||
* Using it offers no guarantee: it needs to be leveraged by a Monolog third-party consumer.
|
||||
*
|
||||
* Using it with the Monolog library only has no effect at all: processors should still be turned into a callable if
|
||||
* needed and manually pushed to the loggers and to the processable handlers.
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
|
||||
class AsMonologProcessor
|
||||
{
|
||||
/** @var string|null */
|
||||
public $channel = null;
|
||||
/** @var string|null */
|
||||
public $handler = null;
|
||||
/** @var string|null */
|
||||
public $method = null;
|
||||
/**
|
||||
* @param string|null $channel The logging channel the processor should be pushed to.
|
||||
* @param string|null $handler The handler the processor should be pushed to.
|
||||
* @param string|null $method The method that processes the records (if the attribute is used at the class level).
|
||||
*/
|
||||
public function __construct(?string $channel = null, ?string $handler = null, ?string $method = null)
|
||||
{
|
||||
$this->channel = $channel;
|
||||
$this->handler = $handler;
|
||||
$this->method = $method;
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace WPMailSMTP\Vendor\Monolog;
|
||||
|
||||
use DateTimeZone;
|
||||
/**
|
||||
* Overrides default json encoding of date time objects
|
||||
*
|
||||
* @author Menno Holtkamp
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*/
|
||||
class DateTimeImmutable extends \DateTimeImmutable implements \JsonSerializable
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $useMicroseconds;
|
||||
public function __construct(bool $useMicroseconds, ?\DateTimeZone $timezone = null)
|
||||
{
|
||||
$this->useMicroseconds = $useMicroseconds;
|
||||
// if you like to use a custom time to pass to Logger::addRecord directly,
|
||||
// call modify() or setTimestamp() on this instance to change the date after creating it
|
||||
parent::__construct('now', $timezone);
|
||||
}
|
||||
public function jsonSerialize() : string
|
||||
{
|
||||
if ($this->useMicroseconds) {
|
||||
return $this->format('Y-m-d\\TH:i:s.uP');
|
||||
}
|
||||
return $this->format('Y-m-d\\TH:i:sP');
|
||||
}
|
||||
public function __toString() : string
|
||||
{
|
||||
return $this->jsonSerialize();
|
||||
}
|
||||
}
|
||||
+117
-58
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -12,7 +13,6 @@ namespace WPMailSMTP\Vendor\Monolog;
|
||||
|
||||
use WPMailSMTP\Vendor\Psr\Log\LoggerInterface;
|
||||
use WPMailSMTP\Vendor\Psr\Log\LogLevel;
|
||||
use WPMailSMTP\Vendor\Monolog\Handler\AbstractHandler;
|
||||
/**
|
||||
* Monolog error handler
|
||||
*
|
||||
@@ -24,17 +24,28 @@ use WPMailSMTP\Vendor\Monolog\Handler\AbstractHandler;
|
||||
*/
|
||||
class ErrorHandler
|
||||
{
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
private $previousExceptionHandler;
|
||||
private $uncaughtExceptionLevel;
|
||||
private $previousErrorHandler;
|
||||
private $errorLevelMap;
|
||||
private $handleOnlyReportedErrors;
|
||||
private $hasFatalErrorHandler;
|
||||
private $fatalLevel;
|
||||
private $reservedMemory;
|
||||
private $lastFatalTrace;
|
||||
private static $fatalErrors = array(\E_ERROR, \E_PARSE, \E_CORE_ERROR, \E_COMPILE_ERROR, \E_USER_ERROR);
|
||||
/** @var ?callable */
|
||||
private $previousExceptionHandler = null;
|
||||
/** @var array<class-string, LogLevel::*> an array of class name to LogLevel::* constant mapping */
|
||||
private $uncaughtExceptionLevelMap = [];
|
||||
/** @var callable|true|null */
|
||||
private $previousErrorHandler = null;
|
||||
/** @var array<int, LogLevel::*> an array of E_* constant to LogLevel::* constant mapping */
|
||||
private $errorLevelMap = [];
|
||||
/** @var bool */
|
||||
private $handleOnlyReportedErrors = \true;
|
||||
/** @var bool */
|
||||
private $hasFatalErrorHandler = \false;
|
||||
/** @var LogLevel::* */
|
||||
private $fatalLevel = \WPMailSMTP\Vendor\Psr\Log\LogLevel::ALERT;
|
||||
/** @var ?string */
|
||||
private $reservedMemory = null;
|
||||
/** @var ?array{type: int, message: string, file: string, line: int, trace: mixed} */
|
||||
private $lastFatalData = null;
|
||||
/** @var int[] */
|
||||
private static $fatalErrors = [\E_ERROR, \E_PARSE, \E_CORE_ERROR, \E_COMPILE_ERROR, \E_USER_ERROR];
|
||||
public function __construct(\WPMailSMTP\Vendor\Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
$this->logger = $logger;
|
||||
@@ -44,114 +55,162 @@ class ErrorHandler
|
||||
*
|
||||
* By default it will handle errors, exceptions and fatal errors
|
||||
*
|
||||
* @param LoggerInterface $logger
|
||||
* @param array|false $errorLevelMap an array of E_* constant to LogLevel::* constant mapping, or false to disable error handling
|
||||
* @param int|false $exceptionLevel a LogLevel::* constant, or false to disable exception handling
|
||||
* @param int|false $fatalLevel a LogLevel::* constant, or false to disable fatal error handling
|
||||
* @param LoggerInterface $logger
|
||||
* @param array<int, LogLevel::*>|false $errorLevelMap an array of E_* constant to LogLevel::* constant mapping, or false to disable error handling
|
||||
* @param array<class-string, LogLevel::*>|false $exceptionLevelMap an array of class name to LogLevel::* constant mapping, or false to disable exception handling
|
||||
* @param LogLevel::*|null|false $fatalLevel a LogLevel::* constant, null to use the default LogLevel::ALERT or false to disable fatal error handling
|
||||
* @return ErrorHandler
|
||||
*/
|
||||
public static function register(\WPMailSMTP\Vendor\Psr\Log\LoggerInterface $logger, $errorLevelMap = array(), $exceptionLevel = null, $fatalLevel = null)
|
||||
public static function register(\WPMailSMTP\Vendor\Psr\Log\LoggerInterface $logger, $errorLevelMap = [], $exceptionLevelMap = [], $fatalLevel = null) : self
|
||||
{
|
||||
//Forces the autoloader to run for LogLevel. Fixes an autoload issue at compile-time on PHP5.3. See https://github.com/Seldaek/monolog/pull/929
|
||||
\class_exists('WPMailSMTP\\Vendor\\Psr\\Log\\LogLevel', \true);
|
||||
/** @phpstan-ignore-next-line */
|
||||
$handler = new static($logger);
|
||||
if ($errorLevelMap !== \false) {
|
||||
$handler->registerErrorHandler($errorLevelMap);
|
||||
}
|
||||
if ($exceptionLevel !== \false) {
|
||||
$handler->registerExceptionHandler($exceptionLevel);
|
||||
if ($exceptionLevelMap !== \false) {
|
||||
$handler->registerExceptionHandler($exceptionLevelMap);
|
||||
}
|
||||
if ($fatalLevel !== \false) {
|
||||
$handler->registerFatalHandler($fatalLevel);
|
||||
}
|
||||
return $handler;
|
||||
}
|
||||
public function registerExceptionHandler($level = null, $callPrevious = \true)
|
||||
/**
|
||||
* @param array<class-string, LogLevel::*> $levelMap an array of class name to LogLevel::* constant mapping
|
||||
* @return $this
|
||||
*/
|
||||
public function registerExceptionHandler(array $levelMap = [], bool $callPrevious = \true) : self
|
||||
{
|
||||
$prev = \set_exception_handler(array($this, 'handleException'));
|
||||
$this->uncaughtExceptionLevel = $level;
|
||||
$prev = \set_exception_handler(function (\Throwable $e) : void {
|
||||
$this->handleException($e);
|
||||
});
|
||||
$this->uncaughtExceptionLevelMap = $levelMap;
|
||||
foreach ($this->defaultExceptionLevelMap() as $class => $level) {
|
||||
if (!isset($this->uncaughtExceptionLevelMap[$class])) {
|
||||
$this->uncaughtExceptionLevelMap[$class] = $level;
|
||||
}
|
||||
}
|
||||
if ($callPrevious && $prev) {
|
||||
$this->previousExceptionHandler = $prev;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
public function registerErrorHandler(array $levelMap = array(), $callPrevious = \true, $errorTypes = -1, $handleOnlyReportedErrors = \true)
|
||||
/**
|
||||
* @param array<int, LogLevel::*> $levelMap an array of E_* constant to LogLevel::* constant mapping
|
||||
* @return $this
|
||||
*/
|
||||
public function registerErrorHandler(array $levelMap = [], bool $callPrevious = \true, int $errorTypes = -1, bool $handleOnlyReportedErrors = \true) : self
|
||||
{
|
||||
$prev = \set_error_handler(array($this, 'handleError'), $errorTypes);
|
||||
$prev = \set_error_handler([$this, 'handleError'], $errorTypes);
|
||||
$this->errorLevelMap = \array_replace($this->defaultErrorLevelMap(), $levelMap);
|
||||
if ($callPrevious) {
|
||||
$this->previousErrorHandler = $prev ?: \true;
|
||||
} else {
|
||||
$this->previousErrorHandler = null;
|
||||
}
|
||||
$this->handleOnlyReportedErrors = $handleOnlyReportedErrors;
|
||||
}
|
||||
public function registerFatalHandler($level = null, $reservedMemorySize = 20)
|
||||
{
|
||||
\register_shutdown_function(array($this, 'handleFatalError'));
|
||||
$this->reservedMemory = \str_repeat(' ', 1024 * $reservedMemorySize);
|
||||
$this->fatalLevel = $level;
|
||||
$this->hasFatalErrorHandler = \true;
|
||||
}
|
||||
protected function defaultErrorLevelMap()
|
||||
{
|
||||
return array(\E_ERROR => \WPMailSMTP\Vendor\Psr\Log\LogLevel::CRITICAL, \E_WARNING => \WPMailSMTP\Vendor\Psr\Log\LogLevel::WARNING, \E_PARSE => \WPMailSMTP\Vendor\Psr\Log\LogLevel::ALERT, \E_NOTICE => \WPMailSMTP\Vendor\Psr\Log\LogLevel::NOTICE, \E_CORE_ERROR => \WPMailSMTP\Vendor\Psr\Log\LogLevel::CRITICAL, \E_CORE_WARNING => \WPMailSMTP\Vendor\Psr\Log\LogLevel::WARNING, \E_COMPILE_ERROR => \WPMailSMTP\Vendor\Psr\Log\LogLevel::ALERT, \E_COMPILE_WARNING => \WPMailSMTP\Vendor\Psr\Log\LogLevel::WARNING, \E_USER_ERROR => \WPMailSMTP\Vendor\Psr\Log\LogLevel::ERROR, \E_USER_WARNING => \WPMailSMTP\Vendor\Psr\Log\LogLevel::WARNING, \E_USER_NOTICE => \WPMailSMTP\Vendor\Psr\Log\LogLevel::NOTICE, \E_STRICT => \WPMailSMTP\Vendor\Psr\Log\LogLevel::NOTICE, \E_RECOVERABLE_ERROR => \WPMailSMTP\Vendor\Psr\Log\LogLevel::ERROR, \E_DEPRECATED => \WPMailSMTP\Vendor\Psr\Log\LogLevel::NOTICE, \E_USER_DEPRECATED => \WPMailSMTP\Vendor\Psr\Log\LogLevel::NOTICE);
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
* @param LogLevel::*|null $level a LogLevel::* constant, null to use the default LogLevel::ALERT
|
||||
* @param int $reservedMemorySize Amount of KBs to reserve in memory so that it can be freed when handling fatal errors giving Monolog some room in memory to get its job done
|
||||
*/
|
||||
public function handleException($e)
|
||||
public function registerFatalHandler($level = null, int $reservedMemorySize = 20) : self
|
||||
{
|
||||
$this->logger->log($this->uncaughtExceptionLevel === null ? \WPMailSMTP\Vendor\Psr\Log\LogLevel::ERROR : $this->uncaughtExceptionLevel, \sprintf('Uncaught Exception %s: "%s" at %s line %s', \WPMailSMTP\Vendor\Monolog\Utils::getClass($e), $e->getMessage(), $e->getFile(), $e->getLine()), array('exception' => $e));
|
||||
\register_shutdown_function([$this, 'handleFatalError']);
|
||||
$this->reservedMemory = \str_repeat(' ', 1024 * $reservedMemorySize);
|
||||
$this->fatalLevel = null === $level ? \WPMailSMTP\Vendor\Psr\Log\LogLevel::ALERT : $level;
|
||||
$this->hasFatalErrorHandler = \true;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @return array<class-string, LogLevel::*>
|
||||
*/
|
||||
protected function defaultExceptionLevelMap() : array
|
||||
{
|
||||
return ['ParseError' => \WPMailSMTP\Vendor\Psr\Log\LogLevel::CRITICAL, 'Throwable' => \WPMailSMTP\Vendor\Psr\Log\LogLevel::ERROR];
|
||||
}
|
||||
/**
|
||||
* @return array<int, LogLevel::*>
|
||||
*/
|
||||
protected function defaultErrorLevelMap() : array
|
||||
{
|
||||
return [\E_ERROR => \WPMailSMTP\Vendor\Psr\Log\LogLevel::CRITICAL, \E_WARNING => \WPMailSMTP\Vendor\Psr\Log\LogLevel::WARNING, \E_PARSE => \WPMailSMTP\Vendor\Psr\Log\LogLevel::ALERT, \E_NOTICE => \WPMailSMTP\Vendor\Psr\Log\LogLevel::NOTICE, \E_CORE_ERROR => \WPMailSMTP\Vendor\Psr\Log\LogLevel::CRITICAL, \E_CORE_WARNING => \WPMailSMTP\Vendor\Psr\Log\LogLevel::WARNING, \E_COMPILE_ERROR => \WPMailSMTP\Vendor\Psr\Log\LogLevel::ALERT, \E_COMPILE_WARNING => \WPMailSMTP\Vendor\Psr\Log\LogLevel::WARNING, \E_USER_ERROR => \WPMailSMTP\Vendor\Psr\Log\LogLevel::ERROR, \E_USER_WARNING => \WPMailSMTP\Vendor\Psr\Log\LogLevel::WARNING, \E_USER_NOTICE => \WPMailSMTP\Vendor\Psr\Log\LogLevel::NOTICE, \E_STRICT => \WPMailSMTP\Vendor\Psr\Log\LogLevel::NOTICE, \E_RECOVERABLE_ERROR => \WPMailSMTP\Vendor\Psr\Log\LogLevel::ERROR, \E_DEPRECATED => \WPMailSMTP\Vendor\Psr\Log\LogLevel::NOTICE, \E_USER_DEPRECATED => \WPMailSMTP\Vendor\Psr\Log\LogLevel::NOTICE];
|
||||
}
|
||||
/**
|
||||
* @phpstan-return never
|
||||
*/
|
||||
private function handleException(\Throwable $e) : void
|
||||
{
|
||||
$level = \WPMailSMTP\Vendor\Psr\Log\LogLevel::ERROR;
|
||||
foreach ($this->uncaughtExceptionLevelMap as $class => $candidate) {
|
||||
if ($e instanceof $class) {
|
||||
$level = $candidate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->logger->log($level, \sprintf('Uncaught Exception %s: "%s" at %s line %s', \WPMailSMTP\Vendor\Monolog\Utils::getClass($e), $e->getMessage(), $e->getFile(), $e->getLine()), ['exception' => $e]);
|
||||
if ($this->previousExceptionHandler) {
|
||||
\call_user_func($this->previousExceptionHandler, $e);
|
||||
($this->previousExceptionHandler)($e);
|
||||
}
|
||||
if (!\headers_sent() && \in_array(\strtolower((string) \ini_get('display_errors')), ['0', '', 'false', 'off', 'none', 'no'], \true)) {
|
||||
\http_response_code(500);
|
||||
}
|
||||
exit(255);
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
*
|
||||
* @param mixed[] $context
|
||||
*/
|
||||
public function handleError($code, $message, $file = '', $line = 0, $context = array())
|
||||
public function handleError(int $code, string $message, string $file = '', int $line = 0, ?array $context = []) : bool
|
||||
{
|
||||
if ($this->handleOnlyReportedErrors && !(\error_reporting() & $code)) {
|
||||
return;
|
||||
return \false;
|
||||
}
|
||||
// fatal error codes are ignored if a fatal error handler is present as well to avoid duplicate log entries
|
||||
if (!$this->hasFatalErrorHandler || !\in_array($code, self::$fatalErrors, \true)) {
|
||||
$level = isset($this->errorLevelMap[$code]) ? $this->errorLevelMap[$code] : \WPMailSMTP\Vendor\Psr\Log\LogLevel::CRITICAL;
|
||||
$this->logger->log($level, self::codeToString($code) . ': ' . $message, array('code' => $code, 'message' => $message, 'file' => $file, 'line' => $line));
|
||||
$level = $this->errorLevelMap[$code] ?? \WPMailSMTP\Vendor\Psr\Log\LogLevel::CRITICAL;
|
||||
$this->logger->log($level, self::codeToString($code) . ': ' . $message, ['code' => $code, 'message' => $message, 'file' => $file, 'line' => $line]);
|
||||
} else {
|
||||
// http://php.net/manual/en/function.debug-backtrace.php
|
||||
// As of 5.3.6, DEBUG_BACKTRACE_IGNORE_ARGS option was added.
|
||||
// Any version less than 5.3.6 must use the DEBUG_BACKTRACE_IGNORE_ARGS constant value '2'.
|
||||
$trace = \debug_backtrace(\PHP_VERSION_ID < 50306 ? 2 : \DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
$trace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
\array_shift($trace);
|
||||
// Exclude handleError from trace
|
||||
$this->lastFatalTrace = $trace;
|
||||
$this->lastFatalData = ['type' => $code, 'message' => $message, 'file' => $file, 'line' => $line, 'trace' => $trace];
|
||||
}
|
||||
if ($this->previousErrorHandler === \true) {
|
||||
return \false;
|
||||
} elseif ($this->previousErrorHandler) {
|
||||
return \call_user_func($this->previousErrorHandler, $code, $message, $file, $line, $context);
|
||||
return (bool) ($this->previousErrorHandler)($code, $message, $file, $line, $context);
|
||||
}
|
||||
return \true;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
public function handleFatalError()
|
||||
public function handleFatalError() : void
|
||||
{
|
||||
$this->reservedMemory = null;
|
||||
$lastError = \error_get_last();
|
||||
$this->reservedMemory = '';
|
||||
if (\is_array($this->lastFatalData)) {
|
||||
$lastError = $this->lastFatalData;
|
||||
} else {
|
||||
$lastError = \error_get_last();
|
||||
}
|
||||
if ($lastError && \in_array($lastError['type'], self::$fatalErrors, \true)) {
|
||||
$this->logger->log($this->fatalLevel === null ? \WPMailSMTP\Vendor\Psr\Log\LogLevel::ALERT : $this->fatalLevel, 'Fatal Error (' . self::codeToString($lastError['type']) . '): ' . $lastError['message'], array('code' => $lastError['type'], 'message' => $lastError['message'], 'file' => $lastError['file'], 'line' => $lastError['line'], 'trace' => $this->lastFatalTrace));
|
||||
$trace = $lastError['trace'] ?? null;
|
||||
$this->logger->log($this->fatalLevel, 'Fatal Error (' . self::codeToString($lastError['type']) . '): ' . $lastError['message'], ['code' => $lastError['type'], 'message' => $lastError['message'], 'file' => $lastError['file'], 'line' => $lastError['line'], 'trace' => $trace]);
|
||||
if ($this->logger instanceof \WPMailSMTP\Vendor\Monolog\Logger) {
|
||||
foreach ($this->logger->getHandlers() as $handler) {
|
||||
if ($handler instanceof \WPMailSMTP\Vendor\Monolog\Handler\AbstractHandler) {
|
||||
$handler->close();
|
||||
}
|
||||
$handler->close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private static function codeToString($code)
|
||||
/**
|
||||
* @param int $code
|
||||
*/
|
||||
private static function codeToString($code) : string
|
||||
{
|
||||
switch ($code) {
|
||||
case \E_ERROR:
|
||||
|
||||
+11
-5
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -20,10 +21,12 @@ class ChromePHPFormatter implements \WPMailSMTP\Vendor\Monolog\Formatter\Formatt
|
||||
{
|
||||
/**
|
||||
* Translates Monolog log levels to Wildfire levels.
|
||||
*
|
||||
* @var array<int, 'log'|'info'|'warn'|'error'>
|
||||
*/
|
||||
private $logLevels = array(\WPMailSMTP\Vendor\Monolog\Logger::DEBUG => 'log', \WPMailSMTP\Vendor\Monolog\Logger::INFO => 'info', \WPMailSMTP\Vendor\Monolog\Logger::NOTICE => 'info', \WPMailSMTP\Vendor\Monolog\Logger::WARNING => 'warn', \WPMailSMTP\Vendor\Monolog\Logger::ERROR => 'error', \WPMailSMTP\Vendor\Monolog\Logger::CRITICAL => 'error', \WPMailSMTP\Vendor\Monolog\Logger::ALERT => 'error', \WPMailSMTP\Vendor\Monolog\Logger::EMERGENCY => 'error');
|
||||
private $logLevels = [\WPMailSMTP\Vendor\Monolog\Logger::DEBUG => 'log', \WPMailSMTP\Vendor\Monolog\Logger::INFO => 'info', \WPMailSMTP\Vendor\Monolog\Logger::NOTICE => 'info', \WPMailSMTP\Vendor\Monolog\Logger::WARNING => 'warn', \WPMailSMTP\Vendor\Monolog\Logger::ERROR => 'error', \WPMailSMTP\Vendor\Monolog\Logger::CRITICAL => 'error', \WPMailSMTP\Vendor\Monolog\Logger::ALERT => 'error', \WPMailSMTP\Vendor\Monolog\Logger::EMERGENCY => 'error'];
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function format(array $record)
|
||||
{
|
||||
@@ -33,7 +36,7 @@ class ChromePHPFormatter implements \WPMailSMTP\Vendor\Monolog\Formatter\Formatt
|
||||
$backtrace = $record['extra']['file'] . ' : ' . $record['extra']['line'];
|
||||
unset($record['extra']['file'], $record['extra']['line']);
|
||||
}
|
||||
$message = array('message' => $record['message']);
|
||||
$message = ['message' => $record['message']];
|
||||
if ($record['context']) {
|
||||
$message['context'] = $record['context'];
|
||||
}
|
||||
@@ -43,11 +46,14 @@ class ChromePHPFormatter implements \WPMailSMTP\Vendor\Monolog\Formatter\Formatt
|
||||
if (\count($message) === 1) {
|
||||
$message = \reset($message);
|
||||
}
|
||||
return array($record['channel'], $message, $backtrace, $this->logLevels[$record['level']]);
|
||||
return [$record['channel'], $message, $backtrace, $this->logLevels[$record['level']]];
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function formatBatch(array $records)
|
||||
{
|
||||
$formatted = array();
|
||||
$formatted = [];
|
||||
foreach ($records as $record) {
|
||||
$formatted[] = $this->format($record);
|
||||
}
|
||||
|
||||
+18
-17
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -15,6 +16,8 @@ use WPMailSMTP\Vendor\Elastica\Document;
|
||||
* Format a log message into an Elastica Document
|
||||
*
|
||||
* @author Jelle Vink <jelle.vink@gmail.com>
|
||||
*
|
||||
* @phpstan-import-type Record from \Monolog\Logger
|
||||
*/
|
||||
class ElasticaFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerFormatter
|
||||
{
|
||||
@@ -23,14 +26,14 @@ class ElasticaFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerF
|
||||
*/
|
||||
protected $index;
|
||||
/**
|
||||
* @var string Elastic search document type
|
||||
* @var ?string Elastic search document type
|
||||
*/
|
||||
protected $type;
|
||||
/**
|
||||
* @param string $index Elastic Search index name
|
||||
* @param string $type Elastic Search document type
|
||||
* @param string $index Elastic Search index name
|
||||
* @param ?string $type Elastic Search document type, deprecated as of Elastica 7
|
||||
*/
|
||||
public function __construct($index, $type)
|
||||
public function __construct(string $index, ?string $type)
|
||||
{
|
||||
// elasticsearch requires a ISO 8601 format date with optional millisecond precision.
|
||||
parent::__construct('Y-m-d\\TH:i:s.uP');
|
||||
@@ -38,40 +41,38 @@ class ElasticaFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerF
|
||||
$this->type = $type;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function format(array $record)
|
||||
{
|
||||
$record = parent::format($record);
|
||||
return $this->getDocument($record);
|
||||
}
|
||||
/**
|
||||
* Getter index
|
||||
* @return string
|
||||
*/
|
||||
public function getIndex()
|
||||
public function getIndex() : string
|
||||
{
|
||||
return $this->index;
|
||||
}
|
||||
/**
|
||||
* Getter type
|
||||
* @return string
|
||||
* @deprecated since Elastica 7 type has no effect
|
||||
*/
|
||||
public function getType()
|
||||
public function getType() : string
|
||||
{
|
||||
/** @phpstan-ignore-next-line */
|
||||
return $this->type;
|
||||
}
|
||||
/**
|
||||
* Convert a log message into an Elastica Document
|
||||
*
|
||||
* @param array $record Log message
|
||||
* @return Document
|
||||
* @phpstan-param Record $record
|
||||
*/
|
||||
protected function getDocument($record)
|
||||
protected function getDocument(array $record) : \WPMailSMTP\Vendor\Elastica\Document
|
||||
{
|
||||
$document = new \WPMailSMTP\Vendor\Elastica\Document();
|
||||
$document->setData($record);
|
||||
$document->setType($this->type);
|
||||
if (\method_exists($document, 'setType')) {
|
||||
/** @phpstan-ignore-next-line */
|
||||
$document->setType($this->type);
|
||||
}
|
||||
$document->setIndex($this->index);
|
||||
return $document;
|
||||
}
|
||||
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace WPMailSMTP\Vendor\Monolog\Formatter;
|
||||
|
||||
use DateTimeInterface;
|
||||
/**
|
||||
* Format a log message into an Elasticsearch record
|
||||
*
|
||||
* @author Avtandil Kikabidze <akalongman@gmail.com>
|
||||
*/
|
||||
class ElasticsearchFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerFormatter
|
||||
{
|
||||
/**
|
||||
* @var string Elasticsearch index name
|
||||
*/
|
||||
protected $index;
|
||||
/**
|
||||
* @var string Elasticsearch record type
|
||||
*/
|
||||
protected $type;
|
||||
/**
|
||||
* @param string $index Elasticsearch index name
|
||||
* @param string $type Elasticsearch record type
|
||||
*/
|
||||
public function __construct(string $index, string $type)
|
||||
{
|
||||
// Elasticsearch requires an ISO 8601 format date with optional millisecond precision.
|
||||
parent::__construct(\DateTimeInterface::ISO8601);
|
||||
$this->index = $index;
|
||||
$this->type = $type;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function format(array $record)
|
||||
{
|
||||
$record = parent::format($record);
|
||||
return $this->getDocument($record);
|
||||
}
|
||||
/**
|
||||
* Getter index
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIndex() : string
|
||||
{
|
||||
return $this->index;
|
||||
}
|
||||
/**
|
||||
* Getter type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType() : string
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
/**
|
||||
* Convert a log message into an Elasticsearch record
|
||||
*
|
||||
* @param mixed[] $record Log message
|
||||
* @return mixed[]
|
||||
*/
|
||||
protected function getDocument(array $record) : array
|
||||
{
|
||||
$record['_index'] = $this->index;
|
||||
$record['_type'] = $this->type;
|
||||
return $record;
|
||||
}
|
||||
}
|
||||
+15
-18
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -14,6 +15,7 @@ namespace WPMailSMTP\Vendor\Monolog\Formatter;
|
||||
* formats the record to be used in the FlowdockHandler
|
||||
*
|
||||
* @author Dominik Liebler <liebler.dominik@gmail.com>
|
||||
* @deprecated Since 2.9.0 and 3.3.0, Flowdock was shutdown we will thus drop this handler in Monolog 4
|
||||
*/
|
||||
class FlowdockFormatter implements \WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface
|
||||
{
|
||||
@@ -25,45 +27,40 @@ class FlowdockFormatter implements \WPMailSMTP\Vendor\Monolog\Formatter\Formatte
|
||||
* @var string
|
||||
*/
|
||||
private $sourceEmail;
|
||||
/**
|
||||
* @param string $source
|
||||
* @param string $sourceEmail
|
||||
*/
|
||||
public function __construct($source, $sourceEmail)
|
||||
public function __construct(string $source, string $sourceEmail)
|
||||
{
|
||||
$this->source = $source;
|
||||
$this->sourceEmail = $sourceEmail;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @return mixed[]
|
||||
*/
|
||||
public function format(array $record)
|
||||
public function format(array $record) : array
|
||||
{
|
||||
$tags = array('#logs', '#' . \strtolower($record['level_name']), '#' . $record['channel']);
|
||||
$tags = ['#logs', '#' . \strtolower($record['level_name']), '#' . $record['channel']];
|
||||
foreach ($record['extra'] as $value) {
|
||||
$tags[] = '#' . $value;
|
||||
}
|
||||
$subject = \sprintf('in %s: %s - %s', $this->source, $record['level_name'], $this->getShortMessage($record['message']));
|
||||
$record['flowdock'] = array('source' => $this->source, 'from_address' => $this->sourceEmail, 'subject' => $subject, 'content' => $record['message'], 'tags' => $tags, 'project' => $this->source);
|
||||
$record['flowdock'] = ['source' => $this->source, 'from_address' => $this->sourceEmail, 'subject' => $subject, 'content' => $record['message'], 'tags' => $tags, 'project' => $this->source];
|
||||
return $record;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @return mixed[][]
|
||||
*/
|
||||
public function formatBatch(array $records)
|
||||
public function formatBatch(array $records) : array
|
||||
{
|
||||
$formatted = array();
|
||||
$formatted = [];
|
||||
foreach ($records as $record) {
|
||||
$formatted[] = $this->format($record);
|
||||
}
|
||||
return $formatted;
|
||||
}
|
||||
/**
|
||||
* @param string $message
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getShortMessage($message)
|
||||
public function getShortMessage(string $message) : string
|
||||
{
|
||||
static $hasMbString;
|
||||
if (null === $hasMbString) {
|
||||
|
||||
+8
-7
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -38,31 +39,31 @@ class FluentdFormatter implements \WPMailSMTP\Vendor\Monolog\Formatter\Formatter
|
||||
* @var bool $levelTag should message level be a part of the fluentd tag
|
||||
*/
|
||||
protected $levelTag = \false;
|
||||
public function __construct($levelTag = \false)
|
||||
public function __construct(bool $levelTag = \false)
|
||||
{
|
||||
if (!\function_exists('json_encode')) {
|
||||
throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s FluentdUnixFormatter');
|
||||
}
|
||||
$this->levelTag = (bool) $levelTag;
|
||||
$this->levelTag = $levelTag;
|
||||
}
|
||||
public function isUsingLevelsInTag()
|
||||
public function isUsingLevelsInTag() : bool
|
||||
{
|
||||
return $this->levelTag;
|
||||
}
|
||||
public function format(array $record)
|
||||
public function format(array $record) : string
|
||||
{
|
||||
$tag = $record['channel'];
|
||||
if ($this->levelTag) {
|
||||
$tag .= '.' . \strtolower($record['level_name']);
|
||||
}
|
||||
$message = array('message' => $record['message'], 'context' => $record['context'], 'extra' => $record['extra']);
|
||||
$message = ['message' => $record['message'], 'context' => $record['context'], 'extra' => $record['extra']];
|
||||
if (!$this->levelTag) {
|
||||
$message['level'] = $record['level'];
|
||||
$message['level_name'] = $record['level_name'];
|
||||
}
|
||||
return \WPMailSMTP\Vendor\Monolog\Utils::jsonEncode(array($tag, $record['datetime']->getTimestamp(), $message));
|
||||
return \WPMailSMTP\Vendor\Monolog\Utils::jsonEncode([$tag, $record['datetime']->getTimestamp(), $message]);
|
||||
}
|
||||
public function formatBatch(array $records)
|
||||
public function formatBatch(array $records) : string
|
||||
{
|
||||
$message = '';
|
||||
foreach ($records as $record) {
|
||||
|
||||
+7
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -14,6 +15,8 @@ namespace WPMailSMTP\Vendor\Monolog\Formatter;
|
||||
* Interface for formatters
|
||||
*
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* @phpstan-import-type Record from \Monolog\Logger
|
||||
*/
|
||||
interface FormatterInterface
|
||||
{
|
||||
@@ -22,6 +25,8 @@ interface FormatterInterface
|
||||
*
|
||||
* @param array $record A record to format
|
||||
* @return mixed The formatted record
|
||||
*
|
||||
* @phpstan-param Record $record
|
||||
*/
|
||||
public function format(array $record);
|
||||
/**
|
||||
@@ -29,6 +34,8 @@ interface FormatterInterface
|
||||
*
|
||||
* @param array $records A set of records to format
|
||||
* @return mixed The formatted set of records
|
||||
*
|
||||
* @phpstan-param Record[] $records
|
||||
*/
|
||||
public function formatBatch(array $records);
|
||||
}
|
||||
|
||||
+64
-31
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -12,15 +13,18 @@ namespace WPMailSMTP\Vendor\Monolog\Formatter;
|
||||
|
||||
use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
use WPMailSMTP\Vendor\Gelf\Message;
|
||||
use WPMailSMTP\Vendor\Monolog\Utils;
|
||||
/**
|
||||
* Serializes a log message to GELF
|
||||
* @see http://www.graylog2.org/about/gelf
|
||||
* @see http://docs.graylog.org/en/latest/pages/gelf.html
|
||||
*
|
||||
* @author Matt Lehner <mlehner@gmail.com>
|
||||
*
|
||||
* @phpstan-import-type Level from \Monolog\Logger
|
||||
*/
|
||||
class GelfMessageFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerFormatter
|
||||
{
|
||||
const DEFAULT_MAX_LENGTH = 32766;
|
||||
protected const DEFAULT_MAX_LENGTH = 32766;
|
||||
/**
|
||||
* @var string the name of the system for the Gelf log message
|
||||
*/
|
||||
@@ -38,23 +42,45 @@ class GelfMessageFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\Normaliz
|
||||
*/
|
||||
protected $maxLength;
|
||||
/**
|
||||
* Translates Monolog log levels to Graylog2 log priorities.
|
||||
* @var int
|
||||
*/
|
||||
private $logLevels = array(\WPMailSMTP\Vendor\Monolog\Logger::DEBUG => 7, \WPMailSMTP\Vendor\Monolog\Logger::INFO => 6, \WPMailSMTP\Vendor\Monolog\Logger::NOTICE => 5, \WPMailSMTP\Vendor\Monolog\Logger::WARNING => 4, \WPMailSMTP\Vendor\Monolog\Logger::ERROR => 3, \WPMailSMTP\Vendor\Monolog\Logger::CRITICAL => 2, \WPMailSMTP\Vendor\Monolog\Logger::ALERT => 1, \WPMailSMTP\Vendor\Monolog\Logger::EMERGENCY => 0);
|
||||
public function __construct($systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_', $maxLength = null)
|
||||
private $gelfVersion = 2;
|
||||
/**
|
||||
* Translates Monolog log levels to Graylog2 log priorities.
|
||||
*
|
||||
* @var array<int, int>
|
||||
*
|
||||
* @phpstan-var array<Level, int>
|
||||
*/
|
||||
private $logLevels = [\WPMailSMTP\Vendor\Monolog\Logger::DEBUG => 7, \WPMailSMTP\Vendor\Monolog\Logger::INFO => 6, \WPMailSMTP\Vendor\Monolog\Logger::NOTICE => 5, \WPMailSMTP\Vendor\Monolog\Logger::WARNING => 4, \WPMailSMTP\Vendor\Monolog\Logger::ERROR => 3, \WPMailSMTP\Vendor\Monolog\Logger::CRITICAL => 2, \WPMailSMTP\Vendor\Monolog\Logger::ALERT => 1, \WPMailSMTP\Vendor\Monolog\Logger::EMERGENCY => 0];
|
||||
public function __construct(?string $systemName = null, ?string $extraPrefix = null, string $contextPrefix = 'ctxt_', ?int $maxLength = null)
|
||||
{
|
||||
if (!\class_exists(\WPMailSMTP\Vendor\Gelf\Message::class)) {
|
||||
throw new \RuntimeException('Composer package graylog2/gelf-php is required to use Monolog\'s GelfMessageFormatter');
|
||||
}
|
||||
parent::__construct('U.u');
|
||||
$this->systemName = $systemName ?: \gethostname();
|
||||
$this->extraPrefix = $extraPrefix;
|
||||
$this->systemName = \is_null($systemName) || $systemName === '' ? (string) \gethostname() : $systemName;
|
||||
$this->extraPrefix = \is_null($extraPrefix) ? '' : $extraPrefix;
|
||||
$this->contextPrefix = $contextPrefix;
|
||||
$this->maxLength = \is_null($maxLength) ? self::DEFAULT_MAX_LENGTH : $maxLength;
|
||||
if (\method_exists(\WPMailSMTP\Vendor\Gelf\Message::class, 'setFacility')) {
|
||||
$this->gelfVersion = 1;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function format(array $record)
|
||||
public function format(array $record) : \WPMailSMTP\Vendor\Gelf\Message
|
||||
{
|
||||
$record = parent::format($record);
|
||||
$context = $extra = [];
|
||||
if (isset($record['context'])) {
|
||||
/** @var mixed[] $context */
|
||||
$context = parent::normalize($record['context']);
|
||||
}
|
||||
if (isset($record['extra'])) {
|
||||
/** @var mixed[] $extra */
|
||||
$extra = parent::normalize($record['extra']);
|
||||
}
|
||||
if (!isset($record['datetime'], $record['message'], $record['level'])) {
|
||||
throw new \InvalidArgumentException('The record should at least contain datetime, message and level keys, ' . \var_export($record, \true) . ' given');
|
||||
}
|
||||
@@ -63,41 +89,48 @@ class GelfMessageFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\Normaliz
|
||||
// message length + system name length + 200 for padding / metadata
|
||||
$len = 200 + \strlen((string) $record['message']) + \strlen($this->systemName);
|
||||
if ($len > $this->maxLength) {
|
||||
$message->setShortMessage(\substr($record['message'], 0, $this->maxLength));
|
||||
$message->setShortMessage(\WPMailSMTP\Vendor\Monolog\Utils::substr($record['message'], 0, $this->maxLength));
|
||||
}
|
||||
if (isset($record['channel'])) {
|
||||
$message->setFacility($record['channel']);
|
||||
if ($this->gelfVersion === 1) {
|
||||
if (isset($record['channel'])) {
|
||||
$message->setFacility($record['channel']);
|
||||
}
|
||||
if (isset($extra['line'])) {
|
||||
$message->setLine($extra['line']);
|
||||
unset($extra['line']);
|
||||
}
|
||||
if (isset($extra['file'])) {
|
||||
$message->setFile($extra['file']);
|
||||
unset($extra['file']);
|
||||
}
|
||||
} else {
|
||||
$message->setAdditional('facility', $record['channel']);
|
||||
}
|
||||
if (isset($record['extra']['line'])) {
|
||||
$message->setLine($record['extra']['line']);
|
||||
unset($record['extra']['line']);
|
||||
}
|
||||
if (isset($record['extra']['file'])) {
|
||||
$message->setFile($record['extra']['file']);
|
||||
unset($record['extra']['file']);
|
||||
}
|
||||
foreach ($record['extra'] as $key => $val) {
|
||||
foreach ($extra as $key => $val) {
|
||||
$val = \is_scalar($val) || null === $val ? $val : $this->toJson($val);
|
||||
$len = \strlen($this->extraPrefix . $key . $val);
|
||||
if ($len > $this->maxLength) {
|
||||
$message->setAdditional($this->extraPrefix . $key, \substr($val, 0, $this->maxLength));
|
||||
break;
|
||||
$message->setAdditional($this->extraPrefix . $key, \WPMailSMTP\Vendor\Monolog\Utils::substr((string) $val, 0, $this->maxLength));
|
||||
continue;
|
||||
}
|
||||
$message->setAdditional($this->extraPrefix . $key, $val);
|
||||
}
|
||||
foreach ($record['context'] as $key => $val) {
|
||||
foreach ($context as $key => $val) {
|
||||
$val = \is_scalar($val) || null === $val ? $val : $this->toJson($val);
|
||||
$len = \strlen($this->contextPrefix . $key . $val);
|
||||
if ($len > $this->maxLength) {
|
||||
$message->setAdditional($this->contextPrefix . $key, \substr($val, 0, $this->maxLength));
|
||||
break;
|
||||
$message->setAdditional($this->contextPrefix . $key, \WPMailSMTP\Vendor\Monolog\Utils::substr((string) $val, 0, $this->maxLength));
|
||||
continue;
|
||||
}
|
||||
$message->setAdditional($this->contextPrefix . $key, $val);
|
||||
}
|
||||
if (null === $message->getFile() && isset($record['context']['exception']['file'])) {
|
||||
if (\preg_match("/^(.+):([0-9]+)\$/", $record['context']['exception']['file'], $matches)) {
|
||||
$message->setFile($matches[1]);
|
||||
$message->setLine($matches[2]);
|
||||
if ($this->gelfVersion === 1) {
|
||||
/** @phpstan-ignore-next-line */
|
||||
if (null === $message->getFile() && isset($context['exception']['file'])) {
|
||||
if (\preg_match("/^(.+):([0-9]+)\$/", $context['exception']['file'], $matches)) {
|
||||
$message->setFile($matches[1]);
|
||||
$message->setLine($matches[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $message;
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace WPMailSMTP\Vendor\Monolog\Formatter;
|
||||
|
||||
use DateTimeInterface;
|
||||
use WPMailSMTP\Vendor\Monolog\LogRecord;
|
||||
/**
|
||||
* Encodes message information into JSON in a format compatible with Cloud logging.
|
||||
*
|
||||
* @see https://cloud.google.com/logging/docs/structured-logging
|
||||
* @see https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry
|
||||
*
|
||||
* @author Luís Cobucci <lcobucci@gmail.com>
|
||||
*/
|
||||
final class GoogleCloudLoggingFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\JsonFormatter
|
||||
{
|
||||
/** {@inheritdoc} **/
|
||||
public function format(array $record) : string
|
||||
{
|
||||
// Re-key level for GCP logging
|
||||
$record['severity'] = $record['level_name'];
|
||||
$record['time'] = $record['datetime']->format(\DateTimeInterface::RFC3339_EXTENDED);
|
||||
// Remove keys that are not used by GCP
|
||||
unset($record['level'], $record['level_name'], $record['datetime']);
|
||||
return parent::format($record);
|
||||
}
|
||||
}
|
||||
+23
-23
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -23,24 +24,25 @@ class HtmlFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerForma
|
||||
{
|
||||
/**
|
||||
* Translates Monolog log levels to html color priorities.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $logLevels = array(\WPMailSMTP\Vendor\Monolog\Logger::DEBUG => '#cccccc', \WPMailSMTP\Vendor\Monolog\Logger::INFO => '#468847', \WPMailSMTP\Vendor\Monolog\Logger::NOTICE => '#3a87ad', \WPMailSMTP\Vendor\Monolog\Logger::WARNING => '#c09853', \WPMailSMTP\Vendor\Monolog\Logger::ERROR => '#f0ad4e', \WPMailSMTP\Vendor\Monolog\Logger::CRITICAL => '#FF7708', \WPMailSMTP\Vendor\Monolog\Logger::ALERT => '#C12A19', \WPMailSMTP\Vendor\Monolog\Logger::EMERGENCY => '#000000');
|
||||
protected $logLevels = [\WPMailSMTP\Vendor\Monolog\Logger::DEBUG => '#CCCCCC', \WPMailSMTP\Vendor\Monolog\Logger::INFO => '#28A745', \WPMailSMTP\Vendor\Monolog\Logger::NOTICE => '#17A2B8', \WPMailSMTP\Vendor\Monolog\Logger::WARNING => '#FFC107', \WPMailSMTP\Vendor\Monolog\Logger::ERROR => '#FD7E14', \WPMailSMTP\Vendor\Monolog\Logger::CRITICAL => '#DC3545', \WPMailSMTP\Vendor\Monolog\Logger::ALERT => '#821722', \WPMailSMTP\Vendor\Monolog\Logger::EMERGENCY => '#000000'];
|
||||
/**
|
||||
* @param string $dateFormat The format of the timestamp: one supported by DateTime::format
|
||||
* @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format
|
||||
*/
|
||||
public function __construct($dateFormat = null)
|
||||
public function __construct(?string $dateFormat = null)
|
||||
{
|
||||
parent::__construct($dateFormat);
|
||||
}
|
||||
/**
|
||||
* Creates an HTML table row
|
||||
*
|
||||
* @param string $th Row header content
|
||||
* @param string $td Row standard cell content
|
||||
* @param bool $escapeTd false if td content must not be html escaped
|
||||
* @return string
|
||||
* @param string $th Row header content
|
||||
* @param string $td Row standard cell content
|
||||
* @param bool $escapeTd false if td content must not be html escaped
|
||||
*/
|
||||
protected function addRow($th, $td = ' ', $escapeTd = \true)
|
||||
protected function addRow(string $th, string $td = ' ', bool $escapeTd = \true) : string
|
||||
{
|
||||
$th = \htmlspecialchars($th, \ENT_NOQUOTES, 'UTF-8');
|
||||
if ($escapeTd) {
|
||||
@@ -55,7 +57,7 @@ class HtmlFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerForma
|
||||
* @param int $level Error level
|
||||
* @return string
|
||||
*/
|
||||
protected function addTitle($title, $level)
|
||||
protected function addTitle(string $title, int $level) : string
|
||||
{
|
||||
$title = \htmlspecialchars($title, \ENT_NOQUOTES, 'UTF-8');
|
||||
return '<h1 style="background: ' . $this->logLevels[$level] . ';color: #ffffff;padding: 5px;" class="monolog-output">' . $title . '</h1>';
|
||||
@@ -63,20 +65,19 @@ class HtmlFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerForma
|
||||
/**
|
||||
* Formats a log record.
|
||||
*
|
||||
* @param array $record A record to format
|
||||
* @return mixed The formatted record
|
||||
* @return string The formatted record
|
||||
*/
|
||||
public function format(array $record)
|
||||
public function format(array $record) : string
|
||||
{
|
||||
$output = $this->addTitle($record['level_name'], $record['level']);
|
||||
$output .= '<table cellspacing="1" width="100%" class="monolog-output">';
|
||||
$output .= $this->addRow('Message', (string) $record['message']);
|
||||
$output .= $this->addRow('Time', $record['datetime']->format($this->dateFormat));
|
||||
$output .= $this->addRow('Time', $this->formatDate($record['datetime']));
|
||||
$output .= $this->addRow('Channel', $record['channel']);
|
||||
if ($record['context']) {
|
||||
$embeddedTable = '<table cellspacing="1" width="100%">';
|
||||
foreach ($record['context'] as $key => $value) {
|
||||
$embeddedTable .= $this->addRow($key, $this->convertToString($value));
|
||||
$embeddedTable .= $this->addRow((string) $key, $this->convertToString($value));
|
||||
}
|
||||
$embeddedTable .= '</table>';
|
||||
$output .= $this->addRow('Context', $embeddedTable, \false);
|
||||
@@ -84,7 +85,7 @@ class HtmlFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerForma
|
||||
if ($record['extra']) {
|
||||
$embeddedTable = '<table cellspacing="1" width="100%">';
|
||||
foreach ($record['extra'] as $key => $value) {
|
||||
$embeddedTable .= $this->addRow($key, $this->convertToString($value));
|
||||
$embeddedTable .= $this->addRow((string) $key, $this->convertToString($value));
|
||||
}
|
||||
$embeddedTable .= '</table>';
|
||||
$output .= $this->addRow('Extra', $embeddedTable, \false);
|
||||
@@ -94,10 +95,9 @@ class HtmlFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerForma
|
||||
/**
|
||||
* Formats a set of log records.
|
||||
*
|
||||
* @param array $records A set of records to format
|
||||
* @return mixed The formatted set of records
|
||||
* @return string The formatted set of records
|
||||
*/
|
||||
public function formatBatch(array $records)
|
||||
public function formatBatch(array $records) : string
|
||||
{
|
||||
$message = '';
|
||||
foreach ($records as $record) {
|
||||
@@ -105,15 +105,15 @@ class HtmlFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerForma
|
||||
}
|
||||
return $message;
|
||||
}
|
||||
protected function convertToString($data)
|
||||
/**
|
||||
* @param mixed $data
|
||||
*/
|
||||
protected function convertToString($data) : string
|
||||
{
|
||||
if (null === $data || \is_scalar($data)) {
|
||||
return (string) $data;
|
||||
}
|
||||
$data = $this->normalize($data);
|
||||
if (\version_compare(\PHP_VERSION, '5.4.0', '>=')) {
|
||||
return \WPMailSMTP\Vendor\Monolog\Utils::jsonEncode($data, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE, \true);
|
||||
}
|
||||
return \str_replace('\\/', '/', \WPMailSMTP\Vendor\Monolog\Utils::jsonEncode($data, null, \true));
|
||||
return \WPMailSMTP\Vendor\Monolog\Utils::jsonEncode($data, \JSON_PRETTY_PRINT | \WPMailSMTP\Vendor\Monolog\Utils::DEFAULT_JSON_FLAGS, \true);
|
||||
}
|
||||
}
|
||||
|
||||
+70
-58
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -10,8 +11,6 @@
|
||||
*/
|
||||
namespace WPMailSMTP\Vendor\Monolog\Formatter;
|
||||
|
||||
use Exception;
|
||||
use WPMailSMTP\Vendor\Monolog\Utils;
|
||||
use Throwable;
|
||||
/**
|
||||
* Encodes whatever record data is passed to it as json
|
||||
@@ -19,27 +18,31 @@ use Throwable;
|
||||
* This can be useful to log to databases or remote APIs
|
||||
*
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* @phpstan-import-type Record from \Monolog\Logger
|
||||
*/
|
||||
class JsonFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerFormatter
|
||||
{
|
||||
const BATCH_MODE_JSON = 1;
|
||||
const BATCH_MODE_NEWLINES = 2;
|
||||
public const BATCH_MODE_JSON = 1;
|
||||
public const BATCH_MODE_NEWLINES = 2;
|
||||
/** @var self::BATCH_MODE_* */
|
||||
protected $batchMode;
|
||||
/** @var bool */
|
||||
protected $appendNewline;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
/** @var bool */
|
||||
protected $ignoreEmptyContextAndExtra;
|
||||
/** @var bool */
|
||||
protected $includeStacktraces = \false;
|
||||
/**
|
||||
* @param int $batchMode
|
||||
* @param bool $appendNewline
|
||||
* @param int $maxDepth
|
||||
* @param self::BATCH_MODE_* $batchMode
|
||||
*/
|
||||
public function __construct($batchMode = self::BATCH_MODE_JSON, $appendNewline = \true, $maxDepth = 9)
|
||||
public function __construct(int $batchMode = self::BATCH_MODE_JSON, bool $appendNewline = \true, bool $ignoreEmptyContextAndExtra = \false, bool $includeStacktraces = \false)
|
||||
{
|
||||
parent::__construct(null, $maxDepth);
|
||||
$this->batchMode = $batchMode;
|
||||
$this->appendNewline = $appendNewline;
|
||||
$this->ignoreEmptyContextAndExtra = $ignoreEmptyContextAndExtra;
|
||||
$this->includeStacktraces = $includeStacktraces;
|
||||
parent::__construct();
|
||||
}
|
||||
/**
|
||||
* The batch mode option configures the formatting style for
|
||||
@@ -47,33 +50,44 @@ class JsonFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerForma
|
||||
* formatted as a JSON-encoded array. However, for
|
||||
* compatibility with some API endpoints, alternative styles
|
||||
* are available.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getBatchMode()
|
||||
public function getBatchMode() : int
|
||||
{
|
||||
return $this->batchMode;
|
||||
}
|
||||
/**
|
||||
* True if newlines are appended to every formatted record
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isAppendingNewlines()
|
||||
public function isAppendingNewlines() : bool
|
||||
{
|
||||
return $this->appendNewline;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function format(array $record)
|
||||
public function format(array $record) : string
|
||||
{
|
||||
return $this->toJson($this->normalize($record), \true) . ($this->appendNewline ? "\n" : '');
|
||||
$normalized = $this->normalize($record);
|
||||
if (isset($normalized['context']) && $normalized['context'] === []) {
|
||||
if ($this->ignoreEmptyContextAndExtra) {
|
||||
unset($normalized['context']);
|
||||
} else {
|
||||
$normalized['context'] = new \stdClass();
|
||||
}
|
||||
}
|
||||
if (isset($normalized['extra']) && $normalized['extra'] === []) {
|
||||
if ($this->ignoreEmptyContextAndExtra) {
|
||||
unset($normalized['extra']);
|
||||
} else {
|
||||
$normalized['extra'] = new \stdClass();
|
||||
}
|
||||
}
|
||||
return $this->toJson($normalized, \true) . ($this->appendNewline ? "\n" : '');
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function formatBatch(array $records)
|
||||
public function formatBatch(array $records) : string
|
||||
{
|
||||
switch ($this->batchMode) {
|
||||
case static::BATCH_MODE_NEWLINES:
|
||||
@@ -84,19 +98,19 @@ class JsonFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerForma
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param bool $include
|
||||
* @return self
|
||||
*/
|
||||
public function includeStacktraces($include = \true)
|
||||
public function includeStacktraces(bool $include = \true) : self
|
||||
{
|
||||
$this->includeStacktraces = $include;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Return a JSON-encoded array of records.
|
||||
*
|
||||
* @param array $records
|
||||
* @return string
|
||||
* @phpstan-param Record[] $records
|
||||
*/
|
||||
protected function formatBatchJson(array $records)
|
||||
protected function formatBatchJson(array $records) : string
|
||||
{
|
||||
return $this->toJson($this->normalize($records), \true);
|
||||
}
|
||||
@@ -104,10 +118,9 @@ class JsonFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerForma
|
||||
* Use new lines to separate records instead of a
|
||||
* JSON-encoded array.
|
||||
*
|
||||
* @param array $records
|
||||
* @return string
|
||||
* @phpstan-param Record[] $records
|
||||
*/
|
||||
protected function formatBatchNewlines(array $records)
|
||||
protected function formatBatchNewlines(array $records) : string
|
||||
{
|
||||
$instance = $this;
|
||||
$oldNewline = $this->appendNewline;
|
||||
@@ -125,25 +138,38 @@ class JsonFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerForma
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function normalize($data, $depth = 0)
|
||||
protected function normalize($data, int $depth = 0)
|
||||
{
|
||||
if ($depth > $this->maxDepth) {
|
||||
return 'Over ' . $this->maxDepth . ' levels deep, aborting normalization';
|
||||
if ($depth > $this->maxNormalizeDepth) {
|
||||
return 'Over ' . $this->maxNormalizeDepth . ' levels deep, aborting normalization';
|
||||
}
|
||||
if (\is_array($data)) {
|
||||
$normalized = array();
|
||||
$normalized = [];
|
||||
$count = 1;
|
||||
foreach ($data as $key => $value) {
|
||||
if ($count++ > 1000) {
|
||||
$normalized['...'] = 'Over 1000 items (' . \count($data) . ' total), aborting normalization';
|
||||
if ($count++ > $this->maxNormalizeItemCount) {
|
||||
$normalized['...'] = 'Over ' . $this->maxNormalizeItemCount . ' items (' . \count($data) . ' total), aborting normalization';
|
||||
break;
|
||||
}
|
||||
$normalized[$key] = $this->normalize($value, $depth + 1);
|
||||
}
|
||||
return $normalized;
|
||||
}
|
||||
if ($data instanceof \Exception || $data instanceof \Throwable) {
|
||||
return $this->normalizeException($data);
|
||||
if (\is_object($data)) {
|
||||
if ($data instanceof \DateTimeInterface) {
|
||||
return $this->formatDate($data);
|
||||
}
|
||||
if ($data instanceof \Throwable) {
|
||||
return $this->normalizeException($data, $depth);
|
||||
}
|
||||
// if the object has specific json serializability we want to make sure we skip the __toString treatment below
|
||||
if ($data instanceof \JsonSerializable) {
|
||||
return $data;
|
||||
}
|
||||
if (\method_exists($data, '__toString')) {
|
||||
return $data->__toString();
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
if (\is_resource($data)) {
|
||||
return parent::normalize($data);
|
||||
@@ -154,27 +180,13 @@ class JsonFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerForma
|
||||
* Normalizes given exception with or without its own stack trace based on
|
||||
* `includeStacktraces` property.
|
||||
*
|
||||
* @param Exception|Throwable $e
|
||||
*
|
||||
* @return array
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function normalizeException($e)
|
||||
protected function normalizeException(\Throwable $e, int $depth = 0) : array
|
||||
{
|
||||
// TODO 2.0 only check for Throwable
|
||||
if (!$e instanceof \Exception && !$e instanceof \Throwable) {
|
||||
throw new \InvalidArgumentException('Exception/Throwable expected, got ' . \gettype($e) . ' / ' . \WPMailSMTP\Vendor\Monolog\Utils::getClass($e));
|
||||
}
|
||||
$data = array('class' => \WPMailSMTP\Vendor\Monolog\Utils::getClass($e), 'message' => $e->getMessage(), 'code' => (int) $e->getCode(), 'file' => $e->getFile() . ':' . $e->getLine());
|
||||
if ($this->includeStacktraces) {
|
||||
$trace = $e->getTrace();
|
||||
foreach ($trace as $frame) {
|
||||
if (isset($frame['file'])) {
|
||||
$data['trace'][] = $frame['file'] . ':' . $frame['line'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($previous = $e->getPrevious()) {
|
||||
$data['previous'] = $this->normalizeException($previous);
|
||||
$data = parent::normalizeException($e, $depth);
|
||||
if (!$this->includeStacktraces) {
|
||||
unset($data['trace']);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
+89
-33
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -21,43 +22,54 @@ use WPMailSMTP\Vendor\Monolog\Utils;
|
||||
*/
|
||||
class LineFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerFormatter
|
||||
{
|
||||
const SIMPLE_FORMAT = "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n";
|
||||
public const SIMPLE_FORMAT = "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n";
|
||||
/** @var string */
|
||||
protected $format;
|
||||
/** @var bool */
|
||||
protected $allowInlineLineBreaks;
|
||||
/** @var bool */
|
||||
protected $ignoreEmptyContextAndExtra;
|
||||
/** @var bool */
|
||||
protected $includeStacktraces;
|
||||
/** @var ?callable */
|
||||
protected $stacktracesParser;
|
||||
/**
|
||||
* @param string $format The format of the message
|
||||
* @param string $dateFormat The format of the timestamp: one supported by DateTime::format
|
||||
* @param bool $allowInlineLineBreaks Whether to allow inline line breaks in log entries
|
||||
* @param bool $ignoreEmptyContextAndExtra
|
||||
* @param string|null $format The format of the message
|
||||
* @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format
|
||||
* @param bool $allowInlineLineBreaks Whether to allow inline line breaks in log entries
|
||||
* @param bool $ignoreEmptyContextAndExtra
|
||||
*/
|
||||
public function __construct($format = null, $dateFormat = null, $allowInlineLineBreaks = \false, $ignoreEmptyContextAndExtra = \false)
|
||||
public function __construct(?string $format = null, ?string $dateFormat = null, bool $allowInlineLineBreaks = \false, bool $ignoreEmptyContextAndExtra = \false, bool $includeStacktraces = \false)
|
||||
{
|
||||
$this->format = $format ?: static::SIMPLE_FORMAT;
|
||||
$this->format = $format === null ? static::SIMPLE_FORMAT : $format;
|
||||
$this->allowInlineLineBreaks = $allowInlineLineBreaks;
|
||||
$this->ignoreEmptyContextAndExtra = $ignoreEmptyContextAndExtra;
|
||||
$this->includeStacktraces($includeStacktraces);
|
||||
parent::__construct($dateFormat);
|
||||
}
|
||||
public function includeStacktraces($include = \true)
|
||||
public function includeStacktraces(bool $include = \true, ?callable $parser = null) : self
|
||||
{
|
||||
$this->includeStacktraces = $include;
|
||||
if ($this->includeStacktraces) {
|
||||
$this->allowInlineLineBreaks = \true;
|
||||
$this->stacktracesParser = $parser;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
public function allowInlineLineBreaks($allow = \true)
|
||||
public function allowInlineLineBreaks(bool $allow = \true) : self
|
||||
{
|
||||
$this->allowInlineLineBreaks = $allow;
|
||||
return $this;
|
||||
}
|
||||
public function ignoreEmptyContextAndExtra($ignore = \true)
|
||||
public function ignoreEmptyContextAndExtra(bool $ignore = \true) : self
|
||||
{
|
||||
$this->ignoreEmptyContextAndExtra = $ignore;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function format(array $record)
|
||||
public function format(array $record) : string
|
||||
{
|
||||
$vars = parent::format($record);
|
||||
$output = $this->format;
|
||||
@@ -91,10 +103,14 @@ class LineFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerForma
|
||||
// remove leftover %extra.xxx% and %context.xxx% if any
|
||||
if (\false !== \strpos($output, '%')) {
|
||||
$output = \preg_replace('/%(?:extra|context)\\..+?%/', '', $output);
|
||||
if (null === $output) {
|
||||
$pcreErrorCode = \preg_last_error();
|
||||
throw new \RuntimeException('Failed to run preg_replace: ' . $pcreErrorCode . ' / ' . \WPMailSMTP\Vendor\Monolog\Utils::pcreLastErrorMessage($pcreErrorCode));
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
public function formatBatch(array $records)
|
||||
public function formatBatch(array $records) : string
|
||||
{
|
||||
$message = '';
|
||||
foreach ($records as $record) {
|
||||
@@ -102,29 +118,32 @@ class LineFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerForma
|
||||
}
|
||||
return $message;
|
||||
}
|
||||
public function stringify($value)
|
||||
/**
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function stringify($value) : string
|
||||
{
|
||||
return $this->replaceNewlines($this->convertToString($value));
|
||||
}
|
||||
protected function normalizeException($e)
|
||||
protected function normalizeException(\Throwable $e, int $depth = 0) : string
|
||||
{
|
||||
// TODO 2.0 only check for Throwable
|
||||
if (!$e instanceof \Exception && !$e instanceof \Throwable) {
|
||||
throw new \InvalidArgumentException('Exception/Throwable expected, got ' . \gettype($e) . ' / ' . \WPMailSMTP\Vendor\Monolog\Utils::getClass($e));
|
||||
}
|
||||
$previousText = '';
|
||||
$str = $this->formatException($e);
|
||||
if ($previous = $e->getPrevious()) {
|
||||
do {
|
||||
$previousText .= ', ' . \WPMailSMTP\Vendor\Monolog\Utils::getClass($previous) . '(code: ' . $previous->getCode() . '): ' . $previous->getMessage() . ' at ' . $previous->getFile() . ':' . $previous->getLine();
|
||||
$depth++;
|
||||
if ($depth > $this->maxNormalizeDepth) {
|
||||
$str .= "\n[previous exception] Over " . $this->maxNormalizeDepth . ' levels deep, aborting normalization';
|
||||
break;
|
||||
}
|
||||
$str .= "\n[previous exception] " . $this->formatException($previous);
|
||||
} while ($previous = $previous->getPrevious());
|
||||
}
|
||||
$str = '[object] (' . \WPMailSMTP\Vendor\Monolog\Utils::getClass($e) . '(code: ' . $e->getCode() . '): ' . $e->getMessage() . ' at ' . $e->getFile() . ':' . $e->getLine() . $previousText . ')';
|
||||
if ($this->includeStacktraces) {
|
||||
$str .= "\n[stacktrace]\n" . $e->getTraceAsString() . "\n";
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
protected function convertToString($data)
|
||||
/**
|
||||
* @param mixed $data
|
||||
*/
|
||||
protected function convertToString($data) : string
|
||||
{
|
||||
if (null === $data || \is_bool($data)) {
|
||||
return \var_export($data, \true);
|
||||
@@ -132,19 +151,56 @@ class LineFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerForma
|
||||
if (\is_scalar($data)) {
|
||||
return (string) $data;
|
||||
}
|
||||
if (\version_compare(\PHP_VERSION, '5.4.0', '>=')) {
|
||||
return $this->toJson($data, \true);
|
||||
}
|
||||
return \str_replace('\\/', '/', $this->toJson($data, \true));
|
||||
return $this->toJson($data, \true);
|
||||
}
|
||||
protected function replaceNewlines($str)
|
||||
protected function replaceNewlines(string $str) : string
|
||||
{
|
||||
if ($this->allowInlineLineBreaks) {
|
||||
if (0 === \strpos($str, '{')) {
|
||||
return \str_replace(array('\\r', '\\n'), array("\r", "\n"), $str);
|
||||
$str = \preg_replace('/(?<!\\\\)\\\\[rn]/', "\n", $str);
|
||||
if (null === $str) {
|
||||
$pcreErrorCode = \preg_last_error();
|
||||
throw new \RuntimeException('Failed to run preg_replace: ' . $pcreErrorCode . ' / ' . \WPMailSMTP\Vendor\Monolog\Utils::pcreLastErrorMessage($pcreErrorCode));
|
||||
}
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
return \str_replace(array("\r\n", "\r", "\n"), ' ', $str);
|
||||
return \str_replace(["\r\n", "\r", "\n"], ' ', $str);
|
||||
}
|
||||
private function formatException(\Throwable $e) : string
|
||||
{
|
||||
$str = '[object] (' . \WPMailSMTP\Vendor\Monolog\Utils::getClass($e) . '(code: ' . $e->getCode();
|
||||
if ($e instanceof \SoapFault) {
|
||||
if (isset($e->faultcode)) {
|
||||
$str .= ' faultcode: ' . $e->faultcode;
|
||||
}
|
||||
if (isset($e->faultactor)) {
|
||||
$str .= ' faultactor: ' . $e->faultactor;
|
||||
}
|
||||
if (isset($e->detail)) {
|
||||
if (\is_string($e->detail)) {
|
||||
$str .= ' detail: ' . $e->detail;
|
||||
} elseif (\is_object($e->detail) || \is_array($e->detail)) {
|
||||
$str .= ' detail: ' . $this->toJson($e->detail, \true);
|
||||
}
|
||||
}
|
||||
}
|
||||
$str .= '): ' . $e->getMessage() . ' at ' . $e->getFile() . ':' . $e->getLine() . ')';
|
||||
if ($this->includeStacktraces) {
|
||||
$str .= $this->stacktracesParser($e);
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
private function stacktracesParser(\Throwable $e) : string
|
||||
{
|
||||
$trace = $e->getTraceAsString();
|
||||
if ($this->stacktracesParser) {
|
||||
$trace = $this->stacktracesParserCustom($trace);
|
||||
}
|
||||
return "\n[stacktrace]\n" . $trace . "\n";
|
||||
}
|
||||
private function stacktracesParserCustom(string $trace) : string
|
||||
{
|
||||
return \implode("\n", \array_filter(\array_map($this->stacktracesParser, \explode("\n", $trace))));
|
||||
}
|
||||
}
|
||||
|
||||
+5
-6
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -20,10 +21,8 @@ class LogglyFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\JsonFormatter
|
||||
/**
|
||||
* Overrides the default batch mode to new lines for compatibility with the
|
||||
* Loggly bulk API.
|
||||
*
|
||||
* @param int $batchMode
|
||||
*/
|
||||
public function __construct($batchMode = self::BATCH_MODE_NEWLINES, $appendNewline = \false)
|
||||
public function __construct(int $batchMode = self::BATCH_MODE_NEWLINES, bool $appendNewline = \false)
|
||||
{
|
||||
parent::__construct($batchMode, $appendNewline);
|
||||
}
|
||||
@@ -33,11 +32,11 @@ class LogglyFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\JsonFormatter
|
||||
* @see https://www.loggly.com/docs/automated-parsing/#json
|
||||
* @see \Monolog\Formatter\JsonFormatter::format()
|
||||
*/
|
||||
public function format(array $record)
|
||||
public function format(array $record) : string
|
||||
{
|
||||
if (isset($record["datetime"]) && $record["datetime"] instanceof \DateTime) {
|
||||
if (isset($record["datetime"]) && $record["datetime"] instanceof \DateTimeInterface) {
|
||||
$record["timestamp"] = $record["datetime"]->format("Y-m-d\\TH:i:s.uO");
|
||||
// TODO 2.0 unset the 'datetime' parameter, retained for BC
|
||||
unset($record["datetime"]);
|
||||
}
|
||||
return parent::format($record);
|
||||
}
|
||||
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace WPMailSMTP\Vendor\Monolog\Formatter;
|
||||
|
||||
/**
|
||||
* Encodes message information into JSON in a format compatible with Logmatic.
|
||||
*
|
||||
* @author Julien Breux <julien.breux@gmail.com>
|
||||
*/
|
||||
class LogmaticFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\JsonFormatter
|
||||
{
|
||||
protected const MARKERS = ["sourcecode", "php"];
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $hostname = '';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $appname = '';
|
||||
public function setHostname(string $hostname) : self
|
||||
{
|
||||
$this->hostname = $hostname;
|
||||
return $this;
|
||||
}
|
||||
public function setAppname(string $appname) : self
|
||||
{
|
||||
$this->appname = $appname;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Appends the 'hostname' and 'appname' parameter for indexing by Logmatic.
|
||||
*
|
||||
* @see http://doc.logmatic.io/docs/basics-to-send-data
|
||||
* @see \Monolog\Formatter\JsonFormatter::format()
|
||||
*/
|
||||
public function format(array $record) : string
|
||||
{
|
||||
if (!empty($this->hostname)) {
|
||||
$record["hostname"] = $this->hostname;
|
||||
}
|
||||
if (!empty($this->appname)) {
|
||||
$record["appname"] = $this->appname;
|
||||
}
|
||||
$record["@marker"] = static::MARKERS;
|
||||
return parent::format($record);
|
||||
}
|
||||
}
|
||||
+24
-78
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -13,15 +14,13 @@ namespace WPMailSMTP\Vendor\Monolog\Formatter;
|
||||
/**
|
||||
* Serializes a log message to Logstash Event Format
|
||||
*
|
||||
* @see http://logstash.net/
|
||||
* @see https://github.com/logstash/logstash/blob/master/lib/logstash/event.rb
|
||||
* @see https://www.elastic.co/products/logstash
|
||||
* @see https://github.com/elastic/logstash/blob/master/logstash-core/src/main/java/org/logstash/Event.java
|
||||
*
|
||||
* @author Tim Mower <timothy.mower@gmail.com>
|
||||
*/
|
||||
class LogstashFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerFormatter
|
||||
{
|
||||
const V0 = 0;
|
||||
const V1 = 1;
|
||||
/**
|
||||
* @var string the name of the system for the Logstash log message, used to fill the @source field
|
||||
*/
|
||||
@@ -31,90 +30,38 @@ class LogstashFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerF
|
||||
*/
|
||||
protected $applicationName;
|
||||
/**
|
||||
* @var string a prefix for 'extra' fields from the Monolog record (optional)
|
||||
* @var string the key for 'extra' fields from the Monolog record
|
||||
*/
|
||||
protected $extraPrefix;
|
||||
protected $extraKey;
|
||||
/**
|
||||
* @var string a prefix for 'context' fields from the Monolog record (optional)
|
||||
* @var string the key for 'context' fields from the Monolog record
|
||||
*/
|
||||
protected $contextPrefix;
|
||||
protected $contextKey;
|
||||
/**
|
||||
* @var int logstash format version to use
|
||||
* @param string $applicationName The application that sends the data, used as the "type" field of logstash
|
||||
* @param string|null $systemName The system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine
|
||||
* @param string $extraKey The key for extra keys inside logstash "fields", defaults to extra
|
||||
* @param string $contextKey The key for context keys inside logstash "fields", defaults to context
|
||||
*/
|
||||
protected $version;
|
||||
/**
|
||||
* @param string $applicationName the application that sends the data, used as the "type" field of logstash
|
||||
* @param string $systemName the system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine
|
||||
* @param string $extraPrefix prefix for extra keys inside logstash "fields"
|
||||
* @param string $contextPrefix prefix for context keys inside logstash "fields", defaults to ctxt_
|
||||
* @param int $version the logstash format version to use, defaults to 0
|
||||
*/
|
||||
public function __construct($applicationName, $systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_', $version = self::V0)
|
||||
public function __construct(string $applicationName, ?string $systemName = null, string $extraKey = 'extra', string $contextKey = 'context')
|
||||
{
|
||||
// logstash requires a ISO 8601 format date with optional millisecond precision.
|
||||
parent::__construct('Y-m-d\\TH:i:s.uP');
|
||||
$this->systemName = $systemName ?: \gethostname();
|
||||
$this->systemName = $systemName === null ? (string) \gethostname() : $systemName;
|
||||
$this->applicationName = $applicationName;
|
||||
$this->extraPrefix = $extraPrefix;
|
||||
$this->contextPrefix = $contextPrefix;
|
||||
$this->version = $version;
|
||||
$this->extraKey = $extraKey;
|
||||
$this->contextKey = $contextKey;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function format(array $record)
|
||||
public function format(array $record) : string
|
||||
{
|
||||
$record = parent::format($record);
|
||||
if ($this->version === self::V1) {
|
||||
$message = $this->formatV1($record);
|
||||
} else {
|
||||
$message = $this->formatV0($record);
|
||||
}
|
||||
return $this->toJson($message) . "\n";
|
||||
}
|
||||
protected function formatV0(array $record)
|
||||
{
|
||||
if (empty($record['datetime'])) {
|
||||
$record['datetime'] = \gmdate('c');
|
||||
}
|
||||
$message = array('@timestamp' => $record['datetime'], '@source' => $this->systemName, '@fields' => array());
|
||||
if (isset($record['message'])) {
|
||||
$message['@message'] = $record['message'];
|
||||
}
|
||||
if (isset($record['channel'])) {
|
||||
$message['@tags'] = array($record['channel']);
|
||||
$message['@fields']['channel'] = $record['channel'];
|
||||
}
|
||||
if (isset($record['level'])) {
|
||||
$message['@fields']['level'] = $record['level'];
|
||||
}
|
||||
if ($this->applicationName) {
|
||||
$message['@type'] = $this->applicationName;
|
||||
}
|
||||
if (isset($record['extra']['server'])) {
|
||||
$message['@source_host'] = $record['extra']['server'];
|
||||
}
|
||||
if (isset($record['extra']['url'])) {
|
||||
$message['@source_path'] = $record['extra']['url'];
|
||||
}
|
||||
if (!empty($record['extra'])) {
|
||||
foreach ($record['extra'] as $key => $val) {
|
||||
$message['@fields'][$this->extraPrefix . $key] = $val;
|
||||
}
|
||||
}
|
||||
if (!empty($record['context'])) {
|
||||
foreach ($record['context'] as $key => $val) {
|
||||
$message['@fields'][$this->contextPrefix . $key] = $val;
|
||||
}
|
||||
}
|
||||
return $message;
|
||||
}
|
||||
protected function formatV1(array $record)
|
||||
{
|
||||
if (empty($record['datetime'])) {
|
||||
$record['datetime'] = \gmdate('c');
|
||||
}
|
||||
$message = array('@timestamp' => $record['datetime'], '@version' => 1, 'host' => $this->systemName);
|
||||
$message = ['@timestamp' => $record['datetime'], '@version' => 1, 'host' => $this->systemName];
|
||||
if (isset($record['message'])) {
|
||||
$message['message'] = $record['message'];
|
||||
}
|
||||
@@ -125,19 +72,18 @@ class LogstashFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerF
|
||||
if (isset($record['level_name'])) {
|
||||
$message['level'] = $record['level_name'];
|
||||
}
|
||||
if (isset($record['level'])) {
|
||||
$message['monolog_level'] = $record['level'];
|
||||
}
|
||||
if ($this->applicationName) {
|
||||
$message['type'] = $this->applicationName;
|
||||
}
|
||||
if (!empty($record['extra'])) {
|
||||
foreach ($record['extra'] as $key => $val) {
|
||||
$message[$this->extraPrefix . $key] = $val;
|
||||
}
|
||||
$message[$this->extraKey] = $record['extra'];
|
||||
}
|
||||
if (!empty($record['context'])) {
|
||||
foreach ($record['context'] as $key => $val) {
|
||||
$message[$this->contextPrefix . $key] = $val;
|
||||
}
|
||||
$message[$this->contextKey] = $record['context'];
|
||||
}
|
||||
return $message;
|
||||
return $this->toJson($message) . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
+74
-28
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -10,6 +11,8 @@
|
||||
*/
|
||||
namespace WPMailSMTP\Vendor\Monolog\Formatter;
|
||||
|
||||
use MongoDB\BSON\Type;
|
||||
use MongoDB\BSON\UTCDateTime;
|
||||
use WPMailSMTP\Vendor\Monolog\Utils;
|
||||
/**
|
||||
* Formats a record for use with the MongoDBHandler.
|
||||
@@ -18,62 +21,84 @@ use WPMailSMTP\Vendor\Monolog\Utils;
|
||||
*/
|
||||
class MongoDBFormatter implements \WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface
|
||||
{
|
||||
/** @var bool */
|
||||
private $exceptionTraceAsString;
|
||||
/** @var int */
|
||||
private $maxNestingLevel;
|
||||
/** @var bool */
|
||||
private $isLegacyMongoExt;
|
||||
/**
|
||||
* @param int $maxNestingLevel 0 means infinite nesting, the $record itself is level 1, $record['context'] is 2
|
||||
* @param bool $exceptionTraceAsString set to false to log exception traces as a sub documents instead of strings
|
||||
*/
|
||||
public function __construct($maxNestingLevel = 3, $exceptionTraceAsString = \true)
|
||||
public function __construct(int $maxNestingLevel = 3, bool $exceptionTraceAsString = \true)
|
||||
{
|
||||
$this->maxNestingLevel = \max($maxNestingLevel, 0);
|
||||
$this->exceptionTraceAsString = (bool) $exceptionTraceAsString;
|
||||
$this->exceptionTraceAsString = $exceptionTraceAsString;
|
||||
$this->isLegacyMongoExt = \extension_loaded('mongodb') && \version_compare((string) \phpversion('mongodb'), '1.1.9', '<=');
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @return mixed[]
|
||||
*/
|
||||
public function format(array $record)
|
||||
public function format(array $record) : array
|
||||
{
|
||||
return $this->formatArray($record);
|
||||
/** @var mixed[] $res */
|
||||
$res = $this->formatArray($record);
|
||||
return $res;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @return array<mixed[]>
|
||||
*/
|
||||
public function formatBatch(array $records)
|
||||
public function formatBatch(array $records) : array
|
||||
{
|
||||
$formatted = [];
|
||||
foreach ($records as $key => $record) {
|
||||
$records[$key] = $this->format($record);
|
||||
$formatted[$key] = $this->format($record);
|
||||
}
|
||||
return $records;
|
||||
return $formatted;
|
||||
}
|
||||
protected function formatArray(array $record, $nestingLevel = 0)
|
||||
/**
|
||||
* @param mixed[] $array
|
||||
* @return mixed[]|string Array except when max nesting level is reached then a string "[...]"
|
||||
*/
|
||||
protected function formatArray(array $array, int $nestingLevel = 0)
|
||||
{
|
||||
if ($this->maxNestingLevel == 0 || $nestingLevel <= $this->maxNestingLevel) {
|
||||
foreach ($record as $name => $value) {
|
||||
if ($value instanceof \DateTime) {
|
||||
$record[$name] = $this->formatDate($value, $nestingLevel + 1);
|
||||
} elseif ($value instanceof \Exception) {
|
||||
$record[$name] = $this->formatException($value, $nestingLevel + 1);
|
||||
} elseif (\is_array($value)) {
|
||||
$record[$name] = $this->formatArray($value, $nestingLevel + 1);
|
||||
} elseif (\is_object($value)) {
|
||||
$record[$name] = $this->formatObject($value, $nestingLevel + 1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$record = '[...]';
|
||||
if ($this->maxNestingLevel > 0 && $nestingLevel > $this->maxNestingLevel) {
|
||||
return '[...]';
|
||||
}
|
||||
return $record;
|
||||
foreach ($array as $name => $value) {
|
||||
if ($value instanceof \DateTimeInterface) {
|
||||
$array[$name] = $this->formatDate($value, $nestingLevel + 1);
|
||||
} elseif ($value instanceof \Throwable) {
|
||||
$array[$name] = $this->formatException($value, $nestingLevel + 1);
|
||||
} elseif (\is_array($value)) {
|
||||
$array[$name] = $this->formatArray($value, $nestingLevel + 1);
|
||||
} elseif (\is_object($value) && !$value instanceof \MongoDB\BSON\Type) {
|
||||
$array[$name] = $this->formatObject($value, $nestingLevel + 1);
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
protected function formatObject($value, $nestingLevel)
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return mixed[]|string
|
||||
*/
|
||||
protected function formatObject($value, int $nestingLevel)
|
||||
{
|
||||
$objectVars = \get_object_vars($value);
|
||||
$objectVars['class'] = \WPMailSMTP\Vendor\Monolog\Utils::getClass($value);
|
||||
return $this->formatArray($objectVars, $nestingLevel);
|
||||
}
|
||||
protected function formatException(\Exception $exception, $nestingLevel)
|
||||
/**
|
||||
* @return mixed[]|string
|
||||
*/
|
||||
protected function formatException(\Throwable $exception, int $nestingLevel)
|
||||
{
|
||||
$formattedException = array('class' => \WPMailSMTP\Vendor\Monolog\Utils::getClass($exception), 'message' => $exception->getMessage(), 'code' => (int) $exception->getCode(), 'file' => $exception->getFile() . ':' . $exception->getLine());
|
||||
$formattedException = ['class' => \WPMailSMTP\Vendor\Monolog\Utils::getClass($exception), 'message' => $exception->getMessage(), 'code' => (int) $exception->getCode(), 'file' => $exception->getFile() . ':' . $exception->getLine()];
|
||||
if ($this->exceptionTraceAsString === \true) {
|
||||
$formattedException['trace'] = $exception->getTraceAsString();
|
||||
} else {
|
||||
@@ -81,8 +106,29 @@ class MongoDBFormatter implements \WPMailSMTP\Vendor\Monolog\Formatter\Formatter
|
||||
}
|
||||
return $this->formatArray($formattedException, $nestingLevel);
|
||||
}
|
||||
protected function formatDate(\DateTime $value, $nestingLevel)
|
||||
protected function formatDate(\DateTimeInterface $value, int $nestingLevel) : \MongoDB\BSON\UTCDateTime
|
||||
{
|
||||
return new \MongoDate($value->getTimestamp());
|
||||
if ($this->isLegacyMongoExt) {
|
||||
return $this->legacyGetMongoDbDateTime($value);
|
||||
}
|
||||
return $this->getMongoDbDateTime($value);
|
||||
}
|
||||
private function getMongoDbDateTime(\DateTimeInterface $value) : \MongoDB\BSON\UTCDateTime
|
||||
{
|
||||
return new \MongoDB\BSON\UTCDateTime((int) \floor((float) $value->format('U.u') * 1000));
|
||||
}
|
||||
/**
|
||||
* This is needed to support MongoDB Driver v1.19 and below
|
||||
*
|
||||
* See https://github.com/mongodb/mongo-php-driver/issues/426
|
||||
*
|
||||
* It can probably be removed in 2.1 or later once MongoDB's 1.2 is released and widely adopted
|
||||
*/
|
||||
private function legacyGetMongoDbDateTime(\DateTimeInterface $value) : \MongoDB\BSON\UTCDateTime
|
||||
{
|
||||
$milliseconds = \floor((float) $value->format('U.u') * 1000);
|
||||
$milliseconds = \PHP_INT_SIZE == 8 ? (int) $milliseconds : (string) $milliseconds;
|
||||
// @phpstan-ignore-next-line
|
||||
return new \MongoDB\BSON\UTCDateTime($milliseconds);
|
||||
}
|
||||
}
|
||||
|
||||
+119
-44
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -10,8 +11,9 @@
|
||||
*/
|
||||
namespace WPMailSMTP\Vendor\Monolog\Formatter;
|
||||
|
||||
use Exception;
|
||||
use WPMailSMTP\Vendor\Monolog\DateTimeImmutable;
|
||||
use WPMailSMTP\Vendor\Monolog\Utils;
|
||||
use Throwable;
|
||||
/**
|
||||
* Normalizes incoming records to remove objects/resources so it's easier to dump to various targets
|
||||
*
|
||||
@@ -19,30 +21,36 @@ use WPMailSMTP\Vendor\Monolog\Utils;
|
||||
*/
|
||||
class NormalizerFormatter implements \WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface
|
||||
{
|
||||
const SIMPLE_DATE = "Y-m-d H:i:s";
|
||||
public const SIMPLE_DATE = "Y-m-d\\TH:i:sP";
|
||||
/** @var string */
|
||||
protected $dateFormat;
|
||||
protected $maxDepth;
|
||||
/** @var int */
|
||||
protected $maxNormalizeDepth = 9;
|
||||
/** @var int */
|
||||
protected $maxNormalizeItemCount = 1000;
|
||||
/** @var int */
|
||||
private $jsonEncodeOptions = \WPMailSMTP\Vendor\Monolog\Utils::DEFAULT_JSON_FLAGS;
|
||||
/**
|
||||
* @param string $dateFormat The format of the timestamp: one supported by DateTime::format
|
||||
* @param int $maxDepth
|
||||
* @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format
|
||||
*/
|
||||
public function __construct($dateFormat = null, $maxDepth = 9)
|
||||
public function __construct(?string $dateFormat = null)
|
||||
{
|
||||
$this->dateFormat = $dateFormat ?: static::SIMPLE_DATE;
|
||||
$this->maxDepth = $maxDepth;
|
||||
$this->dateFormat = null === $dateFormat ? static::SIMPLE_DATE : $dateFormat;
|
||||
if (!\function_exists('json_encode')) {
|
||||
throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s NormalizerFormatter');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @param mixed[] $record
|
||||
*/
|
||||
public function format(array $record)
|
||||
{
|
||||
return $this->normalize($record);
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function formatBatch(array $records)
|
||||
{
|
||||
@@ -51,24 +59,59 @@ class NormalizerFormatter implements \WPMailSMTP\Vendor\Monolog\Formatter\Format
|
||||
}
|
||||
return $records;
|
||||
}
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getMaxDepth()
|
||||
public function getDateFormat() : string
|
||||
{
|
||||
return $this->maxDepth;
|
||||
return $this->dateFormat;
|
||||
}
|
||||
public function setDateFormat(string $dateFormat) : self
|
||||
{
|
||||
$this->dateFormat = $dateFormat;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @param int $maxDepth
|
||||
* The maximum number of normalization levels to go through
|
||||
*/
|
||||
public function setMaxDepth($maxDepth)
|
||||
public function getMaxNormalizeDepth() : int
|
||||
{
|
||||
$this->maxDepth = $maxDepth;
|
||||
return $this->maxNormalizeDepth;
|
||||
}
|
||||
protected function normalize($data, $depth = 0)
|
||||
public function setMaxNormalizeDepth(int $maxNormalizeDepth) : self
|
||||
{
|
||||
if ($depth > $this->maxDepth) {
|
||||
return 'Over ' . $this->maxDepth . ' levels deep, aborting normalization';
|
||||
$this->maxNormalizeDepth = $maxNormalizeDepth;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* The maximum number of items to normalize per level
|
||||
*/
|
||||
public function getMaxNormalizeItemCount() : int
|
||||
{
|
||||
return $this->maxNormalizeItemCount;
|
||||
}
|
||||
public function setMaxNormalizeItemCount(int $maxNormalizeItemCount) : self
|
||||
{
|
||||
$this->maxNormalizeItemCount = $maxNormalizeItemCount;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Enables `json_encode` pretty print.
|
||||
*/
|
||||
public function setJsonPrettyPrint(bool $enable) : self
|
||||
{
|
||||
if ($enable) {
|
||||
$this->jsonEncodeOptions |= \JSON_PRETTY_PRINT;
|
||||
} else {
|
||||
$this->jsonEncodeOptions &= ~\JSON_PRETTY_PRINT;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @param mixed $data
|
||||
* @return null|scalar|array<array|scalar|null>
|
||||
*/
|
||||
protected function normalize($data, int $depth = 0)
|
||||
{
|
||||
if ($depth > $this->maxNormalizeDepth) {
|
||||
return 'Over ' . $this->maxNormalizeDepth . ' levels deep, aborting normalization';
|
||||
}
|
||||
if (null === $data || \is_scalar($data)) {
|
||||
if (\is_float($data)) {
|
||||
@@ -82,46 +125,57 @@ class NormalizerFormatter implements \WPMailSMTP\Vendor\Monolog\Formatter\Format
|
||||
return $data;
|
||||
}
|
||||
if (\is_array($data)) {
|
||||
$normalized = array();
|
||||
$normalized = [];
|
||||
$count = 1;
|
||||
foreach ($data as $key => $value) {
|
||||
if ($count++ > 1000) {
|
||||
$normalized['...'] = 'Over 1000 items (' . \count($data) . ' total), aborting normalization';
|
||||
if ($count++ > $this->maxNormalizeItemCount) {
|
||||
$normalized['...'] = 'Over ' . $this->maxNormalizeItemCount . ' items (' . \count($data) . ' total), aborting normalization';
|
||||
break;
|
||||
}
|
||||
$normalized[$key] = $this->normalize($value, $depth + 1);
|
||||
}
|
||||
return $normalized;
|
||||
}
|
||||
if ($data instanceof \DateTime) {
|
||||
return $data->format($this->dateFormat);
|
||||
if ($data instanceof \DateTimeInterface) {
|
||||
return $this->formatDate($data);
|
||||
}
|
||||
if (\is_object($data)) {
|
||||
// TODO 2.0 only check for Throwable
|
||||
if ($data instanceof \Exception || \PHP_VERSION_ID > 70000 && $data instanceof \Throwable) {
|
||||
return $this->normalizeException($data);
|
||||
if ($data instanceof \Throwable) {
|
||||
return $this->normalizeException($data, $depth);
|
||||
}
|
||||
// non-serializable objects that implement __toString stringified
|
||||
if (\method_exists($data, '__toString') && !$data instanceof \JsonSerializable) {
|
||||
if ($data instanceof \JsonSerializable) {
|
||||
/** @var null|scalar|array<array|scalar|null> $value */
|
||||
$value = $data->jsonSerialize();
|
||||
} elseif (\get_class($data) === '__PHP_Incomplete_Class') {
|
||||
$accessor = new \ArrayObject($data);
|
||||
$value = (string) $accessor['__PHP_Incomplete_Class_Name'];
|
||||
} elseif (\method_exists($data, '__toString')) {
|
||||
/** @var string $value */
|
||||
$value = $data->__toString();
|
||||
} else {
|
||||
// the rest is json-serialized in some way
|
||||
$value = $this->toJson($data, \true);
|
||||
// the rest is normalized by json encoding and decoding it
|
||||
/** @var null|scalar|array<array|scalar|null> $value */
|
||||
$value = \json_decode($this->toJson($data, \true), \true);
|
||||
}
|
||||
return \sprintf("[object] (%s: %s)", \WPMailSMTP\Vendor\Monolog\Utils::getClass($data), $value);
|
||||
return [\WPMailSMTP\Vendor\Monolog\Utils::getClass($data) => $value];
|
||||
}
|
||||
if (\is_resource($data)) {
|
||||
return \sprintf('[resource] (%s)', \get_resource_type($data));
|
||||
return \sprintf('[resource(%s)]', \get_resource_type($data));
|
||||
}
|
||||
return '[unknown(' . \gettype($data) . ')]';
|
||||
}
|
||||
protected function normalizeException($e)
|
||||
/**
|
||||
* @return mixed[]
|
||||
*/
|
||||
protected function normalizeException(\Throwable $e, int $depth = 0)
|
||||
{
|
||||
// TODO 2.0 only check for Throwable
|
||||
if (!$e instanceof \Exception && !$e instanceof \Throwable) {
|
||||
throw new \InvalidArgumentException('Exception/Throwable expected, got ' . \gettype($e) . ' / ' . \WPMailSMTP\Vendor\Monolog\Utils::getClass($e));
|
||||
if ($depth > $this->maxNormalizeDepth) {
|
||||
return ['Over ' . $this->maxNormalizeDepth . ' levels deep, aborting normalization'];
|
||||
}
|
||||
$data = array('class' => \WPMailSMTP\Vendor\Monolog\Utils::getClass($e), 'message' => $e->getMessage(), 'code' => (int) $e->getCode(), 'file' => $e->getFile() . ':' . $e->getLine());
|
||||
if ($e instanceof \JsonSerializable) {
|
||||
return (array) $e->jsonSerialize();
|
||||
}
|
||||
$data = ['class' => \WPMailSMTP\Vendor\Monolog\Utils::getClass($e), 'message' => $e->getMessage(), 'code' => (int) $e->getCode(), 'file' => $e->getFile() . ':' . $e->getLine()];
|
||||
if ($e instanceof \SoapFault) {
|
||||
if (isset($e->faultcode)) {
|
||||
$data['faultcode'] = $e->faultcode;
|
||||
@@ -144,7 +198,7 @@ class NormalizerFormatter implements \WPMailSMTP\Vendor\Monolog\Formatter\Format
|
||||
}
|
||||
}
|
||||
if ($previous = $e->getPrevious()) {
|
||||
$data['previous'] = $this->normalizeException($previous);
|
||||
$data['previous'] = $this->normalizeException($previous, $depth + 1);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
@@ -152,12 +206,33 @@ class NormalizerFormatter implements \WPMailSMTP\Vendor\Monolog\Formatter\Format
|
||||
* Return the JSON representation of a value
|
||||
*
|
||||
* @param mixed $data
|
||||
* @param bool $ignoreErrors
|
||||
* @throws \RuntimeException if encoding fails and errors are not ignored
|
||||
* @return string if encoding fails and ignoreErrors is true 'null' is returned
|
||||
*/
|
||||
protected function toJson($data, bool $ignoreErrors = \false) : string
|
||||
{
|
||||
return \WPMailSMTP\Vendor\Monolog\Utils::jsonEncode($data, $this->jsonEncodeOptions, $ignoreErrors);
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function toJson($data, $ignoreErrors = \false)
|
||||
protected function formatDate(\DateTimeInterface $date)
|
||||
{
|
||||
return \WPMailSMTP\Vendor\Monolog\Utils::jsonEncode($data, null, $ignoreErrors);
|
||||
// in case the date format isn't custom then we defer to the custom DateTimeImmutable
|
||||
// formatting logic, which will pick the right format based on whether useMicroseconds is on
|
||||
if ($this->dateFormat === self::SIMPLE_DATE && $date instanceof \WPMailSMTP\Vendor\Monolog\DateTimeImmutable) {
|
||||
return (string) $date;
|
||||
}
|
||||
return $date->format($this->dateFormat);
|
||||
}
|
||||
public function addJsonEncodeOption(int $option) : self
|
||||
{
|
||||
$this->jsonEncodeOptions |= $option;
|
||||
return $this;
|
||||
}
|
||||
public function removeJsonEncodeOption(int $option) : self
|
||||
{
|
||||
$this->jsonEncodeOptions &= ~$option;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
+11
-7
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -19,23 +20,26 @@ namespace WPMailSMTP\Vendor\Monolog\Formatter;
|
||||
class ScalarFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerFormatter
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @phpstan-return array<string, scalar|null> $record
|
||||
*/
|
||||
public function format(array $record)
|
||||
public function format(array $record) : array
|
||||
{
|
||||
$result = [];
|
||||
foreach ($record as $key => $value) {
|
||||
$record[$key] = $this->normalizeValue($value);
|
||||
$result[$key] = $this->normalizeValue($value);
|
||||
}
|
||||
return $record;
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
* @param mixed $value
|
||||
* @return scalar|null
|
||||
*/
|
||||
protected function normalizeValue($value)
|
||||
{
|
||||
$normalized = $this->normalize($value);
|
||||
if (\is_array($normalized) || \is_object($normalized)) {
|
||||
if (\is_array($normalized)) {
|
||||
return $this->toJson($normalized, \true);
|
||||
}
|
||||
return $normalized;
|
||||
|
||||
+37
-11
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -17,18 +18,32 @@ use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
* @author Eric Clemmons (@ericclemmons) <eric@uxdriven.com>
|
||||
* @author Christophe Coevoet <stof@notk.org>
|
||||
* @author Kirill chEbba Chebunin <iam@chebba.org>
|
||||
*
|
||||
* @phpstan-import-type Level from \Monolog\Logger
|
||||
*/
|
||||
class WildfireFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerFormatter
|
||||
{
|
||||
const TABLE = 'table';
|
||||
/**
|
||||
* Translates Monolog log levels to Wildfire levels.
|
||||
*
|
||||
* @var array<Level, string>
|
||||
*/
|
||||
private $logLevels = array(\WPMailSMTP\Vendor\Monolog\Logger::DEBUG => 'LOG', \WPMailSMTP\Vendor\Monolog\Logger::INFO => 'INFO', \WPMailSMTP\Vendor\Monolog\Logger::NOTICE => 'INFO', \WPMailSMTP\Vendor\Monolog\Logger::WARNING => 'WARN', \WPMailSMTP\Vendor\Monolog\Logger::ERROR => 'ERROR', \WPMailSMTP\Vendor\Monolog\Logger::CRITICAL => 'ERROR', \WPMailSMTP\Vendor\Monolog\Logger::ALERT => 'ERROR', \WPMailSMTP\Vendor\Monolog\Logger::EMERGENCY => 'ERROR');
|
||||
private $logLevels = [\WPMailSMTP\Vendor\Monolog\Logger::DEBUG => 'LOG', \WPMailSMTP\Vendor\Monolog\Logger::INFO => 'INFO', \WPMailSMTP\Vendor\Monolog\Logger::NOTICE => 'INFO', \WPMailSMTP\Vendor\Monolog\Logger::WARNING => 'WARN', \WPMailSMTP\Vendor\Monolog\Logger::ERROR => 'ERROR', \WPMailSMTP\Vendor\Monolog\Logger::CRITICAL => 'ERROR', \WPMailSMTP\Vendor\Monolog\Logger::ALERT => 'ERROR', \WPMailSMTP\Vendor\Monolog\Logger::EMERGENCY => 'ERROR'];
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format
|
||||
*/
|
||||
public function format(array $record)
|
||||
public function __construct(?string $dateFormat = null)
|
||||
{
|
||||
parent::__construct($dateFormat);
|
||||
// http headers do not like non-ISO-8559-1 characters
|
||||
$this->removeJsonEncodeOption(\JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function format(array $record) : string
|
||||
{
|
||||
// Retrieve the line and file if set and remove them from the formatted extra
|
||||
$file = $line = '';
|
||||
@@ -40,8 +55,9 @@ class WildfireFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerF
|
||||
$line = $record['extra']['line'];
|
||||
unset($record['extra']['line']);
|
||||
}
|
||||
/** @var mixed[] $record */
|
||||
$record = $this->normalize($record);
|
||||
$message = array('message' => $record['message']);
|
||||
$message = ['message' => $record['message']];
|
||||
$handleError = \false;
|
||||
if ($record['context']) {
|
||||
$message['context'] = $record['context'];
|
||||
@@ -54,26 +70,36 @@ class WildfireFormatter extends \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerF
|
||||
if (\count($message) === 1) {
|
||||
$message = \reset($message);
|
||||
}
|
||||
if (isset($record['context'][self::TABLE])) {
|
||||
if (isset($record['context']['table'])) {
|
||||
$type = 'TABLE';
|
||||
$label = $record['channel'] . ': ' . $record['message'];
|
||||
$message = $record['context'][self::TABLE];
|
||||
$message = $record['context']['table'];
|
||||
} else {
|
||||
$type = $this->logLevels[$record['level']];
|
||||
$label = $record['channel'];
|
||||
}
|
||||
// Create JSON object describing the appearance of the message in the console
|
||||
$json = $this->toJson(array(array('Type' => $type, 'File' => $file, 'Line' => $line, 'Label' => $label), $message), $handleError);
|
||||
$json = $this->toJson([['Type' => $type, 'File' => $file, 'Line' => $line, 'Label' => $label], $message], $handleError);
|
||||
// The message itself is a serialization of the above JSON object + it's length
|
||||
return \sprintf('%s|%s|', \strlen($json), $json);
|
||||
return \sprintf('%d|%s|', \strlen($json), $json);
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @phpstan-return never
|
||||
*/
|
||||
public function formatBatch(array $records)
|
||||
{
|
||||
throw new \BadMethodCallException('Batch formatting does not make sense for the WildfireFormatter');
|
||||
}
|
||||
protected function normalize($data, $depth = 0)
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @return null|scalar|array<array|scalar|null>|object
|
||||
*/
|
||||
protected function normalize($data, int $depth = 0)
|
||||
{
|
||||
if (\is_object($data) && !$data instanceof \DateTime) {
|
||||
if (\is_object($data) && !$data instanceof \DateTimeInterface) {
|
||||
return $data;
|
||||
}
|
||||
return parent::normalize($data, $depth);
|
||||
|
||||
+27
-97
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -10,103 +11,51 @@
|
||||
*/
|
||||
namespace WPMailSMTP\Vendor\Monolog\Handler;
|
||||
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\LineFormatter;
|
||||
use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
use WPMailSMTP\Vendor\Monolog\ResettableInterface;
|
||||
use WPMailSMTP\Vendor\Psr\Log\LogLevel;
|
||||
/**
|
||||
* Base Handler class providing the Handler structure
|
||||
* Base Handler class providing basic level/bubble support
|
||||
*
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* @phpstan-import-type Level from \Monolog\Logger
|
||||
* @phpstan-import-type LevelName from \Monolog\Logger
|
||||
*/
|
||||
abstract class AbstractHandler implements \WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface, \WPMailSMTP\Vendor\Monolog\ResettableInterface
|
||||
abstract class AbstractHandler extends \WPMailSMTP\Vendor\Monolog\Handler\Handler implements \WPMailSMTP\Vendor\Monolog\ResettableInterface
|
||||
{
|
||||
protected $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG;
|
||||
protected $bubble = \true;
|
||||
/**
|
||||
* @var FormatterInterface
|
||||
* @var int
|
||||
* @phpstan-var Level
|
||||
*/
|
||||
protected $formatter;
|
||||
protected $processors = array();
|
||||
protected $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG;
|
||||
/** @var bool */
|
||||
protected $bubble = \true;
|
||||
/**
|
||||
* @param int|string $level The minimum logging level at which this handler will be triggered
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
*
|
||||
* @phpstan-param Level|LevelName|LogLevel::* $level
|
||||
*/
|
||||
public function __construct($level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, $bubble = \true)
|
||||
public function __construct($level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, bool $bubble = \true)
|
||||
{
|
||||
$this->setLevel($level);
|
||||
$this->bubble = $bubble;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function isHandling(array $record)
|
||||
public function isHandling(array $record) : bool
|
||||
{
|
||||
return $record['level'] >= $this->level;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function handleBatch(array $records)
|
||||
{
|
||||
foreach ($records as $record) {
|
||||
$this->handle($record);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Closes the handler.
|
||||
*
|
||||
* This will be called automatically when the object is destroyed
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function pushProcessor($callback)
|
||||
{
|
||||
if (!\is_callable($callback)) {
|
||||
throw new \InvalidArgumentException('Processors must be valid callables (callback or object with an __invoke method), ' . \var_export($callback, \true) . ' given');
|
||||
}
|
||||
\array_unshift($this->processors, $callback);
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function popProcessor()
|
||||
{
|
||||
if (!$this->processors) {
|
||||
throw new \LogicException('You tried to pop from an empty processor stack.');
|
||||
}
|
||||
return \array_shift($this->processors);
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setFormatter(\WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface $formatter)
|
||||
{
|
||||
$this->formatter = $formatter;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormatter()
|
||||
{
|
||||
if (!$this->formatter) {
|
||||
$this->formatter = $this->getDefaultFormatter();
|
||||
}
|
||||
return $this->formatter;
|
||||
}
|
||||
/**
|
||||
* Sets minimum logging level at which this handler will be triggered.
|
||||
*
|
||||
* @param int|string $level Level or level name
|
||||
* @param Level|LevelName|LogLevel::* $level Level or level name
|
||||
* @return self
|
||||
*/
|
||||
public function setLevel($level)
|
||||
public function setLevel($level) : self
|
||||
{
|
||||
$this->level = \WPMailSMTP\Vendor\Monolog\Logger::toMonologLevel($level);
|
||||
return $this;
|
||||
@@ -115,8 +64,10 @@ abstract class AbstractHandler implements \WPMailSMTP\Vendor\Monolog\Handler\Han
|
||||
* Gets minimum logging level at which this handler will be triggered.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @phpstan-return Level
|
||||
*/
|
||||
public function getLevel()
|
||||
public function getLevel() : int
|
||||
{
|
||||
return $this->level;
|
||||
}
|
||||
@@ -127,7 +78,7 @@ abstract class AbstractHandler implements \WPMailSMTP\Vendor\Monolog\Handler\Han
|
||||
* false means that bubbling is not permitted.
|
||||
* @return self
|
||||
*/
|
||||
public function setBubble($bubble)
|
||||
public function setBubble(bool $bubble) : self
|
||||
{
|
||||
$this->bubble = $bubble;
|
||||
return $this;
|
||||
@@ -138,35 +89,14 @@ abstract class AbstractHandler implements \WPMailSMTP\Vendor\Monolog\Handler\Han
|
||||
* @return bool true means that this handler allows bubbling.
|
||||
* false means that bubbling is not permitted.
|
||||
*/
|
||||
public function getBubble()
|
||||
public function getBubble() : bool
|
||||
{
|
||||
return $this->bubble;
|
||||
}
|
||||
public function __destruct()
|
||||
{
|
||||
try {
|
||||
$this->close();
|
||||
} catch (\Exception $e) {
|
||||
// do nothing
|
||||
} catch (\Throwable $e) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
foreach ($this->processors as $processor) {
|
||||
if ($processor instanceof \WPMailSMTP\Vendor\Monolog\ResettableInterface) {
|
||||
$processor->reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Gets the default formatter.
|
||||
*
|
||||
* @return FormatterInterface
|
||||
*/
|
||||
protected function getDefaultFormatter()
|
||||
{
|
||||
return new \WPMailSMTP\Vendor\Monolog\Formatter\LineFormatter();
|
||||
}
|
||||
}
|
||||
|
||||
+23
-21
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -10,26 +11,35 @@
|
||||
*/
|
||||
namespace WPMailSMTP\Vendor\Monolog\Handler;
|
||||
|
||||
use WPMailSMTP\Vendor\Monolog\ResettableInterface;
|
||||
/**
|
||||
* Base Handler class providing the Handler structure
|
||||
* Base Handler class providing the Handler structure, including processors and formatters
|
||||
*
|
||||
* Classes extending it should (in most cases) only implement write($record)
|
||||
*
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
* @author Christophe Coevoet <stof@notk.org>
|
||||
*
|
||||
* @phpstan-import-type LevelName from \Monolog\Logger
|
||||
* @phpstan-import-type Level from \Monolog\Logger
|
||||
* @phpstan-import-type Record from \Monolog\Logger
|
||||
* @phpstan-type FormattedRecord array{message: string, context: mixed[], level: Level, level_name: LevelName, channel: string, datetime: \DateTimeImmutable, extra: mixed[], formatted: mixed}
|
||||
*/
|
||||
abstract class AbstractProcessingHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractHandler
|
||||
abstract class AbstractProcessingHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractHandler implements \WPMailSMTP\Vendor\Monolog\Handler\ProcessableHandlerInterface, \WPMailSMTP\Vendor\Monolog\Handler\FormattableHandlerInterface
|
||||
{
|
||||
use ProcessableHandlerTrait;
|
||||
use FormattableHandlerTrait;
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function handle(array $record)
|
||||
public function handle(array $record) : bool
|
||||
{
|
||||
if (!$this->isHandling($record)) {
|
||||
return \false;
|
||||
}
|
||||
$record = $this->processRecord($record);
|
||||
if ($this->processors) {
|
||||
/** @var Record $record */
|
||||
$record = $this->processRecord($record);
|
||||
}
|
||||
$record['formatted'] = $this->getFormatter()->format($record);
|
||||
$this->write($record);
|
||||
return \false === $this->bubble;
|
||||
@@ -37,23 +47,15 @@ abstract class AbstractProcessingHandler extends \WPMailSMTP\Vendor\Monolog\Hand
|
||||
/**
|
||||
* Writes the record down to the log of the implementing handler
|
||||
*
|
||||
* @param array $record
|
||||
* @phpstan-param FormattedRecord $record
|
||||
*/
|
||||
protected abstract function write(array $record) : void;
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected abstract function write(array $record);
|
||||
/**
|
||||
* Processes a record.
|
||||
*
|
||||
* @param array $record
|
||||
* @return array
|
||||
*/
|
||||
protected function processRecord(array $record)
|
||||
public function reset()
|
||||
{
|
||||
if ($this->processors) {
|
||||
foreach ($this->processors as $processor) {
|
||||
$record = \call_user_func($processor, $record);
|
||||
}
|
||||
}
|
||||
return $record;
|
||||
parent::reset();
|
||||
$this->resetProcessors();
|
||||
}
|
||||
}
|
||||
|
||||
+15
-9
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -11,27 +12,32 @@
|
||||
namespace WPMailSMTP\Vendor\Monolog\Handler;
|
||||
|
||||
use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\LineFormatter;
|
||||
/**
|
||||
* Common syslog functionality
|
||||
*
|
||||
* @phpstan-import-type Level from \Monolog\Logger
|
||||
*/
|
||||
abstract class AbstractSyslogHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessingHandler
|
||||
{
|
||||
/** @var int */
|
||||
protected $facility;
|
||||
/**
|
||||
* Translates Monolog log levels to syslog log priorities.
|
||||
* @var array
|
||||
* @phpstan-var array<Level, int>
|
||||
*/
|
||||
protected $logLevels = array(\WPMailSMTP\Vendor\Monolog\Logger::DEBUG => \LOG_DEBUG, \WPMailSMTP\Vendor\Monolog\Logger::INFO => \LOG_INFO, \WPMailSMTP\Vendor\Monolog\Logger::NOTICE => \LOG_NOTICE, \WPMailSMTP\Vendor\Monolog\Logger::WARNING => \LOG_WARNING, \WPMailSMTP\Vendor\Monolog\Logger::ERROR => \LOG_ERR, \WPMailSMTP\Vendor\Monolog\Logger::CRITICAL => \LOG_CRIT, \WPMailSMTP\Vendor\Monolog\Logger::ALERT => \LOG_ALERT, \WPMailSMTP\Vendor\Monolog\Logger::EMERGENCY => \LOG_EMERG);
|
||||
protected $logLevels = [\WPMailSMTP\Vendor\Monolog\Logger::DEBUG => \LOG_DEBUG, \WPMailSMTP\Vendor\Monolog\Logger::INFO => \LOG_INFO, \WPMailSMTP\Vendor\Monolog\Logger::NOTICE => \LOG_NOTICE, \WPMailSMTP\Vendor\Monolog\Logger::WARNING => \LOG_WARNING, \WPMailSMTP\Vendor\Monolog\Logger::ERROR => \LOG_ERR, \WPMailSMTP\Vendor\Monolog\Logger::CRITICAL => \LOG_CRIT, \WPMailSMTP\Vendor\Monolog\Logger::ALERT => \LOG_ALERT, \WPMailSMTP\Vendor\Monolog\Logger::EMERGENCY => \LOG_EMERG];
|
||||
/**
|
||||
* List of valid log facility names.
|
||||
* @var array<string, int>
|
||||
*/
|
||||
protected $facilities = array('auth' => \LOG_AUTH, 'authpriv' => \LOG_AUTHPRIV, 'cron' => \LOG_CRON, 'daemon' => \LOG_DAEMON, 'kern' => \LOG_KERN, 'lpr' => \LOG_LPR, 'mail' => \LOG_MAIL, 'news' => \LOG_NEWS, 'syslog' => \LOG_SYSLOG, 'user' => \LOG_USER, 'uucp' => \LOG_UUCP);
|
||||
protected $facilities = ['auth' => \LOG_AUTH, 'authpriv' => \LOG_AUTHPRIV, 'cron' => \LOG_CRON, 'daemon' => \LOG_DAEMON, 'kern' => \LOG_KERN, 'lpr' => \LOG_LPR, 'mail' => \LOG_MAIL, 'news' => \LOG_NEWS, 'syslog' => \LOG_SYSLOG, 'user' => \LOG_USER, 'uucp' => \LOG_UUCP];
|
||||
/**
|
||||
* @param mixed $facility
|
||||
* @param int $level The minimum logging level at which this handler will be triggered
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
* @param string|int $facility Either one of the names of the keys in $this->facilities, or a LOG_* facility constant
|
||||
*/
|
||||
public function __construct($facility = \LOG_USER, $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, $bubble = \true)
|
||||
public function __construct($facility = \LOG_USER, $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, bool $bubble = \true)
|
||||
{
|
||||
parent::__construct($level, $bubble);
|
||||
if (!\defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
@@ -62,7 +68,7 @@ abstract class AbstractSyslogHandler extends \WPMailSMTP\Vendor\Monolog\Handler\
|
||||
// LOG_LOCAL7
|
||||
}
|
||||
// convert textual description of facility to syslog constant
|
||||
if (\array_key_exists(\strtolower($facility), $this->facilities)) {
|
||||
if (\is_string($facility) && \array_key_exists(\strtolower($facility), $this->facilities)) {
|
||||
$facility = $this->facilities[\strtolower($facility)];
|
||||
} elseif (!\in_array($facility, \array_values($this->facilities), \true)) {
|
||||
throw new \UnexpectedValueException('Unknown facility value "' . $facility . '" given');
|
||||
@@ -70,9 +76,9 @@ abstract class AbstractSyslogHandler extends \WPMailSMTP\Vendor\Monolog\Handler\
|
||||
$this->facility = $facility;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getDefaultFormatter()
|
||||
protected function getDefaultFormatter() : \WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface
|
||||
{
|
||||
return new \WPMailSMTP\Vendor\Monolog\Formatter\LineFormatter('%channel%.%level_name%: %message% %context% %extra%');
|
||||
}
|
||||
|
||||
+53
-28
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -11,34 +12,59 @@
|
||||
namespace WPMailSMTP\Vendor\Monolog\Handler;
|
||||
|
||||
use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\JsonFormatter;
|
||||
use WPMailSMTP\Vendor\PhpAmqpLib\Message\AMQPMessage;
|
||||
use WPMailSMTP\Vendor\PhpAmqpLib\Channel\AMQPChannel;
|
||||
use AMQPExchange;
|
||||
/**
|
||||
* @phpstan-import-type Record from \Monolog\Logger
|
||||
*/
|
||||
class AmqpHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessingHandler
|
||||
{
|
||||
/**
|
||||
* @var AMQPExchange|AMQPChannel $exchange
|
||||
*/
|
||||
protected $exchange;
|
||||
/** @var array<string, mixed> */
|
||||
private $extraAttributes = [];
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function getExtraAttributes() : array
|
||||
{
|
||||
return $this->extraAttributes;
|
||||
}
|
||||
/**
|
||||
* Configure extra attributes to pass to the AMQPExchange (if you are using the amqp extension)
|
||||
*
|
||||
* @param array<string, mixed> $extraAttributes One of content_type, content_encoding,
|
||||
* message_id, user_id, app_id, delivery_mode,
|
||||
* priority, timestamp, expiration, type
|
||||
* or reply_to, headers.
|
||||
* @return AmqpHandler
|
||||
*/
|
||||
public function setExtraAttributes(array $extraAttributes) : self
|
||||
{
|
||||
$this->extraAttributes = $extraAttributes;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $exchangeName;
|
||||
/**
|
||||
* @param AMQPExchange|AMQPChannel $exchange AMQPExchange (php AMQP ext) or PHP AMQP lib channel, ready for use
|
||||
* @param string $exchangeName
|
||||
* @param int $level
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
* @param string|null $exchangeName Optional exchange name, for AMQPChannel (PhpAmqpLib) only
|
||||
*/
|
||||
public function __construct($exchange, $exchangeName = 'log', $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, $bubble = \true)
|
||||
public function __construct($exchange, ?string $exchangeName = null, $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, bool $bubble = \true)
|
||||
{
|
||||
if ($exchange instanceof \AMQPExchange) {
|
||||
$exchange->setName($exchangeName);
|
||||
} elseif ($exchange instanceof \WPMailSMTP\Vendor\PhpAmqpLib\Channel\AMQPChannel) {
|
||||
$this->exchangeName = $exchangeName;
|
||||
} else {
|
||||
if ($exchange instanceof \WPMailSMTP\Vendor\PhpAmqpLib\Channel\AMQPChannel) {
|
||||
$this->exchangeName = (string) $exchangeName;
|
||||
} elseif (!$exchange instanceof \AMQPExchange) {
|
||||
throw new \InvalidArgumentException('PhpAmqpLib\\Channel\\AMQPChannel or AMQPExchange instance required');
|
||||
} elseif ($exchangeName) {
|
||||
@\trigger_error('The $exchangeName parameter can only be passed when using PhpAmqpLib, if using an AMQPExchange instance configure it beforehand', \E_USER_DEPRECATED);
|
||||
}
|
||||
$this->exchange = $exchange;
|
||||
parent::__construct($level, $bubble);
|
||||
@@ -46,12 +72,16 @@ class AmqpHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessingH
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function write(array $record)
|
||||
protected function write(array $record) : void
|
||||
{
|
||||
$data = $record["formatted"];
|
||||
$routingKey = $this->getRoutingKey($record);
|
||||
if ($this->exchange instanceof \AMQPExchange) {
|
||||
$this->exchange->publish($data, $routingKey, 0, array('delivery_mode' => 2, 'content_type' => 'application/json'));
|
||||
$attributes = ['delivery_mode' => 2, 'content_type' => 'application/json'];
|
||||
if ($this->extraAttributes) {
|
||||
$attributes = \array_merge($attributes, $this->extraAttributes);
|
||||
}
|
||||
$this->exchange->publish($data, $routingKey, 0, $attributes);
|
||||
} else {
|
||||
$this->exchange->basic_publish($this->createAmqpMessage($data), $this->exchangeName, $routingKey);
|
||||
}
|
||||
@@ -59,7 +89,7 @@ class AmqpHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessingH
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function handleBatch(array $records)
|
||||
public function handleBatch(array $records) : void
|
||||
{
|
||||
if ($this->exchange instanceof \AMQPExchange) {
|
||||
parent::handleBatch($records);
|
||||
@@ -69,6 +99,7 @@ class AmqpHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessingH
|
||||
if (!$this->isHandling($record)) {
|
||||
continue;
|
||||
}
|
||||
/** @var Record $record */
|
||||
$record = $this->processRecord($record);
|
||||
$data = $this->getFormatter()->format($record);
|
||||
$this->exchange->batch_basic_publish($this->createAmqpMessage($data), $this->exchangeName, $this->getRoutingKey($record));
|
||||
@@ -78,31 +109,25 @@ class AmqpHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessingH
|
||||
/**
|
||||
* Gets the routing key for the AMQP exchange
|
||||
*
|
||||
* @param array $record
|
||||
* @return string
|
||||
* @phpstan-param Record $record
|
||||
*/
|
||||
protected function getRoutingKey(array $record)
|
||||
protected function getRoutingKey(array $record) : string
|
||||
{
|
||||
$routingKey = \sprintf(
|
||||
'%s.%s',
|
||||
// TODO 2.0 remove substr call
|
||||
\substr($record['level_name'], 0, 4),
|
||||
$record['channel']
|
||||
);
|
||||
$routingKey = \sprintf('%s.%s', $record['level_name'], $record['channel']);
|
||||
return \strtolower($routingKey);
|
||||
}
|
||||
/**
|
||||
* @param string $data
|
||||
* @return AMQPMessage
|
||||
*/
|
||||
private function createAmqpMessage($data)
|
||||
private function createAmqpMessage(string $data) : \WPMailSMTP\Vendor\PhpAmqpLib\Message\AMQPMessage
|
||||
{
|
||||
return new \WPMailSMTP\Vendor\PhpAmqpLib\Message\AMQPMessage((string) $data, array('delivery_mode' => 2, 'content_type' => 'application/json'));
|
||||
$attributes = ['delivery_mode' => 2, 'content_type' => 'application/json'];
|
||||
if ($this->extraAttributes) {
|
||||
$attributes = \array_merge($attributes, $this->extraAttributes);
|
||||
}
|
||||
return new \WPMailSMTP\Vendor\PhpAmqpLib\Message\AMQPMessage($data, $attributes);
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getDefaultFormatter()
|
||||
protected function getDefaultFormatter() : \WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface
|
||||
{
|
||||
return new \WPMailSMTP\Vendor\Monolog\Formatter\JsonFormatter(\WPMailSMTP\Vendor\Monolog\Formatter\JsonFormatter::BATCH_MODE_JSON, \false);
|
||||
}
|
||||
|
||||
+92
-44
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -10,16 +11,31 @@
|
||||
*/
|
||||
namespace WPMailSMTP\Vendor\Monolog\Handler;
|
||||
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\LineFormatter;
|
||||
use WPMailSMTP\Vendor\Monolog\Utils;
|
||||
use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
use function count;
|
||||
use function headers_list;
|
||||
use function stripos;
|
||||
use function trigger_error;
|
||||
use const E_USER_DEPRECATED;
|
||||
/**
|
||||
* Handler sending logs to browser's javascript console with no browser extension required
|
||||
*
|
||||
* @author Olivier Poitrey <rs@dailymotion.com>
|
||||
*
|
||||
* @phpstan-import-type FormattedRecord from AbstractProcessingHandler
|
||||
*/
|
||||
class BrowserConsoleHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessingHandler
|
||||
{
|
||||
/** @var bool */
|
||||
protected static $initialized = \false;
|
||||
protected static $records = array();
|
||||
/** @var FormattedRecord[] */
|
||||
protected static $records = [];
|
||||
protected const FORMAT_HTML = 'html';
|
||||
protected const FORMAT_JS = 'js';
|
||||
protected const FORMAT_UNKNOWN = 'unknown';
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
@@ -29,14 +45,14 @@ class BrowserConsoleHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractP
|
||||
*
|
||||
* You can do [[blue text]]{color: blue} or [[green background]]{background-color: green; color: white}
|
||||
*/
|
||||
protected function getDefaultFormatter()
|
||||
protected function getDefaultFormatter() : \WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface
|
||||
{
|
||||
return new \WPMailSMTP\Vendor\Monolog\Formatter\LineFormatter('[[%channel%]]{macro: autolabel} [[%level_name%]]{font-weight: bold} %message%');
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function write(array $record)
|
||||
protected function write(array $record) : void
|
||||
{
|
||||
// Accumulate records
|
||||
static::$records[] = $record;
|
||||
@@ -50,51 +66,50 @@ class BrowserConsoleHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractP
|
||||
* Convert records to javascript console commands and send it to the browser.
|
||||
* This method is automatically called on PHP shutdown if output is HTML or Javascript.
|
||||
*/
|
||||
public static function send()
|
||||
public static function send() : void
|
||||
{
|
||||
$format = static::getResponseFormat();
|
||||
if ($format === 'unknown') {
|
||||
if ($format === self::FORMAT_UNKNOWN) {
|
||||
return;
|
||||
}
|
||||
if (\count(static::$records)) {
|
||||
if ($format === 'html') {
|
||||
if ($format === self::FORMAT_HTML) {
|
||||
static::writeOutput('<script>' . static::generateScript() . '</script>');
|
||||
} elseif ($format === 'js') {
|
||||
} elseif ($format === self::FORMAT_JS) {
|
||||
static::writeOutput(static::generateScript());
|
||||
}
|
||||
static::resetStatic();
|
||||
}
|
||||
}
|
||||
public function close()
|
||||
public function close() : void
|
||||
{
|
||||
self::resetStatic();
|
||||
}
|
||||
public function reset()
|
||||
{
|
||||
parent::reset();
|
||||
self::resetStatic();
|
||||
}
|
||||
/**
|
||||
* Forget all logged records
|
||||
*/
|
||||
public static function resetStatic()
|
||||
public static function resetStatic() : void
|
||||
{
|
||||
static::$records = array();
|
||||
static::$records = [];
|
||||
}
|
||||
/**
|
||||
* Wrapper for register_shutdown_function to allow overriding
|
||||
*/
|
||||
protected function registerShutdownFunction()
|
||||
protected function registerShutdownFunction() : void
|
||||
{
|
||||
if (\PHP_SAPI !== 'cli') {
|
||||
\register_shutdown_function(array('WPMailSMTP\\Vendor\\Monolog\\Handler\\BrowserConsoleHandler', 'send'));
|
||||
\register_shutdown_function(['WPMailSMTP\\Vendor\\Monolog\\Handler\\BrowserConsoleHandler', 'send']);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Wrapper for echo to allow overriding
|
||||
*
|
||||
* @param string $str
|
||||
*/
|
||||
protected static function writeOutput($str)
|
||||
protected static function writeOutput(string $str) : void
|
||||
{
|
||||
echo $str;
|
||||
}
|
||||
@@ -106,59 +121,75 @@ class BrowserConsoleHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractP
|
||||
* If Content-Type is anything else -> unknown
|
||||
*
|
||||
* @return string One of 'js', 'html' or 'unknown'
|
||||
* @phpstan-return self::FORMAT_*
|
||||
*/
|
||||
protected static function getResponseFormat()
|
||||
protected static function getResponseFormat() : string
|
||||
{
|
||||
// Check content type
|
||||
foreach (\headers_list() as $header) {
|
||||
if (\stripos($header, 'content-type:') === 0) {
|
||||
// This handler only works with HTML and javascript outputs
|
||||
// text/javascript is obsolete in favour of application/javascript, but still used
|
||||
if (\stripos($header, 'application/javascript') !== \false || \stripos($header, 'text/javascript') !== \false) {
|
||||
return 'js';
|
||||
}
|
||||
if (\stripos($header, 'text/html') === \false) {
|
||||
return 'unknown';
|
||||
}
|
||||
break;
|
||||
return static::getResponseFormatFromContentType($header);
|
||||
}
|
||||
}
|
||||
return 'html';
|
||||
return self::FORMAT_HTML;
|
||||
}
|
||||
private static function generateScript()
|
||||
/**
|
||||
* @return string One of 'js', 'html' or 'unknown'
|
||||
* @phpstan-return self::FORMAT_*
|
||||
*/
|
||||
protected static function getResponseFormatFromContentType(string $contentType) : string
|
||||
{
|
||||
$script = array();
|
||||
// This handler only works with HTML and javascript outputs
|
||||
// text/javascript is obsolete in favour of application/javascript, but still used
|
||||
if (\stripos($contentType, 'application/javascript') !== \false || \stripos($contentType, 'text/javascript') !== \false) {
|
||||
return self::FORMAT_JS;
|
||||
}
|
||||
if (\stripos($contentType, 'text/html') !== \false) {
|
||||
return self::FORMAT_HTML;
|
||||
}
|
||||
return self::FORMAT_UNKNOWN;
|
||||
}
|
||||
private static function generateScript() : string
|
||||
{
|
||||
$script = [];
|
||||
foreach (static::$records as $record) {
|
||||
$context = static::dump('Context', $record['context']);
|
||||
$extra = static::dump('Extra', $record['extra']);
|
||||
if (empty($context) && empty($extra)) {
|
||||
$script[] = static::call_array('log', static::handleStyles($record['formatted']));
|
||||
$script[] = static::call_array(static::getConsoleMethodForLevel($record['level']), static::handleStyles($record['formatted']));
|
||||
} else {
|
||||
$script = \array_merge($script, array(static::call_array('groupCollapsed', static::handleStyles($record['formatted']))), $context, $extra, array(static::call('groupEnd')));
|
||||
$script = \array_merge($script, [static::call_array('groupCollapsed', static::handleStyles($record['formatted']))], $context, $extra, [static::call('groupEnd')]);
|
||||
}
|
||||
}
|
||||
return "(function (c) {if (c && c.groupCollapsed) {\n" . \implode("\n", $script) . "\n}})(console);";
|
||||
}
|
||||
private static function handleStyles($formatted)
|
||||
private static function getConsoleMethodForLevel(int $level) : string
|
||||
{
|
||||
$args = array();
|
||||
return [\WPMailSMTP\Vendor\Monolog\Logger::DEBUG => 'debug', \WPMailSMTP\Vendor\Monolog\Logger::INFO => 'info', \WPMailSMTP\Vendor\Monolog\Logger::NOTICE => 'info', \WPMailSMTP\Vendor\Monolog\Logger::WARNING => 'warn', \WPMailSMTP\Vendor\Monolog\Logger::ERROR => 'error', \WPMailSMTP\Vendor\Monolog\Logger::CRITICAL => 'error', \WPMailSMTP\Vendor\Monolog\Logger::ALERT => 'error', \WPMailSMTP\Vendor\Monolog\Logger::EMERGENCY => 'error'][$level] ?? 'log';
|
||||
}
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
private static function handleStyles(string $formatted) : array
|
||||
{
|
||||
$args = [];
|
||||
$format = '%c' . $formatted;
|
||||
\preg_match_all('/\\[\\[(.*?)\\]\\]\\{([^}]*)\\}/s', $format, $matches, \PREG_OFFSET_CAPTURE | \PREG_SET_ORDER);
|
||||
foreach (\array_reverse($matches) as $match) {
|
||||
$args[] = '"font-weight: normal"';
|
||||
$args[] = static::quote(static::handleCustomStyles($match[2][0], $match[1][0]));
|
||||
$pos = $match[0][1];
|
||||
$format = \substr($format, 0, $pos) . '%c' . $match[1][0] . '%c' . \substr($format, $pos + \strlen($match[0][0]));
|
||||
$format = \WPMailSMTP\Vendor\Monolog\Utils::substr($format, 0, $pos) . '%c' . $match[1][0] . '%c' . \WPMailSMTP\Vendor\Monolog\Utils::substr($format, $pos + \strlen($match[0][0]));
|
||||
}
|
||||
$args[] = static::quote('font-weight: normal');
|
||||
$args[] = static::quote($format);
|
||||
return \array_reverse($args);
|
||||
}
|
||||
private static function handleCustomStyles($style, $string)
|
||||
private static function handleCustomStyles(string $style, string $string) : string
|
||||
{
|
||||
static $colors = array('blue', 'green', 'red', 'magenta', 'orange', 'black', 'grey');
|
||||
static $labels = array();
|
||||
return \preg_replace_callback('/macro\\s*:(.*?)(?:;|$)/', function ($m) use($string, &$colors, &$labels) {
|
||||
static $colors = ['blue', 'green', 'red', 'magenta', 'orange', 'black', 'grey'];
|
||||
static $labels = [];
|
||||
$style = \preg_replace_callback('/macro\\s*:(.*?)(?:;|$)/', function (array $m) use($string, &$colors, &$labels) {
|
||||
if (\trim($m[1]) === 'autolabel') {
|
||||
// Format the string as a label with consistent auto assigned background color
|
||||
if (!isset($labels[$string])) {
|
||||
@@ -169,10 +200,19 @@ class BrowserConsoleHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractP
|
||||
}
|
||||
return $m[1];
|
||||
}, $style);
|
||||
if (null === $style) {
|
||||
$pcreErrorCode = \preg_last_error();
|
||||
throw new \RuntimeException('Failed to run preg_replace_callback: ' . $pcreErrorCode . ' / ' . \WPMailSMTP\Vendor\Monolog\Utils::pcreLastErrorMessage($pcreErrorCode));
|
||||
}
|
||||
return $style;
|
||||
}
|
||||
private static function dump($title, array $dict)
|
||||
/**
|
||||
* @param mixed[] $dict
|
||||
* @return mixed[]
|
||||
*/
|
||||
private static function dump(string $title, array $dict) : array
|
||||
{
|
||||
$script = array();
|
||||
$script = [];
|
||||
$dict = \array_filter($dict);
|
||||
if (empty($dict)) {
|
||||
return $script;
|
||||
@@ -183,21 +223,29 @@ class BrowserConsoleHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractP
|
||||
if (empty($value)) {
|
||||
$value = static::quote('');
|
||||
}
|
||||
$script[] = static::call('log', static::quote('%s: %o'), static::quote($key), $value);
|
||||
$script[] = static::call('log', static::quote('%s: %o'), static::quote((string) $key), $value);
|
||||
}
|
||||
return $script;
|
||||
}
|
||||
private static function quote($arg)
|
||||
private static function quote(string $arg) : string
|
||||
{
|
||||
return '"' . \addcslashes($arg, "\"\n\\") . '"';
|
||||
}
|
||||
private static function call()
|
||||
/**
|
||||
* @param mixed $args
|
||||
*/
|
||||
private static function call(...$args) : string
|
||||
{
|
||||
$args = \func_get_args();
|
||||
$method = \array_shift($args);
|
||||
if (!\is_string($method)) {
|
||||
throw new \UnexpectedValueException('Expected the first arg to be a string, got: ' . \var_export($method, \true));
|
||||
}
|
||||
return static::call_array($method, $args);
|
||||
}
|
||||
private static function call_array($method, array $args)
|
||||
/**
|
||||
* @param mixed[] $args
|
||||
*/
|
||||
private static function call_array(string $method, array $args) : string
|
||||
{
|
||||
return 'c.' . $method . '(' . \implode(', ', $args) . ');';
|
||||
}
|
||||
|
||||
+39
-24
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -20,40 +21,47 @@ use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
* sending one per log message.
|
||||
*
|
||||
* @author Christophe Coevoet <stof@notk.org>
|
||||
*
|
||||
* @phpstan-import-type Record from \Monolog\Logger
|
||||
*/
|
||||
class BufferHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractHandler
|
||||
class BufferHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractHandler implements \WPMailSMTP\Vendor\Monolog\Handler\ProcessableHandlerInterface, \WPMailSMTP\Vendor\Monolog\Handler\FormattableHandlerInterface
|
||||
{
|
||||
use ProcessableHandlerTrait;
|
||||
/** @var HandlerInterface */
|
||||
protected $handler;
|
||||
/** @var int */
|
||||
protected $bufferSize = 0;
|
||||
/** @var int */
|
||||
protected $bufferLimit;
|
||||
/** @var bool */
|
||||
protected $flushOnOverflow;
|
||||
protected $buffer = array();
|
||||
/** @var Record[] */
|
||||
protected $buffer = [];
|
||||
/** @var bool */
|
||||
protected $initialized = \false;
|
||||
/**
|
||||
* @param HandlerInterface $handler Handler.
|
||||
* @param int $bufferLimit How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
|
||||
* @param int $level The minimum logging level at which this handler will be triggered
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
* @param bool $flushOnOverflow If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded
|
||||
*/
|
||||
public function __construct(\WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface $handler, $bufferLimit = 0, $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, $bubble = \true, $flushOnOverflow = \false)
|
||||
public function __construct(\WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface $handler, int $bufferLimit = 0, $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, bool $bubble = \true, bool $flushOnOverflow = \false)
|
||||
{
|
||||
parent::__construct($level, $bubble);
|
||||
$this->handler = $handler;
|
||||
$this->bufferLimit = (int) $bufferLimit;
|
||||
$this->bufferLimit = $bufferLimit;
|
||||
$this->flushOnOverflow = $flushOnOverflow;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function handle(array $record)
|
||||
public function handle(array $record) : bool
|
||||
{
|
||||
if ($record['level'] < $this->level) {
|
||||
return \false;
|
||||
}
|
||||
if (!$this->initialized) {
|
||||
// __destructor() doesn't get called on Fatal errors
|
||||
\register_shutdown_function(array($this, 'close'));
|
||||
\register_shutdown_function([$this, 'close']);
|
||||
$this->initialized = \true;
|
||||
}
|
||||
if ($this->bufferLimit > 0 && $this->bufferSize === $this->bufferLimit) {
|
||||
@@ -65,15 +73,14 @@ class BufferHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractHandler
|
||||
}
|
||||
}
|
||||
if ($this->processors) {
|
||||
foreach ($this->processors as $processor) {
|
||||
$record = \call_user_func($processor, $record);
|
||||
}
|
||||
/** @var Record $record */
|
||||
$record = $this->processRecord($record);
|
||||
}
|
||||
$this->buffer[] = $record;
|
||||
$this->bufferSize++;
|
||||
return \false === $this->bubble;
|
||||
}
|
||||
public function flush()
|
||||
public function flush() : void
|
||||
{
|
||||
if ($this->bufferSize === 0) {
|
||||
return;
|
||||
@@ -88,41 +95,49 @@ class BufferHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractHandler
|
||||
// GC'd until the end of the request
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function close()
|
||||
public function close() : void
|
||||
{
|
||||
$this->flush();
|
||||
$this->handler->close();
|
||||
}
|
||||
/**
|
||||
* Clears the buffer without flushing any messages down to the wrapped handler.
|
||||
*/
|
||||
public function clear()
|
||||
public function clear() : void
|
||||
{
|
||||
$this->bufferSize = 0;
|
||||
$this->buffer = array();
|
||||
$this->buffer = [];
|
||||
}
|
||||
public function reset()
|
||||
{
|
||||
$this->flush();
|
||||
parent::reset();
|
||||
$this->resetProcessors();
|
||||
if ($this->handler instanceof \WPMailSMTP\Vendor\Monolog\ResettableInterface) {
|
||||
$this->handler->reset();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setFormatter(\WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface $formatter)
|
||||
public function setFormatter(\WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface $formatter) : \WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface
|
||||
{
|
||||
$this->handler->setFormatter($formatter);
|
||||
return $this;
|
||||
if ($this->handler instanceof \WPMailSMTP\Vendor\Monolog\Handler\FormattableHandlerInterface) {
|
||||
$this->handler->setFormatter($formatter);
|
||||
return $this;
|
||||
}
|
||||
throw new \UnexpectedValueException('The nested handler of type ' . \get_class($this->handler) . ' does not support formatters.');
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getFormatter()
|
||||
public function getFormatter() : \WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface
|
||||
{
|
||||
return $this->handler->getFormatter();
|
||||
if ($this->handler instanceof \WPMailSMTP\Vendor\Monolog\Handler\FormattableHandlerInterface) {
|
||||
return $this->handler->getFormatter();
|
||||
}
|
||||
throw new \UnexpectedValueException('The nested handler of type ' . \get_class($this->handler) . ' does not support formatters.');
|
||||
}
|
||||
}
|
||||
|
||||
+38
-52
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -11,6 +12,7 @@
|
||||
namespace WPMailSMTP\Vendor\Monolog\Handler;
|
||||
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\ChromePHPFormatter;
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
use WPMailSMTP\Vendor\Monolog\Utils;
|
||||
/**
|
||||
@@ -19,21 +21,25 @@ use WPMailSMTP\Vendor\Monolog\Utils;
|
||||
* This also works out of the box with Firefox 43+
|
||||
*
|
||||
* @author Christophe Coevoet <stof@notk.org>
|
||||
*
|
||||
* @phpstan-import-type Record from \Monolog\Logger
|
||||
*/
|
||||
class ChromePHPHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessingHandler
|
||||
{
|
||||
use WebRequestRecognizerTrait;
|
||||
/**
|
||||
* Version of the extension
|
||||
*/
|
||||
const VERSION = '4.0';
|
||||
protected const VERSION = '4.0';
|
||||
/**
|
||||
* Header name
|
||||
*/
|
||||
const HEADER_NAME = 'X-ChromeLogger-Data';
|
||||
protected const HEADER_NAME = 'X-ChromeLogger-Data';
|
||||
/**
|
||||
* Regular expression to detect supported browsers (matches any Chrome, or Firefox 43+)
|
||||
*/
|
||||
const USER_AGENT_REGEX = '{\\b(?:Chrome/\\d+(?:\\.\\d+)*|HeadlessChrome|Firefox/(?:4[3-9]|[5-9]\\d|\\d{3,})(?:\\.\\d)*)\\b}';
|
||||
protected const USER_AGENT_REGEX = '{\\b(?:Chrome/\\d+(?:\\.\\d+)*|HeadlessChrome|Firefox/(?:4[3-9]|[5-9]\\d|\\d{3,})(?:\\.\\d)*)\\b}';
|
||||
/** @var bool */
|
||||
protected static $initialized = \false;
|
||||
/**
|
||||
* Tracks whether we sent too much data
|
||||
@@ -43,13 +49,11 @@ class ChromePHPHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProces
|
||||
* @var bool
|
||||
*/
|
||||
protected static $overflowed = \false;
|
||||
protected static $json = array('version' => self::VERSION, 'columns' => array('label', 'log', 'backtrace', 'type'), 'rows' => array());
|
||||
/** @var mixed[] */
|
||||
protected static $json = ['version' => self::VERSION, 'columns' => ['label', 'log', 'backtrace', 'type'], 'rows' => []];
|
||||
/** @var bool */
|
||||
protected static $sendHeaders = \true;
|
||||
/**
|
||||
* @param int $level The minimum logging level at which this handler will be triggered
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
*/
|
||||
public function __construct($level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, $bubble = \true)
|
||||
public function __construct($level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, bool $bubble = \true)
|
||||
{
|
||||
parent::__construct($level, $bubble);
|
||||
if (!\function_exists('json_encode')) {
|
||||
@@ -57,16 +61,21 @@ class ChromePHPHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProces
|
||||
}
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function handleBatch(array $records)
|
||||
public function handleBatch(array $records) : void
|
||||
{
|
||||
$messages = array();
|
||||
if (!$this->isWebRequest()) {
|
||||
return;
|
||||
}
|
||||
$messages = [];
|
||||
foreach ($records as $record) {
|
||||
if ($record['level'] < $this->level) {
|
||||
continue;
|
||||
}
|
||||
$messages[] = $this->processRecord($record);
|
||||
/** @var Record $message */
|
||||
$message = $this->processRecord($record);
|
||||
$messages[] = $message;
|
||||
}
|
||||
if (!empty($messages)) {
|
||||
$messages = $this->getFormatter()->formatBatch($messages);
|
||||
@@ -77,7 +86,7 @@ class ChromePHPHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProces
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getDefaultFormatter()
|
||||
protected function getDefaultFormatter() : \WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface
|
||||
{
|
||||
return new \WPMailSMTP\Vendor\Monolog\Formatter\ChromePHPFormatter();
|
||||
}
|
||||
@@ -86,10 +95,12 @@ class ChromePHPHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProces
|
||||
*
|
||||
* @see sendHeader()
|
||||
* @see send()
|
||||
* @param array $record
|
||||
*/
|
||||
protected function write(array $record)
|
||||
protected function write(array $record) : void
|
||||
{
|
||||
if (!$this->isWebRequest()) {
|
||||
return;
|
||||
}
|
||||
self::$json['rows'][] = $record['formatted'];
|
||||
$this->send();
|
||||
}
|
||||
@@ -98,7 +109,7 @@ class ChromePHPHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProces
|
||||
*
|
||||
* @see sendHeader()
|
||||
*/
|
||||
protected function send()
|
||||
protected function send() : void
|
||||
{
|
||||
if (self::$overflowed || !self::$sendHeaders) {
|
||||
return;
|
||||
@@ -109,28 +120,25 @@ class ChromePHPHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProces
|
||||
if (!self::$sendHeaders) {
|
||||
return;
|
||||
}
|
||||
self::$json['request_uri'] = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
|
||||
self::$json['request_uri'] = $_SERVER['REQUEST_URI'] ?? '';
|
||||
}
|
||||
$json = \WPMailSMTP\Vendor\Monolog\Utils::jsonEncode(self::$json, null, \true);
|
||||
$data = \base64_encode(\utf8_encode($json));
|
||||
$json = \WPMailSMTP\Vendor\Monolog\Utils::jsonEncode(self::$json, \WPMailSMTP\Vendor\Monolog\Utils::DEFAULT_JSON_FLAGS & ~\JSON_UNESCAPED_UNICODE, \true);
|
||||
$data = \base64_encode($json);
|
||||
if (\strlen($data) > 3 * 1024) {
|
||||
self::$overflowed = \true;
|
||||
$record = array('message' => 'Incomplete logs, chrome header size limit reached', 'context' => array(), 'level' => \WPMailSMTP\Vendor\Monolog\Logger::WARNING, 'level_name' => \WPMailSMTP\Vendor\Monolog\Logger::getLevelName(\WPMailSMTP\Vendor\Monolog\Logger::WARNING), 'channel' => 'monolog', 'datetime' => new \DateTime(), 'extra' => array());
|
||||
$record = ['message' => 'Incomplete logs, chrome header size limit reached', 'context' => [], 'level' => \WPMailSMTP\Vendor\Monolog\Logger::WARNING, 'level_name' => \WPMailSMTP\Vendor\Monolog\Logger::getLevelName(\WPMailSMTP\Vendor\Monolog\Logger::WARNING), 'channel' => 'monolog', 'datetime' => new \DateTimeImmutable(), 'extra' => []];
|
||||
self::$json['rows'][\count(self::$json['rows']) - 1] = $this->getFormatter()->format($record);
|
||||
$json = \WPMailSMTP\Vendor\Monolog\Utils::jsonEncode(self::$json, null, \true);
|
||||
$data = \base64_encode(\utf8_encode($json));
|
||||
$json = \WPMailSMTP\Vendor\Monolog\Utils::jsonEncode(self::$json, \WPMailSMTP\Vendor\Monolog\Utils::DEFAULT_JSON_FLAGS & ~\JSON_UNESCAPED_UNICODE, \true);
|
||||
$data = \base64_encode($json);
|
||||
}
|
||||
if (\trim($data) !== '') {
|
||||
$this->sendHeader(self::HEADER_NAME, $data);
|
||||
$this->sendHeader(static::HEADER_NAME, $data);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Send header string to the client
|
||||
*
|
||||
* @param string $header
|
||||
* @param string $content
|
||||
*/
|
||||
protected function sendHeader($header, $content)
|
||||
protected function sendHeader(string $header, string $content) : void
|
||||
{
|
||||
if (!\headers_sent() && self::$sendHeaders) {
|
||||
\header(\sprintf('%s: %s', $header, $content));
|
||||
@@ -138,34 +146,12 @@ class ChromePHPHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProces
|
||||
}
|
||||
/**
|
||||
* Verifies if the headers are accepted by the current user agent
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function headersAccepted()
|
||||
protected function headersAccepted() : bool
|
||||
{
|
||||
if (empty($_SERVER['HTTP_USER_AGENT'])) {
|
||||
return \false;
|
||||
}
|
||||
return \preg_match(self::USER_AGENT_REGEX, $_SERVER['HTTP_USER_AGENT']);
|
||||
}
|
||||
/**
|
||||
* BC getter for the sendHeaders property that has been made static
|
||||
*/
|
||||
public function __get($property)
|
||||
{
|
||||
if ('sendHeaders' !== $property) {
|
||||
throw new \InvalidArgumentException('Undefined property ' . $property);
|
||||
}
|
||||
return static::$sendHeaders;
|
||||
}
|
||||
/**
|
||||
* BC setter for the sendHeaders property that has been made static
|
||||
*/
|
||||
public function __set($property, $value)
|
||||
{
|
||||
if ('sendHeaders' !== $property) {
|
||||
throw new \InvalidArgumentException('Undefined property ' . $property);
|
||||
}
|
||||
static::$sendHeaders = $value;
|
||||
return \preg_match(static::USER_AGENT_REGEX, $_SERVER['HTTP_USER_AGENT']) === 1;
|
||||
}
|
||||
}
|
||||
|
||||
+12
-6
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -10,6 +11,7 @@
|
||||
*/
|
||||
namespace WPMailSMTP\Vendor\Monolog\Handler;
|
||||
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\JsonFormatter;
|
||||
use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
/**
|
||||
@@ -19,31 +21,35 @@ use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
*/
|
||||
class CouchDBHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessingHandler
|
||||
{
|
||||
/** @var mixed[] */
|
||||
private $options;
|
||||
public function __construct(array $options = array(), $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, $bubble = \true)
|
||||
/**
|
||||
* @param mixed[] $options
|
||||
*/
|
||||
public function __construct(array $options = [], $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, bool $bubble = \true)
|
||||
{
|
||||
$this->options = \array_merge(array('host' => 'localhost', 'port' => 5984, 'dbname' => 'logger', 'username' => null, 'password' => null), $options);
|
||||
$this->options = \array_merge(['host' => 'localhost', 'port' => 5984, 'dbname' => 'logger', 'username' => null, 'password' => null], $options);
|
||||
parent::__construct($level, $bubble);
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function write(array $record)
|
||||
protected function write(array $record) : void
|
||||
{
|
||||
$basicAuth = null;
|
||||
if ($this->options['username']) {
|
||||
$basicAuth = \sprintf('%s:%s@', $this->options['username'], $this->options['password']);
|
||||
}
|
||||
$url = 'http://' . $basicAuth . $this->options['host'] . ':' . $this->options['port'] . '/' . $this->options['dbname'];
|
||||
$context = \stream_context_create(array('http' => array('method' => 'POST', 'content' => $record['formatted'], 'ignore_errors' => \true, 'max_redirects' => 0, 'header' => 'Content-type: application/json')));
|
||||
if (\false === @\file_get_contents($url, null, $context)) {
|
||||
$context = \stream_context_create(['http' => ['method' => 'POST', 'content' => $record['formatted'], 'ignore_errors' => \true, 'max_redirects' => 0, 'header' => 'Content-type: application/json']]);
|
||||
if (\false === @\file_get_contents($url, \false, $context)) {
|
||||
throw new \RuntimeException(\sprintf('Could not connect to %s', $url));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getDefaultFormatter()
|
||||
protected function getDefaultFormatter() : \WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface
|
||||
{
|
||||
return new \WPMailSMTP\Vendor\Monolog\Formatter\JsonFormatter(\WPMailSMTP\Vendor\Monolog\Formatter\JsonFormatter::BATCH_MODE_JSON, \false);
|
||||
}
|
||||
|
||||
+37
-22
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -15,17 +16,24 @@ use WPMailSMTP\Vendor\Monolog\Utils;
|
||||
/**
|
||||
* Logs to Cube.
|
||||
*
|
||||
* @link http://square.github.com/cube/
|
||||
* @link https://github.com/square/cube/wiki
|
||||
* @author Wan Chen <kami@kamisama.me>
|
||||
* @deprecated Since 2.8.0 and 3.2.0, Cube appears abandoned and thus we will drop this handler in Monolog 4
|
||||
*/
|
||||
class CubeHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessingHandler
|
||||
{
|
||||
private $udpConnection;
|
||||
private $httpConnection;
|
||||
/** @var resource|\Socket|null */
|
||||
private $udpConnection = null;
|
||||
/** @var resource|\CurlHandle|null */
|
||||
private $httpConnection = null;
|
||||
/** @var string */
|
||||
private $scheme;
|
||||
/** @var string */
|
||||
private $host;
|
||||
/** @var int */
|
||||
private $port;
|
||||
private $acceptedSchemes = array('http', 'udp');
|
||||
/** @var string[] */
|
||||
private $acceptedSchemes = ['http', 'udp'];
|
||||
/**
|
||||
* Create a Cube handler
|
||||
*
|
||||
@@ -33,10 +41,10 @@ class CubeHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessingH
|
||||
* A valid url must consist of three parts : protocol://host:port
|
||||
* Only valid protocols used by Cube are http and udp
|
||||
*/
|
||||
public function __construct($url, $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, $bubble = \true)
|
||||
public function __construct(string $url, $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, bool $bubble = \true)
|
||||
{
|
||||
$urlInfo = \parse_url($url);
|
||||
if (!isset($urlInfo['scheme'], $urlInfo['host'], $urlInfo['port'])) {
|
||||
if ($urlInfo === \false || !isset($urlInfo['scheme'], $urlInfo['host'], $urlInfo['port'])) {
|
||||
throw new \UnexpectedValueException('URL "' . $url . '" is not valid');
|
||||
}
|
||||
if (!\in_array($urlInfo['scheme'], $this->acceptedSchemes)) {
|
||||
@@ -44,7 +52,7 @@ class CubeHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessingH
|
||||
}
|
||||
$this->scheme = $urlInfo['scheme'];
|
||||
$this->host = $urlInfo['host'];
|
||||
$this->port = $urlInfo['port'];
|
||||
$this->port = (int) $urlInfo['port'];
|
||||
parent::__construct($level, $bubble);
|
||||
}
|
||||
/**
|
||||
@@ -53,42 +61,46 @@ class CubeHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessingH
|
||||
* @throws \LogicException when unable to connect to the socket
|
||||
* @throws MissingExtensionException when there is no socket extension
|
||||
*/
|
||||
protected function connectUdp()
|
||||
protected function connectUdp() : void
|
||||
{
|
||||
if (!\extension_loaded('sockets')) {
|
||||
throw new \WPMailSMTP\Vendor\Monolog\Handler\MissingExtensionException('The sockets extension is required to use udp URLs with the CubeHandler');
|
||||
}
|
||||
$this->udpConnection = \socket_create(\AF_INET, \SOCK_DGRAM, 0);
|
||||
if (!$this->udpConnection) {
|
||||
$udpConnection = \socket_create(\AF_INET, \SOCK_DGRAM, 0);
|
||||
if (\false === $udpConnection) {
|
||||
throw new \LogicException('Unable to create a socket');
|
||||
}
|
||||
$this->udpConnection = $udpConnection;
|
||||
if (!\socket_connect($this->udpConnection, $this->host, $this->port)) {
|
||||
throw new \LogicException('Unable to connect to the socket at ' . $this->host . ':' . $this->port);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Establish a connection to a http server
|
||||
* @throws \LogicException when no curl extension
|
||||
* Establish a connection to an http server
|
||||
*
|
||||
* @throws \LogicException when unable to connect to the socket
|
||||
* @throws MissingExtensionException when no curl extension
|
||||
*/
|
||||
protected function connectHttp()
|
||||
protected function connectHttp() : void
|
||||
{
|
||||
if (!\extension_loaded('curl')) {
|
||||
throw new \LogicException('The curl extension is needed to use http URLs with the CubeHandler');
|
||||
throw new \WPMailSMTP\Vendor\Monolog\Handler\MissingExtensionException('The curl extension is required to use http URLs with the CubeHandler');
|
||||
}
|
||||
$this->httpConnection = \curl_init('http://' . $this->host . ':' . $this->port . '/1.0/event/put');
|
||||
if (!$this->httpConnection) {
|
||||
$httpConnection = \curl_init('http://' . $this->host . ':' . $this->port . '/1.0/event/put');
|
||||
if (\false === $httpConnection) {
|
||||
throw new \LogicException('Unable to connect to ' . $this->host . ':' . $this->port);
|
||||
}
|
||||
$this->httpConnection = $httpConnection;
|
||||
\curl_setopt($this->httpConnection, \CURLOPT_CUSTOMREQUEST, "POST");
|
||||
\curl_setopt($this->httpConnection, \CURLOPT_RETURNTRANSFER, \true);
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function write(array $record)
|
||||
protected function write(array $record) : void
|
||||
{
|
||||
$date = $record['datetime'];
|
||||
$data = array('time' => $date->format('Y-m-d\\TH:i:s.uO'));
|
||||
$data = ['time' => $date->format('Y-m-d\\TH:i:s.uO')];
|
||||
unset($record['datetime']);
|
||||
if (isset($record['context']['type'])) {
|
||||
$data['type'] = $record['context']['type'];
|
||||
@@ -104,20 +116,23 @@ class CubeHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessingH
|
||||
$this->writeUdp(\WPMailSMTP\Vendor\Monolog\Utils::jsonEncode($data));
|
||||
}
|
||||
}
|
||||
private function writeUdp($data)
|
||||
private function writeUdp(string $data) : void
|
||||
{
|
||||
if (!$this->udpConnection) {
|
||||
$this->connectUdp();
|
||||
}
|
||||
\socket_send($this->udpConnection, $data, \strlen($data), 0);
|
||||
}
|
||||
private function writeHttp($data)
|
||||
private function writeHttp(string $data) : void
|
||||
{
|
||||
if (!$this->httpConnection) {
|
||||
$this->connectHttp();
|
||||
}
|
||||
if (null === $this->httpConnection) {
|
||||
throw new \LogicException('No connection could be established');
|
||||
}
|
||||
\curl_setopt($this->httpConnection, \CURLOPT_POSTFIELDS, '[' . $data . ']');
|
||||
\curl_setopt($this->httpConnection, \CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . \strlen('[' . $data . ']')));
|
||||
\curl_setopt($this->httpConnection, \CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Content-Length: ' . \strlen('[' . $data . ']')]);
|
||||
\WPMailSMTP\Vendor\Monolog\Handler\Curl\Util::execute($this->httpConnection, 5, \false);
|
||||
}
|
||||
}
|
||||
|
||||
+20
-8
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -10,33 +11,44 @@
|
||||
*/
|
||||
namespace WPMailSMTP\Vendor\Monolog\Handler\Curl;
|
||||
|
||||
class Util
|
||||
use CurlHandle;
|
||||
/**
|
||||
* This class is marked as internal and it is not under the BC promise of the package.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
final class Util
|
||||
{
|
||||
private static $retriableErrorCodes = array(\CURLE_COULDNT_RESOLVE_HOST, \CURLE_COULDNT_CONNECT, \CURLE_HTTP_NOT_FOUND, \CURLE_READ_ERROR, \CURLE_OPERATION_TIMEOUTED, \CURLE_HTTP_POST_ERROR, \CURLE_SSL_CONNECT_ERROR);
|
||||
/** @var array<int> */
|
||||
private static $retriableErrorCodes = [\CURLE_COULDNT_RESOLVE_HOST, \CURLE_COULDNT_CONNECT, \CURLE_HTTP_NOT_FOUND, \CURLE_READ_ERROR, \CURLE_OPERATION_TIMEOUTED, \CURLE_HTTP_POST_ERROR, \CURLE_SSL_CONNECT_ERROR];
|
||||
/**
|
||||
* Executes a CURL request with optional retries and exception on failure
|
||||
*
|
||||
* @param resource $ch curl handler
|
||||
* @throws \RuntimeException
|
||||
* @param resource|CurlHandle $ch curl handler
|
||||
* @param int $retries
|
||||
* @param bool $closeAfterDone
|
||||
* @return bool|string @see curl_exec
|
||||
*/
|
||||
public static function execute($ch, $retries = 5, $closeAfterDone = \true)
|
||||
public static function execute($ch, int $retries = 5, bool $closeAfterDone = \true)
|
||||
{
|
||||
while ($retries--) {
|
||||
if (\curl_exec($ch) === \false) {
|
||||
$curlResponse = \curl_exec($ch);
|
||||
if ($curlResponse === \false) {
|
||||
$curlErrno = \curl_errno($ch);
|
||||
if (\false === \in_array($curlErrno, self::$retriableErrorCodes, \true) || !$retries) {
|
||||
$curlError = \curl_error($ch);
|
||||
if ($closeAfterDone) {
|
||||
\curl_close($ch);
|
||||
}
|
||||
throw new \RuntimeException(\sprintf('Curl error (code %s): %s', $curlErrno, $curlError));
|
||||
throw new \RuntimeException(\sprintf('Curl error (code %d): %s', $curlErrno, $curlError));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if ($closeAfterDone) {
|
||||
\curl_close($ch);
|
||||
}
|
||||
break;
|
||||
return $curlResponse;
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
}
|
||||
|
||||
+27
-10
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -11,6 +12,7 @@
|
||||
namespace WPMailSMTP\Vendor\Monolog\Handler;
|
||||
|
||||
use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
use WPMailSMTP\Vendor\Psr\Log\LogLevel;
|
||||
/**
|
||||
* Simple handler wrapper that deduplicates log records across multiple requests
|
||||
*
|
||||
@@ -30,6 +32,10 @@ use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
* same way.
|
||||
*
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* @phpstan-import-type Record from \Monolog\Logger
|
||||
* @phpstan-import-type LevelName from \Monolog\Logger
|
||||
* @phpstan-import-type Level from \Monolog\Logger
|
||||
*/
|
||||
class DeduplicationHandler extends \WPMailSMTP\Vendor\Monolog\Handler\BufferHandler
|
||||
{
|
||||
@@ -38,7 +44,7 @@ class DeduplicationHandler extends \WPMailSMTP\Vendor\Monolog\Handler\BufferHand
|
||||
*/
|
||||
protected $deduplicationStore;
|
||||
/**
|
||||
* @var int
|
||||
* @var Level
|
||||
*/
|
||||
protected $deduplicationLevel;
|
||||
/**
|
||||
@@ -52,18 +58,20 @@ class DeduplicationHandler extends \WPMailSMTP\Vendor\Monolog\Handler\BufferHand
|
||||
/**
|
||||
* @param HandlerInterface $handler Handler.
|
||||
* @param string $deduplicationStore The file/path where the deduplication log should be kept
|
||||
* @param int $deduplicationLevel The minimum logging level for log records to be looked at for deduplication purposes
|
||||
* @param string|int $deduplicationLevel The minimum logging level for log records to be looked at for deduplication purposes
|
||||
* @param int $time The period (in seconds) during which duplicate entries should be suppressed after a given log is sent through
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
*
|
||||
* @phpstan-param Level|LevelName|LogLevel::* $deduplicationLevel
|
||||
*/
|
||||
public function __construct(\WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface $handler, $deduplicationStore = null, $deduplicationLevel = \WPMailSMTP\Vendor\Monolog\Logger::ERROR, $time = 60, $bubble = \true)
|
||||
public function __construct(\WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface $handler, ?string $deduplicationStore = null, $deduplicationLevel = \WPMailSMTP\Vendor\Monolog\Logger::ERROR, int $time = 60, bool $bubble = \true)
|
||||
{
|
||||
parent::__construct($handler, 0, \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, $bubble, \false);
|
||||
$this->deduplicationStore = $deduplicationStore === null ? \sys_get_temp_dir() . '/monolog-dedup-' . \substr(\md5(__FILE__), 0, 20) . '.log' : $deduplicationStore;
|
||||
$this->deduplicationLevel = \WPMailSMTP\Vendor\Monolog\Logger::toMonologLevel($deduplicationLevel);
|
||||
$this->time = $time;
|
||||
}
|
||||
public function flush()
|
||||
public function flush() : void
|
||||
{
|
||||
if ($this->bufferSize === 0) {
|
||||
return;
|
||||
@@ -86,7 +94,10 @@ class DeduplicationHandler extends \WPMailSMTP\Vendor\Monolog\Handler\BufferHand
|
||||
$this->collectLogs();
|
||||
}
|
||||
}
|
||||
private function isDuplicate(array $record)
|
||||
/**
|
||||
* @phpstan-param Record $record
|
||||
*/
|
||||
private function isDuplicate(array $record) : bool
|
||||
{
|
||||
if (!\file_exists($this->deduplicationStore)) {
|
||||
return \false;
|
||||
@@ -109,18 +120,21 @@ class DeduplicationHandler extends \WPMailSMTP\Vendor\Monolog\Handler\BufferHand
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
private function collectLogs()
|
||||
private function collectLogs() : void
|
||||
{
|
||||
if (!\file_exists($this->deduplicationStore)) {
|
||||
return \false;
|
||||
return;
|
||||
}
|
||||
$handle = \fopen($this->deduplicationStore, 'rw+');
|
||||
if (!$handle) {
|
||||
throw new \RuntimeException('Failed to open file for reading and writing: ' . $this->deduplicationStore);
|
||||
}
|
||||
\flock($handle, \LOCK_EX);
|
||||
$validLogs = array();
|
||||
$validLogs = [];
|
||||
$timestampValidity = \time() - $this->time;
|
||||
while (!\feof($handle)) {
|
||||
$log = \fgets($handle);
|
||||
if (\substr($log, 0, 10) >= $timestampValidity) {
|
||||
if ($log && \substr($log, 0, 10) >= $timestampValidity) {
|
||||
$validLogs[] = $log;
|
||||
}
|
||||
}
|
||||
@@ -133,7 +147,10 @@ class DeduplicationHandler extends \WPMailSMTP\Vendor\Monolog\Handler\BufferHand
|
||||
\fclose($handle);
|
||||
$this->gc = \false;
|
||||
}
|
||||
private function appendRecord(array $record)
|
||||
/**
|
||||
* @phpstan-param Record $record
|
||||
*/
|
||||
private function appendRecord(array $record) : void
|
||||
{
|
||||
\file_put_contents($this->deduplicationStore, $record['datetime']->getTimestamp() . ':' . $record['level_name'] . ':' . \preg_replace('{[\\r\\n].*}', '', $record['message']) . "\n", \FILE_APPEND);
|
||||
}
|
||||
|
||||
+6
-3
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -12,6 +13,7 @@ namespace WPMailSMTP\Vendor\Monolog\Handler;
|
||||
|
||||
use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\NormalizerFormatter;
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
use WPMailSMTP\Vendor\Doctrine\CouchDB\CouchDBClient;
|
||||
/**
|
||||
* CouchDB handler for Doctrine CouchDB ODM
|
||||
@@ -20,8 +22,9 @@ use WPMailSMTP\Vendor\Doctrine\CouchDB\CouchDBClient;
|
||||
*/
|
||||
class DoctrineCouchDBHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessingHandler
|
||||
{
|
||||
/** @var CouchDBClient */
|
||||
private $client;
|
||||
public function __construct(\WPMailSMTP\Vendor\Doctrine\CouchDB\CouchDBClient $client, $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, $bubble = \true)
|
||||
public function __construct(\WPMailSMTP\Vendor\Doctrine\CouchDB\CouchDBClient $client, $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, bool $bubble = \true)
|
||||
{
|
||||
$this->client = $client;
|
||||
parent::__construct($level, $bubble);
|
||||
@@ -29,11 +32,11 @@ class DoctrineCouchDBHandler extends \WPMailSMTP\Vendor\Monolog\Handler\Abstract
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function write(array $record)
|
||||
protected function write(array $record) : void
|
||||
{
|
||||
$this->client->postDocument($record['formatted']);
|
||||
}
|
||||
protected function getDefaultFormatter()
|
||||
protected function getDefaultFormatter() : \WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface
|
||||
{
|
||||
return new \WPMailSMTP\Vendor\Monolog\Formatter\NormalizerFormatter();
|
||||
}
|
||||
|
||||
+13
-16
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -12,6 +13,7 @@ namespace WPMailSMTP\Vendor\Monolog\Handler;
|
||||
|
||||
use WPMailSMTP\Vendor\Aws\Sdk;
|
||||
use WPMailSMTP\Vendor\Aws\DynamoDb\DynamoDbClient;
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
use WPMailSMTP\Vendor\Aws\DynamoDb\Marshaler;
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\ScalarFormatter;
|
||||
use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
@@ -23,7 +25,7 @@ use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
*/
|
||||
class DynamoDbHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessingHandler
|
||||
{
|
||||
const DATE_FORMAT = 'Y-m-d\\TH:i:s.uO';
|
||||
public const DATE_FORMAT = 'Y-m-d\\TH:i:s.uO';
|
||||
/**
|
||||
* @var DynamoDbClient
|
||||
*/
|
||||
@@ -40,14 +42,9 @@ class DynamoDbHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcess
|
||||
* @var Marshaler
|
||||
*/
|
||||
protected $marshaler;
|
||||
/**
|
||||
* @param DynamoDbClient $client
|
||||
* @param string $table
|
||||
* @param int $level
|
||||
* @param bool $bubble
|
||||
*/
|
||||
public function __construct(\WPMailSMTP\Vendor\Aws\DynamoDb\DynamoDbClient $client, $table, $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, $bubble = \true)
|
||||
public function __construct(\WPMailSMTP\Vendor\Aws\DynamoDb\DynamoDbClient $client, string $table, $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, bool $bubble = \true)
|
||||
{
|
||||
/** @phpstan-ignore-next-line */
|
||||
if (\defined('Aws\\Sdk::VERSION') && \version_compare(\WPMailSMTP\Vendor\Aws\Sdk::VERSION, '3.0', '>=')) {
|
||||
$this->version = 3;
|
||||
$this->marshaler = new \WPMailSMTP\Vendor\Aws\DynamoDb\Marshaler();
|
||||
@@ -59,9 +56,9 @@ class DynamoDbHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcess
|
||||
parent::__construct($level, $bubble);
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function write(array $record)
|
||||
protected function write(array $record) : void
|
||||
{
|
||||
$filtered = $this->filterEmptyFields($record['formatted']);
|
||||
if ($this->version === 3) {
|
||||
@@ -70,22 +67,22 @@ class DynamoDbHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcess
|
||||
/** @phpstan-ignore-next-line */
|
||||
$formatted = $this->client->formatAttributes($filtered);
|
||||
}
|
||||
$this->client->putItem(array('TableName' => $this->table, 'Item' => $formatted));
|
||||
$this->client->putItem(['TableName' => $this->table, 'Item' => $formatted]);
|
||||
}
|
||||
/**
|
||||
* @param array $record
|
||||
* @return array
|
||||
* @param mixed[] $record
|
||||
* @return mixed[]
|
||||
*/
|
||||
protected function filterEmptyFields(array $record)
|
||||
protected function filterEmptyFields(array $record) : array
|
||||
{
|
||||
return \array_filter($record, function ($value) {
|
||||
return !empty($value) || \false === $value || 0 === $value;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getDefaultFormatter()
|
||||
protected function getDefaultFormatter() : \WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface
|
||||
{
|
||||
return new \WPMailSMTP\Vendor\Monolog\Formatter\ScalarFormatter(self::DATE_FORMAT);
|
||||
}
|
||||
|
||||
+26
-25
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -10,6 +11,7 @@
|
||||
*/
|
||||
namespace WPMailSMTP\Vendor\Monolog\Handler;
|
||||
|
||||
use WPMailSMTP\Vendor\Elastica\Document;
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\ElasticaFormatter;
|
||||
use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
@@ -23,88 +25,87 @@ use WPMailSMTP\Vendor\Elastica\Exception\ExceptionInterface;
|
||||
* $client = new \Elastica\Client();
|
||||
* $options = array(
|
||||
* 'index' => 'elastic_index_name',
|
||||
* 'type' => 'elastic_doc_type',
|
||||
* 'type' => 'elastic_doc_type', Types have been removed in Elastica 7
|
||||
* );
|
||||
* $handler = new ElasticSearchHandler($client, $options);
|
||||
* $handler = new ElasticaHandler($client, $options);
|
||||
* $log = new Logger('application');
|
||||
* $log->pushHandler($handler);
|
||||
*
|
||||
* @author Jelle Vink <jelle.vink@gmail.com>
|
||||
*/
|
||||
class ElasticSearchHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessingHandler
|
||||
class ElasticaHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessingHandler
|
||||
{
|
||||
/**
|
||||
* @var Client
|
||||
*/
|
||||
protected $client;
|
||||
/**
|
||||
* @var array Handler config options
|
||||
* @var mixed[] Handler config options
|
||||
*/
|
||||
protected $options = array();
|
||||
protected $options = [];
|
||||
/**
|
||||
* @param Client $client Elastica Client object
|
||||
* @param array $options Handler configuration
|
||||
* @param int $level The minimum logging level at which this handler will be triggered
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
* @param Client $client Elastica Client object
|
||||
* @param mixed[] $options Handler configuration
|
||||
*/
|
||||
public function __construct(\WPMailSMTP\Vendor\Elastica\Client $client, array $options = array(), $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, $bubble = \true)
|
||||
public function __construct(\WPMailSMTP\Vendor\Elastica\Client $client, array $options = [], $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, bool $bubble = \true)
|
||||
{
|
||||
parent::__construct($level, $bubble);
|
||||
$this->client = $client;
|
||||
$this->options = \array_merge(array(
|
||||
$this->options = \array_merge([
|
||||
'index' => 'monolog',
|
||||
// Elastic index name
|
||||
'type' => 'record',
|
||||
// Elastic document type
|
||||
'ignore_error' => \false,
|
||||
), $options);
|
||||
], $options);
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function write(array $record)
|
||||
protected function write(array $record) : void
|
||||
{
|
||||
$this->bulkSend(array($record['formatted']));
|
||||
$this->bulkSend([$record['formatted']]);
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setFormatter(\WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface $formatter)
|
||||
public function setFormatter(\WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface $formatter) : \WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface
|
||||
{
|
||||
if ($formatter instanceof \WPMailSMTP\Vendor\Monolog\Formatter\ElasticaFormatter) {
|
||||
return parent::setFormatter($formatter);
|
||||
}
|
||||
throw new \InvalidArgumentException('ElasticSearchHandler is only compatible with ElasticaFormatter');
|
||||
throw new \InvalidArgumentException('ElasticaHandler is only compatible with ElasticaFormatter');
|
||||
}
|
||||
/**
|
||||
* Getter options
|
||||
* @return array
|
||||
* @return mixed[]
|
||||
*/
|
||||
public function getOptions()
|
||||
public function getOptions() : array
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getDefaultFormatter()
|
||||
protected function getDefaultFormatter() : \WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface
|
||||
{
|
||||
return new \WPMailSMTP\Vendor\Monolog\Formatter\ElasticaFormatter($this->options['index'], $this->options['type']);
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function handleBatch(array $records)
|
||||
public function handleBatch(array $records) : void
|
||||
{
|
||||
$documents = $this->getFormatter()->formatBatch($records);
|
||||
$this->bulkSend($documents);
|
||||
}
|
||||
/**
|
||||
* Use Elasticsearch bulk API to send list of documents
|
||||
* @param array $documents
|
||||
*
|
||||
* @param Document[] $documents
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
protected function bulkSend(array $documents)
|
||||
protected function bulkSend(array $documents) : void
|
||||
{
|
||||
try {
|
||||
$this->client->addDocuments($documents);
|
||||
+25
-18
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -11,7 +12,9 @@
|
||||
namespace WPMailSMTP\Vendor\Monolog\Handler;
|
||||
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\LineFormatter;
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
use WPMailSMTP\Vendor\Monolog\Utils;
|
||||
/**
|
||||
* Stores to PHP error_log() handler.
|
||||
*
|
||||
@@ -19,20 +22,20 @@ use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
*/
|
||||
class ErrorLogHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessingHandler
|
||||
{
|
||||
const OPERATING_SYSTEM = 0;
|
||||
const SAPI = 4;
|
||||
public const OPERATING_SYSTEM = 0;
|
||||
public const SAPI = 4;
|
||||
/** @var int */
|
||||
protected $messageType;
|
||||
/** @var bool */
|
||||
protected $expandNewlines;
|
||||
/**
|
||||
* @param int $messageType Says where the error should go.
|
||||
* @param int $level The minimum logging level at which this handler will be triggered
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
* @param bool $expandNewlines If set to true, newlines in the message will be expanded to be take multiple log entries
|
||||
*/
|
||||
public function __construct($messageType = self::OPERATING_SYSTEM, $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, $bubble = \true, $expandNewlines = \false)
|
||||
public function __construct(int $messageType = self::OPERATING_SYSTEM, $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, bool $bubble = \true, bool $expandNewlines = \false)
|
||||
{
|
||||
parent::__construct($level, $bubble);
|
||||
if (\false === \in_array($messageType, self::getAvailableTypes())) {
|
||||
if (\false === \in_array($messageType, self::getAvailableTypes(), \true)) {
|
||||
$message = \sprintf('The given message type "%s" is not supported', \print_r($messageType, \true));
|
||||
throw new \InvalidArgumentException($message);
|
||||
}
|
||||
@@ -40,31 +43,35 @@ class ErrorLogHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcess
|
||||
$this->expandNewlines = $expandNewlines;
|
||||
}
|
||||
/**
|
||||
* @return array With all available types
|
||||
* @return int[] With all available types
|
||||
*/
|
||||
public static function getAvailableTypes()
|
||||
public static function getAvailableTypes() : array
|
||||
{
|
||||
return array(self::OPERATING_SYSTEM, self::SAPI);
|
||||
return [self::OPERATING_SYSTEM, self::SAPI];
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getDefaultFormatter()
|
||||
protected function getDefaultFormatter() : \WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface
|
||||
{
|
||||
return new \WPMailSMTP\Vendor\Monolog\Formatter\LineFormatter('[%datetime%] %channel%.%level_name%: %message% %context% %extra%');
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function write(array $record)
|
||||
protected function write(array $record) : void
|
||||
{
|
||||
if ($this->expandNewlines) {
|
||||
$lines = \preg_split('{[\\r\\n]+}', (string) $record['formatted']);
|
||||
foreach ($lines as $line) {
|
||||
\error_log($line, $this->messageType);
|
||||
}
|
||||
} else {
|
||||
if (!$this->expandNewlines) {
|
||||
\error_log((string) $record['formatted'], $this->messageType);
|
||||
return;
|
||||
}
|
||||
$lines = \preg_split('{[\\r\\n]+}', (string) $record['formatted']);
|
||||
if ($lines === \false) {
|
||||
$pcreErrorCode = \preg_last_error();
|
||||
throw new \RuntimeException('Failed to preg_split formatted string: ' . $pcreErrorCode . ' / ' . \WPMailSMTP\Vendor\Monolog\Utils::pcreLastErrorMessage($pcreErrorCode));
|
||||
}
|
||||
foreach ($lines as $line) {
|
||||
\error_log($line, $this->messageType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace WPMailSMTP\Vendor\Monolog\Handler;
|
||||
|
||||
use Throwable;
|
||||
/**
|
||||
* Forwards records to at most one handler
|
||||
*
|
||||
* If a handler fails, the exception is suppressed and the record is forwarded to the next handler.
|
||||
*
|
||||
* As soon as one handler handles a record successfully, the handling stops there.
|
||||
*
|
||||
* @phpstan-import-type Record from \Monolog\Logger
|
||||
*/
|
||||
class FallbackGroupHandler extends \WPMailSMTP\Vendor\Monolog\Handler\GroupHandler
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function handle(array $record) : bool
|
||||
{
|
||||
if ($this->processors) {
|
||||
/** @var Record $record */
|
||||
$record = $this->processRecord($record);
|
||||
}
|
||||
foreach ($this->handlers as $handler) {
|
||||
try {
|
||||
$handler->handle($record);
|
||||
break;
|
||||
} catch (\Throwable $e) {
|
||||
// What throwable?
|
||||
}
|
||||
}
|
||||
return \false === $this->bubble;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function handleBatch(array $records) : void
|
||||
{
|
||||
if ($this->processors) {
|
||||
$processed = [];
|
||||
foreach ($records as $record) {
|
||||
$processed[] = $this->processRecord($record);
|
||||
}
|
||||
/** @var Record[] $records */
|
||||
$records = $processed;
|
||||
}
|
||||
foreach ($this->handlers as $handler) {
|
||||
try {
|
||||
$handler->handleBatch($records);
|
||||
break;
|
||||
} catch (\Throwable $e) {
|
||||
// What throwable?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+61
-26
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -11,7 +12,9 @@
|
||||
namespace WPMailSMTP\Vendor\Monolog\Handler;
|
||||
|
||||
use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
use WPMailSMTP\Vendor\Monolog\ResettableInterface;
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
use WPMailSMTP\Vendor\Psr\Log\LogLevel;
|
||||
/**
|
||||
* Simple handler wrapper that filters records based on a list of levels
|
||||
*
|
||||
@@ -19,19 +22,26 @@ use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
*
|
||||
* @author Hennadiy Verkh
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* @phpstan-import-type Record from \Monolog\Logger
|
||||
* @phpstan-import-type Level from \Monolog\Logger
|
||||
* @phpstan-import-type LevelName from \Monolog\Logger
|
||||
*/
|
||||
class FilterHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractHandler
|
||||
class FilterHandler extends \WPMailSMTP\Vendor\Monolog\Handler\Handler implements \WPMailSMTP\Vendor\Monolog\Handler\ProcessableHandlerInterface, \WPMailSMTP\Vendor\Monolog\ResettableInterface, \WPMailSMTP\Vendor\Monolog\Handler\FormattableHandlerInterface
|
||||
{
|
||||
use ProcessableHandlerTrait;
|
||||
/**
|
||||
* Handler or factory callable($record, $this)
|
||||
*
|
||||
* @var callable|\Monolog\Handler\HandlerInterface
|
||||
* @var callable|HandlerInterface
|
||||
* @phpstan-var callable(?Record, HandlerInterface): HandlerInterface|HandlerInterface
|
||||
*/
|
||||
protected $handler;
|
||||
/**
|
||||
* Minimum level for logs that are passed to handler
|
||||
*
|
||||
* @var int[]
|
||||
* @phpstan-var array<Level, int>
|
||||
*/
|
||||
protected $acceptedLevels;
|
||||
/**
|
||||
@@ -41,12 +51,17 @@ class FilterHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractHandler
|
||||
*/
|
||||
protected $bubble;
|
||||
/**
|
||||
* @psalm-param HandlerInterface|callable(?Record, HandlerInterface): HandlerInterface $handler
|
||||
*
|
||||
* @param callable|HandlerInterface $handler Handler or factory callable($record|null, $filterHandler).
|
||||
* @param int|array $minLevelOrList A list of levels to accept or a minimum level if maxLevel is provided
|
||||
* @param int $maxLevel Maximum level to accept, only used if $minLevelOrList is not an array
|
||||
* @param int|string $maxLevel Maximum level to accept, only used if $minLevelOrList is not an array
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
*
|
||||
* @phpstan-param Level|LevelName|LogLevel::*|array<Level|LevelName|LogLevel::*> $minLevelOrList
|
||||
* @phpstan-param Level|LevelName|LogLevel::* $maxLevel
|
||||
*/
|
||||
public function __construct($handler, $minLevelOrList = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, $maxLevel = \WPMailSMTP\Vendor\Monolog\Logger::EMERGENCY, $bubble = \true)
|
||||
public function __construct($handler, $minLevelOrList = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, $maxLevel = \WPMailSMTP\Vendor\Monolog\Logger::EMERGENCY, bool $bubble = \true)
|
||||
{
|
||||
$this->handler = $handler;
|
||||
$this->bubble = $bubble;
|
||||
@@ -56,17 +71,20 @@ class FilterHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractHandler
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
* @phpstan-return array<int, Level>
|
||||
*/
|
||||
public function getAcceptedLevels()
|
||||
public function getAcceptedLevels() : array
|
||||
{
|
||||
return \array_flip($this->acceptedLevels);
|
||||
}
|
||||
/**
|
||||
* @param int|string|array $minLevelOrList A list of levels to accept or a minimum level or level name if maxLevel is provided
|
||||
* @param int|string $maxLevel Maximum level or level name to accept, only used if $minLevelOrList is not an array
|
||||
*
|
||||
* @phpstan-param Level|LevelName|LogLevel::*|array<Level|LevelName|LogLevel::*> $minLevelOrList
|
||||
* @phpstan-param Level|LevelName|LogLevel::* $maxLevel
|
||||
*/
|
||||
public function setAcceptedLevels($minLevelOrList = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, $maxLevel = \WPMailSMTP\Vendor\Monolog\Logger::EMERGENCY)
|
||||
public function setAcceptedLevels($minLevelOrList = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, $maxLevel = \WPMailSMTP\Vendor\Monolog\Logger::EMERGENCY) : self
|
||||
{
|
||||
if (\is_array($minLevelOrList)) {
|
||||
$acceptedLevels = \array_map('WPMailSMTP\\Vendor\\Monolog\\Logger::toMonologLevel', $minLevelOrList);
|
||||
@@ -78,36 +96,36 @@ class FilterHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractHandler
|
||||
}));
|
||||
}
|
||||
$this->acceptedLevels = \array_flip($acceptedLevels);
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function isHandling(array $record)
|
||||
public function isHandling(array $record) : bool
|
||||
{
|
||||
return isset($this->acceptedLevels[$record['level']]);
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function handle(array $record)
|
||||
public function handle(array $record) : bool
|
||||
{
|
||||
if (!$this->isHandling($record)) {
|
||||
return \false;
|
||||
}
|
||||
if ($this->processors) {
|
||||
foreach ($this->processors as $processor) {
|
||||
$record = \call_user_func($processor, $record);
|
||||
}
|
||||
/** @var Record $record */
|
||||
$record = $this->processRecord($record);
|
||||
}
|
||||
$this->getHandler($record)->handle($record);
|
||||
return \false === $this->bubble;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function handleBatch(array $records)
|
||||
public function handleBatch(array $records) : void
|
||||
{
|
||||
$filtered = array();
|
||||
$filtered = [];
|
||||
foreach ($records as $record) {
|
||||
if ($this->isHandling($record)) {
|
||||
$filtered[] = $record;
|
||||
@@ -123,11 +141,13 @@ class FilterHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractHandler
|
||||
* If the handler was provided as a factory callable, this will trigger the handler's instantiation.
|
||||
*
|
||||
* @return HandlerInterface
|
||||
*
|
||||
* @phpstan-param Record $record
|
||||
*/
|
||||
public function getHandler(array $record = null)
|
||||
public function getHandler(?array $record = null)
|
||||
{
|
||||
if (!$this->handler instanceof \WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface) {
|
||||
$this->handler = \call_user_func($this->handler, $record, $this);
|
||||
$this->handler = ($this->handler)($record, $this);
|
||||
if (!$this->handler instanceof \WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface) {
|
||||
throw new \RuntimeException("The factory callable should return a HandlerInterface");
|
||||
}
|
||||
@@ -135,18 +155,33 @@ class FilterHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractHandler
|
||||
return $this->handler;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setFormatter(\WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface $formatter)
|
||||
public function setFormatter(\WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface $formatter) : \WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface
|
||||
{
|
||||
$this->getHandler()->setFormatter($formatter);
|
||||
return $this;
|
||||
$handler = $this->getHandler();
|
||||
if ($handler instanceof \WPMailSMTP\Vendor\Monolog\Handler\FormattableHandlerInterface) {
|
||||
$handler->setFormatter($formatter);
|
||||
return $this;
|
||||
}
|
||||
throw new \UnexpectedValueException('The nested handler of type ' . \get_class($handler) . ' does not support formatters.');
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getFormatter()
|
||||
public function getFormatter() : \WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface
|
||||
{
|
||||
return $this->getHandler()->getFormatter();
|
||||
$handler = $this->getHandler();
|
||||
if ($handler instanceof \WPMailSMTP\Vendor\Monolog\Handler\FormattableHandlerInterface) {
|
||||
return $handler->getFormatter();
|
||||
}
|
||||
throw new \UnexpectedValueException('The nested handler of type ' . \get_class($handler) . ' does not support formatters.');
|
||||
}
|
||||
public function reset()
|
||||
{
|
||||
$this->resetProcessors();
|
||||
if ($this->getHandler() instanceof \WPMailSMTP\Vendor\Monolog\ResettableInterface) {
|
||||
$this->getHandler()->reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -14,14 +15,15 @@ namespace WPMailSMTP\Vendor\Monolog\Handler\FingersCrossed;
|
||||
* Interface for activation strategies for the FingersCrossedHandler.
|
||||
*
|
||||
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
|
||||
*
|
||||
* @phpstan-import-type Record from \Monolog\Logger
|
||||
*/
|
||||
interface ActivationStrategyInterface
|
||||
{
|
||||
/**
|
||||
* Returns whether the given record activates the handler.
|
||||
*
|
||||
* @param array $record
|
||||
* @return bool
|
||||
* @phpstan-param Record $record
|
||||
*/
|
||||
public function isHandlerActivated(array $record);
|
||||
public function isHandlerActivated(array $record) : bool;
|
||||
}
|
||||
|
||||
+22
-4
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -11,6 +12,7 @@
|
||||
namespace WPMailSMTP\Vendor\Monolog\Handler\FingersCrossed;
|
||||
|
||||
use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
use WPMailSMTP\Vendor\Psr\Log\LogLevel;
|
||||
/**
|
||||
* Channel and Error level based monolog activation strategy. Allows to trigger activation
|
||||
* based on level per channel. e.g. trigger activation on level 'ERROR' by default, except
|
||||
@@ -30,21 +32,37 @@ use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
* </code>
|
||||
*
|
||||
* @author Mike Meessen <netmikey@gmail.com>
|
||||
*
|
||||
* @phpstan-import-type Record from \Monolog\Logger
|
||||
* @phpstan-import-type Level from \Monolog\Logger
|
||||
* @phpstan-import-type LevelName from \Monolog\Logger
|
||||
*/
|
||||
class ChannelLevelActivationStrategy implements \WPMailSMTP\Vendor\Monolog\Handler\FingersCrossed\ActivationStrategyInterface
|
||||
{
|
||||
/**
|
||||
* @var Level
|
||||
*/
|
||||
private $defaultActionLevel;
|
||||
/**
|
||||
* @var array<string, Level>
|
||||
*/
|
||||
private $channelToActionLevel;
|
||||
/**
|
||||
* @param int $defaultActionLevel The default action level to be used if the record's category doesn't match any
|
||||
* @param array $channelToActionLevel An array that maps channel names to action levels.
|
||||
* @param int|string $defaultActionLevel The default action level to be used if the record's category doesn't match any
|
||||
* @param array<string, int> $channelToActionLevel An array that maps channel names to action levels.
|
||||
*
|
||||
* @phpstan-param array<string, Level> $channelToActionLevel
|
||||
* @phpstan-param Level|LevelName|LogLevel::* $defaultActionLevel
|
||||
*/
|
||||
public function __construct($defaultActionLevel, $channelToActionLevel = array())
|
||||
public function __construct($defaultActionLevel, array $channelToActionLevel = [])
|
||||
{
|
||||
$this->defaultActionLevel = \WPMailSMTP\Vendor\Monolog\Logger::toMonologLevel($defaultActionLevel);
|
||||
$this->channelToActionLevel = \array_map('WPMailSMTP\\Vendor\\Monolog\\Logger::toMonologLevel', $channelToActionLevel);
|
||||
}
|
||||
public function isHandlerActivated(array $record)
|
||||
/**
|
||||
* @phpstan-param Record $record
|
||||
*/
|
||||
public function isHandlerActivated(array $record) : bool
|
||||
{
|
||||
if (isset($this->channelToActionLevel[$record['channel']])) {
|
||||
return $record['level'] >= $this->channelToActionLevel[$record['channel']];
|
||||
|
||||
+14
-1
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -11,19 +12,31 @@
|
||||
namespace WPMailSMTP\Vendor\Monolog\Handler\FingersCrossed;
|
||||
|
||||
use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
use WPMailSMTP\Vendor\Psr\Log\LogLevel;
|
||||
/**
|
||||
* Error level based activation strategy.
|
||||
*
|
||||
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
|
||||
*
|
||||
* @phpstan-import-type Level from \Monolog\Logger
|
||||
* @phpstan-import-type LevelName from \Monolog\Logger
|
||||
*/
|
||||
class ErrorLevelActivationStrategy implements \WPMailSMTP\Vendor\Monolog\Handler\FingersCrossed\ActivationStrategyInterface
|
||||
{
|
||||
/**
|
||||
* @var Level
|
||||
*/
|
||||
private $actionLevel;
|
||||
/**
|
||||
* @param int|string $actionLevel Level or name or value
|
||||
*
|
||||
* @phpstan-param Level|LevelName|LogLevel::* $actionLevel
|
||||
*/
|
||||
public function __construct($actionLevel)
|
||||
{
|
||||
$this->actionLevel = \WPMailSMTP\Vendor\Monolog\Logger::toMonologLevel($actionLevel);
|
||||
}
|
||||
public function isHandlerActivated(array $record)
|
||||
public function isHandlerActivated(array $record) : bool
|
||||
{
|
||||
return $record['level'] >= $this->actionLevel;
|
||||
}
|
||||
|
||||
+82
-41
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -15,6 +16,7 @@ use WPMailSMTP\Vendor\Monolog\Handler\FingersCrossed\ActivationStrategyInterface
|
||||
use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
use WPMailSMTP\Vendor\Monolog\ResettableInterface;
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
use WPMailSMTP\Vendor\Psr\Log\LogLevel;
|
||||
/**
|
||||
* Buffers all records until a certain level is reached
|
||||
*
|
||||
@@ -22,29 +24,58 @@ use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
* Only requests which actually trigger an error (or whatever your actionLevel is) will be
|
||||
* in the logs, but they will contain all records, not only those above the level threshold.
|
||||
*
|
||||
* You can then have a passthruLevel as well which means that at the end of the request,
|
||||
* even if it did not get activated, it will still send through log records of e.g. at least a
|
||||
* warning level.
|
||||
*
|
||||
* You can find the various activation strategies in the
|
||||
* Monolog\Handler\FingersCrossed\ namespace.
|
||||
*
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* @phpstan-import-type Record from \Monolog\Logger
|
||||
* @phpstan-import-type Level from \Monolog\Logger
|
||||
* @phpstan-import-type LevelName from \Monolog\Logger
|
||||
*/
|
||||
class FingersCrossedHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractHandler
|
||||
class FingersCrossedHandler extends \WPMailSMTP\Vendor\Monolog\Handler\Handler implements \WPMailSMTP\Vendor\Monolog\Handler\ProcessableHandlerInterface, \WPMailSMTP\Vendor\Monolog\ResettableInterface, \WPMailSMTP\Vendor\Monolog\Handler\FormattableHandlerInterface
|
||||
{
|
||||
protected $handler;
|
||||
protected $activationStrategy;
|
||||
protected $buffering = \true;
|
||||
protected $bufferSize;
|
||||
protected $buffer = array();
|
||||
protected $stopBuffering;
|
||||
protected $passthruLevel;
|
||||
use ProcessableHandlerTrait;
|
||||
/**
|
||||
* @param callable|HandlerInterface $handler Handler or factory callable($record|null, $fingersCrossedHandler).
|
||||
* @param int|ActivationStrategyInterface $activationStrategy Strategy which determines when this handler takes action
|
||||
* @param int $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
* @param bool $stopBuffering Whether the handler should stop buffering after being triggered (default true)
|
||||
* @param int $passthruLevel Minimum level to always flush to handler on close, even if strategy not triggered
|
||||
* @var callable|HandlerInterface
|
||||
* @phpstan-var callable(?Record, HandlerInterface): HandlerInterface|HandlerInterface
|
||||
*/
|
||||
public function __construct($handler, $activationStrategy = null, $bufferSize = 0, $bubble = \true, $stopBuffering = \true, $passthruLevel = null)
|
||||
protected $handler;
|
||||
/** @var ActivationStrategyInterface */
|
||||
protected $activationStrategy;
|
||||
/** @var bool */
|
||||
protected $buffering = \true;
|
||||
/** @var int */
|
||||
protected $bufferSize;
|
||||
/** @var Record[] */
|
||||
protected $buffer = [];
|
||||
/** @var bool */
|
||||
protected $stopBuffering;
|
||||
/**
|
||||
* @var ?int
|
||||
* @phpstan-var ?Level
|
||||
*/
|
||||
protected $passthruLevel;
|
||||
/** @var bool */
|
||||
protected $bubble;
|
||||
/**
|
||||
* @psalm-param HandlerInterface|callable(?Record, HandlerInterface): HandlerInterface $handler
|
||||
*
|
||||
* @param callable|HandlerInterface $handler Handler or factory callable($record|null, $fingersCrossedHandler).
|
||||
* @param int|string|ActivationStrategyInterface $activationStrategy Strategy which determines when this handler takes action, or a level name/value at which the handler is activated
|
||||
* @param int $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
* @param bool $stopBuffering Whether the handler should stop buffering after being triggered (default true)
|
||||
* @param int|string $passthruLevel Minimum level to always flush to handler on close, even if strategy not triggered
|
||||
*
|
||||
* @phpstan-param Level|LevelName|LogLevel::* $passthruLevel
|
||||
* @phpstan-param Level|LevelName|LogLevel::*|ActivationStrategyInterface $activationStrategy
|
||||
*/
|
||||
public function __construct($handler, $activationStrategy = null, int $bufferSize = 0, bool $bubble = \true, bool $stopBuffering = \true, $passthruLevel = null)
|
||||
{
|
||||
if (null === $activationStrategy) {
|
||||
$activationStrategy = new \WPMailSMTP\Vendor\Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy(\WPMailSMTP\Vendor\Monolog\Logger::WARNING);
|
||||
@@ -66,32 +97,31 @@ class FingersCrossedHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractH
|
||||
}
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function isHandling(array $record)
|
||||
public function isHandling(array $record) : bool
|
||||
{
|
||||
return \true;
|
||||
}
|
||||
/**
|
||||
* Manually activate this logger regardless of the activation strategy
|
||||
*/
|
||||
public function activate()
|
||||
public function activate() : void
|
||||
{
|
||||
if ($this->stopBuffering) {
|
||||
$this->buffering = \false;
|
||||
}
|
||||
$this->getHandler(\end($this->buffer) ?: null)->handleBatch($this->buffer);
|
||||
$this->buffer = array();
|
||||
$this->buffer = [];
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function handle(array $record)
|
||||
public function handle(array $record) : bool
|
||||
{
|
||||
if ($this->processors) {
|
||||
foreach ($this->processors as $processor) {
|
||||
$record = \call_user_func($processor, $record);
|
||||
}
|
||||
/** @var Record $record */
|
||||
$record = $this->processRecord($record);
|
||||
}
|
||||
if ($this->buffering) {
|
||||
$this->buffer[] = $record;
|
||||
@@ -107,16 +137,17 @@ class FingersCrossedHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractH
|
||||
return \false === $this->bubble;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function close()
|
||||
public function close() : void
|
||||
{
|
||||
$this->flushBuffer();
|
||||
$this->getHandler()->close();
|
||||
}
|
||||
public function reset()
|
||||
{
|
||||
$this->flushBuffer();
|
||||
parent::reset();
|
||||
$this->resetProcessors();
|
||||
if ($this->getHandler() instanceof \WPMailSMTP\Vendor\Monolog\ResettableInterface) {
|
||||
$this->getHandler()->reset();
|
||||
}
|
||||
@@ -126,15 +157,15 @@ class FingersCrossedHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractH
|
||||
*
|
||||
* It also resets the handler to its initial buffering state.
|
||||
*/
|
||||
public function clear()
|
||||
public function clear() : void
|
||||
{
|
||||
$this->buffer = array();
|
||||
$this->buffer = [];
|
||||
$this->reset();
|
||||
}
|
||||
/**
|
||||
* Resets the state of the handler. Stops forwarding records to the wrapped handler.
|
||||
*/
|
||||
private function flushBuffer()
|
||||
private function flushBuffer() : void
|
||||
{
|
||||
if (null !== $this->passthruLevel) {
|
||||
$level = $this->passthruLevel;
|
||||
@@ -142,10 +173,10 @@ class FingersCrossedHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractH
|
||||
return $record['level'] >= $level;
|
||||
});
|
||||
if (\count($this->buffer) > 0) {
|
||||
$this->getHandler(\end($this->buffer) ?: null)->handleBatch($this->buffer);
|
||||
$this->getHandler(\end($this->buffer))->handleBatch($this->buffer);
|
||||
}
|
||||
}
|
||||
$this->buffer = array();
|
||||
$this->buffer = [];
|
||||
$this->buffering = \true;
|
||||
}
|
||||
/**
|
||||
@@ -154,11 +185,13 @@ class FingersCrossedHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractH
|
||||
* If the handler was provided as a factory callable, this will trigger the handler's instantiation.
|
||||
*
|
||||
* @return HandlerInterface
|
||||
*
|
||||
* @phpstan-param Record $record
|
||||
*/
|
||||
public function getHandler(array $record = null)
|
||||
public function getHandler(?array $record = null)
|
||||
{
|
||||
if (!$this->handler instanceof \WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface) {
|
||||
$this->handler = \call_user_func($this->handler, $record, $this);
|
||||
$this->handler = ($this->handler)($record, $this);
|
||||
if (!$this->handler instanceof \WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface) {
|
||||
throw new \RuntimeException("The factory callable should return a HandlerInterface");
|
||||
}
|
||||
@@ -166,18 +199,26 @@ class FingersCrossedHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractH
|
||||
return $this->handler;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setFormatter(\WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface $formatter)
|
||||
public function setFormatter(\WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface $formatter) : \WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface
|
||||
{
|
||||
$this->getHandler()->setFormatter($formatter);
|
||||
return $this;
|
||||
$handler = $this->getHandler();
|
||||
if ($handler instanceof \WPMailSMTP\Vendor\Monolog\Handler\FormattableHandlerInterface) {
|
||||
$handler->setFormatter($formatter);
|
||||
return $this;
|
||||
}
|
||||
throw new \UnexpectedValueException('The nested handler of type ' . \get_class($handler) . ' does not support formatters.');
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getFormatter()
|
||||
public function getFormatter() : \WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface
|
||||
{
|
||||
return $this->getHandler()->getFormatter();
|
||||
$handler = $this->getHandler();
|
||||
if ($handler instanceof \WPMailSMTP\Vendor\Monolog\Handler\FormattableHandlerInterface) {
|
||||
return $handler->getFormatter();
|
||||
}
|
||||
throw new \UnexpectedValueException('The nested handler of type ' . \get_class($handler) . ' does not support formatters.');
|
||||
}
|
||||
}
|
||||
|
||||
+37
-48
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -11,31 +12,36 @@
|
||||
namespace WPMailSMTP\Vendor\Monolog\Handler;
|
||||
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\WildfireFormatter;
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
/**
|
||||
* Simple FirePHP Handler (http://www.firephp.org/), which uses the Wildfire protocol.
|
||||
*
|
||||
* @author Eric Clemmons (@ericclemmons) <eric@uxdriven.com>
|
||||
*
|
||||
* @phpstan-import-type FormattedRecord from AbstractProcessingHandler
|
||||
*/
|
||||
class FirePHPHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessingHandler
|
||||
{
|
||||
use WebRequestRecognizerTrait;
|
||||
/**
|
||||
* WildFire JSON header message format
|
||||
*/
|
||||
const PROTOCOL_URI = 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2';
|
||||
protected const PROTOCOL_URI = 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2';
|
||||
/**
|
||||
* FirePHP structure for parsing messages & their presentation
|
||||
*/
|
||||
const STRUCTURE_URI = 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1';
|
||||
protected const STRUCTURE_URI = 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1';
|
||||
/**
|
||||
* Must reference a "known" plugin, otherwise headers won't display in FirePHP
|
||||
*/
|
||||
const PLUGIN_URI = 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3';
|
||||
protected const PLUGIN_URI = 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3';
|
||||
/**
|
||||
* Header prefix for Wildfire to recognize & parse headers
|
||||
*/
|
||||
const HEADER_PREFIX = 'X-Wf';
|
||||
protected const HEADER_PREFIX = 'X-Wf';
|
||||
/**
|
||||
* Whether or not Wildfire vendor-specific headers have been generated & sent yet
|
||||
* @var bool
|
||||
*/
|
||||
protected static $initialized = \false;
|
||||
/**
|
||||
@@ -43,36 +49,44 @@ class FirePHPHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessi
|
||||
* @var int
|
||||
*/
|
||||
protected static $messageIndex = 1;
|
||||
/** @var bool */
|
||||
protected static $sendHeaders = \true;
|
||||
/**
|
||||
* Base header creation function used by init headers & record headers
|
||||
*
|
||||
* @param array $meta Wildfire Plugin, Protocol & Structure Indexes
|
||||
* @param string $message Log message
|
||||
* @return array Complete header string ready for the client as key and message as value
|
||||
* @param array<int|string> $meta Wildfire Plugin, Protocol & Structure Indexes
|
||||
* @param string $message Log message
|
||||
*
|
||||
* @return array<string, string> Complete header string ready for the client as key and message as value
|
||||
*
|
||||
* @phpstan-return non-empty-array<string, string>
|
||||
*/
|
||||
protected function createHeader(array $meta, $message)
|
||||
protected function createHeader(array $meta, string $message) : array
|
||||
{
|
||||
$header = \sprintf('%s-%s', self::HEADER_PREFIX, \join('-', $meta));
|
||||
return array($header => $message);
|
||||
$header = \sprintf('%s-%s', static::HEADER_PREFIX, \join('-', $meta));
|
||||
return [$header => $message];
|
||||
}
|
||||
/**
|
||||
* Creates message header from record
|
||||
*
|
||||
* @return array<string, string>
|
||||
*
|
||||
* @phpstan-return non-empty-array<string, string>
|
||||
*
|
||||
* @see createHeader()
|
||||
* @param array $record
|
||||
* @return array
|
||||
*
|
||||
* @phpstan-param FormattedRecord $record
|
||||
*/
|
||||
protected function createRecordHeader(array $record)
|
||||
protected function createRecordHeader(array $record) : array
|
||||
{
|
||||
// Wildfire is extensible to support multiple protocols & plugins in a single request,
|
||||
// but we're not taking advantage of that (yet), so we're using "1" for simplicity's sake.
|
||||
return $this->createHeader(array(1, 1, 1, self::$messageIndex++), $record['formatted']);
|
||||
return $this->createHeader([1, 1, 1, self::$messageIndex++], $record['formatted']);
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getDefaultFormatter()
|
||||
protected function getDefaultFormatter() : \WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface
|
||||
{
|
||||
return new \WPMailSMTP\Vendor\Monolog\Formatter\WildfireFormatter();
|
||||
}
|
||||
@@ -81,20 +95,18 @@ class FirePHPHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessi
|
||||
*
|
||||
* @see createHeader()
|
||||
* @see sendHeader()
|
||||
* @return array
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function getInitHeaders()
|
||||
protected function getInitHeaders() : array
|
||||
{
|
||||
// Initial payload consists of required headers for Wildfire
|
||||
return \array_merge($this->createHeader(array('Protocol', 1), self::PROTOCOL_URI), $this->createHeader(array(1, 'Structure', 1), self::STRUCTURE_URI), $this->createHeader(array(1, 'Plugin', 1), self::PLUGIN_URI));
|
||||
return \array_merge($this->createHeader(['Protocol', 1], static::PROTOCOL_URI), $this->createHeader([1, 'Structure', 1], static::STRUCTURE_URI), $this->createHeader([1, 'Plugin', 1], static::PLUGIN_URI));
|
||||
}
|
||||
/**
|
||||
* Send header string to the client
|
||||
*
|
||||
* @param string $header
|
||||
* @param string $content
|
||||
*/
|
||||
protected function sendHeader($header, $content)
|
||||
protected function sendHeader(string $header, string $content) : void
|
||||
{
|
||||
if (!\headers_sent() && self::$sendHeaders) {
|
||||
\header(\sprintf('%s: %s', $header, $content));
|
||||
@@ -105,11 +117,10 @@ class FirePHPHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessi
|
||||
*
|
||||
* @see sendHeader()
|
||||
* @see sendInitHeaders()
|
||||
* @param array $record
|
||||
*/
|
||||
protected function write(array $record)
|
||||
protected function write(array $record) : void
|
||||
{
|
||||
if (!self::$sendHeaders) {
|
||||
if (!self::$sendHeaders || !$this->isWebRequest()) {
|
||||
return;
|
||||
}
|
||||
// WildFire-specific headers must be sent prior to any messages
|
||||
@@ -130,34 +141,12 @@ class FirePHPHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessi
|
||||
}
|
||||
/**
|
||||
* Verifies if the headers are accepted by the current user agent
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function headersAccepted()
|
||||
protected function headersAccepted() : bool
|
||||
{
|
||||
if (!empty($_SERVER['HTTP_USER_AGENT']) && \preg_match('{\\bFirePHP/\\d+\\.\\d+\\b}', $_SERVER['HTTP_USER_AGENT'])) {
|
||||
return \true;
|
||||
}
|
||||
return isset($_SERVER['HTTP_X_FIREPHP_VERSION']);
|
||||
}
|
||||
/**
|
||||
* BC getter for the sendHeaders property that has been made static
|
||||
*/
|
||||
public function __get($property)
|
||||
{
|
||||
if ('sendHeaders' !== $property) {
|
||||
throw new \InvalidArgumentException('Undefined property ' . $property);
|
||||
}
|
||||
return static::$sendHeaders;
|
||||
}
|
||||
/**
|
||||
* BC setter for the sendHeaders property that has been made static
|
||||
*/
|
||||
public function __set($property, $value)
|
||||
{
|
||||
if ('sendHeaders' !== $property) {
|
||||
throw new \InvalidArgumentException('Undefined property ' . $property);
|
||||
}
|
||||
static::$sendHeaders = $value;
|
||||
}
|
||||
}
|
||||
|
||||
+19
-26
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -10,6 +11,7 @@
|
||||
*/
|
||||
namespace WPMailSMTP\Vendor\Monolog\Handler;
|
||||
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\LineFormatter;
|
||||
use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
/**
|
||||
@@ -19,11 +21,13 @@ use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
*
|
||||
* @see https://fleep.io/integrations/webhooks/ Fleep Webhooks Documentation
|
||||
* @author Ando Roots <ando@sqroot.eu>
|
||||
*
|
||||
* @phpstan-import-type FormattedRecord from AbstractProcessingHandler
|
||||
*/
|
||||
class FleepHookHandler extends \WPMailSMTP\Vendor\Monolog\Handler\SocketHandler
|
||||
{
|
||||
const FLEEP_HOST = 'fleep.io';
|
||||
const FLEEP_HOOK_URI = '/hook/';
|
||||
protected const FLEEP_HOST = 'fleep.io';
|
||||
protected const FLEEP_HOOK_URI = '/hook/';
|
||||
/**
|
||||
* @var string Webhook token (specifies the conversation where logs are sent)
|
||||
*/
|
||||
@@ -35,18 +39,16 @@ class FleepHookHandler extends \WPMailSMTP\Vendor\Monolog\Handler\SocketHandler
|
||||
* see https://fleep.io/integrations/webhooks/
|
||||
*
|
||||
* @param string $token Webhook token
|
||||
* @param bool|int $level The minimum logging level at which this handler will be triggered
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
* @throws MissingExtensionException
|
||||
*/
|
||||
public function __construct($token, $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, $bubble = \true)
|
||||
public function __construct(string $token, $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, bool $bubble = \true, bool $persistent = \false, float $timeout = 0.0, float $writingTimeout = 10.0, ?float $connectionTimeout = null, ?int $chunkSize = null)
|
||||
{
|
||||
if (!\extension_loaded('openssl')) {
|
||||
throw new \WPMailSMTP\Vendor\Monolog\Handler\MissingExtensionException('The OpenSSL PHP extension is required to use the FleepHookHandler');
|
||||
}
|
||||
$this->token = $token;
|
||||
$connectionString = 'ssl://' . self::FLEEP_HOST . ':443';
|
||||
parent::__construct($connectionString, $level, $bubble);
|
||||
$connectionString = 'ssl://' . static::FLEEP_HOST . ':443';
|
||||
parent::__construct($connectionString, $level, $bubble, $persistent, $timeout, $writingTimeout, $connectionTimeout, $chunkSize);
|
||||
}
|
||||
/**
|
||||
* Returns the default formatter to use with this handler
|
||||
@@ -55,41 +57,33 @@ class FleepHookHandler extends \WPMailSMTP\Vendor\Monolog\Handler\SocketHandler
|
||||
*
|
||||
* @return LineFormatter
|
||||
*/
|
||||
protected function getDefaultFormatter()
|
||||
protected function getDefaultFormatter() : \WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface
|
||||
{
|
||||
return new \WPMailSMTP\Vendor\Monolog\Formatter\LineFormatter(null, null, \true, \true);
|
||||
}
|
||||
/**
|
||||
* Handles a log record
|
||||
*
|
||||
* @param array $record
|
||||
*/
|
||||
public function write(array $record)
|
||||
public function write(array $record) : void
|
||||
{
|
||||
parent::write($record);
|
||||
$this->closeSocket();
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param array $record
|
||||
* @return string
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function generateDataStream($record)
|
||||
protected function generateDataStream(array $record) : string
|
||||
{
|
||||
$content = $this->buildContent($record);
|
||||
return $this->buildHeader($content) . $content;
|
||||
}
|
||||
/**
|
||||
* Builds the header of the API Call
|
||||
*
|
||||
* @param string $content
|
||||
* @return string
|
||||
*/
|
||||
private function buildHeader($content)
|
||||
private function buildHeader(string $content) : string
|
||||
{
|
||||
$header = "POST " . self::FLEEP_HOOK_URI . $this->token . " HTTP/1.1\r\n";
|
||||
$header .= "Host: " . self::FLEEP_HOST . "\r\n";
|
||||
$header = "POST " . static::FLEEP_HOOK_URI . $this->token . " HTTP/1.1\r\n";
|
||||
$header .= "Host: " . static::FLEEP_HOST . "\r\n";
|
||||
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
|
||||
$header .= "Content-Length: " . \strlen($content) . "\r\n";
|
||||
$header .= "\r\n";
|
||||
@@ -98,12 +92,11 @@ class FleepHookHandler extends \WPMailSMTP\Vendor\Monolog\Handler\SocketHandler
|
||||
/**
|
||||
* Builds the body of API call
|
||||
*
|
||||
* @param array $record
|
||||
* @return string
|
||||
* @phpstan-param FormattedRecord $record
|
||||
*/
|
||||
private function buildContent($record)
|
||||
private function buildContent(array $record) : string
|
||||
{
|
||||
$dataArray = array('message' => $record['formatted']);
|
||||
$dataArray = ['message' => $record['formatted']];
|
||||
return \http_build_query($dataArray);
|
||||
}
|
||||
}
|
||||
|
||||
+16
-27
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -24,6 +25,9 @@ use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
*
|
||||
* @author Dominik Liebler <liebler.dominik@gmail.com>
|
||||
* @see https://www.flowdock.com/api/push
|
||||
*
|
||||
* @phpstan-import-type FormattedRecord from AbstractProcessingHandler
|
||||
* @deprecated Since 2.9.0 and 3.3.0, Flowdock was shutdown we will thus drop this handler in Monolog 4
|
||||
*/
|
||||
class FlowdockHandler extends \WPMailSMTP\Vendor\Monolog\Handler\SocketHandler
|
||||
{
|
||||
@@ -32,24 +36,20 @@ class FlowdockHandler extends \WPMailSMTP\Vendor\Monolog\Handler\SocketHandler
|
||||
*/
|
||||
protected $apiToken;
|
||||
/**
|
||||
* @param string $apiToken
|
||||
* @param bool|int $level The minimum logging level at which this handler will be triggered
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
*
|
||||
* @throws MissingExtensionException if OpenSSL is missing
|
||||
*/
|
||||
public function __construct($apiToken, $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, $bubble = \true)
|
||||
public function __construct(string $apiToken, $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, bool $bubble = \true, bool $persistent = \false, float $timeout = 0.0, float $writingTimeout = 10.0, ?float $connectionTimeout = null, ?int $chunkSize = null)
|
||||
{
|
||||
if (!\extension_loaded('openssl')) {
|
||||
throw new \WPMailSMTP\Vendor\Monolog\Handler\MissingExtensionException('The OpenSSL PHP extension is required to use the FlowdockHandler');
|
||||
}
|
||||
parent::__construct('ssl://api.flowdock.com:443', $level, $bubble);
|
||||
parent::__construct('ssl://api.flowdock.com:443', $level, $bubble, $persistent, $timeout, $writingTimeout, $connectionTimeout, $chunkSize);
|
||||
$this->apiToken = $apiToken;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setFormatter(\WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface $formatter)
|
||||
public function setFormatter(\WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface $formatter) : \WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface
|
||||
{
|
||||
if (!$formatter instanceof \WPMailSMTP\Vendor\Monolog\Formatter\FlowdockFormatter) {
|
||||
throw new \InvalidArgumentException('The FlowdockHandler requires an instance of Monolog\\Formatter\\FlowdockFormatter to function correctly');
|
||||
@@ -58,30 +58,23 @@ class FlowdockHandler extends \WPMailSMTP\Vendor\Monolog\Handler\SocketHandler
|
||||
}
|
||||
/**
|
||||
* Gets the default formatter.
|
||||
*
|
||||
* @return FormatterInterface
|
||||
*/
|
||||
protected function getDefaultFormatter()
|
||||
protected function getDefaultFormatter() : \WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface
|
||||
{
|
||||
throw new \InvalidArgumentException('The FlowdockHandler must be configured (via setFormatter) with an instance of Monolog\\Formatter\\FlowdockFormatter to function correctly');
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param array $record
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function write(array $record)
|
||||
protected function write(array $record) : void
|
||||
{
|
||||
parent::write($record);
|
||||
$this->closeSocket();
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param array $record
|
||||
* @return string
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function generateDataStream($record)
|
||||
protected function generateDataStream(array $record) : string
|
||||
{
|
||||
$content = $this->buildContent($record);
|
||||
return $this->buildHeader($content) . $content;
|
||||
@@ -89,20 +82,16 @@ class FlowdockHandler extends \WPMailSMTP\Vendor\Monolog\Handler\SocketHandler
|
||||
/**
|
||||
* Builds the body of API call
|
||||
*
|
||||
* @param array $record
|
||||
* @return string
|
||||
* @phpstan-param FormattedRecord $record
|
||||
*/
|
||||
private function buildContent($record)
|
||||
private function buildContent(array $record) : string
|
||||
{
|
||||
return \WPMailSMTP\Vendor\Monolog\Utils::jsonEncode($record['formatted']['flowdock']);
|
||||
}
|
||||
/**
|
||||
* Builds the header of the API Call
|
||||
*
|
||||
* @param string $content
|
||||
* @return string
|
||||
*/
|
||||
private function buildHeader($content)
|
||||
private function buildHeader(string $content) : string
|
||||
{
|
||||
$header = "POST /v1/messages/team_inbox/" . $this->apiToken . " HTTP/1.1\r\n";
|
||||
$header .= "Host: api.flowdock.com\r\n";
|
||||
|
||||
-2
@@ -15,8 +15,6 @@ use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
/**
|
||||
* Interface to describe loggers that have a formatter
|
||||
*
|
||||
* This interface is present in monolog 1.x to ease forward compatibility.
|
||||
*
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*/
|
||||
interface FormattableHandlerInterface
|
||||
|
||||
+3
-6
@@ -16,19 +16,16 @@ use WPMailSMTP\Vendor\Monolog\Formatter\LineFormatter;
|
||||
/**
|
||||
* Helper trait for implementing FormattableInterface
|
||||
*
|
||||
* This trait is present in monolog 1.x to ease forward compatibility.
|
||||
*
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*/
|
||||
trait FormattableHandlerTrait
|
||||
{
|
||||
/**
|
||||
* @var FormatterInterface
|
||||
* @var ?FormatterInterface
|
||||
*/
|
||||
protected $formatter;
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @suppress PhanTypeMismatchReturn
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setFormatter(\WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface $formatter) : \WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface
|
||||
{
|
||||
@@ -36,7 +33,7 @@ trait FormattableHandlerTrait
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getFormatter() : \WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface
|
||||
{
|
||||
|
||||
+8
-14
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -10,12 +11,10 @@
|
||||
*/
|
||||
namespace WPMailSMTP\Vendor\Monolog\Handler;
|
||||
|
||||
use WPMailSMTP\Vendor\Gelf\IMessagePublisher;
|
||||
use WPMailSMTP\Vendor\Gelf\PublisherInterface;
|
||||
use WPMailSMTP\Vendor\Gelf\Publisher;
|
||||
use InvalidArgumentException;
|
||||
use WPMailSMTP\Vendor\Monolog\Logger;
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\GelfMessageFormatter;
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
/**
|
||||
* Handler to send messages to a Graylog2 (http://www.graylog2.org) server
|
||||
*
|
||||
@@ -25,33 +24,28 @@ use WPMailSMTP\Vendor\Monolog\Formatter\GelfMessageFormatter;
|
||||
class GelfHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractProcessingHandler
|
||||
{
|
||||
/**
|
||||
* @var Publisher|PublisherInterface|IMessagePublisher the publisher object that sends the message to the server
|
||||
* @var PublisherInterface the publisher object that sends the message to the server
|
||||
*/
|
||||
protected $publisher;
|
||||
/**
|
||||
* @param PublisherInterface|IMessagePublisher|Publisher $publisher a publisher object
|
||||
* @param int $level The minimum logging level at which this handler will be triggered
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
* @param PublisherInterface $publisher a gelf publisher object
|
||||
*/
|
||||
public function __construct($publisher, $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, $bubble = \true)
|
||||
public function __construct(\WPMailSMTP\Vendor\Gelf\PublisherInterface $publisher, $level = \WPMailSMTP\Vendor\Monolog\Logger::DEBUG, bool $bubble = \true)
|
||||
{
|
||||
parent::__construct($level, $bubble);
|
||||
if (!$publisher instanceof \WPMailSMTP\Vendor\Gelf\Publisher && !$publisher instanceof \WPMailSMTP\Vendor\Gelf\IMessagePublisher && !$publisher instanceof \WPMailSMTP\Vendor\Gelf\PublisherInterface) {
|
||||
throw new \InvalidArgumentException('Invalid publisher, expected a Gelf\\Publisher, Gelf\\IMessagePublisher or Gelf\\PublisherInterface instance');
|
||||
}
|
||||
$this->publisher = $publisher;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function write(array $record)
|
||||
protected function write(array $record) : void
|
||||
{
|
||||
$this->publisher->publish($record['formatted']);
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getDefaultFormatter()
|
||||
protected function getDefaultFormatter() : \WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface
|
||||
{
|
||||
return new \WPMailSMTP\Vendor\Monolog\Formatter\GelfMessageFormatter();
|
||||
}
|
||||
|
||||
+35
-22
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -16,15 +17,21 @@ use WPMailSMTP\Vendor\Monolog\ResettableInterface;
|
||||
* Forwards records to multiple handlers
|
||||
*
|
||||
* @author Lenar Lõhmus <lenar@city.ee>
|
||||
*
|
||||
* @phpstan-import-type Record from \Monolog\Logger
|
||||
*/
|
||||
class GroupHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractHandler
|
||||
class GroupHandler extends \WPMailSMTP\Vendor\Monolog\Handler\Handler implements \WPMailSMTP\Vendor\Monolog\Handler\ProcessableHandlerInterface, \WPMailSMTP\Vendor\Monolog\ResettableInterface
|
||||
{
|
||||
use ProcessableHandlerTrait;
|
||||
/** @var HandlerInterface[] */
|
||||
protected $handlers;
|
||||
/** @var bool */
|
||||
protected $bubble;
|
||||
/**
|
||||
* @param array $handlers Array of Handlers.
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
* @param HandlerInterface[] $handlers Array of Handlers.
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
*/
|
||||
public function __construct(array $handlers, $bubble = \true)
|
||||
public function __construct(array $handlers, bool $bubble = \true)
|
||||
{
|
||||
foreach ($handlers as $handler) {
|
||||
if (!$handler instanceof \WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface) {
|
||||
@@ -35,9 +42,9 @@ class GroupHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractHandler
|
||||
$this->bubble = $bubble;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function isHandling(array $record)
|
||||
public function isHandling(array $record) : bool
|
||||
{
|
||||
foreach ($this->handlers as $handler) {
|
||||
if ($handler->isHandling($record)) {
|
||||
@@ -47,14 +54,13 @@ class GroupHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractHandler
|
||||
return \false;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function handle(array $record)
|
||||
public function handle(array $record) : bool
|
||||
{
|
||||
if ($this->processors) {
|
||||
foreach ($this->processors as $processor) {
|
||||
$record = \call_user_func($processor, $record);
|
||||
}
|
||||
/** @var Record $record */
|
||||
$record = $this->processRecord($record);
|
||||
}
|
||||
foreach ($this->handlers as $handler) {
|
||||
$handler->handle($record);
|
||||
@@ -62,18 +68,16 @@ class GroupHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractHandler
|
||||
return \false === $this->bubble;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function handleBatch(array $records)
|
||||
public function handleBatch(array $records) : void
|
||||
{
|
||||
if ($this->processors) {
|
||||
$processed = array();
|
||||
$processed = [];
|
||||
foreach ($records as $record) {
|
||||
foreach ($this->processors as $processor) {
|
||||
$record = \call_user_func($processor, $record);
|
||||
}
|
||||
$processed[] = $record;
|
||||
$processed[] = $this->processRecord($record);
|
||||
}
|
||||
/** @var Record[] $records */
|
||||
$records = $processed;
|
||||
}
|
||||
foreach ($this->handlers as $handler) {
|
||||
@@ -82,20 +86,29 @@ class GroupHandler extends \WPMailSMTP\Vendor\Monolog\Handler\AbstractHandler
|
||||
}
|
||||
public function reset()
|
||||
{
|
||||
parent::reset();
|
||||
$this->resetProcessors();
|
||||
foreach ($this->handlers as $handler) {
|
||||
if ($handler instanceof \WPMailSMTP\Vendor\Monolog\ResettableInterface) {
|
||||
$handler->reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
public function close() : void
|
||||
{
|
||||
parent::close();
|
||||
foreach ($this->handlers as $handler) {
|
||||
$handler->close();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setFormatter(\WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface $formatter)
|
||||
public function setFormatter(\WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface $formatter) : \WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface
|
||||
{
|
||||
foreach ($this->handlers as $handler) {
|
||||
$handler->setFormatter($formatter);
|
||||
if ($handler instanceof \WPMailSMTP\Vendor\Monolog\Handler\FormattableHandlerInterface) {
|
||||
$handler->setFormatter($formatter);
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace WPMailSMTP\Vendor\Monolog\Handler;
|
||||
|
||||
/**
|
||||
* Base Handler class providing basic close() support as well as handleBatch
|
||||
*
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*/
|
||||
abstract class Handler implements \WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function handleBatch(array $records) : void
|
||||
{
|
||||
foreach ($records as $record) {
|
||||
$this->handle($record);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function close() : void
|
||||
{
|
||||
}
|
||||
public function __destruct()
|
||||
{
|
||||
try {
|
||||
$this->close();
|
||||
} catch (\Throwable $e) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
public function __sleep()
|
||||
{
|
||||
$this->close();
|
||||
$reflClass = new \ReflectionClass($this);
|
||||
$keys = [];
|
||||
foreach ($reflClass->getProperties() as $reflProp) {
|
||||
if (!$reflProp->isStatic()) {
|
||||
$keys[] = $reflProp->getName();
|
||||
}
|
||||
}
|
||||
return $keys;
|
||||
}
|
||||
}
|
||||
+27
-27
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -10,11 +11,13 @@
|
||||
*/
|
||||
namespace WPMailSMTP\Vendor\Monolog\Handler;
|
||||
|
||||
use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
/**
|
||||
* Interface that all Monolog Handlers must implement
|
||||
*
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* @phpstan-import-type Record from \Monolog\Logger
|
||||
* @phpstan-import-type Level from \Monolog\Logger
|
||||
*/
|
||||
interface HandlerInterface
|
||||
{
|
||||
@@ -30,8 +33,10 @@ interface HandlerInterface
|
||||
* @param array $record Partial log record containing only a level key
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @phpstan-param array{level: Level} $record
|
||||
*/
|
||||
public function isHandling(array $record);
|
||||
public function isHandling(array $record) : bool;
|
||||
/**
|
||||
* Handles a record.
|
||||
*
|
||||
@@ -42,41 +47,36 @@ interface HandlerInterface
|
||||
* Unless the bubbling is interrupted (by returning true), the Logger class will keep on
|
||||
* calling further handlers in the stack with a given log record.
|
||||
*
|
||||
* @param array $record The record to handle
|
||||
* @return bool true means that this handler handled the record, and that bubbling is not permitted.
|
||||
* false means the record was either not processed or that this handler allows bubbling.
|
||||
* @param array $record The record to handle
|
||||
* @return bool true means that this handler handled the record, and that bubbling is not permitted.
|
||||
* false means the record was either not processed or that this handler allows bubbling.
|
||||
*
|
||||
* @phpstan-param Record $record
|
||||
*/
|
||||
public function handle(array $record);
|
||||
public function handle(array $record) : bool;
|
||||
/**
|
||||
* Handles a set of records at once.
|
||||
*
|
||||
* @param array $records The records to handle (an array of record arrays)
|
||||
*/
|
||||
public function handleBatch(array $records);
|
||||
/**
|
||||
* Adds a processor in the stack.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return self
|
||||
* @phpstan-param Record[] $records
|
||||
*/
|
||||
public function pushProcessor($callback);
|
||||
public function handleBatch(array $records) : void;
|
||||
/**
|
||||
* Removes the processor on top of the stack and returns it.
|
||||
* Closes the handler.
|
||||
*
|
||||
* @return callable
|
||||
*/
|
||||
public function popProcessor();
|
||||
/**
|
||||
* Sets the formatter.
|
||||
* Ends a log cycle and frees all resources used by the handler.
|
||||
*
|
||||
* @param FormatterInterface $formatter
|
||||
* @return self
|
||||
*/
|
||||
public function setFormatter(\WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface $formatter);
|
||||
/**
|
||||
* Gets the formatter.
|
||||
* Closing a Handler means flushing all buffers and freeing any open resources/handles.
|
||||
*
|
||||
* @return FormatterInterface
|
||||
* Implementations have to be idempotent (i.e. it should be possible to call close several times without breakage)
|
||||
* and ideally handlers should be able to reopen themselves on handle() after they have been closed.
|
||||
*
|
||||
* This is useful at the end of a request and will be called automatically when the object
|
||||
* is destroyed if you extend Monolog\Handler\Handler.
|
||||
*
|
||||
* If you are thinking of calling this method yourself, most likely you should be
|
||||
* calling ResettableInterface::reset instead. Have a look.
|
||||
*/
|
||||
public function getFormatter();
|
||||
public function close() : void;
|
||||
}
|
||||
|
||||
+43
-27
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
@@ -29,75 +30,90 @@ use WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface;
|
||||
*
|
||||
* @author Alexey Karapetov <alexey@karapetov.com>
|
||||
*/
|
||||
class HandlerWrapper implements \WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface, \WPMailSMTP\Vendor\Monolog\ResettableInterface
|
||||
class HandlerWrapper implements \WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface, \WPMailSMTP\Vendor\Monolog\Handler\ProcessableHandlerInterface, \WPMailSMTP\Vendor\Monolog\Handler\FormattableHandlerInterface, \WPMailSMTP\Vendor\Monolog\ResettableInterface
|
||||
{
|
||||
/**
|
||||
* @var HandlerInterface
|
||||
*/
|
||||
protected $handler;
|
||||
/**
|
||||
* HandlerWrapper constructor.
|
||||
* @param HandlerInterface $handler
|
||||
*/
|
||||
public function __construct(\WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface $handler)
|
||||
{
|
||||
$this->handler = $handler;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function isHandling(array $record)
|
||||
public function isHandling(array $record) : bool
|
||||
{
|
||||
return $this->handler->isHandling($record);
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function handle(array $record)
|
||||
public function handle(array $record) : bool
|
||||
{
|
||||
return $this->handler->handle($record);
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function handleBatch(array $records)
|
||||
public function handleBatch(array $records) : void
|
||||
{
|
||||
return $this->handler->handleBatch($records);
|
||||
$this->handler->handleBatch($records);
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function pushProcessor($callback)
|
||||
public function close() : void
|
||||
{
|
||||
$this->handler->pushProcessor($callback);
|
||||
return $this;
|
||||
$this->handler->close();
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function popProcessor()
|
||||
public function pushProcessor(callable $callback) : \WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface
|
||||
{
|
||||
return $this->handler->popProcessor();
|
||||
if ($this->handler instanceof \WPMailSMTP\Vendor\Monolog\Handler\ProcessableHandlerInterface) {
|
||||
$this->handler->pushProcessor($callback);
|
||||
return $this;
|
||||
}
|
||||
throw new \LogicException('The wrapped handler does not implement ' . \WPMailSMTP\Vendor\Monolog\Handler\ProcessableHandlerInterface::class);
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setFormatter(\WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface $formatter)
|
||||
public function popProcessor() : callable
|
||||
{
|
||||
$this->handler->setFormatter($formatter);
|
||||
return $this;
|
||||
if ($this->handler instanceof \WPMailSMTP\Vendor\Monolog\Handler\ProcessableHandlerInterface) {
|
||||
return $this->handler->popProcessor();
|
||||
}
|
||||
throw new \LogicException('The wrapped handler does not implement ' . \WPMailSMTP\Vendor\Monolog\Handler\ProcessableHandlerInterface::class);
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getFormatter()
|
||||
public function setFormatter(\WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface $formatter) : \WPMailSMTP\Vendor\Monolog\Handler\HandlerInterface
|
||||
{
|
||||
return $this->handler->getFormatter();
|
||||
if ($this->handler instanceof \WPMailSMTP\Vendor\Monolog\Handler\FormattableHandlerInterface) {
|
||||
$this->handler->setFormatter($formatter);
|
||||
return $this;
|
||||
}
|
||||
throw new \LogicException('The wrapped handler does not implement ' . \WPMailSMTP\Vendor\Monolog\Handler\FormattableHandlerInterface::class);
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getFormatter() : \WPMailSMTP\Vendor\Monolog\Formatter\FormatterInterface
|
||||
{
|
||||
if ($this->handler instanceof \WPMailSMTP\Vendor\Monolog\Handler\FormattableHandlerInterface) {
|
||||
return $this->handler->getFormatter();
|
||||
}
|
||||
throw new \LogicException('The wrapped handler does not implement ' . \WPMailSMTP\Vendor\Monolog\Handler\FormattableHandlerInterface::class);
|
||||
}
|
||||
public function reset()
|
||||
{
|
||||
if ($this->handler instanceof \WPMailSMTP\Vendor\Monolog\ResettableInterface) {
|
||||
return $this->handler->reset();
|
||||
$this->handler->reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user