diff --git a/lib/Cron/Workers/SendingQueue.php b/lib/Cron/Workers/SendingQueue.php index 193cf406bc..28795797a6 100644 --- a/lib/Cron/Workers/SendingQueue.php +++ b/lib/Cron/Workers/SendingQueue.php @@ -180,8 +180,7 @@ class SendingQueue { } function processLinks($text, $newsletter_id, $queue_id) { - $links = new Links(); - list($text, $processed_links) = $links->replace($text); + list($text, $processed_links) = Links::replace($text); foreach($processed_links as $link) { // save extracted and processed links $newsletter_link = NewsletterLink::create(); diff --git a/lib/Newsletter/Links/Links.php b/lib/Newsletter/Links/Links.php index e01fd16670..fc752de730 100644 --- a/lib/Newsletter/Links/Links.php +++ b/lib/Newsletter/Links/Links.php @@ -5,20 +5,7 @@ use MailPoet\Newsletter\Shortcodes\Shortcodes; use MailPoet\Util\Security; class Links { - public $newsletter_id; - public $queue_id; - public $subscriber_id; - - function __construct( - $newsletter_id = false, - $subscriber_id = false, - $queue_id = false) { - $this->newsletter_id = $newsletter_id; - $this->queue_id = $queue_id; - $this->subscriber_id = $subscriber_id; - } - - function extract($text) { + static function extract($text) { // adopted from WP's wp_extract_urls() function & modified to work on hrefs # match href=' or href=" $regex = '#(?:href.*?=.*?)(["\']?)(' @@ -45,8 +32,8 @@ class Links { ); } - function replace($text, $links = false) { - $links = ($links) ? $links : $this->extract($text); + static function replace($text, $links = false) { + $links = ($links) ? $links : self::extract($text); $processed_links = array(); foreach($links as $link) { $hash = Security::generateRandomString(5);