I have a WordPress plugin that I try to fix is very old and the author is not answering, The plugin had a lot of out date code that I already fixed. The plugin is a tooltip shortcode display in words.
I'm facing with this problems : after activation the plugin adds(outputs) this to all posts :
<html><body><p>
No matter if you write something in the post or not the post will output the HTML above.
Is something wrong in this output function that makes this happen ? this is the output function :
public function box_tooltips_shortcode($atts, $text) {
extract(shortcode_atts(
array(
"header" => "",
"content" => "Tooltip Content",
"style" => $this->default_options["style"],
"position" => $this->default_options["position"],
"width" => "",
"custom_css_class" => "",
"custom_css" => "",
"custom_content_css" => "",
"focus" => "",
"tag" => $this->default_options["tag"],
"delay" => "",
"cursor" => "",
"event" => "",
"attr" => "",
),
$atts, $text
));
// Prepare atributes:
if ($focus == 1) {
$parts = explode("_", $position);
array_splice($parts, 1, 0, "focus");
$position = implode("_", $parts);
}
$position = "qlabs_tooltip_" . $position;
$delay = $delay != "" && $delay != 0 ? " delay_" . $delay : "";
$style = " qlabs_tooltip_" . $style;
$cursor = $cursor != "" ? " cursor_" . $cursor : "";
$event = $event != "" ? " event_" . $event : "";
$custom_css_class = $custom_css_class != "" ? " " . $custom_css_class : "";
$custom_content_css = $custom_content_css != "" ? " " . $custom_content_css : "";
// Generate output
$output = "<{$tag} class='{$position}{$style}{$delay}{$cursor}{$custom_css_class}{$event}' style='{$custom_css}' {$attr} aria-haspopup='true'>";
$output .= $text;
$output .= "<span " . ($width != "" ? "style='width: {$width}; {$custom_content_css}' " : "") . " >";
$output .= $header != "" ? "<strong>{$header}</strong>" : "";
$output .= $content;
$output .= "</span>";
$output .= "</{$tag}>";
// Check if click event is selected, required for loading JS code
if( strpos($event, 'click')!==false ) {
global $box_tooltips_js;
$box_tooltips_js = true;
}
return $output;
}
The plugin outputs this HTML to all post for no reason :
<html><body><p>
Its shortcode doesn't display correctly only the text of the shortcode.