-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions.php
55 lines (52 loc) · 971 Bytes
/
functions.php
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
<?php
if (!defined('__TYPECHO_ROOT_DIR__'))
{
exit;
}
function body_class($archive)
{
if ($archive->is('index'))
{
$class = 'home';
}
if ($archive->is('post'))
{
$class = 'post';
}
if ($archive->is('page'))
{
$class = 'post';
}
if ($archive->is('archive'))
{
$class = 'archive';
}
echo $class;
}
function gravatar_url($mail, $size, $echo = true)
{
$rating = Helper::options()->commentsAvatarRating;
$Request = Typecho_Request::getInstance();
$default = null;
$url = Typecho_Common::gravatarUrl($mail, $size, $rating, $default, $Request->isSecure());
if ($mail == '' && $size == '' && $echo == false)
{
$url = str_replace('?s=&r=G&d=', '', $url);
return $url;
}
$url = Typecho_Common::gravatarUrl($mail, $size, $rating, $default, $Request->isSecure());
if ($echo)
{
echo $url;
}
else
{
return $url;
}
}
function footer_json()
{
echo json_encode(array(
'gravatar_prefix' => gravatar_url('', '', false),
));
}