'; echo do_shortcode( be_dynamic_data($fields['content']) ); echo ''; } /** * [contact_box] */ public static function item_contact_box( $fields ){ echo sc_contact_box( $fields ); } /** * [content] */ public static function item_content( $fields = false ){ echo '
'; echo '
'; the_content(); echo '
'; echo '
'; } /** * [countdown_2] */ public static function item_countdown_2( $fields ){ echo sc_countdown_2( $fields ); } /** * [countdown] */ public static function item_countdown( $fields ){ echo sc_countdown( $fields ); } /** * [counter] */ public static function item_counter( $fields ){ echo sc_counter( $fields ); } /** * [divider_2] */ public static function item_divider_2( $fields ){ echo sc_divider_2( $fields ); } /** * [divider] */ public static function item_divider( $fields ){ echo sc_divider( $fields ); } /** * [fancy_divider] */ public static function item_fancy_divider( $fields ){ echo sc_fancy_divider( $fields ); } /** * [fancy_heading] */ public static function item_fancy_heading( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_fancy_heading( $fields, $fields['content'] ); } /** * [faq] */ public static function item_faq( $fields ){ echo sc_faq( $fields ); } /** * [feature_box] */ public static function item_feature_box( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_feature_box( $fields, $fields['content'] ); } /** * [feature_list] */ public static function item_feature_list( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_feature_list( $fields, $fields['content'] ); } /** * [flat_box] */ public static function item_flat_box( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_flat_box( $fields, $fields['content'] ); } /** * [heading] */ public static function item_heading( $fields ){ echo sc_heading( $fields ); } /** * [helper] */ public static function item_helper( $fields ){ echo sc_helper( $fields ); } /** * [hover_box] */ public static function item_hover_box( $fields ){ echo sc_hover_box( $fields ); } /** * [hover_color] */ public static function item_hover_color( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_hover_color( $fields, $fields['content'] ); } /** * [how_it_works] */ public static function item_how_it_works( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_how_it_works( $fields, $fields['content'] ); } /** * [icon] */ public static function item_icon_2( $fields ){ echo sc_icon_2( $fields ); } /** * [icon_box] */ public static function item_icon_box( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_icon_box( $fields, $fields['content'] ); } /** * [icon_box_2] */ public static function item_icon_box_2( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_icon_box_2( $fields, $fields['content'] ); } /** * [image] */ public static function item_image( $fields ){ echo sc_image( $fields ); } /** * [image_gallery] */ public static function item_image_gallery( $fields ){ $fields['link'] = 'file'; echo sc_gallery( $fields ); } /** * [info_box] */ public static function item_info_box( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_info_box( $fields, $fields['content'] ); } /** * [list_2] */ public static function item_list_2( $fields ){ echo sc_list_2( $fields ); } /** * [list] */ public static function item_list( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_list( $fields, $fields['content'] ); } /** * [livesearch] */ public static function item_livesearch( $fields ){ echo sc_livesearch( $fields ); } /** * [map_basic] */ public static function item_map_basic( $fields ){ echo sc_map_basic( $fields ); } /** * [map] */ public static function item_map( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_map( $fields, $fields['content'] ); } /** * [offer] */ public static function item_offer( $fields ){ echo sc_offer( $fields ); } /** * [offer_thumb] */ public static function item_offer_thumb( $fields ){ echo sc_offer_thumb( $fields ); } /** * [opening_hours] */ public static function item_opening_hours( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_opening_hours( $fields, $fields['content'] ); } /** * [our_team] */ public static function item_our_team( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_our_team( $fields, $fields['content'] ); } /** * [our_team_list] */ public static function item_our_team_list( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_our_team_list( $fields, $fields['content'] ); } /** * [lottie] */ public static function item_lottie( $fields ){ echo sc_lottie( $fields ); } /** * [payment_methods] */ public static function item_payment_methods( $fields ){ echo sc_payment_methods( $fields ); } /** * [photo_box] */ public static function item_photo_box( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_photo_box( $fields, $fields['content'] ); } /** * [plain_text] */ public static function item_plain_text( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_plain_text( $fields, $fields['content'] ); } /** * [placeholder] */ public static function item_placeholder( $fields ){ echo '
 
'; } /** * [portfolio] */ public static function item_portfolio( $fields ){ echo sc_portfolio( $fields ); } /** * [portfolio_grid] */ public static function item_portfolio_grid( $fields ){ echo sc_portfolio_grid( $fields ); } /** * [portfolio_photo] */ public static function item_portfolio_photo( $fields ){ echo sc_portfolio_photo( $fields ); } /** * [portfolio_slider] */ public static function item_portfolio_slider( $fields ){ echo sc_portfolio_slider( $fields ); } /** * [pricing_item] */ public static function item_pricing_item( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_pricing_item( $fields, $fields['content'] ); } /** * [progress_bars] */ public static function item_progress_bars( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_progress_bars( $fields, $fields['content'] ); } /** * [promo_box] */ public static function item_promo_box( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_promo_box( $fields, $fields['content'] ); } /** * [quick_fact] */ public static function item_quick_fact( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_quick_fact( $fields, $fields['content'] ); } /** * [shop] */ public static function item_shop( $fields ) { if( empty($fields['type']) ){ $fields['type'] = ''; } if( isset($fields['category']) && $fields['category'] == 'All' ) unset($fields['category']); if( class_exists( 'WC_Shortcode_Products' ) ) { if( ! empty($fields['paginate']) && ! empty($fields['load_more']) ){ add_filter( 'mfn_item_shop_pagination', function( $type ) { return 'load_more'; } ); } $shortcode = new WC_Shortcode_Products( $fields, $fields['type'] ); echo $shortcode->get_content(); } if( !empty(mfn_opts_get('shop-infinite-load')) ){ wp_enqueue_script('mfn-waypoints', get_theme_file_uri('/js/plugins/waypoints.min.js'), ['jquery'], MFN_THEME_VERSION, true); } } /** * [shop_slider] */ public static function item_shop_slider( $fields ){ echo sc_shop_slider( $fields ); } /** * [sidebar_widget] */ public static function item_sidebar_widget( $fields, $vb = false ){ if( $vb ){ echo ''; }else{ echo sc_sidebar_widget( $fields ); } } /** * [slider] */ public static function item_slider( $fields ){ echo sc_slider( $fields ); } /** * [slider_plugin] */ public static function item_slider_plugin( $fields ){ echo sc_slider_plugin( $fields ); } /** * [sliding_box] */ public static function item_sliding_box( $fields ){ echo sc_sliding_box( $fields ); } /** * [story_box] */ public static function item_story_box( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_story_box( $fields, $fields['content'] ); } /** * [table_of_contents] */ public static function item_table_of_contents( $fields ){ echo sc_table_of_contents( $fields ); } /** * [tabs] */ public static function item_tabs( $fields ){ echo sc_tabs( $fields ); } /** * [tag_cloud] */ public static function item_tag_cloud( $fields ){ echo sc_tag_cloud( $fields ); } /** * [testimonials] */ public static function item_testimonials( $fields ){ echo sc_testimonials( $fields ); } /** * [testimonials_list] */ public static function item_testimonials_list( $fields ){ echo sc_testimonials_list( $fields ); } /** * [timeline] */ public static function item_timeline( $fields ){ echo sc_timeline( $fields ); } /** * [toggle] */ public static function item_toggle( $fields ){ echo sc_toggle( $fields ); } /** * [trailer_box] */ public static function item_trailer_box( $fields ){ echo sc_trailer_box( $fields ); } /** * [video] */ public static function item_video( $fields ){ echo sc_video( $fields ); } /** * [visual] */ public static function item_visual( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } if( empty(Mfn_Builder_Front::$item_id) && !empty($fields['vb_postid']) && get_post_type($fields['vb_postid']) != 'template' && strpos($fields['content'], '}') !== false ){ $fields['content'] = str_replace('}', ':'.$fields['vb_postid'].'}', $fields['content']); } echo '
'; echo do_shortcode( be_dynamic_data($fields['content']) ); echo '
'; } /** * [zoom_box] */ public static function item_zoom_box( $fields ){ if( empty($fields['content']) ){ $fields['content'] = ''; } echo sc_zoom_box( $fields, $fields['content'] ); } /** * BeBuilder BLOCKS */ public static function blocks( $item, $fields ){ // return; $output = ''; if( empty($item['attr']) ){ return; } $item_type = $item['type']; $item_fields = $fields->get_item_fields( $item_type ); // label $label = false; if( ! empty( $item['attr']['title'] ) ){ $label = $item['attr']['title']; } // header $output .= '
'; $output .= '
'; $output .= ''; $output .= '
'; $output .= '
'. esc_html( $item_fields['title'] ) .'
'; // subtitle shows in simple view only $output .= '

'. esc_html( $label ) .'

'; $output .= '
'; $output .= '
'; $output .= '
'; // content $preview = [ 'image' => '', 'title' => '', 'subtitle' => '', 'content' => '', 'style' => '', 'number' => '', 'category' => '', 'category-all' => '', 'icon' => '', 'tabs' => '', 'images' => '', 'align' => '', ]; $preview_empty = []; $preview_tabs_primary = 'title'; // $output .= json_encode($item['attr']); if( ! empty($item_fields['attr']) ){ foreach ( $item_fields['attr'] as $field ) { if ( isset( $field['preview'] ) ){ $prev_key = $field['preview']; $prev_id = $field['id']; // existing item or default value if( isset( $item['attr'] ) ){ if( isset( $item['attr'][$prev_id] ) ){ $preview[$prev_key] = $item['attr'][$prev_id]; } if( 'tabs' === $field['type'] && empty( $item['attr']['tabs'] ) ){ $preview[$prev_key] = ''; } } elseif( ! empty( $field['std'] ) ){ $preview[$prev_key] = $field['std']; } // tabs if( 'tabs' == $field['preview'] ){ if( ! empty( $field['primary'] ) ){ $preview_tabs_primary = $field['primary']; } } // category if( 'category' == $field['preview'] ){ if( $preview['category'] ){ $cat_obj = get_category_by_slug( $preview['category'] ); if( is_object( $cat_obj ) ){ $preview['category'] = $cat_obj->name; } else { $preview['category'] = 'All'; } } else { $preview['category'] = 'All'; } } } } } // multiple categories if ( $preview['category-all'] ){ $preview['category'] = $preview['category-all']; } // icon if ( in_array( $item_type, ['counter','icon_box','icon_box_2','list'] ) && $preview['image'] ){ // image replaces icon in some items $preview['icon'] = ''; } // SVG placeholder if ( in_array( $item_type, ['map','map_basic'] ) ){ $preview['image'] = get_theme_file_uri( '/muffin-options/svg/placeholders/map.svg' ); } if ( in_array( $item_type, ['code','content','fancy_divider','livesearch','lottie','sidebar_widget','slider_plugin','video'] ) ){ $preview['image'] = get_theme_file_uri( '/muffin-options/svg/placeholders/'. $item_type .'.svg' ); } // image dynamic data if( ! empty($preview['image']) && false !== strpos('{featured_image}', $preview['image']) ){ $src_dynamic = be_dynamic_data($preview['image']); if( is_numeric( $src_dynamic ) ){ $preview['image'] = wp_get_attachment_image_url( $src_dynamic, 'full' ); } } // empty foreach( $preview as $prev_key => $prev_val ){ if( $prev_val ){ $preview_empty[ $prev_key ] = ''; } else { $preview_empty[ $prev_key ] = 'empty'; } } // content limit if ( $preview['content'] ){ $excerpt = $preview['content']; if ( in_array( $item_type, ['column', 'visual'] ) ){ // remove unwanted HTML tags $excerpt = wp_kses( $excerpt, Mfn_Builder_Helper::allowed_html() ); // wrap shortcodes into span to highlight $excerpt = preg_replace( '/(\[(.*?)?\[\/)((.*?)?\])|(\[(.*?)?\])/', '$0', $excerpt); // autoclose tags $excerpt = force_balance_tags( $excerpt ); } else { $excerpt = strip_shortcodes( strip_tags( $excerpt ) ); $excerpt = preg_split( '/\b/', $excerpt, 16 * 2 + 1 ); array_pop( $excerpt ); $excerpt = implode( $excerpt ); if( strlen( $excerpt ) < strlen( $preview['content'] ) ){ $excerpt = $excerpt .'...'; } } $preview['content'] = $excerpt; } // align if( is_array($preview['align']) ){ $preview['align'] = $preview['align']['val']; } $output .= '
'; $output .= '
'; $output .= ''; $output .= '
'; $output .= '
'; $output .= '

'. esc_html( $preview['title'] ) .'

'; $output .= '

'. esc_html( $preview['subtitle'] ) .'

'; $output .= '
'. $preview['content'] .'
'; $output .= '

'; $placeholder_type = self::get_item_placeholder_type( $item_type ); if( 'standard' == $placeholder_type ){ $placeholder = get_theme_file_uri( '/muffin-options/svg/placeholders/'. $item_type .'.svg' ); $output .= ''; } elseif ( 'variable' == $placeholder_type ) { // existing item or default value if( isset( $item['fields'] ) ){ $item_style = str_replace( array( ',', ' ' ), '-', $item['fields']['style'] ); } else { $item_style = 'grid'; } $placeholder_dir = get_theme_file_uri( '/muffin-options/svg/select/'. $item_type .'/' ); $placeholder = $placeholder_dir . $item_style .'.svg'; $output .= ''; } $output .= ''. esc_html( $preview['number'] ) .''; $output .= '

'; $output .= '

'; $output .= '

'. esc_html__('Category', 'mfn-opts') .':'. esc_html( $preview['category'] ) .'

'; $output .= ''; $output .= ''; $output .= '
'; $output .= '
'; return $output; } /** * BeBuilder BLOCKS GET item placeholder type */ public static function get_item_placeholder_type( $item ){ $return = false; $array = [ 'standard' => [ 'blog_news', 'blog_slider', 'blog_teaser', 'clients', 'clients_slider', 'offer', 'offer_thumb', 'portfolio_grid', 'portfolio_photo', 'portfolio_slider', 'shop', 'shop_slider', 'slider', 'testimonials', 'testimonials_list' ], 'variable' => [ 'blog', 'portfolio' ], ]; foreach( $array as $type => $items ){ if( in_array( $item, $items ) ){ $return = $type; break; } } return $return; } } }