queue as $script ) : if ( preg_match('/\b(\w*bootstrap\w*)\b/', $script, $matches) ) return true; endforeach; return false; } function fruitful_is_bootstrap_css_loaded() { global $wp_styles; foreach( $wp_styles->queue as $style ) : if ( preg_match('/\b(\w*bootstrap\w*)\b/', $style, $matches) ) return true; endforeach; return false; } function fruitful_description_box ($atts, $content = null) { $out = ''; extract(shortcode_atts(array( 'id' => '', 'style' => '', 'shadowtype' => '' ), $atts, 'fruitful_dbox')); $id = 'desc-box-' . rand( 1, 100 ); if (wp_is_mobile()) { $style = ' font-size: 20px; text-transform : uppercase; text-align: center; font-weight: 300; line-height: 1.2;'; } else { $style = ' font-size: 40px; text-transform : uppercase; text-align: center; font-weight: 300; line-height: 1.2;'; } if (!empty($atts['id'])) { $id = sanitize_html_class($atts['id']); } if (!empty($atts['style'])) { $style = esc_html($atts['style']); } if (!empty($atts['shadowtype'])){ $type = esc_html($atts['shadowtype']); } $out .= '
'; $out .= '
'; $out .= ''; if (!empty($content)) { $out .= '
' . $content . '
'; } else { $out .= '
No text Description
'; } $out .= ''; $out .= '
'; $out .= '
'; $out .= '
'; return $out; } add_shortcode ("fruitful_dbox", "fruitful_description_box"); function fruitful_ibox_row_shortcode ($atts, $content = null) { $out = ""; extract(shortcode_atts(array( 'id' => '' ), $atts, 'fruitful_ibox_row')); $id = 'info-box-row-' . rand( 1, 100 ); if (isset($atts['id'])) { $id = sanitize_html_class($atts['id']); } $out .= '
'; $out .= fruitful_sh_esc_content_pbr(do_shortcode($content)); $out .= '
'; $out .= '
'; return $out; } add_shortcode('fruitful_ibox_row', 'fruitful_ibox_row_shortcode'); /*Add information box into content block*/ function fruitful_info_box ($atts, $content = null) { $image = $title = $column = $class = $styletext = $styletitle = $out = $link = ''; $last = false; extract(shortcode_atts(array( 'column' => '', 'title' => '', 'class' => '', 'link' => '#', 'image' => '', 'alt' => '', 'icon' => 'fa-check-square-o', 'icon_position' => 'center', 'styletext' => 'font-size:13px; ', 'styletitle' => 'font-size:20px; text-transform: uppercase; ', 'styleicon' => 'background-color:#000; color:#fff; border-radius:50%; ', 'last' => '' ), $atts)); $id = 'info-box-' . rand( 1, 100 ); if (isset($column)) { $column = sanitize_html_class($column); } if (isset($title)) { $title = esc_attr($title); } if (isset($class)) { $class = sanitize_html_class($class); } if (isset($image)) { $image = esc_url ($image); } if (isset($alt)) { $alt = esc_html ($alt); } if (isset($styletext)) { $styletext = esc_html($styletext); } if (isset($styletitle)) { $styletitle = esc_html($styletitle); } if (isset($last)) { if ($last) $last = 'last'; } else { $last = ''; } if (isset($icon_position)) { $icon_position = sanitize_html_class($icon_position);} if (isset($icon)) { $icon = sanitize_html_class($icon);} if ($icon_position == 'left') { $styletext = 'text-align:left; '.$styletext ; $styletitle = 'text-align:left; '.$styletitle ; } else if ($icon_position == 'right') { $styletext = 'text-align:right; '.$styletext ; $styletitle = 'text-align:right; '.$styletitle ; } else { $styletext = 'text-align:center; '.$styletext ; $styletitle = 'text-align:center; '.$styletitle ; } $out .= '
'; if (($link != '') && ($link != '#')) { $out .= ''; } if (($image != '') || ($icon != '')) { $out .= '
'; if ($image != '') { $out .= '' . $alt . ''; } else { if ($icon != '') $out .= ''; } $out .= '
'; } $out .= '
'; if ($title != '') { $out .= '
' . $title . '
'; } if ($content != '') { $out .= '
' . fruitful_sh_esc_content_pbr(do_shortcode($content)) . '
'; } $out .= '
'; if (($link != '') && ($link != '#')) { $out .= '
'; } $out .= '
'; return $out; } add_shortcode ("fruitful_ibox", "fruitful_info_box"); function fruitful_tabs_shortcode($atts, $content = null) { $output = ''; $tab_titles = array(); $tabs_class = 'tab_titles'; extract(shortcode_atts( array( 'id' => '', 'type' => '', 'width' => '', 'fit' => '', 'widthtab' => '', 'tabcolor' => '#71AFFF', 'closed' => 'true' ), $atts, 'fruitful_tabs')); static $tab_id = 0; ++$tab_id; $id = 'ffs-tabbed-' . $tab_id; $type = 'default'; $width = 'auto'; $fit = 'false'; $link = '#'; $widthtab = '30%'; if (isset($atts['id'])) { $id = sanitize_html_class($atts['id']); } if (isset($atts['type'])) { $type = esc_js($atts['type']); } if (isset($atts['width'])) { $width = esc_js($atts['width']); } if (isset($atts['fit'])) { $fit = esc_js($atts['fit']); } if (isset($atts['widthtab'])) { $widthtab = esc_js($atts['widthtab']); } if (isset($atts['tabcolor'])) { $tabcolor = esc_html($atts['tabcolor']); } if (isset($atts['closed'])) { $closed = esc_html($atts['closed']); } $output .= ''; $output .= ''; preg_match_all( '/tab title="([^\"]+)"/i', $content, $matches, PREG_OFFSET_CAPTURE ); if ( isset( $matches[1] ) ) { $tabs = $matches[1]; } $output .= '
'; $output .= ''; $output .= '
'; $output .= fruitful_sh_esc_content_pbr(do_shortcode($content)); $output .= '
'; $output .= '
'; $output .= '
'; return $output; } add_shortcode('fruitful_tabs', 'fruitful_tabs_shortcode'); function fruitful_tab_shortcode ( $atts, $content = null ) { extract(shortcode_atts( array( 'title' => 'Tab' ), $atts)); $class = ''; if ( $title != 'Tab' ) { $class = ' tab-' . sanitize_title( $title ); } return '
' . do_shortcode( $content ) . '
'; } add_shortcode( 'fruitful_tab', 'fruitful_tab_shortcode', 99 ); function fruitful_tab_link_shortcode ( $atts, $content = null ) { extract(shortcode_atts( array( 'item' => '1' ), $atts)); return '' . do_shortcode( $content ) . ''; } add_shortcode( 'fruitful_tab_link', 'fruitful_tab_link_shortcode', 100 ); function fruitful_sep ($atts, $content = null) { $out = $height = $style = ''; extract(shortcode_atts(array( 'id' => 'ffs-sep-' . rand( 1, 100 ), 'height' => 10, 'style' => 'border-bottom:1px solid #ebebeb; ' ), $atts)); if (!empty($id)) { $id = sanitize_html_class($id); } if (!empty($height)) { $height = sanitize_html_class($height); } if (!empty($style)) { $style = esc_html($style); } $out .= '
'; return $out; } add_shortcode ("fruitful_sep", "fruitful_sep"); function fruitful_alert_shortcode ($atts, $content = null) { $out = $type = ''; extract(shortcode_atts(array( 'id' => 'ffs-alert-' . rand( 1, 100 ), 'type' => '' ), $atts, 'fss_alert')); $array_class = array(); $array_class[] = 'alert'; $array_class[] = 'alert-dismissible'; if (!empty($id)) $id = sanitize_html_class($id); if (!empty($type)) $array_class[] = sanitize_html_class($type); $out .= '
'; $out .= '
'; $out .= ''; $out .= fruitful_sh_esc_content_pbr($content); $out .= '
'; $out .= '
'; $out .= '
'; return $out; } add_shortcode ("fruitful_alert", "fruitful_alert_shortcode"); function fruitful_pbar_shortcode ($atts, $content = null) { $out = $type = $class = ''; extract(shortcode_atts(array( 'id' => 'ffs-pbar-' . rand( 1, 250 ) ), $atts)); $array_class = array(); $array_class[] = 'progress'; if (!empty($id)) $id = sanitize_html_class($id); $out .= '
'; $out .= fruitful_sh_esc_content_pbr(do_shortcode($content)); $out .= '
'; return ''. $out . '
'; } add_shortcode ("fruitful_pbar", "fruitful_pbar_shortcode"); /* Types: - progress-bar-success - progress-bar-info - progress-bar-warning - progress-bar-danger */ function fruitful_bar_shortcode ( $atts, $content = null ) { $type = $width = ''; extract(shortcode_atts(array( 'type' => '', 'active' => false, 'stripped' => false, 'width' => '60%', ), $atts)); $stripped = filter_var($stripped, FILTER_VALIDATE_BOOLEAN); $active = filter_var($active, FILTER_VALIDATE_BOOLEAN); $array_class = array(); $array_class[] = 'progress-bar'; if (!empty($type)) $array_class[] = sanitize_html_class($type); if ($active) $array_class[] = 'active'; if (!empty($width)) $width = esc_attr($width); if ($stripped) $array_class[] = 'progress-bar-striped'; return '
'; } add_shortcode( 'fruitful_bar', 'fruitful_bar_shortcode', 99 ); /* Size: Default, mini, small, large Color: Default, primary, info, success, warning, danger, inverse Type: link, button, input, sumbit State: active, disabled Text color: #fff Icon: Font Awesome Icon position: left, right */ function fruitful_btn_shortcode ( $atts, $content = null ) { $out = $size = $color = $type = $state = $text_color = $icon = $icon_position = $link = $options = $target = $target_output = ""; extract(shortcode_atts(array( 'size' => 'small', 'color' => 'primary', 'type' => 'link', 'state' => '', 'text_color' => 'fff', 'icon' => '', 'icon_position' => 'left', 'link' => '#', 'target' => '' ), $atts)); $id = 'ffs-button-' . rand( 1, 1000 ); if (!empty($size)) $size = sanitize_html_class($size); if (!empty($color)) $color = sanitize_html_class($color); if (!empty($type)) $type = sanitize_html_class($type); if (!empty($state)) $state = sanitize_html_class($state); if (!empty($text_color)) $text_color = esc_attr($text_color); if (!empty($icon)) $icon = sanitize_html_class($icon); if (!empty($icon_position)) $icon_position = sanitize_html_class($icon_position); if (!empty($link)) $link = fruitful_sh_esc_link($link); if (!empty($target)) $target = sanitize_html_class($target); if (($size == 'mini') || ($size == 'small') || ($size == 'large')) $options .= ' btn-' . $size; if (($color == 'primary') || ($color == 'info') || ($color == 'success') || ($color == 'warning') || ($color == 'danger') || ($color == 'inverse') ) { $options .= ' btn-' . $color; } $options .= ' '. $state; $text_color = '#' .$text_color; $content = do_shortcode(fruitful_sh_esc_content_pbr($content)); if ($target == '_blank'){ $target_output = 'target="_blank"'; } else { $target_output = ''; } if ($type == 'link') { $out = ''; if ($icon != '') { if ($icon_position == 'right') { $out .= $content; } if ($icon != '') { $out .= ''; } if ($icon_position == 'left') { $out .= $content; } } else { $out .= $content; } $out .= ''; } else if ($type == 'input') { $out = ''; } else if ($type == 'submit') { $out = ''; } else { $out = ''; } return ''. $out . ''; } add_shortcode( 'fruitful_btn', 'fruitful_btn_shortcode', 99 ); function fruitful_sh_esc_content_pbr($content = null) { $content = preg_replace( '%

 \s*

%', '', $content ); $Old = array( '
', '
' ); $New = array( '','' ); $content = str_replace( $Old, $New, $content ); return $content; } function fruitful_sh_esc_link($link){ $link = esc_url(str_replace('”','',str_replace('“','',$link))); return $link; } function get_comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) { global $wpcommentspopupfile, $wpcommentsjavascript; $id = get_the_ID(); $title = get_the_title(); $number = get_comments_number( $id ); if ( false === $zero ) { /* translators: %s: post title */ $zero = sprintf( __( 'No Comments on %s' ), $title ); } if ( false === $one ) { /* translators: %s: post title */ $one = sprintf( __( '1 Comment on %s' ), $title ); } if ( false === $more ) { /* translators: 1: Number of comments 2: post title */ $more = _n( '%1$s Comment on %2$s', '%1$s Comments on %2$s', $number ); $more = sprintf( $more, number_format_i18n( $number ), $title ); } if ( false === $none ) { /* translators: %s: post title */ $none = sprintf( __( 'Comments Off on %s' ), $title ); } $out = ''; if ( 0 == $number && !comments_open() && !pings_open() ) { $out .= '' . $none . ''; return; } if ( post_password_required() ) { _e( 'Enter your password to view comments.' ); return; } $out .= ' 4, 'cat' => '' ), $atts)); if(!empty($cat)) { $cats = explode(", ", $cat); $args = array( 'orderby' => 'date', 'order' => 'DESC', 'post_type' => 'post', 'post_status' => 'publish', 'post__not_in' => array($this_id), 'ignore_sticky_posts' => true, 'posts_per_page'=> $posts, 'tax_query' => array( array( 'taxonomy' => 'category', 'field' => 'slug', 'terms' => $cats ) ) ); } else { $args = array( 'orderby' => 'date', 'order' => 'DESC', 'post_type' => 'post', 'post_status' => 'publish', 'post__not_in' => array($this_id), 'ignore_sticky_posts' => true, 'posts_per_page'=> $posts ); } $out = ""; $out .= '
'; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); $content = fruitful_load_template_part(); $out .= $content; endwhile; } $out .= '
'; if(isset($out)) return $out; wp_reset_query(); } add_shortcode ("fruitful_recent_posts", "fruitful_recent_posts"); function fruitful_recent_posts_slider($atts){ //Add FlexSlider wp_enqueue_style( 'flex-slider', FRUITFUL_SHORTCODE_URI . 'includes/shortcodes/flex_slider/slider.css'); wp_enqueue_script('flex-fitvid-j', FRUITFUL_SHORTCODE_URI . 'includes/shortcodes/flex_slider/jquery.flexslider-min.js', array( 'jquery' ), '20130930', false ); wp_enqueue_script('flex-slider', FRUITFUL_SHORTCODE_URI . 'includes/shortcodes/js/slider_init.js', array( 'jquery' )); $posts = $cat = ''; $this_id = get_the_ID(); extract(shortcode_atts(array( 'posts' => 4, 'cat' => '' ), $atts)); if(!empty($cat)) { $cats = explode(", ", $cat); $args = array( 'orderby' => 'date', 'order' => 'DESC', 'post_type' => 'post', 'post_status' => 'publish', 'post__not_in' => array($this_id), 'ignore_sticky_posts' => true, 'posts_per_page'=> $posts, 'tax_query' => array( array( 'taxonomy' => 'category', 'field' => 'slug', 'terms' => $cats ) ) ); } else { $args = array( 'orderby' => 'date', 'order' => 'DESC', 'post_type' => 'post', 'post_status' => 'publish', 'post__not_in' => array($this_id), 'ignore_sticky_posts' => true, 'posts_per_page'=> $posts ); } $out = ""; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { $out .= '
    '; while ($my_query->have_posts()) : $my_query->the_post(); $content = fruitful_load_template_part(); $out .= '
  • '; $out .= $content; $out .= '
  • '; endwhile; $out .= '
'; $out .= '
'; $out .= '
'; } return $out; wp_reset_query(); } add_shortcode ("fruitful_recent_posts_slider", "fruitful_recent_posts_slider");