/** * Outputs a saved payment method's title based on the passed token. * @since 2.6.0 * @param WC_Payment_Token $token Payment Token * @return string Generated payment method title HTML */ public function saved_payment_method_title($token) { if ('CC' == $token->get_type() && is_callable(array($token, 'get_card_type'))) { $type = esc_html__(wc_get_credit_card_type_label($token->get_card_type()), 'woocommerce'); } else { if ('eCheck' === $token->get_type()) { $type = esc_html__('eCheck', 'woocommerce'); } } $type = apply_filters('wc_payment_gateway_form_saved_payment_method_title_type_html', $type, $token, $this); $title = $type; if (is_callable(array($token, 'get_last4'))) { $title .= ' ' . sprintf(esc_html__('ending in %s', 'woocommerce'), $token->get_last4()); } if (is_callable(array($token, 'get_expiry_month')) && is_callable(array($token, 'get_expiry_year'))) { $title .= ' ' . sprintf(esc_html__('(expires %s)', 'woocommerce'), $token->get_expiry_month() . '/' . substr($token->get_expiry_year(), 2)); } return apply_filters('wc_payment_gateway_form_saved_payment_method_title_html', $title, $token, $this); }
/** * Get type to display to user. * @return string */ public function get_display_name() { $display = wc_get_credit_card_type_label($this->get_card_type()); $display .= ' ' . sprintf(__('ending in %s', 'woocommerce'), $this->get_last4()); $display .= ' ' . sprintf(__('(expires %s)', 'woocommerce'), $this->get_expiry_month() . '/' . substr($this->get_expiry_year(), 2)); return $display; }
/** * Get type to display to user. * * @since 2.6.0 * @param string $context * @return string */ public function get_display_name($context = 'view') { /* translators: 1: credit card type 2: last 4 digits 3: expiry month 4: expiry year */ $display = sprintf(__('%1$s ending in %2$s (expires %3$s/%4$s)', 'woocommerce'), wc_get_credit_card_type_label($this->get_card_type($context)), $this->get_last4($context), $this->get_expiry_month($context), substr($this->get_expiry_year($context), 2)); return $display; }
payment-method-<?php echo esc_attr($column_id); ?> " data-title="<?php echo esc_attr($column_name); ?> "> <?php if (has_action('woocommerce_account_payment_methods_column_' . $column_id)) { do_action('woocommerce_account_payment_methods_column_' . $column_id, $method); } else { if ('method' === $column_id) { if (!empty($method['method']['last4'])) { echo sprintf(__('%s ending in %s', 'woocommerce'), esc_html(wc_get_credit_card_type_label($method['method']['brand'])), esc_html($method['method']['last4'])); } else { echo esc_html(wc_get_credit_card_type_label($method['method']['brand'])); } } else { if ('expires' === $column_id) { echo esc_html($method['expires']); } else { if ('actions' === $column_id) { foreach ($method['actions'] as $key => $action) { echo '<a href="' . esc_url($action['url']) . '" class="button ' . sanitize_html_class($key) . '">' . esc_html($action['name']) . '</a> '; } } } } } ?> </td>
/** * Get type to display to user. * @return string */ public function get_display_name() { $display = sprintf(__('%1$s ending in %2$s (expires %3$s/%4$s)', 'woocommerce'), wc_get_credit_card_type_label($this->get_card_type()), $this->get_last4(), $this->get_expiry_month(), substr($this->get_expiry_year(), 2)); return $display; }