本文整理匯總了PHP中ContactForm::enableSpamProtection方法的典型用法代碼示例。如果您正苦於以下問題:PHP ContactForm::enableSpamProtection方法的具體用法?PHP ContactForm::enableSpamProtection怎麽用?PHP ContactForm::enableSpamProtection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ContactForm
的用法示例。
在下文中一共展示了ContactForm::enableSpamProtection方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ContactForm
/**
* Post a contact form
*
* @return Form
*/
public function ContactForm()
{
$form = new ContactForm($this, 'ContactForm');
// we do not want to read a new URL when the form has already been submitted
// which in here, it hasn't been.
$url = isset($_SERVER['REQUEST_URI']) ? Director::protocolAndHost() . '' . $_SERVER['REQUEST_URI'] : false;
$form->loadDataFrom(array('ReturnURL' => $url));
$member = Member::currentUser();
if ($member) {
$form->loadDataFrom($member);
}
if ($form->hasExtension('FormSpamProtectionExtension')) {
$form->enableSpamProtection();
}
// hook to allow further extensions to alter the comments form
//$this->extend('alterContactForm', $form);
return $form;
}