Esempio n. 1
0
/**
 * Email Header
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates/Emails
 * @version     2.0.0
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
// Load colours
$bg = get_option('woocommerce_email_background_color');
$body = get_option('woocommerce_email_body_background_color');
$base = get_option('woocommerce_email_base_color');
$base_text = woocommerce_light_or_dark($base, '#202020', '#ffffff');
$text = get_option('woocommerce_email_text_color');
$bg_darker_10 = woocommerce_hex_darker($bg, 10);
$base_lighter_20 = woocommerce_hex_lighter($base, 20);
$text_lighter_20 = woocommerce_hex_lighter($text, 20);
// For gmail compatibility, including CSS styles in head/body are stripped out therefore styles need to be inline. These variables contain rules which are added to the template inline. !important; is a gmail hack to prevent styles being stripped if it doesn't like something.
$wrapper = "\n\tbackground-color: " . esc_attr($bg) . ";\n\twidth:100%;\n\t-webkit-text-size-adjust:none !important;\n\tmargin:0;\n\tpadding: 70px 0 70px 0;\n";
$template_container = "\n\t-webkit-box-shadow:0 0 0 3px rgba(0,0,0,0.025) !important;\n\tbox-shadow:0 0 0 3px rgba(0,0,0,0.025) !important;\n\t-webkit-border-radius:6px !important;\n\tborder-radius:6px !important;\n\tbackground-color: " . esc_attr($body) . ";\n\tborder: 1px solid {$bg_darker_10};\n\t-webkit-border-radius:6px !important;\n\tborder-radius:6px !important;\n";
$template_header = "\n\tbackground-color: " . esc_attr($base) . ";\n\tcolor: {$base_text};\n\t-webkit-border-top-left-radius:6px !important;\n\t-webkit-border-top-right-radius:6px !important;\n\tborder-top-left-radius:6px !important;\n\tborder-top-right-radius:6px !important;\n\tborder-bottom: 0;\n\tfont-family:Arial;\n\tfont-weight:bold;\n\tline-height:100%;\n\tvertical-align:middle;\n";
$body_content = "\n\tbackground-color: " . esc_attr($body) . ";\n\t-webkit-border-radius:6px !important;\n\tborder-radius:6px !important;\n";
$body_content_inner = "\n\tcolor: {$text_lighter_20};\n\tfont-family:Arial;\n\tfont-size:14px;\n\tline-height:150%;\n\ttext-align:left;\n";
$header_content_h1 = "\n\tcolor: " . esc_attr($base_text) . ";\n\tmargin:0;\n\tpadding: 28px 24px;\n\ttext-shadow: 0 1px 0 {$base_lighter_20};\n\tdisplay:block;\n\tfont-family:Arial;\n\tfont-size:30px;\n\tfont-weight:bold;\n\ttext-align:left;\n\tline-height: 150%;\n";
?>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
/**
 * Generate CSS from the less file when changing colours.
 *
 * @access public
 * @return void
 */
function woocommerce_compile_less_styles()
{
    global $woocommerce;
    $colors = get_option('woocommerce_frontend_css_colors');
    $base_file = $woocommerce->plugin_path() . '/assets/css/woocommerce-base.less';
    $less_file = $woocommerce->plugin_path() . '/assets/css/woocommerce.less';
    $css_file = $woocommerce->plugin_path() . '/assets/css/woocommerce.css';
    // Write less file
    if (is_writable($base_file) && is_writable($css_file)) {
        // Colours changed - recompile less
        if (!class_exists('lessc')) {
            include_once 'includes/lessc.inc.php';
        }
        if (!class_exists('cssmin')) {
            include_once 'includes/cssmin.inc.php';
        }
        try {
            // Set default if colours not set
            if (!$colors['primary']) {
                $colors['primary'] = '#ad74a2';
            }
            if (!$colors['secondary']) {
                $colors['secondary'] = '#f7f6f7';
            }
            if (!$colors['highlight']) {
                $colors['highlight'] = '#85ad74';
            }
            if (!$colors['content_bg']) {
                $colors['content_bg'] = '#ffffff';
            }
            if (!$colors['subtext']) {
                $colors['subtext'] = '#777777';
            }
            // Write new color to base file
            $color_rules = "\n@primary: \t\t" . $colors['primary'] . ";\n@primarytext: \t" . woocommerce_light_or_dark($colors['primary'], 'desaturate(darken(@primary,50%),18%)', 'desaturate(lighten(@primary,50%),18%)') . ";\n\n@secondary: \t" . $colors['secondary'] . ";\n@secondarytext: " . woocommerce_light_or_dark($colors['secondary'], 'desaturate(darken(@secondary,60%),18%)', 'desaturate(lighten(@secondary,60%),18%)') . ";\n\n@highlight: \t" . $colors['highlight'] . ";\n@highlightext:\t" . woocommerce_light_or_dark($colors['highlight'], 'desaturate(darken(@highlight,60%),18%)', 'desaturate(lighten(@highlight,60%),18%)') . ";\n\n@contentbg:\t\t" . $colors['content_bg'] . ";\n\n@subtext:\t\t" . $colors['subtext'] . ";\n\t\t\t";
            file_put_contents($base_file, $color_rules);
            $less = new lessc($less_file);
            $compiled_css = $less->parse();
            $compiled_css = CssMin::minify($compiled_css);
            if ($compiled_css) {
                file_put_contents($css_file, $compiled_css);
            }
        } catch (exception $ex) {
            wp_die(__('Could not compile woocommerce.less:', 'woocommerce') . ' ' . $ex->getMessage());
        }
    }
}
Esempio n. 3
0
                            	<td align="center" valign="top">
                                    <!-- // Begin Template Header \\ -->
                                	<table border="0" cellpadding="0" cellspacing="0" width="600" id="templateHeader" style="background-color:<?php 
echo get_option('woocommerce_email_base_color');
?>
; -webkit-border-top-left-radius:6px; -webkit-border-top-right-radius:6px; color:<?php 
echo woocommerce_light_or_dark(get_option('woocommerce_email_base_color'), '#202020', '#ffffff');
?>
; font-family:Arial; font-weight:bold; line-height:100%; vertical-align:middle;">
                                	
                                        <tr>
                                            <td class="headerContent" style="padding:24px; ">

                                            	<!-- // Begin Module: Standard Header Image \\ -->
                                            	<h1 class="h1" style="color:<?php 
echo woocommerce_light_or_dark(get_option('woocommerce_email_base_color'), '#202020', '#ffffff');
?>
 !important; margin:0; text-shadow:0 1px 0 <?php 
echo woocommerce_hex_lighter(get_option('woocommerce_email_base_color'), 20);
?>
;"><?php 
echo $email_heading;
?>
</h1>
                                            	<!-- // End Module: Standard Header Image \\ -->
                                            
                                            </td>
                                        </tr>
                                    </table>
                                    <!-- // End Template Header \\ -->
                                </td>