From 38153c0f3e739f3d89a1a7734fd7d199bf457fab Mon Sep 17 00:00:00 2001 From: yehudah Date: Wed, 15 May 2019 12:14:32 +0000 Subject: = 2.0 - 2019-05-15 * New: Mailer Type - Added an option to send without overwrite the 'wp_mail' function, better compability to WordPress delivery. hopefully will be the default in the future. * Updated: Sendgrid API was upgraded and rewritten to the new version. * Fixed: Message-Id header was missing on SMTP * Fixed: Email logger optimization - better query for large amount of records. * Fixed: The localization was fixed to match translate.wordpress.org translation system ( Thanks to Niels de Blaauw from Level-Level ). * Fixed: Code and optimization ( Thanks to Niels de Blaauw from Level-Level ). --- .../PostmanAbstractAuthenticationManager.php | 4 +- .../PostmanConfigurationController.php | 173 ++++--- .../PostmanRegisterConfigurationSettings.php | 165 +++--- .../Postman-Configuration/PostmanSmtpDiscovery.php | 14 +- .../Postman-Connectivity-Test/Postman-PortTest.php | 4 +- .../PostmanConnectivityTestController.php | 58 +-- Postman/Postman-Controller/PostmanAdminPointer.php | 4 +- .../PostmanDashboardWidgetController.php | 24 +- .../PostmanManageConfigurationAjaxHandler.php | 2 +- .../PostmanWelcomeController.php | 70 +-- .../PostmanDiagnosticTestController.php | 29 +- .../PostmanEmailLogController.php | 74 +-- .../Postman-Email-Log/PostmanEmailLogPostType.php | 4 +- .../Postman-Email-Log/PostmanEmailLogService.php | 36 +- Postman/Postman-Email-Log/PostmanEmailLogView.php | 34 +- .../Postman-Mail/PostmanDefaultModuleTransport.php | 4 +- Postman/Postman-Mail/PostmanEmailAddress.php | 4 +- .../PostmanGmailApiModuleTransport.php | 10 +- .../PostmanGmailApiModuleZendMailTransport.php | 4 +- Postman/Postman-Mail/PostmanMailgunMailEngine.php | 4 +- Postman/Postman-Mail/PostmanMailgunTransport.php | 42 +- Postman/Postman-Mail/PostmanMandrillMailEngine.php | 4 +- Postman/Postman-Mail/PostmanMandrillTransport.php | 24 +- Postman/Postman-Mail/PostmanMessage.php | 24 +- Postman/Postman-Mail/PostmanModuleTransport.php | 47 +- Postman/Postman-Mail/PostmanMyMailConnector.php | 9 +- Postman/Postman-Mail/PostmanSendGridMailEngine.php | 123 ++--- Postman/Postman-Mail/PostmanSendGridTransport.php | 30 +- .../Postman-Mail/PostmanSmtpModuleTransport.php | 84 +-- Postman/Postman-Mail/PostmanTransportRegistry.php | 22 +- Postman/Postman-Mail/PostmanWooCommerce.php | 42 +- Postman/Postman-Mail/PostmanZendMailEngine.php | 6 +- ...ostmanZendMailTransportConfigurationFactory.php | 18 +- Postman/Postman-Mail/Zend-1.12.10/Mail.php | 4 +- .../Zend-1.12.10/Validate/EmailAddress.php | 2 +- Postman/Postman-Mail/sendgrid/composer.json | 4 +- Postman/Postman-Mail/sendgrid/composer.lock | 49 +- Postman/Postman-Mail/sendgrid/vendor/autoload.php | 2 +- .../sendgrid/vendor/composer/autoload_files.php | 1 - .../sendgrid/vendor/composer/autoload_psr4.php | 5 +- .../sendgrid/vendor/composer/autoload_real.php | 10 +- .../sendgrid/vendor/composer/installed.json | 49 +- .../php-http-client/.github/ISSUE_TEMPLATE | 2 +- .../vendor/sendgrid/php-http-client/.gitignore | 11 +- .../vendor/sendgrid/php-http-client/.travis.yml | 6 +- .../vendor/sendgrid/php-http-client/CHANGELOG.md | 66 +++ .../sendgrid/php-http-client/CONTRIBUTING.md | 37 +- .../vendor/sendgrid/php-http-client/LICENSE.txt | 2 +- .../vendor/sendgrid/php-http-client/README.md | 144 +++++- .../vendor/sendgrid/php-http-client/composer.json | 10 +- .../vendor/sendgrid/php-http-client/lib/Client.php | 561 +++++++++++++++++---- .../sendgrid/php-http-client/lib/Response.php | 41 +- .../sendgrid/sendgrid/.github/ISSUE_TEMPLATE | 3 +- .../sendgrid/vendor/sendgrid/sendgrid/.gitignore | 13 +- .../sendgrid/vendor/sendgrid/sendgrid/.travis.yml | 31 +- .../sendgrid/vendor/sendgrid/sendgrid/README.md | 233 +++++---- .../vendor/sendgrid/sendgrid/composer.json | 40 +- .../vendor/sendgrid/sendgrid/lib/SendGrid.php | 80 +-- .../vendor/sendgrid/sendgrid/lib/loader.php | 50 +- .../PostmanSendTestEmailController.php | 52 +- Postman/Postman.php | 95 +++- Postman/PostmanAdminController.php | 41 +- Postman/PostmanAjaxController.php | 10 +- Postman/PostmanConfigTextHelper.php | 66 +-- Postman/PostmanInputSanitizer.php | 11 +- Postman/PostmanInstaller.php | 7 +- Postman/PostmanLogger.php | 4 +- Postman/PostmanMessageHandler.php | 16 +- Postman/PostmanOptions.php | 18 +- Postman/PostmanSession.php | 6 +- Postman/PostmanUtils.php | 67 ++- Postman/PostmanViewController.php | 178 ++++--- Postman/PostmanWpMail.php | 75 ++- Postman/PostmanWpMailBinder.php | 6 +- Postman/notifications/PostmanMailNotify.php | 2 +- README.md | 321 ++++++++---- postman-smtp.php | 8 +- readme.txt | 17 +- script/postman.js | 12 + style/jquery-steps/jquery.steps.css | 1 - style/postman.css | 21 +- 81 files changed, 2300 insertions(+), 1386 deletions(-) diff --git a/Postman/Postman-Auth/PostmanAbstractAuthenticationManager.php b/Postman/Postman-Auth/PostmanAbstractAuthenticationManager.php index 73a7e03..75d734b 100644 --- a/Postman/Postman-Auth/PostmanAbstractAuthenticationManager.php +++ b/Postman/Postman-Auth/PostmanAbstractAuthenticationManager.php @@ -69,7 +69,7 @@ if (! class_exists ( "PostmanAbstractAuthenticationManager" )) { * Decoded the received token * This code is identical for Google and Hotmail * - * @param unknown $response + * @param mixed $response * @throws Exception */ protected function processResponse($response) { @@ -99,7 +99,7 @@ if (! class_exists ( "PostmanAbstractAuthenticationManager" )) { * * This code is identical for Google and Hotmail * - * @param unknown $client + * @param mixed $client */ protected function decodeReceivedAuthorizationToken($newtoken) { assert ( ! empty ( $newtoken ) ); diff --git a/Postman/Postman-Configuration/PostmanConfigurationController.php b/Postman/Postman-Configuration/PostmanConfigurationController.php index bc9c274..6d5b6b5 100644 --- a/Postman/Postman-Configuration/PostmanConfigurationController.php +++ b/Postman/Postman-Configuration/PostmanConfigurationController.php @@ -12,10 +12,12 @@ class PostmanConfigurationController { // Holds the values to be used in the fields callbacks private $rootPluginFilenameAndPath; + private $importableConfiguration; + /** * Constructor * - * @param unknown $rootPluginFilenameAndPath + * @param mixed $rootPluginFilenameAndPath */ public function __construct( $rootPluginFilenameAndPath ) { assert( ! empty( $rootPluginFilenameAndPath ) ); @@ -94,11 +96,11 @@ class PostmanConfigurationController { /** */ private function addLocalizeScriptsToPage() { - $warning = __( 'Warning', Postman::TEXT_DOMAIN ); + $warning = __( 'Warning', 'post-smtp' ); /* translators: where %s is the name of the SMTP server */ - wp_localize_script( 'postman_wizard_script', 'postman_smtp_mitm', sprintf( '%s: %s', $warning, __( 'connected to %1$s instead of %2$s.', Postman::TEXT_DOMAIN ) ) ); + wp_localize_script( 'postman_wizard_script', 'postman_smtp_mitm', sprintf( '%s: %s', $warning, __( 'connected to %1$s instead of %2$s.', 'post-smtp' ) ) ); /* translators: where %d is a port number */ - wp_localize_script( 'postman_wizard_script', 'postman_wizard_bad_redirect_url', __( 'You are about to configure OAuth 2.0 with an IP address instead of a domain name. This is not permitted. Either assign a real domain name to your site or add a fake one in your local host file.', Postman::TEXT_DOMAIN ) ); + wp_localize_script( 'postman_wizard_script', 'postman_wizard_bad_redirect_url', __( 'You are about to configure OAuth 2.0 with an IP address instead of a domain name. This is not permitted. Either assign a real domain name to your site or add a fake one in your local host file.', 'post-smtp' ) ); // user input wp_localize_script( PostmanViewController::POSTMAN_SCRIPT, 'postman_input_sender_email', '#input_' . PostmanOptions::MESSAGE_SENDER_EMAIL ); @@ -131,7 +133,7 @@ class PostmanConfigurationController { * Register the Configuration screen */ public function addConfigurationSubmenu() { - $page = add_submenu_page( null, sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ) ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanConfigurationController::CONFIGURATION_SLUG, array( + $page = add_submenu_page( null, sprintf( __( '%s Setup', 'post-smtp' ), __( 'Postman SMTP', 'post-smtp' ) ), __( 'Postman SMTP', 'post-smtp' ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanConfigurationController::CONFIGURATION_SLUG, array( $this, 'outputManualConfigurationContent', ) ); @@ -155,7 +157,7 @@ class PostmanConfigurationController { * Register the Setup Wizard screen */ public function addSetupWizardSubmenu() { - $page = add_submenu_page( null, sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ) ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanConfigurationController::CONFIGURATION_WIZARD_SLUG, array( + $page = add_submenu_page( null, sprintf( __( '%s Setup', 'post-smtp' ), __( 'Postman SMTP', 'post-smtp' ) ), __( 'Postman SMTP', 'post-smtp' ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanConfigurationController::CONFIGURATION_WIZARD_SLUG, array( $this, 'outputWizardContent', ) ); @@ -194,14 +196,14 @@ class PostmanConfigurationController { public function outputManualConfigurationContent() { print '
'; - PostmanViewController::outputChildPageHeader( __( 'Settings', Postman::TEXT_DOMAIN ), 'advanced_config' ); + PostmanViewController::outputChildPageHeader( __( 'Settings', 'post-smtp' ), 'advanced_config' ); print '
    '; - print sprintf( '
  • %s
  • ', __( 'Account', Postman::TEXT_DOMAIN ) ); - print sprintf( '
  • %s
  • ', __( 'Fallback', Postman::TEXT_DOMAIN ) ); - print sprintf( '
  • %s
  • ', __( 'Message', Postman::TEXT_DOMAIN ) ); - print sprintf( '
  • %s
  • ', __( 'Logging', Postman::TEXT_DOMAIN ) ); - print sprintf( '
  • %s
  • ', __( 'Advanced', Postman::TEXT_DOMAIN ) ); - print sprintf( '
  • %s
  • ', __( 'Notifications', Postman::TEXT_DOMAIN ) ); + print sprintf( '
  • %s
  • ', __( 'Account', 'post-smtp' ) ); + print sprintf( '
  • %s
  • ', __( 'Fallback', 'post-smtp' ) ); + print sprintf( '
  • %s
  • ', __( 'Message', 'post-smtp' ) ); + print sprintf( '
  • %s
  • ', __( 'Logging', 'post-smtp' ) ); + print sprintf( '
  • %s
  • ', __( 'Advanced', 'post-smtp' ) ); + print sprintf( '
  • %s
  • ', __( 'Notifications', 'post-smtp' ) ); print '
'; print '
'; @@ -239,29 +241,29 @@ class PostmanConfigurationController {
-

-

+

+

- + - + options->getFallbackHostname(); ?> - + options->getFallbackPort(); ?> - + __( 'None', Postman::TEXT_DOMAIN ), - 'ssl' => __( 'SSL', Postman::TEXT_DOMAIN ), - 'tls' => __( 'TLS', Postman::TEXT_DOMAIN ), + 'none' => __( 'None', 'post-smtp' ), + 'ssl' => __( 'SSL', 'post-smtp' ), + 'tls' => __( 'TLS', 'post-smtp' ), ); ?> - + - + - + - +
 
@@ -302,36 +304,36 @@ class PostmanConfigurationController {

- +
 
'; - PostmanViewController::outputChildPageHeader( __( 'Setup Wizard', Postman::TEXT_DOMAIN ) ); + PostmanViewController::outputChildPageHeader( __( 'Setup Wizard', 'post-smtp' ) ); print ''; @@ -440,12 +442,12 @@ class PostmanConfigurationController { settings_fields( PostmanAdminController::SETTINGS_GROUP_NAME ); // Wizard Step 0 - printf( '
%s
', _x( 'Import Configuration', 'Wizard Step Title', Postman::TEXT_DOMAIN ) ); + printf( '
%s
', _x( 'Import Configuration', 'Wizard Step Title', 'post-smtp' ) ); print '
'; - printf( '%s', _x( 'Import configuration from another plugin?', 'Wizard Step Title', Postman::TEXT_DOMAIN ) ); - printf( '

%s

', __( 'If you had a working configuration with another Plugin, the Setup Wizard can begin with those settings.', Postman::TEXT_DOMAIN ) ); + printf( '%s', _x( 'Import configuration from another plugin?', 'Wizard Step Title', 'post-smtp' ) ); + printf( '

%s

', __( 'If you had a working configuration with another Plugin, the Setup Wizard can begin with those settings.', 'post-smtp' ) ); print ''; - printf( '', 'none', __( 'None', Postman::TEXT_DOMAIN ) ); + printf( '', 'none', __( 'None', 'post-smtp' ) ); if ( $this->importableConfiguration->isImportAvailable() ) { foreach ( $this->importableConfiguration->getAvailableOptions() as $options ) { @@ -456,20 +458,20 @@ class PostmanConfigurationController { print ''; // Wizard Step 1 - printf( '
%s
', _x( 'Sender Details', 'Wizard Step Title', Postman::TEXT_DOMAIN ) ); + printf( '
%s
', _x( 'Sender Details', 'Wizard Step Title', 'post-smtp' ) ); print '
'; - printf( '%s', _x( 'Who is the mail coming from?', 'Wizard Step Title', Postman::TEXT_DOMAIN ) ); - printf( '

%s

', __( 'Enter the email address and name you\'d like to send mail as.', Postman::TEXT_DOMAIN ) ); - printf( '

%s

', __( 'Please note that to prevent abuse, many email services will not let you send from an email address other than the one you authenticate with.', Postman::TEXT_DOMAIN ) ); - printf( '', __( 'Email Address', Postman::TEXT_DOMAIN ) ); + printf( '%s', _x( 'Who is the mail coming from?', 'Wizard Step Title', 'post-smtp' ) ); + printf( '

%s

', __( 'Enter the email address and name you\'d like to send mail as.', 'post-smtp' ) ); + printf( '

%s

', __( 'Please note that to prevent abuse, many email services will not let you send from an email address other than the one you authenticate with.', 'post-smtp' ) ); + printf( '', __( 'Email Address', 'post-smtp' ) ); print $this->settingsRegistry->from_email_callback(); print '
'; - printf( '', __( 'Name', Postman::TEXT_DOMAIN ) ); + printf( '', __( 'Name', 'post-smtp' ) ); print $this->settingsRegistry->sender_name_callback(); print '
'; // Wizard Step 2 - printf( '
%s
', __( 'Outgoing Mail Server Hostname', Postman::TEXT_DOMAIN ) ); + printf( '
%s
', __( 'Outgoing Mail Server Hostname', 'post-smtp' ) ); print '
'; foreach ( PostmanTransportRegistry::getInstance()->getTransports() as $transport ) { $transport->printWizardMailServerHostnameStep(); @@ -477,11 +479,11 @@ class PostmanConfigurationController { print '
'; // Wizard Step 3 - printf( '
%s
', __( 'Connectivity Test', Postman::TEXT_DOMAIN ) ); + printf( '
%s
', __( 'Connectivity Test', 'post-smtp' ) ); print '
'; - printf( '%s', __( 'How will the connection to the mail server be established?', Postman::TEXT_DOMAIN ) ); - printf( '

%s

', __( 'Your connection settings depend on what your email service provider offers, and what your WordPress host allows.', Postman::TEXT_DOMAIN ) ); - printf( '

%s: %s

', __( 'Connectivity Test', Postman::TEXT_DOMAIN ), _x( 'Ready', 'TCP Port Test Status', Postman::TEXT_DOMAIN ) ); + printf( '%s', __( 'How will the connection to the mail server be established?', 'post-smtp' ) ); + printf( '

%s

', __( 'Your connection settings depend on what your email service provider offers, and what your WordPress host allows.', 'post-smtp' ) ); + printf( '

%s: %s

', __( 'Connectivity Test', 'post-smtp' ), _x( 'Ready', 'TCP Port Test Status', 'post-smtp' ) ); printf( '', plugins_url( 'post-smtp/style/ajax-loader.gif' ) ); printf( '', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::TRANSPORT_TYPE ); printf( '', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::PORT ); @@ -489,27 +491,27 @@ class PostmanConfigurationController { printf( '', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::AUTHENTICATION_TYPE ); print '

'; /* Translators: Where %1$s is the socket identifier and %2$s is the authentication type */ - printf( '

', _x( 'Socket', 'A socket is the network term for host and port together', Postman::TEXT_DOMAIN ) ); - printf( '', __( 'Authentication', Postman::TEXT_DOMAIN ) ); + printf( '', _x( 'Socket', 'A socket is the network term for host and port together', 'post-smtp' ) ); + printf( '', __( 'Authentication', 'post-smtp' ) ); print ('

') ; - $warning = __( 'Warning', Postman::TEXT_DOMAIN ); - $clearCredentialsWarning = __( 'This configuration option will send your authorization credentials in the clear.', Postman::TEXT_DOMAIN ); + $warning = __( 'Warning', 'post-smtp' ); + $clearCredentialsWarning = __( 'This configuration option will send your authorization credentials in the clear.', 'post-smtp' ); printf( '', $warning, $clearCredentialsWarning ); print '
'; // Wizard Step 4 - printf( '
%s
', __( 'Authentication', Postman::TEXT_DOMAIN ) ); + printf( '
%s
', __( 'Authentication', 'post-smtp' ) ); print '
'; - printf( '%s', __( 'How will you prove your identity to the mail server?', Postman::TEXT_DOMAIN ) ); + printf( '%s', __( 'How will you prove your identity to the mail server?', 'post-smtp' ) ); foreach ( PostmanTransportRegistry::getInstance()->getTransports() as $transport ) { $transport->printWizardAuthenticationStep(); } print '
'; // Wizard Step 5 - Notificiations - printf( '
%s
', __( 'Notifications', Postman::TEXT_DOMAIN ) ); + printf( '
%s
', __( 'Notifications', 'post-smtp' ) ); print '
'; - printf( '%s', __( 'Select a notify service to notify you when an email is failed to delivered.', Postman::TEXT_DOMAIN ) ); + printf( '%s', __( 'Select a notify service to notify you when an email is failed to delivered.', 'post-smtp' ) ); ?> '; } @@ -271,9 +271,9 @@ class PostmanPortTestAjaxController { /** * - * @param unknown $hostname - * @param unknown $port - * @param unknown $success + * @param mixed $hostname + * @param mixed $port + * @param mixed $success */ private function buildResponse( $hostname, $port, PostmanPortTest $portTest, $success, $transport = '' ) { $this->logger->debug( sprintf( 'testing port result for %s:%s success=%s', $hostname, $port, $success ) ); diff --git a/Postman/Postman-Controller/PostmanAdminPointer.php b/Postman/Postman-Controller/PostmanAdminPointer.php index 16bd6a2..15fb52d 100644 --- a/Postman/Postman-Controller/PostmanAdminPointer.php +++ b/Postman/Postman-Controller/PostmanAdminPointer.php @@ -13,7 +13,7 @@ if (! class_exists ( 'PostmanAdminPointer' )) { /** * - * @param unknown $rootPluginFilenameAndPath + * @param mixed $rootPluginFilenameAndPath */ function __construct($rootPluginFilenameAndPath) { $this->logger = new PostmanLogger ( get_class ( $this ) ); @@ -35,7 +35,7 @@ if (! class_exists ( 'PostmanAdminPointer' )) { /** * - * @param unknown $hook_suffix + * @param mixed $hook_suffix */ function wptuts_pointer_load($hook_suffix) { // only do this for administrators diff --git a/Postman/Postman-Controller/PostmanDashboardWidgetController.php b/Postman/Postman-Controller/PostmanDashboardWidgetController.php index 7393ee3..6233315 100644 --- a/Postman/Postman-Controller/PostmanDashboardWidgetController.php +++ b/Postman/Postman-Controller/PostmanDashboardWidgetController.php @@ -54,7 +54,7 @@ if (! class_exists ( "PostmanDashboardWidgetController" )) { public function addDashboardWidget() { // only display to the widget to administrator if (PostmanUtils::isAdmin ()) { - wp_add_dashboard_widget ( 'example_dashboard_widget', __ ( 'Postman SMTP', Postman::TEXT_DOMAIN ), array ( + wp_add_dashboard_widget ( 'example_dashboard_widget', __ ( 'Postman SMTP', 'post-smtp' ), array ( $this, 'printDashboardWidget' ) ); // Display function. @@ -67,7 +67,7 @@ if (! class_exists ( "PostmanDashboardWidgetController" )) { public function addNetworkDashboardWidget() { // only display to the widget to administrator if (PostmanUtils::isAdmin ()) { - wp_add_dashboard_widget ( 'example_dashboard_widget', __ ( 'Postman SMTP', Postman::TEXT_DOMAIN ), array ( + wp_add_dashboard_widget ( 'example_dashboard_widget', __ ( 'Postman SMTP', 'post-smtp' ), array ( $this, 'printNetworkDashboardWidget' ) ); // Display function. @@ -78,8 +78,8 @@ if (! class_exists ( "PostmanDashboardWidgetController" )) { * Create the function to output the contents of our Dashboard Widget. */ public function printDashboardWidget() { - $goToSettings = sprintf ( '%s', PostmanUtils::getSettingsPageUrl (), __ ( 'Settings', Postman::TEXT_DOMAIN ) ); - $goToEmailLog = sprintf ( '%s', _x ( 'Email Log', 'The log of Emails that have been delivered', Postman::TEXT_DOMAIN ) ); + $goToSettings = sprintf ( '%s', PostmanUtils::getSettingsPageUrl (), __ ( 'Settings', 'post-smtp' ) ); + $goToEmailLog = sprintf ( '%s', _x ( 'Email Log', 'The log of Emails that have been delivered', 'post-smtp' ) ); if ($this->options->isMailLoggingEnabled ()) { $goToEmailLog = sprintf ( '%s', PostmanUtils::getEmailLogPageUrl (), $goToEmailLog ); } @@ -92,16 +92,16 @@ if (! class_exists ( "PostmanDashboardWidgetController" )) { */ public function print_postman_status() { if (! PostmanPreRequisitesCheck::isReady ()) { - printf ( '

%s

', __ ( 'Error: Postman is missing a required PHP library.', Postman::TEXT_DOMAIN ) ); + printf ( '

%s

', __ ( 'Error: Postman is missing a required PHP library.', 'post-smtp' ) ); } else if ($this->wpMailBinder->isUnboundDueToException ()) { - printf ( '

%s

', __ ( 'Postman: wp_mail has been declared by another plugin or theme, so you won\'t be able to use Postman until the conflict is resolved.', Postman::TEXT_DOMAIN ) ); + printf ( '

%s

', __ ( 'Postman: wp_mail has been declared by another plugin or theme, so you won\'t be able to use Postman until the conflict is resolved.', 'post-smtp' ) ); } else { if ($this->options->getRunMode () != PostmanOptions::RUN_MODE_PRODUCTION) { - printf ( '

%s

', __ ( 'Postman is in non-Production mode and is dumping all emails.', Postman::TEXT_DOMAIN ) ); + printf ( '

%s

', __ ( 'Postman is in non-Production mode and is dumping all emails.', 'post-smtp' ) ); } else if (PostmanTransportRegistry::getInstance ()->getSelectedTransport ()->isConfiguredAndReady ()) { - printf ( '', sprintf ( _n ( 'Postman is configured and has delivered %d email.', 'Postman is configured and has delivered %d emails.', PostmanState::getInstance ()->getSuccessfulDeliveries (), Postman::TEXT_DOMAIN ), PostmanState::getInstance ()->getSuccessfulDeliveries () ) ); + printf ( '', sprintf ( _n ( 'Postman is configured and has delivered %d email.', 'Postman is configured and has delivered %d emails.', PostmanState::getInstance ()->getSuccessfulDeliveries (), 'post-smtp' ), PostmanState::getInstance ()->getSuccessfulDeliveries () ) ); } else { - printf ( '

%s

', __ ( 'Postman is not configured and is mimicking out-of-the-box WordPress email delivery.', Postman::TEXT_DOMAIN ) ); + printf ( '

%s

', __ ( 'Postman is not configured and is mimicking out-of-the-box WordPress email delivery.', 'post-smtp' ) ); } $currentTransport = PostmanTransportRegistry::getInstance ()->getActiveTransport (); $deliveryDetails = $currentTransport->getDeliveryDetails ( $this->options ); @@ -113,14 +113,14 @@ if (! class_exists ( "PostmanDashboardWidgetController" )) { * Create the function to output the contents of our Dashboard Widget. */ public function printNetworkDashboardWidget() { - printf ( '', __ ( 'Postman is operating in per-site mode.', Postman::TEXT_DOMAIN ) ); + printf ( '', __ ( 'Postman is operating in per-site mode.', 'post-smtp' ) ); } /** * From http://www.hughlashbrooke.com/2014/02/wordpress-add-items-glance-widget/ * http://coffeecupweb.com/how-to-add-custom-post-types-to-at-a-glance-dashboard-widget-in-wordpress/ * - * @param unknown $items + * @param mixed $items * @return string */ function customizeAtAGlanceDashboardWidget($items = array()) { @@ -143,7 +143,7 @@ if (! class_exists ( "PostmanDashboardWidgetController" )) { $privated = intval ( $num_posts->private ); $post_type = get_post_type_object ( $type ); - $text = _n ( '%s ' . $post_type->labels->singular_name, '%s ' . $post_type->labels->name, $privated, Postman::TEXT_DOMAIN ); + $text = _n ( '%s ' . $post_type->labels->singular_name, '%s ' . $post_type->labels->name, $privated, 'post-smtp' ); $text = sprintf ( $text, number_format_i18n ( $privated ) ); $items [] = sprintf ( '%2$s', $type, $text, PostmanUtils::getEmailLogPageUrl () ) . "\n"; diff --git a/Postman/Postman-Controller/PostmanManageConfigurationAjaxHandler.php b/Postman/Postman-Controller/PostmanManageConfigurationAjaxHandler.php index 2c05b3a..1260dad 100644 --- a/Postman/Postman-Controller/PostmanManageConfigurationAjaxHandler.php +++ b/Postman/Postman-Controller/PostmanManageConfigurationAjaxHandler.php @@ -27,7 +27,7 @@ class PostmanWizardSocket { /** * - * @param unknown $queryHostData + * @param mixed $queryHostData */ function __construct($queryHostData) { $this->hostname = $queryHostData ['hostname']; diff --git a/Postman/Postman-Controller/PostmanWelcomeController.php b/Postman/Postman-Controller/PostmanWelcomeController.php index b43e969..869848a 100644 --- a/Postman/Postman-Controller/PostmanWelcomeController.php +++ b/Postman/Postman-Controller/PostmanWelcomeController.php @@ -19,8 +19,8 @@ class PostmanWelcomeController { // About add_dashboard_page( - __( 'Welcome', Postman::TEXT_DOMAIN ), - __( 'Welcome', Postman::TEXT_DOMAIN ), + __( 'Welcome', 'post-smtp' ), + __( 'Welcome', 'post-smtp' ), 'manage_options', 'post-about', array( $this, 'about_screen' ) @@ -28,8 +28,8 @@ class PostmanWelcomeController { // Credits add_dashboard_page( - __( 'Credits', Postman::TEXT_DOMAIN ), - __( 'Credits', Postman::TEXT_DOMAIN ), + __( 'Credits', 'post-smtp' ), + __( 'Credits', 'post-smtp' ), 'manage_options', 'post-credits', array( $this, 'credits_screen' ) @@ -72,36 +72,36 @@ class PostmanWelcomeController { }
-

version ); ?>

-
version ); ?>
+

version ); ?>

+
version ); ?>
%s','Post SMTP support every SMTP service: Gmail/G-suite, SendGrid, Mandrill, Office365, and more...' ); ?>
-
version ); ?>
+
version ); ?>
-

+

-

+

- +

-

+

- +

@@ -109,7 +109,7 @@ class PostmanWelcomeController {
-

+

@@ -120,30 +120,30 @@ class PostmanWelcomeController { Supports forced recipients (cc, bcc, to) and custom email headers, SASL Support: Plain/Login/CRAM-MD5/XOAUTH2 authentication, Security Support: SMTPS and STARTTLS (SSL/TLS), - Copy configuration to other instances of Post.', Postman::TEXT_DOMAIN ); ?>

+ Copy configuration to other instances of Post.', 'post-smtp' ); ?>

-

-

+

+

-

-

+

+

-

-

+

+

- +
@@ -170,36 +170,36 @@ class PostmanWelcomeController { }
-

version ); ?>

-
version ); ?>
-
version ); ?>
+

version ); ?>

+
version ); ?>
+
version ); ?>
-

+

-

+

-

-
+

+

diegocanal, Johan Yourstone, @@ -209,7 +209,7 @@ class PostmanWelcomeController {

- +
diff --git a/Postman/Postman-Diagnostic-Test/PostmanDiagnosticTestController.php b/Postman/Postman-Diagnostic-Test/PostmanDiagnosticTestController.php index c526113..82eb558 100644 --- a/Postman/Postman-Diagnostic-Test/PostmanDiagnosticTestController.php +++ b/Postman/Postman-Diagnostic-Test/PostmanDiagnosticTestController.php @@ -12,7 +12,7 @@ class PostmanDiagnosticTestController { /** * Constructor * - * @param unknown $rootPluginFilenameAndPath + * @param mixed $rootPluginFilenameAndPath */ public function __construct( $rootPluginFilenameAndPath ) { assert( ! empty( $rootPluginFilenameAndPath ) ); @@ -77,7 +77,7 @@ class PostmanDiagnosticTestController { * Register the Diagnostics screen */ public function addDiagnosticsSubmenu() { - $page = add_submenu_page( null, sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ) ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanDiagnosticTestController::DIAGNOSTICS_SLUG, array( + $page = add_submenu_page( null, sprintf( __( '%s Setup', 'post-smtp' ), __( 'Postman SMTP', 'post-smtp' ) ), __( 'Postman SMTP', 'post-smtp' ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanDiagnosticTestController::DIAGNOSTICS_SLUG, array( $this, 'outputDiagnosticsContent', ) ); @@ -98,14 +98,14 @@ class PostmanDiagnosticTestController { // test features print '
'; - PostmanViewController::outputChildPageHeader( __( 'Diagnostic Test', Postman::TEXT_DOMAIN ) ); + PostmanViewController::outputChildPageHeader( __( 'Diagnostic Test', 'post-smtp' ) ); - printf( '

%s

', __( 'Are you having issues with Postman?', Postman::TEXT_DOMAIN ) ); + printf( '

%s

', __( 'Are you having issues with Postman?', 'post-smtp' ) ); /* translators: where %1$s and %2$s are the URLs to the Troubleshooting and Support Forums on WordPress.org */ - printf( '

%s

', sprintf( __( 'Please check the troubleshooting and error messages page and the support forum.', Postman::TEXT_DOMAIN ), 'https://wordpress.org/plugins/post-smtp/other_notes/', 'https://wordpress.org/support/plugin/post-smtp' ) ); - printf( '

%s

', __( 'Diagnostic Test', Postman::TEXT_DOMAIN ) ); - printf( '

%s


', sprintf( __( 'If you write for help, please include the following:', Postman::TEXT_DOMAIN ), 'https://wordpress.org/plugins/post-smtp/other_notes/', 'https://wordpress.org/support/plugin/post-smtp' ) ); - printf( '', _x( 'Checking..', 'The "please wait" message', Postman::TEXT_DOMAIN ) ); + printf( '

%s

', sprintf( __( 'Please check the troubleshooting and error messages page and the support forum.', 'post-smtp' ), 'https://wordpress.org/plugins/post-smtp/other_notes/', 'https://wordpress.org/support/plugin/post-smtp' ) ); + printf( '

%s

', __( 'Diagnostic Test', 'post-smtp' ) ); + printf( '

%s


', sprintf( __( 'If you write for help, please include the following:', 'post-smtp' ), 'https://wordpress.org/plugins/post-smtp/other_notes/', 'https://wordpress.org/support/plugin/post-smtp' ) ); + printf( '', _x( 'Checking..', 'The "please wait" message', 'post-smtp' ) ); print '
'; } } @@ -210,6 +210,7 @@ class PostmanGetDiagnosticsViaAjax { public function getDiagnostics() { $curl = curl_version(); $transportRegistry = PostmanTransportRegistry::getInstance(); + $this->addToDiagnostics( 'Mailer', PostmanOptions::getInstance()->getSmtpMailer() ); $this->addToDiagnostics( 'HostName', PostmanUtils::getServerName() ); $this->addToDiagnostics( 'cURL Version', $curl['version'] ); $this->addToDiagnostics( 'OpenSSL Version', $curl['ssl_version'] ); @@ -219,17 +220,15 @@ class PostmanGetDiagnosticsViaAjax { $this->addToDiagnostics( 'WordPress', (is_multisite() ? 'Multisite ' : '') . get_bloginfo( 'version' ) . ' ' . get_locale() . ' ' . get_bloginfo( 'charset', 'display' ) ); $this->addToDiagnostics( 'WordPress Theme', wp_get_theme() ); $this->addToDiagnostics( 'WordPress Plugins', $this->getActivePlugins() ); - { - $bindResult = apply_filters( 'postman_wp_mail_bind_status', null ); - $wp_mail_file_name = 'n/a'; + + $bindResult = apply_filters( 'postman_wp_mail_bind_status', null ); + $wp_mail_file_name = 'n/a'; if ( class_exists( 'ReflectionFunction' ) ) { $wp_mail = new ReflectionFunction( 'wp_mail' ); $wp_mail_file_name = realpath( $wp_mail->getFileName() ); } - if ( ! $bindResult ['bound'] ) { - $this->addToDiagnostics( 'WordPress wp_mail Owner', $wp_mail_file_name ); - } - } + + $this->addToDiagnostics( 'WordPress wp_mail Owner', $wp_mail_file_name ); $this->addToDiagnostics( 'WordPress wp_mail Filter(s)', $this->getFilters( 'wp_mail' ) ); $this->addToDiagnostics( 'WordPress wp_mail_from Filter(s)', $this->getFilters( 'wp_mail_from' ) ); $this->addToDiagnostics( 'WordPress wp_mail_from_name Filter(s)', $this->getFilters( 'wp_mail_from_name' ) ); diff --git a/Postman/Postman-Email-Log/PostmanEmailLogController.php b/Postman/Postman-Email-Log/PostmanEmailLogController.php index be08232..79751f3 100644 --- a/Postman/Postman-Email-Log/PostmanEmailLogController.php +++ b/Postman/Postman-Email-Log/PostmanEmailLogController.php @@ -1,4 +1,5 @@ getRequestParameter( 'email' ); if ( ! empty( $postid ) ) { - $post = get_post( $postid ); - $meta_values = get_post_meta( $postid ); + $meta_values = PostmanEmailLogs::get_data( $postid ); if ( isset( $_POST['mail_to'] ) && ! empty( $_POST['mail_to'] ) ) { $emails = explode( ',', $_POST['mail_to'] ); @@ -87,7 +87,7 @@ class PostmanEmailLogController { $to = $meta_values ['original_to'] [0]; } - $success = wp_mail( $to, $meta_values ['original_subject'] [0], $meta_values ['original_message'] [0], $meta_values ['original_headers'] [0] ); + $success = wp_mail( $to, $meta_values ['original_subject'] [0], maybe_unserialize( $meta_values ['original_message'] [0] ), $meta_values ['original_headers'] [0] ); // Postman API: retrieve the result of sending this message from Postman $result = apply_filters( 'postman_wp_mail_result', null ); @@ -97,7 +97,7 @@ class PostmanEmailLogController { if ( $success ) { $this->logger->debug( 'Email was successfully re-sent' ); // the message was sent successfully, generate an appropriate message for the user - $statusMessage = sprintf( __( 'Your message was delivered (%d ms) to the SMTP server! Congratulations :)', Postman::TEXT_DOMAIN ), $result ['time'] ); + $statusMessage = sprintf( __( 'Your message was delivered (%d ms) to the SMTP server! Congratulations :)', 'post-smtp' ), $result ['time'] ); // compose the JSON response for the caller $response = array( @@ -134,8 +134,8 @@ class PostmanEmailLogController { /** * TODO move this somewhere reusable * - * @param unknown $parameterName - * @return unknown + * @param mixed $parameterName + * @return mixed */ private function getRequestParameter( $parameterName ) { if ( isset( $_POST [ $parameterName ] ) ) { @@ -163,7 +163,7 @@ class PostmanEmailLogController { $purger->verifyLogItemExistsAndRemove( $postid ); } $mh = new PostmanMessageHandler(); - $mh->addMessage( __( 'Mail Log Entries were deleted.', Postman::TEXT_DOMAIN ) ); + $mh->addMessage( __( 'Mail Log Entries were deleted.', 'post-smtp' ) ); } else { $this->logger->warn( sprintf( 'action "%s" not recognized', $_REQUEST ['action'] ) ); } @@ -186,7 +186,7 @@ class PostmanEmailLogController { $purger = new PostmanEmailLogPurger(); $purger->verifyLogItemExistsAndRemove( $postid ); $mh = new PostmanMessageHandler(); - $mh->addMessage( __( 'Mail Log Entry was deleted.', Postman::TEXT_DOMAIN ) ); + $mh->addMessage( __( 'Mail Log Entry was deleted.', 'post-smtp' ) ); } else { $this->logger->warn( sprintf( 'nonce "%s" failed validation', $_REQUEST ['_wpnonce'] ) ); } @@ -202,7 +202,7 @@ class PostmanEmailLogController { $this->logger->trace( 'handling view item' ); $postid = $_REQUEST ['email']; $post = get_post( $postid ); - $meta_values = get_post_meta( $postid ); + $meta_values = PostmanEmailLogs::get_data( $postid ); // https://css-tricks.com/examples/hrs/ print ''; print ''; if ( ! empty( $meta_values ['from_header'] [0] ) ) { - printf( '', _x( 'From', 'Who is this message From?', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['from_header'] [0] ) ); + printf( '', _x( 'From', 'Who is this message From?', 'post-smtp' ), esc_html( $meta_values ['from_header'] [0] ) ); } // show the To header (it's optional) if ( ! empty( $meta_values ['to_header'] [0] ) ) { - printf( '', _x( 'To', 'Who is this message To?', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['to_header'] [0] ) ); + printf( '', _x( 'To', 'Who is this message To?', 'post-smtp' ), esc_html( $meta_values ['to_header'] [0] ) ); } // show the Cc header (it's optional) if ( ! empty( $meta_values ['cc_header'] [0] ) ) { - printf( '', _x( 'Cc', 'Who is this message Cc\'d to?', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['cc_header'] [0] ) ); + printf( '', _x( 'Cc', 'Who is this message Cc\'d to?', 'post-smtp' ), esc_html( $meta_values ['cc_header'] [0] ) ); } // show the Bcc header (it's optional) if ( ! empty( $meta_values ['bcc_header'] [0] ) ) { - printf( '', _x( 'Bcc', 'Who is this message Bcc\'d to?', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['bcc_header'] [0] ) ); + printf( '', _x( 'Bcc', 'Who is this message Bcc\'d to?', 'post-smtp' ), esc_html( $meta_values ['bcc_header'] [0] ) ); } // show the Reply-To header (it's optional) if ( ! empty( $meta_values ['reply_to_header'] [0] ) ) { - printf( '', __( 'Reply-To', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['reply_to_header'] [0] ) ); + printf( '', __( 'Reply-To', 'post-smtp' ), esc_html( $meta_values ['reply_to_header'] [0] ) ); } - printf( '', _x( 'Date', 'What is the date today?', Postman::TEXT_DOMAIN ), $post->post_date ); - printf( '', _x( 'Subject', 'What is the subject of this message?', Postman::TEXT_DOMAIN ), esc_html( $post->post_title ) ); + printf( '', _x( 'Date', 'What is the date today?', 'post-smtp' ), $post->post_date ); + printf( '', _x( 'Subject', 'What is the subject of this message?', 'post-smtp' ), esc_html( $post->post_title ) ); // The Transport UI is always there, in more recent versions that is if ( ! empty( $meta_values ['transport_uri'] [0] ) ) { - printf( '', _x( 'Delivery-URI', 'What is the unique URI of the configuration?', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['transport_uri'] [0] ) ); + printf( '', _x( 'Delivery-URI', 'What is the unique URI of the configuration?', 'post-smtp' ), esc_html( $meta_values ['transport_uri'] [0] ) ); } print '
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
'; print '
'; @@ -260,21 +260,21 @@ class PostmanEmailLogController { $this->logger->trace( 'handling view transcript item' ); $postid = $_REQUEST ['email']; $post = get_post( $postid ); - $meta_values = get_post_meta( $postid ); + $meta_values = PostmanEmailLogs::get_data( $postid ); // https://css-tricks.com/examples/hrs/ print ''; - printf( '

%s

', __( 'This is the conversation between Postman and the mail server. It can be useful for diagnosing problems. DO NOT post it on-line, it may contain your account password.', Postman::TEXT_DOMAIN ) ); + printf( '

%s

', __( 'This is the conversation between Postman and the mail server. It can be useful for diagnosing problems. DO NOT post it on-line, it may contain your account password.', 'post-smtp' ) ); print '
'; print '
';
 			if ( ! empty( $meta_values ['session_transcript'] [0] ) ) {
 				print esc_html( $meta_values ['session_transcript'] [0] );
 			} else {
 				/* Translators: Meaning "Not Applicable" */
-				print __( 'n/a', Postman::TEXT_DOMAIN );
+				print __( 'n/a', 'post-smtp' );
 			}
 			print '
'; print ''; @@ -299,8 +299,8 @@ class PostmanEmailLogController { $this->logger->trace( 'created PostmanEmailLog admin menu item' ); /* Translators where (%s) is the name of the plugin */ - $pageTitle = sprintf( __( '%s Email Log', Postman::TEXT_DOMAIN ), __( 'Post SMTP', Postman::TEXT_DOMAIN ) ); - $pluginName = _x( 'Email Log', 'The log of Emails that have been delivered', Postman::TEXT_DOMAIN ); + $pageTitle = sprintf( __( '%s Email Log', 'post-smtp' ), __( 'Post SMTP', 'post-smtp' ) ); + $pluginName = _x( 'Email Log', 'The log of Emails that have been delivered', 'post-smtp' ); $page = add_submenu_page( PostmanViewController::POSTMAN_MENU_SLUG, $pageTitle, $pluginName, Postman::MANAGE_POSTMAN_CAPABILITY_LOGS, 'postman_email_log', array( $this, 'postman_render_email_page' ) ); @@ -317,10 +317,10 @@ class PostmanEmailLogController { wp_enqueue_style( 'postman_email_log' ); wp_enqueue_script( 'postman_resend_email_script' ); wp_enqueue_script( 'sprintf' ); - wp_localize_script( 'postman_resend_email_script', 'postman_js_email_was_resent', __( 'Email was successfully resent (but without attachments)', Postman::TEXT_DOMAIN ) ); + wp_localize_script( 'postman_resend_email_script', 'postman_js_email_was_resent', __( 'Email was successfully resent (but without attachments)', 'post-smtp' ) ); /* Translators: Where %s is an error message */ - wp_localize_script( 'postman_resend_email_script', 'postman_js_email_not_resent', __( 'Email could not be resent. Error: %s', Postman::TEXT_DOMAIN ) ); - wp_localize_script( 'postman_resend_email_script', 'postman_js_resend_label', __( 'Resend', Postman::TEXT_DOMAIN ) ); + wp_localize_script( 'postman_resend_email_script', 'postman_js_email_not_resent', __( 'Email could not be resent. Error: %s', 'post-smtp' ) ); + wp_localize_script( 'postman_resend_email_script', 'postman_js_resend_label', __( 'Resend', 'post-smtp' ) ); } /** @@ -349,13 +349,15 @@ class PostmanEmailLogController {

+ echo sprintf( __( '%s Email Log', 'post-smtp' ), __( 'Post SMTP', 'post-smtp' ) )?> + +

+ echo __( 'This is a record of deliveries made to the mail server. It does not neccessarily indicate sucessful delivery to the recipient.', 'post-smtp' )?>

- - + +
- - + +
- - + +
- + %5$s
', $item ['ID'], __( 'Resend', Postman::TEXT_DOMAIN ), 'resend-' . $item ['ID'], esc_attr( $to ), __( 'comma-separated for multiple emails', Postman::TEXT_DOMAIN ), wp_create_nonce( 'resend' ) ); + $actions ['resend'] = sprintf( '%2$s
%5$s
', $item ['ID'], __( 'Resend', 'post-smtp' ), 'resend-' . $item ['ID'], esc_attr( $to ), __( 'comma-separated for multiple emails', 'post-smtp' ), wp_create_nonce( 'resend' ) ); } else { - $actions ['resend'] = sprintf( '%2$s', $resendUrl, __( 'Resend', Postman::TEXT_DOMAIN ) ); + $actions ['resend'] = sprintf( '%2$s', $resendUrl, __( 'Resend', 'post-smtp' ) ); } // Return the title contents @@ -159,10 +161,10 @@ class PostmanEmailLogView extends WP_List_Table { function get_columns() { $columns = array( 'cb' => '', // Render a checkbox instead of text - 'title' => _x( 'Subject', 'What is the subject of this message?', Postman::TEXT_DOMAIN ), - 'sent_to' => __( 'Sent To', Postman::TEXT_DOMAIN ), - 'status' => __( 'Status', Postman::TEXT_DOMAIN ), - 'date' => _x( 'Delivery Time', 'When was this email sent?', Postman::TEXT_DOMAIN ), + 'title' => _x( 'Subject', 'What is the subject of this message?', 'post-smtp' ), + 'sent_to' => __( 'Sent To', 'post-smtp' ), + 'status' => __( 'Status', 'post-smtp' ), + 'date' => _x( 'Delivery Time', 'When was this email sent?', 'post-smtp' ), ); return $columns; } @@ -222,7 +224,7 @@ class PostmanEmailLogView extends WP_List_Table { */ function get_bulk_actions() { $actions = array( - 'bulk_delete' => _x( 'Delete', 'Delete an item from the email log', Postman::TEXT_DOMAIN ), + 'bulk_delete' => _x( 'Delete', 'Delete an item from the email log', 'post-smtp' ), ); return $actions; } @@ -363,16 +365,16 @@ class PostmanEmailLogView extends WP_List_Table { // if this PHP system support humanTime, than use it if ( ! empty( $humanTime ) ) { /* Translators: where %s indicates the relative time from now */ - $date = sprintf( _x( '%s ago', 'A relative time as in "five days ago"', Postman::TEXT_DOMAIN ), $humanTime ); + $date = sprintf( _x( '%s ago', 'A relative time as in "five days ago"', 'post-smtp' ), $humanTime ); } - $meta_values = get_post_meta( $post->ID ); + $meta_values = PostmanEmailLogs::get_data( $post->ID ); $sent_to = array_map( 'sanitize_email', explode( ',' , $meta_values ['to_header'] [0] ) ); $flattenedPost = array( // the post title must be escaped as they are displayed in the HTML output 'sent_to' => implode( ', ', $sent_to ), 'title' => esc_html( $post->post_title ), // the post status must be escaped as they are displayed in the HTML output - 'status' => ($post->post_excerpt != null ? esc_html( $post->post_excerpt ) : __( 'Sent', Postman::TEXT_DOMAIN )), + 'status' => ($post->post_excerpt != null ? esc_html( $post->post_excerpt ) : __( 'Sent', 'post-smtp' )), 'date' => date( "$date_format $time_format", strtotime( $post->post_date ) ), 'ID' => $post->ID, ); diff --git a/Postman/Postman-Mail/PostmanDefaultModuleTransport.php b/Postman/Postman-Mail/PostmanDefaultModuleTransport.php index 8f30962..3234a26 100644 --- a/Postman/Postman-Mail/PostmanDefaultModuleTransport.php +++ b/Postman/Postman-Mail/PostmanDefaultModuleTransport.php @@ -8,7 +8,7 @@ if (! class_exists ( 'PostmanSmtpModuleTransport' )) { /** * - * @param unknown $rootPluginFilenameAndPath + * @param mixed $rootPluginFilenameAndPath */ public function __construct($rootPluginFilenameAndPath) { parent::__construct ( $rootPluginFilenameAndPath ); @@ -102,7 +102,7 @@ if (! class_exists ( 'PostmanSmtpModuleTransport' )) { return self::SLUG; } public function getName() { - return __ ( 'Default', Postman::TEXT_DOMAIN ); + return __ ( 'Default', 'post-smtp' ); } public function getHostname() { return 'localhost'; diff --git a/Postman/Postman-Mail/PostmanEmailAddress.php b/Postman/Postman-Mail/PostmanEmailAddress.php index 67c4662..123064d 100644 --- a/Postman/Postman-Mail/PostmanEmailAddress.php +++ b/Postman/Postman-Mail/PostmanEmailAddress.php @@ -61,8 +61,8 @@ if (! class_exists ( 'PostmanEmailAddress' )) { /** * Accept a String of addresses or an array and return an array * - * @param unknown $recipientList - * @param unknown $recipients + * @param mixed $recipientList + * @param mixed $recipients */ public static function convertToArray($emails) { assert ( ! empty ( $emails ) ); diff --git a/Postman/Postman-Mail/PostmanGmailApiModuleTransport.php b/Postman/Postman-Mail/PostmanGmailApiModuleTransport.php index ab568ea..98fc1f1 100644 --- a/Postman/Postman-Mail/PostmanGmailApiModuleTransport.php +++ b/Postman/Postman-Mail/PostmanGmailApiModuleTransport.php @@ -98,7 +98,7 @@ class PostmanGmailApiModuleTransport extends PostmanAbstractZendModuleTransport return self::SLUG; } public function getName() { - return __ ( 'Gmail API', Postman::TEXT_DOMAIN ); + return __ ( 'Gmail API', 'post-smtp' ); } public function isEnvelopeFromValidationSupported() { return false; @@ -148,7 +148,7 @@ class PostmanGmailApiModuleTransport extends PostmanAbstractZendModuleTransport */ public function getDeliveryDetails() { /* translators: where (1) is the secure icon and (2) is the transport name */ - return sprintf ( __ ( 'Postman will send mail via the %1$s %2$s.', Postman::TEXT_DOMAIN ), '🔐', $this->getName () ); + return sprintf ( __ ( 'Postman will send mail via the %1$s %2$s.', 'post-smtp' ), '🔐', $this->getName () ); } /** @@ -162,7 +162,7 @@ class PostmanGmailApiModuleTransport extends PostmanAbstractZendModuleTransport $this->setReadyForOAuthGrant (); if ($this->isPermissionNeeded ()) { /* translators: %1$s is the Client ID label, and %2$s is the Client Secret label */ - $message = sprintf ( __ ( 'You have configured OAuth 2.0 authentication, but have not received permission to use it.', Postman::TEXT_DOMAIN ), $this->getScribe ()->getClientIdLabel (), $this->getScribe ()->getClientSecretLabel () ); + $message = sprintf ( __ ( 'You have configured OAuth 2.0 authentication, but have not received permission to use it.', 'post-smtp' ), $this->getScribe ()->getClientIdLabel (), $this->getScribe ()->getClientSecretLabel () ); $message .= sprintf ( ' %s.', PostmanUtils::getGrantOAuthPermissionUrl (), $this->getScribe ()->getRequestPermissionLinkText () ); array_push ( $messages, $message ); $this->setNotConfiguredAndReady (); @@ -189,7 +189,7 @@ class PostmanGmailApiModuleTransport extends PostmanAbstractZendModuleTransport * * 70 gmail api on port 465 to www.googleapis.com * - * @param unknown $hostData + * @param mixed $hostData */ public function getConfigurationBid(PostmanWizardSocket $hostData, $userAuthOverride, $originalSmtpServer) { $recommendation = array (); @@ -217,7 +217,7 @@ class PostmanGmailApiModuleTransport extends PostmanAbstractZendModuleTransport $overrideItem ['auth_items'] = array ( array ( 'selected' => true, - 'name' => __ ( 'OAuth 2.0 (requires Client ID and Client Secret)', Postman::TEXT_DOMAIN ), + 'name' => __ ( 'OAuth 2.0 (requires Client ID and Client Secret)', 'post-smtp' ), 'value' => 'oauth2' ) ); diff --git a/Postman/Postman-Mail/PostmanGmailApiModuleZendMailTransport.php b/Postman/Postman-Mail/PostmanGmailApiModuleZendMailTransport.php index 3cb05c9..544d5fb 100644 --- a/Postman/Postman-Mail/PostmanGmailApiModuleZendMailTransport.php +++ b/Postman/Postman-Mail/PostmanGmailApiModuleZendMailTransport.php @@ -112,7 +112,7 @@ if (! class_exists ( 'PostmanGmailApiModuleZendMailTransport' )) { * * @param string $host * OPTIONAL (Default: 127.0.0.1) - * @param array|null $config + * @param array $config * OPTIONAL (Default: null) * @return void * @@ -165,7 +165,7 @@ if (! class_exists ( 'PostmanGmailApiModuleZendMailTransport' )) { /** * Gets the connection protocol instance * - * @return Postman_Zend_Mail_Protocol|null + * @return Postman_Zend_Mail_Protocol_Abstract|null */ public function getConnection() { return $this->_connection; diff --git a/Postman/Postman-Mail/PostmanMailgunMailEngine.php b/Postman/Postman-Mail/PostmanMailgunMailEngine.php index f098ec9..abb0466 100644 --- a/Postman/Postman-Mail/PostmanMailgunMailEngine.php +++ b/Postman/Postman-Mail/PostmanMailgunMailEngine.php @@ -27,8 +27,8 @@ if ( ! class_exists( 'PostmanMailgunMailEngine' ) ) { /** * - * @param unknown $senderEmail - * @param unknown $accessToken + * @param mixed $senderEmail + * @param mixed $accessToken */ function __construct( $apiKey, $domainName ) { assert( ! empty( $apiKey ) ); diff --git a/Postman/Postman-Mail/PostmanMailgunTransport.php b/Postman/Postman-Mail/PostmanMailgunTransport.php index dcbc1ae..a673e01 100644 --- a/Postman/Postman-Mail/PostmanMailgunTransport.php +++ b/Postman/Postman-Mail/PostmanMailgunTransport.php @@ -16,7 +16,7 @@ class PostmanMailgunTransport extends PostmanAbstractModuleTransport implements /** * - * @param unknown $rootPluginFilenameAndPath + * @param mixed $rootPluginFilenameAndPath */ public function __construct( $rootPluginFilenameAndPath ) { parent::__construct( $rootPluginFilenameAndPath ); @@ -36,7 +36,7 @@ class PostmanMailgunTransport extends PostmanAbstractModuleTransport implements return self::SLUG; } public function getName() { - return __( 'Mailgun API', Postman::TEXT_DOMAIN ); + return __( 'Mailgun API', 'post-smtp' ); } /** * v0.2.1 @@ -49,7 +49,7 @@ class PostmanMailgunTransport extends PostmanAbstractModuleTransport implements /** * v0.2.1 * - * @return string + * @return int */ public function getPort() { return self::PORT; @@ -78,12 +78,12 @@ class PostmanMailgunTransport extends PostmanAbstractModuleTransport implements } public function getDeliveryDetails() { /* translators: where (1) is the secure icon and (2) is the transport name */ - return sprintf( __( 'Post SMTP will send mail via the %1$s %2$s.', Postman::TEXT_DOMAIN ), '🔐', $this->getName() ); + return sprintf( __( 'Post SMTP will send mail via the %1$s %2$s.', 'post-smtp' ), '🔐', $this->getName() ); } /** * - * @param unknown $data + * @param mixed $data */ public function prepareOptionsForExport( $data ) { $data = parent::prepareOptionsForExport( $data ); @@ -102,17 +102,17 @@ class PostmanMailgunTransport extends PostmanAbstractModuleTransport implements $domainName = $this->options->getMailgunDomainName(); if ( empty( $apiKey ) ) { - array_push( $messages, __( 'API Key can not be empty', Postman::TEXT_DOMAIN ) . '.' ); + array_push( $messages, __( 'API Key can not be empty', 'post-smtp' ) . '.' ); $this->setNotConfiguredAndReady(); } if ( empty( $domainName ) ) { - array_push( $messages, __( 'Domain Name can not be empty', Postman::TEXT_DOMAIN ) . '.' ); + array_push( $messages, __( 'Domain Name can not be empty', 'post-smtp' ) . '.' ); $this->setNotConfiguredAndReady(); } if ( ! $this->isSenderConfigured() ) { - array_push( $messages, __( 'Message From Address can not be empty', Postman::TEXT_DOMAIN ) . '.' ); + array_push( $messages, __( 'Message From Address can not be empty', 'post-smtp' ) . '.' ); $this->setNotConfiguredAndReady(); } return $messages; @@ -139,8 +139,8 @@ class PostmanMailgunTransport extends PostmanAbstractModuleTransport implements /** * - * @param unknown $hostname - * @param unknown $response + * @param mixed $hostname + * @param mixed $response */ public function populateConfiguration( $hostname ) { $response = parent::populateConfiguration( $hostname ); @@ -155,7 +155,7 @@ class PostmanMailgunTransport extends PostmanAbstractModuleTransport implements $overrideItem ['auth_items'] = array( array( 'selected' => true, - 'name' => __( 'API Key', Postman::TEXT_DOMAIN ), + 'name' => __( 'API Key', 'post-smtp' ), 'value' => 'api_key', ), ); @@ -184,40 +184,40 @@ class PostmanMailgunTransport extends PostmanAbstractModuleTransport implements */ public function addSettings() { // the Mailgun Auth section - add_settings_section( PostmanMailgunTransport::MAILGUN_AUTH_SECTION, __( 'Authentication', Postman::TEXT_DOMAIN ), array( + add_settings_section( PostmanMailgunTransport::MAILGUN_AUTH_SECTION, __( 'Authentication', 'post-smtp' ), array( $this, 'printMailgunAuthSectionInfo', ), PostmanMailgunTransport::MAILGUN_AUTH_OPTIONS ); - add_settings_field( PostmanOptions::MAILGUN_API_KEY, __( 'API Key', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::MAILGUN_API_KEY, __( 'API Key', 'post-smtp' ), array( $this, 'mailgun_api_key_callback', ), PostmanMailgunTransport::MAILGUN_AUTH_OPTIONS, PostmanMailgunTransport::MAILGUN_AUTH_SECTION ); - add_settings_field( PostmanOptions::MAILGUN_DOMAIN_NAME, __( 'Domain Name', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::MAILGUN_DOMAIN_NAME, __( 'Domain Name', 'post-smtp' ), array( $this, 'mailgun_domain_name_callback', ), PostmanMailgunTransport::MAILGUN_AUTH_OPTIONS, PostmanMailgunTransport::MAILGUN_AUTH_SECTION ); - add_settings_field( PostmanOptions::MAILGUN_REGION, __( 'Mailgun Europe Region?', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::MAILGUN_REGION, __( 'Mailgun Europe Region?', 'post-smtp' ), array( $this, 'mailgun_region_callback', ), PostmanMailgunTransport::MAILGUN_AUTH_OPTIONS, PostmanMailgunTransport::MAILGUN_AUTH_SECTION ); } public function printMailgunAuthSectionInfo() { /* Translators: Where (1) is the service URL and (2) is the service name and (3) is a api key URL */ - printf( '

%s

', sprintf( __( 'Create an account at %2$s and enter an API key below.', Postman::TEXT_DOMAIN ), 'https://mailgun.com', 'mailgun.com', 'https://app.mailgun.com/app/domains/' ) ); + printf( '

%s

', sprintf( __( 'Create an account at %2$s and enter an API key below.', 'post-smtp' ), 'https://mailgun.com', 'mailgun.com', 'https://app.mailgun.com/app/domains/' ) ); } /** */ public function mailgun_api_key_callback() { - printf( '', null !== $this->options->getMailgunApiKey() ? esc_attr( PostmanUtils::obfuscatePassword( $this->options->getMailgunApiKey() ) ) : '', __( 'Required', Postman::TEXT_DOMAIN ) ); + printf( '', null !== $this->options->getMailgunApiKey() ? esc_attr( PostmanUtils::obfuscatePassword( $this->options->getMailgunApiKey() ) ) : '', __( 'Required', 'post-smtp' ) ); print ''; } function mailgun_domain_name_callback() { - printf( '', null !== $this->options->getMailgunDomainName() ? esc_attr( $this->options->getMailgunDomainName() ) : '', __( 'Required', Postman::TEXT_DOMAIN ) ); + printf( '', null !== $this->options->getMailgunDomainName() ? esc_attr( $this->options->getMailgunDomainName() ) : '', __( 'Required', 'post-smtp' ) ); } function mailgun_region_callback() { @@ -248,14 +248,14 @@ class PostmanMailgunTransport extends PostmanAbstractModuleTransport implements public function printWizardAuthenticationStep() { print '
'; $this->printMailgunAuthSectionInfo(); - printf( '', __( 'API Key', Postman::TEXT_DOMAIN ) ); + printf( '', __( 'API Key', 'post-smtp' ) ); print '
'; print $this->mailgun_api_key_callback(); - printf( '', __( 'Domain Name', Postman::TEXT_DOMAIN ) ); + printf( '', __( 'Domain Name', 'post-smtp' ) ); print '
'; print $this->mailgun_domain_name_callback(); print '
'; - printf( '', __( 'Mailgun Europe Region?', Postman::TEXT_DOMAIN ) ); + printf( '', __( 'Mailgun Europe Region?', 'post-smtp' ) ); print '
'; print $this->mailgun_region_callback(); print '
'; diff --git a/Postman/Postman-Mail/PostmanMandrillMailEngine.php b/Postman/Postman-Mail/PostmanMandrillMailEngine.php index 7549a37..6ecc156 100644 --- a/Postman/Postman-Mail/PostmanMandrillMailEngine.php +++ b/Postman/Postman-Mail/PostmanMandrillMailEngine.php @@ -22,8 +22,8 @@ if ( ! class_exists( 'PostmanMandrillMailEngine' ) ) { /** * - * @param unknown $senderEmail - * @param unknown $accessToken + * @param mixed $senderEmail + * @param mixed $accessToken */ function __construct( $apiKey ) { assert( ! empty( $apiKey ) ); diff --git a/Postman/Postman-Mail/PostmanMandrillTransport.php b/Postman/Postman-Mail/PostmanMandrillTransport.php index 795abfd..8284660 100644 --- a/Postman/Postman-Mail/PostmanMandrillTransport.php +++ b/Postman/Postman-Mail/PostmanMandrillTransport.php @@ -25,7 +25,7 @@ class PostmanMandrillTransport extends PostmanAbstractModuleTransport implements /** * - * @param unknown $data + * @param mixed $data */ public function prepareOptionsForExport($data) { $data = parent::prepareOptionsForExport ( $data ); @@ -41,7 +41,7 @@ class PostmanMandrillTransport extends PostmanAbstractModuleTransport implements return self::SLUG; } public function getName() { - return __ ( 'Mandrill API', Postman::TEXT_DOMAIN ); + return __ ( 'Mandrill API', 'post-smtp' ); } /** * v0.2.1 @@ -54,7 +54,7 @@ class PostmanMandrillTransport extends PostmanAbstractModuleTransport implements /** * v0.2.1 * - * @return string + * @return int */ public function getPort() { return self::PORT; @@ -132,7 +132,7 @@ class PostmanMandrillTransport extends PostmanAbstractModuleTransport implements */ public function getDeliveryDetails() { /* translators: where (1) is the secure icon and (2) is the transport name */ - return sprintf ( __ ( 'Postman will send mail via the %1$s %2$s.', Postman::TEXT_DOMAIN ), '🔐', $this->getName () ); + return sprintf ( __ ( 'Postman will send mail via the %1$s %2$s.', 'post-smtp' ), '🔐', $this->getName () ); } /** @@ -144,11 +144,11 @@ class PostmanMandrillTransport extends PostmanAbstractModuleTransport implements $messages = parent::validateTransportConfiguration (); $apiKey = $this->options->getMandrillApiKey (); if (empty ( $apiKey )) { - array_push ( $messages, __ ( 'API Key can not be empty', Postman::TEXT_DOMAIN ) . '.' ); + array_push ( $messages, __ ( 'API Key can not be empty', 'post-smtp' ) . '.' ); $this->setNotConfiguredAndReady (); } if (! $this->isSenderConfigured ()) { - array_push ( $messages, __ ( 'Message From Address can not be empty', Postman::TEXT_DOMAIN ) . '.' ); + array_push ( $messages, __ ( 'Message From Address can not be empty', 'post-smtp' ) . '.' ); $this->setNotConfiguredAndReady (); } return $messages; @@ -191,7 +191,7 @@ class PostmanMandrillTransport extends PostmanAbstractModuleTransport implements $overrideItem ['auth_items'] = array ( array ( 'selected' => true, - 'name' => __ ( 'API Key', Postman::TEXT_DOMAIN ), + 'name' => __ ( 'API Key', 'post-smtp' ), 'value' => 'api_key' ) ); @@ -220,12 +220,12 @@ class PostmanMandrillTransport extends PostmanAbstractModuleTransport implements */ public function addSettings() { // the Mandrill Auth section - add_settings_section ( PostmanMandrillTransport::MANDRILL_AUTH_SECTION, __ ( 'Authentication', Postman::TEXT_DOMAIN ), array ( + add_settings_section ( PostmanMandrillTransport::MANDRILL_AUTH_SECTION, __ ( 'Authentication', 'post-smtp' ), array ( $this, 'printMandrillAuthSectionInfo' ), PostmanMandrillTransport::MANDRILL_AUTH_OPTIONS ); - add_settings_field ( PostmanOptions::MANDRILL_API_KEY, __ ( 'API Key', Postman::TEXT_DOMAIN ), array ( + add_settings_field ( PostmanOptions::MANDRILL_API_KEY, __ ( 'API Key', 'post-smtp' ), array ( $this, 'mandrill_api_key_callback' ), PostmanMandrillTransport::MANDRILL_AUTH_OPTIONS, PostmanMandrillTransport::MANDRILL_AUTH_SECTION ); @@ -235,13 +235,13 @@ class PostmanMandrillTransport extends PostmanAbstractModuleTransport implements */ public function printMandrillAuthSectionInfo() { /* Translators: Where (1) is the service URL and (2) is the service name and (3) is a api key URL */ - printf ( '

%s

', sprintf ( __ ( 'Create an account at %2$s and enter an API key below.', Postman::TEXT_DOMAIN ), 'https://mandrillapp.com', 'Mandrillapp.com', 'https://mandrillapp.com/settings' ) ); + printf ( '

%s

', sprintf ( __ ( 'Create an account at %2$s and enter an API key below.', 'post-smtp' ), 'https://mandrillapp.com', 'Mandrillapp.com', 'https://mandrillapp.com/settings' ) ); } /** */ public function mandrill_api_key_callback() { - printf ( '', null !== $this->options->getMandrillApiKey () ? esc_attr ( PostmanUtils::obfuscatePassword ( $this->options->getMandrillApiKey () ) ) : '', __ ( 'Required', Postman::TEXT_DOMAIN ) ); + printf ( '', null !== $this->options->getMandrillApiKey () ? esc_attr ( PostmanUtils::obfuscatePassword ( $this->options->getMandrillApiKey () ) ) : '', __ ( 'Required', 'post-smtp' ) ); print ' '; } @@ -268,7 +268,7 @@ class PostmanMandrillTransport extends PostmanAbstractModuleTransport implements public function printWizardAuthenticationStep() { print '
'; $this->printMandrillAuthSectionInfo (); - printf ( '', __ ( 'API Key', Postman::TEXT_DOMAIN ) ); + printf ( '', __ ( 'API Key', 'post-smtp' ) ); print '
'; print $this->mandrill_api_key_callback (); print '
'; diff --git a/Postman/Postman-Mail/PostmanMessage.php b/Postman/Postman-Mail/PostmanMessage.php index 2af67ef..7f8949e 100644 --- a/Postman/Postman-Mail/PostmanMessage.php +++ b/Postman/Postman-Mail/PostmanMessage.php @@ -52,7 +52,7 @@ if ( ! class_exists( 'PostmanMessage' ) ) { } function __get( $name ) { - $message = __( '%1$s property of a PostmanMessage object is not supported. For now all of this class properties are private.', Postman::TEXT_DOMAIN ); + $message = __( '%1$s property of a PostmanMessage object is not supported. For now all of this class properties are private.', 'post-smtp' ); if ( WP_DEBUG ) { trigger_error( sprintf( $message, $name ) ); @@ -63,7 +63,7 @@ if ( ! class_exists( 'PostmanMessage' ) ) { $class = new ReflectionClass(__CLASS__); $methods = $class->getMethods(ReflectionMethod::IS_PUBLIC ); - $message = __( '%1$s method of a PostmanMessage object is not supported. Use one of the following methods
%2$s
', Postman::TEXT_DOMAIN ); + $message = __( '%1$s method of a PostmanMessage object is not supported. Use one of the following methods
%2$s
', 'post-smtp' ); if ( WP_DEBUG ) { trigger_error( sprintf( $message, $name, print_r( $methods, true ) ) ); @@ -291,7 +291,7 @@ if ( ! class_exists( 'PostmanMessage' ) ) { /** * Set the charset * - * @param unknown $charset + * @param mixed $charset */ public function setCharset( $charset ) { $this->charset = $charset; @@ -310,7 +310,7 @@ if ( ! class_exists( 'PostmanMessage' ) ) { } /** * - * @param unknown $recipients + * @param mixed $recipients * Array or comma-separated list of email addresses to send message. * @throws Exception */ @@ -319,7 +319,7 @@ if ( ! class_exists( 'PostmanMessage' ) ) { } /** * - * @param unknown $recipients + * @param mixed $recipients * Array or comma-separated list of email addresses to send message. * @throws Exception */ @@ -328,7 +328,7 @@ if ( ! class_exists( 'PostmanMessage' ) ) { } /** * - * @param unknown $recipients + * @param mixed $recipients * Array or comma-separated list of email addresses to send message. * @throws Exception */ @@ -337,7 +337,7 @@ if ( ! class_exists( 'PostmanMessage' ) ) { } /** * - * @param unknown $recipients + * @param mixed $recipients * Array or comma-separated list of email addresses to send message. * @throws Exception */ @@ -391,8 +391,8 @@ if ( ! class_exists( 'PostmanMessage' ) ) { * Add the headers that were processed in processHeaders() * Zend requires that several headers are specially handled. * - * @param unknown $name - * @param unknown $value + * @param mixed $name + * @param mixed $value * @param Postman_Zend_Mail $mail */ private function processHeader( $name, $content ) { @@ -477,9 +477,9 @@ if ( ! class_exists( 'PostmanMessage' ) ) { /** * - * @param unknown $desc - * @param unknown $name - * @param unknown $content + * @param mixed $desc + * @param mixed $name + * @param mixed $content */ private function logProcessHeader( $desc, $name, $content ) { $this->logger->debug( 'Processing ' . $desc . ' Header - ' . $name . ': ' . $content ); diff --git a/Postman/Postman-Mail/PostmanModuleTransport.php b/Postman/Postman-Mail/PostmanModuleTransport.php index 21c1624..1dcc8b0 100644 --- a/Postman/Postman-Mail/PostmanModuleTransport.php +++ b/Postman/Postman-Mail/PostmanModuleTransport.php @@ -43,6 +43,7 @@ interface PostmanModuleTransport extends PostmanTransport { public function isReadyToSendMail(); public function getFromEmailAddress(); public function getFromName(); + public function getHostname(); public function getProtocol(); public function isEmailValidationSupported(); public function getPort(); @@ -68,7 +69,7 @@ abstract class PostmanAbstractModuleTransport implements PostmanModuleTransport /** * These internal variables are exposed for the subclasses to use * - * @var unknown + * @var mixed */ protected $logger; protected $options; @@ -124,7 +125,7 @@ abstract class PostmanAbstractModuleTransport implements PostmanModuleTransport /** * - * @param unknown $data + * @param mixed $data */ public function prepareOptionsForExport($data) { // no-op @@ -139,7 +140,7 @@ abstract class PostmanAbstractModuleTransport implements PostmanModuleTransport /** * - * @param unknown $queryHostname + * @param mixed $queryHostname */ protected function createScribe($hostname) { $scribe = new PostmanNonOAuthScribe ( $hostname ); @@ -281,8 +282,8 @@ abstract class PostmanAbstractModuleTransport implements PostmanModuleTransport /** * - * @param unknown $hostname - * @param unknown $response + * @param mixed $hostname + * @param mixed $response */ public function populateConfiguration($hostname) { $configuration = array (); @@ -290,8 +291,8 @@ abstract class PostmanAbstractModuleTransport implements PostmanModuleTransport } /** * - * @param unknown $winningRecommendation - * @param unknown $response + * @param mixed $winningRecommendation + * @param mixed $response */ public function populateConfigurationFromRecommendation($winningRecommendation) { $configuration = array (); @@ -421,7 +422,7 @@ abstract class PostmanAbstractZendModuleTransport extends PostmanAbstractModuleT /** * - * @param unknown $data + * @param mixed $data */ public function prepareOptionsForExport($data) { $data = parent::prepareOptionsForExport ( $data ); @@ -455,7 +456,7 @@ abstract class PostmanAbstractZendModuleTransport extends PostmanAbstractModuleT /** * - * @param unknown $queryHostname + * @param mixed $queryHostname */ protected function createScribe($hostname) { $scribe = null; @@ -503,12 +504,12 @@ abstract class PostmanAbstractZendModuleTransport extends PostmanAbstractModuleT $deliveryDetails ['host'] = $this->getHostname () . ':' . $this->getPort (); $deliveryDetails ['auth_desc'] = $this->getAuthenticationDescription ( $this->getAuthenticationType () ); /* translators: where (1) is the transport type, (2) is the host, and (3) is the Authentication Type (e.g. Postman will send mail via smtp.gmail.com:465 using OAuth 2.0 authentication.) */ - return sprintf ( __ ( 'Postman will send mail via %1$s to %2$s using %3$s authentication.', Postman::TEXT_DOMAIN ), '' . $deliveryDetails ['transport_name'] . '', '' . $deliveryDetails ['host'] . '', '' . $deliveryDetails ['auth_desc'] . '' ); + return sprintf ( __ ( 'Postman will send mail via %1$s to %2$s using %3$s authentication.', 'post-smtp' ), '' . $deliveryDetails ['transport_name'] . '', '' . $deliveryDetails ['host'] . '', '' . $deliveryDetails ['auth_desc'] . '' ); } /** * - * @param unknown $encType + * @param mixed $encType * @return string */ protected function getTransportDescription($encType) { @@ -525,13 +526,13 @@ abstract class PostmanAbstractZendModuleTransport extends PostmanAbstractModuleT /** * - * @param unknown $authType + * @param mixed $authType */ protected function getAuthenticationDescription($authType) { if (PostmanOptions::AUTHENTICATION_TYPE_OAUTH2 == $authType) { return 'OAuth 2.0'; } else if (PostmanOptions::AUTHENTICATION_TYPE_NONE == $authType) { - return _x ( 'no', 'as in "There is no Spoon"', Postman::TEXT_DOMAIN ); + return _x ( 'no', 'as in "There is no Spoon"', 'post-smtp' ); } else { switch ($authType) { case PostmanOptions::AUTHENTICATION_TYPE_CRAMMD5 : @@ -550,7 +551,7 @@ abstract class PostmanAbstractZendModuleTransport extends PostmanAbstractModuleT $authDescription = $authType; break; } - return sprintf ( '%s (%s)', __ ( 'Password', Postman::TEXT_DOMAIN ), $authDescription ); + return sprintf ( '%s (%s)', __ ( 'Password', 'post-smtp' ), $authDescription ); } } @@ -575,13 +576,13 @@ abstract class PostmanAbstractZendModuleTransport extends PostmanAbstractModuleT parent::validateTransportConfiguration (); $messages = parent::validateTransportConfiguration (); if (! $this->isSenderConfigured ()) { - array_push ( $messages, __ ( 'Message From Address can not be empty', Postman::TEXT_DOMAIN ) . '.' ); + array_push ( $messages, __ ( 'Message From Address can not be empty', 'post-smtp' ) . '.' ); $this->setNotConfiguredAndReady (); } if ($this->getAuthenticationType () == PostmanOptions::AUTHENTICATION_TYPE_OAUTH2) { if (! $this->isOAuth2ClientIdAndClientSecretConfigured ()) { /* translators: %1$s is the Client ID label, and %2$s is the Client Secret label (e.g. Warning: OAuth 2.0 authentication requires an OAuth 2.0-capable Outgoing Mail Server, Sender Email Address, Client ID, and Client Secret.) */ - array_push ( $messages, sprintf ( __ ( 'OAuth 2.0 authentication requires a %1$s and %2$s.', Postman::TEXT_DOMAIN ), $this->getScribe ()->getClientIdLabel (), $this->getScribe ()->getClientSecretLabel () ) ); + array_push ( $messages, sprintf ( __ ( 'OAuth 2.0 authentication requires a %1$s and %2$s.', 'post-smtp' ), $this->getScribe ()->getClientIdLabel (), $this->getScribe ()->getClientSecretLabel () ) ); $this->setNotConfiguredAndReady (); } } @@ -621,8 +622,8 @@ abstract class PostmanAbstractZendModuleTransport extends PostmanAbstractModuleT /** * - * @param unknown $hostname - * @param unknown $response + * @param mixed $hostname + * @param mixed $response */ public function populateConfiguration($hostname) { $response = parent::populateConfiguration ( $hostname ); @@ -650,8 +651,8 @@ abstract class PostmanAbstractZendModuleTransport extends PostmanAbstractModuleT /** * Populate the Ajax response for the Setup Wizard / Manual Configuration * - * @param unknown $hostname - * @param unknown $response + * @param mixed $hostname + * @param mixed $response */ public function populateConfigurationFromRecommendation($winningRecommendation) { $response = parent::populateConfigurationFromRecommendation ( $winningRecommendation ); @@ -703,21 +704,21 @@ abstract class PostmanAbstractZendModuleTransport extends PostmanAbstractModuleT if ($socket->auth_crammd5 || $socket->auth_login || $socket->authPlain) { array_push ( $overrideAuthItems, array ( 'selected' => $passwordMode, - 'name' => __ ( 'Password (requires username and password)', Postman::TEXT_DOMAIN ), + 'name' => __ ( 'Password (requires username and password)', 'post-smtp' ), 'value' => 'password' ) ); } if ($socket->auth_xoauth || $winningRecommendation ['auth'] == 'oauth2') { array_push ( $overrideAuthItems, array ( 'selected' => $oauth2Mode, - 'name' => __ ( 'OAuth 2.0 (requires Client ID and Client Secret)', Postman::TEXT_DOMAIN ), + 'name' => __ ( 'OAuth 2.0 (requires Client ID and Client Secret)', 'post-smtp' ), 'value' => 'oauth2' ) ); } if ($socket->auth_none) { array_push ( $overrideAuthItems, array ( 'selected' => $noAuthMode, - 'name' => __ ( 'None', Postman::TEXT_DOMAIN ), + 'name' => __ ( 'None', 'post-smtp' ), 'value' => 'none' ) ); } diff --git a/Postman/Postman-Mail/PostmanMyMailConnector.php b/Postman/Postman-Mail/PostmanMyMailConnector.php index e08aa02..f6b7e54 100644 --- a/Postman/Postman-Mail/PostmanMyMailConnector.php +++ b/Postman/Postman-Mail/PostmanMyMailConnector.php @@ -155,7 +155,6 @@ if ( ! class_exists( 'PostmanMyMailConnector' ) ) { * * @access public * @param mixed $message - * @return array */ public function reset() { update_option( '_transient__mailster_send_period_timeout', false ); @@ -169,10 +168,10 @@ if ( ! class_exists( 'PostmanMyMailConnector' ) ) { * * @access public * @param mixed $delivery_methods - * @return void + * @return mixed */ public function delivery_method( $delivery_methods ) { - $delivery_methods [ MAILSTER_POSTMAN_ID ] = __( 'Postman SMTP', Postman::TEXT_DOMAIN ); + $delivery_methods [ MAILSTER_POSTMAN_ID ] = __( 'Postman SMTP', 'post-smtp' ); return $delivery_methods; } @@ -196,7 +195,7 @@ if ( ! class_exists( 'PostmanMyMailConnector' ) ) { */ public function activate() { if ( defined( 'MAILSTER_VERSION' ) && version_compare( MAILSTER_POSTMAN_REQUIRED_VERSION, MAILSTER_VERSION, '<=' ) ) { - mailster_notice( sprintf( __( 'MyMail: Change the delivery method in the %s!', Postman::TEXT_DOMAIN ), sprintf( '%s', __( 'Settings', 'postman-smtp' ) ) ), '', false, 'delivery_method' ); + mailster_notice( sprintf( __( 'MyMail: Change the delivery method in the %s!', 'post-smtp' ), sprintf( '%s', __( 'Settings', 'postman-smtp' ) ) ), '', false, 'delivery_method' ); $this->reset(); } } @@ -212,7 +211,7 @@ if ( ! class_exists( 'PostmanMyMailConnector' ) ) { if ( mailster_option( 'deliverymethod' ) == MAILSTER_POSTMAN_ID ) { mailster_update_option( 'deliverymethod', 'simple' ); /* Translators where %s is the name of the page */ - mailster_notice( sprintf( __( 'MyMail: Change the delivery method in the %s!', Postman::TEXT_DOMAIN ), sprintf( '%s', __( 'Settings', 'postman-smtp' ) ) ), '', false, 'delivery_method' ); + mailster_notice( sprintf( __( 'MyMail: Change the delivery method in the %s!', 'post-smtp' ), sprintf( '%s', __( 'Settings', 'postman-smtp' ) ) ), '', false, 'delivery_method' ); } } } diff --git a/Postman/Postman-Mail/PostmanSendGridMailEngine.php b/Postman/Postman-Mail/PostmanSendGridMailEngine.php index 32cfb9e..b3e13b9 100644 --- a/Postman/Postman-Mail/PostmanSendGridMailEngine.php +++ b/Postman/Postman-Mail/PostmanSendGridMailEngine.php @@ -22,8 +22,8 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) { /** * - * @param unknown $senderEmail - * @param unknown $accessToken + * @param mixed $senderEmail + * @param mixed $accessToken */ function __construct( $apiKey ) { assert( ! empty( $apiKey ) ); @@ -41,86 +41,62 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) { public function send( PostmanMessage $message ) { $options = PostmanOptions::getInstance(); - // add the From Header + $email = new \SendGrid\Mail\Mail(); + + // add the From Header $sender = $message->getFromAddress(); $senderEmail = ! empty( $sender->getEmail() ) ? $sender->getEmail() : $options->getMessageSenderEmail(); $senderName = ! empty( $sender->getName() ) ? $sender->getName() : $options->getMessageSenderName(); - $from = new SendGrid\Email( $senderName, $senderEmail ); + $email->setFrom($senderEmail, $senderName); - // now log it + // now log it $sender->log( $this->logger, 'From' ); - // add the to recipients - $counter = 0; - $emails = array(); - /** - * @todo: Find a better approch. - */ - $duplicates = array(); + // add the to recipients foreach ( ( array ) $message->getToRecipients() as $recipient ) { - $recipient->log( $this->logger, 'To' ); - - $email = $recipient->getEmail(); - if ( $counter == 0 ) { - $this->logger->debug( 'Adding to=' . $recipient->getEmail() ); - $to = new SendGrid\Email($recipient->getName(), $recipient->getEmail() ); - $duplicates[] = $email; - } else { - if ( ! in_array( $email, $duplicates ) ) { - $duplicates[] = $email; - $this->logger->debug( 'Adding personalization to=' . $recipient->getEmail() ); - $emails[] = new SendGrid\Email($recipient->getName(), $recipient->getEmail() ); - } - } - - $counter++; + $emails[] = new \SendGrid\Mail\To($recipient->getEmail(), $recipient->getName() ); } + $email->addTos( $emails ); + // add the subject if ( null !== $message->getSubject() ) { - $subject = $message->getSubject(); - } + $email->setSubject($message->getSubject()); + } // add the message content $textPart = $message->getBodyTextPart(); if ( ! empty( $textPart ) ) { $this->logger->debug( 'Adding body as text' ); - $content = new SendGrid\Content("text/plain", $textPart); - } + $email->addContent("text/plain", $textPart); + } $htmlPart = $message->getBodyHtmlPart(); if ( ! empty( $htmlPart ) ) { $this->logger->debug( 'Adding body as html' ); - $content = new SendGrid\Content("text/html", $htmlPart); - } - - $mail = new SendGrid\Mail($from, $subject, $to, $content); - - foreach ( $emails as $email) { - $mail->personalization[0]->addTo($email); + $email->addContent("text/html", $htmlPart); } // add the reply-to $replyTo = $message->getReplyTo(); // $replyTo is null or a PostmanEmailAddress object if ( isset( $replyTo ) ) { - $reply_to = new SendGrid\ReplyTo( $replyTo->getEmail(), $replyTo->getName() ); - $mail->setReplyTo($reply_to); + $email->setReplyTo( $replyTo->getEmail(), $replyTo->getName() ); } // add the Postman signature - append it to whatever the user may have set if ( ! $options->isStealthModeEnabled() ) { $pluginData = apply_filters( 'postman_get_plugin_metadata', null ); - $mail->personalization[0]->addHeader( 'X-Mailer', sprintf( 'Postman SMTP %s for WordPress (%s)', $pluginData ['version'], 'https://wordpress.org/plugins/post-smtp/' ) ); + $email->addHeader( 'X-Mailer', sprintf( 'Postman SMTP %s for WordPress (%s)', $pluginData ['version'], 'https://wordpress.org/plugins/post-smtp/' ) ); } // add the headers - see http://framework.zend.com/manual/1.12/en/zend.mail.additional-headers.html foreach ( ( array ) $message->getHeaders() as $header ) { $this->logger->debug( sprintf( 'Adding user header %s=%s', $header ['name'], $header ['content'] ) ); - $mail->personalization[0]->addHeader( $header ['name'], $header ['content'] ); + $email->addHeader( $header ['name'], $header ['content'] ); } // if the caller set a Content-Type header, use it @@ -130,28 +106,25 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) { } // add the cc recipients + $ccEmails = array(); foreach ( ( array ) $message->getCcRecipients() as $recipient ) { - if ( ! in_array( $recipient->getEmail(), $duplicates ) ) { - $recipient->log( $this->logger, 'Cc' ); - $email = new SendGrid\Email( $recipient->getName(), $recipient->getEmail() ); - $mail->personalization[0]->addCc( $email ); - } - + $recipient->log( $this->logger, 'Cc' ); + $ccEmails[] = new \SendGrid\Mail\Cc( $recipient->getEmail(), $recipient->getName() ); } + $email->addCcs($ccEmails); - // add the bcc recipients + // add the bcc recipients + $bccEmails = array(); foreach ( ( array ) $message->getBccRecipients() as $recipient ) { - if ( ! in_array( $recipient->getEmail(), $duplicates ) ) { - $recipient->log($this->logger, 'Bcc'); - $email = new SendGrid\Email($recipient->getName(), $recipient->getEmail()); - $mail->personalization[0]->addBcc($email); - } + $recipient->log($this->logger, 'Bcc'); + $bccEmails[] = new \SendGrid\Mail\Cc( $recipient->getEmail(), $recipient->getName() ); } + $email->addBccs($bccEmails); - // add the messageId + // add the messageId $messageId = $message->getMessageId(); if ( ! empty( $messageId ) ) { - $mail->personalization[0]->addHeader( 'message-id', $messageId ); + $email->addHeader( 'message-id', $messageId ); } // add attachments @@ -160,13 +133,13 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) { $attachments = $this->addAttachmentsToMail( $message ); foreach ( $attachments as $index => $attachment ) { - $attach = new SendGrid\Attachment(); - $attach->setContent($attachment['content']); - $attach->setType($attachment['type']); - $attach->setFilename($attachment['file_name']); - $attach->setDisposition("attachment"); - $attach->setContentId($attachment['id']); - $mail->addAttachment($attach); + + $email->addAttachment( + $attachment['content'], + $attachment['type'], + $attachment['file_name'], + "attachment" + ); } try { @@ -174,14 +147,14 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) { if ( $this->logger->isDebug() ) { $this->logger->debug( 'Creating SendGrid service with apiKey=' . $this->apiKey ); } - $sendgrid = new SendGrid( $this->apiKey ); + $sendgrid = new \SendGrid( $this->apiKey ); // send the message if ( $this->logger->isDebug() ) { $this->logger->debug( 'Sending mail' ); } - $response = $sendgrid->client->mail()->send()->post($mail); + $response = $sendgrid->send($email); if ( $this->logger->isInfo() ) { $this->logger->info( sprintf( 'Message %d accepted for delivery', PostmanState::getInstance()->getSuccessfulDeliveries() + 1 ) ); } @@ -196,7 +169,7 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) { $e = ! $email_sent ? $this->errorCodesMap($response_code) : $response_body->errors[0]->message; $this->transcript = $e; $this->transcript .= PostmanModuleTransport::RAW_MESSAGE_FOLLOWS; - $this->transcript .= print_r( $mail, true ); + $this->transcript .= print_r( $email, true ); $this->logger->debug( 'Transcript=' . $this->transcript ); @@ -204,11 +177,11 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) { } $this->transcript = print_r( $response->body(), true ); $this->transcript .= PostmanModuleTransport::RAW_MESSAGE_FOLLOWS; - $this->transcript .= print_r( $mail, true ); + $this->transcript .= print_r( $email, true ); } catch ( SendGrid\Exception $e ) { $this->transcript = $e->getMessage(); $this->transcript .= PostmanModuleTransport::RAW_MESSAGE_FOLLOWS; - $this->transcript .= print_r( $mail, true ); + $this->transcript .= print_r( $email, true ); $this->logger->debug( 'Transcript=' . $this->transcript ); throw $e; @@ -219,22 +192,22 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) { private function errorCodesMap($error_code) { switch ($error_code) { case 413: - $message = sprintf( __( 'ERROR: The JSON payload you have included in your request is too large. Status code is %1$s', Postman::TEXT_DOMAIN ), $error_code ); + $message = sprintf( __( 'ERROR: The JSON payload you have included in your request is too large. Status code is %1$s', 'post-smtp' ), $error_code ); break; case 429: - $message = sprintf( __( 'ERROR: The number of requests you have made exceeds SendGrid rate limitations. Status code is %1$s', Postman::TEXT_DOMAIN ), $error_code ); + $message = sprintf( __( 'ERROR: The number of requests you have made exceeds SendGrid rate limitations. Status code is %1$s', 'post-smtp' ), $error_code ); break; case 500: - $message = sprintf( __( 'ERROR: An error occurred on a SendGrid server. Status code is %1$s', Postman::TEXT_DOMAIN ), $error_code ); + $message = sprintf( __( 'ERROR: An error occurred on a SendGrid server. Status code is %1$s', 'post-smtp' ), $error_code ); break; case 513: - $message = sprintf( __( 'ERROR: The SendGrid v3 Web API is not available. Status code is %1$s', Postman::TEXT_DOMAIN ), $error_code ); + $message = sprintf( __( 'ERROR: The SendGrid v3 Web API is not available. Status code is %1$s', 'post-smtp' ), $error_code ); break; case 502: - $message = sprintf( __( 'ERROR: No recipient supplied. Status code is %1$s', Postman::TEXT_DOMAIN ), $error_code ); + $message = sprintf( __( 'ERROR: No recipient supplied. Status code is %1$s', 'post-smtp' ), $error_code ); break; default: - $message = sprintf( __( 'ERROR: Status code is %1$s', Postman::TEXT_DOMAIN ), $error_code ); + $message = sprintf( __( 'ERROR: Status code is %1$s', 'post-smtp' ), $error_code ); } return $message; diff --git a/Postman/Postman-Mail/PostmanSendGridTransport.php b/Postman/Postman-Mail/PostmanSendGridTransport.php index 358fcc5..efac416 100644 --- a/Postman/Postman-Mail/PostmanSendGridTransport.php +++ b/Postman/Postman-Mail/PostmanSendGridTransport.php @@ -16,7 +16,7 @@ class PostmanSendGridTransport extends PostmanAbstractModuleTransport implements /** * - * @param unknown $rootPluginFilenameAndPath + * @param mixed $rootPluginFilenameAndPath */ public function __construct($rootPluginFilenameAndPath) { parent::__construct ( $rootPluginFilenameAndPath ); @@ -36,7 +36,7 @@ class PostmanSendGridTransport extends PostmanAbstractModuleTransport implements return self::SLUG; } public function getName() { - return __ ( 'SendGrid API', Postman::TEXT_DOMAIN ); + return __ ( 'SendGrid API', 'post-smtp' ); } /** * v0.2.1 @@ -49,7 +49,7 @@ class PostmanSendGridTransport extends PostmanAbstractModuleTransport implements /** * v0.2.1 * - * @return string + * @return int */ public function getPort() { return self::PORT; @@ -76,12 +76,12 @@ class PostmanSendGridTransport extends PostmanAbstractModuleTransport implements } public function getDeliveryDetails() { /* translators: where (1) is the secure icon and (2) is the transport name */ - return sprintf ( __ ( 'Postman will send mail via the %1$s %2$s.', Postman::TEXT_DOMAIN ), '🔐', $this->getName () ); + return sprintf ( __ ( 'Postman will send mail via the %1$s %2$s.', 'post-smtp' ), '🔐', $this->getName () ); } /** * - * @param unknown $data + * @param mixed $data */ public function prepareOptionsForExport($data) { $data = parent::prepareOptionsForExport ( $data ); @@ -98,11 +98,11 @@ class PostmanSendGridTransport extends PostmanAbstractModuleTransport implements $messages = parent::validateTransportConfiguration (); $apiKey = $this->options->getSendGridApiKey (); if (empty ( $apiKey )) { - array_push ( $messages, __ ( 'API Key can not be empty', Postman::TEXT_DOMAIN ) . '.' ); + array_push ( $messages, __ ( 'API Key can not be empty', 'post-smtp' ) . '.' ); $this->setNotConfiguredAndReady (); } if (! $this->isSenderConfigured ()) { - array_push ( $messages, __ ( 'Message From Address can not be empty', Postman::TEXT_DOMAIN ) . '.' ); + array_push ( $messages, __ ( 'Message From Address can not be empty', 'post-smtp' ) . '.' ); $this->setNotConfiguredAndReady (); } return $messages; @@ -129,8 +129,8 @@ class PostmanSendGridTransport extends PostmanAbstractModuleTransport implements /** * - * @param unknown $hostname - * @param unknown $response + * @param mixed $hostname + * @param mixed $response */ public function populateConfiguration($hostname) { $response = parent::populateConfiguration ( $hostname ); @@ -145,7 +145,7 @@ class PostmanSendGridTransport extends PostmanAbstractModuleTransport implements $overrideItem ['auth_items'] = array ( array ( 'selected' => true, - 'name' => __ ( 'API Key', Postman::TEXT_DOMAIN ), + 'name' => __ ( 'API Key', 'post-smtp' ), 'value' => 'api_key' ) ); @@ -174,25 +174,25 @@ class PostmanSendGridTransport extends PostmanAbstractModuleTransport implements */ public function addSettings() { // the SendGrid Auth section - add_settings_section ( PostmanSendGridTransport::SENDGRID_AUTH_SECTION, __ ( 'Authentication', Postman::TEXT_DOMAIN ), array ( + add_settings_section ( PostmanSendGridTransport::SENDGRID_AUTH_SECTION, __ ( 'Authentication', 'post-smtp' ), array ( $this, 'printSendGridAuthSectionInfo' ), PostmanSendGridTransport::SENDGRID_AUTH_OPTIONS ); - add_settings_field ( PostmanOptions::SENDGRID_API_KEY, __ ( 'API Key', Postman::TEXT_DOMAIN ), array ( + add_settings_field ( PostmanOptions::SENDGRID_API_KEY, __ ( 'API Key', 'post-smtp' ), array ( $this, 'sendgrid_api_key_callback' ), PostmanSendGridTransport::SENDGRID_AUTH_OPTIONS, PostmanSendGridTransport::SENDGRID_AUTH_SECTION ); } public function printSendGridAuthSectionInfo() { /* Translators: Where (1) is the service URL and (2) is the service name and (3) is a api key URL */ - printf ( '

%s

', sprintf ( __ ( 'Create an account at %2$s and enter an API key below.', Postman::TEXT_DOMAIN ), 'https://sendgrid.com', 'SendGrid.com', 'https://app.sendgrid.com/settings/api_keys' ) ); + printf ( '

%s

', sprintf ( __ ( 'Create an account at %2$s and enter an API key below.', 'post-smtp' ), 'https://sendgrid.com', 'SendGrid.com', 'https://app.sendgrid.com/settings/api_keys' ) ); } /** */ public function sendgrid_api_key_callback() { - printf ( '', null !== $this->options->getSendGridApiKey () ? esc_attr ( PostmanUtils::obfuscatePassword ( $this->options->getSendGridApiKey () ) ) : '', __ ( 'Required', Postman::TEXT_DOMAIN ) ); + printf ( '', null !== $this->options->getSendGridApiKey () ? esc_attr ( PostmanUtils::obfuscatePassword ( $this->options->getSendGridApiKey () ) ) : '', __ ( 'Required', 'post-smtp' ) ); print ' '; } @@ -219,7 +219,7 @@ class PostmanSendGridTransport extends PostmanAbstractModuleTransport implements public function printWizardAuthenticationStep() { print '
'; $this->printSendGridAuthSectionInfo (); - printf ( '', __ ( 'API Key', Postman::TEXT_DOMAIN ) ); + printf ( '', __ ( 'API Key', 'post-smtp' ) ); print '
'; print $this->sendgrid_api_key_callback (); print '
'; diff --git a/Postman/Postman-Mail/PostmanSmtpModuleTransport.php b/Postman/Postman-Mail/PostmanSmtpModuleTransport.php index 3bd1ad2..08e833f 100644 --- a/Postman/Postman-Mail/PostmanSmtpModuleTransport.php +++ b/Postman/Postman-Mail/PostmanSmtpModuleTransport.php @@ -91,21 +91,21 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl protected function validateTransportConfiguration() { $messages = parent::validateTransportConfiguration(); if ( ! $this->isHostConfigured( $this->options ) ) { - array_push( $messages, __( 'Outgoing Mail Server Hostname and Port can not be empty.', Postman::TEXT_DOMAIN ) ); + array_push( $messages, __( 'Outgoing Mail Server Hostname and Port can not be empty.', 'post-smtp' ) ); $this->setNotConfiguredAndReady(); } if ( ! $this->isEnvelopeFromConfigured() ) { - array_push( $messages, __( 'Envelope-From Email Address can not be empty', Postman::TEXT_DOMAIN ) . '.' ); + array_push( $messages, __( 'Envelope-From Email Address can not be empty', 'post-smtp' ) . '.' ); $this->setNotConfiguredAndReady(); } if ( $this->options->isAuthTypePassword() && ! $this->isPasswordAuthenticationConfigured( $this->options ) ) { - array_push( $messages, __( 'Username and password can not be empty.', Postman::TEXT_DOMAIN ) ); + array_push( $messages, __( 'Username and password can not be empty.', 'post-smtp' ) ); $this->setNotConfiguredAndReady(); } if ( $this->getAuthenticationType() == PostmanOptions::AUTHENTICATION_TYPE_OAUTH2 ) { if ( ! $this->isOAuth2SupportedHostConfigured() ) { /* translators: %1$s is the Client ID label, and %2$s is the Client Secret label (e.g. Warning: OAuth 2.0 authentication requires an OAuth 2.0-capable Outgoing Mail Server, Sender Email Address, Client ID, and Client Secret.) */ - array_push( $messages, sprintf( __( 'OAuth 2.0 authentication requires a supported OAuth 2.0-capable Outgoing Mail Server.', Postman::TEXT_DOMAIN ) ) ); + array_push( $messages, sprintf( __( 'OAuth 2.0 authentication requires a supported OAuth 2.0-capable Outgoing Mail Server.', 'post-smtp' ) ) ); $this->setNotConfiguredAndReady(); } } @@ -113,7 +113,7 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl $this->setReadyForOAuthGrant(); if ( $this->isPermissionNeeded( $this->options, $this->getOAuthToken() ) ) { /* translators: %1$s is the Client ID label, and %2$s is the Client Secret label */ - $message = sprintf( __( 'You have configured OAuth 2.0 authentication, but have not received permission to use it.', Postman::TEXT_DOMAIN ), $this->getScribe()->getClientIdLabel(), $this->getScribe()->getClientSecretLabel() ); + $message = sprintf( __( 'You have configured OAuth 2.0 authentication, but have not received permission to use it.', 'post-smtp' ), $this->getScribe()->getClientIdLabel(), $this->getScribe()->getClientSecretLabel() ); $message .= sprintf( ' %s.', PostmanUtils::getGrantOAuthPermissionUrl(), $this->getScribe()->getRequestPermissionLinkText() ); array_push( $messages, $message ); $this->setNotConfiguredAndReady(); @@ -160,7 +160,7 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl /** * SendGrid will never recommend it's configuration * - * @param unknown $hostData + * @param mixed $hostData */ public function getConfigurationBid( PostmanWizardSocket $hostData, $userAuthOverride, $originalSmtpServer ) { $port = $hostData->port; @@ -265,7 +265,7 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl $authDesc = $this->getAuthenticationDescription( $recommendation ['auth'] ); $recommendation ['label'] = sprintf( 'SMTP - %2$s:%3$d', $transportDescription, $hostData->hostnameDomainOnly, $port ); /* translators: where %1$s is a description of the transport (eg. SMTPS-SSL), %2$s is a description of the authentication (eg. Password-CRAMMD5), %3$d is the TCP port (eg. 465), %4$d is the hostname */ - $recommendation ['message'] = sprintf( __( 'Postman recommends %1$s with %2$s authentication to host %4$s on port %3$d.', Postman::TEXT_DOMAIN ), $transportDescription, $authDesc, $port, $hostname ); + $recommendation ['message'] = sprintf( __( 'Postman recommends %1$s with %2$s authentication to host %4$s on port %3$d.', 'post-smtp' ), $transportDescription, $authDesc, $port, $hostname ); } // fill-in the rest of the recommendation @@ -322,53 +322,53 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl $oauthScribe = $transport->getScribe(); // Sanitize - add_settings_section( PostmanAdminController::SMTP_SECTION, __( 'Transport Settings', Postman::TEXT_DOMAIN ), array( + add_settings_section( PostmanAdminController::SMTP_SECTION, __( 'Transport Settings', 'post-smtp' ), array( $this, 'printSmtpSectionInfo', ), PostmanAdminController::SMTP_OPTIONS ); - add_settings_field( PostmanOptions::HOSTNAME, __( 'Outgoing Mail Server Hostname', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::HOSTNAME, __( 'Outgoing Mail Server Hostname', 'post-smtp' ), array( $this, 'hostname_callback', ), PostmanAdminController::SMTP_OPTIONS, PostmanAdminController::SMTP_SECTION ); - add_settings_field( PostmanOptions::PORT, __( 'Outgoing Mail Server Port', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::PORT, __( 'Outgoing Mail Server Port', 'post-smtp' ), array( $this, 'port_callback', ), PostmanAdminController::SMTP_OPTIONS, PostmanAdminController::SMTP_SECTION ); - add_settings_field( PostmanOptions::ENVELOPE_SENDER, __( 'Envelope-From Email Address', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::ENVELOPE_SENDER, __( 'Envelope-From Email Address', 'post-smtp' ), array( $this, 'sender_email_callback', ), PostmanAdminController::SMTP_OPTIONS, PostmanAdminController::SMTP_SECTION ); - add_settings_field( PostmanOptions::SECURITY_TYPE, _x( 'Security', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::SECURITY_TYPE, _x( 'Security', 'Configuration Input Field', 'post-smtp' ), array( $this, 'encryption_type_callback', ), PostmanAdminController::SMTP_OPTIONS, PostmanAdminController::SMTP_SECTION ); - add_settings_field( PostmanOptions::AUTHENTICATION_TYPE, __( 'Authentication', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::AUTHENTICATION_TYPE, __( 'Authentication', 'post-smtp' ), array( $this, 'authentication_type_callback', ), PostmanAdminController::SMTP_OPTIONS, PostmanAdminController::SMTP_SECTION ); - add_settings_section( PostmanAdminController::BASIC_AUTH_SECTION, __( 'Authentication', Postman::TEXT_DOMAIN ), array( + add_settings_section( PostmanAdminController::BASIC_AUTH_SECTION, __( 'Authentication', 'post-smtp' ), array( $this, 'printBasicAuthSectionInfo', ), PostmanAdminController::BASIC_AUTH_OPTIONS ); - add_settings_field( PostmanOptions::BASIC_AUTH_USERNAME, __( 'Username', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::BASIC_AUTH_USERNAME, __( 'Username', 'post-smtp' ), array( $this, 'basic_auth_username_callback', ), PostmanAdminController::BASIC_AUTH_OPTIONS, PostmanAdminController::BASIC_AUTH_SECTION ); - add_settings_field( PostmanOptions::BASIC_AUTH_PASSWORD, __( 'Password', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::BASIC_AUTH_PASSWORD, __( 'Password', 'post-smtp' ), array( $this, 'basic_auth_password_callback', ), PostmanAdminController::BASIC_AUTH_OPTIONS, PostmanAdminController::BASIC_AUTH_SECTION ); // the OAuth section - add_settings_section( PostmanAdminController::OAUTH_SECTION, __( 'Authentication', Postman::TEXT_DOMAIN ), array( + add_settings_section( PostmanAdminController::OAUTH_SECTION, __( 'Authentication', 'post-smtp' ), array( $this, 'printOAuthSectionInfo', ), PostmanAdminController::OAUTH_AUTH_OPTIONS ); @@ -398,21 +398,21 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl * Print the Section text */ public function printSmtpSectionInfo() { - print __( 'Configure the communication with the mail server.', Postman::TEXT_DOMAIN ); + print __( 'Configure the communication with the mail server.', 'post-smtp' ); } /** * Get the settings option array and print one of its values */ public function hostname_callback() { - printf( '', null !== $this->options->getHostname() ? esc_attr( $this->options->getHostname() ) : '', __( 'Required', Postman::TEXT_DOMAIN ) ); + printf( '', null !== $this->options->getHostname() ? esc_attr( $this->options->getHostname() ) : '', __( 'Required', 'post-smtp' ) ); } /** * Get the settings option array and print one of its values */ public function port_callback( $args ) { - printf( '', null !== $this->options->getPort() ? esc_attr( $this->options->getPort() ) : '', isset( $args ['style'] ) ? $args ['style'] : '', __( 'Required', Postman::TEXT_DOMAIN ) ); + printf( '', null !== $this->options->getPort() ? esc_attr( $this->options->getPort() ) : '', isset( $args ['style'] ) ? $args ['style'] : '', __( 'Required', 'post-smtp' ) ); } /** @@ -421,7 +421,7 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl public function encryption_type_callback() { $encType = $this->options->getEncryptionType(); print ''; @@ -445,7 +445,7 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl * Print the Section text */ public function printBasicAuthSectionInfo() { - print __( 'Enter the account credentials.', Postman::TEXT_DOMAIN ); + print __( 'Enter the account credentials.', 'post-smtp' ); } /** @@ -453,9 +453,9 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl */ public function basic_auth_username_callback() { $inputValue = (null !== $this->options->getUsername() ? esc_attr( $this->options->getUsername() ) : ''); - $inputDescription = __( 'The Username is usually the same as the Envelope-From Email Address.', Postman::TEXT_DOMAIN ); + $inputDescription = __( 'The Username is usually the same as the Envelope-From Email Address.', 'post-smtp' ); print ('') ; - printf( '
%s', $inputValue, __( 'Required', Postman::TEXT_DOMAIN ), $inputDescription ); + printf( '
%s', $inputValue, __( 'Required', 'post-smtp' ), $inputDescription ); } /** @@ -463,7 +463,7 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl */ public function basic_auth_password_callback() { print ('') ; - printf( '', null !== $this->options->getPassword() ? esc_attr( PostmanUtils::obfuscatePassword( $this->options->getPassword() ) ) : '', __( 'Required', Postman::TEXT_DOMAIN ) ); + printf( '', null !== $this->options->getPassword() ? esc_attr( PostmanUtils::obfuscatePassword( $this->options->getPassword() ) ) : '', __( 'Required', 'post-smtp' ) ); print ' '; } @@ -471,14 +471,14 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl * Get the settings option array and print one of its values */ public function oauth_client_id_callback() { - printf( '', null !== $this->options->getClientId() ? esc_attr( $this->options->getClientId() ) : '', __( 'Required', Postman::TEXT_DOMAIN ) ); + printf( '', null !== $this->options->getClientId() ? esc_attr( $this->options->getClientId() ) : '', __( 'Required', 'post-smtp' ) ); } /** * Get the settings option array and print one of its values */ public function oauth_client_secret_callback() { - printf( '', null !== $this->options->getClientSecret() ? esc_attr( $this->options->getClientSecret() ) : '', __( 'Required', Postman::TEXT_DOMAIN ) ); + printf( '', null !== $this->options->getClientSecret() ? esc_attr( $this->options->getClientSecret() ) : '', __( 'Required', 'post-smtp' ) ); } /** @@ -507,7 +507,7 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl $oauthScribe = $transport->getScribe(); return $oauthScribe->getCallbackDomain(); } catch ( Exception $e ) { - return __( 'Error computing your domain root - please enter it manually', Postman::TEXT_DOMAIN ); + return __( 'Error computing your domain root - please enter it manually', 'post-smtp' ); } } @@ -526,28 +526,28 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl */ public function sender_email_callback() { $inputValue = (null !== $this->options->getEnvelopeSender() ? esc_attr( $this->options->getEnvelopeSender() ) : ''); - $requiredLabel = __( 'Required', Postman::TEXT_DOMAIN ); - $envelopeFromMessage = __( 'This address, like the return address printed on an envelope, identifies the account owner to the SMTP server.', Postman::TEXT_DOMAIN ); - $spfMessage = sprintf( __( 'For reliable delivery, this domain must specify an SPF record permitting the use of the SMTP server named above.', Postman::TEXT_DOMAIN ), 'https://www.mail-tester.com/spf/' ); + $requiredLabel = __( 'Required', 'post-smtp' ); + $envelopeFromMessage = __( 'This address, like the return address printed on an envelope, identifies the account owner to the SMTP server.', 'post-smtp' ); + $spfMessage = sprintf( __( 'For reliable delivery, this domain must specify an SPF record permitting the use of the SMTP server named above.', 'post-smtp' ), 'https://www.mail-tester.com/spf/' ); printf( '
%s %s', $inputValue, $requiredLabel, $envelopeFromMessage, $spfMessage ); } /** */ public function printWizardMailServerHostnameStep() { - printf( '%s', _x( 'Which host will relay the mail?', 'Wizard Step Title', Postman::TEXT_DOMAIN ) ); - printf( '

%s

', __( 'This is the Outgoing (SMTP) Mail Server, or Mail Submission Agent (MSA), which Postman delegates mail delivery to. This server is specific to your email account, and if you don\'t know what to use, ask your email service provider.', Postman::TEXT_DOMAIN ) ); - printf( '

%s

', __( 'Note that many WordPress hosts, such as GoDaddy, Bluehost and Dreamhost, require that you use their mail accounts with their mail servers, and prevent you from using others.', Postman::TEXT_DOMAIN ) ); - printf( '', __( 'Outgoing Mail Server Hostname', Postman::TEXT_DOMAIN ) ); + printf( '%s', _x( 'Which host will relay the mail?', 'Wizard Step Title', 'post-smtp' ) ); + printf( '

%s

', __( 'This is the Outgoing (SMTP) Mail Server, or Mail Submission Agent (MSA), which Postman delegates mail delivery to. This server is specific to your email account, and if you don\'t know what to use, ask your email service provider.', 'post-smtp' ) ); + printf( '

%s

', __( 'Note that many WordPress hosts, such as GoDaddy, Bluehost and Dreamhost, require that you use their mail accounts with their mail servers, and prevent you from using others.', 'post-smtp' ) ); + printf( '', __( 'Outgoing Mail Server Hostname', 'post-smtp' ) ); print $this->hostname_callback(); printf( '', plugins_url( 'post-smtp/style/ajax-loader.gif' ) ); - $warning = __( 'Warning', Postman::TEXT_DOMAIN ); + $warning = __( 'Warning', 'post-smtp' ); /* Translators: Where (%s) is the name of the web host */ - $nonGodaddyDomainMessage = sprintf( __( 'Your email address requires access to a remote SMTP server blocked by %s.', Postman::TEXT_DOMAIN ), 'GoDaddy' ); - $nonGodaddyDomainMessage .= sprintf( ' %s', __( 'If you have access to cPanel, enable the Remote Mail Exchanger.', Postman::TEXT_DOMAIN ) ); + $nonGodaddyDomainMessage = sprintf( __( 'Your email address requires access to a remote SMTP server blocked by %s.', 'post-smtp' ), 'GoDaddy' ); + $nonGodaddyDomainMessage .= sprintf( ' %s', __( 'If you have access to cPanel, enable the Remote Mail Exchanger.', 'post-smtp' ) ); printf( '

%s: %s

', $warning, $nonGodaddyDomainMessage ); /* Translators: Where (%1$s) is the SPF-info URL and (%2$s) is the name of the web host */ - $godaddyCustomDomainMessage = sprintf( __( 'If you own this domain, make sure it has an SPF record authorizing %2$s as a relay, or you will have delivery problems.', Postman::TEXT_DOMAIN ), 'http://www.mail-tester.com/spf/godaddy', 'GoDaddy' ); + $godaddyCustomDomainMessage = sprintf( __( 'If you own this domain, make sure it has an SPF record authorizing %2$s as a relay, or you will have delivery problems.', 'post-smtp' ), 'http://www.mail-tester.com/spf/godaddy', 'GoDaddy' ); printf( '

%s: %s

', $warning, $godaddyCustomDomainMessage ); } @@ -575,12 +575,12 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl print ''; print '
'; - printf( '

%s

', __( 'Enter the account credentials.', Postman::TEXT_DOMAIN ) ); - printf( '', __( 'Username', Postman::TEXT_DOMAIN ) ); + printf( '

%s

', __( 'Enter the account credentials.', 'post-smtp' ) ); + printf( '', __( 'Username', 'post-smtp' ) ); print '
'; print $this->basic_auth_username_callback(); print '
'; - printf( '', __( 'Password', Postman::TEXT_DOMAIN ) ); + printf( '', __( 'Password', 'post-smtp' ) ); print '
'; print $this->basic_auth_password_callback(); print '
'; diff --git a/Postman/Postman-Mail/PostmanTransportRegistry.php b/Postman/Postman-Mail/PostmanTransportRegistry.php index e86f1f4..5af2493 100644 --- a/Postman/Postman-Mail/PostmanTransportRegistry.php +++ b/Postman/Postman-Mail/PostmanTransportRegistry.php @@ -39,7 +39,7 @@ class PostmanTransportRegistry { * B) when querying what a theoretical scenario involving this transport is like * (ie.for ajax in config screen) * - * @param unknown $slug + * @param mixed $slug */ public function getTransport( $slug ) { $transports = $this->getTransports(); @@ -61,7 +61,7 @@ class PostmanTransportRegistry { /** * Determine if a specific transport is registered in the directory. * - * @param unknown $slug + * @param mixed $slug */ public function isRegistered( $slug ) { $transports = $this->getTransports(); @@ -71,7 +71,7 @@ class PostmanTransportRegistry { /** * Retrieve the transport Postman is currently configured with. * - * @return PostmanDummyTransport|PostmanModuleTransport + * @return PostmanModuleTransport * @deprecated */ public function getCurrentTransport() { @@ -105,7 +105,7 @@ class PostmanTransportRegistry { /** * Retrieve the transport Postman is currently configured with. * - * @return PostmanDummyTransport|PostmanModuleTransport + * @return PostmanModuleTransport */ public function getSelectedTransport() { $selectedTransport = PostmanOptions::getInstance()->getTransportType(); @@ -143,8 +143,8 @@ class PostmanTransportRegistry { /** * Polls all the installed transports to get a complete list of sockets to probe for connectivity * - * @param unknown $hostname - * @param unknown $isGmail + * @param mixed $hostname + * @param mixed $isGmail * @return multitype: */ public function getSocketsForSetupWizardToProbe( $hostname = 'localhost', $smtpServerGuess = null ) { @@ -178,7 +178,7 @@ class PostmanTransportRegistry { * * response should include ['success'], ['message'], ['priority'] * - * @param unknown $hostData + * @param mixed $hostData */ public function getRecommendation( PostmanWizardSocket $hostData, $userAuthOverride, $originalSmtpServer ) { $scrubbedUserAuthOverride = $this->scrubUserOverride( $hostData, $userAuthOverride ); @@ -193,7 +193,7 @@ class PostmanTransportRegistry { /** * * @param PostmanWizardSocket $hostData - * @param unknown $userAuthOverride + * @param mixed $userAuthOverride * @return NULL */ private function scrubUserOverride( PostmanWizardSocket $hostData, $userAuthOverride ) { @@ -231,18 +231,18 @@ class PostmanTransportRegistry { if ( PostmanOptions::getInstance()->getRunMode() != PostmanOptions::RUN_MODE_PRODUCTION ) { return array( 'error' => true, - 'message' => __( 'Postman is in non-Production mode and is dumping all emails.', Postman::TEXT_DOMAIN ), + 'message' => __( 'Postman is in non-Production mode and is dumping all emails.', 'post-smtp' ), ); } else { return array( 'error' => false, - 'message' => __( 'Postman is configured.', Postman::TEXT_DOMAIN ), + 'message' => __( 'Postman is configured.', 'post-smtp' ), ); } } else { return array( 'error' => true, - 'message' => __( 'Postman is not configured and is mimicking out-of-the-box WordPress email delivery.', Postman::TEXT_DOMAIN ), + 'message' => __( 'Postman is not configured and is mimicking out-of-the-box WordPress email delivery.', 'post-smtp' ), ); } } diff --git a/Postman/Postman-Mail/PostmanWooCommerce.php b/Postman/Postman-Mail/PostmanWooCommerce.php index a6a2e82..feee32e 100644 --- a/Postman/Postman-Mail/PostmanWooCommerce.php +++ b/Postman/Postman-Mail/PostmanWooCommerce.php @@ -28,7 +28,7 @@ if ( ! class_exists( 'PostmanWoocommerce' ) ) { return array( - array( 'title' => __( 'Email notifications', Postman::TEXT_DOMAIN ), 'desc' => __( 'Email notifications sent from WooCommerce are listed below. Click on an email to configure it.', Postman::TEXT_DOMAIN ), 'type' => 'title', 'id' => 'email_notification_settings' ), + array( 'title' => __( 'Email notifications', 'post-smtp' ), 'desc' => __( 'Email notifications sent from WooCommerce are listed below. Click on an email to configure it.', 'post-smtp' ), 'type' => 'title', 'id' => 'email_notification_settings' ), array( 'type' => 'email_notification' ), @@ -36,11 +36,11 @@ if ( ! class_exists( 'PostmanWoocommerce' ) ) { array( 'type' => 'sectionend', 'id' => 'email_recipient_options' ), - array( 'title' => __( 'Email sender options', Postman::TEXT_DOMAIN ), 'type' => 'title', 'desc' => '', 'id' => 'email_options' ), + array( 'title' => __( 'Email sender options', 'post-smtp' ), 'type' => 'title', 'desc' => '', 'id' => 'email_options' ), array( - 'title' => __( '"From" name', Postman::TEXT_DOMAIN ), - 'desc' => __( 'How the sender name appears in outgoing WooCommerce emails.', Postman::TEXT_DOMAIN ), + 'title' => __( '"From" name', 'post-smtp' ), + 'desc' => __( 'How the sender name appears in outgoing WooCommerce emails.', 'post-smtp' ), 'id' => 'woocommerce_email_from_name', 'type' => 'text', 'css' => 'min-width:300px;', @@ -50,8 +50,8 @@ if ( ! class_exists( 'PostmanWoocommerce' ) ) { ), array( - 'title' => __( '"From" address', Postman::TEXT_DOMAIN ), - 'desc' => __( 'This is overided by the account configured on Post SMTP plugin configuration.', Postman::TEXT_DOMAIN ), + 'title' => __( '"From" address', 'post-smtp' ), + 'desc' => __( 'This is overided by the account configured on Post SMTP plugin configuration.', 'post-smtp' ), 'id' => 'woocommerce_email_from_address', 'type' => 'email', 'custom_attributes' => array( @@ -66,26 +66,26 @@ if ( ! class_exists( 'PostmanWoocommerce' ) ) { array( 'type' => 'sectionend', 'id' => 'email_options' ), - array( 'title' => __( 'Email template', Postman::TEXT_DOMAIN ), 'type' => 'title', 'desc' => sprintf( __( 'This section lets you customize the WooCommerce emails. Click here to preview your email template.', Postman::TEXT_DOMAIN ), wp_nonce_url( admin_url( '?preview_woocommerce_mail=true' ), 'preview-mail' ) ), 'id' => 'email_template_options' ), + array( 'title' => __( 'Email template', 'post-smtp' ), 'type' => 'title', 'desc' => sprintf( __( 'This section lets you customize the WooCommerce emails. Click here to preview your email template.', 'post-smtp' ), wp_nonce_url( admin_url( '?preview_woocommerce_mail=true' ), 'preview-mail' ) ), 'id' => 'email_template_options' ), array( - 'title' => __( 'Header image', Postman::TEXT_DOMAIN ), - 'desc' => __( 'URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', Postman::TEXT_DOMAIN ), + 'title' => __( 'Header image', 'post-smtp' ), + 'desc' => __( 'URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'post-smtp' ), 'id' => 'woocommerce_email_header_image', 'type' => 'text', 'css' => 'min-width:300px;', - 'placeholder' => __( 'N/A', Postman::TEXT_DOMAIN ), + 'placeholder' => __( 'N/A', 'post-smtp' ), 'default' => '', 'autoload' => false, 'desc_tip' => true, ), array( - 'title' => __( 'Footer text', Postman::TEXT_DOMAIN ), - 'desc' => __( 'The text to appear in the footer of WooCommerce emails.', Postman::TEXT_DOMAIN ), + 'title' => __( 'Footer text', 'post-smtp' ), + 'desc' => __( 'The text to appear in the footer of WooCommerce emails.', 'post-smtp' ), 'id' => 'woocommerce_email_footer_text', 'css' => 'width:300px; height: 75px;', - 'placeholder' => __( 'N/A', Postman::TEXT_DOMAIN ), + 'placeholder' => __( 'N/A', 'post-smtp' ), 'type' => 'textarea', /* translators: %s: site name */ 'default' => get_bloginfo( 'name', 'display' ), @@ -94,9 +94,9 @@ if ( ! class_exists( 'PostmanWoocommerce' ) ) { ), array( - 'title' => __( 'Base color', Postman::TEXT_DOMAIN ), + 'title' => __( 'Base color', 'post-smtp' ), /* translators: %s: default color */ - 'desc' => sprintf( __( 'The base color for WooCommerce email templates. Default %s.', Postman::TEXT_DOMAIN ), '#96588a' ), + 'desc' => sprintf( __( 'The base color for WooCommerce email templates. Default %s.', 'post-smtp' ), '#96588a' ), 'id' => 'woocommerce_email_base_color', 'type' => 'color', 'css' => 'width:6em;', @@ -106,9 +106,9 @@ if ( ! class_exists( 'PostmanWoocommerce' ) ) { ), array( - 'title' => __( 'Background color', Postman::TEXT_DOMAIN ), + 'title' => __( 'Background color', 'post-smtp' ), /* translators: %s: default color */ - 'desc' => sprintf( __( 'The background color for WooCommerce email templates. Default %s.', Postman::TEXT_DOMAIN ), '#f7f7f7' ), + 'desc' => sprintf( __( 'The background color for WooCommerce email templates. Default %s.', 'post-smtp' ), '#f7f7f7' ), 'id' => 'woocommerce_email_background_color', 'type' => 'color', 'css' => 'width:6em;', @@ -118,9 +118,9 @@ if ( ! class_exists( 'PostmanWoocommerce' ) ) { ), array( - 'title' => __( 'Body background color', Postman::TEXT_DOMAIN ), + 'title' => __( 'Body background color', 'post-smtp' ), /* translators: %s: default color */ - 'desc' => sprintf( __( 'The main body background color. Default %s.', Postman::TEXT_DOMAIN ), '#ffffff' ), + 'desc' => sprintf( __( 'The main body background color. Default %s.', 'post-smtp' ), '#ffffff' ), 'id' => 'woocommerce_email_body_background_color', 'type' => 'color', 'css' => 'width:6em;', @@ -130,9 +130,9 @@ if ( ! class_exists( 'PostmanWoocommerce' ) ) { ), array( - 'title' => __( 'Body text color', Postman::TEXT_DOMAIN ), + 'title' => __( 'Body text color', 'post-smtp' ), /* translators: %s: default color */ - 'desc' => sprintf( __( 'The main body text color. Default %s.', Postman::TEXT_DOMAIN ), '#3c3c3c' ), + 'desc' => sprintf( __( 'The main body text color. Default %s.', 'post-smtp' ), '#3c3c3c' ), 'id' => 'woocommerce_email_text_color', 'type' => 'color', 'css' => 'width:6em;', diff --git a/Postman/Postman-Mail/PostmanZendMailEngine.php b/Postman/Postman-Mail/PostmanZendMailEngine.php index 8d69811..e4ea286 100644 --- a/Postman/Postman-Mail/PostmanZendMailEngine.php +++ b/Postman/Postman-Mail/PostmanZendMailEngine.php @@ -47,8 +47,8 @@ if ( ! class_exists( 'PostmanZendMailEngine' ) ) { /** * - * @param unknown $senderEmail - * @param unknown $accessToken + * @param mixed $senderEmail + * @param mixed $accessToken */ function __construct( PostmanZendModuleTransport $transport ) { assert( isset( $transport ) ); @@ -204,7 +204,7 @@ if ( ! class_exists( 'PostmanZendMailEngine' ) ) { $message = $e->getMessage(); if ( $e->getCode() == 334 ) { // replace the unusable Google message with a better one in the case of code 334 - $message = sprintf( __( 'Communication Error [334] - make sure the Envelope From email is the same account used to create the Client ID.', Postman::TEXT_DOMAIN ) ); + $message = sprintf( __( 'Communication Error [334] - make sure the Envelope From email is the same account used to create the Client ID.', 'post-smtp' ) ); } // create a new exception $newException = new Exception( $message, $e->getCode() ); diff --git a/Postman/Postman-Mail/PostmanZendMailTransportConfigurationFactory.php b/Postman/Postman-Mail/PostmanZendMailTransportConfigurationFactory.php index 2639497..08e1810 100644 --- a/Postman/Postman-Mail/PostmanZendMailTransportConfigurationFactory.php +++ b/Postman/Postman-Mail/PostmanZendMailTransportConfigurationFactory.php @@ -78,11 +78,11 @@ if (! class_exists ( 'PostmanOAuth2ConfigurationFactory' )) { * * Create the Configuration structure for Zend_Mail * - * @param unknown $hostname - * @param unknown $port - * @param unknown $securityType - * @param unknown $authenticationType - * @param unknown $initClientRequestEncoded + * @param mixed $hostname + * @param mixed $port + * @param mixed $securityType + * @param mixed $authenticationType + * @param mixed $initClientRequestEncoded * @return multitype:unknown NULL */ private static function createConfiguration($logger, $hostname, $port, $securityType, $authenticationType, $initClientRequestEncoded) { @@ -99,7 +99,7 @@ if (! class_exists ( 'PostmanOAuth2ConfigurationFactory' )) { /** * Create the vendor string (for Yahoo servers only) * - * @param unknown $hostname + * @param mixed $hostname * @return string */ private static function createVendorString($hostname) { @@ -116,9 +116,9 @@ if (! class_exists ( 'PostmanOAuth2ConfigurationFactory' )) { /** * Create the standard OAuth2 SMTP Authentication string * - * @param unknown $senderEmail - * @param unknown $oauth2AccessToken - * @param unknown $vendor + * @param mixed $senderEmail + * @param mixed $oauth2AccessToken + * @param mixed $vendor * @return string */ private static function createAuthenticationString($senderEmail, $oauth2AccessToken, $vendor) { diff --git a/Postman/Postman-Mail/Zend-1.12.10/Mail.php b/Postman/Postman-Mail/Zend-1.12.10/Mail.php index b2204f7..d597ea7 100644 --- a/Postman/Postman-Mail/Zend-1.12.10/Mail.php +++ b/Postman/Postman-Mail/Zend-1.12.10/Mail.php @@ -365,7 +365,7 @@ class Postman_Zend_Mail extends Postman_Zend_Mime_Message } $mp = new Postman_Zend_Mime_Part($txt); - $mp->encoding = $encoding; + $mp->encoding = apply_filters( 'post_smtp_content_transfer_encoding', $encoding, Postman_Zend_Mime::TYPE_TEXT); $mp->type = Postman_Zend_Mime::TYPE_TEXT; $mp->disposition = Postman_Zend_Mime::DISPOSITION_INLINE; $mp->charset = $charset; @@ -406,7 +406,7 @@ class Postman_Zend_Mail extends Postman_Zend_Mime_Message } $mp = new Postman_Zend_Mime_Part($html); - $mp->encoding = $encoding; + $mp->encoding = apply_filters( 'post_smtp_content_transfer_encoding', $encoding, Postman_Zend_Mime::TYPE_HTML ); $mp->type = Postman_Zend_Mime::TYPE_HTML; $mp->disposition = Postman_Zend_Mime::DISPOSITION_INLINE; $mp->charset = $charset; diff --git a/Postman/Postman-Mail/Zend-1.12.10/Validate/EmailAddress.php b/Postman/Postman-Mail/Zend-1.12.10/Validate/EmailAddress.php index 537c330..f51645b 100644 --- a/Postman/Postman-Mail/Zend-1.12.10/Validate/EmailAddress.php +++ b/Postman/Postman-Mail/Zend-1.12.10/Validate/EmailAddress.php @@ -321,7 +321,7 @@ class Postman_Zend_Validate_EmailAddress extends Postman_Zend_Validate_Abstract /** * Returns the set domainCheck option * - * @return unknown + * @return mixed */ public function getDomainCheck() { diff --git a/Postman/Postman-Mail/sendgrid/composer.json b/Postman/Postman-Mail/sendgrid/composer.json index dbcdefd..95d93ce 100644 --- a/Postman/Postman-Mail/sendgrid/composer.json +++ b/Postman/Postman-Mail/sendgrid/composer.json @@ -1,5 +1,5 @@ { "require": { - "sendgrid/sendgrid": "~6.0" + "sendgrid/sendgrid": "~7" } -} +} \ No newline at end of file diff --git a/Postman/Postman-Mail/sendgrid/composer.lock b/Postman/Postman-Mail/sendgrid/composer.lock index 22d21cb..fd6a6e2 100644 --- a/Postman/Postman-Mail/sendgrid/composer.lock +++ b/Postman/Postman-Mail/sendgrid/composer.lock @@ -4,21 +4,21 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "72f70d0a56dace06ee80667ae9467dc2", - "content-hash": "31a416743df03ec89ce9f557ff36c18e", + "hash": "cb037c28e262c69616caad2764cb3a4f", + "content-hash": "907e285f65325b51e424d991537f18af", "packages": [ { "name": "sendgrid/php-http-client", - "version": "3.8.0", + "version": "3.9.6", "source": { "type": "git", "url": "https://github.com/sendgrid/php-http-client.git", - "reference": "929018c62b7fcd99b3b356216ae75fff4d47b5a1" + "reference": "e9a04d949ee2d19938ab83dc100933a3b41a8ec7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sendgrid/php-http-client/zipball/929018c62b7fcd99b3b356216ae75fff4d47b5a1", - "reference": "929018c62b7fcd99b3b356216ae75fff4d47b5a1", + "url": "https://api.github.com/repos/sendgrid/php-http-client/zipball/e9a04d949ee2d19938ab83dc100933a3b41a8ec7", + "reference": "e9a04d949ee2d19938ab83dc100933a3b41a8ec7", "shasum": "" }, "require": { @@ -57,53 +57,64 @@ "rest", "sendgrid" ], - "time": "2017-09-13 16:52:38" + "time": "2018-04-10 18:06:08" }, { "name": "sendgrid/sendgrid", - "version": "6.0.0", + "version": "7.3.0", "source": { "type": "git", "url": "https://github.com/sendgrid/sendgrid-php.git", - "reference": "8db454e4b5674b545c207a162b64202b0d63259b" + "reference": "37fa19d3ae019842f07a2a43e92ed0f566ad927d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sendgrid/sendgrid-php/zipball/8db454e4b5674b545c207a162b64202b0d63259b", - "reference": "8db454e4b5674b545c207a162b64202b0d63259b", + "url": "https://api.github.com/repos/sendgrid/sendgrid-php/zipball/37fa19d3ae019842f07a2a43e92ed0f566ad927d", + "reference": "37fa19d3ae019842f07a2a43e92ed0f566ad927d", "shasum": "" }, "require": { + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "ext-openssl": "*", "php": ">=5.6", - "sendgrid/php-http-client": "~3.7" + "sendgrid/php-http-client": "~3.9" }, "replace": { "sendgrid/sendgrid-php": "*" }, "require-dev": { - "phpunit/phpunit": "4.*", - "squizlabs/php_codesniffer": "2.*" + "phpunit/phpunit": "^5.7.9 || ^6.4.3", + "squizlabs/php_codesniffer": "3.*", + "swaggest/json-diff": "^3.4" }, "type": "library", "autoload": { + "psr-4": { + "SendGrid\\": "lib/", + "SendGrid\\Mail\\": "lib/mail/", + "SendGrid\\Contacts\\": "lib/contacts/", + "SendGrid\\Stats\\": "lib/stats/" + }, "files": [ - "lib/SendGrid.php", - "lib/helpers/mail/Mail.php" + "lib/SendGrid.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "This library allows you to quickly and easily send emails through SendGrid using PHP.", + "description": "This library allows you to quickly and easily send emails through Twilio SendGrid using PHP.", "homepage": "http://github.com/sendgrid/sendgrid-php", "keywords": [ "email", "grid", "send", - "sendgrid" + "sendgrid", + "twilio sendgrid" ], - "time": "2017-07-01 04:30:16" + "time": "2019-04-15 17:27:21" } ], "packages-dev": [], diff --git a/Postman/Postman-Mail/sendgrid/vendor/autoload.php b/Postman/Postman-Mail/sendgrid/vendor/autoload.php index cb30775..764afb2 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/autoload.php +++ b/Postman/Postman-Mail/sendgrid/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer' . '/autoload_real.php'; -return ComposerAutoloaderInit31a2dc55ed2dc338fb6b79b1af891c68::getLoader(); +return ComposerAutoloaderInitb8261ccd2bb9e98223bcd166b46db8d9::getLoader(); diff --git a/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_files.php b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_files.php index c6a74bd..4d74b3d 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_files.php +++ b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_files.php @@ -7,5 +7,4 @@ $baseDir = dirname($vendorDir); return array( '3f8bdd3b35094c73a26f0106e3c0f8b2' => $vendorDir . '/sendgrid/sendgrid/lib/SendGrid.php', - '9dda55337a76a24e949fbcc5d905a2c7' => $vendorDir . '/sendgrid/sendgrid/lib/helpers/mail/Mail.php', ); diff --git a/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_psr4.php b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_psr4.php index 89751b9..7618d79 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_psr4.php +++ b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_psr4.php @@ -6,5 +6,8 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - 'SendGrid\\' => array($vendorDir . '/sendgrid/php-http-client/lib'), + 'SendGrid\\Stats\\' => array($vendorDir . '/sendgrid/sendgrid/lib/stats'), + 'SendGrid\\Mail\\' => array($vendorDir . '/sendgrid/sendgrid/lib/mail'), + 'SendGrid\\Contacts\\' => array($vendorDir . '/sendgrid/sendgrid/lib/contacts'), + 'SendGrid\\' => array($vendorDir . '/sendgrid/php-http-client/lib', $vendorDir . '/sendgrid/sendgrid/lib'), ); diff --git a/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_real.php b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_real.php index 81518bf..35b4612 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_real.php +++ b/Postman/Postman-Mail/sendgrid/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit31a2dc55ed2dc338fb6b79b1af891c68 +class ComposerAutoloaderInitb8261ccd2bb9e98223bcd166b46db8d9 { private static $loader; @@ -19,9 +19,9 @@ class ComposerAutoloaderInit31a2dc55ed2dc338fb6b79b1af891c68 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit31a2dc55ed2dc338fb6b79b1af891c68', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitb8261ccd2bb9e98223bcd166b46db8d9', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit31a2dc55ed2dc338fb6b79b1af891c68', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitb8261ccd2bb9e98223bcd166b46db8d9', 'loadClassLoader')); $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -42,14 +42,14 @@ class ComposerAutoloaderInit31a2dc55ed2dc338fb6b79b1af891c68 $includeFiles = require __DIR__ . '/autoload_files.php'; foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire31a2dc55ed2dc338fb6b79b1af891c68($fileIdentifier, $file); + composerRequireb8261ccd2bb9e98223bcd166b46db8d9($fileIdentifier, $file); } return $loader; } } -function composerRequire31a2dc55ed2dc338fb6b79b1af891c68($fileIdentifier, $file) +function composerRequireb8261ccd2bb9e98223bcd166b46db8d9($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/Postman/Postman-Mail/sendgrid/vendor/composer/installed.json b/Postman/Postman-Mail/sendgrid/vendor/composer/installed.json index b3d9001..f86362a 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/composer/installed.json +++ b/Postman/Postman-Mail/sendgrid/vendor/composer/installed.json @@ -1,17 +1,17 @@ [ { "name": "sendgrid/php-http-client", - "version": "3.8.0", - "version_normalized": "3.8.0.0", + "version": "3.9.6", + "version_normalized": "3.9.6.0", "source": { "type": "git", "url": "https://github.com/sendgrid/php-http-client.git", - "reference": "929018c62b7fcd99b3b356216ae75fff4d47b5a1" + "reference": "e9a04d949ee2d19938ab83dc100933a3b41a8ec7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sendgrid/php-http-client/zipball/929018c62b7fcd99b3b356216ae75fff4d47b5a1", - "reference": "929018c62b7fcd99b3b356216ae75fff4d47b5a1", + "url": "https://api.github.com/repos/sendgrid/php-http-client/zipball/e9a04d949ee2d19938ab83dc100933a3b41a8ec7", + "reference": "e9a04d949ee2d19938ab83dc100933a3b41a8ec7", "shasum": "" }, "require": { @@ -21,7 +21,7 @@ "phpunit/phpunit": "~4.4", "squizlabs/php_codesniffer": "~2.0" }, - "time": "2017-09-13 16:52:38", + "time": "2018-04-10 18:06:08", "type": "library", "installation-source": "dist", "autoload": { @@ -55,50 +55,61 @@ }, { "name": "sendgrid/sendgrid", - "version": "6.0.0", - "version_normalized": "6.0.0.0", + "version": "7.3.0", + "version_normalized": "7.3.0.0", "source": { "type": "git", "url": "https://github.com/sendgrid/sendgrid-php.git", - "reference": "8db454e4b5674b545c207a162b64202b0d63259b" + "reference": "37fa19d3ae019842f07a2a43e92ed0f566ad927d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sendgrid/sendgrid-php/zipball/8db454e4b5674b545c207a162b64202b0d63259b", - "reference": "8db454e4b5674b545c207a162b64202b0d63259b", + "url": "https://api.github.com/repos/sendgrid/sendgrid-php/zipball/37fa19d3ae019842f07a2a43e92ed0f566ad927d", + "reference": "37fa19d3ae019842f07a2a43e92ed0f566ad927d", "shasum": "" }, "require": { + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "ext-openssl": "*", "php": ">=5.6", - "sendgrid/php-http-client": "~3.7" + "sendgrid/php-http-client": "~3.9" }, "replace": { "sendgrid/sendgrid-php": "*" }, "require-dev": { - "phpunit/phpunit": "4.*", - "squizlabs/php_codesniffer": "2.*" + "phpunit/phpunit": "^5.7.9 || ^6.4.3", + "squizlabs/php_codesniffer": "3.*", + "swaggest/json-diff": "^3.4" }, - "time": "2017-07-01 04:30:16", + "time": "2019-04-15 17:27:21", "type": "library", "installation-source": "dist", "autoload": { + "psr-4": { + "SendGrid\\": "lib/", + "SendGrid\\Mail\\": "lib/mail/", + "SendGrid\\Contacts\\": "lib/contacts/", + "SendGrid\\Stats\\": "lib/stats/" + }, "files": [ - "lib/SendGrid.php", - "lib/helpers/mail/Mail.php" + "lib/SendGrid.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "This library allows you to quickly and easily send emails through SendGrid using PHP.", + "description": "This library allows you to quickly and easily send emails through Twilio SendGrid using PHP.", "homepage": "http://github.com/sendgrid/sendgrid-php", "keywords": [ "email", "grid", "send", - "sendgrid" + "sendgrid", + "twilio sendgrid" ] } ] diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.github/ISSUE_TEMPLATE b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.github/ISSUE_TEMPLATE index f6eac95..94a2122 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.github/ISSUE_TEMPLATE +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.github/ISSUE_TEMPLATE @@ -14,4 +14,4 @@ Any other information you want to share that is relevant to the issue being repo #### Technical details: * php-http-client Version: master (latest commit: [commit number]) -* PHP Version: 5.x +* PHP Version: X.X diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.gitignore b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.gitignore index bc9ed87..b90ffc5 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.gitignore +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.gitignore @@ -1,6 +1,11 @@ -.env -*.lock +# Composer vendor/ +*.phar +*.lock + +# Jetbrains Idea *.old .idea/ -*.phar + +# Environment files +.env/*.* \ No newline at end of file diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.travis.yml b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.travis.yml index c9ad9ca..0ba5d28 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.travis.yml +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/.travis.yml @@ -3,7 +3,9 @@ before_script: - composer install --dev --no-interaction - cd test/unit script: -- ../../vendor/bin/phpunit . --bootstrap bootstrap.php --filter test* --coverage-clover clover.xml +- ../../vendor/bin/phpunit . --bootstrap bootstrap.php --filter test* --coverage-clover=coverage.xml +after_success: +- bash <(curl -s https://codecov.io/bash) php: - 5.6 - 7.0 @@ -22,4 +24,4 @@ notifications: Build %{build_number} on branch %{branch} by %{author}: %{message} View on GitHub' format: html - notify: true \ No newline at end of file + notify: true diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CHANGELOG.md b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CHANGELOG.md index fb45f8d..dd0c13d 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CHANGELOG.md +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CHANGELOG.md @@ -3,6 +3,72 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [3.9.6] - 2018-04-10 +### Added +- PR [#98](https://github.com/sendgrid/php-http-client/pull/98). Updated documention of `Client.php` using PHPDoc. +- Thanks to [Martijn Melchers](https://github.com/martijnmelchers) for the pull request! + +## [3.9.5] - 2018-03-26 +### Added +- Fixes [#94](https://github.com/sendgrid/php-http-client/issues/94), PR [#95](https://github.com/sendgrid/php-http-client/pull/95): CreateCurlOptions method regression tests +- Thanks to [Alexandr Ivanov](https://github.com/misantron) for the pull request! + +## [3.9.4] - 2018-03-22 +### Fixed +- Fixes [#586](https://github.com/sendgrid/sendgrid-php/issues/586), PR [#96](https://github.com/sendgrid/php-http-client/pull/96): Fix constructor function signature regression. + +## [3.9.3] - 2018-03-11 +### Fixed +- Fixes [#584](https://github.com/sendgrid/sendgrid-php/issues/584), PR [#93](https://github.com/sendgrid/php-http-client/pull/93): Don't overwrite headers set from upstream dependencies. + +## [3.9.2] - 2018-03-10 +### Fixed +- Fixes [#12](https://github.com/sendgrid/php-http-client/issues/12), PR [#91](https://github.com/sendgrid/php-http-client/pull/91): Curl Options broken as array merge does not preserve keys. + +## [3.9.1] - 2018-03-09 +### Fixed +- Fixes [#88](https://github.com/sendgrid/php-http-client/issues/88), PR [#89](https://github.com/sendgrid/php-http-client/pull/89): Restore missing function 'prepareResponse' due to bad previous merge. + +## [3.9.0] - 2018-03-08 +### Added +- PR [#24](https://github.com/sendgrid/php-http-client/pull/24): implements sending concurrent requests with curl multi, thanks to [Tuan Nguyen](https://github.com/lightbringer1991) for the PR! +- PR [#25](https://github.com/sendgrid/php-http-client/pull/25): Add description how install php-http-client manually, thanks to [Ivan](https://github.com/janczer) for the PR! +- PR [#28](https://github.com/sendgrid/php-http-client/pull/28): Create code of conduct, thanks to [Alexander Androsyuk](https://github.com/alex2sat) for the PR! +- Closes [#32](https://github.com/sendgrid/php-http-client/issues/32), PR [#33](https://github.com/sendgrid/php-http-client/pull/33): Added TROUBLESHOOTING + Debug Info, thanks to [Braunson Yager](https://github.com/Braunson) for the PR! +- Closes [#35](https://github.com/sendgrid/php-http-client/issues/35), PR [#37](https://github.com/sendgrid/php-http-client/pull/37): Update README badges, thanks to [Tim Harshman](https://github.com/goteamtim) for the PR! +- Closes [#34](https://github.com/sendgrid/php-http-client/issues/34), PR [#38](https://github.com/sendgrid/php-http-client/pull/38): Update .md files with hyphen vs underscore for page links to enhance SEO, thanks to [Eric Kates](https://github.com/positronek) for the PR! +- Closes [#39](https://github.com/sendgrid/php-http-client/issues/39), PR [#40](https://github.com/sendgrid/php-http-client/pull/40): Added Packagist badge to README, thanks to [Rakshan Shetty](https://github.com/rakshans1) for the PR! +- PR [#41](https://github.com/sendgrid/php-http-client/pull/41): Add table of contents in README.md, thanks to [thepriefy](https://github.com/thepriefy) for the PR! +- PR [#42](https://github.com/sendgrid/php-http-client/pull/42): Add SendGrid logo at the top of README.md, thanks to [thepriefy](https://github.com/thepriefy) for the PR! +- PR [#43](https://github.com/sendgrid/php-http-client/pull/43): Add License section to the README.md, thanks to [thepriefy](https://github.com/thepriefy) for the PR! +- Closes [#46](https://github.com/sendgrid/php-http-client/issues/46), PR [#47](https://github.com/sendgrid/php-http-client/pull/47): Create Pull Request Template, thanks to [Paweł Lewtak](https://github.com/pawel-lewtak) for the PR! +- Closes [#48](https://github.com/sendgrid/php-http-client/issues/48), PR [#51](https://github.com/sendgrid/php-http-client/pull/51): Added example file, updated .gitignore and README, thanks to [Diego Rocha](https://github.com/dhsrocha) for the PR! +- PR [#53](https://github.com/sendgrid/php-http-client/pull/53): README and usage example update, thanks to [Alexandr Ivanov](https://github.com/misantron) for the PR! +- PR [#55](https://github.com/sendgrid/php-http-client/pull/55): Code climate config, thanks to [Alexandr Ivanov](https://github.com/misantron) for the PR! +- Closes [#58](https://github.com/sendgrid/php-http-client/pull/58), PR [#60](https://github.com/sendgrid/php-http-client/pull/60): Adds unit test for checking file existence in repo, thanks to [Michele Orselli](https://github.com/micheleorselli) for the PR! +- Closes [#57](https://github.com/sendgrid/php-http-client/pull/57), PR [#61](https://github.com/sendgrid/php-http-client/pull/61): Adds unit test for checking year on licence, thanks to [Michele Orselli](https://github.com/micheleorselli) for the PR! +- Closes [#50](https://github.com/sendgrid/php-http-client/issues/50), PR [#62](https://github.com/sendgrid/php-http-client/pull/62): Create USAGE.md, thanks to [Nitanshu](https://github.com/nvzard) for the PR! +- Closes [#57](https://github.com/sendgrid/php-http-client/issues/57), PR [#66](https://github.com/sendgrid/php-http-client/pull/66): Add unit test for license year, thanks to [Alex](https://github.com/pushkyn) for the PR! +- Closes [#67](https://github.com/sendgrid/php-http-client/issues/67), PR [#68](https://github.com/sendgrid/php-http-client/pull/68): Add CodeCov support to .travis.yml, thanks to [Manjiri Tapaswi](https://github.com/mptap) for the PR! +- Closes [#49](https://github.com/sendgrid/php-http-client/issues/49), PR [#73](https://github.com/sendgrid/php-http-client/pull/73): Create Dockerfile, thanks to [Jessica Mauerhan](https://github.com/jmauerhan) for the PR! +- Closes [#76](https://github.com/sendgrid/php-http-client/issues/76), PR [#78](https://github.com/sendgrid/php-http-client/pull/78): Added Pull Requests Review section to CONTRIBUTE.md Closes, thanks to [Povilas Balzaravičius](https://github.com/Pawka) for the PR! +- Closes [#63](https://github.com/sendgrid/php-http-client/issues/63), PR [#79](https://github.com/sendgrid/php-http-client/pull/79): Refactor makeRequest method, thanks to [Michael Dennis](https://github.com/michaeljdennis) for the PR! +- PR [#82](https://github.com/sendgrid/php-http-client/pull/82): Add JsonSerializable type to phpDoc of $body parameter in makeRequest method, thanks to [Jan Konáš](https://github.com/jankonas) for the PR! +- PR [#85](https://github.com/sendgrid/php-http-client/pull/85): Updated the PHP Version details, thanks to [Siddhant Sharma](https://github.com/ssiddhantsharma) for the PR! +- PR [#86](https://github.com/sendgrid/php-http-client/pull/86): Add phpdoc for send method, thanks to [Vitaliy Ryaboy](https://github.com/rvitaliy) for the PR! +- PR [#84](https://github.com/sendgrid/php-http-client/pull/84): Update Docker instructions + + +### Fixed +- PR [#26](https://github.com/sendgrid/php-http-client/pull/26): README typo, thanks to [Cícero Pablo](https://github.com/ciceropablo) for the PR! +- PR [#30](https://github.com/sendgrid/php-http-client/pull/30), Fixes [#18](https://github.com/sendgrid/php-http-client/issues/18): Disable CURLOPT_FAILONERROR, thanks to [Zsolt Prontvai](https://github.com/ProZsolt) for the PR! +- PR [#44](https://github.com/sendgrid/php-http-client/pull/44): Fix Typo and add missing links to README, thanks to [Alex](https://github.com/pushkyn) for the PR! +- PR [#52](https://github.com/sendgrid/php-http-client/pull/52): Fix syntax errors in README examples, thanks to [Michael Spiss](https://github.com/michaelspiss) for the PR! +- Fixes [#56](https://github.com/sendgrid/php-http-client/pull/56), PR [#59](https://github.com/sendgrid/php-http-client/pull/59): Update LICENSE - fix year, thanks to [Alex](https://github.com/pushkyn) for the PR! +- PR [#69](https://github.com/sendgrid/php-http-client/pull/69): Remove extra parenthesis from README, thanks to [Jessica Mauerhan](https://github.com/jmauerhan) for the PR! +- PR [#71](https://github.com/sendgrid/php-http-client/pull/71): Fix typo in CONTRIBUTING.md, thanks to [thepriefy](https://github.com/thepriefy) for the PR! +- Fixes [#81](https://github.com/sendgrid/php-http-client/issues/81), PR [#87](https://github.com/sendgrid/php-http-client/pull/87): Stop using insecure option by default + ## [3.8.0] - 2017-09-13 ### Added - Pull request #23: [Automatically retry when rate limit is reached](https://github.com/sendgrid/php-http-client/pull/23) diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CONTRIBUTING.md b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CONTRIBUTING.md index 6350054..6b01be8 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CONTRIBUTING.md +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/CONTRIBUTING.md @@ -2,13 +2,14 @@ Hello! Thank you for choosing to help contribute to one of the SendGrid open sou - [CLAs and CCLAs](#cla) - [Roadmap & Milestones](#roadmap) -- [Feature Request](#feature_request) -- [Submit a Bug Report](#submit_a_bug_report) -- [Improvements to the Codebase](#improvements_to_the_codebase) -- [Understanding the Code Base](#understanding_the_codebase) +- [Feature Request](#feature-request) +- [Submit a Bug Report](#submit-a-bug-report) +- [Improvements to the Codebase](#improvements-to-the-codebase) +- [Understanding the Code Base](#understanding-the-codebase) - [Testing](#testing) -- [Style Guidelines & Naming Conventions](#style_guidelines_and_naming_conventions) -- [Creating a Pull Request](#creating_a_pull_request) +- [Style Guidelines & Naming Conventions](#style-guidelines-and-naming-conventions) +- [Creating a Pull Request](#creating-a-pull-request) +- [Code Reviews](#code-reviews) We use [Milestones](https://github.com/sendgrid/php-http-client/milestones) to help define current roadmaps, please feel free to grab an issue from the current milestone. Please indicate that you have begun work on it to avoid collisions. Once a PR is made, community review, comments, suggestions and additional PRs are welcomed and encouraged. @@ -26,7 +27,7 @@ When you create a Pull Request, after a few seconds, a comment will appear with There are a few ways to contribute, which we'll enumerate below: - + ## Feature Request If you'd like to make a feature request, please read this section. @@ -36,7 +37,7 @@ The GitHub issue tracker is the preferred channel for library feature requests, - Please **search for existing issues** in order to ensure we don't have duplicate bugs/feature requests. - Please be respectful and considerate of others when commenting on issues - + ## Submit a Bug Report Note: DO NOT include your credentials in ANY code examples, descriptions, or media you make public. @@ -53,7 +54,7 @@ Before you decide to create a new issue, please try the following: In order to make the process easier, we've included a [sample bug report template](https://github.com/sendgrid/php-http-client/.github/ISSUE_TEMPLATE) (borrowed from [Ghost](https://github.com/TryGhost/Ghost/)). The template uses [GitHub flavored markdown](https://help.github.com/articles/github-flavored-markdown/) for formatting. - + ## Improvements to the Codebase We welcome direct contributions to the php-http-client code base. Thank you! @@ -74,7 +75,7 @@ git clone https://github.com/sendgrid/php-http-client.git cd php-http-client ``` -## Environment Variables +### Environment Variables First, get your free SendGrid account [here](https://sendgrid.com/free?source=php-http-client). @@ -88,8 +89,9 @@ source ./sendgrid.env ##### Execute: ##### -See the [examples folder](https://github.com/sendgrid/php-http-client/tree/master/examples - +See the [examples folder](https://github.com/sendgrid/php-http-client/tree/master/examples). + + ## Understanding the Code Base **/examples** @@ -127,7 +129,7 @@ cd test/unit ../../vendor/bin/phpunit . --bootstrap bootstrap.php --filter test* ``` - + ## Style Guidelines & Naming Conventions Generally, we follow the style guidelines as suggested by the official language. However, we ask that you conform to the styles that already exist in the library. If you wish to deviate, please explain your reasoning. @@ -138,7 +140,8 @@ Please run your code through: - [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer) -## Creating a Pull Request + +## Creating a Pull Request 1. [Fork](https://help.github.com/fork-a-repo/) the project, clone your fork, and configure the remotes: @@ -147,7 +150,7 @@ Please run your code through: # Clone your fork of the repo into the current directory git clone https://github.com/sendgrid/php-http-client # Navigate to the newly cloned directory - cd sendgrid-python + cd php-http-client # Assign the original repo to a remote called "upstream" git remote add upstream https://github.com/sendgrid/php-http-client ``` @@ -191,4 +194,8 @@ Please run your code through: 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) with a clear title and description against the `master` branch. All tests must be passing before we will review the PR. + +## Code Reviews +If you can, please look at open PRs and review them. Give feedback and help us merge these PRs much faster! If you don't know how, Github has some great [information on how to review a Pull Request](https://help.github.com/articles/about-pull-request-reviews/). + If you have any additional questions, please feel free to [email](mailto:dx@sendgrid.com) us or create an issue in this repo. diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/LICENSE.txt b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/LICENSE.txt index c1631d6..8a3ef00 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/LICENSE.txt +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016 SendGrid, Inc. +Copyright (c) 2012-2018 SendGrid, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/README.md b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/README.md index 0eb7ce8..ef7236a 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/README.md +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/README.md @@ -1,4 +1,11 @@ +![SendGrid Logo](https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png) + [![Travis Badge](https://travis-ci.org/sendgrid/php-http-client.svg?branch=master)](https://travis-ci.org/sendgrid/php-http-client) +[![Latest Version on Packagist](https://img.shields.io/packagist/v/sendgrid/php-http-client.svg?style=flat-square)](https://packagist.org/packages/sendgrid/php-http-client) +[![Email Notifications Badge](https://dx.sendgrid.com/badge/php)](https://dx.sendgrid.com/newsletter/php) +[![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid) +[![GitHub contributors](https://img.shields.io/github/contributors/sendgrid/php-http-client.svg)](https://github.com/sendgrid/php-http-client/graphs/contributors) +[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.txt) **Quickly and easily access any RESTful or RESTful-like API.** @@ -8,6 +15,17 @@ If you are looking for the SendGrid API client library, please see [this repo](h All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/php-http-client/blob/master/CHANGELOG.md). +# Table of Contents +- [Installation](#installation) +- [Quick Start](#quick-start) +- [Usage](#usage) +- [Roadmap](#roadmap) +- [How to Contribute](#contribute) +- [Thanks](#thanks) +- [About](#about) +- [License](#license) + + # Installation ## Prerequisites @@ -21,7 +39,7 @@ Add php-http-client to your `composer.json` file. If you are not using [Composer ```json { "require": { - "sendgrid/php-http-client": "~3.8" + "sendgrid/php-http-client": "~3.9.6" } } ``` @@ -38,6 +56,44 @@ Then from the command line: composer install ``` +## Install without Composer + +You should create directory `lib` in directory of your application and clone to `lib` repositories [php-http-client](https://github.com/sendgrid/php-http-client.git) and [sendgrid-php](https://github.com/sendgrid/sendgrid-php.git): + +``` +$ cd /path/to/your/app +$ mkdir lib +$ cd lib +$ git clone https://github.com/sendgrid/php-http-client.git +``` + +In the next step you should create `loader.php`: + +``` +$ cd /path/to/your/app +$ touch loader.php +``` + +And add to `loader.php` code below: + +```php + # Quick Start Here is a quick example: @@ -45,59 +101,95 @@ Here is a quick example: `GET /your/api/{param}/call` ```php +// include __DIR__ . '/loader.php'; require 'vendor/autoload.php'; -$global_headers = array(Authorization: Basic XXXXXXX); -$client = SendGrid\Client('base_url', global_headers); +$apiKey = YOUR_SENDGRID_API_KEY; +$authHeaders = [ + 'Authorization: Bearer ' . $apiKey +]; +$client = new SendGrid\Client('https://api.sendgrid.com', $authHeaders); +$param = 'foo'; $response = $client->your()->api()->_($param)->call()->get(); -print $response->statusCode(); -print $response->headers(); -print $response->body(); + +var_dump( + $response->statusCode(), + $response->headers(), + $response->body() +); ``` `POST /your/api/{param}/call` with headers, query parameters and a request body with versioning. ```php +// include __DIR__ . '/loader.php'; require 'vendor/autoload.php'; -$global_headers = array(Authorization: Basic XXXXXXX); -$client = SendGrid\Client('base_url', global_headers); -$query_params = array('hello' => 0, 'world' => 1); -$request_headers = array('X-Test' => 'test'); -$data = array('some' => 1, 'awesome' => 2, 'data' => 3); -$response = $client->your()->api()->_($param)->call()->post('data', - 'query_params', - 'request_headers'); -print $response->statusCode(); -print $response->headers(); -print $response->body(); +$apiKey = YOUR_SENDGRID_API_KEY; +$authHeaders = [ + 'Authorization: Bearer ' . $apiKey +]; +$client = new SendGrid\Client('https://api.sendgrid.com', $authHeaders); +$queryParams = [ + 'hello' => 0, 'world' => 1 +]; +$requestHeaders = [ + 'X-Test' => 'test' +]; +$data = [ + 'some' => 1, 'awesome' => 2, 'data' => 3 +]; +$param = 'bar'; +$response = $client->your()->api()->_($param)->call()->post($data, $queryParams, $requestHeaders); + +var_dump( + $response->statusCode(), + $response->headers(), + $response->body() +); ``` + # Usage -- [Example Code](https://github.com/sendgrid/php-http-client/tree/master/examples) +- [Usage Examples](USAGE.md) + +## Environment Variables + +You can do the following to create a .env file: -## Roadmap +```cp .env_example .env``` -If you are intersted in the future direction of this project, please take a look at our [milestones](https://github.com/sendgrid/php-http-client/milestones). We would love to hear your feedback. +Then, just add your API Key into your .env file. -## How to Contribute + +# Roadmap -We encourage contribution to our libraries, please see our [CONTRIBUTING](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md)) guide for details. +If you are interested in the future direction of this project, please take a look at our [milestones](https://github.com/sendgrid/php-http-client/milestones). We would love to hear your feedback. + + +# How to Contribute + +We encourage contribution to our libraries, please see our [CONTRIBUTING](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md) guide for details. Quick links: -- [Feature Request](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#feature_request) -- [Bug Reports](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#submit_a_bug_report) +- [Feature Request](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#feature-request) +- [Bug Reports](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#submit-a-bug-report) - [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#cla) -- [Improvements to the Codebase](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#improvements_to_the_codebase) +- [Improvements to the Codebase](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#improvements-to-the-codebase) +- [Review Pull Requests](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#code-reviews) + # Thanks We were inspired by the work done on [birdy](https://github.com/inueni/birdy) and [universalclient](https://github.com/dgreisen/universalclient). + # About php-http-client is guided and supported by the SendGrid [Developer Experience Team](mailto:dx@sendgrid.com). php-http-client is maintained and funded by SendGrid, Inc. The names and logos for php-http-client are trademarks of SendGrid, Inc. -![SendGrid Logo](https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png) + +# License +[The MIT License (MIT)](LICENSE.txt) diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/composer.json b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/composer.json index 80b219b..5c0a3af 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/composer.json +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/composer.json @@ -2,11 +2,7 @@ "name": "sendgrid/php-http-client", "description": "HTTP REST client, simplified for PHP", "type": "library", - "version": "3.8.0", - "require-dev": { - "phpunit/phpunit": "~4.4", - "squizlabs/php_codesniffer": "~2.0" - }, + "version": "3.9.6", "homepage": "http://github.com/sendgrid/php-http-client", "keywords": ["SendGrid", "HTTP", "REST", "API", "Fluent"], "license": "MIT", @@ -23,6 +19,10 @@ "require": { "php": ">=5.6" }, + "require-dev": { + "phpunit/phpunit": "~4.4", + "squizlabs/php_codesniffer": "~2.0" + }, "autoload": { "psr-4": { "SendGrid\\": "lib/" diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Client.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Client.php index d3ca94d..ec732b9 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Client.php +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Client.php @@ -1,46 +1,225 @@ - * @author Elmer Thomas - * @copyright 2016 SendGrid - * @license https://opensource.org/licenses/MIT The MIT License - * @version GIT: - * @link http://packagist.org/packages/sendgrid/php-http-client - */ + * HTTP Client library + * + * @author Matt Bernier + * @author Elmer Thomas + * @copyright 2018 SendGrid + * @license https://opensource.org/licenses/MIT The MIT License + * @version GIT: + * @link http://packagist.org/packages/sendgrid/php-http-client + */ namespace SendGrid; /** - * Quickly and easily access any REST or REST-like API. - */ + * + * Class Client + * @package SendGrid + * @version 3.9.5 + * + * Quickly and easily access any REST or REST-like API. + * + * @method Response get($body = null, $query = null, $headers = null) + * @method Response post($body = null, $query = null, $headers = null) + * @method Response patch($body = null, $query = null, $headers = null) + * @method Response put($body = null, $query = null, $headers = null) + * @method Response delete($body = null, $query = null, $headers = null) + * + * @method Client version($value) + * @method Client|Response send() + * + * Adding all the endpoints as a method so code completion works + * + * General + * @method Client stats() + * @method Client search() + * @method Client monthly() + * @method Client sums() + * @method Client monitor() + * @method Client test() + * + * Access settings + * @method Client access_settings() + * @method Client activity() + * @method Client whitelist() + * + * Alerts + * @method Client alerts() + * + * Api keys + * @method Client api_keys() + * + * ASM + * @method Client asm() + * @method Client groups() + * + * Browsers + * @method Client browsers() + * + * Campaigns + * @method Client campaigns() + * @method Client schedules() + * @method Client now() + * + * Categories + * @method Client categories() + * + * Clients + * @method Client clients() + * + * ContactDB + * @method Client contactdb() + * @method Client custom_fields() + * @method Client lists() + * @method Client recipients() + * @method Client billable_count() + * @method Client count() + * @method Client reserved_fields() + * @method Client segments() + * + * Devices + * @method Client devices() + * + * Geo + * @method Client geo() + * + * Ips + * @method Client ips() + * @method Client assigned() + * @method Client pools() + * @method Client warmup() + * + * Mail + * @method Client mail() + * @method Client batch() + * + * Mailbox Providers + * @method Client mailbox_providers() + * + * Mail settings + * @method Client mail_settings() + * @method Client address_whitelist() + * @method Client bcc() + * @method Client bounce_purge() + * @method Client footer() + * @method Client forward_bounce() + * @method Client forward_spam() + * @method Client plain_content() + * @method Client spam_check() + * @method Client template() + * + * Partner settings + * @method Client partner_settings() + * @method Client new_relic() + * + * Scopes + * @method Client scopes() + * + * Senders + * @method Client senders() + * @method Client resend_verification() + * + * Sub Users + * @method Client subusers() + * @method Client reputations() + * + * Supressions + * @method Client suppressions() + * @method Client global() + * @method Client blocks() + * @method Client bounces() + * @method Client invalid_emails() + * @method Client spam_reports() + * @method Client unsubcribes() + * + * Templates + * @method Client templates() + * @method Client versions() + * @method Client activate() + * + * Tracking settings + * @method Client tracking_settings() + * @method Client click() + * @method Client google_analytics() + * @method Client open() + * @method Client subscription() + * + * User + * @method Client user() + * @method Client account() + * @method Client credits() + * @method Client email() + * @method Client password() + * @method Client profile() + * @method Client scheduled_sends() + * @method Client enforced_tls() + * @method Client settings() + * @method Client username() + * @method Client webhooks() + * @method Client event() + * @method Client parse() + * + * Missed any? Simply add them by doing: @method Client method() + */ class Client { - /** @var string */ + const TOO_MANY_REQUESTS_HTTP_CODE = 429; + + /** + * @var string + */ protected $host; - /** @var array */ + + /** + * @var array + */ protected $headers; - /** @var string */ + + /** + * @var string + */ protected $version; - /** @var array */ + + /** + * @var array + */ protected $path; - /** @var array */ + + /** + * @var array + */ protected $curlOptions; - /** @var array */ - private $methods; - /** @var bool */ - private $retryOnLimit; + + /** + * @var bool + */ + protected $isConcurrentRequest; + + /** + * @var array + */ + protected $savedRequests; + + /** + * @var bool + */ + protected $retryOnLimit; + + /** + * These are the supported HTTP verbs + * + * @var array + */ + private $methods = ['get', 'post', 'patch', 'put', 'delete']; /** * Initialize the client * * @param string $host the base url (e.g. https://api.sendgrid.com) * @param array $headers global request headers - * @param string $version api version (configurable) + * @param string $version api version (configurable) - this is specific to the SendGrid API * @param array $path holds the segments of the url path * @param array $curlOptions extra options to set during curl initialization * @param bool $retryOnLimit set default retry on limit flag @@ -52,10 +231,9 @@ class Client $this->version = $version; $this->path = $path ?: []; $this->curlOptions = $curlOptions ?: []; - // These are the supported HTTP verbs - $this->methods = ['delete', 'get', 'patch', 'post', 'put']; - $this->retryOnLimit = $retryOnLimit; + $this->isConcurrentRequest = false; + $this->savedRequests = []; } /** @@ -99,29 +277,54 @@ class Client } /** - * Make a new Client object - * - * @param string $name name of the url segment - * - * @return Client object - */ - private function buildClient($name = null) + * Set extra options to set during curl initialization + * + * @param array $options + * + * @return Client + */ + public function setCurlOptions(array $options) { - if (isset($name)) { - $this->path[] = $name; - } - $client = new Client($this->host, $this->headers, $this->version, $this->path, $this->curlOptions); - $this->path = []; - return $client; + $this->curlOptions = $options; + + return $this; } /** - * Build the final URL to be passed - * - * @param array $queryParams an array of all the query parameters - * - * @return string - */ + * Set default retry on limit flag + * + * @param bool $retry + * + * @return Client + */ + public function setRetryOnLimit($retry) + { + $this->retryOnLimit = $retry; + + return $this; + } + + /** + * Set concurrent request flag + * + * @param bool $isConcurrent + * + * @return Client + */ + public function setIsConcurrentRequest($isConcurrent) + { + $this->isConcurrentRequest = $isConcurrent; + + return $this; + } + + /** + * Build the final URL to be passed + * + * @param array $queryParams an array of all the query parameters + * + * @return string + */ private function buildUrl($queryParams = null) { $path = '/' . implode('/', $this->path); @@ -132,86 +335,231 @@ class Client } /** - * Make the API call and return the response. This is separated into - * it's own function, so we can mock it easily for testing. - * - * @param string $method the HTTP verb - * @param string $url the final url to call - * @param array $body request body - * @param array $headers any additional request headers - * @param bool $retryOnLimit should retry if rate limit is reach? - * - * @return Response object - */ - public function makeRequest($method, $url, $body = null, $headers = null, $retryOnLimit = false) + * Creates curl options for a request + * this function does not mutate any private variables + * + * @param string $method + * @param array $body + * @param array $headers + * + * @return array + */ + private function createCurlOptions($method, $body = null, $headers = null) { - $curl = curl_init($url); - - curl_setopt_array($curl, [ - CURLOPT_RETURNTRANSFER => true, - CURLOPT_HEADER => 1, - CURLOPT_CUSTOMREQUEST => strtoupper($method), - CURLOPT_SSL_VERIFYPEER => false, - ] + $this->curlOptions); + $options = [ + CURLOPT_RETURNTRANSFER => true, + CURLOPT_HEADER => true, + CURLOPT_CUSTOMREQUEST => strtoupper($method), + CURLOPT_SSL_VERIFYPEER => true, + CURLOPT_FAILONERROR => false + ] + $this->curlOptions; if (isset($headers)) { - $this->headers = array_merge($this->headers, $headers); + $headers = array_merge($this->headers, $headers); + } else { + $headers = $this->headers; } + if (isset($body)) { $encodedBody = json_encode($body); - curl_setopt($curl, CURLOPT_POSTFIELDS, $encodedBody); - $this->headers = array_merge($this->headers, ['Content-Type: application/json']); + $options[CURLOPT_POSTFIELDS] = $encodedBody; + $headers = array_merge($headers, ['Content-Type: application/json']); + } + $options[CURLOPT_HTTPHEADER] = $headers; + + return $options; + } + + /** + * @param array $requestData + * e.g. ['method' => 'POST', 'url' => 'www.example.com', 'body' => 'test body', 'headers' => []] + * @param bool $retryOnLimit + * + * @return array + */ + private function createSavedRequest(array $requestData, $retryOnLimit = false) + { + return array_merge($requestData, ['retryOnLimit' => $retryOnLimit]); + } + + /** + * @param array $requests + * + * @return array + */ + private function createCurlMultiHandle(array $requests) + { + $channels = []; + $multiHandle = curl_multi_init(); + + foreach ($requests as $id => $data) { + $channels[$id] = curl_init($data['url']); + $curlOpts = $this->createCurlOptions($data['method'], $data['body'], $data['headers']); + curl_setopt_array($channels[$id], $curlOpts); + curl_multi_add_handle($multiHandle, $channels[$id]); } - curl_setopt($curl, CURLOPT_HTTPHEADER, $this->headers); - $response = curl_exec($curl); - $headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE); - $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); + return [$channels, $multiHandle]; + } + + /** + * Prepare response object + * + * @param resource $channel the curl resource + * @param string $content + * + * @return Response object + */ + private function parseResponse($channel, $content) + { + $headerSize = curl_getinfo($channel, CURLINFO_HEADER_SIZE); + $statusCode = curl_getinfo($channel, CURLINFO_HTTP_CODE); - $responseBody = substr($response, $headerSize); - $responseHeaders = substr($response, 0, $headerSize); + $responseBody = substr($content, $headerSize); + $responseHeaders = substr($content, 0, $headerSize); $responseHeaders = explode("\n", $responseHeaders); $responseHeaders = array_map('trim', $responseHeaders); - curl_close($curl); - - $response = new Response($statusCode, $responseBody, $responseHeaders); + return new Response($statusCode, $responseBody, $responseHeaders); + } - if ($statusCode == 429 && $retryOnLimit) { - $headers = $response->headers(true); - $sleepDurations = $headers['X-Ratelimit-Reset'] - time(); - sleep($sleepDurations > 0 ? $sleepDurations : 0); - return $this->makeRequest($method, $url, $body, $headers, false); + /** + * Retry request + * + * @param array $responseHeaders headers from rate limited response + * @param string $method the HTTP verb + * @param string $url the final url to call + * @param array $body request body + * @param array $headers original headers + * + * @return Response response object + */ + private function retryRequest(array $responseHeaders, $method, $url, $body, $headers) + { + $sleepDurations = $responseHeaders['X-Ratelimit-Reset'] - time(); + sleep($sleepDurations > 0 ? $sleepDurations : 0); + return $this->makeRequest($method, $url, $body, $headers, false); + } + + /** + * Make the API call and return the response. + * This is separated into it's own function, so we can mock it easily for testing. + * + * @param string $method the HTTP verb + * @param string $url the final url to call + * @param array $body request body + * @param array $headers any additional request headers + * @param bool $retryOnLimit should retry if rate limit is reach? + * + * @return Response object + */ + public function makeRequest($method, $url, $body = null, $headers = null, $retryOnLimit = false) + { + $channel = curl_init($url); + + $options = $this->createCurlOptions($method, $body, $headers); + + curl_setopt_array($channel, $options); + $content = curl_exec($channel); + + $response = $this->parseResponse($channel, $content); + + if ($response->statusCode() === self::TOO_MANY_REQUESTS_HTTP_CODE && $retryOnLimit) { + $responseHeaders = $response->headers(true); + return $this->retryRequest($responseHeaders, $method, $url, $body, $headers); } + curl_close($channel); + return $response; } /** - * Add variable values to the url. - * (e.g. /your/api/{variable_value}/call) - * Another example: if you have a PHP reserved word, such as and, - * in your url, you must use this method. - * - * @param string $name name of the url segment - * - * @return Client object - */ + * Send all saved requests at once + * + * @param array $requests + * + * @return Response[] + */ + public function makeAllRequests(array $requests = []) + { + if (empty($requests)) { + $requests = $this->savedRequests; + } + list($channels, $multiHandle) = $this->createCurlMultiHandle($requests); + + // running all requests + $isRunning = null; + do { + curl_multi_exec($multiHandle, $isRunning); + } while ($isRunning); + + // get response and close all handles + $retryRequests = []; + $responses = []; + $sleepDurations = 0; + foreach ($channels as $id => $channel) { + + $content = curl_multi_getcontent($channel); + $response = $this->parseResponse($channel, $content); + + if ($response->statusCode() === self::TOO_MANY_REQUESTS_HTTP_CODE && $requests[$id]['retryOnLimit']) { + $headers = $response->headers(true); + $sleepDurations = max($sleepDurations, $headers['X-Ratelimit-Reset'] - time()); + $requestData = [ + 'method' => $requests[$id]['method'], + 'url' => $requests[$id]['url'], + 'body' => $requests[$id]['body'], + 'headers' => $headers, + ]; + $retryRequests[] = $this->createSavedRequest($requestData, false); + } else { + $responses[] = $response; + } + + curl_multi_remove_handle($multiHandle, $channel); + } + curl_multi_close($multiHandle); + + // retry requests + if (!empty($retryRequests)) { + sleep($sleepDurations > 0 ? $sleepDurations : 0); + $responses = array_merge($responses, $this->makeAllRequests($retryRequests)); + } + return $responses; + } + + /** + * Add variable values to the url. (e.g. /your/api/{variable_value}/call) + * Another example: if you have a PHP reserved word, such as and, in your url, you must use this method. + * + * @param string $name name of the url segment + * + * @return Client object + */ public function _($name = null) { - return $this->buildClient($name); + if (isset($name)) { + $this->path[] = $name; + } + $client = new static($this->host, $this->headers, $this->version, $this->path); + $client->setCurlOptions($this->curlOptions); + $client->setRetryOnLimit($this->retryOnLimit); + $this->path = []; + + return $client; } /** - * Dynamically add method calls to the url, then call a method. - * (e.g. client.name.name.method()) - * - * @param string $name name of the dynamic method call or HTTP verb - * @param array $args parameters passed with the method call - * - * @return Client|Response object - */ + * Dynamically add method calls to the url, then call a method. + * (e.g. client.name.name.method()) + * + * @param string $name name of the dynamic method call or HTTP verb + * @param array $args parameters passed with the method call + * + * @return Client|Response|Response[]|null object + */ public function __call($name, $args) { $name = strtolower($name); @@ -221,12 +569,25 @@ class Client return $this->_(); } + // send all saved requests + if (($name === 'send') && $this->isConcurrentRequest) { + return $this->makeAllRequests(); + } + if (in_array($name, $this->methods, true)) { $body = isset($args[0]) ? $args[0] : null; $queryParams = isset($args[1]) ? $args[1] : null; $url = $this->buildUrl($queryParams); $headers = isset($args[2]) ? $args[2] : null; $retryOnLimit = isset($args[3]) ? $args[3] : $this->retryOnLimit; + + if ($this->isConcurrentRequest) { + // save request to be sent later + $requestData = ['method' => $name, 'url' => $url, 'body' => $body, 'headers' => $headers]; + $this->savedRequests[] = $this->createSavedRequest($requestData, $retryOnLimit); + return null; + } + return $this->makeRequest($name, $url, $body, $headers, $retryOnLimit); } diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Response.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Response.php index 29720f0..f658f2c 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Response.php +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/php-http-client/lib/Response.php @@ -3,11 +3,9 @@ /** * HTTP Client library * - * PHP version 5.4 - * * @author Matt Bernier * @author Elmer Thomas - * @copyright 2016 SendGrid + * @copyright 2018 SendGrid * @license https://opensource.org/licenses/MIT The MIT License * @version GIT: * @link http://packagist.org/packages/sendgrid/php-http-client @@ -20,21 +18,29 @@ namespace SendGrid; */ class Response { - /** @var int */ + /** + * @var int + */ protected $statusCode; - /** @var string */ + + /** + * @var string + */ protected $body; - /** @var array */ + + /** + * @var array + */ protected $headers; /** * Setup the response data * - * @param int $statusCode the status code. - * @param string $body the response body. - * @param array $headers an array of response headers. + * @param int $statusCode the status code. + * @param string $body the response body. + * @param array $headers an array of response headers. */ - public function __construct($statusCode = null, $body = null, $headers = null) + public function __construct($statusCode = 200, $body = '', array $headers = []) { $this->statusCode = $statusCode; $this->body = $body; @@ -79,25 +85,16 @@ class Response /** * Returns response headers as associative array - * + * * @param array $headers * * @return array - * - * @throws \InvalidArgumentException */ - private function prettifyHeaders($headers) + private function prettifyHeaders(array $headers) { - if (!is_array($headers)) { - throw new \InvalidArgumentException('$headers should be array'); - } - return array_reduce( array_filter($headers), function ($result, $header) { - if (empty($header)) { - return $result; - } if (false === strpos($header, ':')) { $result['Status'] = trim($header); @@ -105,7 +102,7 @@ class Response return $result; } - list ($key, $value) = explode(':', $header, 2); + list($key, $value) = explode(':', $header, 2); $result[trim($key)] = trim($value); return $result; diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.github/ISSUE_TEMPLATE b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.github/ISSUE_TEMPLATE index 8e2d043..d378427 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.github/ISSUE_TEMPLATE +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.github/ISSUE_TEMPLATE @@ -2,7 +2,6 @@ A summary of the issue and the environment in which it occurs. If suitable, include the steps required to reproduce the bug. Please feel free to include screenshots, screencasts, code examples. - #### Steps to Reproduce 1. This is the first step @@ -14,4 +13,4 @@ Any other information you want to share that is relevant to the issue being repo #### Technical details: * sendgrid-php Version: master (latest commit: [commit number]) -* PHP Version: 5.x \ No newline at end of file +* PHP Version: 5.6, 7.0, 7.1, 7.2 (as of May 17, 2018) diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.gitignore b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.gitignore index 8f8f4f1..efe514c 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.gitignore +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.gitignore @@ -2,9 +2,18 @@ test/coverage/* dist/ composer.lock vendor -.env* +.env sendgrid.env composer.phar .editorconfig test.php -.idea/ \ No newline at end of file +.idea/ +test/prism_linux_amd64 +test/prism/* +!test/prim +*.code-workspace +.vscode +prism* +temp.php +example*.php +TODO.txt diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.travis.yml b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.travis.yml index 068c594..c222a38 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.travis.yml +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/.travis.yml @@ -1,27 +1,26 @@ language: php + before_script: -before_script: -- mkdir prism -- mkdir prism/bin -- export PATH=$PATH:$PWD/prism/bin/ -- ./test/prism.sh - composer install -- cd test/unit +- "./test/prism.sh &" +- sleep 60 +- cd test + script: -- "../../vendor/bin/phpunit . --bootstrap bootstrap.php --filter test*" +- "../vendor/bin/phpunit . --filter test*" + after_script: -- cd ../.. -- ./scripts/s3upload.sh +- cd ../ +after_success: +- bash <(curl -s https://codecov.io/bash) + php: - 5.6 - 7.0 -env: - global: - - S3_POLICY: ewogICJleHBpcmF0aW9uIjogIjIxMDAtMDEtMDFUMTI6MDA6MDAuMDAwWiIsCiAgImNvbmRpdGlvbnMiOiBbCiAgICB7ImFjbCI6ICJwdWJsaWMtcmVhZCIgfSwKICAgIHsiYnVja2V0IjogInNlbmRncmlkLW9wZW4tc291cmNlIiB9LAogICAgWyJzdGFydHMtd2l0aCIsICIka2V5IiwgInNlbmRncmlkLXBocC8iXSwKICAgIFsiY29udGVudC1sZW5ndGgtcmFuZ2UiLCAyMDQ4LCAyNjg0MzU0NTZdLAogICAgWyJlcSIsICIkQ29udGVudC1UeXBlIiwgImFwcGxpY2F0aW9uL3ppcCJdCiAgXQp9Cgo= - - secure: eUN0huKA436uIkISu6V3yW01/gZHC6slBvlnprMPEhzclU2szH6qhWEXWS5CcOG6EEDBReqLZdNAwu+FC69KGFO9+6oW2GQQLSsfEViqFi/Ig2N0r4EBO4jLRebgq0GOfetPwQvJH27d8BCiloPy8rXBb5pskxSNw4B4bRyXHz4= - - secure: j38xzMNmzYXR/JJdVumPmDoDVxb6FUDF497AuVPHowGh0egFW8XHWCOMeQWqWZI4Gg17pViQNIJ3xC6WBvob70AF8fsNm0+vxF2s7abXDMcbq5flLTS6ydKLgNu+na/RAkOBbTwxJAGIH/fQh8BH8iGKerCwoqf8sDErAge4NMw= - - secure: h3HlxBOsNXBDrIJ0yl467ST6Q8R2TmbL7PltlPcRoHy5gAxn5UiDv5W2+6DSXrwQrTjOUunZ+O9ckcaQGQy1JNhGMwgIkJpyWAHDIHhTYGU289uUIDTHQW/soX0qHJSHSx3iMgDOIc7XnfTz6W7Nv1gYKZFedOMsZ5uBMeGyiXE= - - secure: SKSl/RHFQNhGT7OUj7E0AbrQnuDhhCRI/4jC76mmzvy8EJBDgUNevAKJGtug+LVilHrlbk9fLC8rayPW6SGv0s3PowTGm8NMOc48aRBLOr7QRo/sMikJCmRuU6HWptr0NKuf2fq6lV94WDm/pDdyOSNyLga9/eaIDs/Sacp78sw= +- 7.1 +- 7.2 +- 7.3 + notifications: hipchat: rooms: diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/README.md b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/README.md index 2add305..79d38ee 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/README.md +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/README.md @@ -1,208 +1,201 @@ +![SendGrid Logo](https://github.com/sendgrid/sendgrid-python/raw/master/twilio_sendgrid_logo.png) + [![BuildStatus](https://travis-ci.org/sendgrid/sendgrid-php.svg?branch=master)](https://travis-ci.org/sendgrid/sendgrid-php) +[![Packagist](https://img.shields.io/packagist/v/sendgrid/sendgrid.svg)](https://packagist.org/packages/sendgrid/sendgrid) +[![Downloads](https://img.shields.io/packagist/dt/sendgrid/sendgrid.svg?maxAge=3600)](https://packagist.org/packages/sendgrid/sendgrid) +[![Email Notifications Badge](https://dx.sendgrid.com/badge/php)](https://dx.sendgrid.com/newsletter/php) +[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.md) +[![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid) +[![GitHub contributors](https://img.shields.io/github/contributors/sendgrid/sendgrid-php.svg)](https://github.com/sendgrid/sendgrid-php/graphs/contributors) +[![Open Source Helpers](https://www.codetriage.com/sendgrid/sendgrid-php/badges/users.svg)](https://www.codetriage.com/sendgrid/sendgrid-php) -Please see our announcement regarding [breaking changes](https://github.com/sendgrid/sendgrid-php/issues/290). Your support is appreciated! +**NEW:** +- Subscribe to email [notifications](https://dx.sendgrid.com/newsletter/php) for releases and breaking changes. +- Send SMS messages with [Twilio](https://github.com/sendgrid/sendgrid-php/blob/master/USE_CASES.md#sms). -**This library allows you to quickly and easily use the SendGrid Web API v3 via PHP.** +**This library allows you to quickly and easily use the Twilio SendGrid Web API v3 via PHP.** -Version 5.X.X of this library provides full support for all SendGrid [Web API v3](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html) endpoints, including the new [v3 /mail/send](https://sendgrid.com/blog/introducing-v3mailsend-sendgrids-new-mail-endpoint). +Version 7.X.X of this library provides full support for all Twilio SendGrid [Web API v3](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html) endpoints, including the new [v3 /mail/send](https://sendgrid.com/blog/introducing-v3mailsend-sendgrids-new-mail-endpoint). -This library represents the beginning of a new path for SendGrid. We want this library to be community driven and SendGrid led. We need your help to realize this goal. To help make sure we are building the right things in the right order, we ask that you create [issues](https://github.com/sendgrid/sendgrid-php/issues) and [pull requests](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md) or simply upvote or comment on existing issues or pull requests. +We want this library to be community driven and Twilio SendGrid led. Your help is needed to realize this goal. To help make sure we are building the right things in the right order, we ask that you create [issues](https://github.com/sendgrid/sendgrid-php/issues) and [pull requests](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md) or simply upvote or comment on existing issues or pull requests. -Please browse the rest of this README for further detail. +Please browse the rest of this README for further details. We appreciate your continued support, thank you! # Table of Contents * [Installation](#installation) -* [Quick Start](#quick_start) +* [Quick Start](#quick-start) +* [Use Cases](#use-cases) * [Usage](#usage) -* [Use Cases](#use_cases) * [Announcements](#announcements) * [Roadmap](#roadmap) * [How to Contribute](#contribute) * [Troubleshooting](#troubleshooting) * [About](#about) +* [License](#license) # Installation ## Prerequisites -- PHP version 5.6 or 7.0 -- The SendGrid service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-php) +- PHP version 5.6, 7.0, 7.1 or 7.2 +- The Twilio SendGrid service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-php) to send up to 40,000 emails for the first 30 days, then send 100 emails/day free forever or check out [our pricing](https://sendgrid.com/pricing?source=sendgrid-php). +- For SMS messages, you will need a free [Twilio account](https://www.twilio.com/try-twilio?source=sendgrid-php). ## Setup Environment Variables Update the development environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys), for example: +1. Copy the sample env file to a new file named `.env` +```bash +cp .env.sample .env +``` +2. Edit the `.env` file to include your `SENDGRID_API_KEY` +3. Source the `.env` file ```bash -echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env -echo "sendgrid.env" >> .gitignore -source ./sendgrid.env +source ./.env ``` ## Install Package -Add SendGrid to your `composer.json` file. If you are not using [Composer](http://getcomposer.org), you should be. It's an excellent way to manage dependencies in your PHP application. +Add Twilio SendGrid to your `composer.json` file. If you are not using [Composer](http://getcomposer.org), we highly recommend it. It's an excellent way to manage dependencies in your PHP application. ```json { "require": { - "sendgrid/sendgrid": "~6.0" + "sendgrid/sendgrid": "~7" } } ``` #### Alternative: Install package from zip -If you are not using Composer, simply download and install the **[latest packaged release of the library as a zip](https://github.com/sendgrid/sendgrid-php/archive/master.zip)**. +If you are not using Composer, simply download and install the **[latest packaged release of the library as a zip](https://github.com/sendgrid/sendgrid-php/releases/download/v7.3.0/sendgrid-php.zip)**. -[**⬇︎ Download Packaged Library ⬇︎**](https://github.com/sendgrid/sendgrid-php/archive/master.zip) +[**⬇︎ Download Packaged Library ⬇︎**](https://github.com/sendgrid/sendgrid-php/releases/download/v7.3.0/sendgrid-php.zip) -Previous versions of the library can be found in the [version index](https://sendgrid-open-source.s3.amazonaws.com/index.html) or downloaded directly from GitHub. +Previous versions of the library can be found in the [version index](https://sendgrid-open-source.s3.amazonaws.com/index.html) or downloaded directly from [GitHub](https://github.com/sendgrid/sendgrid-php/releases). ## Dependencies -- The SendGrid Service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-php) -- [php-HTTP-Client](https://github.com/sendgrid/php-http-client) +- The Twilio SendGrid Service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-php) +- The dependency free [php-http-client](https://github.com/sendgrid/php-http-client) - + # Quick Start ## Hello Email -The following is the minimum needed code to send an email with the [/mail/send Helper](https://github.com/sendgrid/sendgrid-php/tree/master/lib/helpers/mail) ([here](https://github.com/sendgrid/sendgrid-php/blob/master/examples/helpers/mail/example.php#L22) is a full example): +The following is the minimum needed code to send an email. You may find more examples in our USE_CASES file: ```php client->mail()->send()->post($mail); -echo $response->statusCode(); -print_r($response->headers()); -echo $response->body(); +require 'vendor/autoload.php'; // If you're using Composer (recommended) +// Comment out the above line if not using Composer +// require("/sendgrid-php.php"); +// If not using Composer, uncomment the above line and +// download sendgrid-php.zip from the latest release here, +// replacing with the path to the sendgrid-php.php file, +// which is included in the download: +// https://github.com/sendgrid/sendgrid-php/releases + +$email = new \SendGrid\Mail\Mail(); +$email->setFrom("test@example.com", "Example User"); +$email->setSubject("Sending with Twilio SendGrid is Fun"); +$email->addTo("test@example.com", "Example User"); +$email->addContent("text/plain", "and easy to do anywhere, even with PHP"); +$email->addContent( + "text/html", "and easy to do anywhere, even with PHP" +); +$sendgrid = new \SendGrid(getenv('SENDGRID_API_KEY')); +try { + $response = $sendgrid->send($email); + print $response->statusCode() . "\n"; + print_r($response->headers()); + print $response->body() . "\n"; +} catch (Exception $e) { + echo 'Caught exception: '. $e->getMessage() ."\n"; +} ``` -The `SendGrid\Mail` constructor creates a [personalization object](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/personalizations.html) for you. [Here](https://github.com/sendgrid/sendgrid-php/blob/master/examples/helpers/mail/example.php#L16) is an example of how to add to it. - -### Without Mail Helper Class - -The following is the minimum needed code to send an email without the /mail/send Helper ([here](https://github.com/sendgrid/sendgrid-php/blob/master/examples/mail/mail.php#L28) is a full example): - -```php -client->mail()->send()->post($request_body); -echo $response->statusCode(); -echo $response->body(); -print_r($response->headers()); -``` +The `SendGrid\Mail` constructor creates a [personalization object](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/personalizations.html) for you. [Here](https://github.com/sendgrid/sendgrid-php/blob/master/USE_CASES.md#kitchen-sink) is an example of how to add to it. ## General v3 Web API Usage (With Fluent Interface) ```php /sendgrid-php.php"); +// If not using Composer, uncomment the above line and +// download sendgrid-php.zip from the latest release here, +// replacing with the path to the sendgrid-php.php file, +// which is included in the download: +// https://github.com/sendgrid/sendgrid-php/releases $apiKey = getenv('SENDGRID_API_KEY'); $sg = new \SendGrid($apiKey); -$response = $sg->client->suppression()->bounces()->get(); - -print $response->statusCode(); -print $response->headers(); -print $response->body(); +try { + $response = $sg->client->suppression()->bounces()->get(); + print $response->statusCode() . "\n"; + print_r($response->headers()); + print $response->body() . "\n"; +} catch (Exception $e) { + echo 'Caught exception: '. $e->getMessage(). "\n"; +} ``` ## General v3 Web API Usage (Without Fluent Interface) ```php /sendgrid-php.php"); +// If not using Composer, uncomment the above line and +// download sendgrid-php.zip from the latest release here, +// replacing with the path to the sendgrid-php.php file, +// which is included in the download: +// https://github.com/sendgrid/sendgrid-php/releases $apiKey = getenv('SENDGRID_API_KEY'); $sg = new \SendGrid($apiKey); -$response = $sg->client->_("suppression/bounces")->get(); - -print $response->statusCode(); -print $response->headers(); -print $response->body(); +try { + $response = $sg->client->_("suppression/bounces")->get(); + print $response->statusCode() . "\n"; + print_r($response->headers()); + print $response->body() . "\n"; +} catch (Exception $e) { + echo 'Caught exception: '. $e->getMessage(). "\n"; +} ``` + +# Use Cases + +[Examples of common API use cases](https://github.com/sendgrid/sendgrid-php/blob/master/USE_CASES.md), such as how to send an email with a transactional template. + # Usage -- [SendGrid Docs](https://sendgrid.com/docs/API_Reference/index.html) -- [Library Usage +- [Twilio SendGrid Docs](https://sendgrid.com/docs/API_Reference/index.html) +- [Generic Library Usage Documentation](https://github.com/sendgrid/sendgrid-php/tree/master/USAGE.md) -- [Example Code](https://github.com/sendgrid/sendgrid-php/tree/master/examples) -- [How-to: Migration from v2 to v3](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/how_to_migrate_from_v2_to_v3_mail_send.html) -- [v3 Web API Mail Send Helper](https://github.com/sendgrid/sendgrid-php/tree/master/lib/helpers/mail/README.md) - build a request object payload for a v3 /mail/send API call. - - -# Use Cases - -[Examples of common API use cases](https://github.com/sendgrid/sendgrid-php/blob/master/USE_CASES.md), such as how to send an email with a transactional template. +- [Example Code](https://github.com/sendgrid/sendgrid-php/blob/master/USE_CASES.md) # Announcements -Please see our announcement regarding [breaking changes](https://github.com/sendgrid/sendgrid-php/issues/290). Your support is appreciated! +v7 has been released! Please see the [release notes](https://github.com/sendgrid/sendgrid-php/releases/tag/v7.0.0) for details. -All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/sendgrid-php/blob/master/CHANGELOG.md) and [releases](https://github.com/sendgrid/sendgrid-php/releases) +All updates to this library are documented in our [CHANGELOG](https://github.com/sendgrid/sendgrid-php/blob/master/CHANGELOG.md) and [releases](https://github.com/sendgrid/sendgrid-php/releases). You may also subscribe to email [release notifications](https://dx.sendgrid.com/newsletter/php) for releases and breaking changes. # Roadmap @@ -220,6 +213,7 @@ Quick links: - [Bug Reports](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#submit_a_bug_report) - [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#cla) - [Improvements to the Codebase](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#improvements_to_the_codebase) +- [Review Pull Requests](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#code-reviews) # Troubleshooting @@ -229,9 +223,10 @@ Please see our [troubleshooting guide](https://github.com/sendgrid/sendgrid-php/ # About -sendgrid-php is guided and supported by the SendGrid [Developer Experience Team](mailto:dx@sendgrid.com). +sendgrid-php is guided and supported by the Twilio [Developer Experience Team](mailto:dx@sendgrid.com). -sendgrid-php is maintained and funded by SendGrid, Inc. The names and logos for sendgrid-php are trademarks of SendGrid, Inc. +sendgrid-php is maintained and funded by Twilio SendGrid, Inc. The names and logos for sendgrid-php are trademarks of Twilio SendGrid, Inc. -![SendGrid Logo](https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png) +# License +[The MIT License (MIT)](LICENSE.txt) diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/composer.json b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/composer.json index 2e2a398..d7dea0e 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/composer.json +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/composer.json @@ -1,23 +1,47 @@ { "name": "sendgrid/sendgrid", - "description": "This library allows you to quickly and easily send emails through SendGrid using PHP.", - "version": "6.0.0", + "description": "This library allows you to quickly and easily send emails through Twilio SendGrid using PHP.", + "version": "7.3.0", "homepage": "http://github.com/sendgrid/sendgrid-php", "license": "MIT", - "keywords": ["SendGrid", "sendgrid", "email", "send", "grid"], + "keywords": [ + "SendGrid", + "sendgrid", + "Twilio SendGrid", + "twilio sendgrid", + "email", + "send", + "grid" + ], "require": { "php": ">=5.6", - "sendgrid/php-http-client": "~3.7" + "sendgrid/php-http-client": "~3.9", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "ext-openssl": "*" }, "require-dev": { - "phpunit/phpunit": "4.*", - "squizlabs/php_codesniffer": "2.*" + "phpunit/phpunit": "^5.7.9 || ^6.4.3", + "squizlabs/php_codesniffer": "3.*", + "swaggest/json-diff": "^3.4" }, "replace": { "sendgrid/sendgrid-php": "*" }, "type": "library", "autoload": { - "files": ["lib/SendGrid.php", "lib/helpers/mail/Mail.php"] + "psr-4": { + "SendGrid\\": "lib/", + "SendGrid\\Mail\\": "lib/mail/", + "SendGrid\\Contacts\\": "lib/contacts/", + "SendGrid\\Stats\\": "lib/stats/" + }, + "files": ["lib/SendGrid.php"] + }, + "autoload-dev": { + "psr-4": { + "SendGrid\\Tests\\": "test/" + } } -} \ No newline at end of file +} diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/SendGrid.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/SendGrid.php index 0bda1b5..08ee1d6 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/SendGrid.php +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/SendGrid.php @@ -1,43 +1,42 @@ - * @copyright 2017 SendGrid - * @license https://opensource.org/licenses/MIT The MIT License - * @version GIT: - * @link http://packagist.org/packages/sendgrid/sendgrid - */ + * This library allows you to quickly and easily send emails through + * Twilio SendGrid using PHP. + * + * PHP Version - 5.6, 7.0, 7.1, 7.2 + * + * @package SendGrid\Tests + * @author Elmer Thomas + * @copyright 2018-19 Twilio SendGrid + * @license https://opensource.org/licenses/MIT The MIT License + * @version GIT: + * @link http://packagist.org/packages/sendgrid/sendgrid + */ /** - * Interface to the SendGrid Web API - */ + * This class is the interface to the Twilio SendGrid Web API + * + * @package SendGrid\Mail + */ class SendGrid { - const VERSION = '6.0.0'; + const VERSION = '7.3.0'; - /** - * - * @var string - */ + // @var string protected $namespace = 'SendGrid'; - /** - * @var \SendGrid\Client - */ + // @var \SendGrid\Client public $client; - - /** - * @var string - */ + // @var string public $version = self::VERSION; /** - * Setup the HTTP Client - * - * @param string $apiKey your SendGrid API Key. - * @param array $options an array of options, currently only "host" and "curl" are implemented. - */ + * Setup the HTTP Client + * + * @param string $apiKey Your Twilio SendGrid API Key. + * @param array $options An array of options, currently only "host", "curl" and + * "impersonateSubuser" are implemented. + */ public function __construct($apiKey, $options = array()) { $headers = array( @@ -46,10 +45,33 @@ class SendGrid 'Accept: application/json' ); - $host = isset($options['host']) ? $options['host'] : 'https://api.sendgrid.com'; + $host = isset($options['host']) ? $options['host'] : + 'https://api.sendgrid.com'; + + if (!empty($options['impersonateSubuser'])) { + $headers[] = 'On-Behalf-Of: '. $options['impersonateSubuser']; + } $curlOptions = isset($options['curl']) ? $options['curl'] : null; - $this->client = new \SendGrid\Client($host, $headers, '/v3', null, $curlOptions); + $this->client = new \SendGrid\Client( + $host, + $headers, + '/v3', + null, + $curlOptions + ); + } + + /** + * Make an API request + * + * @param \SendGrid\Mail\Mail $email A Mail object, containing the request object + * + * @return \SendGrid\Response + */ + public function send(\SendGrid\Mail\Mail $email) + { + return $this->client->mail()->send()->post($email); } } diff --git a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/loader.php b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/loader.php index ed17dfe..9e6a749 100644 --- a/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/loader.php +++ b/Postman/Postman-Mail/sendgrid/vendor/sendgrid/sendgrid/lib/loader.php @@ -1,6 +1,54 @@ + * @copyright 2018-19 Twilio SendGrid + * @license https://opensource.org/licenses/MIT The MIT License + * @version GIT: + * @link http://packagist.org/packages/sendgrid/sendgrid */ require_once __DIR__ . '/SendGrid.php'; -require_once __DIR__ . '/helpers/mail/Mail.php'; +require_once __DIR__ . '/contacts/Recipient.php'; +require_once __DIR__ . '/contacts/RecipientForm.php'; +require_once __DIR__ . '/mail/EmailAddress.php'; +require_once __DIR__ . '/mail/Asm.php'; +require_once __DIR__ . '/mail/Attachment.php'; +require_once __DIR__ . '/mail/BatchId.php'; +require_once __DIR__ . '/mail/Bcc.php'; +require_once __DIR__ . '/mail/BccSettings.php'; +require_once __DIR__ . '/mail/BypassListManagement.php'; +require_once __DIR__ . '/mail/Category.php'; +require_once __DIR__ . '/mail/Cc.php'; +require_once __DIR__ . '/mail/ClickTracking.php'; +require_once __DIR__ . '/mail/Content.php'; +require_once __DIR__ . '/mail/CustomArg.php'; +require_once __DIR__ . '/mail/Footer.php'; +require_once __DIR__ . '/mail/From.php'; +require_once __DIR__ . '/mail/Ganalytics.php'; +require_once __DIR__ . '/mail/GroupId.php'; +require_once __DIR__ . '/mail/GroupsToDisplay.php'; +require_once __DIR__ . '/mail/Header.php'; +require_once __DIR__ . '/mail/HtmlContent.php'; +require_once __DIR__ . '/mail/IpPoolName.php'; +require_once __DIR__ . '/mail/Mail.php'; +require_once __DIR__ . '/mail/MailSettings.php'; +require_once __DIR__ . '/mail/MimeType.php'; +require_once __DIR__ . '/mail/OpenTracking.php'; +require_once __DIR__ . '/mail/Personalization.php'; +require_once __DIR__ . '/mail/PlainTextContent.php'; +require_once __DIR__ . '/mail/ReplyTo.php'; +require_once __DIR__ . '/mail/Section.php'; +require_once __DIR__ . '/mail/SandBoxMode.php'; +require_once __DIR__ . '/mail/SendAt.php'; +require_once __DIR__ . '/mail/SpamCheck.php'; +require_once __DIR__ . '/mail/Subject.php'; +require_once __DIR__ . '/mail/SubscriptionTracking.php'; +require_once __DIR__ . '/mail/Substitution.php'; +require_once __DIR__ . '/mail/TemplateId.php'; +require_once __DIR__ . '/mail/TrackingSettings.php'; +require_once __DIR__ . '/mail/To.php'; +require_once __DIR__ . '/stats/Stats.php'; diff --git a/Postman/Postman-Send-Test-Email/PostmanSendTestEmailController.php b/Postman/Postman-Send-Test-Email/PostmanSendTestEmailController.php index 55b7d49..b569c98 100644 --- a/Postman/Postman-Send-Test-Email/PostmanSendTestEmailController.php +++ b/Postman/Postman-Send-Test-Email/PostmanSendTestEmailController.php @@ -13,7 +13,7 @@ class PostmanSendTestEmailController { /** * Constructor * - * @param unknown $rootPluginFilenameAndPath + * @param mixed $rootPluginFilenameAndPath */ public function __construct( $rootPluginFilenameAndPath ) { assert( ! empty( $rootPluginFilenameAndPath ) ); @@ -90,7 +90,7 @@ class PostmanSendTestEmailController { * Register the Email Test screen */ public function addEmailTestSubmenu() { - $page = add_submenu_page( null, sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ) ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanSendTestEmailController::EMAIL_TEST_SLUG, array( + $page = add_submenu_page( null, sprintf( __( '%s Setup', 'post-smtp' ), __( 'Postman SMTP', 'post-smtp' ) ), __( 'Postman SMTP', 'post-smtp' ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanSendTestEmailController::EMAIL_TEST_SLUG, array( $this, 'outputTestEmailContent', ) ); @@ -110,11 +110,11 @@ class PostmanSendTestEmailController { wp_enqueue_script( 'postman_test_email_wizard_script' ); wp_localize_script( PostmanViewController::POSTMAN_SCRIPT, 'postman_email_test', array( 'recipient' => '#' . self::RECIPIENT_EMAIL_FIELD_NAME, - 'not_started' => _x( 'In Outbox', 'Email Test Status', Postman::TEXT_DOMAIN ), - 'sending' => _x( 'Sending...', 'Email Test Status', Postman::TEXT_DOMAIN ), - 'success' => _x( 'Success', 'Email Test Status', Postman::TEXT_DOMAIN ), - 'failed' => _x( 'Failed', 'Email Test Status', Postman::TEXT_DOMAIN ), - 'ajax_error' => __( 'Ajax Error', Postman::TEXT_DOMAIN ), + 'not_started' => _x( 'In Outbox', 'Email Test Status', 'post-smtp' ), + 'sending' => _x( 'Sending...', 'Email Test Status', 'post-smtp' ), + 'success' => _x( 'Success', 'Email Test Status', 'post-smtp' ), + 'failed' => _x( 'Failed', 'Email Test Status', 'post-smtp' ), + 'ajax_error' => __( 'Ajax Error', 'post-smtp' ), ) ); } @@ -123,42 +123,42 @@ class PostmanSendTestEmailController { public function outputTestEmailContent() { print '
'; - PostmanViewController::outputChildPageHeader( __( 'Send a Test Email', Postman::TEXT_DOMAIN ) ); + PostmanViewController::outputChildPageHeader( __( 'Send a Test Email', 'post-smtp' ) ); printf( '
', PostmanUtils::getSettingsPageUrl() ); // Step 1 - printf( '
%s
', __( 'Specify the Recipient', Postman::TEXT_DOMAIN ) ); + printf( '
%s
', __( 'Specify the Recipient', 'post-smtp' ) ); print '
'; - printf( '%s', __( 'Who is this message going to?', Postman::TEXT_DOMAIN ) ); - printf( '

%s', __( 'This utility allows you to send an email message for testing.', Postman::TEXT_DOMAIN ) ); + printf( '%s', __( 'Who is this message going to?', 'post-smtp' ) ); + printf( '

%s', __( 'This utility allows you to send an email message for testing.', 'post-smtp' ) ); print ' '; /* translators: where %d is an amount of time, in seconds */ - printf( '%s

', sprintf( _n( 'If there is a problem, Postman will give up after %d second.', 'If there is a problem, Postman will give up after %d seconds.', $this->options->getReadTimeout(), Postman::TEXT_DOMAIN ), $this->options->getReadTimeout() ) ); - printf( '', _x( 'Recipient Email Address', 'Configuration Input Field', Postman::TEXT_DOMAIN ) ); + printf( '%s

', sprintf( _n( 'If there is a problem, Postman will give up after %d second.', 'If there is a problem, Postman will give up after %d seconds.', $this->options->getReadTimeout(), 'post-smtp' ), $this->options->getReadTimeout() ) ); + printf( '', _x( 'Recipient Email Address', 'Configuration Input Field', 'post-smtp' ) ); print $this->test_email_callback(); print '
'; // Step 2 - printf( '
%s
', __( 'Send The Message', Postman::TEXT_DOMAIN ) ); + printf( '
%s
', __( 'Send The Message', 'post-smtp' ) ); print '
'; print ''; - print __( 'Sending the message:', Postman::TEXT_DOMAIN ); - printf( ' %s', _x( 'In Outbox', 'Email Test Status', Postman::TEXT_DOMAIN ) ); + print __( 'Sending the message:', 'post-smtp' ); + printf( ' %s', _x( 'In Outbox', 'Email Test Status', 'post-smtp' ) ); print ''; print '
'; - printf( '

', __( 'Status', Postman::TEXT_DOMAIN ) ); + printf( '

', __( 'Status', 'post-smtp' ) ); print ''; print '
'; print '
'; // Step 3 - printf( '
%s
', __( 'Session Transcript', Postman::TEXT_DOMAIN ) ); + printf( '
%s
', __( 'Session Transcript', 'post-smtp' ) ); print '
'; - printf( '%s', __( 'Examine the Session Transcript if you need to.', Postman::TEXT_DOMAIN ) ); - printf( '

%s

', __( 'This is the conversation between Postman and the mail server. It can be useful for diagnosing problems. DO NOT post it on-line, it may contain your account password.', Postman::TEXT_DOMAIN ) ); + printf( '%s', __( 'Examine the Session Transcript if you need to.', 'post-smtp' ) ); + printf( '

%s

', __( 'This is the conversation between Postman and the mail server. It can be useful for diagnosing problems. DO NOT post it on-line, it may contain your account password.', 'post-smtp' ) ); print '
'; - printf( '

', __( 'Session Transcript', Postman::TEXT_DOMAIN ) ); + printf( '

', __( 'Session Transcript', 'post-smtp' ) ); print ''; print '
'; print '
'; @@ -206,7 +206,7 @@ class PostmanSendTestEmailAjaxController extends PostmanAbstractAjaxHandler { $serverName = PostmanUtils::postmanGetServerName(); /* translators: where %s is the domain name of the site */ - $subject = sprintf( _x( 'Postman SMTP Test (%s)', 'Test Email Subject', Postman::TEXT_DOMAIN ), $serverName ); + $subject = sprintf( _x( 'Postman SMTP Test (%s)', 'Test Email Subject', 'post-smtp' ), $serverName ); // Postman API: indicate to Postman this is just for testing add_filter( 'postman_test_email', array( @@ -236,7 +236,7 @@ class PostmanSendTestEmailAjaxController extends PostmanAbstractAjaxHandler { if ( $success ) { $this->logger->debug( 'Test Email delivered to server' ); // the message was sent successfully, generate an appropriate message for the user - $statusMessage = sprintf( __( 'Your message was delivered (%d ms) to the SMTP server! Congratulations :)', Postman::TEXT_DOMAIN ), $result ['time'] ); + $statusMessage = sprintf( __( 'Your message was delivered (%d ms) to the SMTP server! Congratulations :)', 'post-smtp' ), $result ['time'] ); $this->logger->debug( 'statusmessage: ' . $statusMessage ); @@ -292,9 +292,9 @@ class PostmanSendTestEmailAjaxController extends PostmanAbstractAjaxHandler { // English - Mandarin - French - Hindi - Spanish - Portuguese - Russian - Japanese // http://www.pinyin.info/tools/converter/chars2uninumbers.html $greeting = 'Hello! - 你好 - Bonjour! - नमस्ते - ¡Hola! - Olá - Привет! - 今日は'; - $sentBy = sprintf( _x( 'Sent by Postman %s', 'Test Email Tagline', Postman::TEXT_DOMAIN ), $pluginData ['version'] ); - $imageSource = __( 'Image source', Postman::TEXT_DOMAIN ); - $withPermission = __( 'Used with permission', Postman::TEXT_DOMAIN ); + $sentBy = sprintf( _x( 'Sent by Postman %s', 'Test Email Tagline', 'post-smtp' ), $pluginData ['version'] ); + $imageSource = __( 'Image source', 'post-smtp' ); + $withPermission = __( 'Used with permission', 'post-smtp' ); $messageArray = array( 'Content-Type: text/plain; charset = "UTF-8"', 'Content-Transfer-Encoding: 8bit', diff --git a/Postman/Postman.php b/Postman/Postman.php index b0f70e0..1610da5 100644 --- a/Postman/Postman.php +++ b/Postman/Postman.php @@ -19,6 +19,14 @@ class Postman { const ADMINISTRATOR_ROLE_NAME = 'administrator'; const MANAGE_POSTMAN_CAPABILITY_NAME = 'manage_postman_smtp'; const MANAGE_POSTMAN_CAPABILITY_LOGS = 'manage_postman_logs'; + + /** + * Use the text domain directly instead of this constant, as it + * causes issues with https://translate.wordpress.org. + * + * @deprecated + * @see https://github.com/yehudah/Post-SMTP/issues/1#issuecomment-421940923 + */ const TEXT_DOMAIN = 'post-smtp'; private $logger; @@ -30,7 +38,7 @@ class Postman { /** * The constructor * - * @param unknown $rootPluginFilenameAndPath + * @param mixed $rootPluginFilenameAndPath * - the __FILE__ of the caller */ public function __construct( $rootPluginFilenameAndPath, $version ) { @@ -56,11 +64,12 @@ class Postman { require_once 'Postman-Email-Log/PostmanEmailLogPostType.php'; require_once 'Postman-Mail/PostmanMyMailConnector.php'; require_once 'Postman-Mail/PostmanContactForm7.php'; + require_once 'Phpmailer/PostsmtpMailer.php'; //require_once 'Postman-Mail/PostmanWooCommerce.php'; // get plugin metadata - alternative to get_plugin_data $this->pluginData = array( - 'name' => __( 'Postman SMTP', Postman::TEXT_DOMAIN ), + 'name' => __( 'Postman SMTP', 'post-smtp' ), 'version' => $version, ); @@ -83,13 +92,21 @@ class Postman { // register the email transports $this->registerTransports( $rootPluginFilenameAndPath ); - // store an instance of the WpMailBinder - $this->wpMailBinder = PostmanWpMailBinder::getInstance(); + // store an instance of the WpMailBinder + $this->wpMailBinder = PostmanWpMailBinder::getInstance(); - // bind to wp_mail - this has to happen before the "init" action - // this design allows other plugins to register a Postman transport and call bind() - // bind may be called more than once - $this->wpMailBinder->bind(); + $mailer = PostmanOptions::getInstance()->getSmtpMailer(); + $this->logger->trace( 'SMTP Mailer: ' . $mailer ); + + if ( $mailer && $mailer !== 'phpmailer') { + + // bind to wp_mail - this has to happen before the "init" action + // this design allows other plugins to register a Postman transport and call bind() + // bind may be called more than once + $this->wpMailBinder->bind(); + } else { + PostmanWpMailBinder::getInstance()->bound = true; + } // registers the custom post type for all callers PostmanEmailLogPostType::automaticallyCreatePostType(); @@ -163,9 +180,9 @@ class Postman { public function post_smtp_wpml_admin_notice() { $class = 'notice notice-error'; - $title = __( 'Post SMTP notice!', Postman::TEXT_DOMAIN ); - $intro = __( 'WPML is installed and has a known bug with Post SMTP and few other plugins - you better upgrade, but we can try to fix it.', Postman::TEXT_DOMAIN ); - $text = __( 'Click here to fix', Postman::TEXT_DOMAIN ); + $title = __( 'Post SMTP notice!', 'post-smtp' ); + $intro = __( 'WPML is installed and has a known bug with Post SMTP and few other plugins - you better upgrade, but we can try to fix it.', 'post-smtp' ); + $text = __( 'Click here to fix', 'post-smtp' ); $message = '
' . $text . ''; printf( '

%2$s

%3$s

%4$s

', esc_attr( $class ), $title, $intro, $message ); @@ -305,7 +322,8 @@ class Postman { // I've adopted their error message as well, for shits and giggles .... :D $reflFunc = new ReflectionFunction( 'wp_mail' ); - $message = __( 'Postman: wp_mail has been declared by another plugin or theme, so you won\'t be able to use Postman until the conflict is resolved.', Postman::TEXT_DOMAIN ); + $message = __( 'Postman: wp_mail has been declared by another plugin or theme, so you won\'t be able to use Postman until the conflict is resolved.', 'post-smtp' ); + $plugin_full_path = $reflFunc->getFileName(); if ( strpos( $plugin_full_path, 'plugins' ) !== false ) { @@ -323,6 +341,12 @@ class Postman { } $message .= '
More info that may help - ' . $reflFunc->getFileName() . ':' . $reflFunc->getStartLine(); + + // PHPmailer Recommandation + ob_start(); + Postman::getMailerTypeRecommend(); + $message .= ob_get_clean(); + $this->messageHandler->addError( $message ); } } else { @@ -359,6 +383,25 @@ class Postman { } } + public static function getMailerTypeRecommend() { + ?> +
+

Please notice

+

+ Mailer Type.', 'post-smtp' ); ?>
+ TEST Post SMTP with the value PHPMailer.', 'post-smtp' ); ?>
+ PostSMTP.', 'post-smtp' ); ?>
+ +

+ how to set mailer type +
+
+ +

+
+ getReadyMessage(); $message = sprintf( $msg['message'] ); - $goToSettings = sprintf( '%s', PostmanUtils::getSettingsPageUrl(), __( 'Settings', Postman::TEXT_DOMAIN ) ); - $goToEmailLog = sprintf( '%s', _x( 'Email Log', 'The log of Emails that have been delivered', Postman::TEXT_DOMAIN ) ); + $goToSettings = sprintf( '%s', PostmanUtils::getSettingsPageUrl(), __( 'Settings', 'post-smtp' ) ); + $goToEmailLog = sprintf( '%s', _x( 'Email Log', 'The log of Emails that have been delivered', 'post-smtp' ) ); if ( PostmanOptions::getInstance()->isMailLoggingEnabled() ) { $goToEmailLog = sprintf( '%s', PostmanUtils::getEmailLogPageUrl(), $goToEmailLog ); } @@ -404,15 +447,19 @@ class Postman { * The Gmail API used to be a separate plugin which was registered when that plugin * was loaded. But now both the SMTP, Gmail API and other transports are registered here. * - * @param unknown $pluginData + * @param mixed $pluginData */ private function registerTransports( $rootPluginFilenameAndPath ) { - PostmanTransportRegistry::getInstance()->registerTransport( new PostmanDefaultModuleTransport( $rootPluginFilenameAndPath ) ); - PostmanTransportRegistry::getInstance()->registerTransport( new PostmanSmtpModuleTransport( $rootPluginFilenameAndPath ) ); - PostmanTransportRegistry::getInstance()->registerTransport( new PostmanGmailApiModuleTransport( $rootPluginFilenameAndPath ) ); - PostmanTransportRegistry::getInstance()->registerTransport( new PostmanMandrillTransport( $rootPluginFilenameAndPath ) ); - PostmanTransportRegistry::getInstance()->registerTransport( new PostmanSendGridTransport( $rootPluginFilenameAndPath ) ); - PostmanTransportRegistry::getInstance()->registerTransport( new PostmanMailgunTransport( $rootPluginFilenameAndPath ) ); + $postman_transport_registry = PostmanTransportRegistry::getInstance(); + + $postman_transport_registry->registerTransport( new PostmanDefaultModuleTransport( $rootPluginFilenameAndPath ) ); + $postman_transport_registry->registerTransport( new PostmanSmtpModuleTransport( $rootPluginFilenameAndPath ) ); + $postman_transport_registry->registerTransport( new PostmanGmailApiModuleTransport( $rootPluginFilenameAndPath ) ); + $postman_transport_registry->registerTransport( new PostmanMandrillTransport( $rootPluginFilenameAndPath ) ); + $postman_transport_registry->registerTransport( new PostmanSendGridTransport( $rootPluginFilenameAndPath ) ); + $postman_transport_registry->registerTransport( new PostmanMailgunTransport( $rootPluginFilenameAndPath ) ); + + do_action( 'postsmtp_register_transport', $postman_transport_registry ); } /** @@ -433,12 +480,12 @@ class Postman { $shortLocale = substr( get_locale(), 0, 2 ); if ( $shortLocale != 'en' ) { $langDir = 'post-smtp/Postman/languages'; - $success = load_plugin_textdomain( Postman::TEXT_DOMAIN, false, $langDir ); + $success = load_plugin_textdomain( 'post-smtp', false, $langDir ); if ( $this->logger->isDebug() ) { if ( $success ) { $this->logger->debug( sprintf( 'local translation file loaded for locale=%s', get_locale() ) ); } else { - $this->logger->debug( sprintf( 'failed to load local translation file: locale=%s file=%s/%s-%s.mo', get_locale(), $langDir, Postman::TEXT_DOMAIN, get_locale() ) ); + $this->logger->debug( sprintf( 'failed to load local translation file: locale=%s file=%s/%s-%s.mo', get_locale(), $langDir, 'post-smtp', get_locale() ) ); } } } @@ -460,7 +507,7 @@ if ( ! function_exists( 'str_getcsv' ) ) { /** * PHP version less than 5.3 don't have str_getcsv natively. * - * @param unknown $string + * @param mixed $string * @return multitype: */ function str_getcsv( $string ) { diff --git a/Postman/PostmanAdminController.php b/Postman/PostmanAdminController.php index f85e30c..f92bc2c 100644 --- a/Postman/PostmanAdminController.php +++ b/Postman/PostmanAdminController.php @@ -78,7 +78,7 @@ if ( ! class_exists( 'PostmanAdminController' ) ) { /** * Constructor * - * @param unknown $rootPluginFilenameAndPath + * @param mixed $rootPluginFilenameAndPath * @param PostmanOptions $options * @param PostmanOAuthToken $authorizationToken * @param PostmanMessageHandler $messageHandler @@ -111,7 +111,7 @@ if ( ! class_exists( 'PostmanAdminController' ) ) { // do a redirect on the init hook $this->registerInitFunction( 'handleSuccessfulSave' ); // add a saved message to be shown after the redirect - $this->messageHandler->addMessage( _x( 'Settings saved.', 'The plugin successfully saved new settings.', Postman::TEXT_DOMAIN ) ); + $this->messageHandler->addMessage( _x( 'Settings saved.', 'The plugin successfully saved new settings.', 'post-smtp' ) ); return; } else { // unset the action in the failed case as well @@ -162,11 +162,11 @@ if ( ! class_exists( 'PostmanAdminController' ) ) { ?> -

+