当前位置: 首页>>代码示例>>PHP>>正文


PHP PBValidation类代码示例

本文整理汇总了PHP中PBValidation的典型用法代码示例。如果您正苦于以下问题:PHP PBValidation类的具体用法?PHP PBValidation怎么用?PHP PBValidation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PBValidation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processShortcodeScreenPreloader

    function processShortcodeScreenPreloader($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $html = null;
        $Validation = new PBValidation();
        if (!$Validation->isColor($attribute['bg_color'])) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['z_index'], 0, 999999)) {
            return $html;
        }
        $style = array();
        $class = array('pb-screen-preloader', $attribute['css_class']);
        $style['z-index'] = $attribute['z_index'];
        $style['background-color'] = PBColor::getColor($attribute['bg_color']);
        $id = PBHelper::createId('pb_screen_preloader');
        $html = '
			<div' . PBHelper::createStyleAttribute($style) . PBHelper::createClassAttribute($class) . ' id="' . esc_attr($id) . '"></div>
			<div class="pb-script-tag">
				<script type="text/javascript">
					jQuery(document).ready(function($)
					{
						$(\'#' . $id . '\').PBScreenPreloader();
					});
				</script>
			</div>
		';
        return PBHelper::formatHTML($html);
    }
开发者ID:phanhoanglong2610,项目名称:anc_gvn,代码行数:29,代码来源:PB.Component.ScreenPreloader.class.php

示例2: processShortcodeHeaderSubheaderSubheader

 function processShortcodeHeaderSubheaderSubheader($attribute, $content, $tag)
 {
     $attribute = $this->processAttribute($tag, $attribute);
     $html = null;
     $style = array();
     $Font = new PBFont();
     $Header = new PBHeader();
     $Validation = new PBValidation();
     if ($Validation->isEmpty($content)) {
         return $html;
     }
     if (!array_key_exists($attribute['important'], $Header->important)) {
         return $html;
     }
     if ($Validation->isNumber($attribute['font_size'], 1, 200, true)) {
         $style['font-size'] = $attribute['font_size'] . 'px';
     }
     if (array_key_exists($attribute['font_weight'], $Font->weight)) {
         $style['font-weight'] = $attribute['font_weight'];
     }
     if (array_key_exists($attribute['font_style'], $Font->style)) {
         $style['font-style'] = $attribute['font_style'];
     }
     if ($Validation->isColor($attribute['font_color'])) {
         $style['color'] = PBColor::getColor($attribute['font_color']);
     }
     if ($Validation->isNotEmpty($attribute['line_height'])) {
         $style['line-height'] = $attribute['line_height'];
     }
     $class = array(array('pb-subheader'), array('pb-subheader-content'));
     $html = '<h' . (int) $attribute['important'] . PBHelper::createClassAttribute($class[0]) . PBHelper::createStyleAttribute($style) . '><span' . PBHelper::createClassAttribute($class[1]) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</span></h' . (int) $attribute['important'] . '>';
     return PBHelper::formatHTML($html, $content);
 }
开发者ID:phanhoanglong2610,项目名称:anc_gvn,代码行数:33,代码来源:PB.Component.HeaderSubheader.class.php

示例3: processAttribute

 function processAttribute($shortcode, $attr)
 {
     $default = array();
     $Validation = new PBValidation();
     $repeat = 1;
     $shortcode = str_replace(PLUGIN_PAGE_BUILDER_SHORTCODE_PREFIX . $this->getComponentId(), '', $shortcode, $repeat);
     if (mb_substr($shortcode, 0, 1) == '_') {
         $shortcode = mb_substr($shortcode, 1);
     }
     foreach ($this->component['structure']['element'] as $element) {
         $path = mb_split('/', preg_replace('/\\*/', '', $element['shortcode']['path']));
         $count = count($path);
         if (!(mb_substr($path[$count - 1], 0, 1) == '@' && $path[$count - 1] != '@content')) {
             continue;
         }
         $name = mb_substr($path[$count - 1], 1);
         if ($name == 'param') {
             $name = $element['id'];
         }
         if ($count == 1) {
             if ($Validation->isEmpty($shortcode)) {
                 $default[$name] = $element['shortcode']['default'];
             }
         } else {
             if ($shortcode == $path[$count - 2]) {
                 $default[$name] = $element['shortcode']['default'];
             }
         }
     }
     return shortcode_atts($default, $attr);
 }
开发者ID:annguyenit,项目名称:HawaiiEducation,代码行数:31,代码来源:PB.Component.class.php

示例4: processShortcodeCounterListItem

    function processShortcodeCounterListItem($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $html = null;
        $Validation = new PBValidation();
        if ($Validation->isEmpty($attribute['name'])) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['value'], 0, 99999, false)) {
            return $html;
        }
        $lineCharacterAfter = null;
        $lineCharacterBefore = null;
        if ($Validation->isNotEmpty($this->character['before'])) {
            $lineCharacterBefore = '<span' . PBHelper::createClassAttribute(array('pb-counter-list-value-character-before')) . '>' . esc_html($this->character['before']) . '</span>';
        }
        if ($Validation->isNotEmpty($this->character['after'])) {
            $lineCharacterAfter = '<span' . PBHelper::createClassAttribute(array('pb-counter-list-value-character-after')) . '>' . esc_html($this->character['after']) . '</span>';
        }
        $html = '
			<li class="pb-value-' . (int) $attribute['value'] . '">
				<span class="pb-counter-list-label">' . esc_html($attribute['name']) . '</span>
				<span class="pb-counter-list-value">
					' . $lineCharacterBefore . '
					<span class="pb-counter-list-value-value">' . (int) $attribute['value'] . '</span>
					' . $lineCharacterAfter . '
				</span>
				<span class="pb-counter-list-foreground"></span>
				<span class="pb-counter-list-background"></span>
			</li>
		';
        return PBHelper::formatHTML($html);
    }
开发者ID:slavai,项目名称:sadick,代码行数:33,代码来源:PB.Component.CounterList.class.php

示例5: processShortcodeIframe

    function processShortcodeIframe($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $Validation = new PBValidation();
        if ($Validation->isEmpty($attribute['src'])) {
            return null;
        }
        $style = array(array(), array());
        if ((int) $attribute['width'] > 0) {
            $style[0]['width'] = (int) $attribute['width'] . 'px';
        }
        if ((int) $attribute['height'] > 0) {
            $style[1]['height'] = (int) $attribute['height'] . 'px';
            $style[1]['padding-bottom'] = '0px';
        }
        $class = array(array('pb-iframe', $attribute['css_class']), array('pb-iframe-content'));
        $html = '
			<div' . PBHelper::createClassAttribute($class[0]) . PBHelper::createStyleAttribute($style[0]) . '>
				<div' . PBHelper::createClassAttribute($class[1]) . PBHelper::createStyleAttribute($style[1]) . '>
					<iframe src="' . esc_attr($attribute['src']) . '"></iframe>
				</div>
			</div>
		';
        return PBHelper::formatCode($html);
    }
开发者ID:annguyenit,项目名称:HawaiiEducation,代码行数:25,代码来源:PB.Component.Iframe.class.php

示例6: processShortcodeList

 function processShortcodeList($attribute, $content, $tag)
 {
     $attribute = $this->processAttribute($tag, $attribute);
     $Validation = new PBValidation();
     $classBullet = null;
     if ($Validation->isNotEmpty($attribute['bullet'])) {
         $classBullet = 'pb-list-' . PBHelper::createHash($attribute['bullet']);
     }
     $class = array('pb-list', $classBullet, $attribute['css_class']);
     $html = '<div' . PBHelper::createClassAttribute($class) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</div>';
     return PBHelper::formatHTML($html, $content);
 }
开发者ID:annguyenit,项目名称:HawaiiEducation,代码行数:12,代码来源:PB.Component.List.class.php

示例7: createStyleAttribute

 static function createStyleAttribute($style)
 {
     $ret = null;
     $Validation = new PBValidation();
     foreach ($style as $index => $value) {
         if ($Validation->isEmpty($value)) {
             continue;
         }
         $ret .= $index . ':' . $value . ';';
     }
     return $Validation->isEmpty($ret) ? null : ' style="' . $ret . '"';
 }
开发者ID:annguyenit,项目名称:fable.local,代码行数:12,代码来源:PB.Helper.class.php

示例8: processShortcodeRedirect

 function processShortcodeRedirect($attribute, $content, $tag)
 {
     $attribute = $this->processAttribute($tag, $attribute);
     $Validation = new PBValidation();
     if ($Validation->isEmpty($attribute['url']) && $Validation->isEmpty($attribute['post_id'])) {
         return;
     }
     $url = $Validation->isEmpty($attribute['url']) ? get_permalink($attribute['post_id']) : $attribute['url'];
     ob_start();
     wp_redirect($url, $attribute['status']);
     ob_end_flush();
     exit;
 }
开发者ID:annguyenit,项目名称:fable.local,代码行数:13,代码来源:PB.Component.Redirect.class.php

示例9: processShortcodeSpace

 function processShortcodeSpace($attribute, $content, $tag)
 {
     $attribute = $this->processAttribute($tag, $attribute);
     $style = array();
     $Validation = new PBValidation();
     if ($Validation->isNumber($attribute['height'], -9999, 9999)) {
         if ((int) $attribute['height'] >= 0) {
             $style['height'] = (int) $attribute['height'] . 'px';
         } else {
             $style['margin-top'] = (int) $attribute['height'] . 'px';
         }
     }
     $class = array('pb-space', 'pb-clear-fix', $attribute['css_class']);
     $html = '<div' . PBHelper::createClassAttribute(array('pb-space-line')) . '></div><div' . PBHelper::createClassAttribute($class) . PBHelper::createStyleAttribute($style) . '></div>';
     return PBHelper::formatHTML($html);
 }
开发者ID:annguyenit,项目名称:fable.local,代码行数:16,代码来源:PB.Component.Space.class.php

示例10: processShortcodeSitemap

    function processShortcodeSitemap($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $html = null;
        $Validation = new PBValidation();
        $argument = array();
        if ($Validation->isNotEmpty($attribute['post_type'])) {
            $argument['post_type'] = explode(',', $attribute['post_type']);
        }
        if ($Validation->isNotEmpty($attribute['post_status'])) {
            $argument['post_status'] = explode(',', $attribute['post_status']);
        }
        if ($Validation->isNotEmpty($attribute['post__in'])) {
            $argument['post__in'] = explode(',', $attribute['post__in']);
        }
        if ($Validation->isNotEmpty($attribute['post__not_in'])) {
            $argument['post__not_in'] = explode(',', $attribute['post__not_in']);
        }
        if ($Validation->isNotEmpty($attribute['posts_per_page'])) {
            $argument['posts_per_page'] = $attribute['posts_per_page'] == -2 ? -1 : $attribute['posts_per_page'];
        }
        if ($Validation->isNotEmpty($attribute['orderby'])) {
            $argument['orderby'] = $attribute['orderby'];
        }
        if ($Validation->isNotEmpty($attribute['order'])) {
            $argument['order'] = $attribute['order'];
        }
        $query = new WP_Query($argument);
        if ($query === false) {
            return $html;
        }
        if ($query->post_count == 0) {
            return $html;
        }
        $class = array(array('pb-sitemap'), array('pb-reset-list'));
        if (array_key_exists($attribute['bullet'], $this->bullet['file'])) {
            array_push($class[0], 'pb-sitemap-bullet-list', 'pb-sitemap-bullet-list-' . PBHelper::createHash($attribute['bullet']));
        }
        global $post;
        $bPost = $post;
        while ($query->have_posts()) {
            $query->the_post();
            $html .= '
				<li id="post-' . get_the_ID() . '" class="' . implode(' ', get_post_class()) . '">
					<a href="' . get_the_permalink() . '">' . get_the_title() . '</a>
				</li>
			';
        }
        $post = $bPost;
        $html = '
			<div' . PBHelper::createClassAttribute($class[0]) . '>
				<ul' . PBHelper::createClassAttribute($class[1]) . '>' . $html . '</ul>
			</div>
		';
        return PBHelper::formatHTML($html);
    }
开发者ID:annguyenit,项目名称:HawaiiEducation,代码行数:56,代码来源:PB.Component.Sitemap.class.php

示例11: processShortcodeAudio

    function processShortcodeAudio($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $html = null;
        $option = array();
        $this->track = array();
        $this->trackIndex = 0;
        $Validation = new PBValidation();
        if ($Validation->isEmpty($content)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['volume'], 0, 100)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['muted'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['playlist_enable'])) {
            return $html;
        }
        $attribute['volume'] /= 100;
        $key = array('muted', 'volume', 'playlist_enable');
        foreach ($key as $value) {
            $option[$value] = $attribute[$value];
        }
        $id = PBHelper::createId('audio');
        $idPlayer = PBHelper::createId('audio_player');
        $idPlayerContainer = PBHelper::createId('audio_player_container');
        do_shortcode($content);
        if (!count($this->track)) {
            return $html;
        }
        $html .= $this->createJPlayerTemplate($id, $idPlayer, $idPlayerContainer);
        $html .= '
			<div class="pb-script-tag">
				<script type="text/javascript">
					jQuery(document).ready(function($)
					{
						$(\'#' . $id . '\').PBAudio(' . json_encode(array('idPlayer' => $idPlayer, 'idPlayerContainer' => $idPlayerContainer)) . ',' . json_encode($option) . ',' . json_encode($this->track) . ');
					});
				</script>
			</div>		
		';
        return PBHelper::formatHTML($html);
    }
开发者ID:slavai,项目名称:sadick,代码行数:45,代码来源:PB.Component.Audio.class.php

示例12: start_el

    function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
    {
        $this->iconClass = null;
        $Validation = new PBValidation();
        if ($depth == 0) {
            $this->icon = $object->icon;
            $this->mega_menu_layout_column_index = 0;
            $this->mega_menu_enable = $object->mega_menu_enable;
            $this->mega_menu_layout = $object->mega_menu_layout;
            if ($object->icon != '-1') {
                $this->iconClass = 'pb-menu-icon pb-menu-icon-' . PBHelper::createHash($object->icon);
            }
        }
        $linkClass = array();
        if ($Validation->isNotEmpty($object->target)) {
            array_push($linkClass, 'pb-window-target-blank');
        }
        if ($this->mega_menu_enable == 1) {
            if ($depth == 0 || $depth == 2) {
                $output .= '<li class="' . join(' ', (array) $object->classes) . ($depth == 0 ? ' sf-mega-enable-1' : null) . ' ' . $this->iconClass . ' ' . '">';
            }
            if ($depth == 1) {
                $Layout = new PBLayout();
                $class = array('sf-mega-section', 'pb-layout-' . $Layout->getLayoutColumnCSSClass($this->mega_menu_layout, $this->mega_menu_layout_column_index));
                $output .= '
					<div' . PBHelper::createClassAttribute($class) . '>
				';
                $this->mega_menu_layout_column_index++;
            }
            if ($depth == 1) {
                $output .= '
					<span class="sf-mega-header">' . esc_html($object->title) . '</span>
				';
            } else {
                $output .= '
					<a href="' . esc_attr($object->url) . '"' . PBHelper::createClassAttribute($linkClass) . '><span></span>' . $object->title . '</a>
				';
            }
        } else {
            $output .= '
				<li class="' . join(' ', (array) $object->classes) . ($depth == 0 ? ' sf-mega-enable-0' : null) . ' ' . $this->iconClass . ' ' . '">
					<a href="' . esc_attr($object->url) . '"' . PBHelper::createClassAttribute($linkClass) . '><span></span>' . $object->title . '</a>
			';
        }
    }
开发者ID:phanhoanglong2610,项目名称:anc_gvn,代码行数:45,代码来源:PB.MenuWalker.class.php

示例13: getColor

 static function getColor($color)
 {
     $Validation = new PBValidation();
     if (!$Validation->isColor($color, false)) {
         return false;
     }
     if ($color === 'transparent') {
         return $color;
     }
     $length = strlen($color);
     if ($length == 6) {
         return '#' . $color;
     }
     if ($length == 8) {
         return self::HEX2RGBA($color);
     }
     return false;
 }
开发者ID:phanhoanglong2610,项目名称:anc_gvn,代码行数:18,代码来源:PB.Color.class.php

示例14: start_el

    function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
    {
        $level = null;
        $Validation = new PBValidation();
        for ($i = 0; $i < $depth; $i++) {
            $level .= '--';
        }
        if (!is_null($level)) {
            $level .= ' ';
        }
        $linkClass = array();
        if ($Validation->isNotEmpty($object->target)) {
            array_push($linkClass, 'pb-window-target-blank');
        }
        $output .= '
			<li class="' . join(' ', (array) $object->classes) . '">
				<a href="' . esc_attr($object->url) . '"' . PBHelper::createClassAttribute($linkClass) . '>' . $level . $object->title . '</a>
			</li>
		';
    }
开发者ID:phanhoanglong2610,项目名称:anc_gvn,代码行数:20,代码来源:PB.MenuWalkerResponsive.class.php

示例15: processShortcodeDivider

    function processShortcodeDivider($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $Align = new PBAlign();
        $Border = new PBBorder();
        $Validation = new PBValidation();
        $style = array();
        $class = array('pb-divider', 'pb-clear-fix');
        if ($Validation->isNumber($attribute['line_width'], 0, 9999)) {
            $style['width'] = $attribute['line_width'] . 'px';
        }
        if ($Validation->isNumber($attribute['line_height'], 0, 9999)) {
            $style['border-bottom-width'] = $attribute['line_height'] . 'px';
        }
        if (array_key_exists($attribute['line_style'], $Border->style)) {
            $style['border-style'] = $attribute['line_style'];
        }
        if ($Validation->isColor($attribute['line_color'])) {
            $style['border-color'] = PBColor::getColor($attribute['line_color']);
        }
        if (array_key_exists($attribute['align'], $Align->align)) {
            array_push($class, $Align->getCSSClass($attribute['align']));
        }
        if ($Validation->isNumber($attribute['margin_top'], 0, 9999)) {
            $style['margin-top'] = $attribute['margin_top'] . 'px';
        }
        if ($Validation->isNumber($attribute['margin_bottom'], 0, 9999)) {
            $style['margin-bottom'] = $attribute['margin_bottom'] . 'px';
        }
        array_push($class, $attribute['css_class']);
        $html = '
			<div' . PBHelper::createClassAttribute($class) . PBHelper::createStyleAttribute($style) . '></div>
		';
        return PBHelper::formatHTML($html);
    }
开发者ID:slavai,项目名称:sadick,代码行数:35,代码来源:PB.Component.Divider.class.php


注:本文中的PBValidation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。