本文整理汇总了PHP中Captcha::getCaptchaCalc方法的典型用法代码示例。如果您正苦于以下问题:PHP Captcha::getCaptchaCalc方法的具体用法?PHP Captcha::getCaptchaCalc怎么用?PHP Captcha::getCaptchaCalc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Captcha
的用法示例。
在下文中一共展示了Captcha::getCaptchaCalc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addCaptcha
/**
* Add a captcha with an input field to the form. The captcha could be a picture with a character code
* or a simple mathematical calculation that must be solved.
* @param string $id Id of the captcha field. This will also be the name of the captcha field.
* @param string $type The of captcha that should be shown. This can be characters in a image or
* simple mathematical calculation. Possible values are @b pic or @b calc.
* @param string $class (optional) An additional css classname. The class @b admTextInput
* is set as default and need not set with this parameter.
*/
public function addCaptcha($id, $type, $class = '')
{
global $gL10n, $g_root_path;
$attributes = array('class' => 'captcha');
++$this->countElements;
// set specific css class for this field
if ($class !== '') {
$attributes['class'] .= ' ' . $class;
}
// add a row with the captcha puzzle
$this->openControlStructure('captcha_puzzle', '');
$captchaLabel = '';
$captchaDescription = '';
if ($type === 'pic') {
$this->addHtml('<img src="' . $g_root_path . '/adm_program/system/show_captcha.php?id=' . time() . '" alt="' . $gL10n->get('SYS_CAPTCHA') . '" />');
$captchaLabel = $gL10n->get('SYS_CAPTCHA_CONFIRMATION_CODE');
$captchaDescription = 'SYS_CAPTCHA_DESCRIPTION';
} elseif ($type === 'calc') {
$captcha = new Captcha();
$this->addHtml($captcha->getCaptchaCalc($gL10n->get('SYS_CAPTCHA_CALC_PART1'), $gL10n->get('SYS_CAPTCHA_CALC_PART2'), $gL10n->get('SYS_CAPTCHA_CALC_PART3_THIRD'), $gL10n->get('SYS_CAPTCHA_CALC_PART3_HALF'), $gL10n->get('SYS_CAPTCHA_CALC_PART4')));
$captchaLabel = $gL10n->get('SYS_CAPTCHA_CALC');
$captchaDescription = 'SYS_CAPTCHA_CALC_DESCRIPTION';
}
$this->closeControlStructure();
// now add a row with a text field where the user can write the solution for the puzzle
$this->addInput($id, $captchaLabel, '', array('property' => FIELD_REQUIRED, 'helpTextIdLabel' => $captchaDescription, 'class' => 'form-control-small'));
}
示例2: time
<?php
/**
***********************************************************************************************
* Ausgabe einer Captcha Vorschau
*
* @copyright 2004-2015 The Admidio Team
* @see http://www.admidio.org/
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2.0 only
***********************************************************************************************
*/
require_once '../../system/common.php';
echo '
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">' . $gL10n->get('ORG_CAPTCHA_PREVIEW') . '</h4>
</div>
<div class="modal-body">';
if ($gPreferences['captcha_type'] === 'pic') {
$height = $gPreferences['captcha_height'] + 25;
$width = $gPreferences['captcha_width'] + 25;
echo '<img src="' . $g_root_path . '/adm_program/system/show_captcha.php?id=' . time() . '" alt="' . $gL10n->get('SYS_CAPTCHA') . '" />';
} elseif ($gPreferences['captcha_type'] === 'calc') {
$captcha = new Captcha();
echo $captcha->getCaptchaCalc($gL10n->get('SYS_CAPTCHA_CALC_PART1'), $gL10n->get('SYS_CAPTCHA_CALC_PART2'), $gL10n->get('SYS_CAPTCHA_CALC_PART3_THIRD'), $gL10n->get('SYS_CAPTCHA_CALC_PART3_HALF'), $gL10n->get('SYS_CAPTCHA_CALC_PART4'));
echo '<br><i>(' . $gL10n->get('SYS_CAPTCHA_CALC') . ': ' . $_SESSION['captchacode'] . ')</i>';
}
echo '</div>';