Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 71
- Log:
Start of upgrade to Typo 4.0.0, the latest stable release since
2.6.0. Note test/mocks/themes/azure changes from a file to a
directory, so the file has been removed in this revision and
the directory will be added in the next revision.
- Author:
- adh
- Date:
- Mon Aug 07 22:18:11 +0100 2006
- Size:
- 1482 Bytes
1 | require_dependency 'spam_protection' |
2 | |
3 | class Trackback < Content |
4 | include TypoGuid |
5 | belongs_to :article, :counter_cache => true |
6 | |
7 | content_fields :excerpt |
8 | |
9 | validates_age_of :article_id |
10 | validates_presence_of :title, :excerpt, :url |
11 | validate_on_create :article_is_pingable |
12 | |
13 | def self.default_order |
14 | 'created_at ASC' |
15 | end |
16 | |
17 | def initialize(*args, &block) |
18 | super(*args, &block) |
19 | self.title ||= self.url |
20 | self.blog_name ||= "" |
21 | end |
22 | |
23 | def location(anchor=:ignored, only_path=true) |
24 | blog.url_for(article, "trackback-#{id}", only_path) |
25 | end |
26 | |
27 | protected |
28 | before_create :make_nofollow, :process_trackback, :create_guid |
29 | |
30 | def make_nofollow |
31 | self.blog_name = blog_name.strip_html |
32 | self.title = title.strip_html |
33 | self.excerpt = excerpt.strip_html |
34 | end |
35 | |
36 | def process_trackback |
37 | if excerpt.length >= 251 |
38 | # this limits excerpt to 250 chars, including the trailing "..." |
39 | self.excerpt = excerpt[0..246] << "..." |
40 | end |
41 | end |
42 | |
43 | def article_is_pingable |
44 | return if article.nil? |
45 | if blog.global_pings_disable |
46 | errors.add(:article, "Pings are disabled") |
47 | end |
48 | unless article.allow_pings? |
49 | errors.add(:article, "Article is not pingable") |
50 | end |
51 | end |
52 | |
53 | def akismet_options |
54 | {:user_ip => ip, :comment_type => 'trackback', :comment_author => blog_name, :comment_author_email => nil, |
55 | :comment_author_url => url, :comment_content => excerpt} |
56 | end |
57 | |
58 | def spam_fields |
59 | [:title, :excerpt, :ip, :url] |
60 | end |
61 | end |
62 |