Skip to content

Commit

Permalink
DD-1449 : fixed issues with mce_href
Browse files Browse the repository at this point in the history
  • Loading branch information
guardiola86 committed Jul 16, 2019
1 parent 6bb1406 commit c1fea2f
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/Dennis/Link/Checker/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public function run() {
return FALSE;
}

// Clear the queue if nids are present as parameters.
if (!empty($this->config->getNodeList())) {
$this->getQueue()->deleteQueue();
}

$end = time() + $this->timeLimit;

// Remove any old items from the queue.
Expand Down Expand Up @@ -305,7 +310,6 @@ public function correctLinks(ItemInterface $item, FieldInterface $field) {
$entity = $field->getEntity();

foreach ($links as $link) {

// If url is protocol neutral, force it to use http.
if (substr( $link->originalHref(), 0, 2 ) === "//") {
$url = ltrim($link->originalHref(), '//');
Expand Down Expand Up @@ -342,6 +346,14 @@ public function correctLinks(ItemInterface $item, FieldInterface $field) {
. ' => ' . $suggested);
}

// Remove mce_href parameter from links.
if ($link->removeMceHref()) {
$this->config->getLogger()->info('mce_href removed | '
. $entity->entityType() . '/' . $entity->entityId()
. ' | ' . $link->originalHref() . " => " . $link->correctedHref());
$do_field_save = TRUE;
}

// Do the correction if needed.
if ($link->corrected() && $this->updateLink($entity, $link)) {
$do_field_save = TRUE;
Expand Down Expand Up @@ -369,11 +381,6 @@ public function updateLink(EntityInterface $entity, LinkInterface $link) {
. ' | ' . $link->originalHref() . " => " . $link->correctedHref());
}
else {
if ($link->removeMceHref()) {
$this->config->getLogger()->info('mce_href removed | '
. $entity->entityType() . '/' . $entity->entityId()
. ' | ' . $link->originalHref() . " => " . $link->correctedHref());
}
if ($link->replace()) {
$this->config->getLogger()->info('Link corrected | '
. $entity->entityType() . '/' . $entity->entityId()
Expand Down

0 comments on commit c1fea2f

Please sign in to comment.