Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 193
- Log:
First stage commit of Typo 4.1, modified for the ROOL site.
Includes all local modifications but a final pass needs to be
made to delete any files left over from earlier Typo versions
that shouldn't be here anymore. See the 'tags' section of the
repository for a clean Typo 4.1 tree.Note that symlinks to shared files in the RISC OS Open theme
directory have been deliberately included this time around; I
decided that on balance it was better to leave them in as
placeholders, since unlike symlinks in app/views/shared, the
Typo theme structure is not a standard Rails concept.
- Author:
- rool
- Date:
- Wed Apr 04 18:51:02 +0100 2007
- Size:
- 1901 Bytes
1 | # Typo-filter-amazon |
2 | |
3 | class Typo |
4 | class Textfilter |
5 | class Amazon < TextFilterPlugin::PostProcess |
6 | plugin_display_name "Amazon" |
7 | plugin_description "Automatically turn amazon:ASIN URLs into affiliate links to Amazon items using your Amazon Associate ID" |
8 | |
9 | def self.filtertext(blog, content, text, params) |
10 | associateid = config_value(params,'amazon-associate-id') |
11 | domain_suffix = config_value(params,'amazon-domain-suffix') |
12 | content.whiteboard[:asins] = [] |
13 | text.gsub(/<a href="amazon:([^"]+)"/) do |match| |
14 | content.whiteboard[:asins] = content.whiteboard[:asins].to_a | [$1] |
15 | "<a href=\"http://www.amazon.#{domain_suffix}/exec/obidos/ASIN/#{$1}/#{associateid}\"" |
16 | end |
17 | end |
18 | |
19 | def self.default_config |
20 | {"amazon-associate-id" => {:default => "", |
21 | :description => "Amazon Associate ID", |
22 | :help => "Your Amazon Associate's ID (see http://amazon.com/associates). Typo's Amazon filter will automatically add this ID to all amazon:ASIN URLs that you create."}, |
23 | "amazon-domain-suffix" => {:default => "com", |
24 | :description => "Amazon Domain Suffix", |
25 | :help => "Your Amazon Domain Suffix depends on the language or country you live in."} |
26 | } |
27 | end |
28 | |
29 | def self.help_text |
30 | %{ |
31 | You can use `amazon:XXXX`-style URLs to refer to items for sale on |
32 | [Amazon.com](http://www.amazon.com). If you provide an Amazon associate |
33 | ID in the filter configuration, then each of these URLs will be tagged |
34 | with your associate ID and you'll make money if someone buys an item |
35 | while using your link. Example: |
36 | |
37 | <a href="amazon:097669400X"> |
38 | |
39 | turns into |
40 | |
41 | <a href="http://www.amazon.com/.../097669400X/scottstuff-20">} |
42 | end |
43 | end |
44 | end |
45 | end |