<?php

if (!defined('ABSPATH')) {
    exit;
}
?>

<h2><?php 
_e('Shipping Methods', 'woocommerce');
?>
 (<?php 
echo esc_html($zone->get_zone_name());
?>
) <?php 
echo wc_back_link(__('Return to Shipping Zones', 'woocommerce'), admin_url('admin.php?page=wc-settings&tab=shipping'));
?>
</h2>
<p><?php 
_e('The following shipping methods apply to customers with shipping addresses within this zone.', 'woocommerce');
?>
<p>
<table class="wc-shipping-zone-methods widefat">
    <thead>
        <tr>
            <th class="wc-shipping-zone-method-sort"><?php 
echo wc_help_tip(__('Drag and drop to re-order your shipping methods. This is the order in which they will display during checkout.', 'woocommerce'));
?>
</th>
            <th class="wc-shipping-zone-method-title"><?php 
esc_html_e('Title', 'woocommerce');
?>
Exemplo n.º 2
0
    /**
     * Admin Options.
     *
     * Setup the email settings screen.
     * Override this in your email.
     *
     * @since 1.0.0
     */
    public function admin_options()
    {
        // Do admin actions.
        $this->admin_actions();
        ?>
		<h2><?php 
        echo esc_html($this->get_title());
        ?>
 <?php 
        wc_back_link(__('Return to emails', 'woocommerce'), admin_url('admin.php?page=wc-settings&tab=email'));
        ?>
</h2>

		<?php 
        echo wpautop(wp_kses_post($this->get_description()));
        ?>

		<?php 
        /**
         * woocommerce_email_settings_before action hook.
         * @param string $email The email object
         */
        do_action('woocommerce_email_settings_before', $this);
        ?>

		<table class="form-table">
			<?php 
        $this->generate_settings_html();
        ?>
		</table>

		<?php 
        /**
         * woocommerce_email_settings_after action hook.
         * @param string $email The email object
         */
        do_action('woocommerce_email_settings_after', $this);
        ?>

		<?php 
        if (current_user_can('edit_themes') && (!empty($this->template_html) || !empty($this->template_plain))) {
            ?>
			<div id="template">
			<?php 
            $templates = array('template_html' => __('HTML template', 'woocommerce'), 'template_plain' => __('Plain text template', 'woocommerce'));
            foreach ($templates as $template_type => $title) {
                $template = $this->get_template($template_type);
                if (empty($template)) {
                    continue;
                }
                $local_file = $this->get_theme_template_file($template);
                $core_file = $this->template_base . $template;
                $template_file = apply_filters('woocommerce_locate_core_template', $core_file, $template, $this->template_base);
                $template_dir = apply_filters('woocommerce_template_directory', 'woocommerce', $template);
                ?>
					<div class="template <?php 
                echo $template_type;
                ?>
">

						<h4><?php 
                echo wp_kses_post($title);
                ?>
</h4>

						<?php 
                if (file_exists($local_file)) {
                    ?>

							<p>
								<a href="#" class="button toggle_editor"></a>

								<?php 
                    if (is_writable($local_file)) {
                        ?>
									<a href="<?php 
                        echo esc_url(wp_nonce_url(remove_query_arg(array('move_template', 'saved'), add_query_arg('delete_template', $template_type)), 'woocommerce_email_template_nonce', '_wc_email_nonce'));
                        ?>
" class="delete_template button"><?php 
                        _e('Delete template file', 'woocommerce');
                        ?>
</a>
								<?php 
                    }
                    ?>

								<?php 
                    printf(__('This template has been overridden by your theme and can be found in: <code>%s</code>.', 'woocommerce'), trailingslashit(basename(get_stylesheet_directory())) . $template_dir . '/' . $template);
                    ?>
							</p>

							<div class="editor" style="display:none">
								<textarea class="code" cols="25" rows="20" <?php 
                    if (!is_writable($local_file)) {
                        ?>
readonly="readonly" disabled="disabled"<?php 
                    } else {
                        ?>
data-name="<?php 
                        echo $template_type . '_code';
                        ?>
"<?php 
                    }
                    ?>
><?php 
                    echo file_get_contents($local_file);
                    ?>
</textarea>
							</div>

						<?php 
                } elseif (file_exists($template_file)) {
                    ?>

							<p>
								<a href="#" class="button toggle_editor"></a>

								<?php 
                    if (is_dir(get_stylesheet_directory() . '/' . $template_dir . '/emails/') && is_writable(get_stylesheet_directory() . '/' . $template_dir . '/emails/') || is_writable(get_stylesheet_directory())) {
                        ?>
									<a href="<?php 
                        echo esc_url(wp_nonce_url(remove_query_arg(array('delete_template', 'saved'), add_query_arg('move_template', $template_type)), 'woocommerce_email_template_nonce', '_wc_email_nonce'));
                        ?>
" class="button"><?php 
                        _e('Copy file to theme', 'woocommerce');
                        ?>
</a>
								<?php 
                    }
                    ?>

								<?php 
                    printf(__('To override and edit this email template copy <code>%1$s</code> to your theme folder: <code>%2$s</code>.', 'woocommerce'), plugin_basename($template_file), trailingslashit(basename(get_stylesheet_directory())) . $template_dir . '/' . $template);
                    ?>
							</p>

							<div class="editor" style="display:none">
								<textarea class="code" readonly="readonly" disabled="disabled" cols="25" rows="20"><?php 
                    echo file_get_contents($template_file);
                    ?>
</textarea>
							</div>

						<?php 
                } else {
                    ?>

							<p><?php 
                    _e('File was not found.', 'woocommerce');
                    ?>
</p>

						<?php 
                }
                ?>

					</div>
					<?php 
            }
            ?>
			</div>
			<?php 
            wc_enqueue_js("\n\t\t\t\tjQuery( 'select.email_type' ).change( function() {\n\n\t\t\t\t\tvar val = jQuery( this ).val();\n\n\t\t\t\t\tjQuery( '.template_plain, .template_html' ).show();\n\n\t\t\t\t\tif ( val != 'multipart' && val != 'html' ) {\n\t\t\t\t\t\tjQuery('.template_html').hide();\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( val != 'multipart' && val != 'plain' ) {\n\t\t\t\t\t\tjQuery('.template_plain').hide();\n\t\t\t\t\t}\n\n\t\t\t\t}).change();\n\n\t\t\t\tvar view = '" . esc_js(__('View template', 'woocommerce')) . "';\n\t\t\t\tvar hide = '" . esc_js(__('Hide template', 'woocommerce')) . "';\n\n\t\t\t\tjQuery( 'a.toggle_editor' ).text( view ).toggle( function() {\n\t\t\t\t\tjQuery( this ).text( hide ).closest(' .template' ).find( '.editor' ).slideToggle();\n\t\t\t\t\treturn false;\n\t\t\t\t}, function() {\n\t\t\t\t\tjQuery( this ).text( view ).closest( '.template' ).find( '.editor' ).slideToggle();\n\t\t\t\t\treturn false;\n\t\t\t\t} );\n\n\t\t\t\tjQuery( 'a.delete_template' ).click( function() {\n\t\t\t\t\tif ( window.confirm('" . esc_js(__('Are you sure you want to delete this template file?', 'woocommerce')) . "') ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false;\n\t\t\t\t});\n\n\t\t\t\tjQuery( '.editor textarea' ).change( function() {\n\t\t\t\t\tvar name = jQuery( this ).attr( 'data-name' );\n\n\t\t\t\t\tif ( name ) {\n\t\t\t\t\t\tjQuery( this ).attr( 'name', name );\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t");
        }
    }
<?php

if (!defined('ABSPATH')) {
    exit;
}
?>

<h2><?php 
echo esc_html($shipping_method->get_method_title());
?>
 <?php 
wc_back_link(__('Return to Shipping Methods', 'woocommerce'), admin_url('admin.php?page=wc-settings&tab=shipping&zone_id=' . absint($zone->get_zone_id())));
?>
</h2>
<?php 
$shipping_method->admin_options();
if (!isset($GLOBALS['hide_save_button'])) {
    ?>
	<p class="submit"><input type="submit" class="button button-primary" name="save_method" value="<?php 
    _e('Save changes', 'woocommerce');
    ?>
" /></p>
<?php 
}
wp_nonce_field('woocommerce_save_method', 'woocommerce_save_method_nonce');