Skip to content

Commit

Permalink
Both else and exit() not needed. Clearer intention and lower complexi…
Browse files Browse the repository at this point in the history
…ty. All paths either return or exit() through class Tools
  • Loading branch information
dkarvounaris committed Mar 15, 2023
1 parent e0aa533 commit a504413
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions gsitemap.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ public function addLinkToSitemap(&$link_sitemap, $new_link, $lang, &$index, &$i,
++$i; ++$i;


return true; return true;
} else { }

$this->recursiveSitemapCreator($link_sitemap, $lang, $index); $this->recursiveSitemapCreator($link_sitemap, $lang, $index);
if ($index % 20 == 0 && !$this->cron) { if ($index % 20 == 0 && !$this->cron) {
$this->context->smarty->assign([ $this->context->smarty->assign([
Expand All @@ -295,7 +296,8 @@ public function addLinkToSitemap(&$link_sitemap, $new_link, $lang, &$index, &$i,
]); ]);


return false; return false;
} else { }

if ($this->cron) { if ($this->cron) {
Tools::redirect($this->context->link->getBaseLink() . 'modules/gsitemap/gsitemap-cron.php?continue=1&token=' . Tools::substr(Tools::hash('gsitemap/cron'), 0, 10) . '&type=' . $new_link['type'] . '&lang=' . $lang . '&index=' . $index . '&id=' . (int) $id_obj . '&id_shop=' . $this->context->shop->id); Tools::redirect($this->context->link->getBaseLink() . 'modules/gsitemap/gsitemap-cron.php?continue=1&token=' . Tools::substr(Tools::hash('gsitemap/cron'), 0, 10) . '&type=' . $new_link['type'] . '&lang=' . $lang . '&index=' . $index . '&id=' . (int) $id_obj . '&id_shop=' . $this->context->shop->id);
} else { } else {
Expand All @@ -311,9 +313,6 @@ public function addLinkToSitemap(&$link_sitemap, $new_link, $lang, &$index, &$i,
'id_shop' => $this->context->shop->id, 'id_shop' => $this->context->shop->id,
])); ]));
} }
exit();
}
}
} }


/** /**
Expand Down

0 comments on commit a504413

Please sign in to comment.