<?php

function salesloo_webhook_replace_shortcode($string, $replacers)
{
    preg_match_all('@\[([^<>&/\[\]\x00-\x20=]++)@', $string, $matches);

    foreach ($matches[1] as $key => $tag) {
        if (isset($replacers[$tag])) {
            $string = str_replace('[' . $tag . ']', $replacers[$tag], $string);
        }
    }

    return $string;
}
