function stpb_generate_text($data) { $data_settings = $data['settings']; $data_settings = wp_parse_args($data_settings, array('text' => '', 'autop' => 0, 'align' => '')); $data_settings['text'] = balanceTags($data_settings['text']); if (isset($data_settings['autop']) && $data_settings['autop'] == 1) { $data_settings['text'] = wpautop($data_settings['text']); } $class = ''; $style = ''; if ($data_settings['align'] != '') { $class .= " text-" . esc_attr($data_settings['align']); } if ($data_settings['color'] != '' && st_is_color($data_settings['color'])) { $style = ' style=" color: ' . $data_settings['color'] . '; "'; } $effect = st_effect_attr($data_settings['effect']); $data_settings['text'] = '<div ' . $style . ' class="item-text-wrapper' . $class . ' ' . $effect['class'] . '" ' . $effect['attr'] . '>' . balanceTags($data_settings['text']) . '</div>'; $data_settings['text'] = apply_filters('stpb_generate_text', $data_settings['text'], $data); return $data_settings['text']; }
/** * PB Item Image */ function st_image_func($atts, $content = '') { $atts = shortcode_atts(array('image' => 0, 'size' => 'thumbnail', 'position' => '', 'link_type' => 'lightbox', 'link' => '#', 'link_target' => '_self', 'effect' => ''), $atts); extract($atts); if ($link_type == '') { $link_type = 'lightbox'; } $image = intval($image); // $link =''; $html = ''; $html .= '<div class="st-image st-image-' . $position . '">'; $image_infor = get_post($image); // $thumb = wp_get_attachment_image($image, $size, $attr = array('alt' => esc_attr(@$image_infor->post_title)) ); $thumb = wp_get_attachment_image_src($image, $size); $thumb = $thumb[0]; if ($thumb != '') { $eef = st_effect_attr($effect); $thumb = '<img class="' . $eef['class'] . '" ' . $eef['attr'] . ' src="' . esc_url($thumb) . '" alt=""/>'; } if ($link != '' && $link_type != 'none') { $a_class = 'image-normal'; if ($link_type == 'lightbox') { $full = wp_get_attachment_image_src($image, 'full'); $link = $full[0]; $a_class = 'single-lightbox'; } $html .= $link != '' ? '<a class="' . $a_class . '" href="' . esc_url($link) . '" target="' . esc_attr($link_target) . '" title="' . esc_attr($image_infor->post_title) . '">' : ''; } else { } $html .= $thumb != '' ? $thumb : ''; $html .= $link != '' ? '</a>' : ''; $html .= '</div>'; $html = apply_filters('st_image_func', $html, $atts); return $html; }
/** * Settings before column start * @param $col_data * @return string */ function column_settings_before($default = '', $data = array()) { $col_data = $data['settings']; if (!is_array($col_data) || empty($col_data)) { return ''; } $col_data = wp_parse_args($col_data, array('_classes' => '', 'mod' => 'boxed', 'inside_mod' => 'boxed', 'custom_class' => '', 'custom_id' => '', 'padding' => '', 'bg_img' => '', 'bg_color' => '', 'bg_attachment' => '', 'bg_repeat' => '', 'margin_bottom' => '', 'margin_top' => '', 'padding_bottom' => '', 'padding_top' => '', 'is_parallax' => 'n', 'opacity' => '', 'effect' => '', 'vertical_align' => '', 'border' => '')); $attrs = array(); $classes = array(); $classes[] = trim($col_data['_classes']); $style = ''; $container_open = ''; if ($col_data['is_parallax'] == 'y' && $col_data['bg_img'] != '') { $attrs[] = ' data-bg="' . esc_attr($col_data['bg_img']) . '" '; $attrs[] = ' data-speed="0.4" '; if (is_numeric($col_data['opacity'])) { $attrs[] = ' data-opacity="' . esc_attr($col_data['opacity']) . '" '; } $classes[] = 'parallax'; } else { } $bg_style = st_bg(array('img' => $col_data['bg_img'], 'color' => $col_data['bg_color'], 'attachment' => $col_data['bg_attachment'], 'repeat' => $col_data['bg_repeat'], 'position' => $col_data['bg_position'])); $is_full_w = false; $fwpd = ''; if ($col_data['padding'] == 'custom') { if (is_numeric($col_data['padding_left'])) { $fwpd .= ' padding-left: ' . esc_attr(trim($col_data['padding_left'])) . 'px; '; } if (is_numeric($col_data['padding_right'])) { $fwpd .= ' padding-right: ' . esc_attr(trim($col_data['padding_right'])) . 'px; '; } } if (strtolower($data['type']) == 'row') { $row_wrapper_class = isset($col_data['mod']) && $col_data['mod'] != '' ? $col_data['mod'] .= '' : 'boxed'; if ($row_wrapper_class == 'full-width') { $is_full_w = true; if ($fwpd != '') { $fwpd = ' style="' . $fwpd . '" '; } if ($col_data['inside_mod'] == 'full-width') { $container_open = ' <div class="rc-inside rc-full-with"' . $fwpd . '> '; } else { $container_open = ' <div class="rc-inside rc-boxed container"' . $fwpd . '> '; } $fwpd = ''; } $row_wrapper_class .= '-mod'; $row_wrapper_class .= ' settings-' . $data['type']; } else { $row_wrapper_class .= ' settings-col'; $reffect = st_effect_attr($col_data['effect']); $classes[] = $reffect['class']; $attrs[] = $reffect['attr']; if ($col_data['vertical_align'] != '' && $col_data['vertical_align'] != 'top') { $classes[] = 'col-va va-' . esc_attr($col_data['vertical_align']); } } if (is_numeric($col_data['margin_bottom'])) { $style .= ' margin-bottom: ' . esc_attr(trim($col_data['margin_bottom'])) . 'px; '; } if (is_numeric($col_data['margin_top'])) { $style .= ' margin-top: ' . esc_attr(trim($col_data['margin_top'])) . 'px; '; } if ($col_data['padding'] == 'custom') { if (is_numeric($col_data['padding_bottom'])) { $style .= ' padding-bottom: ' . esc_attr(trim($col_data['padding_bottom'])) . 'px; '; } if (is_numeric($col_data['padding_top'])) { $style .= ' padding-top: ' . esc_attr(trim($col_data['padding_top'])) . 'px; '; } if (!$is_full_w && $fwpd != '') { $style .= $fwpd; } } if ($style != '' || $bg_style != '') { $style = ' style="' . $style . $bg_style . '" '; } if (!empty($attrs) || $style != '') { $row_wrapper_class .= ' has-custom alt-bg'; } else { $row_wrapper_class .= ' no-custom'; } if ($col_data['custom_id'] != '') { $attrs[] = ' id="' . esc_attr($col_data['custom_id']) . '" '; } $padding = $col_data['padding']; $classes[] = 'custom-settings'; $classes[] = $padding; $classes[] = $row_wrapper_class; if ($col_data['custom_class'] != '') { $classes[] = esc_attr($col_data['custom_class']); } if ($col_data['border'] != '') { $classes[] = esc_attr($col_data['border']); } $attrs[] = ' class="' . esc_attr(join(' ', $classes)) . '" '; return '<div ' . $style . join(' ', $attrs) . '>' . $container_open; }