- Removes unused properties from Links class and converts methods to
static
This commit is contained in:
@ -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();
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user