- Adds subsription tracking option to Settings->Advanced

- Updates sending queue worker to not replace links if tracking is
  disabled
Closes #417
This commit is contained in:
Vlad
2016-04-13 22:00:13 -04:00
parent a3e6eb5bba
commit 84294b7ee6
5 changed files with 112 additions and 29 deletions

View File

@ -18,18 +18,21 @@ class Shortcodes {
return array_unique($shortcodes[0]);
}
function match($shortcode) {
preg_match(
'/\[(?P<type>\w+):(?P<action>\w+)(?:.*?default:(?P<default>.*?))?\]/',
$shortcode,
$match
);
return $match;
}
function process($shortcodes, $text) {
$processed_shortcodes = array_map(
function($shortcode) use($text) {
preg_match(
'/\[(?P<type>\w+):(?P<action>\w+)(?:.*?default:(?P<default>.*?))?\]/',
$shortcode,
$shortcode_details
);
$shortcode_details = $this->match($shortcode);
$shortcode_type = ucfirst($shortcode_details['type']);
$shortcode_action = $shortcode_details['action'];
// do not process subscription management links
if ($shortcode_type === 'Subscription') return $shortcode;
$shortcode_class =
__NAMESPACE__ . '\\Categories\\' . $shortcode_type;
$shortcode_default_value = isset($shortcode_details['default'])