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); }
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); }
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)); }
function processShortcodeHeader($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->isBool($attribute['underline_enable'])) { 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->isColor($attribute['background_color'])) { $style['background-color'] = PBColor::getColor($attribute['background_color']); } if ($Validation->isNotEmpty($attribute['line_height'])) { $style['line-height'] = $attribute['line_height']; } if ($Validation->isNumber($attribute['text_indent'], 0, 999)) { $style['text-indent'] = $attribute['text_indent'] . 'px'; } $class = array(array('pb-header', $attribute['css_class']), array('pb-header-content'), array('pb-header-underline')); $html = '<h' . (int) $attribute['important'] . PBHelper::createClassAttribute($class[0]) . PBHelper::createStyleAttribute($style) . '><span' . PBHelper::createClassAttribute($class[1]) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</span>' . ($attribute['underline_enable'] == 1 ? '<span' . PBHelper::createClassAttribute($class[2]) . '></span>' : null) . '</h' . (int) $attribute['important'] . '>'; return PBHelper::formatHTML($html, $content); }
function processShortcodeDropcap($attribute, $content, $tag) { $attribute = $this->processAttribute($tag, $attribute); $Validation = new PBValidation(); $style = array(); $class = array('pb-dropcap', 'pb-clear-fix', $attribute['css_class']); if ($Validation->isNumber($attribute['font_size'], 1, 100)) { $style['font-size'] = $attribute['font_size'] . 'px'; } if ($Validation->isColor($attribute['font_color'])) { $style['color'] = PBColor::getColor($attribute['font_color']); } if ($Validation->isColor($attribute['bg_color'])) { $style['background-color'] = PBColor::getColor($attribute['bg_color']); } $letter = mb_substr($content, 0, 1); $content = mb_substr($content, 1); $html = ' <p' . PBHelper::createClassAttribute($class) . '> <span class="pb-dropcap-first-letter" ' . PBHelper::createStyleAttribute($style) . '>' . $letter . '</span>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . ' </p> '; return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false)); }
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'); } array_push($class, 'pb-reset-list', 'pb-clear-fix', $attribute['css_class']); $html = ' <ul' . PBHelper::createClassAttribute($class) . ' id="' . esc_attr($id) . '"> ' . $html . ' </ul> <div class="pb-script-tag"> <script type="text/javascript"> jQuery(document).ready(function($) { $(\'#' . $id . '\').PBSocialIcon(' . json_encode($option) . '); }); </script> </div> '; return PBHelper::formatHTML($html); }
function processShortcodeCallToActionButton($attribute, $content, $tag) { $attribute = $this->processAttribute($tag, $attribute); $style = array(); $option = array(); $Window = new PBWindow(); $Validation = new PBValidation(); $src = !$Validation->isEmpty($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); }
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); }
function processShortcodeButton($attribute, $content, $tag) { $attribute = $this->processAttribute($tag, $attribute); $html = null; $option = array(); $class = array_fill(0, 4, array()); $style = array_fill(0, 4, array()); $Font = new PBFont(); $Window = new PBWindow(); $Border = new PBBorder(); $Validation = new PBValidation(); if ($Validation->isEmpty($content)) { return $html; } if ($Validation->isEmpty($attribute['src'])) { return $html; } if (!$Validation->isBool($attribute['arrow_enable'])) { return $html; } if (!$Validation->isBool($attribute['icon_enable'])) { return $html; } if (!array_key_exists($attribute['size'], $this->buttonSize)) { return $html; } if (!array_key_exists($attribute['src_target'], $Window->linkTarget)) { return $html; } if ($attribute['icon_enable'] == 1) { if ($Validation->isEmpty($attribute['icon'])) { return $html; } if (!in_array($attribute['icon_position'], array_keys($this->buttonIconPosition))) { return $html; } } /***/ if ($Validation->isColor($attribute['text_color'])) { $style[1]['color'] = PBColor::getColor($attribute['text_color']); $option['out']['color'] = $style[1]['color']; } if ($Validation->isColor($attribute['bg_color'])) { $style[1]['background-color'] = PBColor::getColor($attribute['bg_color']); $option['out']['background-color'] = $style[1]['background-color']; } if ($attribute['border_style'] != -1) { if (array_key_exists($attribute['border_style'], $Border->style)) { $style[1]['border-style'] = $attribute['border_style']; $option['out']['border-style'] = $style[1]['border-style']; } } if ($Validation->isColor($attribute['border_color'])) { $style[1]['border-color'] = PBColor::getColor($attribute['border_color']); $option['out']['border-color'] = $style[1]['border-color']; } if ($Validation->isNumber($attribute['border_width'], 0, 999)) { $style[1]['border-width'] = $attribute['border_width'] . 'px'; $option['out']['border-width'] = $style[1]['border-width']; } if ($Validation->isNumber($attribute['border_radius'], 0, 999)) { $style[1]['border-radius'] = $attribute['border_radius'] . 'px'; $option['out']['border-radius'] = $style[1]['border-radius']; } if ($attribute['font_weight'] != -1) { if (array_key_exists($attribute['font_weight'], $Font->weight)) { $style[1]['font-weight'] = $attribute['font_weight']; $option['out']['font-weight'] = $style[1]['font-weight']; } } /***/ 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 ($attribute['border_style_hover'] != -1) { if (array_key_exists($attribute['border_style_hover'], $Border->style)) { $option['in']['border-style'] = $attribute['border_style_hover']; } } if ($Validation->isColor($attribute['border_color_hover'])) { $option['in']['border-color'] = PBColor::getColor($attribute['border_color_hover']); } if ($Validation->isNumber($attribute['border_width_hover'], 0, 999)) { $option['in']['border-width'] = $attribute['border_width_hover'] . 'px'; } if ($Validation->isNumber($attribute['border_radius_hover'], 0, 999)) { $option['in']['border-radius'] = $attribute['border_radius_hover'] . 'px'; } if ($attribute['font_weight'] != -1) { if (array_key_exists($attribute['font_weight_hover'], $Font->weight)) { $option['in']['font-weight'] = $attribute['font_weight_hover']; } } /***/ $class[0] = array('pb-button'); $class[1] = array($Window->getTargetCSSClass($attribute['src_target'])); $class[2] = array('pb-button-icon'); $class[3] = array('pb-button-content'); array_push($class[0], 'pb-button-size-' . $attribute['size']); if ($attribute['icon_enable'] == 1) { array_push($class[0], 'pb-button-icon'); array_push($class[0], 'pb-button-icon-position-' . $attribute['icon_position']); array_push($class[2], 'pb-button-icon-' . PBHelper::createHash($attribute['icon'])); } $class[0][] = $attribute['css_class']; $id = PBHelper::createId('pb_button'); $html = ' <div' . PBHelper::createClassAttribute($class[0]) . ' id="' . $id . '"> <a href="' . esc_attr($attribute['src']) . '"' . PBHelper::createClassAttribute($class[1]) . PBHelper::createStyleAttribute($style[1]) . '> <span class="pb-button-box"> <span' . PBHelper::createClassAttribute($class[2]) . PBHelper::createStyleAttribute($style[2]) . '></span> <span' . PBHelper::createClassAttribute($class[3]) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . ($attribute['arrow_enable'] == 1 ? '<i class="pb-button-arrow pb-button-arrow-right"></i>' : null) . '</span> </span> </a> <div class="pb-script-tag"> <script type="text/javascript"> jQuery(document).ready(function($) { $(\'#' . $id . '\').PBButton(' . json_encode($option) . '); }); </script> </div> </div> '; return PBHelper::formatHTML($html, $content); }
function processShortcodeFeature($attribute, $content, $tag) { $attribute = $this->processAttribute($tag, $attribute); $html = null; $Border = new PBBorder(); $Layout = new PBLayout(); $Easing = new PBEasing(); $Validation = new PBValidation(); $CarouFredSel = new PBCarouFredSel(); /***/ if (!array_key_exists($attribute['layout'], $this->layout)) { return $html; } if (!array_key_exists($attribute['icon_position'], $this->iconPosition)) { return $html; } if (!$Validation->isBool($attribute['carousel_autoplay_enable'])) { return $html; } if (!$Validation->isBool($attribute['carousel_circular_enable'])) { return $html; } if (!$Validation->isBool($attribute['carousel_infinite_enable'])) { return $html; } if (!$Validation->isBool($attribute['carousel_scroll_pause_hover'])) { return $html; } if (!array_key_exists($attribute['carousel_scroll_fx'], $CarouFredSel->scrollFX)) { return $html; } if (!array_key_exists($attribute['carousel_scroll_easing'], $Easing->easingType)) { return $html; } if (!$Validation->isNumber($attribute['carousel_scroll_duration'], 0, 99999)) { return $html; } if (!array_key_exists($attribute['waypoint_type'], $this->waypointType)) { return $html; } if (!$Validation->isNumber($attribute['waypoint_duration'], 0, 99999)) { return $html; } if (!$Validation->isNumber($attribute['waypoint_opacity_initial'], 0, 100)) { return $html; } if (!array_key_exists($attribute['icon_size'], $this->icon)) { return $html; } /***/ $this->attrLayout = $attribute['layout']; $this->attrLayoutColumnIndex = 0; $option = array(); $key = array('carousel_enable', 'carousel_autoplay_enable', 'carousel_circular_enable', 'carousel_infinite_enable', 'carousel_scroll_pause_hover', 'carousel_scroll_fx', 'carousel_scroll_easing', 'carousel_scroll_duration'); foreach ($key as $index) { $option['carousel'][$index] = $attribute[$index]; } $key = array('waypoint_type', 'waypoint_easing', 'waypoint_duration', 'waypoint_offset_trigger', 'waypoint_opacity_initial'); foreach ($key as $index) { $option['waypoint'][$index] = $attribute[$index]; } /**/ $this->style = array('odd' => array(), 'even' => array()); foreach ($this->style as $index => $value) { if (PBComponentData::get($this->getComponentId(), 'icon_type') !== 'gr') { if ($Validation->isColor($attribute['element_' . $index . '_icon_color'])) { $this->style[$index]['color'] = PBColor::getColor($attribute['element_' . $index . '_icon_color']); } } if ($Validation->isColor($attribute['element_' . $index . '_icon_bg_color'])) { $this->style[$index]['background-color'] = PBColor::getColor($attribute['element_' . $index . '_icon_bg_color']); } if (array_key_exists($attribute['element_' . $index . '_icon_border_style'], $Border->style)) { $this->style[$index]['border-style'] = $attribute['element_' . $index . '_icon_border_style']; } if ($Validation->isColor($attribute['element_' . $index . '_icon_border_color'])) { $this->style[$index]['border-color'] = PBColor::getColor($attribute['element_' . $index . '_icon_border_color']); } if ($Validation->isNumber($attribute['element_' . $index . '_icon_border_width'], 0, 999)) { $this->style[$index]['border-width'] = $attribute['element_' . $index . '_icon_border_width'] . 'px'; } if ($Validation->isNumber($attribute['element_' . $index . '_icon_border_radius'], 0, 100)) { $this->style[$index]['border-radius'] = $attribute['element_' . $index . '_icon_border_radius'] . '%'; } } /**/ $this->attrIconSize = $attribute['icon_size']; $this->attrIconPosition = $attribute['icon_position']; $id = PBHelper::createId('pb_feature'); $class = array(array('pb-feature', 'pb-feature-icon-size-' . $attribute['icon_size'], 'pb-feature-icon-position-' . $attribute['icon_position'], 'pb-clear-fix'), array($Layout->getLayoutCSSClass($attribute['layout']), 'pb-reset-list', 'pb-clear-fix')); if (PBComponentData::get($this->getComponentId(), 'icon_type') === 'gr') { array_push($class[0], 'pb-feature-icon-type-gr'); } else { array_push($class[0], 'pb-feature-icon-type-fa'); } array_push($class[0], $attribute['css_class']); $html = ' <div' . PBHelper::createClassAttribute($class[0]) . ' id="' . $id . '"> <ul' . PBHelper::createClassAttribute($class[1]) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</ul> <div class="pb-slider-pagination"></div> </div> <div class="pb-script-tag"> <script type="text/javascript"> jQuery(document).ready(function($) { $("#' . $id . '").PBFeature(' . json_encode($option) . '); }); </script> </div> '; return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false)); }
function validateProperty($property) { $data = array(); $Validation = new PBValidation(); foreach ($property as $name => $value) { $unit = 'px'; if (is_array($value)) { if (isset($value['unit'])) { $unit = $value['unit']; } if (isset($value['value'])) { $value = $value['value']; } } switch ($name) { case 'left': case 'width': case 'height': case 'font-size': case 'padding-top': case 'padding-left': case 'padding-right': case 'padding-bottom': if ($Validation->isNumber($value, 0, 9999)) { $data[$name] = $value . $unit; } break; case 'top': case 'margin-top': case 'margin-left': case 'margin-right': case 'margin-bottom': if ($Validation->isNumber($value, -9999, 9999)) { $data[$name] = $value . $unit; } break; case 'color': case 'border-color': case 'border-top-color': case 'border-right-color': case 'border-bottom-color': case 'border-left-color': case 'outline-color': case 'background-color': $value = PBColor::getColor($value); if ($Validation->isNotEmpty($value)) { $data[$name] = $value; } break; case 'font-family': foreach ((array) $value as $family) { if ($Validation->isNotEmpty($family)) { PBHelper::removeUIndex($data, $name); if ($Validation->isNotEmpty($data[$name])) { $data[$name] .= ','; } $data[$name] .= '\'' . $family . '\''; } } break; case 'font-style': if (isset($this->fontStyle[$value])) { $data[$name] = $value; } break; case 'font-weight': if (isset($this->fontWeight[$value])) { $data[$name] = $value; } break; case 'display': case 'background': case 'background-repeat': case 'background-position': if ($Validation->isNotEmpty($value)) { $data[$name] = $value; } break; case 'background-image': if ($Validation->isNotEmpty($value)) { $data[$name] = 'url(\'' . $value . '\')'; } break; } } return $data; }
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); }
function processShortcodeNoticeSecondLine($attribute, $content, $tag) { $attribute = $this->processAttribute($tag, $attribute); $style = array(); $Validation = new PBValidation(); if ($Validation->isColor($attribute['text_color'])) { $style['color'] = PBColor::getColor($attribute['text_color']); } $class = array('pb-notice-second-line'); $html = ' <p' . PBHelper::createClassAttribute($class) . PBHelper::createStyleAttribute($style) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</p> '; return PBHelper::formatHTML($html, $content); }
function processShortcodeLayout($attribute, $content, $tag) { $attribute = $this->processAttribute($tag, $attribute); $Border = new PBBorder(); $Layout = new PBLayout(); $Background = new PBBackground(); $Validation = new PBValidation(); $style = array(); $option = array(); if (!$Layout->isLayout($attribute['layout'])) { return; } if (!$Layout->isLayoutLine($attribute['layout_line'])) { return; } if (!$Validation->isBool($attribute['bg_parallax_enable'])) { return; } if (!$Validation->isBool($attribute['bg_parallax_mobile_enable'])) { return; } if (!$Validation->isNumber($attribute['bg_parallax_speed'], 0, 100)) { return; } if ($Validation->isColor($attribute['bg_color'])) { $style['background-color'] = PBColor::getColor($attribute['bg_color']); } if ($Validation->isNotEmpty($attribute['bg_position'])) { $style['background-position'] = $attribute['bg_position']; } if ($Validation->isNotEmpty($attribute['bg_repeat'])) { $style['background-repeat'] = $attribute['bg_repeat']; } if ($Validation->isNotEmpty($attribute['bg_image'])) { $style['background-image'] = 'url(\'' . $attribute['bg_image'] . '\')'; } if ($Validation->isNotEmpty($attribute['bg_size_a'])) { if (array_key_exists($attribute['bg_size_a'], $Background->backgroundSize)) { if (in_array($attribute['bg_size_a'], array('length', 'percentage'))) { if ($Validation->isNotEmpty($attribute['bg_size_b'])) { $style['background-size'] = $attribute['bg_size_b']; } } else { $style['background-size'] = $attribute['bg_size_a']; } } } if (!$Validation->isBool($attribute['video_loop'])) { return; } if (!$Validation->isBool($attribute['video_muted'])) { return; } if (!$Validation->isBool($attribute['video_autoplay'])) { return; } if (!$Validation->isBool($attribute['video_control'])) { return; } if ($Validation->isNotEmpty($attribute['padding_top'])) { $style['padding-top'] = (int) $attribute['padding_top'] . 'px'; } if ($Validation->isNotEmpty($attribute['padding_right'])) { $style['padding-right'] = (int) $attribute['padding_right'] . 'px'; } if ($Validation->isNotEmpty($attribute['padding_bottom'])) { $style['padding-bottom'] = (int) $attribute['padding_bottom'] . 'px'; } if ($Validation->isNotEmpty($attribute['padding_left'])) { $style['padding-left'] = (int) $attribute['padding_left'] . 'px'; } if (array_key_exists($attribute['border_top_style'], $Border->style)) { $style['border-top-style'] = $attribute['border_top_style']; } if ($Validation->isNumber($attribute['border_top_width'], 0, 999)) { $style['border-top-width'] = $attribute['border_top_width'] . 'px'; } if ($Validation->isColor($attribute['border_top_color'])) { $style['border-top-color'] = PBColor::getColor($attribute['border_top_color']); } if (array_key_exists($attribute['border_right_style'], $Border->style)) { $style['border-right-style'] = $attribute['border_right_style']; } if ($Validation->isNumber($attribute['border_right_width'], 0, 999)) { $style['border-right-width'] = $attribute['border_right_width'] . 'px'; } if ($Validation->isColor($attribute['border_right_color'])) { $style['border-right-color'] = PBColor::getColor($attribute['border_right_color']); } if (array_key_exists($attribute['border_bottom_style'], $Border->style)) { $style['border-bottom-style'] = $attribute['border_bottom_style']; } if ($Validation->isNumber($attribute['border_bottom_width'], 0, 999)) { $style['border-bottom-width'] = $attribute['border_bottom_width'] . 'px'; } if ($Validation->isColor($attribute['border_bottom_color'])) { $style['border-bottom-color'] = PBColor::getColor($attribute['border_bottom_color']); } if (array_key_exists($attribute['border_left_style'], $Border->style)) { $style['border-left-style'] = $attribute['border_left_style']; } if ($Validation->isNumber($attribute['border_left_width'], 0, 999)) { $style['border-left-width'] = $attribute['border_left_width'] . 'px'; } if ($Validation->isColor($attribute['border_left_color'])) { $style['border-left-color'] = PBColor::getColor($attribute['border_left_color']); } /***/ $MobileDetect = new Mobile_Detect(); $mobile = (int) $MobileDetect->isMobile(); /***/ $videoHTML = null; $video = $Validation->isNotEmpty($attribute['video_format_webm']) || $Validation->isNotEmpty($attribute['video_format_ogg']) || $Validation->isNotEmpty($attribute['video_format_mp4']); if ($video && $attribute['video_mobile_enable'] != 1) { PBInclude::includeClass(PLUGIN_PAGE_BUILDER_LIBRARY_PATH . 'mobileDetect/Mobile_Detect.php', array('Mobile_Detect')); if ($mobile) { $video = false; } } if ($video) { $sourceHTML = null; $videoControlHTML = null; $videoAttributeHTML = null; if ($Validation->isNotEmpty($attribute['video_format_mp4'])) { $sourceHTML .= '<source type="video/mp4" src="' . esc_attr($attribute['video_format_mp4']) . '" />'; } if ($Validation->isNotEmpty($attribute['video_format_webm'])) { $sourceHTML .= '<source type="video/webm" src="' . esc_attr($attribute['video_format_webm']) . '" />'; } if ($Validation->isNotEmpty($attribute['video_format_ogg'])) { $sourceHTML .= '<source type="video/ogg" src="' . esc_attr($attribute['video_format_ogg']) . '" />'; } if ($attribute['video_loop']) { $videoAttributeHTML .= ' loop'; } if ($attribute['video_muted']) { $videoAttributeHTML .= ' muted'; } if ($attribute['video_autoplay']) { $videoAttributeHTML .= ' autoplay'; } if ($attribute['video_control'] == 1) { $videoControlHTML = ' <div class="pb-line-video-control"> <a href="#" class="pb-line-video-control-toggle-play pb-line-video-control-toggle-play-' . ($attribute['video_autoplay'] == 1 ? 'on' : 'off') . '"></a> <a href="#" class="pb-line-video-control-toggle-sound pb-line-video-control-toggle-sound-' . ($attribute['video_muted'] == 1 ? 'off' : 'on') . '"></a> </div> '; } $videoHTML = ' <div class="pb-line-video"> <video preload="auto"' . $videoAttributeHTML . '> ' . $sourceHTML . ' </video> </div> ' . $videoControlHTML . ' '; } /***/ $overlay = false; $overlayHTML = null; if ($Validation->isColor($attribute['overlay_color'])) { $overlay = true; $overlayHTML = '<div class="pb-line-overlay" style="background-color:' . PBColor::getColor($attribute['overlay_color']) . '"></div>'; } /***/ $class = array(array('pb-line', 'pb-clear-fix', $attribute['css_class'], $video || $overlay ? 'pb-line-include-video' : null), array('pb-layout', $Layout->getLayoutCSSClass($attribute['layout']), 'pb-reset-list', 'pb-clear-fix')); if (in_array($attribute['layout_line'], array('boxed'))) { $class[0][] = 'pb-main'; } if (in_array($attribute['layout_line'], array('boxed', 'wide', ''))) { $class[1][] = 'pb-main'; } $key = array('bg_parallax_speed', 'bg_parallax_enable', 'bg_parallax_mobile_enable'); foreach ($key as $index) { $option[$index] = $attribute[$index]; } $id = PBHelper::createId('pb_line'); $css = esc_attr($attribute['css_group']); if ($Validation->isNotEmpty($css)) { array_push($class[0], 'pb-line-css-group-' . $css); } PBComponentData::set('layout', 'index', 0); PBComponentData::set('layout', 'layout', $attribute['layout']); $html = ' <div id="' . $id . '" ' . PBHelper::createClassAttribute($class[0]) . PBHelper::createStyleAttribute($style) . '> ' . $videoHTML . ' ' . $overlayHTML . ' <ul' . PBHelper::createClassAttribute($class[1]) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</ul> </div> <div class="pb-script-tag"> <script type="text/javascript"> jQuery(document).ready(function($) { $("#' . $id . '").PBLayout(' . json_encode($option) . ',' . $mobile . '); }); </script> </div> '; return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false)); }
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 (PBComponentData::get($this->getComponentId(), 'icon_type') === 'gr') { if (array_key_exists($attribute['bullet'], $this->bullet['file'])) { array_push($class[0], 'pb-sitemap-icon-type-gr', 'pb-sitemap-icon-name-' . PBHelper::createHash($attribute['bullet'])); } } $iconHTML = null; if (PBComponentData::get($this->getComponentId(), 'icon_type') === 'fa') { if ($Validation->isNotEmpty($attribute['font_icon_name'])) { $style = array(); if ($Validation->isColor($attribute['font_icon_color'])) { $style['color'] = PBColor::getColor($attribute['font_icon_color']); } if ($Validation->isNumber($attribute['font_icon_size'], 1, 200)) { $style['font-size'] = $attribute['font_icon_size'] . 'px'; } array_push($class[0], 'pb-sitemap-icon-type-fa'); $iconHTML = '<i class="fa fa-' . esc_attr($attribute['font_icon_name']) . '"' . PBHelper::createStyleAttribute($style) . '></i>'; } } global $post; $bPost = $post; while ($query->have_posts()) { $query->the_post(); $html .= ' <li id="post-' . get_the_ID() . '" class="' . implode(' ', get_post_class()) . '"> ' . $iconHTML . ' <a href="' . get_the_permalink() . '">' . preg_replace('/\\<br\\/\\>/', ' ', 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); }