本文整理汇总了PHP中CSmartyDP::is_open方法的典型用法代码示例。如果您正苦于以下问题:PHP CSmartyDP::is_open方法的具体用法?PHP CSmartyDP::is_open怎么用?PHP CSmartyDP::is_open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSmartyDP
的用法示例。
在下文中一共展示了CSmartyDP::is_open方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* mb_form
*/
function mb_form($params, $content, &$smarty, &$repeat)
{
$fields = array("m" => CMbArray::extract($params, "m", null, true), "dosql" => CMbArray::extract($params, "dosql"), "tab" => CMbArray::extract($params, "tab"), "a" => CMbArray::extract($params, "a"));
$attributes = array("name" => CMbArray::extract($params, "name", null, true), "method" => CMbArray::extract($params, "method", "get"), "action" => CMbArray::extract($params, "action", "?"), "class" => CMbArray::extract($params, "className", ""));
// If protection enabled
if (CAppUI::conf("csrf_protection")) {
// During opening tag, we generate the token
if ($repeat) {
// Form is open
self::$is_open = true;
} else {
if (strtoupper($attributes["method"]) == "POST") {
$lifetime = CMbArray::extract($params, "lifetime", CAppUI::conf("csrf_token_lifetime"));
$lifetime = abs(round($lifetime));
$token = CCSRF::generateToken();
if ($token) {
// Key is token, value is expiration date and fields to check
$_SESSION["tokens"][$token] = array("lifetime" => time() + $lifetime, "fields" => self::$csrf_values);
// In order to add the hidden input
$fields["csrf"] = $token;
self::$csrf_values = array();
}
}
// Form is closing
self::$is_open = false;
}
}
$attributes += $params;
$fields = array_filter($fields);
$_content = "";
foreach ($fields as $name => $value) {
$_content .= "\n" . CHTMLResourceLoader::getTag("input", array("type" => "hidden", "name" => $name, "value" => $value));
}
$_content .= $content;
return CHTMLResourceLoader::getTag("form", $attributes, $_content);
}