From ecf7b6f79c3c5f2a6ca28648135d3259c794698c Mon Sep 17 00:00:00 2001 From: Claudio-Emmolo <113107618+Claudio-Emmolo@users.noreply.github.com> Date: Tue, 5 Nov 2024 16:33:43 +0100 Subject: [PATCH] Custom tag and subtag --- config/referral-rewriter-tag.php | 12 +++++++++++- src/ReferralRewriterTag.php | 24 ++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/config/referral-rewriter-tag.php b/config/referral-rewriter-tag.php index 927a50b..d5f6b93 100644 --- a/config/referral-rewriter-tag.php +++ b/config/referral-rewriter-tag.php @@ -2,5 +2,15 @@ // config for The3LabsTeam/ReferralRewriterTag return [ - + 'ebay' => [ + 'tag' => '', + 'subtag' => '', + ], + 'amazon' => [ + 'tag' => '', + 'subtag' => '', + ], + 'instantgaming' => [ + 'tag' => '', + ], ]; diff --git a/src/ReferralRewriterTag.php b/src/ReferralRewriterTag.php index e31f65b..d968baf 100755 --- a/src/ReferralRewriterTag.php +++ b/src/ReferralRewriterTag.php @@ -35,6 +35,14 @@ public function rewrite(string $link, ?string $tag, ?string $subtag, string $add */ public function rewriteAmazonLink(): string { + if(!$this->tag) { + $this->tag = config('referral-rewriter-tag.amazon.tag'); + } + + if(!$this->subtag) { + $this->subtag = config('referral-rewriter-tag.amazon.subtag'); + } + return $this->rewriteLink(tagKey: 'tag', subTagKey: 'ascsubtag'); } @@ -43,6 +51,14 @@ public function rewriteAmazonLink(): string */ public function rewriteInstantGamingLink(): string { + if(!$this->tag) { + $this->tag = config('referral-rewriter-tag.instantgaming.tag'); + } + + if(!$this->subtag) { + $this->subtag = config('referral-rewriter-tag.instantgaming.subtag'); + } + return $this->rewriteLink(tagKey: 'igr', subTagKey: 'igr_extra'); } @@ -51,6 +67,14 @@ public function rewriteInstantGamingLink(): string */ public function rewriteEbayLink(): string { + if(!$this->tag) { + $this->tag = config('referral-rewriter-tag.ebay.tag'); + } + + if(!$this->subtag) { + $this->subtag = config('referral-rewriter-tag.ebay.subtag'); + } + return $this->rewriteLink(tagKey: 'campid', subTagKey: 'customid'); }