File: Trackback.pm

package info (click to toggle)
movabletype-opensource 4.2.3-1%2Blenny3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 21,268 kB
  • ctags: 15,862
  • sloc: perl: 178,892; php: 26,178; sh: 161; makefile: 82
file content (95 lines) | stat: -rw-r--r-- 1,967 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Movable Type (r) Open Source (C) 2001-2008 Six Apart, Ltd.
# This program is distributed under the terms of the
# GNU General Public License, version 2.
#
# $Id: Trackback.pm 1174 2008-01-08 21:02:50Z bchoate $

package MT::Trackback;
use strict;

use MT::Object;
@MT::Trackback::ISA = qw( MT::Object );
__PACKAGE__->install_properties({
    column_defs => {
        'id' => 'integer not null auto_increment',
        'blog_id' => 'integer not null',
        'title' => 'string(255)',
        'description' => 'text',
        'rss_file' => 'string(255)',
        'url' => 'string(255)',
        'entry_id' => 'integer not null',
        'category_id' => 'integer not null',
        'is_disabled' => 'boolean',
        'passphrase' => 'string(30)',
    },
    indexes => {
        blog_id => 1,
        entry_id => 1,
        category_id => 1,
        created_on => 1,
    },
    defaults => {
        'entry_id' => 0,
        'category_id' => 0,
        'is_disabled' => 0,
    },
    child_classes => ['MT::TBPing'],
    audit => 1,
    datasource => 'trackback',
    primary_key => 'id',
});

sub class_label {
    MT->translate("TrackBack");
}

sub class_label_plural {
    MT->translate("TrackBacks");
}

sub remove {
    my $tb = shift;
    $tb->remove_children({ key => 'tb_id' }) or return;
    $tb->SUPER::remove(@_);
}

sub entry {
    my $tb = shift;
    return undef unless $tb->entry_id;
    require MT::Entry;
    MT::Entry->load($tb->entry_id);
}

sub category {
    my $tb = shift;
    return undef unless $tb->category_id;
    require MT::Category;
    MT::Category->load($tb->category_id);
}

1;
__END__

=head1 NAME

MT::Trackback

=head1 METHODS

=head2 $tb->remove()

Call L<MT::Object/remove> for the trackback.

=head2 $tb->entry()

Call L<MT::Entry/load> for the trackback I<entry_id>.

=head2 $tb->category()

Call L<MT::Category/load> for the trackback I<category_id>.

=head1 AUTHOR & COPYRIGHT

Please see L<MT/AUTHOR & COPYRIGHT>.

=cut