/** * Create the function to output the contents of our Dashboard Widget. */ public function printDashboardWidget() { $goToSettings = sprintf('<a href="%s">%s</a>', PostmanUtils::getSettingsPageUrl(), __('Settings', Postman::TEXT_DOMAIN)); $goToEmailLog = sprintf('%s', _x('Email Log', 'The log of Emails that have been delivered', Postman::TEXT_DOMAIN)); if ($this->options->isMailLoggingEnabled()) { $goToEmailLog = sprintf('<a href="%s">%s</a>', PostmanUtils::getEmailLogPageUrl(), $goToEmailLog); } apply_filters('print_postman_status', null); printf('<p>%s | %s</p>', $goToEmailLog, $goToSettings); }
/** * This is the general message that Postman requires configuration, to warn users who think * the plugin is ready-to-go as soon as it is activated. * This message only goes away once * the plugin is configured. */ public function display_configuration_required_warning() { $this->logger->debug('Displaying configuration required warning'); $message = sprintf(__('WordPress is still handling email delivery, <em>not</em> Postman.', 'postman-smtp')); $message .= ' '; /* translators: where %s is the URL to the Postman Setup page */ $message .= sprintf(__('<a href="%s">Configure</a> the plugin.', 'postman-smtp'), PostmanUtils::getSettingsPageUrl()); $this->messageHandler->printMessage($message, PostmanMessageHandler::WARNING_CLASS); }
/** * Add "Settings" link to the plugin action page * * @param unknown $links * @return multitype: */ public function postmanModifyLinksOnPluginsListPage($links) { // only administrators should be able to trigger this if (PostmanUtils::isAdmin()) { $mylinks = array(sprintf('<a href="%s" class="postman_settings">%s</a>', PostmanUtils::getSettingsPageUrl(), _x('Settings', 'The configuration page of the plugin', 'postman-smtp'))); return array_merge($mylinks, $links); } }
/** */ public function outputTestEmailWizardContent() { print '<div class="wrap">'; $this->outputChildPageHeader(__('Send a Test Email', 'postman-smtp')); printf('<form id="postman_test_email_wizard" method="post" action="%s">', PostmanUtils::getSettingsPageUrl()); // Step 1 printf('<h5>%s</h5>', __('Specify the Recipient', 'postman-smtp')); print '<fieldset>'; printf('<legend>%s</legend>', __('Who is this message going to?', 'postman-smtp')); printf('<p>%s', __('This utility allows you to send an email message for testing.', 'postman-smtp')); print ' '; /* translators: where %d is an amount of time, in seconds */ printf('%s</p>', 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-smtp'), $this->options->getReadTimeout())); printf('<label for="postman_test_options[test_email]">%s</label>', _x('Recipient Email Address', 'Configuration Input Field', 'postman-smtp')); print $this->adminController->test_email_callback(); print '</fieldset>'; // Step 2 printf('<h5>%s</h5>', __('Send The Message', 'postman-smtp')); print '<fieldset>'; print '<legend>'; print __('Sending the message:', 'postman-smtp'); printf(' <span id="postman_test_message_status">%s</span>', _x('In Outbox', 'Email Test Status', 'postman-smtp')); print '</legend>'; print '<section>'; printf('<p><label>%s</label></p>', _x('Status', 'Was sending this email successful or not?', 'postman-smtp')); print '<textarea id="postman_test_message_error_message" readonly="readonly" cols="65" rows="4"></textarea>'; print '</section>'; print '</fieldset>'; // Step 3 printf('<h5>%s</h5>', __('Session Transcript', 'postman-smtp')); print '<fieldset>'; printf('<legend>%s</legend>', __('Examine the SMTP Session Transcript if you need to.', 'postman-smtp')); printf('<p>%s</p>', __('This is the conversation between Postman and your SMTP server. It can be useful for diagnosing problems. <b>DO NOT</b> post it on-line, it may contain your account password.', 'postman-smtp')); print '<section>'; printf('<p><label for="postman_test_message_transcript">%s</label></p>', __('SMTP Session Transcript', 'postman-smtp')); print '<textarea readonly="readonly" id="postman_test_message_transcript" cols="65" rows="8"></textarea>'; print '</section>'; print '</fieldset>'; print '</form>'; print '</div>'; }
/** * This is the general message that Postman requires configuration, to warn users who think * the plugin is ready-to-go as soon as it is activated. * This message only goes away once the plugin is configured. */ public function display_configuration_required_warning() { if (PostmanUtils::isAdmin()) { if ($this->logger->isDebug()) { $this->logger->debug('Displaying configuration required warning'); } $message = sprintf(PostmanTransportRegistry::getInstance()->getReadyMessage()); $goToSettings = sprintf('<a href="%s">%s</a>', PostmanUtils::getSettingsPageUrl(), __('Settings', Postman::TEXT_DOMAIN)); $goToEmailLog = sprintf('%s', _x('Email Log', 'The log of Emails that have been delivered', Postman::TEXT_DOMAIN)); if (PostmanOptions::getInstance()->isMailLoggingEnabled()) { $goToEmailLog = sprintf('<a href="%s">%s</a>', PostmanUtils::getEmailLogPageUrl(), $goToEmailLog); } $message .= sprintf(' %s | %s', $goToEmailLog, $goToSettings); $this->messageHandler->printMessage($message, PostmanMessageHandler::WARNING_CLASS); } }
/** * Add "Settings" link to the plugin action page * * @param unknown $links * @return multitype: */ public function postmanModifyLinksOnPluginsListPage($links) { // only administrators should be able to trigger this if (PostmanUtils::isAdmin()) { $mylinks = array(sprintf('<a href="%s" class="postman_settings">%s</a>', PostmanUtils::getSettingsPageUrl(), __('Settings', Postman::TEXT_DOMAIN))); return array_merge($mylinks, $links); } }
/** * Print the human-readable plugin state */ public function print_postman_status() { if (!PostmanPreRequisitesCheck::isReady()) { printf('<p><span style="color:red">%s</span></p>', __('Error: Postman is missing a required PHP library.', 'postman-smtp')); } else { if ($this->wpMailBinder->isUnboundDueToException()) { printf('<p><span style="color:red">%s</span></p>', __('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-smtp')); } else { if ($this->options->getRunMode() != PostmanOptions::RUN_MODE_PRODUCTION) { printf('<p><span style="background-color:yellow">%s</span></p>', __('Postman is in <em>non-Production</em> mode and is dumping all emails.', 'postman-smtp')); } else { if (PostmanTransportRegistry::getInstance()->isPostmanReadyToSendEmail($this->options, $this->authorizationToken)) { printf('<p class="wp-menu-image dashicons-before dashicons-email"> %s </p>', sprintf(_n('<span style="color:green">Postman is configured</span> and has delivered <span style="color:green">%d</span> email.', '<span style="color:green">Postman is configured</span> and has delivered <span style="color:green">%d</span> emails.', PostmanStats::getInstance()->getSuccessfulDeliveries(), 'postman-smtp'), PostmanStats::getInstance()->getSuccessfulDeliveries())); $currentTransport = PostmanTransportRegistry::getInstance()->getCurrentTransport(); $deliveryDetails = $currentTransport->getDeliveryDetails($this->options); printf('<p>%s</p>', $deliveryDetails); } else { printf('<p><span>%s %s</span></p>', __('Postman is <em>not</em> handling email delivery.', 'postman-smtp'), sprintf(__('<a href="%s">Configure</a> the plugin.', 'postman-smtp'), PostmanUtils::getSettingsPageUrl())); } } } } }
/** * * @param unknown $title * @param string $slug */ public static function outputChildPageHeader($title, $slug = '') { printf('<h2>%s</h2>', sprintf(__('%s Setup', Postman::TEXT_DOMAIN), __('Postman SMTP', Postman::TEXT_DOMAIN))); printf('<div id="postman-main-menu" class="welcome-panel %s">', $slug); print '<div class="welcome-panel-content">'; print '<div class="welcome-panel-column-container">'; print '<div class="welcome-panel-column welcome-panel-last">'; printf('<h4>%s</h4>', $title); print '</div>'; printf('<p id="back_to_main_menu">%s <a id="back_to_menu_link" href="%s">%s</a></p>', self::BACK_ARROW_SYMBOL, PostmanUtils::getSettingsPageUrl(), _x('Back To Main Menu', 'Return to main menu link', Postman::TEXT_DOMAIN)); print '</div></div></div>'; }