1 | <?php |
---|
2 | |
---|
3 | $core->addBehavior('publicHeadContent',array('publicTweet','publicHeadContent')); |
---|
4 | |
---|
5 | class publicTweet |
---|
6 | { |
---|
7 | public static function publicHeadContent(&$core) |
---|
8 | { |
---|
9 | $url = $core->blog->getQmarkURL().'pf='.basename(dirname(__FILE__)); |
---|
10 | $count = abs((integer) $w->count); |
---|
11 | if($count > 100) $count = 100; |
---|
12 | if($count < 1) $count = 1; |
---|
13 | |
---|
14 | echo |
---|
15 | '<style type="text/css">'."\n". |
---|
16 | '@import url('.$url.'/css/jquery.tweet.css);'."\n". |
---|
17 | '@import url('.$url.'/css/jquery.tweet.query.css);'."\n". |
---|
18 | "</style>\n". |
---|
19 | '<script type="text/javascript" src="'.$url.'/js/jquery.tweet.js"></script>'."\n"; |
---|
20 | } |
---|
21 | public static function divTweet(&$w) |
---|
22 | { |
---|
23 | global $core; |
---|
24 | if ($w->homeonly && $core->url->type != 'default') { |
---|
25 | return; |
---|
26 | } |
---|
27 | $res = '<script type="text/javascript">'."\n". |
---|
28 | "//<![CDATA[\n". |
---|
29 | '$(document).ready(function(){'."\n". |
---|
30 | '$("'; |
---|
31 | $res .= $w->divClass != '' ? '.'.$w->divClass : '.tweet'; |
---|
32 | $res .= '").tweet({'."\n"; |
---|
33 | if ($w->queryType == 'users') |
---|
34 | { |
---|
35 | $res .= 'username: ["'.preg_replace('/,\s?/','", "',$w->queryValue).'"],'."\n"; |
---|
36 | } |
---|
37 | |
---|
38 | elseif ($w->queryType == 'list') |
---|
39 | { |
---|
40 | $res .= 'username: "'.$w->queryValue.'",'."\n". |
---|
41 | 'list: "'.$w->list.'",'."\n"; |
---|
42 | } |
---|
43 | else |
---|
44 | { |
---|
45 | $res .= 'query: "'.$w->queryValue.'",'."\n"; |
---|
46 | } |
---|
47 | $res .= 'join_text: "auto",'."\n"; |
---|
48 | $res .= $w->avatarSize != '' && $w->avatarSize != 0 ? 'avatar_size: '.$w->avatarSize.','."\n" : ''; |
---|
49 | $res .= $w->avatarAlt != '' ? 'avatar_alt: "'.$w->avatarAlt.'",'."\n" : ''; |
---|
50 | $res .= 'count: '.$w->count.','."\n". |
---|
51 | 'auto_join_text_default: "'.$w->defaultText.'",'."\n". |
---|
52 | 'auto_join_text_ed: "'.$w->defaultText.'",'."\n". |
---|
53 | 'auto_join_text_ing: "'.$w->defaultText.'",'."\n". |
---|
54 | 'auto_join_text_reply: "'.$w->replyText.'",'."\n". |
---|
55 | 'auto_join_text_url: "'.$w->defaultText.'",'."\n". |
---|
56 | 'loading_text: "'.$w->loadText.'",'."\n". |
---|
57 | 'text_less_min: "'.$w->lessMin.'",'."\n". |
---|
58 | 'text_one_min: "'.$w->oneMin.'",'."\n". |
---|
59 | 'text_n_mins: "'.$w->nMins.'",'."\n". |
---|
60 | 'text_one_hour: "'.$w->oneHour.'",'."\n". |
---|
61 | 'text_n_hours: "'.$w->nHours.'",'."\n". |
---|
62 | 'text_one_day: "'.$w->oneDay.'",'."\n"; |
---|
63 | $res .= $w->dateAfter != '' ? 'date_after: '.$w->dateAfter.",\n" : ''; |
---|
64 | $res .= 'text_n_days: "'.$w->nDays.'"'."\n". |
---|
65 | "});\n". |
---|
66 | "});\n". |
---|
67 | "\n//]]>\n". |
---|
68 | "</script>\n". |
---|
69 | '<div class="'; |
---|
70 | $res .= $w->divClass != '' ? $w->divClass : 'tweet'; |
---|
71 | $res .= '">'. |
---|
72 | ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : ''). |
---|
73 | '</div>'; |
---|
74 | |
---|
75 | return $res; |
---|
76 | } |
---|
77 | |
---|
78 | } |
---|
79 | ?> |
---|