diff --git a/class-wc-huayi-score.php b/class-wc-huayi-score.php index f291c11..736a95f 100644 --- a/class-wc-huayi-score.php +++ b/class-wc-huayi-score.php @@ -19,9 +19,9 @@ class WC_Huayi_Score extends WC_Payment_Gateway { public function __construct() { $this->id = 'huayi_score'; - $this->icon = apply_filters('woocommerce_huayi_score_icon', '*'); + $this->icon = apply_filters('woocommerce_huayi_score_icon', ''); $this->has_fields = true; - $this->method_title = __( '积分', 'huayi_score' ); + $this->method_title = __( '积分支付', 'huayi_score' ); $this->method_description = __( '调用系统积分数据进行支付.', 'huayi_score' ); $this->supports = array('refunds'); diff --git a/huayi-score.php b/huayi-score.php index de51b54..9e17460 100644 --- a/huayi-score.php +++ b/huayi-score.php @@ -19,12 +19,12 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly */ function wc_huayi_score_gateway_init() { - if( !class_exists('WC_Payment_Gateway') ) return; + if (!class_exists('WC_Payment_Gateway')) return; - load_plugin_textdomain( 'huayi_score', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' ); + load_plugin_textdomain('huayi_score', false, dirname(plugin_basename(__FILE__)).'/lang/'); - require_once( plugin_basename( 'class-wc-huayi-score.php' ) ); - add_filter('woocommerce_payment_gateways', 'woocommerce_huayi_score_add_gateway' ); + require_once(plugin_basename('class-wc-huayi-score.php')); + add_filter('woocommerce_payment_gateways', 'woocommerce_huayi_score_add_gateway'); //add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'wc_huayi_score_plugin_edit_link' ); } @@ -38,8 +38,64 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly * @package WooCommerce/Classes/Payment * @return array */ - function woocommerce_huayi_score_add_gateway( $methods ) + function woocommerce_huayi_score_add_gateway($methods) { $methods[] = 'WC_Huayi_Score'; return $methods; } + + /** + * WordPress 个人资料添加额外的字段 + * http://www.wpdaxue.com/extra-user-profile-fields.html + */ + if (!has_action('show_user_profile','huayi_score_user_fields') && !has_action('edit_user_profile','huayi_score_user_fields')) { + add_action( 'show_user_profile', 'huayi_score_user_fields' ); + add_action( 'edit_user_profile', 'huayi_score_user_fields' ); + } + + function huayi_score_user_fields($user) + { ?> +
+ +| + |
+ + + |
+
|---|