本文整理汇总了PHP中Check::isvar方法的典型用法代码示例。如果您正苦于以下问题:PHP Check::isvar方法的具体用法?PHP Check::isvar怎么用?PHP Check::isvar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Check
的用法示例。
在下文中一共展示了Check::isvar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process(&$action = null)
{
# find the method from the map of action -> method
if (Check::isvar($action, $empty = false) == false) {
$action = $this->get();
}
$func = $this->actions[$action];
# if it doesn't exist use the default
if (empty($func) or !method_exists($this, $func)) {
$func = $this->actions[''];
}
# run the function and return the result (a template name for the page to view)
return $this->{$func}();
}
示例2: smarty_function_inputwidget
/**
* take schema data and make an input widget
*/
function smarty_function_inputwidget($params, &$smarty)
{
# check and grab our data
if (!is_array($params['fdata'])) {
return;
} else {
$fdata = $params['fdata'];
}
if (!Check::isvar($params['field'])) {
return;
} else {
$field = $params['field'];
}
if (!is_array($params['input'])) {
$input = array();
} else {
$input = $params['input'];
}
# configure some dimensions for the display
$max = $fdata['size'];
if ($fdata['size'] > VIEW_MAXFIELDSIZE) {
$size = VIEW_MAXFIELDSIZE;
} else {
$size = $fdata['size'];
}
if ($fdata['cols'] > VIEW_MAXFIELDSIZE) {
$cols = VIEW_MAXFIELDSIZE;
} else {
$cols = $fdata['cols'];
}
if ($fdata['rows'] > VIEW_MAXROWS) {
$rows = VIEW_MAXROWS;
} else {
$rows = $fdata['rows'];
}
if ($rows < VIEW_MINROWS) {
$rows = VIEW_MINROWS;
}
if ($cols < VIEW_MINFIELDSIZE) {
$cols = VIEW_MINFIELDSIZE;
}
# squash any wierdness in the data
$value = htmlentities($input[$field]);
if ($fdata['key']) {
if ($value) {
return "{$value} <input type=hidden name=\"{$field}\" value=\"{$value}\">";
}
return "Create new";
}
if ($fdata['hide']) {
if ($value) {
return "<input type=hidden name=\"{$field}\" value=\"{$value}\">";
}
return;
}
# output a widget
switch ($fdata['type']) {
case 'datetime':
if (!$value) {
$value = date('Y-m-d H:I:S');
}
case 'time':
if (!$value) {
$value = date('H:I:S');
}
case 'date':
if (!$value) {
$value = date('Y-m-d');
}
case 'varchar':
case 'int':
$html = "<input size=\"{$size}\" maxlength=\"{$max}\" name=\"{$field}\" value=\"{$value}\">";
break;
case 'text':
$html = "<textarea name=\"{$field}\" rows=\"{$rows}\" cols=\"{$cols}\">{$value}</textarea>";
break;
case 'hidden':
$html = "<input type=\"hidden\" name=\"{$field}\" value=\"{$value}\">";
break;
case 'password':
$html = "<input type=\"password\" size=\"{$size}\" maxlength=\"{$max}\" " . "name=\"{$field}\" value=\"{$value}\">";
break;
case 'timestamp':
case 'none':
$html = $value;
break;
}
if ($fdata['comment']) {
$html .= $fdata['comment'];
}
return $html;
}