本文整理汇总了PHP中PBValidation::isURL方法的典型用法代码示例。如果您正苦于以下问题:PHP PBValidation::isURL方法的具体用法?PHP PBValidation::isURL怎么用?PHP PBValidation::isURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PBValidation
的用法示例。
在下文中一共展示了PBValidation::isURL方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processShortcodeSocialIcon
function processShortcodeSocialIcon($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$style = array();
$social = array();
$Window = new PBWindow();
$Validation = new PBValidation();
if (!array_key_exists($attribute['target'], $Window->linkTarget)) {
return $html;
}
if (!$Validation->isBool($attribute['native_color_enable'])) {
return $html;
}
foreach ($this->social as $index => $value) {
$url = 'profile_' . $index . '_url';
$order = 'profile_' . $index . '_order';
PBHelper::removeUIndex($attribute, $url, $order);
if (!$Validation->isURL($attribute[$url])) {
continue;
}
$orderValue = (int) $attribute[$order];
$socialData = array('id' => $index, 'url' => $attribute[$url]);
if ($Validation->isNumber($attribute[$order], 0, 99)) {
if (isset($social[$orderValue])) {
array_push($social, $socialData);
} else {
$social[$orderValue] = $socialData;
}
} else {
array_push($social, $socialData);
}
}
ksort($social);
if (!count($social)) {
return;
}
$option = array('in' => array(), 'out' => array());
if ($Validation->isNumber($attribute['width'], 0, 999)) {
$style['width'] = $attribute['width'] . 'px';
}
if ($Validation->isNumber($attribute['height'], 0, 999)) {
$style['height'] = $attribute['height'] . 'px';
}
$borderRadius = null;
if ($Validation->isNumber($attribute['border_radius_top_left'], 0, 999)) {
$borderRadius .= ' ' . $attribute['border_radius_top_left'] . 'px';
} else {
$borderRadius .= ' 0px';
}
if ($Validation->isNumber($attribute['border_radius_top_right'], 0, 999)) {
$borderRadius .= ' ' . $attribute['border_radius_top_right'] . 'px';
} else {
$borderRadius .= ' 0px';
}
if ($Validation->isNumber($attribute['border_radius_bottom_right'], 0, 999)) {
$borderRadius .= ' ' . $attribute['border_radius_bottom_right'] . 'px';
} else {
$borderRadius .= ' 0px';
}
if ($Validation->isNumber($attribute['border_radius_bottom_left'], 0, 999)) {
$borderRadius .= ' ' . $attribute['border_radius_bottom_left'] . 'px';
} else {
$borderRadius .= ' 0px';
}
$borderRadius = trim($borderRadius);
$style['-webkit-border-radius'] = $borderRadius;
$style['-moz-border-radius'] = $borderRadius;
$style['border-radius'] = $borderRadius;
if ($Validation->isNumber($attribute['border_width'], 0, 999)) {
$style['border-width'] = $attribute['border_width'] . 'px';
$option['out']['border-width'] = $style['border-width'];
}
if ($Validation->isColor($attribute['bg_color'])) {
$style['background-color'] = PBColor::getColor($attribute['bg_color']);
$option['out']['background-color'] = $style['background-color'];
}
if ($Validation->isColor($attribute['border_color'])) {
$style['border-color'] = PBColor::getColor($attribute['border_color']);
$option['out']['border-color'] = $style['border-color'];
}
if ($Validation->isNumber($attribute['border_width_hover'], 0, 999)) {
$option['in']['border-width'] = $attribute['border_width_hover'] . 'px';
}
if ($Validation->isColor($attribute['bg_color_hover'])) {
$option['in']['background-color'] = PBColor::getColor($attribute['bg_color_hover']);
}
if ($Validation->isColor($attribute['border_color_hover'])) {
$option['in']['border-color'] = PBColor::getColor($attribute['border_color_hover']);
}
foreach ($social as $index => $value) {
$class = array('pb-social-icon-' . $value['id'], $Window->getTargetCSSClass($attribute['target']));
$html .= '
<li><a href="' . esc_attr($value['url']) . '"' . PBHelper::createClassAttribute($class) . PBHelper::createStyleAttribute($style) . '></a></li>
';
}
$id = PBHelper::createId('pb_social_icon');
$class = array('pb-social-icon');
if ($attribute['native_color_enable'] == 1) {
array_push($class, 'pb-social-icon-color-native');
//.........这里部分代码省略.........
示例2: processShortcodeGallery
function processShortcodeGallery($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$elementHTML = null;
$Layout = new PBLayout();
$Validation = new PBValidation();
$ImageHover = new PBImageHover();
$file = PBFile::getImage(explode(',', $attribute['image']));
if ($file === false) {
return $html;
}
if (!count($file->posts)) {
return $html;
}
if (!PBFile::isWPImage($attribute['image_size'])) {
return $html;
}
if (!array_key_exists($attribute['layout'], $this->layout)) {
return $html;
}
if (!$Validation->isBool($attribute['hover_enable'])) {
return $html;
}
if (!array_key_exists($attribute['hover_type'], $ImageHover->type)) {
return $html;
}
if (!$Validation->isBool($attribute['caption_enable'])) {
return $html;
}
if (!$Validation->isBool($attribute['preloader_enable'])) {
return $html;
}
if (!$Validation->isBool($attribute['description_enable'])) {
return $html;
}
if (!$Validation->isBool($attribute['layout_full_width_enable'])) {
return $html;
}
$key = array('hover_type', 'hover_enable', 'preloader_enable', 'layout_full_width_enable');
foreach ($key as $index) {
$option[$index] = $attribute[$index];
}
$id = PBHelper::createId('pb_gallery');
global $post;
$bPost = $post;
$i = 0;
while ($file->have_posts()) {
global $post;
$file->the_post();
$full = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), $attribute['image_size']);
$meta = PBMeta::get($post);
PBHelper::removeUIndex($meta, 'media_library_video_url', 'media_library_url');
$class = array();
$class[0] = array('pb-layout-' . $Layout->getLayoutColumnCSSClass($attribute['layout'], $i));
$class[1] = array('pb-image-box');
$class[2] = array('pb-image');
if ($attribute['preloader_enable'] == 1) {
array_push($class[1], 'pb-image-preloader', 'pb-image-preloader-animation-enable');
}
if ($attribute['hover_enable'] == 1) {
array_push($class[1], 'pb-image-hover', 'pb-image-hover-type-' . $attribute['hover_type']);
}
/****/
$imageTextHTML = null;
if ($Validation->isNotEmpty($post->post_excerpt) && $attribute['caption_enable'] == 1) {
$imageTextHTML .= '<' . PBComponentData::get($this->getComponentId(), 'image_text_caption_header_tag') . ' class="pb-image-text-caption">' . get_the_excerpt() . '</' . PBComponentData::get($this->getComponentId(), 'image_text_caption_header_tag') . '>';
}
if ($Validation->isNotEmpty($post->post_content) && $attribute['description_enable'] == 1) {
$imageTextHTML .= '<div class="pb-image-text-description">' . get_the_content() . '</div>';
}
if ($Validation->isNotEmpty($imageTextHTML)) {
$imageTextHTML = '<div class="pb-image-text">' . $imageTextHTML . '</div>';
}
if ($Validation->isNotEmpty($imageTextHTML)) {
$imageTextHTML .= '<div class="pb-image-text-fancybox"><b>' . get_the_excerpt() . '</b> ' . get_the_content() . '</div>';
}
/****/
$url = null;
$rel = null;
if ($Validation->isVideoURL($meta['media_library_video_url'])) {
$url = $meta['media_library_video_url'];
array_push($class[1], 'pb-image-type-video');
} elseif ($Validation->isURL($meta['media_library_url'])) {
$url = $meta['media_library_url'];
array_push($class[1], 'pb-image-type-link');
} else {
$rel = $id;
$url = $full[0];
array_push($class[1], 'pb-image-type-image');
}
/****/
$imageHTML = null;
if ($attribute['hover_enable'] == 1) {
$imageHTML = '<a href="' . $url . '"' . PBHelper::createClassAttribute($class[2]) . ($Validation->isEmpty($rel) ? null : ' data-fancybox-group="' . esc_attr($rel) . '"') . '><img src="' . $thumbnail[0] . '" alt=""/><span><span><span></span></span></span></a>';
} else {
$imageHTML = '<div' . PBHelper::createClassAttribute($class[2]) . '><img src="' . $thumbnail[0] . '" alt=""/></div>';
}
/****/
//.........这里部分代码省略.........
示例3: processShortcodeCallToActionButton
function processShortcodeCallToActionButton($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$style = array();
$option = array();
$Window = new PBWindow();
$Validation = new PBValidation();
$src = $Validation->isURL($attribute['src']) ? $attribute['src'] : '#';
$class = array($Window->getTargetCSSClass($attribute['src_target']));
if ($Validation->isColor($attribute['text_color'])) {
$style['color'] = PBColor::getColor($attribute['text_color']);
$option['out']['color'] = $style['color'];
}
if ($Validation->isColor($attribute['bg_color'])) {
$style['background-color'] = PBColor::getColor($attribute['bg_color']);
$option['out']['background-color'] = $style['background-color'];
}
if ($Validation->isColor($attribute['border_color'])) {
$style['border-color'] = PBColor::getColor($attribute['border_color']);
$option['out']['border-color'] = $style['border-color'];
}
if ($Validation->isColor($attribute['text_color_hover'])) {
$option['in']['color'] = PBColor::getColor($attribute['text_color_hover']);
}
if ($Validation->isColor($attribute['bg_color_hover'])) {
$option['in']['background-color'] = PBColor::getColor($attribute['bg_color_hover']);
}
if ($Validation->isColor($attribute['border_color_hover'])) {
$option['in']['border-color'] = PBColor::getColor($attribute['border_color_hover']);
}
if ($Validation->isNumber($attribute['padding_top'], 0, 9999)) {
$style['padding-top'] = $attribute['padding_top'] . 'px';
}
if ($Validation->isNumber($attribute['padding_right'], 0, 9999)) {
$style['padding-right'] = $attribute['padding_right'] . 'px';
}
if ($Validation->isNumber($attribute['padding_bottom'], 0, 9999)) {
$style['padding-bottom'] = $attribute['padding_bottom'] . 'px';
}
if ($Validation->isNumber($attribute['padding_left'], 0, 9999)) {
$style['padding-left'] = $attribute['padding_left'] . 'px';
}
if ($Validation->isNumber($attribute['margin_top'], -9999, 9999)) {
$style['margin-top'] = $attribute['margin_top'] . 'px';
}
if ($Validation->isNumber($attribute['margin_bottom'], -9999, 9999)) {
$style['margin-bottom'] = $attribute['margin_bottom'] . 'px';
}
$html = '
<div>
<a href="' . $src . '"' . PBHelper::createClassAttribute($class) . PBHelper::createStyleAttribute($style) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '<i class="pb-button-arrow pb-button-arrow-right"></i></a>
<input type="hidden" value="' . esc_attr(json_encode($option)) . '"/>
</div>
';
return PBHelper::formatHTML($html, $content);
}
示例4: processShortcodeMenu
function processShortcodeMenu($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$Easing = new PBEasing();
$Validation = new PBValidation();
if (!array_key_exists($attribute['responsive_mode'], $this->responiveMode)) {
return;
}
if (!$Validation->isBool($attribute['sticky_enable'])) {
return;
}
if (!$Validation->isBool($attribute['hide_scroll_enable'])) {
return;
}
if (!$Validation->isBool($attribute['menu_animation_enable'])) {
return;
}
if (!$Validation->isNumber($attribute['menu_animation_speed_open'], 0, 99999)) {
return;
}
if (!$Validation->isNumber($attribute['menu_animation_speed_close'], 0, 99999)) {
return;
}
if (!$Validation->isNumber($attribute['menu_animation_delay'], 0, 99999)) {
return;
}
if (!$Validation->isBool($attribute['scroll_animation_enable'])) {
return;
}
if (!$Validation->isNumber($attribute['scroll_animation_speed'], 0, 99999)) {
return;
}
if (!array_key_exists($attribute['scroll_animation_easing'], $Easing->easingType)) {
return;
}
$html = null;
$logoHTML = null;
$option = array();
$key = array('responsive_mode', 'sticky_enable', 'hide_scroll_enable', 'menu_animation_enable', 'menu_animation_speed_open', 'menu_animation_speed_close', 'menu_animation_delay', 'scroll_animation_enable', 'scroll_animation_speed', 'scroll_animation_easing');
foreach ($key as $value) {
$option[$value] = $attribute[$value];
}
$option['responsive_menu_id'] = PBHelper::createId('pb_menu_responsive');
$option['responsive_menu_label'] = __('Menu');
$id = PBHelper::createId('pb_menu');
$classLogo = array('pb-logo');
$classMenu = array('pb-menu-default');
$classMenuResponsive = array('pb-menu-responsive');
$class = array('pb-menu', $attribute['css_class']);
$menuAttribute = array('menu' => $attribute['menu_id'], 'walker' => new PBMenuWalker(), 'menu_class' => 'sf-menu pb-reset-list pb-clear-fix', 'container' => '', 'container_class' => '', 'echo' => 0);
$menuResponsiveAttribute = array('id' => $option['responsive_menu_id'], 'menu' => $attribute['menu_id'], 'walker' => new PBMenuResponsiveWalker(), 'menu_class' => 'pb-clear-fix', 'container' => '', 'container_class' => '', 'echo' => 0, 'items_wrap' => '<div id="%1$s" class="%2$s"><div id="' . $option['responsive_menu_id'] . '"><ul>%3$s</ul></div></div>');
if ($Validation->isURL($attribute['logo_src'])) {
$logoHTML = '
<a href="' . get_home_url() . '">
<img src="' . esc_attr($attribute['logo_src']) . '" alt=""/>
</a>
';
}
$html = '
<div' . PBHelper::createClassAttribute($class) . ' id="' . $id . '">
<div class="pb-main pb-clear-fix">
<div' . PBHelper::createClassAttribute($classLogo) . '>
' . $logoHTML . '
</div>
<div' . PBHelper::createClassAttribute($classMenu) . '>
' . wp_nav_menu($menuAttribute) . '
</div>
<div' . PBHelper::createClassAttribute($classMenuResponsive) . '>
' . wp_nav_menu($menuResponsiveAttribute) . '
</div>
</div>
</div>
<div class="pb-script-tag">
<script type="text/javascript">
jQuery(document).ready(function($)
{
$(\'#' . $id . '\').PBMenu(' . json_encode($option) . ');
});
</script>
</div>
';
return PBHelper::formatCode($html);
}
示例5: adminSaveMetaBox
function adminSaveMetaBox($postId)
{
if ($_POST) {
if (PBHelper::checkSavePost($postId, PLUGIN_PAGE_BUILDER_CONTEXT . '_team_noncename', 'adminSaveMetaBox') === false) {
return false;
}
$option = PBHelper::getPOSTOption('team');
$Validation = new PBValidation();
/***/
PBHelper::removeUIndex($option, 'team_skill_name', 'team_skill_level', 'team_skill_order');
$skill = array('team_skill_name' => $option['team_skill_name'], 'team_skill_level' => $option['team_skill_level'], 'team_skill_order' => $option['team_skill_order']);
unset($option['team_skill_name'], $option['team_skill_level'], $option['team_skill_order']);
foreach ($skill['team_skill_name'] as $index => $value) {
if ($Validation->isEmpty($value)) {
continue;
}
if (!array_key_exists($index, $skill['team_skill_level'])) {
continue;
}
if (!$Validation->isNumber($skill['team_skill_level'][$index], 1, 100)) {
continue;
}
$option['team_skill'][] = array('team_skill_name' => $value, 'team_skill_level' => $skill['team_skill_level'][$index], 'team_skill_order' => array_key_exists($index, $skill['team_skill_order']) ? $skill['team_skill_order'][$index] : 0);
}
/***/
PBHelper::removeUIndex($option, 'team_social_name', 'team_social_url', 'team_social_order');
$social = array('team_social_name' => $option['team_social_name'], 'team_social_url' => $option['team_social_url'], 'team_social_order' => $option['team_social_order']);
unset($option['team_social_name'], $option['team_social_url'], $option['team_social_order']);
foreach ($social['team_social_name'] as $index => $value) {
if (!array_key_exists($value, $this->social)) {
continue;
}
if (!array_key_exists($index, $social['team_social_url'])) {
continue;
}
if (!$Validation->isURL($social['team_social_url'][$index])) {
continue;
}
$option['team_social'][] = array('team_social_name' => $value, 'team_social_url' => $social['team_social_url'][$index], 'team_social_order' => array_key_exists($index, $social['team_social_order']) ? $social['team_social_order'][$index] : 0);
}
PBMeta::update($postId, $option);
}
}