/** * @param WP_Post $post */ public function display($post) { if (!$this->prompt_post) { $this->prompt_post = new Prompt_Post($post); } if ($post->ID != $this->prompt_post->id()) { return; } $sent = (bool) $this->prompt_post->sent_recipient_ids(); if ($sent) { echo html('h3', __('This was the text version sent to subscribers.', 'Postmatic')); } $text = $this->prompt_post->get_custom_text(); if (!$sent and $text and 'publish' != $post->post_status) { echo self::render_form($text); return; } if ('publish' != $post->post_status) { echo html('input type="button" class="button prompt-customize-text"', array('value' => __('Customize', 'Postmatic'))); } if (empty($text) and 'auto-draft' != $post->post_status) { $context = new Prompt_Post_Rendering_Context($post); $text = $context->get_the_text_content(); $context->reset(); } echo html('pre class="prompt-custom-text"', $text); echo html('div class="prompt-custom-text-upgrade"', sprintf(__('This post will be sent as a multipart message. We have automatically generated a plaintext version for older email clients. You can adjust it if you need to.', 'Postmatic'), Prompt_Enum_Urls::PREMIUM)); }
protected function set_post($post) { $this->post = $post; $prompt_post = new Prompt_Post($post); $this->recipient_ids = $prompt_post->recipient_ids(); $this->sent_recipient_ids = $prompt_post->sent_recipient_ids(); }