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 processShortcodeTeam($attribute, $content, $tag) { $html = null; $teamHTML = null; $option = array(); $attribute = $this->processAttribute($tag, $attribute); $Window = new PBWindow(); $Easing = new PBEasing(); $Layout = new PBLayout(); $Validation = new PBValidation(); $ImageHover = new PBImageHover(); $data = $this->getTeam($attribute); if ($data === false) { return; } if (!count($data->posts)) { return; } if (!array_key_exists($attribute['template'], $this->template)) { return $html; } if (!array_key_exists($attribute['layout'], $this->layout)) { return $html; } if (!PBFile::isWPImage($attribute['image_size'])) { 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['preloader_enable'])) { return $html; } if (!$Validation->isBool($attribute['skill_list_waypoint_enable'])) { return $html; } if (!$Validation->isNumber($attribute['skill_list_waypoint_duration'], 0, 99999)) { return $html; } if (!array_key_exists($attribute['skill_list_waypoint_easing'], $Easing->easingType)) { return $html; } $key = array('hover_type', 'hover_enable', 'preloader_enable', 'skill_list_waypoint_enable', 'skill_list_waypoint_easing', 'skill_list_waypoint_duration', 'skill_list_waypoint_offset_trigger'); foreach ($key as $index) { $option[$index] = $attribute[$index]; } $layoutCurrent = '100'; if ($attribute['template'] == 2) { $layoutCurrent = '50x50'; } elseif ($attribute['template'] == 3) { $layoutCurrent = $attribute['layout']; } global $post; $bPost = $post; $i = 0; while ($data->have_posts()) { global $post; $data->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']); if ($full == false || $thumbnail == false) { continue; } $meta = PBMeta::get($post); PBHelper::removeUIndex($meta, 'team_social', 'team_skill'); /***/ $class = array(array(), array()); $class[0] = array('pb-layout-' . $Layout->getLayoutColumnCSSClass($layoutCurrent, $i)); $class[1] = array('pb-image-box', 'pb-image-preloader-animation-enable'); $class[2] = array('pb-image'); if ($attribute['preloader_enable'] == 1) { array_push($class[1], 'pb-image-preloader'); } if ($attribute['hover_enable'] == 1) { array_push($class[1], 'pb-image-hover', 'pb-image-hover-type-' . $attribute['hover_type'], 'pb-image-type-image'); } /***/ $textHTML = null; if ($Validation->isNotEmpty($meta['team_first_name']) || $Validation->isNotEmpty($meta['team_second_name'])) { $textHTML .= '<h3 class="pb-team-text-box-member-name">' . trim($meta['team_first_name'] . ' ' . $meta['team_second_name']) . '</h3>'; } if ($Validation->isNotEmpty($meta['team_position'])) { $textHTML .= '<div class="pb-team-text-box-member-position">' . $meta['team_position'] . '</div>'; } /***/ $socialHTML = null; if (is_array($meta['team_social'])) { $social = PBHelper::orderArrayByElement($meta['team_social'], 'team_social_order'); foreach ($social as $index => $value) { if (!array_key_exists($value['team_social_name'], $this->social)) { continue; } $socialHTML .= ' <li> <a href="' . esc_attr($value['team_social_url']) . '" class="pb-team-social-icon-' . $value['team_social_name'] . ' ' . $Window->getTargetCSSClass('_blank') . '"></a> </li> '; } if ($Validation->isNotEmpty($socialHTML)) { $socialHTML = ' <ul class="pb-team-social-icon-box pb-reset-list pb-clear-fix"> ' . $socialHTML . ' </ul> '; } } /***/ $skillHTML = null; if (is_array($meta['team_skill'])) { $skill = PBHelper::orderArrayByElement($meta['team_skill'], 'team_skill_order'); foreach ($skill as $index => $value) { if (!$Validation->isNumber($value['team_skill_level'], 0, 100)) { continue; } $skillHTML .= ' <div class="pb-team-skill pb-value-' . (int) $value['team_skill_level'] . '"> <span class="pb-team-skill-label">' . esc_html($value['team_skill_name']) . '</span> <span class="pb-team-skill-value"> <span class="pb-team-skill-value-value">' . (int) $value['team_skill_level'] . '</span> <span class="pb-team-skill-value-character-after">%</span> </span> <span class="pb-team-skill-foreground"></span> <span class="pb-team-skill-background"></span> </div> '; } if ($Validation->isNotEmpty($skillHTML)) { $skillHTML = ' <div class="pb-team-skill-box"> ' . $skillHTML . ' </div> '; } } /***/ $imageTextHTML = null; if ($Validation->isNotEmpty($meta['team_first_name']) || $Validation->isNotEmpty($meta['team_second_name'])) { $imageTextHTML .= '<' . PBComponentData::get($this->getComponentId(), 'image_text_caption_header_tag') . ' class="pb-image-text-caption">' . trim($meta['team_first_name'] . ' ' . $meta['team_second_name']) . '</' . PBComponentData::get($this->getComponentId(), 'image_text_caption_header_tag') . '>'; } if ($Validation->isNotEmpty($meta['team_position'])) { $imageTextHTML .= '<div class="pb-image-text-description">' . $meta['team_position'] . '</div>'; } if ($Validation->isNotEmpty($imageTextHTML)) { $imageTextHTML = '<div class="pb-image-text">' . $imageTextHTML . '</div>'; } /***/ $imageHTML = null; if ($attribute['hover_enable'] == 1) { $imageHTML = '<a href="' . $full[0] . '"' . PBHelper::createClassAttribute($class[2]) . '><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>'; } if ($Validation->isNotEmpty($imageTextHTML)) { array_push($class[1], 'pb-image-text-enable'); } $imageBoxHTML = '<div' . PBHelper::createClassAttribute($class[1]) . '>' . $imageHTML . $imageTextHTML . '</div>'; /***/ $teamHTML .= ' <li' . PBHelper::createClassAttribute($class[0]) . '> '; switch ($attribute['template']) { case 1: $teamHTML .= '<div class="pb-layout-33x66 pb-clear-fix"><div class="pb-layout-column-left">' . $imageBoxHTML . $socialHTML . '</div><div class="pb-layout-column-right"><div class="pb-team-text-box">' . $textHTML . apply_filters('the_content', do_shortcode(get_the_content())) . '</div>' . $skillHTML . '</div></div>'; break; case 2: $teamHTML .= '<div class="pb-layout-50x50 pb-clear-fix"><div class="pb-layout-column-left">' . $imageBoxHTML . '</div><div class="pb-layout-column-right"><div class="pb-team-quote-box"></div><div class="pb-team-text-box">' . apply_filters('the_content', do_shortcode(get_the_content())) . '</div>' . $socialHTML . '</div></div>'; break; case 3: $teamHTML .= '<div>' . $imageBoxHTML . $socialHTML . '</div>'; break; } $teamHTML .= ' </li> '; $i++; } wp_reset_query(); $post = $bPost; if ($Validation->isEmpty($teamHTML)) { return; } $id = PBHelper::createId('pb_team'); $class = array(); $class[0] = array('pb-team', 'pb-team-template-' . $attribute['template'], 'pb-clear-fix', $attribute['css_class']); $class[1] = array('pb-layout-' . $layoutCurrent, 'pb-reset-list', 'pb-clear-fix'); $html = ' <div' . PBHelper::createClassAttribute($class[0]) . ' id="' . $id . '"> <ul' . PBHelper::createClassAttribute($class[1]) . '> ' . $teamHTML . ' </ul> </div> <div class="pb-script-tag"> <script type="text/javascript"> jQuery(document).ready(function($) { $(\'#' . $id . '\').PBTeam(' . json_encode($option) . '); }); </script> </div> '; return $html; }
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 processShortcodeFeatureItemHeader($attribute, $content, $tag) { $attribute = $this->processAttribute($tag, $attribute); $html = null; $Window = new PBWindow(); $Validation = new PBValidation(); if ($Validation->isEmpty($content)) { return $html; } if (!array_key_exists($this->attrItemURLTarget, $Window->linkTarget)) { return $html; } $content = do_shortcode($content); if ($Validation->isNotEmpty($this->attrItemURL)) { $class = array($Window->getTargetCSSClass($this->attrItemURLTarget)); $content = '<a href="' . esc_attr($this->attrItemURL) . '"' . PBHelper::createClassAttribute($class) . '>' . $content . '</a>'; } $class = array('pb-feature-header'); $html = '<h' . PBComponentData::get($this->getComponentId(), 'header_important_default') . PBHelper::createClassAttribute($class) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</h' . PBComponentData::get($this->getComponentId(), 'header_important_default') . '>'; return PBHelper::formatHTML($html, $content); }