本文整理汇总了PHP中PBValidation::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:PHP PBValidation::isEmpty方法的具体用法?PHP PBValidation::isEmpty怎么用?PHP PBValidation::isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PBValidation
的用法示例。
在下文中一共展示了PBValidation::isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 . '"';
}
示例2: 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;
}
示例3: 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);
}
示例4: 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);
}
示例5: 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);
}
示例6: 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);
}
示例7: processShortcodeVerticalGrid
function processShortcodeVerticalGrid($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$Validation = new PBValidation();
$this->lineNumber = 0;
$this->lineStyle = array('even' => array('name' => null, 'value' => null), 'odd' => array('name' => null, 'value' => null));
if ($Validation->isEmpty($content)) {
return $html;
}
$style = array();
if ($Validation->isNumber($attribute['column_name_width'], 1, 100)) {
$style['odd']['name']['width'] = $attribute['column_name_width'] . '%';
$style['even']['name']['width'] = $attribute['column_name_width'] . '%';
}
if ($Validation->isNumber($attribute['column_value_width'], 1, 100)) {
$style['odd']['value']['width'] = $attribute['column_value_width'] . '%';
$style['even']['value']['width'] = $attribute['column_value_width'] . '%';
}
if ($Validation->isColor($attribute['line_even_column_name_text_color'])) {
$style['even']['name']['color'] = PBColor::getColor($attribute['line_even_column_name_text_color']);
}
if ($Validation->isColor($attribute['line_even_column_value_text_color'])) {
$style['even']['value']['color'] = PBColor::getColor($attribute['line_even_column_value_text_color']);
}
if ($Validation->isColor($attribute['line_even_column_name_bg_color'])) {
$style['even']['name']['background-color'] = PBColor::getColor($attribute['line_even_column_name_bg_color']);
}
if ($Validation->isColor($attribute['line_even_column_value_bg_color'])) {
$style['even']['value']['background-color'] = PBColor::getColor($attribute['line_even_column_value_bg_color']);
}
if ($Validation->isColor($attribute['line_odd_column_name_text_color'])) {
$style['odd']['name']['color'] = PBColor::getColor($attribute['line_odd_column_name_text_color']);
}
if ($Validation->isColor($attribute['line_odd_column_value_text_color'])) {
$style['odd']['value']['color'] = PBColor::getColor($attribute['line_odd_column_value_text_color']);
}
if ($Validation->isColor($attribute['line_odd_column_name_bg_color'])) {
$style['odd']['name']['background-color'] = PBColor::getColor($attribute['line_odd_column_name_bg_color']);
}
if ($Validation->isColor($attribute['line_odd_column_value_bg_color'])) {
$style['odd']['value']['background-color'] = PBColor::getColor($attribute['line_odd_column_value_bg_color']);
}
$this->lineStyle['even']['name'] = PBHelper::createStyleAttribute($style['even']['name']);
$this->lineStyle['even']['value'] = PBHelper::createStyleAttribute($style['even']['value']);
$this->lineStyle['odd']['name'] = PBHelper::createStyleAttribute($style['odd']['name']);
$this->lineStyle['odd']['value'] = PBHelper::createStyleAttribute($style['odd']['value']);
$class = array('pb-vertical-grid', 'pb-clear-fix', $attribute['css_class']);
$html = '
<div' . PBHelper::createClassAttribute($class) . '>
<ul' . PBHelper::createClassAttribute(array('pb-reset-list')) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</ul>
</div>
';
return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false));
}
示例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;
}
if ($Validation->isEmpty($attribute['url'])) {
if ($Validation->isNumber($attribute['post_id'], 1, 99999999)) {
$url = get_permalink($attribute['post_id']);
} else {
return;
}
} else {
$url = $attribute['url'];
}
if (ob_get_contents()) {
ob_clean();
}
wp_redirect($url, $attribute['status']);
ob_end_flush();
exit;
}
示例9: 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;
}
示例10: 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);
}
示例11: processShortcodeBlockquote
function processShortcodeBlockquote($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$Validation = new PBValidation();
if ($Validation->isEmpty($content)) {
return $html;
}
$class = array('pb-blockquote', $attribute['css_class']);
if ($Validation->isNotEmpty($attribute['author'])) {
$html = '<div class="pb-blockquote-author">— ' . $attribute['author'] . '</div>';
}
$html = '
<div' . PBHelper::createClassAttribute($class) . '>
<blockquote>
' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '
</blockquote>
' . $html . '
</div>
';
return PBHelper::formatHTML($html, PBHelper::formatContent($content));
}
示例12: processShortcodePreformattedText
function processShortcodePreformattedText($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$Validation = new PBValidation();
if ($Validation->isEmpty($content)) {
return $html;
}
if (!$Validation->isBool($attribute['open_default'])) {
return $html;
}
$class = array('pb-preformatted-text');
if ($attribute['open_default'] == 1) {
array_push($class, 'pb-preformatted-text-visible');
}
array_push($class, $attribute['css_class']);
$id = PBHelper::createId('pb_preformatted_text');
$content = nl2br(trim(preg_replace(array('/\\[/', '/\\]/'), array('[', ']'), htmlspecialchars($content))));
$html = '
<div id="' . $id . '"' . PBHelper::createClassAttribute($class) . '>
<a href="#">
<span class="pb-preformatted-text-label-open">' . esc_html($attribute['label_open']) . '</span>
<span class="pb-preformatted-text-label-close">' . esc_html($attribute['label_close']) . '</span>
</a>
<pre>' . $content . '</pre>
</div>
<div class="pb-script-tag">
<script type="text/javascript">
jQuery(document).ready(function($)
{
$("#' . $id . '").PBPreformattedText();
});
</script>
</div>
';
return PBHelper::formatHTML($html);
}
示例13: processShortcodeContactFormLayoutLine
function processShortcodeContactFormLayoutLine($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$Layout = new PBLayout();
$Validation = new PBValidation();
if (!$Layout->isLayout($attribute['layout'])) {
return $html;
}
$columnCount = $Layout->getLayoutColumnCount($attribute['layout']);
for ($i = 1; $i <= $columnCount; $i++) {
$fieldHTML = null;
if (!$Validation->isEmpty($attribute['column_' . $i . '_name'])) {
$field = mb_split(',', $attribute['column_' . $i . '_name']);
foreach ($field as $fieldValue) {
$this->fieldCounter++;
$class = array('pb-clear-fix', 'pb-contact-form-field');
$fieldHTML .= '
<div' . PBHelper::createClassAttribute($class) . '>' . $this->createField($fieldValue) . '</div>
';
}
}
$class = array('pb-layout-' . $Layout->getLayoutColumnCSSClass($attribute['layout'], $i - 1), $attribute['column_' . $i . '_css_class']);
$html .= '
<li' . PBHelper::createClassAttribute($class) . '>' . $fieldHTML . '</li>
';
}
$class = array('pb-reset-list', 'pb-clear-fix', $Layout->getLayoutCSSClass($attribute['layout']));
$html = '
<ul' . PBHelper::createClassAttribute($class) . '>
' . $html . '
</ul>
';
return PBHelper::formatHTML($html);
}
示例14: processShortcodeBoxHeader
function processShortcodeBoxHeader($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$style = array();
$Align = new PBAlign();
$Header = new PBHeader();
$Validation = new PBValidation();
if ($Validation->isEmpty($content)) {
return $html;
}
if (!array_key_exists($attribute['align'], $Align->align)) {
return $html;
}
if (!array_key_exists($attribute['important'], $Header->important)) {
return $html;
}
if ($Validation->isColor($attribute['text_color'])) {
$style['color'] = PBColor::getColor($attribute['text_color']);
}
$class = array('pb-box-header', 'pb-clear-fix', $Align->getCSSClass($attribute['align']));
$html = '
<h' . $attribute['important'] . PBHelper::createClassAttribute($class) . PBHelper::createStyleAttribute($style) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</h' . $attribute['important'] . '>
';
return PBHelper::formatHTML($html, $content);
}
示例15: PBValidation
function processShortcodeTestimonialItemAuthorCompany($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$html = null;
$Validation = new PBValidation();
if ($Validation->isEmpty($content)) {
return $html;
}
$html = '<div' . PBHelper::createClassAttribute(array('pb-testimonial-author-company')) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</div>';
return PBHelper::formatHTML($html, $content);
}