"", "use_custom_icon_size" => "", "custom_icon_size" => "", "custom_icon_size_inner" => "", "custom_icon_margin" => "", "icon_animation" => "", "icon_animation_delay" => "", "image" => "", "icon_type" => "", "icon_position" => "", "icon_border_color" => "", "icon_margin" => "", "icon_color" => "", "icon_hover_color" => "", "icon_background_color" => "", "icon_hover_background_color" => "", "box_type" => "", "box_border_color" => "", "box_background_color" => "", "title" => "", "title_tag" => "h5", "title_color" => "", "title_font_weight" => "", "separator" => "", "separator_color" => "", "separator_top_margin" => "0", "separator_bottom_margin" => "15", "separator_width" => "20", "text" => "", "text_color" => "", "link" => "", "link_text" => "", "link_color" => "", "link_icon" => "", "target" => "" ); $default_atts = array_merge($default_atts, $qodeIconCollections->getShortcodeParams()); extract(shortcode_atts($default_atts, $atts)); $headings_array = array('h2', 'h3', 'h4', 'h5', 'h6'); //get correct heading value. If provided heading isn't valid get the default one $title_tag = (in_array($title_tag, $headings_array)) ? $title_tag : $args['title_tag']; //init icon styles $style = ''; $icon_stack_classes = ''; //init icon stack styles $icon_margin_style = ''; $icon_stack_square_style = ''; $icon_stack_base_style = ''; $icon_stack_style = ''; $img_styles = ''; $animation_delay_style = ''; $icon_text_holder_styles = ''; //generate inline icon styles if($use_custom_icon_size == "yes") { if($custom_icon_size != "") { //remove px if user has entered it $custom_icon_size = strstr($custom_icon_size, 'px', true) ? strstr($custom_icon_size, 'px', true) : $custom_icon_size; $icon_stack_style .= 'font-size: '.$custom_icon_size.'px;'; } if($custom_icon_margin != "") { //remove px if user has entered it $custom_icon_margin = strstr($custom_icon_margin, 'px', true) ? strstr($custom_icon_margin, 'px', true) : $custom_icon_margin; $custom_icon_margin = $custom_icon_size + $custom_icon_margin; if($icon_position !== 'right') { $icon_text_holder_styles .= 'padding-left:'.$custom_icon_margin.'px;'; } else { $icon_text_holder_styles .= 'padding-right:'.$custom_icon_margin.'px;'; } } if($custom_icon_size_inner != '' && in_array($icon_type, array('circle', 'square'))) { $style .= 'font-size: '.$custom_icon_size_inner.'px;'; } } if($icon_color != "") { $style .= 'color: '.$icon_color.';'; } //generate icon stack styles if($icon_background_color != "") { $icon_stack_base_style .= 'background-color: '.$icon_background_color.';'; $icon_stack_square_style .= 'background-color: '.$icon_background_color.';'; } if($icon_border_color != "") { $icon_stack_style .= 'border-color: '.$icon_border_color.';'; } if($icon_margin != "" && ($icon_position == "" || $icon_position == "top")) { $icon_margin_style .= "margin: ".$icon_margin.";"; $img_styles .= "margin: ".$icon_margin.";"; } if($icon_animation_delay != ""){ $animation_delay_style .= 'transition-delay: '.$icon_animation_delay.'ms; -webkit-transition-delay: '.$icon_animation_delay.'ms; -moz-transition-delay: '.$icon_animation_delay.'ms; -o-transition-delay: '.$icon_animation_delay.'ms;'; } $box_size = ''; //generate icon text holder styles and classes //map value of the field to the actual class value switch ($icon_size) { case 'large': //smallest icon size $box_size = 'tiny'; break; case 'fa-2x': $box_size = 'small'; break; case 'fa-3x': $box_size = 'medium'; break; case 'fa-4x': $box_size = 'large'; break; case 'fa-5x': $box_size = 'very_large'; break; default: $box_size = 'tiny'; } if($image != "") { $icon_type = 'image'; } $box_icon_type = ''; switch ($icon_type) { case 'normal': $box_icon_type = 'normal_icon'; break; case 'square': $box_icon_type = 'square'; break; case 'circle': $box_icon_type = 'circle'; break; case 'image': if($box_type == 'normal') { $box_icon_type = 'custom_icon_image'; } else { $box_icon_type = 'image'; } break; } /* Generate text styles */ $title_style = ""; if($title_color != "") { $title_style .= "color: ".$title_color.";"; } if($title_font_weight !== "") { $title_style .= "font-weight: ".$title_font_weight.";"; } $text_style = ""; if($text_color != "") { $text_style .= "color: ".$text_color; } $link_style = ""; if($link_color != "") { $link_style .= "color: ".$link_color.";"; } $html = ""; $html_icon = ""; if($link_icon == 'yes' && $link !== '') { $html_icon .= ''; } //generate normal type of a box html if($box_type == "normal") { //init icon text wrapper styles $icon_with_text_clasess = ''; $icon_with_text_style = ''; $icon_text_inner_style = ''; $icon_with_text_clasess .= $box_size; $icon_with_text_clasess .= ' '.$box_icon_type; if($box_border_color != "") { $icon_text_inner_style .= 'border-color: '.$box_border_color; } if($icon_position == "" || $icon_position == "top") { $icon_with_text_clasess .= " center"; } if($icon_position == "left_from_title"){ $icon_with_text_clasess .= " left_from_title"; } if($icon_position == 'right') { $icon_with_text_clasess .= ' right'; } $html .= "
"; if($icon_position != "left_from_title") { //generate icon holder html part with icon $html .= '
'; $html .= $html_icon; $html .= '
'; //close icon_holder } //generate text html $html .= '
'; $html .= '
'; if($icon_position == "left_from_title") { $html .= '
'; //generate icon_title holder for icon from title //generate icon holder html part with icon $html .= '
'; $html .= $html_icon; $html .= '
'; //close icon_holder } $html .= '<'.$title_tag.' class="icon_title" style="'.$title_style.'">'.$title.''; if($icon_position == "left_from_title") { $html .= '
'; //close icon_title holder for icon from title } if($separator == "yes") { $html .= do_shortcode('[vc_separator type="small" position="left" color="'.$separator_color.'" thickness="2" width="'.$separator_width.'" up="'.$separator_top_margin.'" down="'.$separator_bottom_margin.'"]'); } $html .= "

".$text."

"; if($link != ""){ if($target == ""){ $target = "_self"; } if($link_text == ""){ $link_text = "Read More"; } $html .= ""; } $html .= '
'; //close icon_text_inner $html .= '
'; //close icon_text_holder $html.= '
'; //close icon_with_title } else { //init icon text wrapper styles $icon_with_text_clasess = ''; $box_holder_styles = ''; if($box_border_color != "") { $box_holder_styles .= 'border-color: '.$box_border_color.';'; } if($box_background_color != "") { $box_holder_styles .= 'background-color: '.$box_background_color.';'; } $icon_with_text_clasess .= $box_size; $icon_with_text_clasess .= ' '.$box_icon_type; $html .= '
'; $html .= '
'; $html .= '
'; $html .= $html_icon; $html .= '
'; //close box_holder_icon_inner $html .= '
'; //close box_holder_icon //generate text html $html .= '
'; $html .= '<'.$title_tag.' class="icon_title" style="'.$title_style.'">'.$title.''; if($separator == "yes") { $html .= do_shortcode('[vc_separator type="small" position="left" color="'.$separator_color.'" thickness="2" width="'.$separator_width.'" up="'.$separator_top_margin.'" down="'.$separator_bottom_margin.'"]'); }else{ $html .= ''; } $html .= '

'.$text.'

'; $html .= '
'; //close box_holder_inner $html .= '
'; //close box_holder } return $html; } add_shortcode('icon_text', 'icon_text'); }