diff --git a/includes/cravatar.php b/includes/cravatar.php new file mode 100644 index 0000000..028b173 --- /dev/null +++ b/includes/cravatar.php @@ -0,0 +1,115 @@ +'.__('You can update your profile picture at Cravatar.cn', 'wpavatar').''; + } + + 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() +{ + ?> +
+

+

+

Cravatar.cn.

+
+ + + + + + + + + + +
+ + + +
+ +
+
+ \n" "Language-Team: 薇晓朵 \n" "Language: zh_CN\n" @@ -13,261 +13,76 @@ msgstr "" "X-Generator: Poedit 3.1.1\n" "X-Poedit-Basepath: ..\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-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" +"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" -#: includes/shortcode.php:52 wpicp-license.php:145 -msgid "Beijing" -msgstr "北京" +#: includes/cravatar.php:44 +msgid "Cravatar Logo" +msgstr "头像" -#: includes/shortcode.php:53 wpicp-license.php:146 -msgid "Tianjin" -msgstr "天津" +#: includes/cravatar.php:59 +msgid "You can update your profile picture at Cravatar.cn" +msgstr "您可以在 Cravatar.cn 更新您的个人资料图片" -#: includes/shortcode.php:54 wpicp-license.php:147 -msgid "Hebei" -msgstr "河北" +#: includes/cravatar.php:72 +msgid "Avatar Settings" +msgstr "头像设置" -#: includes/shortcode.php:55 wpicp-license.php:148 -msgid "Shanxi" -msgstr "山西" +#: includes/cravatar.php:73 +msgid "Avatar" +msgstr "头像" -#: includes/shortcode.php:56 wpicp-license.php:149 -msgid "Inner Mongolia" -msgstr "内蒙古" +#: includes/cravatar.php:86 +msgid "WordPress Avatar Settings" +msgstr "文派头像设置" -#: includes/shortcode.php:57 wpicp-license.php:150 -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 +#: includes/cravatar.php:87 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 " -"WPICP.com" +"Cravatar is the perfect alternative to Gravatar in China, you can update " +"your avatar at" msgstr "" -"此插件永久免费,目的是补充 WordPress 中文版本所缺少的功能。更多信息请访问 WPICP.com" +"Cravatar(初认头像)是中国 Gravatar 的完美替代方案,您可以在官网更新您的头" +"像" -#: wpicp-license.php:116 -msgid "Why do you need?" -msgstr "为什么需要?" +#: includes/cravatar.php:95 +msgid "Enable Cravatar" +msgstr "启用Cravatar" -#: wpicp-license.php:117 -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. (What would happen if not?)" -msgstr "" -"ICP备案许可证是国家颁发的注册证,中国大陆所有公开网站都必须在网站首页显示有" -"ICP备案号。(如果没有会怎样?)" +#: includes/cravatar.php:98 +msgid "Yes" +msgstr "是" -#: wpicp-license.php:118 -msgid "How to use?" -msgstr "如何使用?" +#: includes/cravatar.php:99 +msgid "No" +msgstr "否" -#: wpicp-license.php:119 -msgid "" -"1. Enter your ICP license information below. (Find My " -"License?)" -msgstr "" -"1. 在下方输入您的 ICP 许可证信息。 (找到我的许可证?)" - -#: wpicp-license.php:120 -msgid "" -"2. Use the shortcode [wpicp_license] to display the license " -"information and link on your website. (Integrate into " -"theme?)" -msgstr "" -"2. 使用简码[wpicp_license]在您的网站上显示许可证信息和链接。(集成到主题?)" - -#: wpicp-license.php:127 -msgid "" -"Enter your ICP license number information. (Correct " -"format?)" -msgstr "" -"输入您的备案号。(正确格式?)" - -#: wpicp-license.php:131 -msgid "" -"Use the shortcode [wpicp_wangan], You need to register with the " -"Public Security Bureau (PSB) to have this license. (What " -"is PSB filing?)" -msgstr "" -"使用简码[wpicp_wangan],您需要在公安局(PSB)注册才能获得此备案" -"许可证。 (什么是公共安全备案?)" - -#: 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 许可证设置" +#: includes/cravatar.php:104 +msgid "Save Changes" +msgstr "保存更改" #. Plugin Name of the plugin/theme -msgid "WPICP License" -msgstr "文派 ICP 许可证" +msgid "WPAvatar" +msgstr "文派头像" #. Plugin URI of the plugin/theme -msgid "https://wpicp.com/download" -msgstr "https://wpicp.com/download" +msgid "https://wpavatar.com/download" +msgstr "https://wpavatar.com/download" #. Description of the plugin/theme -msgid "Must-have for WordPress sites in China, showing your ICP license." -msgstr "中国WordPress网站必备,显示您的 ICP 备案许可证。" +msgid "" +"Replace Gravatar with Cravatar, a perfect replacement of Gravatar in China." +msgstr "" +"替换 Gravatar 头像为 Cravatar 头像,这是 Gravatar 在中国的完美替代方案。" #. Author of the plugin/theme -msgid "WPICP.com" -msgstr "文派 ICP" +msgid "WPfanyi" +msgstr "文派翻译" #. Author URI of the plugin/theme -msgid "https://wpicp.com/" -msgstr "https://wpicp.com/" +msgid "https://wpfanyi.com/" +msgstr "https://wpfanyi.com/" diff --git a/languages/wpavatar-zh_TW.mo b/languages/wpavatar-zh_TW.mo index 7aab825..5948975 100644 Binary files a/languages/wpavatar-zh_TW.mo and b/languages/wpavatar-zh_TW.mo differ diff --git a/languages/wpavatar-zh_TW.po b/languages/wpavatar-zh_TW.po index 5a17933..249969a 100644 --- a/languages/wpavatar-zh_TW.po +++ b/languages/wpavatar-zh_TW.po @@ -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 "" 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: 薇晓朵 \n" +"Language-Team: 薇曉朵 \n" +"Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: GlotPress/4.0.0-alpha.4\n" -"Language: zh_TW\n" -"Project-Id-Version: Plugins - WPICP License - Development (trunk)\n" +"X-Generator: Poedit 3.1.1\n" +"X-Poedit-Basepath: ..\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 -msgid "Enter your Wangan license number and select the abbreviation of your province." -msgstr "輸入這個網站的公安局備案許可證號,並選取所在省份。" +#: includes/cravatar.php:44 +msgid "Cravatar Logo" +msgstr "頭像" -#: wpicp-license.php:155 -msgid "Xinjiang" -msgstr "新疆" +#: includes/cravatar.php:59 +msgid "You can update your profile picture at Cravatar.cn" +msgstr "您可以在 Cravatar.cn 更新您的個人資料圖片" -#: wpicp-license.php:154 -msgid "Ningxia" -msgstr "寧夏" +#: includes/cravatar.php:72 +msgid "Avatar Settings" +msgstr "頭像設定" -#: wpicp-license.php:153 -msgid "Qinghai" -msgstr "青海" +#: includes/cravatar.php:73 +msgid "Avatar" +msgstr "頭像" -#: wpicp-license.php:152 -msgid "Gansu" -msgstr "甘肅" +#: includes/cravatar.php:86 +msgid "WordPress Avatar Settings" +msgstr "文派頭像設定" -#: wpicp-license.php:151 -msgid "Shaanxi" -msgstr "陝西" +#: includes/cravatar.php:87 +msgid "" +"Cravatar is the perfect alternative to Gravatar in China, you can update " +"your avatar at" +msgstr "" +"Cravatar(初認頭像)是中國 Gravatar 的完美替代方案,您可以在官網更新您的頭" +"像" -#: wpicp-license.php:150 -msgid "Tibet" -msgstr "西藏" +#: includes/cravatar.php:95 +msgid "Enable Cravatar" +msgstr "啟用Cravatar" -#: wpicp-license.php:149 -msgid "Yunnan" -msgstr "雲南" +#: includes/cravatar.php:98 +msgid "Yes" +msgstr "是" -#: wpicp-license.php:148 -msgid "Guizhou" -msgstr "貴州" +#: includes/cravatar.php:99 +msgid "No" +msgstr "否" -#: wpicp-license.php:147 -msgid "Sichuan" -msgstr "四川" +#: includes/cravatar.php:104 +msgid "Save Changes" +msgstr "儲存更改" -#: wpicp-license.php:146 -msgid "Chongqing" -msgstr "重慶" +#. Plugin Name of the plugin/theme +msgid "WPAvatar" +msgstr "文派頭像" -#: wpicp-license.php:145 -msgid "Hainan" -msgstr "海南" +#. Plugin URI of the plugin/theme +msgid "https://wpavatar.com/download" +msgstr "https://wpavatar.com/download" -#: wpicp-license.php:144 -msgid "Guangxi" -msgstr "廣西" +#. Description of the plugin/theme +msgid "" +"Replace Gravatar with Cravatar, a perfect replacement of Gravatar in China." +msgstr "" +"替換 Gravatar 頭像為 Cravatar 頭像,這是 Gravatar 在中國的完美替代方案。" -#: wpicp-license.php:143 -msgid "Guangdong" -msgstr "廣東" +#. Author of the plugin/theme +msgid "WPfanyi" +msgstr "文派翻譯" -#: wpicp-license.php:142 -msgid "Hunan" -msgstr "湖南" - -#: 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 [wpicp_wangan], You need to register with the Public Security Bureau (PSB) to have this license. (What is PSB filing?)" -msgstr "使用短代碼 [wpicp_wangan]。網站管理員必須向中國公安局 (Public Security Bureau,PSB) 註冊以取得證號。(什麼是中國公安局備案)" - -#: 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. (Correct format?)" -msgstr "輸入這個網站的 ICP 備案許可證號。進一步了解正確格式" - -#: wpicp-license.php:99 -msgid "2. Use the shortcode [wpicp_license] to display the license information and link on your website. (Integrate into theme?)" -msgstr "2. 使用短代碼 [wpicp_license] 在這個網站上顯示 ICP 備案許可證號及連結。(與佈景主題整合的方式)" - -#: wpicp-license.php:98 -msgid "1. Enter your ICP license information below. (Find My License?)" -msgstr "1. 在下方輸入欄位輸入網站的 ICP 備案許可證號。(如何找到 ICP 備案許可證號)" - -#: 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. (What would happen if not?)" -msgstr "ICP 備案許可證號是中國頒發的網站註冊證明,在中國提供網際網路資訊服務的全部公開網站,都必須在網站首頁顯示 ICP 備案許可證號。(如果沒有 ICP 備案許可證號會發生什麼)" - -#: 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 WPICP.com" -msgstr "這個外掛永久免費,目的是為 WordPress 網站新增能加入 ICP 備案許可證號的功能。如需進一步了解,請造訪 WPICP.com。" - -#: 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" \ No newline at end of file +#. Author URI of the plugin/theme +msgid "https://wpfanyi.com/" +msgstr "https://wpfanyi.com/" diff --git a/wpavatar.php b/wpavatar.php index 42c86c1..ffc12c2 100644 --- a/wpavatar.php +++ b/wpavatar.php @@ -2,13 +2,12 @@ /** * Plugin Name: WPAvatar * 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 URI: https://wpfanyi.com/ * Text Domain: wpavatar * Domain Path: /languages * Version: 1.0 - * Network: True * License: GPLv2 or later * License URI: http://www.gnu.org/licenses/gpl-2.0.html * @@ -23,44 +22,23 @@ * GNU General Public License for more details. */ - if ( ! function_exists( 'get_cravatar_url' ) ) { - /** - * 替换 Gravatar 头像为 Cravatar 头像 - * - * Cravatar 是 Gravatar 在中国的完美替代方案,你可以在 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 ); - } - 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' ) ) { - /** - * 替换 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 '您可以在 Cravatar 修改您的资料图片'; - } - add_filter( 'user_profile_picture_description', 'set_user_profile_picture_for_cravatar', 1 ); - } +if (!defined('ABSPATH')) { + exit; // Exit if accessed directly +} + + +require_once( plugin_dir_path( __FILE__ ) . 'includes/cravatar.php' ); + + +register_activation_hook( __FILE__, 'wpavatar_activate' ); + +function wpavatar_activate() { + update_option( 'wpavatar_enable_cravatar', '1' ); +} + + +// Load translation +add_action( 'init', 'wpavatar_load_textdomain' ); +function wpavatar_load_textdomain() { + load_plugin_textdomain( 'wpavatar', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); +}