本文整理汇总了PHP中BxDolForm::isVisible方法的典型用法代码示例。如果您正苦于以下问题:PHP BxDolForm::isVisible方法的具体用法?PHP BxDolForm::isVisible怎么用?PHP BxDolForm::isVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BxDolForm
的用法示例。
在下文中一共展示了BxDolForm::isVisible方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check
function check(&$aInputs)
{
$oChecker = $this->_oChecker;
$iErrors = 0;
// check CSRF token if it's needed.
if (getParam('sys_security_form_token_enable') == 'on' && $this->_bFormCsrfChecking === true && ($mixedCsrfTokenSys = BxDolForm::getCsrfToken()) !== false) {
$mixedCsrfTokenUsr = BxDolForm::getSubmittedValue('csrf_token', $this->_sFormMethod, $this->_aSpecificValues);
unset($aInputs['csrf_token']);
if ($mixedCsrfTokenUsr === false || $mixedCsrfTokenSys != $mixedCsrfTokenUsr) {
return false;
}
}
$sSubmitName = false;
foreach ($aInputs as $k => $a) {
if (isset($a['visible_for_levels']) && !BxDolForm::isVisible($a)) {
continue;
}
if (empty($a['name']) || 'submit' == $a['type'] || 'reset' == $a['type'] || 'button' == $a['type'] || 'value' == $a['type']) {
if (isset($a['type']) && 'submit' == $a['type']) {
$sSubmitName = $k;
}
continue;
}
if ('input_set' == $a['type']) {
foreach ($a as $r) {
if (isset($r['type']) && 'submit' == $r['type']) {
$sSubmitName = $k;
}
}
}
$a['name'] = str_replace('[]', '', $a['name']);
$val = BxDolForm::getSubmittedValue($a['name'], $this->_sFormMethod, $this->_aSpecificValues);
if (isset(BxDolForm::$TYPES_FILE[$a['type']])) {
$val = isset($_FILES[$a['name']]['name']) ? $_FILES[$a['name']]['name'] : '';
}
if (!isset($a['checker'])) {
if (isset(BxDolForm::$TYPES_CHECKBOX[$a['type']])) {
$aInputs[$k]['checked'] = isset($aInputs[$k]['value']) && $aInputs[$k]['value'] == $val;
} elseif (!isset(BxDolForm::$TYPES_FILE[$a['type']])) {
$aInputs[$k]['value'] = bx_process_input($val);
}
continue;
}
$sCheckFunction = array($oChecker, 'check' . bx_gen_method_name($a['checker']['func']));
if (is_callable($sCheckFunction)) {
$bool = call_user_func_array($sCheckFunction, !empty($a['checker']['params']) ? array_merge(array($val), $a['checker']['params']) : array($val));
} else {
$bool = true;
}
if (is_string($bool)) {
++$iErrors;
$aInputs[$k]['error'] = $bool;
} elseif (!$bool) {
++$iErrors;
$aInputs[$k]['error'] = $a['checker']['error'];
}
if (isset(BxDolForm::$TYPES_CHECKBOX[$a['type']])) {
$aInputs[$k]['checked'] = $aInputs[$k]['value'] == $val;
} elseif (!isset(BxDolForm::$TYPES_FILE[$a['type']])) {
$aInputs[$k]['value'] = bx_process_input($val);
}
}
// check for spam
if (!$iErrors) {
foreach ($aInputs as $k => $a) {
if ($a['type'] != 'textarea') {
continue;
}
$a['name'] = str_replace('[]', '', $a['name']);
$val = BxDolForm::getSubmittedValue($a['name'], $this->_sFormMethod, $this->_aSpecificValues);
if (!$val) {
continue;
}
if (!$oChecker->checkIsSpam($val)) {
continue;
}
++$iErrors;
$sErr = _t('_sys_spam_detected');
if (BxDolRequest::serviceExists('bx_contact', 'get_contact_page_url') && ($sUrl = BxDolService::call('bx_contact', 'get_contact_page_url'))) {
$sErr = _t('_sys_spam_detected_contact', $sUrl);
}
$aInputs[$k]['error'] = $sErr;
}
}
// add error message near submit button
if ($iErrors && $sSubmitName) {
$aInputs[$sSubmitName]['error'] = _t('_sys_txt_form_submission_error');
}
return $iErrors ? false : true;
}