コード例 #1
0
 /**
  * Returns the HTML for success or error messages
  *
  * @return string
  */
 public function get_response_html()
 {
     // get all form messages
     $messages = $this->form->get_messages();
     // retrieve correct message
     $message = isset($messages[$this->message_type]) ? $messages[$this->message_type] : $messages['error'];
     // replace variables in message text
     $message['text'] = MC4WP_Tools::replace_variables($message['text'], array(), array_values($this->get_lists()));
     $html = '<div class="mc4wp-alert mc4wp-' . esc_attr($message['type']) . '">' . $message['text'] . '</div>';
     // show additional MailChimp API errors to administrators
     if (!$this->success && current_user_can('manage_options')) {
         if ('' !== $this->mailchimp_error) {
             $html .= '<div class="mc4wp-alert mc4wp-error"><strong>Admin notice:</strong> ' . $this->mailchimp_error . '</div>';
         }
     }
     return $html;
 }
コード例 #2
0
 /**
  * Returns the HTML for success or error messages
  *
  * @return string
  */
 public function get_response_html()
 {
     // get all form messages
     $messages = $this->form->get_messages();
     // retrieve correct message
     $message = isset($messages[$this->status]) ? $messages[$this->status] : $messages['error'];
     // replace variables in message text
     $message['text'] = MC4WP_Tools::replace_variables($message['text'], array(), array_values($this->get_lists()));
     $html = '<div class="mc4wp-alert mc4wp-' . esc_attr($message['type']) . '">' . $message['text'] . '</div>';
     // show additional MailChimp API errors to administrators
     if (!$this->success && current_user_can('manage_options')) {
         if (!empty($this->responses[0]->error)) {
             $html .= '<div class="mc4wp-alert mc4wp-error">';
             $html .= $this->responses[0]->error;
             $html .= '<br /><small>' . __('This message is only visible to logged-in administrators.', 'mailchimp-for-wp') . '</small>';
             $html .= '</div>';
         }
     }
     return $html;
 }