本文整理汇总了PHP中WPCF7_ContactForm::in_demo_mode方法的典型用法代码示例。如果您正苦于以下问题:PHP WPCF7_ContactForm::in_demo_mode方法的具体用法?PHP WPCF7_ContactForm::in_demo_mode怎么用?PHP WPCF7_ContactForm::in_demo_mode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPCF7_ContactForm
的用法示例。
在下文中一共展示了WPCF7_ContactForm::in_demo_mode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: submitForm
/**
* Handler for wpcf7_submit hook.
*
* @param \WPCF7_ContactForm $contactform
*/
public function submitForm($contactform)
{
if ($contactform->in_demo_mode()) {
return;
}
$submission = \WPCF7_Submission::get_instance();
$posted = $submission->get_posted_data();
$groovehq_copy_email = $contactform->additional_setting("groovehq_copy_email");
$groovehq_tags = $contactform->additional_setting("groovehq_tags");
$groovehq_inbox = $contactform->additional_setting("groovehq_inbox");
if (!$submission || !$posted) {
return;
}
if (!isset($posted['your-email'])) {
$sender = get_option('admin_email');
} else {
$sender = $posted['your-email'];
}
$ticket = array('state' => 'pending', 'to' => $sender, 'subject' => sprintf('%s: %s', $contactform->title(), $sender), 'from' => $this->getOption("inbox", "Inbox"), 'note' => true, 'body' => $this->getMessage($posted, $contactform->prop('form')));
if (!is_null($groovehq_tags)) {
$ticket = array_merge($ticket, array("tags" => explode(",", $groovehq_tags[0])));
}
if (!is_null($groovehq_inbox)) {
$ticket["from"] = $groovehq_inbox[0];
}
if (!is_null($groovehq_copy_email)) {
add_filter('wp_mail_content_type', array(&$this, "set_html_content_type"));
wp_mail($groovehq_copy_email[0], $ticket["subject"], $ticket["body"]);
remove_filter('wp_mail_content_type', array(&$this, "set_html_content_type"));
}
$res = $this->postAPI("/tickets", $ticket);
if ($res && $this->getOption("to_pending", false)) {
$this->setPendingTicket($res->ticket->number);
}
}
示例2: get_instance
public static function get_instance(WPCF7_ContactForm $contact_form = null)
{
if (empty(self::$instance)) {
if (null == $contact_form) {
return null;
}
self::$instance = new self();
self::$instance->contact_form = $contact_form;
self::$instance->skip_mail = $contact_form->in_demo_mode();
self::$instance->setup_posted_data();
self::$instance->submit();
} elseif (null != $contact_form) {
return null;
}
return self::$instance;
}