File: function.mtentrytrackbackdata.php

package info (click to toggle)
movabletype-opensource 5.1.4%2Bdfsg-4%2Bdeb7u3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 32,996 kB
  • sloc: perl: 197,285; php: 62,405; sh: 166; xml: 117; makefile: 83; sql: 32
file content (74 lines) | stat: -rw-r--r-- 2,379 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
<?php
# Movable Type (r) Open Source (C) 2001-2012 Six Apart, Ltd.
# This program is distributed under the terms of the
# GNU General Public License, version 2.
#
# $Id$

function smarty_function_mtentrytrackbackdata($args, &$ctx) {
    $e = $ctx->stash('entry');
    $tb = $e->trackback();
    if (empty($tb))
        return '';
    if ($tb->trackback_is_disabled)
        return '';

    $blog = $ctx->stash('blog');
    $entry = $ctx->stash('entry');
    $blog_accepted = $blog->blog_allow_pings && $ctx->mt->config('AllowPings');
    if ($entry) {
        $accepted = $blog_accepted && $entry->entry_allow_pings;
    } else {
        $accepted = $blog_accepted;
    }
    if (!$accepted)
        return '';

    require_once "function.mtcgipath.php";
    $path = smarty_function_mtcgipath($args, $ctx);
    $path .= $ctx->mt->config('TrackbackScript') . '/' . $tb->trackback_id;
    if ($at = $ctx->stash('current_archive_type')) {
        $url = $ctx->tag('ArchiveLink');
        if ($at != 'Individual') {
            $url .= '#entry-' . sprintf("%06d", $e->entry_id);
        }
    } else {
        $url = $ctx->tag('EntryPermalink');
    }
    $rdf = '';
    $comment_wrap = isset($args['comment_wrap']) ?
        $args['comment_wrap'] : 1;
    if ($comment_wrap) {
        $rdf .= "<!--\n";
    }
    require_once("MTUtil.php");
    ## SGML comments cannot contain double hyphens, so we convert
    ## any double hyphens to single hyphens.
    $title = encode_xml(strip_hyphen($e->entry_title), 1);
    $subject = encode_xml(strip_hyphen($ctx->tag('EntryCategory')), 1);
    $excerpt = encode_xml(strip_hyphen($ctx->tag('EntryExcerpt')), 1);
    $creator = encode_xml(strip_hyphen($ctx->tag('EntryAuthorDisplayName')), 1);
    $date = $ctx->_hdlr_date(array('format' => '%Y-%m-%dT%H:%M:%S'), $ctx) .
            $ctx->tag('BlogTimezone');
    $rdf .= <<<RDF
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"
         xmlns:dc="http://purl.org/dc/elements/1.1/">
<rdf:Description
    rdf:about="$url"
    trackback:ping="$path"
    dc:title="$title"
    dc:identifier="$url"
    dc:subject="$subject"
    dc:description="$excerpt"
    dc:creator="$creator"
    dc:date="$date" />
</rdf:RDF>

RDF;
    if ($comment_wrap) {
        $rdf .= "-->\n";
    }
    return $rdf;
}
?>