コード例 #1
0
 *
 * HOWEVER, on occasion WooCommerce will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see 	http://docs.woothemes.com/document/template-structure/
 * @author  WooThemes
 * @package WooCommerce/Templates
 * @version 2.6.0
 */
if (!defined('ABSPATH')) {
    exit;
}
$saved_methods = wc_get_customer_saved_methods_list(get_current_user_id());
$has_methods = (bool) $saved_methods;
wc_print_notices();
?>

<?php 
wc_get_template('myaccount/navigation.php');
?>

<div class="my-account-content">

	<?php 
do_action('woocommerce_before_account_payment_methods', $has_methods);
?>

	<?php 
        /**
         * Enqueue frontend CSS/JS
         *
         * @since 4.0.0
         */
        public function maybe_enqueue_styles_scripts()
        {
            $handle = 'sv-wc-payment-gateway-my-payment-methods';
            wp_enqueue_style($handle, $this->get_plugin()->get_payment_gateway_framework_assets_url() . '/css/frontend/' . $handle . '.min.css', array(), SV_WC_Plugin::VERSION);
            wp_enqueue_style('dashicons');
            // if there are tokens to display, add the custom JS
            if ($this->has_tokens) {
                // if there are no WC 2.6+ core tokens, hide the "No saved methods found." notice
                // TODO: remove this when we fully support the core payment methods table {CW 2016-05-17}
                if (SV_WC_Plugin_Compatibility::is_wc_version_gte_2_6() && !(bool) wc_get_customer_saved_methods_list(get_current_user_id())) {
                    wc_enqueue_js('$( "table.wc-' . $this->get_plugin()->get_id_dasherized() . '-my-payment-methods" ).prev( ".woocommerce-Message.woocommerce-Message--info" ).hide();');
                }
                wp_enqueue_script('jquery-tiptip', WC()->plugin_url() . '/assets/js/jquery-tiptip/jquery.tipTip.min.js', array('jquery'), WC_VERSION, true);
                // add confirm javascript when deleting payment methods
                wc_enqueue_js('

				$( ".wc-' . $this->get_plugin()->get_id_dasherized() . '-payment-method-actions .button.tip" ).tipTip();

				$( ".wc-' . $this->get_plugin()->get_id_dasherized() . '-payment-method-actions a.delete-payment-method" ).on( "click", function( e ) {
					if ( $( this ).hasClass( "disabled" ) || ! confirm( "' . esc_js(esc_html__('Are you sure you want to delete this payment method?', 'woocommerce-plugin-framework')) . '" ) ) {
						e.preventDefault();
					}
				} );
			');
            }
        }