- Fixes incorrect newsletter issue number display

- Updates newsletter 'last post title' logic
- Updates shortcode extraction regex to allow limiting extraction of only
  specific categories
- Updates unit tests
- Closes #380
This commit is contained in:
Vlad
2016-04-21 19:14:06 -04:00
parent e4a5438512
commit dd8f58e35e
4 changed files with 38 additions and 15 deletions

View File

@ -13,8 +13,13 @@ class Shortcodes {
$this->subscriber = $subscriber;
}
function extract($text) {
preg_match_all('/\[(?:\w+):.*?\]/ism', $text, $shortcodes);
function extract($text, $limit = false) {
$limit = (is_array($limit)) ? implode('|', $limit) : false;
$regex = sprintf(
'/\[%s:.*?\]/ism',
($limit) ? '(?:' . $limit . ')' : '(?:\w+)'
);
preg_match_all($regex, $text, $shortcodes);
return array_unique($shortcodes[0]);
}