1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK ---------------------------------- |
---|
3 | # |
---|
4 | # This file is part of agora, a plugin for Dotclear 2. |
---|
5 | # |
---|
6 | # Copyright (c) 2009 Osku , Tomtom and contributors |
---|
7 | # |
---|
8 | # Licensed under the GPL version 2.0 license. |
---|
9 | # A copy of this license is available in LICENSE file or at |
---|
10 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
11 | # |
---|
12 | # -- END LICENSE BLOCK ------------------------------------ |
---|
13 | |
---|
14 | class rsExtMessage |
---|
15 | { |
---|
16 | public static function getContent($rs,$absolute_urls=false) |
---|
17 | { |
---|
18 | if ($absolute_urls) { |
---|
19 | return html::absoluteURLs($rs->message_content_xhtml,$rs->getThreadURL()); |
---|
20 | } else { |
---|
21 | return $rs->message_content_xhtml; |
---|
22 | } |
---|
23 | } |
---|
24 | |
---|
25 | public static function getAuthorCN($rs) |
---|
26 | { |
---|
27 | return dcUtils::getUserCN($rs->user_id, $rs->user_name, |
---|
28 | $rs->user_firstname, $rs->user_displayname); |
---|
29 | } |
---|
30 | |
---|
31 | public static function getThreadURL($rs) |
---|
32 | { |
---|
33 | return $rs->core->blog->url.$rs->core->getPostPublicURL( |
---|
34 | $rs->post_type,html::sanitizeURL($rs->post_url) |
---|
35 | ); |
---|
36 | } |
---|
37 | |
---|
38 | public static function getDate($rs,$format) |
---|
39 | { |
---|
40 | if ($format) { |
---|
41 | return dt::dt2str($format,$rs->message_dt); |
---|
42 | } else { |
---|
43 | return dt::dt2str($rs->core->blog->settings->date_format,$rs->message_dt); |
---|
44 | } |
---|
45 | } |
---|
46 | |
---|
47 | public static function getTime($rs,$format) |
---|
48 | { |
---|
49 | if ($format) { |
---|
50 | return dt::dt2str($format,$rs->messsage_dt); |
---|
51 | } else { |
---|
52 | return dt::dt2str($rs->core->blog->settings->time_format,$rs->message_dt); |
---|
53 | } |
---|
54 | } |
---|
55 | |
---|
56 | public static function getTS($rs) |
---|
57 | { |
---|
58 | return strtotime($rs->message_dt); |
---|
59 | } |
---|
60 | |
---|
61 | public static function getISO8601Date($rs) |
---|
62 | { |
---|
63 | return dt::iso8601($rs->getTS(),$rs->message_tz); |
---|
64 | } |
---|
65 | |
---|
66 | public static function getRFC822Date($rs) |
---|
67 | { |
---|
68 | return dt::rfc822($rs->getTS(),$rs->message_tz); |
---|
69 | } |
---|
70 | |
---|
71 | public static function getFeedID($rs) |
---|
72 | { |
---|
73 | return 'urn:md5:'.md5($rs->core->blog->uid.$rs->message_id); |
---|
74 | |
---|
75 | $url = parse_url($rs->core->blog->url); |
---|
76 | $date_part = date('Y-m-d',strtotime($rs->message_dt)); |
---|
77 | |
---|
78 | return 'tag:'.$url['host'].','.$date_part.':'.$rs->message_id; |
---|
79 | } |
---|
80 | } |
---|
81 | ?> |
---|