/** * */ public function sendTestMailAction() { if (!$this->_verifyNonce('psn-form-test-mail')) { $this->getAdminNotices()->persistError(__('Invalid access.', 'psn')); $this->_gotoIndex(); } $this->_email = new IfwPsn_Wp_Email(); $subject = sprintf(__('Test Email from %s', 'psn'), $this->_pm->getEnv()->getName()); $body = IfwPsn_Wp_Proxy_Filter::apply('psn_send_test_mail_body', sprintf(__('This is a test email generated by %s on %s (%s)', 'psn'), $this->_pm->getEnv()->getName(), IfwPsn_Wp_Proxy_Blog::getName(), IfwPsn_Wp_Proxy_Blog::getUrl()), $this->_email); switch (trim($this->_request->get('recipient'))) { case 'custom': $recipient = esc_attr($_POST['custom_recipient']); break; case 'admin': default: $recipient = IfwPsn_Wp_Proxy_Blog::getAdminEmail(); break; } $recipient = IfwPsn_Wp_Proxy_Filter::apply('psn_send_test_mail_recipient', $recipient); if (empty($recipient)) { $resultMsg = __('Invalid recipient.', 'psn') . ' ' . __('Test email could not be sent.', 'psn'); $this->getAdminNotices()->persistError($resultMsg); } else { $this->_email->setTo($recipient)->setSubject($subject)->setMessage($body); IfwPsn_Wp_Proxy_Action::doAction('psn_send_test_mail', $this->_email); if ($this->_email->send()) { // mail sent successfully $resultMsg = __('Test email has been sent successfully.', 'psn'); $this->getAdminNotices()->persistUpdated($resultMsg); IfwPsn_Wp_Proxy_Action::doAction('psn_send_test_mail_success', $this); } else { // email could not be sent $resultMsg = __('Test email could not be sent.', 'psn'); $this->getAdminNotices()->persistError($resultMsg); IfwPsn_Wp_Proxy_Action::doAction('psn_send_test_mail_failure', $this); } IfwPsn_Wp_Proxy_Action::doAction('psn_after_test_email_send', $this->_email); } $this->_gotoIndex(); }
/** * @return string|void */ protected function _getPlatform() { return IfwPsn_Wp_Proxy_Blog::getUrl(); }
/** * */ protected function _init() { parent::_init(); $this->setUrl($this->_pm->getConfig()->plugin->updateServer); $this->addData('api-key', md5(IfwPsn_Wp_Proxy_Blog::getUrl())); }
/** * @return IfwPsn_Wp_Http_Request */ protected function _getRequest() { if ($this->_request === null) { $this->_request = new IfwPsn_Wp_Http_Request(); $this->_request->setUrl($this->_pm->getConfig()->plugin->updateServer); $this->_request->addData('api-key', md5(IfwPsn_Wp_Proxy_Blog::getUrl())); $this->_request->addData('referrer', IfwPsn_Wp_Proxy_Blog::getUrl()); if (isset($_SERVER['HTTP_USER_AGENT'])) { $this->_request->addData('browser_user_agent', $_SERVER['HTTP_USER_AGENT']); } } return $this->_request; }