mirror of
https://github.com/discourse/discourse.git
synced 2026-08-11 05:25:16 -05:00
DEV: Move discourse-affiliate to core (#33749)
https://meta.discourse.org/t/373574 Internal `/t/-/156778`
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# name: discourse-affiliate
|
||||
# about: Allows the creation of Amazon affiliate links on your forum.
|
||||
# meta_topic_id: 101937
|
||||
# version: 0.2
|
||||
# authors: Régis Hanol (zogstrip), Sam Saffron
|
||||
# url: https://github.com/discourse/discourse/tree/main/plugins/discourse-affiliate
|
||||
|
||||
enabled_site_setting :affiliate_enabled
|
||||
|
||||
after_initialize do
|
||||
require File.expand_path(File.dirname(__FILE__) + "/lib/affiliate_processor")
|
||||
|
||||
on(:post_process_cooked) do |doc, post|
|
||||
doc.css("a[href]").each { |a| a["href"] = AffiliateProcessor.apply(a["href"]) }
|
||||
true
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user