drex88669 2019-04-23 04:59
浏览 70

这个Wordpress工具提示输出功能有什么问题?

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.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥30 vmware exsi重置后登不上
    • ¥15 易盾点选的cb参数怎么解啊
    • ¥15 MATLAB运行显示错误,如何解决?
    • ¥15 c++头文件不能识别CDialog
    • ¥15 Excel发现不可读取的内容
    • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
    • ¥20 yolov5自定义Prune报错,如何解决?
    • ¥15 电磁场的matlab仿真
    • ¥15 mars2d在vue3中的引入问题
    • ¥50 h5唤醒支付宝并跳转至向小荷包转账界面