diff --git a/README.md b/README.md index baf2210..80bcecf 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ ![avatar](https://ps.w.org/wpicp-license/assets/banner-1544x500.png) - 描述 -中国WordPress站点必备,展示您的 ICP 许可证。 + 描述 +中国WordPress站点必备,展示您的 ICP 许可证。 ICP 许可证使用方法: diff --git a/includes/shortcode.php b/includes/shortcode.php new file mode 100644 index 0000000..b66742e --- /dev/null +++ b/includes/shortcode.php @@ -0,0 +1,99 @@ +' . $license_text . ''; + return $license_link; + } +} + + +// Add Wangan shortcode +add_shortcode( 'wpicp_wangan', 'wpicp_wangan_shortcode' ); + +function wpicp_wangan_shortcode() { + $wpicp_wangan = get_option( 'wpicp_wangan' ); + $wpicp_province = get_option( 'wpicp_province' ); + + if ( $wpicp_wangan ) { + $wangan_text = 'Wangan License' . $wpicp_province . '公网安备' . $wpicp_wangan . '号' ; + $wangan_url = 'https://www.beian.gov.cn/portal/registerSystemInfo?recordcode=' . urlencode($wpicp_wangan); + $target = '_blank'; + $nofollow = 'nofollow'; + $wangan_link = '' . $wangan_text . ''; + return $wangan_link; + } +} + + +// Add wpicp_province shortcode +add_shortcode( 'wpicp_province', 'wpicp_province_shortcode' ); + +function wpicp_province_shortcode() { + $wpicp_province = get_option( 'wpicp_province' ); + $provinces = array( + '京' => __('Beijing', 'wpicp-license'), + '津' => __('Tianjin', 'wpicp-license'), + '冀' => __('Hebei', 'wpicp-license'), + '晋' => __('Shanxi', 'wpicp-license'), + '蒙' => __('Inner Mongolia', 'wpicp-license'), + '辽' => __('Liaoning', 'wpicp-license'), + '吉' => __('Jilin', 'wpicp-license'), + '黑' => __('Heilongjiang', 'wpicp-license'), + '沪' => __('Shanghai', 'wpicp-license'), + '苏' => __('Jiangsu', 'wpicp-license'), + '浙' => __('Zhejiang', 'wpicp-license'), + '皖' => __('Anhui', 'wpicp-license'), + '闽' => __('Fujian', 'wpicp-license'), + '赣' => __('Jiangxi', 'wpicp-license'), + '鲁' => __('Shandong', 'wpicp-license'), + '豫' => __('Henan', 'wpicp-license'), + '鄂' => __('Hubei', 'wpicp-license'), + '湘' => __('Hunan', 'wpicp-license'), + '粤' => __('Guangdong', 'wpicp-license'), + '桂' => __('Guangxi', 'wpicp-license'), + '琼' => __('Hainan', 'wpicp-license'), + '渝' => __('Chongqing', 'wpicp-license'), + '川' => __('Sichuan', 'wpicp-license'), + '黔' => __('Guizhou', 'wpicp-license'), + '滇' => __('Yunnan', 'wpicp-license'), + '藏' => __('Tibet', 'wpicp-license'), + '陕' => __('Shaanxi', 'wpicp-license'), + '甘' => __('Gansu', 'wpicp-license'), + '青' => __('Qinghai', 'wpicp-license'), + '宁' => __('Ningxia', 'wpicp-license'), + '新' => __('Xinjiang', 'wpicp-license') + // ... add more provinces here + ); + if ( isset( $provinces[ $wpicp_province ] ) ) { + return $provinces[ $wpicp_province ]; + } else { + return ''; + } +} + +add_shortcode( 'wpicp_p', 'wpicp_province_abbr_shortcode' ); +function wpicp_province_abbr_shortcode() { + $wpicp_province = get_option( 'wpicp_province' ); + + if ( $wpicp_province ) { + return $wpicp_province; + } +} diff --git a/languages/wpicp-license-zh_CN.mo b/languages/wpicp-license-zh_CN.mo new file mode 100644 index 0000000..3665d45 Binary files /dev/null and b/languages/wpicp-license-zh_CN.mo differ diff --git a/languages/wpicp-license-zh_CN.po b/languages/wpicp-license-zh_CN.po new file mode 100644 index 0000000..50c455e --- /dev/null +++ b/languages/wpicp-license-zh_CN.po @@ -0,0 +1,273 @@ +msgid "" +msgstr "" +"Project-Id-Version: WPICP License\n" +"POT-Creation-Date: 2023-03-30 22:41+0800\n" +"PO-Revision-Date: 2023-03-30 22:42+0800\n" +"Last-Translator: 薇晓朵 \n" +"Language-Team: 薇晓朵 \n" +"Language: zh_CN\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: 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-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" + +#: includes/shortcode.php:52 wpicp-license.php:145 +msgid "Beijing" +msgstr "北京" + +#: includes/shortcode.php:53 wpicp-license.php:146 +msgid "Tianjin" +msgstr "天津" + +#: includes/shortcode.php:54 wpicp-license.php:147 +msgid "Hebei" +msgstr "河北" + +#: includes/shortcode.php:55 wpicp-license.php:148 +msgid "Shanxi" +msgstr "山西" + +#: includes/shortcode.php:56 wpicp-license.php:149 +msgid "Inner Mongolia" +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 +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 中文版本所缺少的功能。更多信息请访问 WPICP.com" + +#: wpicp-license.php:116 +msgid "Why do you need?" +msgstr "为什么需要?" + +#: 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备案号。(如果没有会怎样?)" + +#: wpicp-license.php:118 +msgid "How to use?" +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 许可证设置" + +#. Plugin Name of the plugin/theme +msgid "WPICP License" +msgstr "文派 ICP 许可证" + +#. Plugin URI of the plugin/theme +msgid "https://wpicp.com/download" +msgstr "https://wpicp.com/download" + +#. Description of the plugin/theme +msgid "Must-have for WordPress sites in China, showing your ICP license." +msgstr "中国WordPress网站必备,显示您的 ICP 备案许可证。" + +#. Author of the plugin/theme +msgid "WPICP.com" +msgstr "文派 ICP" + +#. Author URI of the plugin/theme +msgid "https://wpicp.com/" +msgstr "https://wpicp.com/" diff --git a/languages/wpicp-license-zh_TW.mo b/languages/wpicp-license-zh_TW.mo new file mode 100644 index 0000000..7aab825 Binary files /dev/null and b/languages/wpicp-license-zh_TW.mo differ diff --git a/languages/wpicp-license-zh_TW.po b/languages/wpicp-license-zh_TW.po new file mode 100644 index 0000000..5a17933 --- /dev/null +++ b/languages/wpicp-license-zh_TW.po @@ -0,0 +1,220 @@ +# 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" +"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" + +#: wpicp-license.php:169 +msgid "Enter your Wangan license number and select the abbreviation of your province." +msgstr "輸入這個網站的公安局備案許可證號,並選取所在省份。" + +#: wpicp-license.php:155 +msgid "Xinjiang" +msgstr "新疆" + +#: wpicp-license.php:154 +msgid "Ningxia" +msgstr "寧夏" + +#: wpicp-license.php:153 +msgid "Qinghai" +msgstr "青海" + +#: wpicp-license.php:152 +msgid "Gansu" +msgstr "甘肅" + +#: wpicp-license.php:151 +msgid "Shaanxi" +msgstr "陝西" + +#: wpicp-license.php:150 +msgid "Tibet" +msgstr "西藏" + +#: wpicp-license.php:149 +msgid "Yunnan" +msgstr "雲南" + +#: wpicp-license.php:148 +msgid "Guizhou" +msgstr "貴州" + +#: wpicp-license.php:147 +msgid "Sichuan" +msgstr "四川" + +#: wpicp-license.php:146 +msgid "Chongqing" +msgstr "重慶" + +#: wpicp-license.php:145 +msgid "Hainan" +msgstr "海南" + +#: wpicp-license.php:144 +msgid "Guangxi" +msgstr "廣西" + +#: wpicp-license.php:143 +msgid "Guangdong" +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 diff --git a/readme.txt b/readme.txt index b03bd7d..aff4ee4 100644 --- a/readme.txt +++ b/readme.txt @@ -2,9 +2,9 @@ Contributors: wpfanyi Tags: ICP, ICP License, ICP Beian,备案,备案号 Requires at least: 5.4 -Tested up to: 6.1.1 +Tested up to: 6.2 Requires PHP: 5.6 -Stable tag: 1.0.1 +Stable tag: 1.2 License: GPLv2 License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -68,6 +68,15 @@ Starting with WP ICP License consists of just two steps: installing and setting == Changelog == + +### 1.2 ### + +* Add Chinese province shortcodes. +* Use the shortcode [wpicp_province] to display the full province name. +* Use the shortcode [wpicp_p] to display the short name of the province. +* Added ICP license input box to settings page. + + ### 1.1 ### * Add China Wangan License(PSB) diff --git a/wpicp-license.php b/wpicp-license.php index bb045e5..fb65100 100644 --- a/wpicp-license.php +++ b/wpicp-license.php @@ -7,7 +7,7 @@ * Author URI: https://wpicp.com/ * Text Domain: wpicp-license * Domain Path: /languages - * Version: 1.1 + * Version: 1.2 * Network: True * License: GPLv2 or later * License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -23,83 +23,103 @@ * GNU General Public License for more details. */ -// Add admin menu page -add_action( 'admin_menu', 'wpicp_license_menu' ); -function wpicp_license_menu() { - add_options_page( - __( 'WP ICP License Settings', 'wpicp-license' ), + + require_once( plugin_dir_path( __FILE__ ) . 'includes/shortcode.php' ); + + + // Add admin menu page + add_action( 'admin_menu', 'wpicp_license_menu' ); + + function wpicp_license_menu() { + add_options_page( + __( 'WP ICP License Settings', 'wpicp-license' ), + __( 'ICP License', 'wpicp-license' ), + 'manage_options', + 'wpicp_license_settings', + 'wpicp_license_settings_page' + ); + } + + /** Load translation */ + add_action( 'init', 'wpicp_load_textdomain' ); + function wpicp_load_textdomain() { + load_plugin_textdomain( 'wpicp-license', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); + } + + // Add settings page and field + add_action( 'admin_init', 'wpicp_license_settings' ); + + function wpicp_license_settings() { + + add_settings_section( + 'wpicp_license_section', + __( 'WordPress ICP License Namber', 'wpicp-license' ), + 'wpicp_license_section_callback', + 'wpicp_license_settings' + ); + add_settings_section( + 'wpicp_wangan_section', + __( 'China Wangan License Number', 'wpicp-license' ), + 'wpicp_wangan_section_callback', + 'wpicp_license_settings' + ); + add_settings_field( + 'wpicp_license_field', __( 'ICP License', 'wpicp-license' ), - 'manage_options', - 'wpicp_license_settings', - 'wpicp_license_settings_page' - ); -} + 'wpicp_license_field_callback', + 'wpicp_license_settings', + 'wpicp_license_section' + ); -/** Load translation */ -add_action( 'init', 'wpicp_load_textdomain' ); -function wpicp_load_textdomain() { - load_plugin_textdomain( 'wpicp-license', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); -} - -// Add settings page and field -add_action( 'admin_init', 'wpicp_license_settings' ); - -function wpicp_license_settings() { - - add_settings_section( - 'wpicp_license_section', - __( 'WordPress ICP License Namber', 'wpicp-license' ), - 'wpicp_license_section_callback', - 'wpicp_license_settings' - ); - add_settings_section( - 'wpicp_wangan_section', - __( 'China Wangan License Number', 'wpicp-license' ), - 'wpicp_wangan_section_callback', - 'wpicp_license_settings' - ); - add_settings_field( - 'wpicp_license_field', - __( 'ICP License', 'wpicp-license' ), - 'wpicp_license_field_callback', - 'wpicp_license_settings', - 'wpicp_license_section' - ); - - add_settings_field( - 'wpicp_wangan_field', - __( 'Wangan License', 'wpicp-license' ), - 'wpicp_wangan_field_callback', - 'wpicp_license_settings', - 'wpicp_wangan_section' - ); - add_settings_field( - 'wpicp_province_field', - __( 'Province', 'wpicp-license' ), - 'wpicp_license_settings', - 'wpicp_wangan_section' - ); - - register_setting( 'wpicp_license_settings', 'wpicp_province' ); - register_setting( 'wpicp_license_settings', 'wpicp_wangan' ); - register_setting( 'wpicp_license_settings', 'wpicp_license' ); -} + add_settings_field( + 'wpicp_wangan_field', + __( 'Wangan License', 'wpicp-license' ), + 'wpicp_wangan_field_callback', + 'wpicp_license_settings', + 'wpicp_wangan_section' + ); + add_settings_field( + 'wpicp_province_field', + __( 'Province', 'wpicp-license' ), + 'wpicp_license_settings', + 'wpicp_license_section' + ); + register_setting( 'wpicp_license_settings', 'wpicp_province' ); + register_setting( 'wpicp_license_settings', 'wpicp_wangan' ); + register_setting( 'wpicp_license_settings', 'wpicp_license' ); + } -// Settings section callback -function wpicp_license_section_callback() { - echo '

' . __( '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', 'wpicp-license' ) . '

'; - echo '

' . __( 'Why do you need?', 'wpicp-license' ) . '

'; - echo '

' . __( '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?)', 'wpicp-license' ) . '

'; - echo '

' . __( 'How to use?', 'wpicp-license' ) . '

'; - echo '

' . __( '1. Enter your ICP license information below. (Find My License?)', 'wpicp-license' ) . '

'; - echo '

' . __( '2. Use the shortcode [wpicp_license] to display the license information and link on your website. (Integrate into theme?)', 'wpicp-license' ) . '

'; -} + function show_wpicp_license_field(){ + $wpicp_license = get_option('wpicp_license'); + echo ''; + echo '

'.__('Enter your ICP license number information.', 'wpicp-license').'

'; + } + add_filter('admin_init', 'add_wpicp_license_setting'); + function add_wpicp_license_setting(){ + add_settings_field( + 'wpicp_license_field', + __('ICP License', 'wpicp-license'), + 'show_wpicp_license_field', + 'general' + ); + register_setting('general', 'wpicp_license'); + } + // Settings section callback + function wpicp_license_section_callback() { + echo '

' . __( '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', 'wpicp-license' ) . '

'; + echo '

' . __( 'Why do you need?', 'wpicp-license' ) . '

'; + echo '

' . __( '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?)', 'wpicp-license' ) . '

'; + echo '

' . __( 'How to use?', 'wpicp-license' ) . '

'; + echo '

' . __( '1. Enter your ICP license information below. (Find My License?)', 'wpicp-license' ) . '

'; + echo '

' . __( '2. Use the shortcode [wpicp_license] to display the license information and link on your website. (Integrate into theme?)', 'wpicp-license' ) . '

'; + } + // Settings field callback function wpicp_license_field_callback() { $wpicp_license = get_option( 'wpicp_license' ); @@ -188,38 +208,4 @@ function wpicp_license_settings_page() { -// Add ICP shortcode -add_shortcode( 'wpicp_license', 'wpicp_license_shortcode' ); - -function wpicp_license_shortcode() { - $wpicp_license = get_option( 'wpicp_license' ); - if ( $wpicp_license ) { - $license_text = '' . $wpicp_license; - $license_url = 'https://beian.miit.gov.cn'; - $target = '_blank'; - $nofollow = 'nofollow'; - $license_link = '' . $license_text . ''; - return $license_link; - } -} - - -// Add Wangan shortcode -add_shortcode( 'wpicp_wangan', 'wpicp_wangan_shortcode' ); - -function wpicp_wangan_shortcode() { - $wpicp_wangan = get_option( 'wpicp_wangan' ); - $wpicp_province = get_option( 'wpicp_province' ); - - if ( $wpicp_wangan ) { - $wangan_text = 'Wangan License' . $wpicp_province . '公网安备' . $wpicp_wangan . '号' ; - $wangan_url = 'https://www.beian.gov.cn/portal/registerSystemInfo?recordcode=' . urlencode($wpicp_wangan); - $target = '_blank'; - $nofollow = 'nofollow'; - $wangan_link = '' . $wangan_text . ''; - return $wangan_link; - } -} - - ?>