功能更新

This commit is contained in:
feng 2023-04-16 23:50:36 +08:00
parent 1de962f801
commit 57d40cc8ac
6 changed files with 253 additions and 477 deletions

115
includes/cravatar.php Normal file
View file

@ -0,0 +1,115 @@
<?php
/*
Name: Cravatar
URI: https://cravatar.cn
License: GPL-2.0+
License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
if (!function_exists('get_cravatar_url')) {
/**
* Replace Gravatar with Cravatar
*
* Cravatar is the perfect alternative to Gravatar in China, you can update your avatar at https://cravatar.cn.
*/
function get_cravatar_url($url)
{
$sources = array(
'www.gravatar.com',
'0.gravatar.com',
'1.gravatar.com',
'2.gravatar.com',
'secure.gravatar.com',
'cn.gravatar.com',
'gravatar.com',
);
return str_replace($sources, 'cravatar.cn', $url);
}
if (get_option('wpavatar_enable_cravatar', '0') == '1') {
add_filter('um_user_avatar_url_filter', 'get_cravatar_url', 1);
add_filter('bp_gravatar_url', 'get_cravatar_url', 1);
add_filter('get_avatar_url', 'get_cravatar_url', 1);
}
}
if (!function_exists('set_defaults_for_cravatar')) {
/**
* Replace default avatar with Cravatar in Discussion Settings
*/
function set_defaults_for_cravatar($avatar_defaults)
{
$avatar_defaults['gravatar_default'] = __('Cravatar Logo', 'wpavatar');
return $avatar_defaults;
}
if (get_option('wpavatar_enable_cravatar', '0') == '1') {
add_filter('avatar_defaults', 'set_defaults_for_cravatar', 1);
}
}
if (!function_exists('set_user_profile_picture_for_cravatar')) {
/**
* Replace avatar upload link in user profile
*/
function set_user_profile_picture_for_cravatar()
{
return '<a href="https://cravatar.cn" target="_blank" rel="noopener">'.__('You can update your profile picture at Cravatar.cn', 'wpavatar').'</a>';
}
if (get_option('wpavatar_enable_cravatar', '0') == '1') {
add_filter('user_profile_picture_description', 'set_user_profile_picture_for_cravatar', 1);
}
}
add_action('admin_menu', 'wpavatar_create_settings_page');
function wpavatar_create_settings_page()
{
add_options_page(
__('Avatar Settings', 'wpavatar'),
__('Avatar', 'wpavatar'),
'manage_options',
'wpavatar-settings',
'wpavatar_render_settings_page'
);
}
function wpavatar_render_settings_page()
{
?>
<div class="wrap">
<h1><?php echo esc_html(get_admin_page_title()); ?></h1>
<h2><?php _e( 'WordPress Avatar Settings', 'wpavatar' ); ?></h2>
<p><?php _e( 'Cravatar is the perfect alternative to Gravatar in China, you can update your avatar at', 'wpavatar' ); ?> <a href="https://cravatar.cn" target="_blank" rel="noopener">Cravatar.cn</a>.</p>
<form method="post" action="options.php">
<?php settings_fields('wpavatar_settings'); ?>
<?php do_settings_sections('wpavatar-settings'); ?>
<table class="form-table">
<tbody>
<tr>
<th scope="row"><?php _e('Enable Cravatar', 'wpavatar'); ?></th>
<td>
<?php $enable_cravatar = get_option('wpavatar_enable_cravatar', '1'); ?>
<label><input type="radio" name="wpavatar_enable_cravatar" value="1" <?php checked($enable_cravatar, '1'); ?>> <?php _e('Yes', 'wpavatar'); ?></label>
<label><input type="radio" name="wpavatar_enable_cravatar" value="0" <?php checked($enable_cravatar, '0'); ?>> <?php _e('No', 'wpavatar'); ?></label>
</td>
</tr>
</tbody>
</table>
<?php submit_button(__('Save Changes', 'wpavatar')); ?>
</form>
</div>
<?php
}
add_action('admin_init', 'wpavatar_register_settings');
function wpavatar_register_settings()
{
register_setting('wpavatar_settings', 'wpavatar_enable_cravatar', 'absint');
}

Binary file not shown.

View file

@ -1,8 +1,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WPICP License\n" "Project-Id-Version: WPAvatar\n"
"POT-Creation-Date: 2023-03-30 22:41+0800\n" "POT-Creation-Date: 2023-04-16 23:45+0800\n"
"PO-Revision-Date: 2023-03-30 22:42+0800\n" "PO-Revision-Date: 2023-04-16 23:45+0800\n"
"Last-Translator: 薇晓朵 <support@weixiaoduo.com>\n" "Last-Translator: 薇晓朵 <support@weixiaoduo.com>\n"
"Language-Team: 薇晓朵 <support@weixiaoduo.com>\n" "Language-Team: 薇晓朵 <support@weixiaoduo.com>\n"
"Language: zh_CN\n" "Language: zh_CN\n"
@ -13,261 +13,76 @@ msgstr ""
"X-Generator: Poedit 3.1.1\n" "X-Generator: Poedit 3.1.1\n"
"X-Poedit-Basepath: ..\n" "X-Poedit-Basepath: ..\n"
"X-Poedit-Flags-xgettext: --add-comments=translators:\n" "X-Poedit-Flags-xgettext: --add-comments=translators:\n"
"X-Poedit-WPHeader: wpicp-license.php\n" "X-Poedit-WPHeader: wpavatar.php\n"
"X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;" "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;" "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;"
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n" "_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
"X-Poedit-SearchPath-0: .\n" "X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: *.min.js\n" "X-Poedit-SearchPathExcluded-0: *.min.js\n"
#: includes/shortcode.php:52 wpicp-license.php:145 #: includes/cravatar.php:44
msgid "Beijing" msgid "Cravatar Logo"
msgstr "北京" msgstr "头像"
#: includes/shortcode.php:53 wpicp-license.php:146 #: includes/cravatar.php:59
msgid "Tianjin" msgid "You can update your profile picture at Cravatar.cn"
msgstr "天津" msgstr "您可以在 Cravatar.cn 更新您的个人资料图片"
#: includes/shortcode.php:54 wpicp-license.php:147 #: includes/cravatar.php:72
msgid "Hebei" msgid "Avatar Settings"
msgstr "河北" msgstr "头像设置"
#: includes/shortcode.php:55 wpicp-license.php:148 #: includes/cravatar.php:73
msgid "Shanxi" msgid "Avatar"
msgstr "山西" msgstr "头像"
#: includes/shortcode.php:56 wpicp-license.php:149 #: includes/cravatar.php:86
msgid "Inner Mongolia" msgid "WordPress Avatar Settings"
msgstr "内蒙古" msgstr "文派头像设置"
#: includes/shortcode.php:57 wpicp-license.php:150 #: includes/cravatar.php:87
msgid "Liaoning"
msgstr "辽宁"
#: includes/shortcode.php:58 wpicp-license.php:151
msgid "Jilin"
msgstr "吉林"
#: includes/shortcode.php:59 wpicp-license.php:152
msgid "Heilongjiang"
msgstr "黑龙江"
#: includes/shortcode.php:60 wpicp-license.php:153
msgid "Shanghai"
msgstr "上海"
#: includes/shortcode.php:61 wpicp-license.php:154
msgid "Jiangsu"
msgstr "江苏"
#: includes/shortcode.php:62 wpicp-license.php:155
msgid "Zhejiang"
msgstr "浙江"
#: includes/shortcode.php:63 wpicp-license.php:156
msgid "Anhui"
msgstr "安徽"
#: includes/shortcode.php:64 wpicp-license.php:157
msgid "Fujian"
msgstr "福建"
#: includes/shortcode.php:65 wpicp-license.php:158
msgid "Jiangxi"
msgstr "江西"
#: includes/shortcode.php:66 wpicp-license.php:159
msgid "Shandong"
msgstr "山东"
#: includes/shortcode.php:67 wpicp-license.php:160
msgid "Henan"
msgstr "河南"
#: includes/shortcode.php:68 wpicp-license.php:161
msgid "Hubei"
msgstr "湖北"
#: includes/shortcode.php:69 wpicp-license.php:162
msgid "Hunan"
msgstr "湖南"
#: includes/shortcode.php:70 wpicp-license.php:163
msgid "Guangdong"
msgstr "广东"
#: includes/shortcode.php:71 wpicp-license.php:164
msgid "Guangxi"
msgstr "广西"
#: includes/shortcode.php:72 wpicp-license.php:165
msgid "Hainan"
msgstr "海南"
#: includes/shortcode.php:73 wpicp-license.php:166
msgid "Chongqing"
msgstr "重庆"
#: includes/shortcode.php:74 wpicp-license.php:167
msgid "Sichuan"
msgstr "四川"
#: includes/shortcode.php:75 wpicp-license.php:168
msgid "Guizhou"
msgstr "贵州"
#: includes/shortcode.php:76 wpicp-license.php:169
msgid "Yunnan"
msgstr "云南"
#: includes/shortcode.php:77 wpicp-license.php:170
msgid "Tibet"
msgstr "西藏"
#: includes/shortcode.php:78 wpicp-license.php:171
msgid "Shaanxi"
msgstr "陕西"
#: includes/shortcode.php:79 wpicp-license.php:172
msgid "Gansu"
msgstr "甘肃"
#: includes/shortcode.php:80 wpicp-license.php:173
msgid "Qinghai"
msgstr "青海"
#: includes/shortcode.php:81 wpicp-license.php:174
msgid "Ningxia"
msgstr "宁夏"
#: includes/shortcode.php:82 wpicp-license.php:175
msgid "Xinjiang"
msgstr "新疆"
#: wpicp-license.php:36
msgid "WP ICP License Settings"
msgstr "文派 ICP 许可证设置"
#: wpicp-license.php:37 wpicp-license.php:69 wpicp-license.php:105
msgid "ICP License"
msgstr "ICP 备案号"
#: wpicp-license.php:57
msgid "WordPress ICP License Namber"
msgstr "文派(WordPress) ICP 备案许可证"
#: wpicp-license.php:63
msgid "China Wangan License Number"
msgstr "中国公安网许可证"
#: wpicp-license.php:77
msgid "Wangan License"
msgstr "网安备案号"
#: wpicp-license.php:84
msgid "Province"
msgstr "省份"
#: wpicp-license.php:99
msgid "Enter your ICP license number information."
msgstr "输入您的备案号。"
#: wpicp-license.php:115
msgid "" msgid ""
"This plugin is free forever, and its purpose is to supplement the essential " "Cravatar is the perfect alternative to Gravatar in China, you can update "
"functions that the Chinese version of WordPress lacks. More information at " "your avatar at"
"<a href=\"https://wpicp.com\" target=\"_blank\" rel=\"noopener\">WPICP.com</"
"a>"
msgstr "" msgstr ""
"此插件永久免费,目的是补充 WordPress 中文版本所缺少的功能。更多信息请访问 <a " "Cravatar初认头像是中国 Gravatar 的完美替代方案,您可以在官网更新您的头"
"href=\"https://wpicp.com\" target=\"_blank\" rel=\"noopener\">WPICP.com</a>" "像"
#: wpicp-license.php:116 #: includes/cravatar.php:95
msgid "Why do you need?" msgid "Enable Cravatar"
msgstr "为什么需要?" msgstr "启用Cravatar"
#: wpicp-license.php:117 #: includes/cravatar.php:98
msgid "" msgid "Yes"
"The ICP license is a state-issued registration, All public websites in " msgstr "是"
"mainland China must have an ICP number listed on the homepage of the "
"website. <a href=\"https://wpicp.com/document/what-would-happen-if-not\" "
"target=\"_blank\" rel=\"noopener\">(What would happen if not?)</a>"
msgstr ""
"ICP备案许可证是国家颁发的注册证中国大陆所有公开网站都必须在网站首页显示有"
"ICP备案号。<a href=\"https://wpicp.com/document/what-would-happen-if-not\" "
"target=\"_blank\" rel=\"noopener\">(如果没有会怎样?)</a>"
#: wpicp-license.php:118 #: includes/cravatar.php:99
msgid "How to use?" msgid "No"
msgstr "如何使用?" msgstr "否"
#: wpicp-license.php:119 #: includes/cravatar.php:104
msgid "" msgid "Save Changes"
"1. Enter your ICP license information below. <a href=\"https://wpicp.com/" msgstr "保存更改"
"document/find-my-license\" target=\"_blank\" rel=\"noopener\">(Find My "
"License?)</a>"
msgstr ""
"1. 在下方输入您的 ICP 许可证信息。 <a href=\"https://wpicp.com/document/find-"
"my-license\" target=\"_blank\" rel=\"noopener\">(找到我的许可证?)</a>"
#: wpicp-license.php:120
msgid ""
"2. Use the shortcode <code>[wpicp_license]</code> to display the license "
"information and link on your website. <a href=\"https://wpicp.com/document/"
"integrate-into-theme\" target=\"_blank\" rel=\"noopener\">(Integrate into "
"theme?)</a>"
msgstr ""
"2. 使用简码<code>[wpicp_license]</code>在您的网站上显示许可证信息和链接。<a "
"href=\"https://wpicp.com/document/integrate-into-theme\" target=\"_blank\" "
"rel=\"noopener\">(集成到主题?)</a>"
#: wpicp-license.php:127
msgid ""
"Enter your ICP license number information. <a href=\"https://wpicp.com/"
"document/correct-format\" target=\"_blank\" rel=\"noopener\">(Correct "
"format?)</a>"
msgstr ""
"输入您的备案号。<a href=\"https://wpicp.com/document/correct-format\" target="
"\"_blank\" rel=\"noopener\">(正确格式?)</a>"
#: wpicp-license.php:131
msgid ""
"Use the shortcode <code>[wpicp_wangan]</code>, You need to register with the "
"Public Security Bureau (PSB) to have this license. <a href=\"https://wpicp."
"com/document/what-is-psb-filing\" target=\"_blank\" rel=\"noopener\">(What "
"is PSB filing?)</a>"
msgstr ""
"使用简码<code>[wpicp_wangan]</code>您需要在公安局PSB注册才能获得此备案"
"许可证。 <a href=\"https://wpicp.com/document/what-is-psb-filing\" target="
"\"_blank\" rel=\"noopener\">(什么是公共安全备案?)</a>"
#: wpicp-license.php:189
msgid ""
"Enter your Wangan license number and select the abbreviation of your "
"province."
msgstr "输入您的网安备案号并选择您所在省份的简称。"
#: wpicp-license.php:199
msgid "ICP License Settings"
msgstr "ICP 许可证设置"
#. Plugin Name of the plugin/theme #. Plugin Name of the plugin/theme
msgid "WPICP License" msgid "WPAvatar"
msgstr "文派 ICP 许可证" msgstr "文派头像"
#. Plugin URI of the plugin/theme #. Plugin URI of the plugin/theme
msgid "https://wpicp.com/download" msgid "https://wpavatar.com/download"
msgstr "https://wpicp.com/download" msgstr "https://wpavatar.com/download"
#. Description of the plugin/theme #. Description of the plugin/theme
msgid "Must-have for WordPress sites in China, showing your ICP license." msgid ""
msgstr "中国WordPress网站必备显示您的 ICP 备案许可证。" "Replace Gravatar with Cravatar, a perfect replacement of Gravatar in China."
msgstr ""
"替换 Gravatar 头像为 Cravatar 头像,这是 Gravatar 在中国的完美替代方案。"
#. Author of the plugin/theme #. Author of the plugin/theme
msgid "WPICP.com" msgid "WPfanyi"
msgstr "文派 ICP" msgstr "文派翻译"
#. Author URI of the plugin/theme #. Author URI of the plugin/theme
msgid "https://wpicp.com/" msgid "https://wpfanyi.com/"
msgstr "https://wpicp.com/" msgstr "https://wpfanyi.com/"

Binary file not shown.

View file

@ -1,220 +1,88 @@
# Translation of Plugins - WPICP License - Development (trunk) in Chinese (Taiwan)
# This file is distributed under the same license as the Plugins - WPICP License - Development (trunk) package.
msgid "" msgid ""
msgstr "" msgstr ""
"PO-Revision-Date: 2023-03-19 07:28:23+0000\n" "Project-Id-Version: WPAvatar\n"
"POT-Creation-Date: 2023-04-16 23:45+0800\n"
"PO-Revision-Date: 2023-04-16 23:47+0800\n"
"Last-Translator: 薇晓朵 <support@weixiaoduo.com>\n"
"Language-Team: 薇曉朵 <support@weixiaoduo.com>\n"
"Language: zh_TW\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n" "Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: GlotPress/4.0.0-alpha.4\n" "X-Generator: Poedit 3.1.1\n"
"Language: zh_TW\n" "X-Poedit-Basepath: ..\n"
"Project-Id-Version: Plugins - WPICP License - Development (trunk)\n" "X-Poedit-Flags-xgettext: --add-comments=translators:\n"
"X-Poedit-WPHeader: wpavatar.php\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;"
"_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: *.min.js\n"
#: wpicp-license.php:169 #: includes/cravatar.php:44
msgid "Enter your Wangan license number and select the abbreviation of your province." msgid "Cravatar Logo"
msgstr "輸入這個網站的公安局備案許可證號,並選取所在省份。" msgstr "頭像"
#: wpicp-license.php:155 #: includes/cravatar.php:59
msgid "Xinjiang" msgid "You can update your profile picture at Cravatar.cn"
msgstr "新疆" msgstr "您可以在 Cravatar.cn 更新您的個人資料圖片"
#: wpicp-license.php:154 #: includes/cravatar.php:72
msgid "Ningxia" msgid "Avatar Settings"
msgstr "寧夏" msgstr "頭像設定"
#: wpicp-license.php:153 #: includes/cravatar.php:73
msgid "Qinghai" msgid "Avatar"
msgstr "青海" msgstr "頭像"
#: wpicp-license.php:152 #: includes/cravatar.php:86
msgid "Gansu" msgid "WordPress Avatar Settings"
msgstr "甘肅" msgstr "文派頭像設定"
#: wpicp-license.php:151 #: includes/cravatar.php:87
msgid "Shaanxi" msgid ""
msgstr "陝西" "Cravatar is the perfect alternative to Gravatar in China, you can update "
"your avatar at"
msgstr ""
"Cravatar初認頭像是中國 Gravatar 的完美替代方案,您可以在官網更新您的頭"
"像"
#: wpicp-license.php:150 #: includes/cravatar.php:95
msgid "Tibet" msgid "Enable Cravatar"
msgstr "西藏" msgstr "啟用Cravatar"
#: wpicp-license.php:149 #: includes/cravatar.php:98
msgid "Yunnan" msgid "Yes"
msgstr "雲南" msgstr ""
#: wpicp-license.php:148 #: includes/cravatar.php:99
msgid "Guizhou" msgid "No"
msgstr "貴州" msgstr ""
#: wpicp-license.php:147 #: includes/cravatar.php:104
msgid "Sichuan" msgid "Save Changes"
msgstr "四川" msgstr "儲存更改"
#: wpicp-license.php:146 #. Plugin Name of the plugin/theme
msgid "Chongqing" msgid "WPAvatar"
msgstr "重慶" msgstr "文派頭像"
#: wpicp-license.php:145 #. Plugin URI of the plugin/theme
msgid "Hainan" msgid "https://wpavatar.com/download"
msgstr "海南" msgstr "https://wpavatar.com/download"
#: wpicp-license.php:144 #. Description of the plugin/theme
msgid "Guangxi" msgid ""
msgstr "廣西" "Replace Gravatar with Cravatar, a perfect replacement of Gravatar in China."
msgstr ""
"替換 Gravatar 頭像為 Cravatar 頭像,這是 Gravatar 在中國的完美替代方案。"
#: wpicp-license.php:143 #. Author of the plugin/theme
msgid "Guangdong" msgid "WPfanyi"
msgstr "廣東" msgstr "文派翻譯"
#: wpicp-license.php:142 #. Author URI of the plugin/theme
msgid "Hunan" msgid "https://wpfanyi.com/"
msgstr "湖南" msgstr "https://wpfanyi.com/"
#: wpicp-license.php:141
msgid "Hubei"
msgstr "湖北"
#: wpicp-license.php:140
msgid "Henan"
msgstr "河南"
#: wpicp-license.php:139
msgid "Shandong"
msgstr "山東"
#: wpicp-license.php:138
msgid "Jiangxi"
msgstr "江西"
#: wpicp-license.php:137
msgid "Fujian"
msgstr "福建"
#: wpicp-license.php:136
msgid "Anhui"
msgstr "安徽"
#: wpicp-license.php:135
msgid "Zhejiang"
msgstr "浙江"
#: wpicp-license.php:134
msgid "Jiangsu"
msgstr "江蘇"
#: wpicp-license.php:133
msgid "Shanghai"
msgstr "上海"
#: wpicp-license.php:132
msgid "Heilongjiang"
msgstr "黑龍江"
#: wpicp-license.php:131
msgid "Jilin"
msgstr "吉林"
#: wpicp-license.php:130
msgid "Liaoning"
msgstr "遼寧"
#: wpicp-license.php:129
msgid "Inner Mongolia"
msgstr "內蒙古"
#: wpicp-license.php:128
msgid "Shanxi"
msgstr "山西"
#: wpicp-license.php:127
msgid "Hebei"
msgstr "河北"
#: wpicp-license.php:126
msgid "Tianjin"
msgstr "天津"
#: wpicp-license.php:125
msgid "Beijing"
msgstr "北京"
#: wpicp-license.php:111
msgid "Use the shortcode <code>[wpicp_wangan]</code>, You need to register with the Public Security Bureau (PSB) to have this license. <a href=\"https://wpicp.com/document/what-is-psb-filing\" target=\"_blank\" rel=\"noopener\">(What is PSB filing?)</a>"
msgstr "使用短代碼 <code>[wpicp_wangan]</code>。網站管理員必須向中國公安局 (Public Security BureauPSB) 註冊以取得證號。<a href=\"https://wpicp.com/document/what-is-psb-filing\" target=\"_blank\" rel=\"noopener\">(什麼是中國公安局備案)</a>"
#: wpicp-license.php:79
msgid "Province"
msgstr "中國省份"
#: wpicp-license.php:72
msgid "Wangan License"
msgstr "公安網備案證號"
#: wpicp-license.php:58
msgid "China Wangan License Number"
msgstr "中國公安局備案證號"
#: wpicp-license.php:179
msgid "ICP License Settings"
msgstr "ICP 備案許可證號設定"
#: wpicp-license.php:107
msgid "Enter your ICP license number information. <a href=\"https://wpicp.com/document/correct-format\" target=\"_blank\" rel=\"noopener\">(Correct format?)</a>"
msgstr "輸入這個網站的 ICP 備案許可證號。<a href=\"https://wpicp.com/document/correct-format\" target=\"_blank\" rel=\"noopener\">進一步了解正確格式</a>"
#: wpicp-license.php:99
msgid "2. Use the shortcode <code>[wpicp_license]</code> to display the license information and link on your website. <a href=\"https://wpicp.com/document/integrate-into-theme\" target=\"_blank\" rel=\"noopener\">(Integrate into theme?)</a>"
msgstr "2. 使用短代碼 <code>[wpicp_license]</code> 在這個網站上顯示 ICP 備案許可證號及連結。<a href=\"https://wpicp.com/document/integrate-into-theme\" target=\"_blank\" rel=\"noopener\">(與佈景主題整合的方式)</a>"
#: wpicp-license.php:98
msgid "1. Enter your ICP license information below. <a href=\"https://wpicp.com/document/find-my-license\" target=\"_blank\" rel=\"noopener\">(Find My License?)</a>"
msgstr "1. 在下方輸入欄位輸入網站的 ICP 備案許可證號。<a href=\"https://wpicp.com/document/find-my-license\" target=\"_blank\" rel=\"noopener\">(如何找到 ICP 備案許可證號)</a>"
#: wpicp-license.php:97
msgid "How to use?"
msgstr "使用方式"
#: wpicp-license.php:96
msgid "The ICP license is a state-issued registration, All public websites in mainland China must have an ICP number listed on the homepage of the website. <a href=\"https://wpicp.com/document/what-would-happen-if-not\" target=\"_blank\" rel=\"noopener\">(What would happen if not?)</a>"
msgstr "ICP 備案許可證號是中國頒發的網站註冊證明,在中國提供網際網路資訊服務的全部公開網站,都必須在網站首頁顯示 ICP 備案許可證號。<a href=\"https://wpicp.com/document/what-would-happen-if-not\" target=\"_blank\" rel=\"noopener\">(如果沒有 ICP 備案許可證號會發生什麼)</a>"
#: wpicp-license.php:95
msgid "Why do you need?"
msgstr "為什麼需要 ICP 備案許可證號"
#: wpicp-license.php:94
msgid "This plugin is free forever, and its purpose is to supplement the essential functions that the Chinese version of WordPress lacks. More information at <a href=\"https://wpicp.com\" target=\"_blank\" rel=\"noopener\">WPICP.com</a>"
msgstr "這個外掛永久免費,目的是為 WordPress 網站新增能加入 ICP 備案許可證號的功能。如需進一步了解,請造訪 <a href=\"https://wpicp.com\" target=\"_blank\" rel=\"noopener\">WPICP.com</a>。"
#: wpicp-license.php:52
msgid "WordPress ICP License Namber"
msgstr "WordPress 網站 ICP 備案許可證號"
#: wpicp-license.php:32 wpicp-license.php:64
msgid "ICP License"
msgstr "ICP 備案許可證號"
#: wpicp-license.php:31
msgid "WP ICP License Settings"
msgstr "WordPress 網站 ICP 備案許可證號設定"
#. Author URI of the plugin
msgid "https://wpicp.com/"
msgstr "https://wpicp.com/"
#. Author of the plugin
msgid "WPICP.com"
msgstr "文派 ICP"
#. Description of the plugin
msgid "Must-have for WordPress sites in China, showing your ICP license."
msgstr "目標對象為中國使用者的 WordPress 網站必備外掛,用於顯示網站 ICP 備案許可證號。"
#. Plugin URI of the plugin
msgid "https://wpicp.com/download"
msgstr "https://wpicp.com/download"
#. Plugin Name of the plugin
msgid "WPICP License"
msgstr "WPICP License"

View file

@ -2,13 +2,12 @@
/** /**
* Plugin Name: WPAvatar * Plugin Name: WPAvatar
* Plugin URI: https://wpavatar.com/download * Plugin URI: https://wpavatar.com/download
* Description: Must-have for WordPress sites in China, showing your ICP license. * Description: Replace Gravatar with Cravatar, a perfect replacement of Gravatar in China.
* Author: WPfanyi * Author: WPfanyi
* Author URI: https://wpfanyi.com/ * Author URI: https://wpfanyi.com/
* Text Domain: wpavatar * Text Domain: wpavatar
* Domain Path: /languages * Domain Path: /languages
* Version: 1.0 * Version: 1.0
* Network: True
* License: GPLv2 or later * License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html * License URI: http://www.gnu.org/licenses/gpl-2.0.html
* *
@ -23,44 +22,23 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
if ( ! function_exists( 'get_cravatar_url' ) ) { if (!defined('ABSPATH')) {
/** exit; // Exit if accessed directly
* 替换 Gravatar 头像为 Cravatar 头像 }
*
* Cravatar Gravatar 在中国的完美替代方案,你可以在 https://cravatar.cn 更新你的头像
*/ require_once( plugin_dir_path( __FILE__ ) . 'includes/cravatar.php' );
function get_cravatar_url( $url ) {
$sources = array(
'www.gravatar.com', register_activation_hook( __FILE__, 'wpavatar_activate' );
'0.gravatar.com',
'1.gravatar.com', function wpavatar_activate() {
'2.gravatar.com', update_option( 'wpavatar_enable_cravatar', '1' );
'secure.gravatar.com', }
'cn.gravatar.com',
'gravatar.com',
); // Load translation
return str_replace( $sources, 'cravatar.cn', $url ); add_action( 'init', 'wpavatar_load_textdomain' );
} function wpavatar_load_textdomain() {
add_filter( 'um_user_avatar_url_filter', 'get_cravatar_url', 1 ); load_plugin_textdomain( 'wpavatar', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
add_filter( 'bp_gravatar_url', 'get_cravatar_url', 1 ); }
add_filter( 'get_avatar_url', 'get_cravatar_url', 1 );
}
if ( ! function_exists( 'set_defaults_for_cravatar' ) ) {
/**
* 替换 WordPress 讨论设置中的默认头像
*/
function set_defaults_for_cravatar( $avatar_defaults ) {
$avatar_defaults['gravatar_default'] = 'Cravatar 标志';
return $avatar_defaults;
}
add_filter( 'avatar_defaults', 'set_defaults_for_cravatar', 1 );
}
if ( ! function_exists( 'set_user_profile_picture_for_cravatar' ) ) {
/**
* 替换个人资料卡中的头像上传地址
*/
function set_user_profile_picture_for_cravatar() {
return '<a href="https://cravatar.cn" target="_blank">您可以在 Cravatar 修改您的资料图片</a>';
}
add_filter( 'user_profile_picture_description', 'set_user_profile_picture_for_cravatar', 1 );
}