Skip to content

Commit

Permalink
✨ 增加gravatar镜像源
Browse files Browse the repository at this point in the history
  • Loading branch information
Licoy committed Nov 1, 2022
1 parent fdd8e5f commit 6057a62
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 8 deletions.
26 changes: 26 additions & 0 deletions inc/classes/PuockMetaBox.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace Puock\Theme\classes;

class PuockMetaBox
{
private static $args = array();

public static function newPostMeta($id, $args = array())
{
self::$args['post'][$id] = $args;
}

public static function newTaxonomyMeta($id, $args = array())
{
self::$args['taxonomy'][$id] = $args;
}

public static function newSection($id, $args = array())
{
self::$args['section'][$id] = $args;
}

public static function load(){
}
}
15 changes: 7 additions & 8 deletions inc/fun/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,20 +343,19 @@ function pk_post_style_list()
if ($type == 'cravatar') {
add_filter('get_avatar', 'cr_avatar');
add_filter('get_avatar_url', 'cr_avatar');
}
if ($type == 'cn') {
}else if ($type == 'loli') {
add_filter('get_avatar', 'loli_avatar');
add_filter('get_avatar_url', 'loli_avatar');
}else if ($type == 'cn') {
add_filter('get_avatar', 'cn_avatar');
add_filter('get_avatar_url', 'cn_avatar');
}
if ($type == 'cn_ssl') {
}else if ($type == 'cn_ssl') {
add_filter('get_avatar', 'cn_ssl_avatar');
add_filter('get_avatar_url', 'cn_ssl_avatar');
}
if ($type == 'loli_ssl') {
}else if ($type == 'loli_ssl') {
add_filter('get_avatar', 'loli_ssl_avatar');
add_filter('get_avatar_url', 'loli_ssl_avatar');
}
if ($type == 'v2ex') {
}else if ($type == 'v2ex') {
add_filter('get_avatar', 'v2ex_ssl_avatar');
add_filter('get_avatar_url', 'v2ex_ssl_avatar');
}
Expand Down
6 changes: 6 additions & 0 deletions inc/fun/opt.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ function cr_avatar($avatar)
return str_replace($gravatar_urls, 'cravatar.cn', $avatar);
}

function loli_avatar($avatar)
{
global $gravatar_urls;
return str_replace($gravatar_urls, 'gravatar.loli.net', $avatar);
}

function cn_ssl_avatar($avatar)
{
global $gravatar_urls;
Expand Down
4 changes: 4 additions & 0 deletions inc/setting/options/OptionBasic.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ function get_fields(): array
'value' => 'v2ex',
'label' => 'v2ex提供的SSL节点',
],
[
'value'=>'loli',
'label'=>'loli.net节点'
]
],
],
[
Expand Down

0 comments on commit 6057a62

Please sign in to comment.