/** * Generate HTML code from shortcode content. * * @param array $atts Shortcode attributes. * @param string $content Current content. * * @return string */ public function element_shortcode_full($atts = null, $content = null) { $arr_params = shortcode_atts($this->config['params'], $atts); extract($arr_params); $button_text = !$button_text ? '' : $button_text; $button_size = !$button_size || strtolower($button_size) == 'default' ? '' : $button_size; $button_color = !$button_color || strtolower($button_color) == 'default' ? '' : $button_color; $button_icon = !$icon ? '' : "<i class='{$icon}'></i>"; $tag = 'a'; $href = ''; $single_item = explode('__#__', $single_item); $single_item = $single_item[0]; if (!empty($link_type)) { $taxonomies = IG_Pb_Helper_Type::get_public_taxonomies(); $post_types = IG_Pb_Helper_Type::get_post_types(); // single post if (array_key_exists($link_type, $post_types)) { $permalink = home_url() . "/?p={$single_item}"; $href = !$single_item ? ' href="#"' : " href='{$permalink}'"; } else { if (array_key_exists($link_type, $taxonomies)) { $permalink = get_term_link(intval($single_item), $link_type); if (!is_wp_error($permalink)) { $href = !$single_item ? ' href="#"' : " href='{$permalink}'"; } } else { switch ($link_type) { case 'no_link': $tag = 'button'; break; case 'url': $href = !$button_type_url ? ' href="#"' : " href='{$button_type_url}'"; break; } } } } $target = ''; if ($open_in) { switch ($open_in) { case 'current_browser': $target = ''; break; case 'new_browser': $target = ' target="_blank"'; break; case 'lightbox': $cls_button_fancy = 'ig-button-fancy'; $script = IG_Pb_Helper_Functions::fancybox(".{$cls_button_fancy}", array('type' => 'iframe', 'width' => '75%', 'height' => '75%')); break; } } $button_type = $tag == 'button' ? " type='button'" : ''; $cls_button_fancy = !isset($cls_button_fancy) ? '' : $cls_button_fancy; $script = !isset($script) ? '' : $script; $html_result = "<{$tag} class='btn {$button_size} {$button_color} {$cls_button_fancy}'{$href}{$target}{$button_type}>[icon]{$button_icon}[/icon][title]{$button_text}[/title]</{$tag}>"; return $html_result . $script . '<!--seperate-->'; }