本文整理汇总了PHP中PBValidation::isFloat方法的典型用法代码示例。如果您正苦于以下问题:PHP PBValidation::isFloat方法的具体用法?PHP PBValidation::isFloat怎么用?PHP PBValidation::isFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PBValidation
的用法示例。
在下文中一共展示了PBValidation::isFloat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processShortcodeBackgroundVideo
function processShortcodeBackgroundVideo($attribute, $content, $tag)
{
$html = null;
$option = array();
$Validation = new PBValidation();
$attribute = $this->processAttribute($tag, $attribute);
if (!$Validation->isBool($attribute['loop'])) {
return $html;
}
if (!$Validation->isBool($attribute['muted'])) {
return $html;
}
if (!$Validation->isNumber($attribute['volume'], 0, 100)) {
return $html;
}
if (!$Validation->isFloat($attribute['playback_rate'], -999.99, 999.99)) {
return $html;
}
if ($Validation->isEmpty($attribute['video_format_webm']) && $Validation->isEmpty($attribute['video_format_ogg']) && $Validation->isEmpty($attribute['video_format_mp4'])) {
return $html;
}
$key = array('loop', 'muted', 'poster', 'volume', 'position', 'playback_rate', 'video_format_mp4', 'video_format_ogg', 'video_format_webm');
foreach ($key as $value) {
$option[$value] = $attribute[$value];
}
$html = '
<div class="pb-script-tag">
<script type="text/javascript">
jQuery(document).ready(function($)
{
$(\'body\').PBBackgroundVideo(' . json_encode($option) . ');
});
</script>
</div>
';
return $html;
}
示例2: processShortcodeGoogleMapMapTypeStyle
function processShortcodeGoogleMapMapTypeStyle($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$Validation = new PBValidation();
$data = array();
$style = array();
if (array_key_exists($attribute['feature_type'], $this->mapTypeStyleFeatureType)) {
if ($attribute['feature_type'] != 'all') {
$data['featureType'] = $attribute['feature_type'];
}
}
if (array_key_exists($attribute['element_type'], $this->mapTypeStyleElementType)) {
if ($attribute['element_type'] != 'all') {
$data['elementType'] = $attribute['element_type'];
}
}
if ($Validation->isColor($attribute['hue'], false)) {
$style[]['hue'] = PBColor::getColor($attribute['hue']);
}
if ($Validation->isNumber($attribute['lightness'], -100, 100, false)) {
$style[]['lightness'] = $attribute['lightness'];
}
if ($Validation->isNumber($attribute['saturation'], -100, 100, false)) {
$style[]['saturation'] = $attribute['saturation'];
}
if ($Validation->isFloat($attribute['gamma'], 0, 10, false)) {
$style[]['gamma'] = $attribute['gamma'];
}
if ($Validation->isBool($attribute['inverse_lightness'])) {
$style[]['inverse_lightness'] = $attribute['inverse_lightness'];
}
if (array_key_exists($attribute['visibility'], $this->mapTypeStyleVisibility)) {
$style[]['visibility'] = $attribute['visibility'];
}
if ($Validation->isColor($attribute['color'], false)) {
$style[]['color'] = PBColor::getColor($attribute['color']);
}
if ($Validation->isNumber($attribute['weight'], 1, 999, false)) {
$style[]['weight'] = $attribute['weight'];
}
$data['stylers'] = $style;
return ',' . json_encode($data);
}