• Resolved Dan Griffiths

    (@evertiro)


    There has been a display bug on the last several versions of the plugin. The bug is at line 39 of terminal-for-stripe-and-woocommerce.php. The current code block is as follows:

    
    if($alert['success']){
        $alert = $alert['success'];
        preg_match_all('#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#', $alert, $match);
        if(!empty($match[0])){
            foreach($match[0] as $m){
                $alert = str_replace($m,'<a target="_blank" class="wc-update-now button-primary" href="'.$m.'">'.$m.'</a>',$alert);
            }
        }
        echo '<div class="notice notice-warning"><p>'.$alert.'</p></div>';
    }
    

    The echo line doesn’t take into account situations where there is no alert, and displays a very annoying, undismissable empty alert. The following fixes it:

    
    if($alert['success']){
        $alert = $alert['success'];
        preg_match_all('#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#', $alert, $match);
        if(!empty($match[0])){
            foreach($match[0] as $m){
                $alert = str_replace($m,'<a target="_blank" class="wc-update-now button-primary" href="'.$m.'">'.$m.'</a>',$alert);
            }
        }
        if ( '' !== trim( $alert ) ) {
            echo '<div class="notice notice-warning"><p>'.$alert.'</p></div>';
        }
    }
    

    Please fix it, I don’t want to have to keep modifying your plugin and I don’t have the energy to write my own.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Bug report – please get a GitHub/GitLab/something account’ is closed to new replies.