/** * Get text command from the message, if any. * * A blank message is treated as a subscribe command. * * @since 1.0.0 * @return string Text command if found, otherwise empty. */ protected function get_text_command() { $stripped_text = $this->get_message_text(); if (preg_match('/^\\s*$/', $stripped_text, $matches)) { return self::$subscribe_method; } $subscribe_matcher = new Prompt_Subscribe_Matcher($stripped_text); if ($subscribe_matcher->matches()) { return self::$subscribe_method; } $unsubscribe_matcher = new Prompt_Unsubscribe_Matcher($stripped_text); if ($unsubscribe_matcher->matches()) { return self::$unsubscribe_method; } return ''; }
/** * @since 2.0.0 * * @return array Two strings, HTML then text */ protected function footnote_content() { $html_parts = array(); $text_parts = array(); /* translators: %s is a subscription list title */ $why = sprintf(__('You received this email because you\'re subscribed to %s.', 'Postmatic'), '{{{subscribed_object_label}}}'); $html_parts[] = $why; $text_parts[] = $why; /** * Filter extra footnote content for post emails. * * @param array $content Two element array containing first HTML then text content. */ list($html_parts[], $text_parts[]) = apply_filters('prompt/post_email_batch/extra_footnote_content', array('', '')); /* translators: %s is the unsubscribe command word */ $unsub_format = __('To unsubscribe reply with the word \'%s\'.', 'Postmatic'); $html_parts[] = sprintf($unsub_format, "<a href=\"{$this->unsubscribe_mailto()}\">" . Prompt_Unsubscribe_Matcher::target() . '</a>'); $text_parts[] = sprintf($unsub_format, Prompt_Unsubscribe_Matcher::target()); $html_parts = array(html('p', implode(' ', $html_parts))); $text_parts[] = "\n\n"; if ($this->replyable) { $sub_mailto = sprintf('mailto:{{{reply_to}}}?subject=%s&body=%s', rawurlencode(__('Subscribe to comments', 'Postmatic')), rawurlencode(Prompt_Subscribe_Matcher::target())); /* translators: %s is the subscribed command word */ $sub_format = __('To keep up to date with the conversation you can subscribe to comments. Just reply to this email with the word \'%s\'.', 'Postmatic'); $html_parts[] = html('p', sprintf($sub_format, "<a href=\"{$sub_mailto}\">" . Prompt_Subscribe_Matcher::target() . '</a>')); $text_parts[] = sprintf($sub_format, Prompt_Subscribe_Matcher::target()); } return array(implode(' ', $html_parts), implode(' ', $text_parts)); }