本文整理匯總了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;
}