本文整理汇总了PHP中captcha::setLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP captcha::setLanguage方法的具体用法?PHP captcha::setLanguage怎么用?PHP captcha::setLanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类captcha
的用法示例。
在下文中一共展示了captcha::setLanguage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
function run()
{
global $_out;
$ns = $this->query('form');
foreach ($ns as $form) {
if (!$form->getAttribute('action')) {
$form->setAttribute('action', $_SERVER['REQUEST_URI']);
}
if ($this->isSent($form)) {
//форму отправили
$xml = new xml($form);
if (!$this->check($form) && ($res = $this->getSentData($form))) {
$resultSQL = $resultMail = true;
if (count($res['mysql'])) {
$resultSQL = $this->insertDB($res['mysql'], $form);
}
if ($res['xml']) {
$resultMail = $this->sendEmail($res['xml'], $form);
}
$form->appendChild($xml->createElement('message', array('type' => $resultSQL && $resultMail ? 'success' : 'fail'), xml::getElementText($this->query($resultSQL && $resultMail ? 'form/good' : 'form/fail')->item(0))));
} else {
// Ошибка - заполняем форму
$this->fillForm($form);
}
}
if ($form->hasAttribute('appendTo')) {
$_out->elementIncludeTo($form, $form->getAttribute('appendTo'));
} elseif (!$this->getSection()) {
$_out->elementIncludeTo($form, $_out->de());
} else {
$_out->addSectionContent($form);
}
if ($this->hasCaptcha($form)) {
$captcha = new captcha();
$captcha->setLanguage($_out->getLang());
$captcha->setParamName('captcha');
$captcha->create('userfiles/cptch.jpg');
}
}
}
示例2: run
function run()
{
global $_out;
$captcha = new captcha();
$captcha->setParamName('captcha');
if ($form = $this->query('form')->item(0)) {
//нашли форму
if (!$form->getAttribute('action')) {
$form->setAttribute('action', $_SERVER['REQUEST_URI']);
}
if ($this->isSent($form)) {
//форму отправили
if (!$this->check($form) && ($res = $this->getSentData($form))) {
$e = $this->getSection()->getXML()->createElement('final', null);
$resultSQL = $resultMail = true;
if (count($res['mysql'])) {
$resultSQL = $this->insertDB($res['mysql'], $form);
}
if ($res['xml']) {
$resultMail = $this->sendEmail($res['xml'], $form);
}
if ($resultSQL && $resultMail) {
xml::setElementText($e, xml::getElementText($this->getSection()->getXML()->query('good', $form)->item(0)));
} else {
xml::setElementText($e, xml::getElementText($this->getSection()->getXML()->query('fail', $form)->item(0)));
}
$form->appendChild($e);
} else {
// Ошибка - заполняем форму
$this->fillForm($form);
}
}
$_out->addSectionContent($form);
$captcha->setLanguage('en');
$captcha->create('userfiles/cptch.jpg');
}
}