Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Julian Jöris 2012-05-02 10:25:11 +02:00
commit 486371c00a
91 changed files with 13884 additions and 3336 deletions

File diff suppressed because it is too large Load Diff

2690
admin/includes/lessc.inc.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -113,7 +113,7 @@ function woocommerce_custom_order_columns($column) {
endif;
break;
case "total_cost" :
echo woocommerce_price($order->order_total);
echo $order->get_formatted_order_total();
break;
case "order_date" :

View File

@ -487,6 +487,7 @@ function woocommerce_order_totals_meta_box($post) {
</li>
</ul>
<?php do_action( 'woocommerce_admin_order_totals_after_shipping', $post->ID ) ?>
<div class="clear"></div>
</div>
<div class="totals_group">

View File

@ -32,7 +32,7 @@ function woocommerce_product_data_box() {
<li class="inventory_tab show_if_simple show_if_variable show_if_grouped inventory_options"><a href="#inventory_product_data"><?php _e('Inventory', 'woocommerce'); ?></a></li>
<li class="upsells_and_crosssells_tab crosssell_options"><a href="#upsells_and_crosssells_product_data"><?php _e('Up-sells/Cross-sells', 'woocommerce'); ?></a></li>
<li class="related_product_tab related_product_options"><a href="#related_product_data"><?php _e('Related Products', 'woocommerce'); ?></a></li>
<li class="attributes_tab attribute_options"><a href="#woocommerce_attributes"><?php _e('Attributes', 'woocommerce'); ?></a></li>
@ -413,7 +413,7 @@ function woocommerce_product_data_box() {
<div class="clear"></div>
</div>
<div id="upsells_and_crosssells_product_data" class="panel woocommerce_options_panel">
<div id="related_product_data" class="panel woocommerce_options_panel">
<p class="form-field"><label for="upsell_ids"><?php _e('Up-Sells', 'woocommerce'); ?></label>
<select id="upsell_ids" name="upsell_ids[]" class="ajax_chosen_select_products" multiple="multiple" data-placeholder="<?php _e('Search for a product&hellip;', 'woocommerce'); ?>">
@ -453,6 +453,8 @@ function woocommerce_product_data_box() {
?>
</select> <img class="help_tip" data-tip='<?php _e('Cross-sells are products which you promote in the cart, based on the current product.', 'woocommerce') ?>' src="<?php echo $woocommerce->plugin_url(); ?>/assets/images/help.png" /></p>
<?php do_action('woocommerce_product_options_related'); ?>
</div>
<div id="grouping_product_data" class="panel woocommerce_options_panel">
<?php

View File

@ -222,3 +222,61 @@ function woocommerce_delete_term( $term_id, $tt_id, $taxonomy ) {
$wpdb->query("DELETE FROM {$wpdb->woocommerce_termmeta} WHERE `woocommerce_term_id` = " . $term_id);
}
/**
* Compile styles
*/
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
include_once('includes/lessc.inc.php');
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 = "
@primary: " . $colors['primary'] . ";
@primarytext: " . woocommerce_light_or_dark( $colors['primary'], 'desaturate(darken(@primary,50%),18%)', 'desaturate(lighten(@primary,50%),18%)' ) . ";
@secondary: " . $colors['secondary'] . ";
@secondarytext: " . woocommerce_light_or_dark( $colors['secondary'], 'desaturate(darken(@secondary,60%),18%)', 'desaturate(lighten(@secondary,60%),18%)' ) . ";
@highlight: " . $colors['highlight'] . ";
@highlightext: " . woocommerce_light_or_dark( $colors['highlight'], 'desaturate(darken(@highlight,60%),18%)', 'desaturate(lighten(@highlight,60%),18%)' ) . ";
@contentbg: " . $colors['content_bg'] . ";
@subtext: " . $colors['subtext'] . ";
";
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() );
}
}
}

View File

@ -48,6 +48,33 @@ function do_install_woocommerce() {
// Clear transient cache
$woocommerce->clear_product_transients();
// Recompile LESS styles if they are custom
if ( get_option('woocommerce_frontend_css') == 'yes' ) {
// Handle Colour Settings
$colors = get_option( 'woocommerce_frontend_css_colors' );
if ( (
! empty( $colors['primary'] ) &&
! empty( $colors['secondary'] ) &&
! empty( $colors['highlight'] ) &&
! empty( $colors['content_bg'] ) &&
! empty( $colors['subtext'] )
) && (
$colors['primary'] != '#ad74a2' ||
$colors['secondary'] != '#f7f6f7' ||
$colors['highlight'] != '#85ad74' ||
$colors['content_bg'] != '#ffffff' ||
$colors['subtext'] != '#777777'
) ) {
// Write less file
woocommerce_compile_less_styles();
}
}
// Update version
update_option( "woocommerce_db_version", $woocommerce->version );
}
@ -85,7 +112,7 @@ function woocommerce_default_options() {
foreach ($section as $value) :
if (isset($value['std'])) :
if (isset($value['std']) && isset($value['id'])) :
if ($value['type']=='image_width') :

View File

@ -1490,19 +1490,32 @@ function woocommerce_stock_overview() {
<h3><span><?php _e('Low stock', 'woocommerce'); ?></span></h3>
<div class="inside">
<?php
if ($low_in_stock) :
if ( $low_in_stock ) {
echo '<ul class="stock_list">';
foreach ($low_in_stock as $product) :
$stock = (int) get_post_meta($product->ID, '_stock', true);
foreach ( $low_in_stock as $product ) {
$stock = (int) get_post_meta( $product->ID, '_stock', true );
$sku = get_post_meta( $product->ID, '_sku', true );
if ( $stock <= $nostockamount ) continue;
echo '<li><a href="';
if ($product->post_type=='product') echo admin_url('post.php?post='.$product->ID.'&action=edit'); else echo admin_url('post.php?post='.$product->post_parent.'&action=edit');
echo '"><small>' . sprintf( _n('%d in stock', '%d in stock', $stock, 'woocommerce'), $stock ) . '</small> ' . $product->post_title . '</a></li>';
endforeach;
$title = $product->post_title;
if ( $sku )
$title .= ' (' . __('SKU', 'woocommerce') . ': ' . $sku . ')';
if ( $product->post_type=='product' )
$product_url = admin_url( 'post.php?post=' . $product->ID . '&action=edit' );
else
$product_url = admin_url( 'post.php?post=' . $product->post_parent . '&action=edit' );
printf( '<li><a href="%s"><small>' . _n('%d in stock', '%d in stock', $stock, 'woocommerce') . '</small> %s</a></li>', $product_url, $stock, $title );
}
echo '</ul>';
else :
} else {
echo '<p>'.__('No products are low in stock.', 'woocommerce').'</p>';
endif;
}
?>
</div>
</div>
@ -1512,19 +1525,32 @@ function woocommerce_stock_overview() {
<h3><span><?php _e('Out of stock', 'woocommerce'); ?></span></h3>
<div class="inside">
<?php
if ($low_in_stock) :
if ( $low_in_stock ) {
echo '<ul class="stock_list">';
foreach ($low_in_stock as $product) :
$stock = (int) get_post_meta($product->ID, '_stock', true);
foreach ( $low_in_stock as $product ) {
$stock = (int) get_post_meta( $product->ID, '_stock', true );
$sku = get_post_meta( $product->ID, '_sku', true );
if ( $stock > $nostockamount ) continue;
echo '<li><a href="';
if ($product->post_type=='product') echo admin_url('post.php?post='.$product->ID.'&action=edit'); else echo admin_url('post.php?post='.$product->post_parent.'&action=edit');
echo '"><small>' . sprintf( _n('%d in stock', '%d in stock', $stock, 'woocommerce'), $stock ) . '</small> ' . $product->post_title . '</a></li>';
endforeach;
$title = $product->post_title;
if ( $sku )
$title .= ' (' . __('SKU', 'woocommerce') . ': ' . $sku . ')';
if ( $product->post_type=='product' )
$product_url = admin_url( 'post.php?post=' . $product->ID . '&action=edit' );
else
$product_url = admin_url( 'post.php?post=' . $product->post_parent . '&action=edit' );
printf( '<li><a href="%s"><small>' . _n('%d in stock', '%d in stock', $stock, 'woocommerce') . '</small> %s</a></li>', $product_url, $stock, $title );
}
echo '</ul>';
else :
} else {
echo '<p>'.__('No products are out in stock.', 'woocommerce').'</p>';
endif;
}
?>
</div>
</div>

View File

@ -17,7 +17,7 @@ function woocommerce_update_options($options) {
if ( empty( $_POST ) ) return false;
foreach ( $options as $value ) {
if (isset($value['id']) && $value['id']=='woocommerce_tax_rates') :
if ( isset( $value['id'] ) && $value['id'] == 'woocommerce_tax_rates' ) {
// Tax rates saving
$tax_rates = array();
@ -128,32 +128,32 @@ function woocommerce_update_options($options) {
update_option( 'woocommerce_local_tax_rates', $local_tax_rates );
elseif (isset($value['type']) && $value['type']=='multi_select_countries') :
} elseif ( isset( $value['type'] ) && $value['type'] == 'multi_select_countries' ) {
// Get countries array
if (isset($_POST[$value['id']])) $selected_countries = $_POST[$value['id']]; else $selected_countries = array();
update_option($value['id'], $selected_countries);
elseif ( isset($value['id']) && ( $value['id'] == 'woocommerce_price_thousand_sep' || $value['id'] == 'woocommerce_price_decimal_sep' ) ):
} elseif ( isset( $value['id'] ) && ( $value['id'] == 'woocommerce_price_thousand_sep' || $value['id'] == 'woocommerce_price_decimal_sep' ) ) {
// price separators get a special treatment as they should allow a spaces (don't trim)
if( isset( $_POST[ $value['id'] ] ) ) {
if ( isset( $_POST[ $value['id'] ] ) ) {
update_option($value['id'], $_POST[$value['id']] );
} else {
delete_option($value['id']);
}
elseif (isset($value['type']) && $value['type']=='checkbox') :
} elseif ( isset( $value['type'] ) && $value['type'] == 'checkbox' ) {
if(isset($value['id']) && isset($_POST[$value['id']])) {
if ( isset( $value['id'] ) && isset( $_POST[$value['id']] ) ) {
update_option($value['id'], 'yes');
} else {
update_option($value['id'], 'no');
}
elseif (isset($value['type']) && $value['type']=='image_width') :
} elseif (isset( $value['type'] ) && $value['type'] == 'image_width' ) {
if(isset($value['id']) && isset($_POST[$value['id'].'_width'])) {
if ( isset( $value['id'] ) && isset( $_POST[$value['id'] . '_width'] ) ) {
update_option($value['id'].'_width', woocommerce_clean($_POST[$value['id'].'_width']));
update_option($value['id'].'_height', woocommerce_clean($_POST[$value['id'].'_height']));
if (isset($_POST[$value['id'].'_crop'])) :
@ -167,15 +167,19 @@ function woocommerce_update_options($options) {
update_option($value['id'].'_crop', 1);
}
else :
} elseif ( isset( $value['type'] ) && $value['type'] == 'woocommerce_frontend_css_colors' ) {
if(isset($value['id']) && isset($_POST[$value['id']])) {
} else {
if ( isset( $value['id'] ) && isset( $_POST[$value['id']] ) ) {
update_option($value['id'], woocommerce_clean($_POST[$value['id']]));
} else {
} elseif( isset( $value['id'] ) ) {
delete_option($value['id']);
}
endif;
}
}
return true;
@ -190,6 +194,7 @@ function woocommerce_admin_fields($options) {
global $woocommerce;
foreach ( $options as $value ) {
if ( ! isset( $value['type'] ) ) continue;
if ( ! isset( $value['name'] ) ) $value['name'] = '';
if ( ! isset( $value['class'] ) ) $value['class'] = '';
if ( ! isset( $value['css'] ) ) $value['css'] = '';
@ -197,8 +202,10 @@ function woocommerce_admin_fields($options) {
if ( ! isset( $value['desc'] ) ) $value['desc'] = '';
if ( ! isset( $value['desc_tip'] ) ) $value['desc_tip'] = false;
if ( $value['desc_tip'] ) {
if ( $value['desc_tip'] === true ) {
$description = '<img class="help_tip" data-tip="' . esc_attr( $value['desc'] ) . '" src="' . $woocommerce->plugin_url() . '/assets/images/help.png" />';
} elseif ( $value['desc_tip'] ) {
$description = '<img class="help_tip" data-tip="' . esc_attr( $value['desc_tip'] ) . '" src="' . $woocommerce->plugin_url() . '/assets/images/help.png" />';
} else {
$description = '<span class="description">' . $value['desc'] . '</span>';
}
@ -217,13 +224,17 @@ function woocommerce_admin_fields($options) {
break;
case 'text':
?><tr valign="top">
<th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
<th scope="row" class="titledesc">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo $value['name']; ?></label>
</th>
<td class="forminp"><input name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" type="<?php echo esc_attr( $value['type'] ); ?>" style="<?php echo esc_attr( $value['css'] ); ?>" value="<?php if ( get_option( $value['id'] ) !== false && get_option( $value['id'] ) !== null ) { echo esc_attr( stripslashes( get_option($value['id'] ) ) ); } else { echo esc_attr( $value['std'] ); } ?>" /> <?php echo $description; ?></td>
</tr><?php
break;
case 'color' :
?><tr valign="top">
<th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
<th scope="row" class="titledesc">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo $value['name']; ?></label>
</th>
<td class="forminp"><input name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" type="text" style="<?php echo esc_attr( $value['css'] ); ?>" value="<?php if ( get_option( $value['id'] ) !== false && get_option( $value['id'] ) !== null ) { echo esc_attr( stripslashes( get_option($value['id'] ) ) ); } else { echo esc_attr( $value['std'] ); } ?>" class="colorpick" /> <?php echo $description; ?> <div id="colorPickerDiv_<?php echo esc_attr( $value['id'] ); ?>" class="colorpickdiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div></td>
</tr><?php
break;
@ -243,7 +254,9 @@ function woocommerce_admin_fields($options) {
break;
case 'select':
?><tr valign="top">
<th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
<th scope="row" class="titledesc">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo $value['name']; ?></label>
</th>
<td class="forminp"><select name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" style="<?php echo esc_attr( $value['css'] ); ?>" class="<?php if (isset($value['class'])) echo $value['class']; ?>">
<?php
foreach ($value['options'] as $key => $val) {
@ -290,7 +303,7 @@ function woocommerce_admin_fields($options) {
<legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
<label for="<?php echo $value['id'] ?>">
<input name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" type="checkbox" value="1" <?php checked(get_option($value['id']), 'yes'); ?> />
<?php echo $value['desc'] ?></label><br />
<?php echo $value['desc'] ?></label> <?php if ( $value['desc_tip'] ) echo $description; ?><br />
<?php
if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup']=='end')) :
@ -308,7 +321,9 @@ function woocommerce_admin_fields($options) {
break;
case 'textarea':
?><tr valign="top">
<th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
<th scope="row" class="titledesc">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo $value['name']; ?></label>
</th>
<td class="forminp">
<textarea <?php if ( isset($value['args']) ) echo $value['args'] . ' '; ?>name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" style="<?php echo esc_attr( $value['css'] ); ?>"><?php if (false !== get_option($value['id'])) echo esc_textarea(stripslashes(get_option($value['id']))); else echo esc_textarea( $value['std'] ); ?></textarea> <?php echo $description; ?>
</td>
@ -346,7 +361,9 @@ function woocommerce_admin_fields($options) {
$state = '*';
endif;
?><tr valign="top">
<th scope="rpw" class="titledesc"><?php echo $value['name'] ?></th>
<th scope="row" class="titledesc">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo $value['name']; ?></label>
</th>
<td class="forminp"><select name="<?php echo esc_attr( $value['id'] ); ?>" style="<?php echo esc_attr( $value['css'] ); ?>" data-placeholder="<?php _e('Choose a country&hellip;', 'woocommerce'); ?>" title="Country" class="chosen_select">
<?php echo $woocommerce->countries->country_dropdown_options($country, $state); ?>
</select> <?php echo $description; ?>
@ -358,7 +375,9 @@ function woocommerce_admin_fields($options) {
asort($countries);
$selections = (array) get_option($value['id']);
?><tr valign="top">
<th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
<th scope="row" class="titledesc">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo $value['name']; ?></label>
</th>
<td class="forminp">
<select multiple="multiple" name="<?php echo esc_attr( $value['id'] ); ?>[]" style="width:450px;" data-placeholder="<?php _e('Choose countries&hellip;', 'woocommerce'); ?>" title="Country" class="chosen_select">
<?php
@ -702,6 +721,57 @@ function woocommerce_admin_fields($options) {
</script>
<?php
break;
case 'woocommerce_frontend_css_colors' :
?><tr valign="top" class="woocommerce_frontend_css_colors">
<th scope="row" class="titledesc">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo $value['name']; ?></label>
</th>
<td class="forminp"><?php
$base_file = $woocommerce->plugin_path() . '/assets/css/woocommerce-base.less';
$css_file = $woocommerce->plugin_path() . '/assets/css/woocommerce.css';
if ( is_writable( $base_file ) && is_writable( $css_file ) ) {
// Get settings
$colors = (array) get_option( 'woocommerce_frontend_css_colors' );
// Defaults
if ( empty( $colors['primary'] ) ) $colors['primary'] = '#ad74a2';
if ( empty( $colors['secondary'] ) ) $colors['secondary'] = '#f7f6f7';
if ( empty( $colors['highlight'] ) ) $colors['highlight'] = '#85ad74';
if ( empty( $colors['content_bg'] ) ) $colors['content_bg'] = '#ffffff';
// Show inputs
woocommerce_frontend_css_color_picker( __('Primary', 'woocommerce'), 'woocommerce_frontend_css_primary', $colors['primary'], __('Call to action buttons/price slider/layered nav UI', 'woocommerce') );
woocommerce_frontend_css_color_picker( __('Secondary', 'woocommerce'), 'woocommerce_frontend_css_secondary', $colors['secondary'], __('Buttons and tabs', 'woocommerce') );
woocommerce_frontend_css_color_picker( __('Highlight', 'woocommerce'), 'woocommerce_frontend_css_highlight', $colors['highlight'], __('Price labels and Sale Flashes', 'woocommerce') );
echo '<div class="color_box_clear clear"></div>';
woocommerce_frontend_css_color_picker( __('Content BG', 'woocommerce'), 'woocommerce_frontend_css_content_bg', $colors['content_bg'], __('Your themes page background - used for tab active states', 'woocommerce') );
woocommerce_frontend_css_color_picker( __('Subtext', 'woocommerce'), 'woocommerce_frontend_css_subtext', $colors['subtext'], __('Used for certain text and asides - breadcrumbs, small text etc.', 'woocommerce') );
} else {
echo '<span class="description">' . __( 'To edit colours <code>woocommerce/assets/css/woocommerce-base.less</code> and <code>woocommerce.css</code> need to be writable. See <a href="http://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.', 'woocommerce' ) . '</span>';
}
?></td>
</tr>
<script type="text/javascript">
jQuery('input#woocommerce_frontend_css').change(function() {
if (jQuery(this).is(':checked')) {
jQuery('tr.woocommerce_frontend_css_colors').show();
} else {
jQuery('tr.woocommerce_frontend_css_colors').hide();
}
}).change();
</script>
<?php
default:
do_action( 'woocommerce_admin_field_'.$value['type'], $value );
break;
@ -709,6 +779,19 @@ function woocommerce_admin_fields($options) {
}
}
/**
* Color Picker Input
*
* Shows a color picker for our options
*/
function woocommerce_frontend_css_color_picker( $name, $id, $value, $desc = '' ) {
global $woocommerce;
echo '<div class="color_box"><strong><img class="help_tip" data-tip="' . $desc . '" src="' . $woocommerce->plugin_url() . '/assets/images/help.png" /> ' . $name . '</strong>
<input name="' . esc_attr( $id ). '" id="' . $id . '" type="text" value="' . esc_attr( $value ) . '" class="colorpick" /> <div id="colorPickerDiv_' . esc_attr( $id ) . '" class="colorpickdiv"></div>
</div>';
}
/**
* Tax Row Label

View File

@ -15,6 +15,14 @@
*/
global $woocommerce_settings;
$localisation_setting = ( defined('WPLANG') ) ? array(
'name' => __('Localisation', 'woocommerce'),
'desc' => __('Use informal localisation file if it exists', 'woocommerce'),
'id' => 'woocommerce_informal_localisation_type',
'type' => 'checkbox',
'std' => 'no',
) : array();
$woocommerce_settings['general'] = apply_filters('woocommerce_general_settings', array(
array( 'name' => __( 'General Options', 'woocommerce' ), 'type' => 'title', 'desc' => '', 'id' => 'general_options' ),
@ -32,7 +40,6 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
array(
'name' => __( 'Currency', 'woocommerce' ),
'desc' => __("This controls what currency prices are listed at in the catalog and which currency gateways will take payments in.", 'woocommerce' ),
'tip' => '',
'id' => 'woocommerce_currency',
'css' => 'min-width:300px;',
'std' => 'GBP',
@ -94,30 +101,42 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
'type' => 'multi_select_countries'
),
array(
'name' => __('Localisation', 'woocommerce'),
'desc' => __('Use informal localisation file if it exists', 'woocommerce'),
'id' => 'woocommerce_informal_localisation_type',
'type' => 'checkbox',
'std' => 'no',
),
$localisation_setting,
array( 'type' => 'sectionend', 'id' => 'general_options'),
array( 'name' => __( 'Checkout and Accounts', 'woocommerce' ), 'type' => 'title','desc' => __('The following options control the behaviour of the checkout process and customer accounts.', 'woocommerce'), 'id' => 'checkout_account_options' ),
array(
'name' => __( 'Checkout', 'woocommerce' ),
'desc' => __( 'Enable guest checkout (no account required)', 'woocommerce' ),
'id' => 'woocommerce_enable_guest_checkout',
'std' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start'
),
array(
'desc' => __( 'Show order comments section', 'woocommerce' ),
'id' => 'woocommerce_enable_order_comments',
'std' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'end'
),
array(
'name' => __( 'Security', 'woocommerce' ),
'desc' => __( 'Force <abbr title="Secure Sockets Layer, a computing protocol that ensures the security of data sent via the Internet by using encryption">SSL</abbr>/HTTPS (an SSL Certificate is required)', 'woocommerce' ),
'desc' => __( 'Force secure checkout', 'woocommerce' ),
'id' => 'woocommerce_force_ssl_checkout',
'std' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'start',
'show_if_checked' => 'option',
'desc_tip' => __('Force SSL (HTTPS) on the checkout pages (an SSL Certificate is required)', 'woocommerce'),
),
array(
'desc' => __( 'Un-force <abbr title="Secure Sockets Layer, a computing protocol that ensures the security of data sent via the Internet by using encryption">SSL</abbr>/HTTPS when leaving the checkout', 'woocommerce' ),
'desc' => __( 'Un-force HTTPS when leaving the checkout', 'woocommerce' ),
'id' => 'woocommerce_unforce_ssl_checkout',
'std' => 'no',
'type' => 'checkbox',
@ -127,7 +146,7 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
array(
'name' => __( 'Coupons', 'woocommerce' ),
'desc' => __( 'Enable the use of coupons', 'woocommerce' ),
'desc' => __( 'Enable coupons', 'woocommerce' ),
'id' => 'woocommerce_enable_coupons',
'std' => 'yes',
'type' => 'checkbox',
@ -145,24 +164,7 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
),
array(
'name' => __( 'Checkout', 'woocommerce' ),
'desc' => __( 'Enable Guest Checkout (no account required)', 'woocommerce' ),
'id' => 'woocommerce_enable_guest_checkout',
'std' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start'
),
array(
'desc' => __( 'Show order comments section', 'woocommerce' ),
'id' => 'woocommerce_enable_order_comments',
'std' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'end'
),
array(
'name' => __( 'Customer Accounts', 'woocommerce' ),
'name' => __( 'Registration', 'woocommerce' ),
'desc' => __( 'Allow unregistered users to register from the Checkout', 'woocommerce' ),
'id' => 'woocommerce_enable_signup_and_login_from_checkout',
'std' => 'yes',
@ -175,7 +177,16 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
'id' => 'woocommerce_enable_myaccount_registration',
'std' => 'no',
'type' => 'checkbox',
'checkboxgroup' => ''
'checkboxgroup' => 'end'
),
array(
'name' => __( 'Customer Accounts', 'woocommerce' ),
'desc' => __( 'Prevent customers from accessing WordPress admin', 'woocommerce' ),
'id' => 'woocommerce_lock_down_admin',
'std' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'start'
),
array(
@ -187,15 +198,7 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
),
array(
'desc' => __( 'Prevent customers from accessing WordPress admin', 'woocommerce' ),
'id' => 'woocommerce_lock_down_admin',
'std' => 'no',
'type' => 'checkbox',
'checkboxgroup' => ''
),
array(
'desc' => __( 'Allow customers to reorder items from past orders', 'woocommerce' ),
'desc' => __( 'Allow customers to repurchase past orders', 'woocommerce' ),
'id' => 'woocommerce_allow_customers_to_reorder',
'std' => 'no',
'type' => 'checkbox',
@ -208,19 +211,25 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
array(
'name' => __( 'Styling', 'woocommerce' ),
'desc' => __( 'Enable WooCommerce CSS styles', 'woocommerce' ),
'id' => 'woocommerce_frontend_css',
'std' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start'
),
array(
'desc' => __( 'Enable the "Demo Store" notice on your site', 'woocommerce' ),
'id' => 'woocommerce_demo_store',
'std' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'end'
'checkboxgroup' => 'start'
),
array(
'desc' => __( 'Enable WooCommerce CSS styles', 'woocommerce' ),
'id' => 'woocommerce_frontend_css',
'std' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'end'
),
array(
'name' => __( 'Colours', 'woocommerce' ),
'std' => '#ad74a2',
'type' => 'woocommerce_frontend_css_colors'
),
array(
@ -241,7 +250,7 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
),
array(
'desc' => __( 'Enable "chosen" (enhanced select input) for country selection inputs', 'woocommerce' ),
'desc' => __( 'Enable enhanced country select boxes', 'woocommerce' ),
'id' => 'woocommerce_enable_chosen',
'std' => 'yes',
'type' => 'checkbox',
@ -285,29 +294,32 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
),
array(
'name' => __('Require login to download', 'woocommerce'),
'desc' => __('Do not allow downloads if a user is not logged in. This setting does not apply to guest downloads.', 'woocommerce'),
'name' => __('Access Restrictions', 'woocommerce'),
'desc' => __('Must be logged in to download files', 'woocommerce'),
'id' => 'woocommerce_downloads_require_login',
'type' => 'checkbox',
'std' => 'no',
'desc_tip' => __('This setting does not apply to guest downloads.', 'woocommerce'),
'checkboxgroup' => 'start'
),
array(
'desc' => __('Grant access to downloadable products after payment', 'woocommerce'),
'id' => 'woocommerce_downloads_grant_access_after_payment',
'type' => 'checkbox',
'std' => 'yes',
'desc_tip' => __('Turn this option off to only grant access when an order is "complete", rather than "processing"', 'woocommerce'),
'checkboxgroup' => 'end'
),
array(
'name' => __('Limit quantity', 'woocommerce'),
'desc' => __( 'Limit the purchasable quantity of downloadable-virtual items to 1.', 'woocommerce' ),
'desc' => __( 'Limit the purchasable quantity of downloadable-virtual items to 1', 'woocommerce' ),
'id' => 'woocommerce_limit_downloadable_product_qty',
'std' => 'yes',
'type' => 'checkbox'
),
array(
'name' => __('Mixed cart handling', 'woocommerce'),
'desc' => __('Grant access to downloadable products after payment. Turn this option off to only grant access when an order is "complete".', 'woocommerce'),
'id' => 'woocommerce_downloads_grant_access_after_payment',
'type' => 'checkbox',
'std' => 'yes',
),
array( 'type' => 'sectionend', 'id' => 'digital_download_options' ),
)); // End general settings
@ -644,12 +656,8 @@ $woocommerce_settings['catalog'] = apply_filters('woocommerce_catalog_settings',
'desc_tip' => true,
),
array( 'type' => 'sectionend', 'id' => 'product_data_options' ),
array( 'name' => __( 'Product Reviews', 'woocommerce' ), 'type' => 'title', 'desc' => __('The following options affect product reviews (comments).', 'woocommerce'), 'id' => 'product_review_options' ),
array(
'name' => __( 'Ratings', 'woocommerce' ),
'name' => __( 'Product Ratings', 'woocommerce' ),
'desc' => __( 'Enable the star rating field on the review form', 'woocommerce' ),
'id' => 'woocommerce_enable_review_rating',
'std' => 'yes',
@ -825,6 +833,21 @@ $woocommerce_settings['inventory'] = apply_filters('woocommerce_inventory_settin
'type' => 'checkbox'
),
array(
'name' => __( 'Stock display format', 'woocommerce' ),
'desc' => __( 'This controls how stock is displayed on the frontend.', 'woocommerce' ),
'id' => 'woocommerce_stock_format',
'css' => 'min-width:150px;',
'std' => '',
'type' => 'select',
'options' => array(
'' => __( 'Always show stock e.g. "12 in stock"', 'woocommerce' ),
'low_amount' => __( 'Only show stock when low e.g. "Only 2 left in stock" vs. "In Stock"', 'woocommerce' ),
'no_amount' => __( 'Never show stock amount', 'woocommerce' ),
),
'desc_tip' => true,
),
array( 'type' => 'sectionend', 'id' => 'inventory_options'),
)); // End inventory settings
@ -875,6 +898,14 @@ $woocommerce_settings['shipping'] = apply_filters('woocommerce_shipping_settings
'id' => 'woocommerce_ship_to_same_address',
'std' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => ''
),
array(
'desc' => __( 'Collect shipping address even when not required', 'woocommerce' ),
'id' => 'woocommerce_require_shipping_address',
'std' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'end'
),
@ -1078,63 +1109,6 @@ $woocommerce_settings['email'] = apply_filters('woocommerce_email_settings', arr
)); // End email settings
$woocommerce_settings['integration'] = apply_filters('woocommerce_intregation_settings', array(
array( 'name' => __( 'ShareThis', 'woocommerce' ), 'type' => 'title', 'desc' => __('ShareThis offers a sharing widget which will allow customers to share links to products with their friends.', 'woocommerce'), 'id' => 'share_this' ),
array(
'name' => __( 'ShareThis Publisher ID', 'woocommerce' ),
'desc' => sprintf( __( 'Enter your %1$sShareThis publisher ID%2$s to show social sharing buttons on product pages.', 'woocommerce' ), '<a href="http://sharethis.com/account/">', '</a>' ),
'id' => 'woocommerce_sharethis',
'type' => 'text',
'std' => '',
'css' => 'min-width:300px;',
),
array( 'type' => 'sectionend', 'id' => 'share_this'),
array( 'name' => __( 'ShareDaddy', 'woocommerce' ), 'type' => 'title', 'desc' => __('ShareDaddy is a sharing plugin bundled with JetPack.', 'woocommerce'), 'id' => 'share_this' ),
array(
'name' => __( 'Output ShareDaddy button?', 'woocommerce' ),
'desc' => __( 'Enable this option to show the ShareDaddy button (if installed) on the product page.', 'woocommerce' ),
'id' => 'woocommerce_sharedaddy',
'type' => 'checkbox',
'std' => 'no',
),
array( 'type' => 'sectionend', 'id' => 'share_this'),
array( 'name' => __( 'Google Analytics', 'woocommerce' ), 'type' => 'title', 'desc' => __('Google Analytics is a free service offered by Google that generates detailed statistics about the visitors to a website.', 'woocommerce'), 'id' => 'google_analytics' ),
array(
'name' => __('Google Analytics ID', 'woocommerce'),
'desc' => __('Log into your google analytics account to find your ID. e.g. <code>UA-XXXXX-X</code>', 'woocommerce'),
'id' => 'woocommerce_ga_id',
'type' => 'text',
'css' => 'min-width:300px;',
),
array(
'name' => __('Tracking code', 'woocommerce'),
'desc' => __('Add tracking code to your site\'s footer. You don\'t need to enable this if using a 3rd party analytics plugin.', 'woocommerce'),
'id' => 'woocommerce_ga_standard_tracking_enabled',
'type' => 'checkbox',
'checkboxgroup' => 'start'
),
array(
'name' => __('Tracking code', 'woocommerce'),
'desc' => __('Add eCommerce tracking code to the thankyou page', 'woocommerce'),
'id' => 'woocommerce_ga_ecommerce_tracking_enabled',
'type' => 'checkbox',
'checkboxgroup' => 'end'
),
array( 'type' => 'sectionend', 'id' => 'google_analytics'),
)); // End integration settings
/**
* Settings page
*
@ -1144,16 +1118,21 @@ if (!function_exists('woocommerce_settings')) {
function woocommerce_settings() {
global $woocommerce, $woocommerce_settings;
$current_tab = ( empty( $_GET['tab'] ) ) ? 'general' : urldecode( $_GET['tab'] );
$current_section = ( empty( $_GET['section'] ) ) ? '' : urldecode( $_GET['section'] );
// Get current tab/section
$current_tab = ( empty( $_GET['tab'] ) ) ? 'general' : urldecode( $_GET['tab'] );
$current_section = ( empty( $_REQUEST['section'] ) ) ? '' : urldecode( $_REQUEST['section'] );
// Save settings
if ( ! empty( $_POST ) ) {
if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'woocommerce-settings' ) )
die( __( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
if ( ! $current_section ) {
$old_base_color = get_option('woocommerce_frontend_css_base_color');
$old_base_color = get_option('woocommerce_frontend_css_base_color');
switch ( $current_tab ) {
case "general" :
case "pages" :
@ -1162,7 +1141,6 @@ function woocommerce_settings() {
case "shipping" :
case "tax" :
case "email" :
case "integration" :
woocommerce_update_options( $woocommerce_settings[$current_tab] );
break;
}
@ -1170,6 +1148,32 @@ function woocommerce_settings() {
do_action( 'woocommerce_update_options' );
do_action( 'woocommerce_update_options_' . $current_tab );
// Handle Colour Settings
if ( $current_tab == 'general' && get_option('woocommerce_frontend_css') == 'yes' ) {
// Save settings
$primary = ( ! empty( $_POST['woocommerce_frontend_css_primary'] ) ) ? woocommerce_format_hex( $_POST['woocommerce_frontend_css_primary'] ) : '';
$secondary = ( ! empty( $_POST['woocommerce_frontend_css_secondary'] ) ) ? woocommerce_format_hex( $_POST['woocommerce_frontend_css_secondary'] ) : '';
$highlight = ( ! empty( $_POST['woocommerce_frontend_css_highlight'] ) ) ? woocommerce_format_hex( $_POST['woocommerce_frontend_css_highlight'] ) : '';
$content_bg = ( ! empty( $_POST['woocommerce_frontend_css_content_bg'] ) ) ? woocommerce_format_hex( $_POST['woocommerce_frontend_css_content_bg'] ) : '';
$subtext = ( ! empty( $_POST['woocommerce_frontend_css_subtext'] ) ) ? woocommerce_format_hex( $_POST['woocommerce_frontend_css_subtext'] ) : '';
$colors = array(
'primary' => $primary,
'secondary' => $secondary,
'highlight' => $highlight,
'content_bg' => $content_bg,
'subtext' => $subtext
);
$old_colors = get_option( 'woocommerce_frontend_css_colors' );
update_option( 'woocommerce_frontend_css_colors', $colors );
if ( $old_colors != $colors )
woocommerce_compile_less_styles();
}
} else {
// Save section only
@ -1182,7 +1186,7 @@ function woocommerce_settings() {
unset($_SESSION['orderby']);
$woocommerce->clear_product_transients();
// Redirect back
// Redirect back to the settings page
$redirect = add_query_arg( 'saved', 'true' );
if ( ! empty( $_POST['subtab'] ) ) $redirect = add_query_arg( 'subtab', esc_attr( str_replace( '#', '', $_POST['subtab'] ) ), $redirect );
@ -1191,12 +1195,27 @@ function woocommerce_settings() {
exit;
}
// Settings saved message
// Get any returned messages
$error = ( empty( $_GET['wc_error'] ) ) ? '' : urldecode( stripslashes( $_GET['wc_error'] ) );
$message = ( empty( $_GET['wc_message'] ) ) ? '' : urldecode( stripslashes( $_GET['wc_message'] ) );
if ( $error || $message ) {
if ( $error ) {
echo '<div id="message" class="error fade"><p><strong>' . wptexturize( $error ) . '</strong></p></div>';
} else {
echo '<div id="message" class="updated fade"><p><strong>' . wptexturize( $message ) . '</strong></p></div>';
}
} elseif ( ! empty( $_GET['saved'] ) ) {
echo '<div id="message" class="updated fade"><p><strong>' . __( 'Your settings have been saved.', 'woocommerce' ) . '</strong></p></div>';
}
// Were the settings saved?
if ( ! empty( $_GET['saved'] ) ) {
echo '<div id="message" class="updated fade"><p><strong>' . __( 'Your settings have been saved.', 'woocommerce' ) . '</strong></p></div>';
flush_rewrite_rules( false );
do_action('woocommerce_settings_saved');
}
@ -1282,7 +1301,6 @@ function woocommerce_settings() {
case "inventory" :
case "tax" :
case "email" :
case "integration" :
woocommerce_admin_fields( $woocommerce_settings[$current_tab] );
break;
case "shipping" :
@ -1425,6 +1443,25 @@ function woocommerce_settings() {
echo '</div>';
break;
case "integration" :
$integrations = $woocommerce->integrations->get_integrations();
$section = empty( $_GET['section'] ) ? key( $integrations ) : urldecode( $_GET['section'] );
foreach ( $integrations as $integration ) {
$title = ( isset( $integration->method_title ) && $integration->method_title) ? ucwords( $integration->method_title ) : ucwords( $method->id );
$current = ( $integration->id == $section ) ? 'class="current"' : '';
$links[] = '<a href="' . add_query_arg( 'section', $integration->id, admin_url('admin.php?page=woocommerce&tab=integration') ) . '"' . $current . '>' . $title . '</a>';
}
echo '<ul class="subsubsub"><li>' . implode(' | </li><li>', $links) . '</li></ul><br class="clear" />';
if ( isset( $integrations[ $section ] ) )
$integrations[ $section ]->admin_options();
break;
default :
do_action( 'woocommerce_settings_tabs_' . $current_tab );

File diff suppressed because one or more lines are too long

View File

@ -110,6 +110,12 @@
}
}
#wc_get_started { position: relative; margin: 1em 0 2em; padding: 15px 15px 15px 90px; border: 1px solid #d9d9d9; background: #f5f5f5 url(../images/gear.png) no-repeat 15px 15px; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #fff; -moz-box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #fff; -webkit-box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #fff; }
#wc_get_started span { display: block; text-shadow: 1px 1px 0 #fff; font-size: 14px; line-height: 22px; color: #595959; }
#wc_get_started span.main { margin-top: 2px; font-weight: bold; font-size: 16px; }
#wc_get_started .main-button { position: absolute; right: 20px; top: 27px; }
#wc_get_started p { margin: 1em 0 .5em; }
#icon-woocommerce, .woocommerce_icon, .icon32-posts-product, .icon32-posts-shop_order, .icon32-posts-shop_coupon, .icon32-posts-product_variation {
background-image: url(../images/icons/woocommerce-icons.png) !important;
background-position: -11px -6px;
@ -154,6 +160,12 @@ input.wc-error {
background-color: #FFBABA;
}
span.mce_woocommerce_shortcodes_button {
background-image: url(../images/icons/wc_icon.png) !important;
background-repeat: no-repeat !important;
background-position: center !important;
}
/* Status page */
table.wc_status_table {
th {
@ -1261,6 +1273,54 @@ img.help_tip {
cursor: help;
line-height: 1;
}
fieldset {
img.help_tip {
margin: -3px 0 0 5px;
}
}
.color_box {
border: 1px solid #ccc;
box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
-webkit-box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
-moz-box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
-webkit-border-radius:3px;
-moz-border-radius:3px;
border-radius:3px;
padding: 4px 6px;
float: left;
width: 90px;
margin: 0 10px 0 0;
strong {
text-align: left;
display: block;
padding: 0 0 2px;
font-size: 0.92em;
img {
float: right;
margin: 1px 0 0 0;
}
}
input {
width: 100%;
margin: 0;
font-family: monospace;
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box; /* Firefox, other Gecko */
box-sizing: border-box; /* Opera/IE 8+ */
}
.colorpickdiv {
z-index: 100;
background:#eee;
border:1px solid #ccc;
position:absolute;
display:none;
}
}
.color_box_clear {
display: block;
clear: both;
padding-bottom: 10px;
}
}
}
@ -1339,7 +1399,7 @@ img.help_tip {
}
#woocommerce-product-data ul.product_data_tabs li {
&.general_options, &.tax_options, &.inventory_options, &.crosssell_options, &.attribute_options, &.grouping_options, &.variation_options {
&.general_options, &.tax_options, &.inventory_options, &.related_product_options, &.attribute_options, &.grouping_options, &.variation_options {
a {
padding: 9px 9px 9px 34px;
line-height: 16px;
@ -1364,7 +1424,7 @@ img.help_tip {
background-position: 9px -111px;
}
}
&.crosssell_options {
&.related_product_options {
a {
background-position: 9px -171px;
}

View File

@ -1 +1 @@
#fancybox-loading{position:fixed;top:50%;left:50%;width:40px;height:40px;margin-top:-20px;margin-left:-20px;cursor:pointer;overflow:hidden;z-index:1104;display:none}#fancybox-loading div{position:absolute;top:0;left:0;width:40px;height:480px;background-image:url('../images/fancybox/fancybox.png')}#fancybox-overlay{position:absolute;top:0;left:0;width:100%;z-index:1100;display:none}#fancybox-tmp{padding:0;margin:0;border:0;overflow:auto;display:none}#fancybox-wrap{position:absolute;top:0;left:0;padding:20px;z-index:1101;outline:0;display:none}#fancybox-outer{position:relative;width:100%;height:100%;background:#fff;-webkit-border-radius:1em;-moz-border-radius:1em;border-radius:1em;-webkit-box-shadow:0 0 1em rgba(0,0,0,0.6);-moz-box-shadow:0 0 1em rgba(0,0,0,0.6);box-shadow:0 0 1em rgba(0,0,0,0.6)}#fancybox-content{width:0;height:0;padding:0;outline:0;position:relative;overflow:hidden;z-index:1102;border:0 solid #fff;-webkit-border-radius:1em;-moz-border-radius:1em;border-radius:1em}#fancybox-hide-sel-frame{position:absolute;top:0;left:0;width:100%;height:100%;background:transparent;z-index:1101}#fancybox-close{position:absolute;top:-15px;right:-15px;width:24px;height:24px;line-height:24px!important;font-size:16px!important;font-family:sans-serif!important;cursor:pointer;z-index:1103;display:none;text-align:center;background:#000;display:inline-block;border:2px solid #fff;-webkit-border-radius:2em;-moz-border-radius:2em;border-radius:2em;font-weight:bold;color:#fff;text-shadow:none;-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.8);-moz-box-shadow:0 1px 3px rgba(0,0,0,0.8);box-shadow:0 1px 3px rgba(0,0,0,0.8);-webkit-transition:all ease-in-out .2s}#fancybox-close:hover{background:#a36396;text-decoration:none!important}#fancybox-error{color:#444;font:normal 12px/20px Arial;padding:14px;margin:0}#fancybox-img{width:100%;height:100%;padding:0;margin:0;border:0;outline:0;line-height:0;vertical-align:top}#fancybox-frame{width:100%;height:100%;border:0;display:block}#fancybox-left,#fancybox-right{position:absolute;bottom:0;height:100%;width:35%;cursor:pointer;outline:0;background:transparent url('../images/fancybox/blank.gif');z-index:1102;display:none}#fancybox-left{left:0}#fancybox-right{right:0}#fancybox-left-ico,#fancybox-right-ico{position:absolute;top:50%;left:-9999px;width:30px;height:30px;margin-top:-15px;cursor:pointer;z-index:1102;display:block}#fancybox-left-ico{background-image:url('../images/fancybox/fancybox.png');background-position:-40px -30px}#fancybox-right-ico{background-image:url('../images/fancybox/fancybox.png');background-position:-40px -60px}#fancybox-left:hover,#fancybox-right:hover{visibility:visible}#fancybox-left:hover span{left:20px}#fancybox-right:hover span{left:auto;right:20px}.fancybox-bg{position:absolute;padding:0;margin:0;border:0;width:20px;height:20px;z-index:1001}#fancybox-title{font-family:Helvetica;font-size:12px;z-index:1102;text-align:center;padding-top:10px}#fancybox-title-float{padding:3px 10px;background:#000;display:inline-block;border:2px solid #fff;-webkit-border-radius:2em;-moz-border-radius:2em;border-radius:2em;font-weight:bold;color:#fff;text-shadow:none;-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.8);-moz-box-shadow:0 1px 3px rgba(0,0,0,0.8);box-shadow:0 1px 3px rgba(0,0,0,0.8)}
#fancybox-loading{position:fixed;top:50%;left:50%;width:40px;height:40px;margin-top:-20px;margin-left:-20px;cursor:pointer;overflow:hidden;z-index:11104;display:none}#fancybox-loading div{position:absolute;top:0;left:0;width:40px;height:480px;background-image:url('../images/fancybox/fancybox.png')}#fancybox-overlay{position:absolute;top:0;left:0;width:100%;z-index:11100;display:none}#fancybox-tmp{padding:0;margin:0;border:0;overflow:auto;display:none}#fancybox-wrap{position:absolute;top:0;left:0;padding:20px;z-index:11101;outline:0;display:none}#fancybox-outer{position:relative;width:100%;height:100%;background:#fff;-webkit-border-radius:1em;-moz-border-radius:1em;border-radius:1em;-webkit-box-shadow:0 0 1em rgba(0,0,0,0.6);-moz-box-shadow:0 0 1em rgba(0,0,0,0.6);box-shadow:0 0 1em rgba(0,0,0,0.6)}#fancybox-content{width:0;height:0;padding:0;outline:0;position:relative;overflow:hidden;z-index:11102;border:0 solid #fff;-webkit-border-radius:1em;-moz-border-radius:1em;border-radius:1em}#fancybox-hide-sel-frame{position:absolute;top:0;left:0;width:100%;height:100%;background:transparent;z-index:11101}#fancybox-close{position:absolute;top:-15px;right:-15px;width:24px;height:24px;line-height:24px!important;font-size:16px!important;font-family:sans-serif!important;cursor:pointer;z-index:11103;display:none;text-align:center;background:#000;display:inline-block;border:2px solid #fff;-webkit-border-radius:2em;-moz-border-radius:2em;border-radius:2em;font-weight:bold;color:#fff;text-shadow:none;-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.8);-moz-box-shadow:0 1px 3px rgba(0,0,0,0.8);box-shadow:0 1px 3px rgba(0,0,0,0.8);-webkit-transition:all ease-in-out .2s}#fancybox-close:hover{background:#a36396;text-decoration:none!important}#fancybox-error{color:#444;font:normal 12px/20px Arial;padding:14px;margin:0}#fancybox-img{width:100%;height:100%;padding:0;margin:0;border:0;outline:0;line-height:0;vertical-align:top}#fancybox-frame{width:100%;height:100%;border:0;display:block}#fancybox-left,#fancybox-right{position:absolute;bottom:0;height:100%;width:35%;cursor:pointer;outline:0;background:transparent url('../images/fancybox/blank.gif');z-index:11102;display:none}#fancybox-left{left:0}#fancybox-right{right:0}#fancybox-left-ico,#fancybox-right-ico{position:absolute;top:50%;left:-9999px;width:30px;height:30px;margin-top:-15px;cursor:pointer;z-index:11102;display:block}#fancybox-left-ico{background-image:url('../images/fancybox/fancybox.png');background-position:-40px -30px}#fancybox-right-ico{background-image:url('../images/fancybox/fancybox.png');background-position:-40px -60px}#fancybox-left:hover,#fancybox-right:hover{visibility:visible}#fancybox-left:hover span{left:20px}#fancybox-right:hover span{left:auto;right:20px}.fancybox-bg{position:absolute;padding:0;margin:0;border:0;width:20px;height:20px;z-index:11001}#fancybox-title{font-family:Helvetica;font-size:12px;z-index:11102;text-align:center;padding-top:10px}#fancybox-title-float{padding:3px 10px;background:#000;display:inline-block;border:2px solid #fff;-webkit-border-radius:2em;-moz-border-radius:2em;border-radius:2em;font-weight:bold;color:#fff;text-shadow:none;-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.8);-moz-box-shadow:0 1px 3px rgba(0,0,0,0.8);box-shadow:0 1px 3px rgba(0,0,0,0.8)}

View File

@ -25,7 +25,7 @@
margin-left: -20px;
cursor: pointer;
overflow: hidden;
z-index: 1104;
z-index: 11104;
display: none;
}
@ -43,7 +43,7 @@
top: 0;
left: 0;
width: 100%;
z-index: 1100;
z-index: 11100;
display: none;
}
@ -60,7 +60,7 @@
top: 0;
left: 0;
padding: 20px;
z-index: 1101;
z-index: 11101;
outline: none;
display: none;
}
@ -85,7 +85,7 @@
outline: none;
position: relative;
overflow: hidden;
z-index: 1102;
z-index: 11102;
border: 0px solid #fff;
-webkit-border-radius:1em;
-moz-border-radius:1em;
@ -99,7 +99,7 @@
width: 100%;
height: 100%;
background: transparent;
z-index: 1101;
z-index: 11101;
}
#fancybox-close {
@ -112,7 +112,7 @@
font-size:16px !important;
font-family: sans-serif !important;
cursor: pointer;
z-index: 1103;
z-index: 11103;
display: none;
text-align: center;
background: #000;
@ -168,7 +168,7 @@
cursor: pointer;
outline: none;
background: transparent url('../images/fancybox/blank.gif');
z-index: 1102;
z-index: 11102;
display: none;
}
@ -188,7 +188,7 @@
height: 30px;
margin-top: -15px;
cursor: pointer;
z-index: 1102;
z-index: 11102;
display: block;
}
@ -222,13 +222,13 @@
border: 0;
width: 20px;
height: 20px;
z-index: 1001;
z-index: 11001;
}
#fancybox-title {
font-family: Helvetica;
font-size: 12px;
z-index: 1102;
z-index: 11102;
text-align: center;
padding-top:10px;
}

82
assets/css/mixins.less Normal file
View File

@ -0,0 +1,82 @@
.clearfix() {
&:after {
content:"";
display:block;
clear:both;
}
}
.border_radius(@radius:4px) {
-webkit-border-radius:@radius;
-moz-border-radius:@radius;
border-radius:@radius;
}
.border_radius_right(@radius:4px) {
-webkit-border-top-right-radius: @radius;
-webkit-border-bottom-right-radius: @radius;
-moz-border-radius-topright: @radius;
-moz-border-radius-bottomright: @radius;
border-top-right-radius: @radius;
border-bottom-right-radius: @radius;
}
.border_radius_left(@radius:4px) {
-webkit-border-top-left-radius: @radius;
-webkit-border-bottom-left-radius: @radius;
-moz-border-radius-topleft: @radius;
-moz-border-radius-bottomleft: @radius;
border-top-left-radius: @radius;
border-bottom-left-radius: @radius;
}
.border_radius_bottom(@radius:4px) {
-webkit-border-bottom-left-radius: @radius;
-webkit-border-bottom-right-radius: @radius;
-moz-border-radius-bottomleft: @radius;
-moz-border-radius-bottomright: @radius;
border-bottom-left-radius: @radius;
border-bottom-right-radius: @radius;
}
.border_radius_top(@radius:4px) {
-webkit-border-top-left-radius: @radius;
-webkit-border-top-right-radius: @radius;
-moz-border-radius-topleft: @radius;
-moz-border-radius-topright: @radius;
border-top-left-radius: @radius;
border-top-right-radius: @radius;
}
.opacity(@opacity:0.75) {
filter:~"alpha(opacity=@opacity * 100)";
-moz-opacity:@opacity;
-khtml-opacity: @opacity;
opacity: @opacity;
}
.box_shadow(@shadow_x:3px, @shadow_y:3px, @shadow_rad:3px, @shadow_in:3px, @shadow_color:#888) {
box-shadow:@shadow_x @shadow_y @shadow_rad @shadow_in @shadow_color;
-webkit-box-shadow:@shadow_x @shadow_y @shadow_rad @shadow_in @shadow_color;
-moz-box-shadow:@shadow_x @shadow_y @shadow_rad @shadow_in @shadow_color;
}
.inset_box_shadow(@shadow_x:3px, @shadow_y:3px, @shadow_rad:3px, @shadow_in:3px, @shadow_color:#888) {
box-shadow:inset @shadow_x @shadow_y @shadow_rad @shadow_in @shadow_color;
-webkit-box-shadow:inset @shadow_x @shadow_y @shadow_rad @shadow_in @shadow_color;
-moz-box-shadow:inset @shadow_x @shadow_y @shadow_rad @shadow_in @shadow_color;
}
.text_shadow(@shadow_x:3px, @shadow_y:3px, @shadow_rad:3px, @shadow_color:#fff) {
text-shadow:@shadow_x @shadow_y @shadow_rad @shadow_color;
}
.vertical_gradient(@from: #000, @to: #FFF) {
background: @from;
background: -webkit-gradient(linear, left top, left bottom, from(@from), to(@to));
background: -webkit-linear-gradient(@from, @to);
background: -moz-linear-gradient(center top, @from 0%, @to 100%);
background: -moz-gradient(center top, @from 0%, @to 100%);
}
.transition(@selector:all, @animation:ease-in-out, @duration:.2s) {
-webkit-transition:@selector @animation @duration;
-moz-transition:@selector @animation @duration;
-o-transition:@selector @animation @duration;
transition:@selector @animation @duration;
}
.clear { clear: both; }
.nobr { white-space: nowrap; }
.darkorlighttextshadow ( @a, @opacity: 0.8 ) when (lightness(@a) >= 65%) { .text_shadow( 0, -1px, 0, rgba(0,0,0,@opacity) ); }
.darkorlighttextshadow ( @a, @opacity: 0.8 ) when (lightness(@a) < 65%) { .text_shadow( 0, 1px, 0, rgba(255,255,255,@opacity) ); }

View File

@ -0,0 +1,11 @@
@primary: #ad74a2; /* Primary colour for buttons (alt) */
@primarytext: desaturate(lighten(@primary,50%),18%); /* Text on primary colour bg */
@secondary: desaturate(lighten(@primary,40%),18%); /* Secondary buttons */
@secondarytext: desaturate(darken(@secondary,60%),18%); /* Text on secondary colour bg */
@highlight: spin( @primary, 150 ); /* Prices, In stock labels, sales flash */
@highlightext: desaturate(lighten(@highlight,50%),18%); /* Text on highlight colour bg */
@contentbg: #fff; /* Content BG - Tabs (active state) */
@subtext: #777; /* small, breadcrumbs etc */

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

BIN
assets/images/gear.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 814 B

View File

@ -1,8 +1,6 @@
(
function(){
var icon_url = '../wp-content/plugins/woocommerce/assets/images/icons/wc_icon.png';
tinymce.create(
"tinymce.plugins.WooCommerceShortcodes",
{
@ -14,7 +12,6 @@
d=e.createMenuButton( "woocommerce_shortcodes_button",{
title:"Insert WooCommerce Shortcode",
image:icon_url,
icons:false
});

View File

@ -710,6 +710,7 @@ class WC_Cart {
function set_quantity( $cart_item_key, $quantity = 1 ) {
if ( $quantity == 0 || $quantity < 0 ) {
do_action( 'woocommerce_before_cart_item_quantity_zero', $cart_item_key );
unset( $this->cart_contents[$cart_item_key] );
} else {
$this->cart_contents[$cart_item_key]['quantity'] = $quantity;
@ -1368,6 +1369,7 @@ class WC_Cart {
$packages[0]['contents'] = $this->get_cart(); // Items in the package
$packages[0]['contents_cost'] = 0; // Cost of items in the package
$packages[0]['applied_coupons'] = $this->applied_coupons; // Applied coupons - some, like free shipping, affect costs
$packages[0]['destination']['country'] = $woocommerce->customer->get_shipping_country();
$packages[0]['destination']['state'] = $woocommerce->customer->get_shipping_state();
$packages[0]['destination']['postcode'] = $woocommerce->customer->get_shipping_postcode();

View File

@ -103,7 +103,7 @@ class WC_Checkout {
$this->posted['shipping_method'] = isset($_POST['shipping_method']) ? woocommerce_clean($_POST['shipping_method']) : '';
// Ship to billing only option
if ($woocommerce->cart->ship_to_billing_address_only()) $this->posted['shiptobilling'] = 1;
if ( $woocommerce->cart->ship_to_billing_address_only() ) $this->posted['shiptobilling'] = 1;
// Update customer shipping and payment method to posted method
$_SESSION['_chosen_shipping_method'] = $this->posted['shipping_method'];
@ -122,10 +122,10 @@ class WC_Checkout {
foreach ($this->checkout_fields as $fieldset_key => $fieldset) :
// Skip shipping if its not needed
if ($fieldset_key=='shipping' && (!$woocommerce->cart->needs_shipping() || $woocommerce->cart->ship_to_billing_address_only() || $this->posted['shiptobilling'])) :
if ( $fieldset_key == 'shipping' && ( $woocommerce->cart->ship_to_billing_address_only() || $this->posted['shiptobilling'] || ( ! $woocommerce->cart->needs_shipping() && get_option('woocommerce_require_shipping_address') == 'no' ) ) ) {
$skipped_shipping = true;
continue;
endif;
}
foreach ($fieldset as $key => $field) :
@ -204,17 +204,16 @@ class WC_Checkout {
}
if (is_user_logged_in()) :
if ( is_user_logged_in() )
$this->creating_account = false;
elseif (isset($this->posted['createaccount']) && $this->posted['createaccount']) :
elseif ( ! empty( $this->posted['createaccount'] ) )
$this->creating_account = true;
elseif ($this->must_create_account) :
elseif ($this->must_create_account)
$this->creating_account = true;
else :
else
$this->creating_account = false;
endif;
if ($this->creating_account) :
if ( $this->creating_account ) {
if ( empty($this->posted['account_username']) ) $woocommerce->add_error( __('Please enter an account username.', 'woocommerce') );
if ( empty($this->posted['account_password']) ) $woocommerce->add_error( __('Please enter an account password.', 'woocommerce') );
@ -232,7 +231,7 @@ class WC_Checkout {
$woocommerce->add_error( __('An account is already registered with your email address. Please login.', 'woocommerce') );
endif;
endif;
}
// Terms
if (!isset($_POST['woocommerce_checkout_update_totals']) && empty($this->posted['terms']) && woocommerce_get_page_id('terms')>0 ) $woocommerce->add_error( __('You must accept our Terms &amp; Conditions.', 'woocommerce') );
@ -410,14 +409,14 @@ class WC_Checkout {
// UPDATE ORDER META
// Save billing and shipping first, also save to user meta if logged in
if ($this->checkout_fields['billing']) :
foreach ($this->checkout_fields['billing'] as $key => $field) :
if ($this->checkout_fields['billing']) {
foreach ($this->checkout_fields['billing'] as $key => $field) {
// Post
update_post_meta( $order_id, '_' . $key, $this->posted[$key] );
// User
if ($user_id>0 && !empty($this->posted[$key])) :
if ($user_id>0 && !empty($this->posted[$key])) {
update_user_meta( $user_id, $key, $this->posted[$key] );
// Special fields
@ -433,31 +432,28 @@ class WC_Checkout {
break;
}
endif;
}
}
}
endforeach;
endif;
if ($this->checkout_fields['shipping'] && $woocommerce->cart->needs_shipping()) :
foreach ($this->checkout_fields['shipping'] as $key => $field) :
if ($this->posted['shiptobilling']) :
if ( $this->checkout_fields['shipping'] && ( $woocommerce->cart->needs_shipping() || get_option('woocommerce_require_shipping_address') == 'yes' ) ) {
foreach ($this->checkout_fields['shipping'] as $key => $field) {
if ( $this->posted['shiptobilling'] ) {
$field_key = str_replace('shipping_', 'billing_', $key);
// Post
update_post_meta( $order_id, '_' . $key, $this->posted[$field_key] );
else :
} else {
// Post
update_post_meta( $order_id, '_' . $key, $this->posted[$key] );
// User
if ($user_id>0) :
if ( $user_id > 0 )
update_user_meta( $user_id, $key, $this->posted[$key] );
endif;
endif;
endforeach;
endif;
}
}
}
// Save any other user meta
if ($user_id) do_action('woocommerce_checkout_update_user_meta', $user_id, $this->posted);

View File

@ -291,6 +291,11 @@ class WC_Order {
return $this->order_shipping;
}
/** Gets shipping tax amount */
function get_shipping_tax() {
return $this->order_shipping_tax;
}
/** Gets order total */
function get_order_total() {
return $this->order_total;
@ -372,7 +377,16 @@ class WC_Order {
else :
$subtotal = woocommerce_price( $this->get_line_subtotal( $item, true ) );
endif;
return $subtotal;
return apply_filters( 'woocommerce_order_formatted_line_subtotal', $subtotal, $item, $this );
}
/** Gets order total - formatted for display */
function get_formatted_order_total() {
$formatted_total = woocommerce_price( $this->order_total );
return apply_filters( 'woocommerce_get_formatted_order_total', $formatted_total, $this );
}
/** Gets subtotal - subtotal is shown before discounts, but with localised taxes */
@ -537,7 +551,7 @@ class WC_Order {
if ( $this->get_order_discount() > 0 )
$total_rows[ __( 'Order Discount:', 'woocommerce' ) ] = '-' . woocommerce_price( $this->get_order_discount() );
$total_rows[ __( 'Order Total:', 'woocommerce' ) ] = woocommerce_price( $this->get_order_total() );
$total_rows[ __( 'Order Total:', 'woocommerce' ) ] = $this->get_formatted_order_total();
return apply_filters( 'woocommerce_get_order_item_totals', $total_rows, $this );
}

View File

@ -357,7 +357,6 @@ class WC_Product {
$url = add_query_arg('add-to-cart', $this->id);
endif;
$url = $woocommerce->nonce_url( 'add_to_cart', $url );
return $url;
}
@ -436,9 +435,25 @@ class WC_Product {
endif;
else :
if ($this->is_in_stock()) :
if ($this->get_total_stock() > 0) :
if ( $this->get_total_stock() > 0 ) :
$availability = sprintf( __('%s in stock', 'woocommerce'), $this->stock );
$format_option = get_option( 'woocommerce_stock_format' );
switch ( $format_option ) {
case 'no_amount' :
$format = __('In stock', 'woocommerce');
break;
case 'low_amount' :
$low_amount = get_option( 'woocommerce_notify_low_stock_amount' );
$format = ( $this->get_total_stock() <= $low_amount ) ? __('Only %s left in stock', 'woocommerce') : __('In stock', 'woocommerce');
break;
default :
$format = __('%s in stock', 'woocommerce');
break;
}
$availability = sprintf( $format, $this->stock );
if ($this->backorders_allowed() && $this->backorders_require_notification()) :
$availability .= ' ' . __('(backorders allowed)', 'woocommerce');
@ -530,13 +545,13 @@ class WC_Product {
/** Returns the product's price */
function get_price() {
return $this->price;
return apply_filters( 'woocommerce_get_price', $this->price, $this );
}
/** Returns the price (excluding tax) - ignores tax_class filters since the price may *include* tax and thus needs subtracting */
function get_price_excluding_tax() {
$price = $this->price;
$price = $this->get_price();
if ( $this->is_taxable() && get_option('woocommerce_prices_include_tax')=='yes' ) :
@ -549,7 +564,7 @@ class WC_Product {
endif;
return $price;
return apply_filters( 'woocommerce_get_price_excluding_tax', $price, $this );
}
/** Returns the tax class */

View File

@ -158,10 +158,11 @@ class WC_Settings_API {
$data['css'] = (isset( $data['css'] )) ? $data['css'] : '';
$html .= '<tr valign="top">' . "\n";
$html .= '<th scope="row" class="titledesc">' . $title . '</th>' . "\n";
$html .= '<th scope="row" class="titledesc">';
$html .= '<label for="' . $this->plugin_id . $this->id . '_' . $key . '">' . $title . '</label>';
$html .= '</th>' . "\n";
$html .= '<td class="forminp">' . "\n";
$html .= '<fieldset><legend class="screen-reader-text"><span>' . $title . '</span></legend>' . "\n";
$html .= '<label for="' . $this->plugin_id . $this->id . '_' . $key . '">';
$value = ( isset( $this->settings[ $key ] ) ) ? esc_attr( $this->settings[ $key ] ) : '';
$html .= '<input class="input-text wide-input '.$data['class'].'" type="text" name="' . $this->plugin_id . $this->id . '_' . $key . '" id="' . $this->plugin_id . $this->id . '_' . $key . '" style="'.$data['css'].'" value="' . $value . '" />';
if ( isset( $data['description'] ) && $data['description'] != '' ) { $html .= '<span class="description">' . $data['description'] . '</span>' . "\n"; }
@ -186,10 +187,11 @@ class WC_Settings_API {
$data['css'] = (isset( $data['css'] )) ? $data['css'] : '';
$html .= '<tr valign="top">' . "\n";
$html .= '<th scope="row" class="titledesc">' . $title . '</th>' . "\n";
$html .= '<th scope="row" class="titledesc">';
$html .= '<label for="' . $this->plugin_id . $this->id . '_' . $key . '">' . $title . '</label>';
$html .= '</th>' . "\n";
$html .= '<td class="forminp">' . "\n";
$html .= '<fieldset><legend class="screen-reader-text"><span>' . $title . '</span></legend>' . "\n";
$html .= '<label for="' . $this->plugin_id . $this->id . '_' . $key . '">';
$value = ( isset( $this->settings[ $key ] ) ) ? esc_attr( $this->settings[ $key ] ) : '';
$html .= '<input class="input-text wide-input '.$data['class'].'" type="password" name="' . $this->plugin_id . $this->id . '_' . $key . '" id="' . $this->plugin_id . $this->id . '_' . $key . '" style="'.$data['css'].'" value="' . $value . '" />';
if ( isset( $data['description'] ) && $data['description'] != '' ) { $html .= '<span class="description">' . $data['description'] . '</span>' . "\n"; }
@ -215,10 +217,11 @@ class WC_Settings_API {
$data['css'] = (isset( $data['css'] )) ? $data['css'] : '';
$html .= '<tr valign="top">' . "\n";
$html .= '<th scope="row" class="titledesc">' . $title . '</th>' . "\n";
$html .= '<th scope="row" class="titledesc">';
$html .= '<label for="' . $this->plugin_id . $this->id . '_' . $key . '">' . $title . '</label>';
$html .= '</th>' . "\n";
$html .= '<td class="forminp">' . "\n";
$html .= '<fieldset><legend class="screen-reader-text"><span>' . $title . '</span></legend>' . "\n";
$html .= '<label for="' . $this->plugin_id . $this->id . '_' . $key . '">';
$value = ( isset( $this->settings[ $key ] ) ) ? esc_attr( $this->settings[ $key ] ) : '';
$html .= '<textarea rows="3" cols="20" class="input-text wide-input '.$data['class'].'" name="' . $this->plugin_id . $this->id . '_' . $key . '" id="' . $this->plugin_id . $this->id . '_' . $key . '" style="'.$data['css'].'">'. $value .'</textarea>';
if ( isset( $data['description'] ) && $data['description'] != '' ) { $html .= '<span class="description">' . $data['description'] . '</span>' . "\n"; }
@ -272,10 +275,11 @@ class WC_Settings_API {
$data['css'] = (isset( $data['css'] )) ? $data['css'] : '';
$html .= '<tr valign="top">' . "\n";
$html .= '<th scope="row" class="titledesc">' . $title . '</th>' . "\n";
$html .= '<th scope="row" class="titledesc">';
$html .= '<label for="' . $this->plugin_id . $this->id . '_' . $key . '">' . $title . '</label>';
$html .= '</th>' . "\n";
$html .= '<td class="forminp">' . "\n";
$html .= '<fieldset><legend class="screen-reader-text"><span>' . $title . '</span></legend>' . "\n";
$html .= '<label for="' . $this->plugin_id . $this->id . '_' . $key . '">';
$html .= '<select name="' . $this->plugin_id . $this->id . '_' . $key . '" id="' . $this->plugin_id . $this->id . '_' . $key . '" style="'.$data['css'].'" class="select '.$data['class'].'">';
foreach ($data['options'] as $option_key => $option_value) :
@ -306,10 +310,11 @@ class WC_Settings_API {
$data['css'] = (isset( $data['css'] )) ? $data['css'] : '';
$html .= '<tr valign="top">' . "\n";
$html .= '<th scope="row" class="titledesc">' . $title . '</th>' . "\n";
$html .= '<th scope="row" class="titledesc">';
$html .= '<label for="' . $this->plugin_id . $this->id . '_' . $key . '">' . $title . '</label>';
$html .= '</th>' . "\n";
$html .= '<td class="forminp">' . "\n";
$html .= '<fieldset><legend class="screen-reader-text"><span>' . $title . '</span></legend>' . "\n";
$html .= '<label for="' . $this->plugin_id . $this->id . '_' . $key . '">';
$html .= '<select multiple="multiple" style="'.$data['css'].'" class="multiselect '.$data['class'].'" name="' . $this->plugin_id . $this->id . '_' . $key . '[]" id="' . $this->plugin_id . $this->id . '_' . $key . '">';
foreach ($data['options'] as $option_key => $option_value) :

View File

@ -19,8 +19,8 @@ class WC_Tax {
if (!is_array($this->parsed_rates)) :
global $woocommerce;
$tax_rates = (array) get_option('woocommerce_tax_rates');
$local_tax_rates = (array) get_option('woocommerce_local_tax_rates');
$tax_rates = array_filter( (array) get_option('woocommerce_tax_rates') );
$local_tax_rates = array_filter( (array) get_option('woocommerce_local_tax_rates') );
$parsed_rates = array();
$flat_rates = array();

View File

@ -113,7 +113,7 @@ class WC_Validation {
$postcode = trim(preg_replace('/[\s]/', '', $postcode));
if ( in_array( $country, array('GB', 'CA') ) ) :
$postcode = substr_replace( $postcode, ' ', -3, 0 );
$postcode = trim( substr_replace( $postcode, ' ', -3, 0 ) );
endif;
return $postcode;

View File

@ -44,7 +44,7 @@ class WC_COD extends WC_Payment_Gateway {
$this->form_fields = array(
'enabled' => array(
'title' => __( 'Enable COD', 'woocommerce' ),
'label' => __( 'Turn on Cash on Delivery for WooCommerce', 'woocommerce' ),
'label' => __( 'Enable Cash on Delivery', 'woocommerce' ),
'type' => 'checkbox',
'description' => '',
'default' => 'no'

View File

@ -208,7 +208,7 @@ class WC_Paypal extends WC_Payment_Gateway {
'no_note' => 1,
'currency_code' => get_woocommerce_currency(),
'charset' => 'UTF-8',
'rm' => 2,
'rm' => is_ssl() ? 2 : 1,
'upload' => 1,
'return' => $this->get_return_url( $order ),
'cancel_return' => $order->get_cancel_order_url(),
@ -234,6 +234,7 @@ class WC_Paypal extends WC_Payment_Gateway {
// Payment Info
'invoice' => $order->order_key
),
$phone_args
);
@ -258,7 +259,7 @@ class WC_Paypal extends WC_Payment_Gateway {
$paypal_args['no_shipping'] = 1;
}
// If prices include tax or have order discounts, send the whole order
// If prices include tax or have order discounts, send the whole order as a single item
if ( get_option('woocommerce_prices_include_tax')=='yes' || $order->get_order_discount() > 0 ) :
// Discount
@ -273,14 +274,16 @@ class WC_Paypal extends WC_Payment_Gateway {
$paypal_args['item_name_1'] = sprintf( __('Order %s' , 'woocommerce'), $order->get_order_number() ) . " - " . implode(', ', $item_names);
$paypal_args['quantity_1'] = 1;
$paypal_args['amount_1'] = number_format($order->get_order_total() - $order->get_shipping() + $order->get_order_discount(), 2, '.', '');
$paypal_args['amount_1'] = number_format($order->get_order_total() - $order->get_shipping() - $order->get_shipping_tax() + $order->get_order_discount(), 2, '.', '');
// Shipping Cost
if ($order->get_shipping()>0) :
$paypal_args['shipping_1'] = number_format( $order->get_shipping() + $order->get_shipping_tax() , 2, '.', '' );
/*if ( $order->get_shipping() > 0 ) :
$paypal_args['item_name_2'] = __('Shipping via', 'woocommerce') . ' ' . ucwords($order->shipping_method_title);
$paypal_args['quantity_2'] = '1';
$paypal_args['amount_2'] = number_format($order->get_shipping(), 2, '.', '');
endif;
endif;*/
else :
@ -311,7 +314,7 @@ class WC_Paypal extends WC_Payment_Gateway {
endif;
endforeach; endif;
// Shipping Cost
// Shipping Cost item - paypal only allows shipping per item, we want to send shipping for the order
if ($order->get_shipping()>0) :
$item_loop++;
$paypal_args['item_name_'.$item_loop] = __('Shipping via', 'woocommerce') . ucwords($order->shipping_method_title);

View File

@ -0,0 +1,38 @@
<?php
/**
* WooCommerce Integration class
*
* Extended by individual integrations to offer additional functionality.
*
* @class WC_Integration
* @package WooCommerce
* @category Integrations
* @author WooThemes
*/
class WC_Integration extends WC_Settings_API {
/**
* Admin Options
*
* Setup the gateway settings screen.
* Override this in your gateway.
*
* @since 1.0.0
*/
function admin_options() { ?>
<h3><?php echo isset( $this->method_title ) ? $this->method_title : __( 'Settings', 'woocommerce' ) ; ?></h3>
<?php echo isset( $this->method_description ) ? wpautop( $this->method_description ) : ''; ?>
<table class="form-table">
<?php $this->generate_settings_html(); ?>
</table>
<!-- Section -->
<div><input type="hidden" name="section" value="<?php echo $this->id; ?>" /></div>
<?php
}
}

View File

@ -0,0 +1,42 @@
<?php
/**
* WooCommerce Integrations class
*
* Loads Integrations into WooCommerce.
*
* @class WC_Integrations
* @package WooCommerce
* @category Integrations
* @author WooThemes
*/
class WC_Integrations {
var $integrations = array();
/**
* init function.
*
* @access public
*/
function init() {
do_action('woocommerce_integrations_init');
$load_integrations = apply_filters('woocommerce_integrations', array() );
// Load integration classes
foreach ( $load_integrations as $integration ) {
$load_integration = new $integration();
$this->integrations[$load_integration->id] = $load_integration;
}
}
function get_integrations() {
return $this->integrations;
}
}

View File

@ -0,0 +1,204 @@
<?php
/**
* Google Analytics Integration
*
* Allows tracking code to be inserted into store pages.
*
* @class WC_Google_Analytics
* @package WooCommerce
* @category Integrations
* @author WooThemes
*/
class WC_Google_Analytics extends WC_Integration {
public function __construct() {
$this->id = 'google_analytics';
$this->method_title = __( 'Google Analytics', 'woocommerce' );
$this->method_description = __( 'Google Analytics is a free service offered by Google that generates detailed statistics about the visitors to a website.', 'woocommerce' );
// Load the form fields.
$this->init_form_fields();
// Load the settings.
$this->init_settings();
// Define user set variables
$this->ga_id = $this->settings['ga_id'];
$this->ga_standard_tracking_enabled = $this->settings['ga_standard_tracking_enabled'];
$this->ga_ecommerce_tracking_enabled = $this->settings['ga_ecommerce_tracking_enabled'];
// Actions
add_action( 'woocommerce_update_options_integration_google_analytics', array( &$this, 'process_admin_options') );
// Tracking code
add_action( 'wp_footer', array( &$this, 'google_tracking_code' ) );
add_action( 'woocommerce_thankyou', array( &$this, 'ecommerce_tracking_code' ) );
}
/**
* Initialise Settings Form Fields
*/
function init_form_fields() {
$this->form_fields = array(
'ga_id' => array(
'title' => __('Google Analytics ID', 'woocommerce'),
'description' => __('Log into your google analytics account to find your ID. e.g. <code>UA-XXXXX-X</code>', 'woocommerce'),
'type' => 'text',
'default' => get_option('woocommerce_ga_id')
),
'ga_standard_tracking_enabled' => array(
'title' => __('Tracking code', 'woocommerce'),
'label' => __('Add tracking code to your site\'s footer. You don\'t need to enable this if using a 3rd party analytics plugin.', 'woocommerce'),
'type' => 'checkbox',
'checkboxgroup' => 'start',
'default' => get_option('woocommerce_ga_standard_tracking_enabled') ? get_option('woocommerce_ga_standard_tracking_enabled') : 'no'
),
'ga_ecommerce_tracking_enabled' => array(
'label' => __('Add eCommerce tracking code to the thankyou page', 'woocommerce'),
'type' => 'checkbox',
'checkboxgroup' => 'end',
'default' => get_option('woocommerce_ga_ecommerce_tracking_enabled') ? get_option('woocommerce_ga_ecommerce_tracking_enabled') : 'no'
)
);
/**
* Google Analytics standard tracking
**/
function google_tracking_code() {
global $woocommerce;
if ( is_admin() || current_user_can('manage_options') || get_option('woocommerce_ga_standard_tracking_enabled') == "no" ) return;
$tracking_id = get_option('woocommerce_ga_id');
if ( ! $tracking_id ) return;
$loggedin = ( is_user_logged_in() ) ? 'yes' : 'no';
if ( is_user_logged_in() ) {
$user_id = get_current_user_id();
$current_user = get_user_by('id', $user_id);
$username = $current_user->user_login;
} else {
$user_id = '';
$username = __('Guest', 'woocommerce');
}
?>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(
['_setAccount', '<?php echo $tracking_id; ?>'],
['_setCustomVar', 1, 'logged-in', '<?php echo $loggedin; ?>', 1],
['_setCustomVar', 2, 'user-id', '<?php echo $user_id; ?>', 1],
['_setCustomVar', 3, 'username', '<?php echo $username; ?>', 1],
['_trackPageview']
);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<?php
}
/**
* Google Analytics eCommerce tracking
**/
function ecommerce_tracking_code( $order_id ) {
global $woocommerce;
if ( is_admin() || current_user_can('manage_options') || get_option('woocommerce_ga_ecommerce_tracking_enabled') == "no" ) return;
$tracking_id = get_option('woocommerce_ga_id');
if ( ! $tracking_id ) return;
// Doing eCommerce tracking so unhook standard tracking from the footer
remove_action('wp_footer', 'woocommerce_google_tracking');
// Get the order and output tracking code
$order = new WC_Order($order_id);
$loggedin = (is_user_logged_in()) ? 'yes' : 'no';
if (is_user_logged_in()) {
$user_id = get_current_user_id();
$current_user = get_user_by('id', $user_id);
$username = $current_user->user_login;
} else {
$user_id = '';
$username = __('Guest', 'woocommerce');
}
?>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(
['_setAccount', '<?php echo $tracking_id; ?>'],
['_setCustomVar', 1, 'logged-in', '<?php echo $loggedin; ?>', 1],
['_setCustomVar', 2, 'user-id', '<?php echo $user_id; ?>', 1],
['_setCustomVar', 3, 'username', '<?php echo $username; ?>', 1],
['_trackPageview']
);
_gaq.push(['_addTrans',
'<?php echo $order_id; ?>', // order ID - required
'<?php bloginfo('name'); ?>', // affiliation or store name
'<?php echo $order->order_total; ?>', // total - required
'<?php echo $order->get_total_tax(); ?>', // tax
'<?php echo $order->get_shipping(); ?>', // shipping
'<?php echo $order->billing_city; ?>', // city
'<?php echo $order->billing_state; ?>', // state or province
'<?php echo $order->billing_country; ?>' // country
]);
// Order items
<?php if ($order->get_items()) foreach($order->get_items() as $item) : $_product = $order->get_product_from_item( $item ); ?>
_gaq.push(['_addItem',
'<?php echo $order_id; ?>', // order ID - required
'<?php if (!empty($_product->sku))
echo __('SKU:', 'woocommerce') . ' ' . $_product->sku;
else
echo $_product->id;
?>', // SKU/code - required
'<?php echo $item['name']; ?>', // product name
'<?php if (isset($_product->variation_data)){
echo woocommerce_get_formatted_variation( $_product->variation_data, true );
} else {
$out = array();
$categories = get_the_terms($_product->id, 'product_cat');
foreach ( $categories as $category ){
$out[] = $category->name;
}
echo join( "/", $out);
}
?>', // category or variation
'<?php echo ($item['line_total']/$item['qty']); ?>', // unit price - required
'<?php echo $item['qty']; ?>' // quantity - required
]);
<?php endforeach; ?>
_gaq.push(['_trackTrans']); // submits transaction to the Analytics servers
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<?php
}
} // End init_form_fields()
}
/**
* Add the integration to WooCommerce
**/
function add_google_analytics_integration( $integrations ) {
$integrations[] = 'WC_Google_Analytics'; return $integrations;
}
add_filter('woocommerce_integrations', 'add_google_analytics_integration' );

View File

@ -0,0 +1,76 @@
<?php
/**
* ShareDaddy Integration
*
* Enables ShareDaddy integration.
*
* @class WC_ShareThis
* @package WooCommerce
* @category Integrations
* @author WooThemes
*/
class WC_ShareDaddy extends WC_Integration {
public function __construct() {
$this->id = 'sharedaddy';
$this->method_title = __( 'ShareDaddy', 'woocommerce' );
$this->method_description = __( 'ShareDaddy is a sharing plugin bundled with JetPack.', 'woocommerce' );
// Load the form fields.
$this->init_form_fields();
// Load the settings.
$this->init_settings();
// Define user set variables
$this->enabled = $this->settings['enabled'];
// Actions
add_action( 'woocommerce_update_options_integration_sharedaddy', array( &$this, 'process_admin_options') );
// Share widget
add_action( 'woocommerce_share', array( &$this, 'sharedaddy_code') );
}
/**
* Initialise Settings Form Fields
*/
function init_form_fields() {
$this->form_fields = array(
'enabled' => array(
'title' => __( 'Output ShareDaddy button?', 'woocommerce' ),
'description' => __( 'Enable this option to show the ShareDaddy button on the product page.', 'woocommerce' ),
'type' => 'checkbox',
'default' => get_option('woocommerce_sharedaddy') ? get_option('woocommerce_sharedaddy') : 'no'
)
);
} // End init_form_fields()
/**
* sharedaddy_code function.
*
*/
function sharedaddy_code() {
global $post;
if ( $this->enabled == 'yes' && function_exists('sharing_display') ) {
?><div class="social"><?php echo sharing_display(); ?></div><?php
}
}
}
/**
* Add the integration to WooCommerce
**/
function add_sharedaddy_integration( $integrations ) {
if ( class_exists('jetpack') )
$integrations[] = 'WC_ShareDaddy';
return $integrations;
}
add_filter('woocommerce_integrations', 'add_sharedaddy_integration' );

View File

@ -0,0 +1,95 @@
<?php
/**
* ShareThis Integration
*
* Enables ShareThis integration.
*
* @class WC_ShareThis
* @package WooCommerce
* @category Integrations
* @author WooThemes
*/
class WC_ShareThis extends WC_Integration {
var $default_code;
public function __construct() {
$this->id = 'sharethis';
$this->method_title = __( 'ShareThis', 'woocommerce' );
$this->method_description = __( 'ShareThis offers a sharing widget which will allow customers to share links to products with their friends.', 'woocommerce' );
$this->default_code = '<div class="social">
<iframe src="https://www.facebook.com/plugins/like.php?href={permalink}&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>
<span class="st_twitter"></span><span class="st_email"></span><span class="st_sharethis"></span><span class="st_plusone_button"></span>
</div>';
// Load the form fields.
$this->init_form_fields();
// Load the settings.
$this->init_settings();
// Define user set variables
$this->publisher_id = $this->settings['publisher_id'];
$this->sharethis_code = $this->settings['sharethis_code'];
if ( ! $this->sharethis_code ) $this->sharethis_code = $this->default_code;
// Actions
add_action( 'woocommerce_update_options_integration_sharethis', array( &$this, 'process_admin_options') );
// Share widget
add_action( 'woocommerce_share', array( &$this, 'sharethis_code') );
}
/**
* Initialise Settings Form Fields
*/
function init_form_fields() {
$this->form_fields = array(
'publisher_id' => array(
'title' => __( 'ShareThis Publisher ID', 'woocommerce' ),
'description' => sprintf( __( 'Enter your %1$sShareThis publisher ID%2$s to show social sharing buttons on product pages.', 'woocommerce' ), '<a href="http://sharethis.com/account/">', '</a>' ),
'type' => 'text',
'default' => get_option('woocommerce_sharethis')
),
'sharethis_code' => array(
'title' => __( 'ShareThis Code', 'woocommerce' ),
'description' => __( 'You can tweak the ShareThis code by editing this option.', 'woocommerce' ),
'type' => 'textarea',
'default' => $this->default_code
)
);
} // End init_form_fields()
/**
* sharethis_code function.
*
*/
function sharethis_code() {
global $post;
if ( $this->publisher_id ) {
$sharethis = ( is_ssl() ) ? 'https://ws.sharethis.com/button/buttons.js' : 'http://w.sharethis.com/button/buttons.js';
echo str_replace( '{permalink}', urlencode(get_permalink($post->ID)), $this->sharethis_code );
echo '<script type="text/javascript">var switchTo5x=true;</script><script type="text/javascript" src="' . $sharethis . '"></script>';
echo '<script type="text/javascript">stLight.options({publisher:"' . $this->publisher_id . '"});</script>';
}
}
}
/**
* Add the integration to WooCommerce
**/
function add_sharethis_integration( $integrations ) {
$integrations[] = 'WC_ShareThis'; return $integrations;
}
add_filter('woocommerce_integrations', 'add_sharethis_integration' );

View File

@ -0,0 +1,383 @@
<?php
require_once "sdk/class.shareyourcart-base.php";
class ShareYourCartWooCommerce extends ShareYourCartBase {
public $settings;
public $_plugin_name = "shareyourcart_woo_commerce";
public $_post_user_id = 1;
protected static $_VERSION = 1;
/**
* Constructor
* @param null
*/
function __construct( $settings ) {
$this->settings = $settings;
parent::__construct();
//if there is installed another plugin with a never version
//do not load this one further
if (!$this->canLoad()) return;
// Shortcodes
add_shortcode( 'shareyourcart', array(&$this, 'getButton') );
add_shortcode( 'shareyourcart_button', array(&$this, 'getButton') );
// Actions
add_action( 'init', array(&$this, 'init') );
add_action( 'wp', array(&$this, 'hook_buttons') );
add_action( 'wp_head', array(&$this, 'wp_head') );
}
function admin_settings_page() {
$this->checkSDKStatus(true);
}
/**
* processInit function.
*
* @access public
*/
public function init() {
if (isset($_REQUEST['action'])) {
switch ($_REQUEST['action']) {
case $this->_plugin_name:
$this->buttonCallback();
break;
case $this->_plugin_name . '_coupon':
$this->couponCallback();
break;
}
}
}
/**
* hook_buttons function.
*
* @access public
*/
public function hook_buttons() {
if ( $this->isSingleProduct() )
add_filter('woocommerce_product_description_heading', array(&$this, '_getProductButton'));
add_action('woocommerce_cart_coupon', array(&$this, '_getCartButton'));
}
public function wp_head() {
echo '<meta property="syc:client_id" content="' . $this->getClientId() . '" />';
}
public function _getProductButton( $title ) {
$title .= $this->getProductButton();
return $title;
}
public function _getCartButton() {
echo '<div id="shareyourcart_button">' . $this->getCartButton() . '</div>';
}
public function getSecretKey() {
return '2cfd496d-7812-44ba-91ce-e43c59f6c680';
}
public function isSingleProduct() {
return is_singular('product');
}
public function saveCoupon( $token, $coupon_code, $coupon_value, $coupon_type ) {
// Create coupon
$post_id = $this->_saveCouponPost($coupon_code);
// Set coupon meta
switch ($coupon_type) {
case 'amount':
$discount_type = 'fixed_product';
$free_shipping = 'no';
break;
case 'percent':
$discount_type = 'percent_product';
$free_shipping = 'no';
break;
case 'free_shipping':
$discount_type = 'fixed_product';
$coupon_value = 0;
$free_shipping = 'yes';
break;
default :
$discount_type = 'fixed_cart';
$free_shipping = 'no';
}
update_post_meta( $post_id, 'customer_email', array() );
update_post_meta( $post_id, 'minimum_amount', '' );
update_post_meta( $post_id, 'exclude_product_categories', array() );
update_post_meta( $post_id, 'product_categories', array() );
update_post_meta( $post_id, 'free_shipping', $free_shipping );
update_post_meta( $post_id, 'apply_before_tax', 'yes' );
update_post_meta( $post_id, 'expiry_date', '' );
update_post_meta( $post_id, 'usage_limit', 1 );
update_post_meta( $post_id, 'exclude_product_ids', '' );
update_post_meta( $post_id, 'product_ids', '' );
update_post_meta( $post_id, 'individual_use', 'yes' );
update_post_meta( $post_id, 'coupon_amount', $coupon_value );
update_post_meta( $post_id, 'discount_type', $discount_type );
// parent
parent::saveCoupon( $token, $coupon_code, $coupon_value, $coupon_type );
}
public function applyCoupon( $coupon_code ) {}
private function _saveCouponPost($coupon_code) {
$new_post = array(
'post_title' => $coupon_code,
'post_name' => ereg_replace("[^A-Za-z0-9]", "", $coupon_code),
'post_content' => '',
'post_status' => 'publish',
'comment_status'=> 'closed',
'ping_status' => 'closed',
'post_author' => $this->_post_user_id,
'post_type' => 'shop_coupon'
);
$post_id = wp_insert_post($new_post);
return $post_id;
}
public function getButtonCallbackURL() {
global $wp_query;
$callback_url = add_query_arg( 'action', $this->_plugin_name, trailingslashit( home_url() ) );
if ($this->isSingleProduct()) {
$callback_url .= '&p='. $wp_query->post->ID;
}
return $callback_url;
}
public function buttonCallback() {
//specify the parameters
$params = array(
'callback_url' => get_bloginfo('wpurl').'/?action='.$this->_plugin_name.'_coupon'.(isset($_REQUEST['p']) ? '&p='.$_REQUEST['p'] : '' ),
'success_url' => get_option('shopping_cart_url'),
'cancel_url' => get_option('shopping_cart_url'),
);
//there is no product set, thus send the products from the shopping cart
if (!isset($_REQUEST['p'])) {
if (empty($_SESSION['cart']))
exit("Cart is empty");
foreach ($_SESSION['cart'] as $cart_details) {
$params['cart'][] = $this->_getProductDetails($cart_details['product_id']);
}
}
else {
$params['cart'][] = $this->_getProductDetails($_GET['p']);
}
try
{
$this->startSession($params);
}
catch(Exception $e) {
//display the error to the user
echo $e->getMessage();
}
exit;
}
private function _getProductDetails($product_id) {
$product = new WC_Product($product_id);
ob_start();
$product->get_image();
$image = ob_get_clean();
return array(
"item_name" => $product->get_title(),
"item_description" => $product->post->post_content,
"item_url" => $product->post->guid,
"item_price" => $product->price,
"item_picture_url" => $image,
);
}
public function loadSessionData() {
return;
}
/**
*
* Get the plugin version.
* @return an integer
*
*/
protected function getPluginVersion() {
return self::$_VERSION;
}
/**
*
* Return the project's URL
*
*/
protected function getDomain() {
return get_bloginfo('url');
}
/**
*
* Return the admin's email
*
*/
protected function getAdminEmail() {
return get_settings('admin_email');
}
/**
*
* Set the field value
*
*/
public function setConfigValue($field, $value) {
$this->settings[$field] = $value;
update_option( 'woocommerce_shareyourcart_settings', $this->settings );
}
/**
*
* Get the field value
*
*/
protected function getConfigValue( $field ) {
switch ( $field ) {
case "clientId" :
return $this->settings['client_id'];
case "hide_on_checkout" :
return ( $this->settings['show_on_cart'] == 'yes' ) ? false : true;
case "hide_on_product" :
return ( $this->settings['show_on_product'] == 'yes' ) ? false : true;
case "appKey" :
return $this->settings['app_key'];
case "account_status" :
return 'active';
case "button_type" :
if ( $this->settings['button_style'] == 'image_button' ) return 2;
if ( $this->settings['button_style'] == 'custom_html' ) return 3;
return 1; // Standard
break;
default :
return ( isset( $this->settings[$field] ) ) ? $this->settings[$field] : '';
}
}
/**
*
* Execute the SQL statement
*
*/
protected function executeNonQuery($sql) {
if (substr($sql, 0, 12) == "CREATE TABLE") {
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
//if this is a create table command, use the special function which compares tables
dbDelta($sql);
} else {
global $wpdb;
//use the normal query
$wpdb->query($sql);
}
}
/**
*
* Get the row returned from the SQL
*
* @return an associative array containing the data of the row OR NULL
* if there is none
*/
protected function getRow($sql) {
global $wpdb;
//get the row as an associative array
return $wpdb->get_row($sql, ARRAY_A);
}
/**
*
* Get the table name based on the key
*
*/
protected function getTableName($key) {
global $wpdb;
return $wpdb->base_prefix . $key;
}
/**
*
* Insert the row into the specified table
*
*/
protected function insertRow($tableName, $data) {
global $wpdb;
$wpdb->insert($tableName, $data);
}
/**
*
* Create url for the specified file. The file must be specified in relative path
* to the base of the plugin
*/
protected function createUrl($file) {
//get the real file path
$file = realpath($file);
//calculate the relative path from this file
$file = SyC::relativepath(dirname(__FILE__), $file);
//append the relative path to the current file's URL
return WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__), "", plugin_basename(__FILE__)).$file;
}
/*
*
* Called when a new coupon is generated
*
*/
public function couponCallback() {
parent::couponCallback();
//since this is actually an API, exit
exit;
}
}

View File

@ -0,0 +1,391 @@
<?php
/**
* ShareYourCart Integration
*
* Enables ShareYourCart integration.
*
* @class WC_ShareYourCart
* @package WooCommerce
* @category Integrations
* @author WooThemes
*/
class WC_ShareYourCart extends WC_Integration {
var $ShareYourCartWooCommerce;
public function __construct() {
$this->id = 'shareyourcart';
$this->method_title = __( 'ShareYourCart', 'woocommerce' );
$this->method_description = sprintf( __( 'Increase your social media exposure by 10 percent! ShareYourCart helps you get more customers by motivating satisfied customers to talk with their friends about your products. For help with ShareYourCart view the <a href="%s">documentation</a>.', 'woocommerce' ), 'http://www.woothemes.com/woocommerce-docs/user-guide/shareyourcart/' );
// Load the form fields.
$this->init_form_fields();
// Load the settings.
$this->init_settings();
// Define user set variables
$this->enabled = $this->settings['enabled'];
$this->client_id = $this->settings['client_id'];
$this->app_key = $this->settings['app_key'];
$this->email = $this->settings['email'];
// Actions
add_action( 'woocommerce_update_options_integration_shareyourcart', array( &$this, 'process_admin_options') );
add_action( 'woocommerce_update_options_integration_shareyourcart', array( &$this, 'process_forms') );
// Actions if enabled
if ( $this->enabled == 'yes' ) {
add_action( 'wp_enqueue_scripts', array(&$this, 'styles') );
$this->init_share_your_cart();
}
}
/**
* styles function.
*
* @access public
* @return void
*/
public function styles() {
wp_enqueue_style( 'shareyourcart', plugins_url( 'css/style.css', __FILE__ ) );
}
/**
* init_share_your_cart function.
*
* @access public
* @return void
*/
function init_share_your_cart() {
if ( ! $this->shareYourCartWooCommerce ) {
// Share your cart api class
include_once('class-shareyourcart-woocommerce.php');
// Init the class
$this->shareYourCartWooCommerce = new ShareYourCartWooCommerce( $this->settings );
}
}
/**
* process_forms function.
*
* @access public
*/
function process_forms() {
if ( ! empty( $_REQUEST['syc-account'] ) && $_REQUEST['syc-account'] == 'create' ) {
$this->init_share_your_cart();
$error = $message = '';
$redirect = remove_query_arg( 'saved' );
$redirect = remove_query_arg( 'wc_error', $redirect );
$redirect = remove_query_arg( 'wc_message', $redirect );
if ( ! empty( $_POST['domain'] ) && ! empty( $_POST['email'] ) && ! empty( $_POST['syc-terms-agreement'] ) ) {
if ( ! ( ( $register = $this->shareYourCartWooCommerce->register( $this->shareYourCartWooCommerce->getSecretKey(), $_POST['domain'], $_POST['email'], $message ) ) === false) ) {
$this->shareYourCartWooCommerce->setConfigValue('app_key', $register['app_key']);
$this->shareYourCartWooCommerce->setConfigValue('client_id', $register['client_id']);
$redirect = remove_query_arg( 'syc-account', $redirect );
} else {
$error = $message;
if ( json_decode($error) ) {
$error = json_decode($error);
$error = $error->message;
}
$message = '';
}
} else {
$error = __( 'Please complete all fields.', 'woocommerce' );
}
if ( $error ) $redirect = add_query_arg( 'wc_error', urlencode( esc_attr( $error ) ), $redirect );
if ( $message ) $redirect = add_query_arg( 'wc_message', urlencode( esc_attr( $message ) ), $redirect );
wp_safe_redirect( $redirect );
exit;
} elseif ( ! empty( $_REQUEST['syc-account'] ) && $_REQUEST['syc-account'] == 'recover' ) {
$this->init_share_your_cart();
$error = $message = '';
$redirect = remove_query_arg( 'saved' );
$redirect = remove_query_arg( 'wc_error', $redirect );
$redirect = remove_query_arg( 'wc_message', $redirect );
if ( ! empty( $_POST['domain'] ) && ! empty( $_POST['email'] ) ) {
if ( ! $this->shareYourCartWooCommerce->recover( $this->shareYourCartWooCommerce->getSecretKey(), $_POST['domain'], $_POST['email'], $message ) ) {
$error = $message;
if ( json_decode($error) ) {
$error = json_decode($error);
$error = $error->message;
}
$message = '';
} else {
$redirect = remove_query_arg( 'syc-account', $redirect );
}
} else {
$error = __( 'Please complete all fields.', 'woocommerce' );
}
if ( $error ) $redirect = add_query_arg( 'wc_error', urlencode( esc_attr( $error ) ), $redirect );
if ( $message ) $redirect = add_query_arg( 'wc_message', urlencode( esc_attr( $message ) ), $redirect );
wp_safe_redirect( $redirect );
exit;
}
}
/**
* Admin Options
*
* Setup the gateway settings screen.
* Override this in your gateway.
*
* @since 1.0.0
*/
function admin_options() {
if ( $this->enabled == 'yes' ) {
// Installation
$this->shareYourCartWooCommerce->install();
// Check status
$this->shareYourCartWooCommerce->admin_settings_page();
}
?>
<?php
if ( ! $this->client_id && ! $this->app_key ) {
if ( ! empty( $_REQUEST['syc-account'] ) && $_REQUEST['syc-account'] == 'create' ) {
?>
<div class="updated">
<h3><?php _e('Create a ShareYourCart account', 'woocommerce') ?></h3>
<table class="form-table">
<tr>
<th><?php _e('Domain', 'woocommerce'); ?></th>
<td><input type="text" name="domain" id="domain" class="regular-text" value="<?php echo (isset($_POST['domain']) ? $_POST['domain'] : site_url()); ?>" /></td>
</tr>
<tr>
<th><?php _e('Email', 'woocommerce'); ?></th>
<td><input type="text" name="email" id="email" class="regular-text" value="<?php echo (isset($_POST['email']) ? $_POST['email'] : get_option('admin_email')); ?>"/></td>
</tr>
<tr>
<th>&nbsp;</th>
<td><input class="buttonCheckbox" name="syc-terms-agreement" id="syc-terms-agreement" type="checkbox" /> <label for="syc-terms-agreement"><?php printf(__('I agree to the <a href="%s">ShareYourCart terms and conditions</a>', 'woocommerce'), 'http://shareyourcart.com/terms'); ?></label></td>
</tr>
</table>
<p class="submit"><input type="submit" class="button button-primary" value="<?php _e('Create Account', 'woocommerce') ?>" /></p>
</div>
<?php
} elseif ( ! empty( $_REQUEST['syc-account'] ) && $_REQUEST['syc-account'] == 'recover' ) {
?>
<div class="updated">
<h3><?php _e('Recover your ShareYourCart account', 'woocommerce') ?></h3>
<table class="form-table">
<tr>
<th><?php _e('Domain', 'woocommerce'); ?></th>
<td><input type="text" name="domain" id="domain" class="regular-text" value="<?php echo (isset($_POST['domain']) ? $_POST['domain'] : site_url()); ?>" /></td>
</tr>
<tr>
<th><?php _e('Email', 'woocommerce'); ?></th>
<td><input type="text" name="email" id="email" class="regular-text" value="<?php echo (isset($_POST['email']) ? $_POST['email'] : get_option('admin_email')); ?>"/></td>
</tr>
</table>
<p class="submit"><input type="submit" class="button button-primary" value="<?php _e('Email me my details', 'woocommerce') ?>" /></p>
</div>
<?php
} else {
?>
<div id="wc_get_started">
<span class="main"><?php _e('Setup your ShareYourCart account', 'woocommerce'); ?></span>
<span><?php echo $this->method_description; ?></span>
<p><a href="<?php echo add_query_arg( 'syc-account', 'create', admin_url( 'admin.php?page=woocommerce&tab=integration&section=shareyourcart' ) ); ?>" class="button button-primary api-link"><?php _e('Create an account', 'woocommerce'); ?></a> <a href="<?php echo add_query_arg( 'syc-account', 'recover', admin_url( 'admin.php?page=woocommerce&tab=integration&section=shareyourcart' ) ); ?>" class="button api-link"><?php _e('Can\'t access your account?', 'woocommerce'); ?></a></p>
</div>
<?php
}
} else {
echo '<h3><a href="http://shareyourcart.com/"><img src="' . plugins_url( 'sdk/img/shareyourcart-logo.png', __FILE__ ) . '" alt="ShareYourCart" /></a></h3>';
echo wpautop( $this->method_description );
}
?>
<table class="form-table">
<?php $this->generate_settings_html(); ?>
<?php if ( $this->client_id && $this->app_key ) : ?>
<tr>
<th><?php _e('Configure ShareYourCart', 'woocommerce'); ?></th>
<td>
<p><?php _e('You can choose how much of a discount to give (in fixed amount, percentage, or free shipping) and to which social media channels it should it be applied. You can also define what the advertisement should say, so that it fully benefits your sales.', 'woocommerce'); ?></p>
<p><a href="http://www.shareyourcart.com/configure/?app_key=<?php echo $this->app_key; ?>&amp;client_id=<?php echo $this->client_id; ?>&amp;email=<?php echo $this->email; ?>" class="button" target="_blank"><?php _e('Configure', 'woocommerce'); ?></a></p>
</td>
</tr>
<?php endif; ?>
</table>
<script type="text/javascript">
jQuery('#woocommerce_shareyourcart_button_style').change(function(){
var value = jQuery(this).val();
if ( value == 'standard_button' ) {
jQuery('.standard_button').closest('tr').show();
jQuery('.image_button').closest('tr').hide();
jQuery('.custom_html').closest('tr').hide();
}
if ( value == 'image_button' ) {
jQuery('.standard_button').closest('tr').hide();
jQuery('.image_button').closest('tr').show();
jQuery('.custom_html').closest('tr').hide();
}
if ( value == 'custom_html' ) {
jQuery('.standard_button').closest('tr').hide();
jQuery('.image_button').closest('tr').hide();
jQuery('.custom_html').closest('tr').show();
}
}).change();
</script>
<!-- Section -->
<div><input type="hidden" name="section" value="<?php echo $this->id; ?>" /></div>
<?php
}
/**
* Initialise Settings Form Fields
*/
function init_form_fields() {
$this->form_fields = array(
'enabled' => array(
'title' => __( 'Enable/Disable', 'woocommerce' ),
'label' => __( 'Enable ShareYourCart integration', 'woocommerce' ),
'type' => 'checkbox',
'default' => 'no',
),
'client_id' => array(
'title' => __( 'Client ID', 'woocommerce' ),
'description' => __( 'Get your client ID by creating a ShareYourCart account.', 'woocommerce' ),
'type' => 'text',
'default' => '',
'css' => 'width: 300px'
),
'app_key' => array(
'title' => __( 'App Key', 'woocommerce' ),
'description' => __( 'Get your app key by creating a ShareYourCart account.', 'woocommerce' ),
'type' => 'text',
'default' => '',
'css' => 'width: 300px'
),
'email' => array(
'title' => __( 'Email address', 'woocommerce' ),
'description' => __( 'The email address you used to sign up for ShareYourCart.', 'woocommerce' ),
'type' => 'text',
'default' => get_option('admin_email'),
'css' => 'width: 300px'
),
'show_on_product' => array(
'title' => __( 'Show button by default on:', 'woocommerce' ),
'label' => __( 'Product page', 'woocommerce' ),
'type' => 'checkbox',
'default' => 'yes',
),
'show_on_cart' => array(
'label' => __( 'Cart page', 'woocommerce' ),
'type' => 'checkbox',
'default' => 'yes',
),
'button_style' => array(
'title' => __( 'Button style', 'woocommerce' ),
'description' => __( 'Select a style for your share buttons', 'woocommerce' ),
'default' => 'standard_button',
'type' => 'select',
'options' => array(
'standard_button' => __( 'Standard Button', 'woocommerce' ),
'custom_html' => __( 'Custom HTML', 'woocommerce' )
)
),
'button_skin' => array(
'title' => __( 'Button skin', 'woocommerce' ),
'description' => __( 'Select a skin for your share buttons', 'woocommerce' ),
'default' => 'orange',
'type' => 'select',
'options' => array(
'orange' => __( 'Orange', 'woocommerce' ),
'blue' => __( 'Blue', 'woocommerce' ),
'light' => __( 'Light', 'woocommerce' ),
'dark' => __( 'Dark', 'woocommerce' )
),
'class' => 'standard_button'
),
'button_position' => array(
'title' => __( 'Button position', 'woocommerce' ),
'description' => __( 'Where should the button be positioned?', 'woocommerce' ),
'default' => 'normal',
'type' => 'select',
'options' => array(
'normal' => __( 'Normal', 'woocommerce' ),
'floating' => __( 'Floating', 'woocommerce' )
),
'class' => 'standard_button'
),
'button_html' => array(
'title' => __( 'HTML for the button', 'woocommerce' ),
'description' => __( 'Enter the HTML code for your custom button.', 'woocommerce' ),
'default' => '<button>Get a <div class="shareyourcart-discount"></div> discount</button>',
'type' => 'textarea',
'class' => 'custom_html'
)
);
} // End init_form_fields()
}
/**
* Add the integration to WooCommerce
**/
function add_shareyourcart_integration( $integrations ) {
if ( ! class_exists('ShareYourCartAPI') ) // Only allow this integration if we're not already using shareyourcart via another plugin
$integrations[] = 'WC_ShareYourCart';
return $integrations;
}
add_filter('woocommerce_integrations', 'add_shareyourcart_integration' );

View File

@ -0,0 +1,24 @@
.button_iframe iframe {
width: 58px;
height: 230px;
position: fixed;
top:360px;
right:0px;
}
.button_iframe-normal iframe {
float:right;
height: 58px;
width: 230px;
position:relative;
z-index:1000;
}
.button_iframe-normal.button_height {
height: 60px;
}
#shareyourcart_button {
margin: .5em 0 0;
overflow: hidden;
}

View File

@ -0,0 +1,479 @@
<?php
/**
* CLASS: Share Your Cart API
* AUTHOR: Barandi Solutions
* COUNTRY: Romania
* EMAIL: catalin.paun@barandisolutions.ro
* VERSION : 1.0
* DESCRIPTION: This class is used as a wrapper to communicate to the ShareYourCart API.
* * Copyright (C) 2011 Barandi Solutions
*/
if(!class_exists('ShareYourCartAPI',false)){
class ShareYourCartAPI {
protected $SHAREYOURCART_URL = "www.shareyourcart.com";
protected $SHAREYOURCART_SANDBOX_URL = "sandbox.shareyourcart.com";
protected $SHAREYOURCART_API;
protected $SHAREYOURCART_API_REGISTER;
protected $SHAREYOURCART_API_RECOVER;
protected $SHAREYOURCART_API_ACTIVATE;
protected $SHAREYOURCART_API_DEACTIVATE;
protected $SHAREYOURCART_API_CREATE;
protected $SHAREYOURCART_API_VALIDATE;
protected $SHAREYOURCART_API_STATUS;
protected $SHAREYOURCART_CONFIGURE;
protected $SHAREYOURCART_BUTTON_JS;
protected $SHAREYOURCART_BUTTON_URL;
/**
* Constructor
* @param null
*/
function __construct() {
$is_live = true;
//check if the current object has a secret key function
//this is for backward compatibility
if(method_exists ($this,'getSecretKey')){
$secretKey = $this->getSecretKey();
if(empty($secretKey)){
throw new Exception("You must specify a valid secret key");
}
//check if the secret key is a sandbox one
if(strpos($secretKey,"sndbx_") === 0){
$this->SHAREYOURCART_URL = $this->SHAREYOURCART_SANDBOX_URL;
$is_live = false;
}
}
$this->SHAREYOURCART_API = (isset($_SERVER['HTTPS']) && !strcasecmp($_SERVER['HTTPS'],'on') ? 'https://' : 'http://') . $this->SHAREYOURCART_URL;
$this->SHAREYOURCART_REGISTER = $this->SHAREYOURCART_API.'/account/create';
$this->SHAREYOURCART_API_REGISTER = $this->SHAREYOURCART_API.'/account/create';
$this->SHAREYOURCART_API_RECOVER = $this->SHAREYOURCART_API.'/account/recover';
$this->SHAREYOURCART_API_ACTIVATE = $this->SHAREYOURCART_API.'/account/activate';
$this->SHAREYOURCART_API_DEACTIVATE = $this->SHAREYOURCART_API.'/account/deactivate';
$this->SHAREYOURCART_API_CREATE = $this->SHAREYOURCART_API.'/session/create';
$this->SHAREYOURCART_API_VALIDATE = $this->SHAREYOURCART_API.'/session/validate';
$this->SHAREYOURCART_API_STATUS = $this->SHAREYOURCART_API.'/sdk';
$this->SHAREYOURCART_CONFIGURE = $this->SHAREYOURCART_API.'/configure';
$this->SHAREYOURCART_BUTTON_JS = $this->SHAREYOURCART_API.'/js/'.($is_live ? 'button.js' : 'button_sandbox.js');
$this->SHAREYOURCART_BUTTON_URL = $this->SHAREYOURCART_API.'/button';
}
/**
* startSession
* @param array $params
* @return array $data
*/
public function startSession($params) {
//make sure the session is started
if(session_id() == '')
session_start();
$session = curl_init($this->SHAREYOURCART_API_CREATE);
// Tell curl to use HTTP POST
curl_setopt($session, CURLOPT_POST, true);
// Tell curl that this is the body of the POST
curl_setopt($session, CURLOPT_POSTFIELDS, http_build_query($params,'','&'));
// Tell curl not to return headers, but do return the response
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($session);
$httpCode = curl_getinfo($session, CURLINFO_HTTP_CODE);
curl_close($session);
// If the operation was not succesfull, print the error
if($httpCode != 200)
throw new Exception($response);
// Decode the result
$results = json_decode($response, true);
// Find the token
if(isset($results['token'])) {
// Link the token with the current cart ( held in session id )
$data = array(
'token' => $results['token'],
'session_id' => session_id(),
);
// A token was obtained, so redirect the browser
header("Location: $results[session_url]", true, 302);
return $data;
}
//show the raw response received ( for debug purposes )
throw new Exception($response);
}
/**
* make sure the coupon is valid
* @param null
*/
public function assertCouponIsValid($token, $coupon_code, $coupon_value, $coupon_type) {
// Verifies POST information
if(!isset($token, $coupon_code, $coupon_value, $coupon_type)) {
throw new Exception(SyC::t('sdk',"At least one of the parameters is missing."));
}
// Urlencode and concatenate the POST arguments
$params = array(
'token' => $token,
'coupon_code' => $coupon_code,
'coupon_value' => $coupon_value,
'coupon_type'=> $coupon_type,
);
// Make the API call
$session = curl_init($this->SHAREYOURCART_API_VALIDATE);
// Tell curl to use HTTP POST
curl_setopt($session, CURLOPT_POST, true);
// Tell curl that this is the body of the POST
curl_setopt($session, CURLOPT_POSTFIELDS, http_build_query($params,'','&'));
// Tell curl not to return headers, but do return the response
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($session);
$httpCode = curl_getinfo($session, CURLINFO_HTTP_CODE);
curl_close($session);
//if the operation was not succesfull, print the error
if($httpCode != 200)
throw new Exception(SyC::t('sdk',"Coupon Invalid: {coupon}", array('{coupon}' => $response)));
$results = json_decode($response, true);
//if the result is not valid, print it
if(!isset($results['valid']) || !($results['valid'] === true))
throw new Exception(SyC::t('sdk',"Coupon Invalid: {coupon}", array('{coupon}' => $response)));
}
/**
* register
* @param string $secretKey
* @param string $domain
* @param string $email
* @param string $message
* @return array json_decode
*/
public function register($secretKey, $domain, $email, &$message = null) {
// Urlencode and concatenate the POST arguments
$params = array(
'secret_key' => $secretKey,
'domain' => $domain,
'email' => $email,
);
// Make the API call
$session = curl_init($this->SHAREYOURCART_API_REGISTER);
// Tell curl to use HTTP POST
curl_setopt($session, CURLOPT_POST, true);
// Tell curl that this is the body of the POST
curl_setopt($session, CURLOPT_POSTFIELDS, http_build_query($params,'','&'));
// Tell curl not to return headers, but do return the response
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($session);
$httpCode = curl_getinfo($session, CURLINFO_HTTP_CODE);
curl_close($session);
// If the operation was not succesfull, return FALSE
if($httpCode != 200) {
if(isset($message)) $message = $response;
return false;
}
//if the caller is expecting a message
//let him know what happened
if(isset($message)){
$message = SyC::t('sdk','The account has been registered');
}
// Return the response after decoding it
return json_decode($response, true);
}
/**
* recover
* @param string $secretKey
* @param string $domain
* @param string $email
* @param string $message
* @return boolean
*/
public function recover($secretKey, $domain, $email, &$message = null) {
// Urlencode and concatenate the POST arguments
$params = array(
'secret_key' => $secretKey,
'domain' => $domain,
'email' => $email,
);
// Make the API call
$session = curl_init($this->SHAREYOURCART_API_RECOVER);
// Tell curl to use HTTP POST
curl_setopt($session, CURLOPT_POST, true);
// Tell curl that this is the body of the POST
curl_setopt($session, CURLOPT_POSTFIELDS, http_build_query($params,'','&'));
// Tell curl not to return headers, but do return the response
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($session);
$httpCode = curl_getinfo($session, CURLINFO_HTTP_CODE);
curl_close($session);
//if the operation was not succesfull, return FALSE
if($httpCode != 200) {
if(isset($message)) $message = $response;
return false;
}
//if the caller is expecting a message
//let him know what happened
if(isset($message)){
$message = (!empty($response) ? $response : SyC::t('sdk',"An email has been sent with your credentials at {email}",array('{email}' => $email)));
}
return true;
}
/**
* setAccountStatus
* @param string $secretKey
* @param string $clientId
* @param string $appKey
* @param string $activate
* @param string $message
* @return boolean
*/
public function setAccountStatus($secretKey, $clientId, $appKey, $activate = true, &$message = null) {
// Urlencode and concatenate the POST arguments
$params = array(
'secret_key' => $secretKey,
'client_id' => $clientId,
'app_key' => $appKey,
);
//make the API call
$session = curl_init($activate ? $this->SHAREYOURCART_API_ACTIVATE : $this->SHAREYOURCART_API_DEACTIVATE);
// Tell curl to use HTTP POST
curl_setopt($session, CURLOPT_POST, true);
// Tell curl that this is the body of the POST
curl_setopt($session, CURLOPT_POSTFIELDS, http_build_query($params,'','&'));
// Tell curl not to return headers, but do return the response
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($session);
$httpCode = curl_getinfo($session, CURLINFO_HTTP_CODE);
curl_close($session);
// Notify the caller
if($httpCode != 200) {
if(isset($message)) $message = $response;
return false;
}
//if the caller is expecting a message
//let him know what happened
if(isset($message)){
$message = (!empty($response) ? $response : ($activate ? SyC::t('sdk','The account has been enabled') : SyC::t('sdk','The account has been disabled')));
}
return true;
}
/**
* setAccountStatus
* @param string $secretKey
* @param string $clientId
* @param string $appKey
* @param string $message
* @return array or FALSE
*/
public function getSDKStatus($secretKey=null, $clientId=null, $appKey=null, &$message = null)
{
$params = array();
if(isset($secretKey)) $params['secret_key'] = $secretKey;
if(isset($clientId)) $params['client_id'] = $clientId;
if(isset($appKey)) $params['app_key'] = $appKey;
//make the API call
$session = curl_init($this->SHAREYOURCART_API_STATUS);
// Tell curl to use HTTP POST
curl_setopt($session, CURLOPT_POST, true);
// Tell curl that this is the body of the POST
curl_setopt($session, CURLOPT_POSTFIELDS, http_build_query($params,'','&'));
// Tell curl not to return headers, but do return the response
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($session);
$httpCode = curl_getinfo($session, CURLINFO_HTTP_CODE);
curl_close($session);
// Notify the caller
if($httpCode != 200) {
if(isset($message)) $message = $response;
return false;
}
// Decode the result
return json_decode($response, true);
}
}
/**
*
* This class should contain all the static methods in the SDK
*
*/
class SyC
{
static $_messages;
static $_language = 'en';
/**
*
* Change the language the SDK should be displayed in
*
*/
public static function setLanguage($newLanguage = null){
self::$_language = $newLanguage;
//reset the old messages, so that they are reloaded
self::$_messages = null;
}
/*
* Translate the specified message
*
*/
public static function t($category,$message,$params=array())
{
//load the translation from file if not done so
if(!isset(self::$_messages)){
//The language is the folder name, and the category is the name of the file
$messageFile = dirname(__FILE__).DIRECTORY_SEPARATOR.'messages'.DIRECTORY_SEPARATOR.self::$_language.DIRECTORY_SEPARATOR.$category.'.php';
if(is_file($messageFile))
{
self::$_messages=include($messageFile);
}
//make sure we have an array for this variable
if(!is_array(self::$_messages)) self::$_messages=array();
}
//check if the text has a valid translation
if(isset(self::$_messages[$message]) && !empty(self::$_messages[$message])){
$message = self::$_messages[$message];
}
//return the translated message, with the parameters replaced
return $params!==array() ? strtr($message,$params) : $message;
}
function relativepath($from, $to, $ps = '/' ,$ds = DIRECTORY_SEPARATOR)
{
$arFrom = explode($ds, rtrim($from, $ds));
$arTo = explode($ds, rtrim($to, $ds));
while(count($arFrom) && count($arTo) && ($arFrom[0] == $arTo[0]))
{
array_shift($arFrom);
array_shift($arTo);
}
return str_pad("", count($arFrom) * 3, '..'.$ps).implode($ps, $arTo);
}
/**
* rel2Abs
* @param string $src
* @return string
*/
function rel2Abs($rel, $base) {
/* return if already absolute URL */
if (parse_url($rel, PHP_URL_SCHEME) != '')
return $rel;
/* queries and anchors */
if ($rel[0] == '#' || $rel[0] == '?')
return $base . $rel;
/* parse base URL and convert to local variables:
$scheme, $host, $path */
extract(parse_url($base));
/* remove non-directory element from path */
$path = preg_replace('#/[^/]*$#', '', @$path);
/* destroy path if relative url points to root */
if ($rel[0] == '/')
$path = '';
/* dirty absolute URL */
$abs = "$host$path/$rel";
/* replace '//' or '/./' or '/foo/../' with '/' */
$re = array('#(/\.?/)#', '#/(?!\.\.)[^/]+/\.\./#');
for ($n = 1; $n > 0; $abs = preg_replace($re, '/', $abs, -1, $n)) {
}
/* absolute URL is ready! */
return $scheme . '://' . $abs;
}
/**
* htmlIndent
* @param string $src
* @return string
*/
function htmlIndent($src) {
//replace all leading spaces with &nbsp;
//Attention: this will render wrong html if you split a tag on more lines!
return preg_replace_callback('/(^|\n)( +)/', create_function('$match', 'return str_repeat("&nbsp;", strlen($match[0]));'
), $src);
}
}
} //END IF
?>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,406 @@
.shareyourcart-button-orange {
position: relative;
display: block;
padding: 15px 20px !important;
text-align: center !important;
border: 1px solid #a15400;
width: 170px;
color: #623505 !important;
font-size: 16px !important;
font-weight: bold;
text-shadow: 0 1px 1px #ffce97 !important;
background-color: #fcc436 !important;
background-image: -moz-linear-gradient(top, #fcc436, #ff7a01) !important;
background-image: -o-linear-gradient(top, #fcc436, #ff7a01) !important;
background-image: -webkit-gradient(linear, left top, left bottom, from(#fcc436), to(#ff7a01)) !important;
background-image: linear-gradient(top, #fcc436, #ff7a01) !important;
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#fcc436', EndColorStr='#ff7a01') !important;
border-radius: 10px !important;
-moz-border-radius: 10px !important;
-webkit-border-radius: 10px !important;
box-shadow: 0 2px 2px #bfc7cb, inset 0 1px 0px #fee6a9;
-moz-box-shadow: 0 2px 2px #bfc7cb, inset 0 1px 0px #fee6a9;
-webkit-box-shadow: 0 2px 2px #bfc7cb, inset 0 1px 0px #fee6a9;
text-decoration: none;
}
.shareyourcart-button-blue {
position: relative;
display: block;
padding: 15px 20px !important;
text-align: center !important;
border: 1px solid #688da9;
width: 170px;
color: #005fa9 !important;
font-size: 16px !important;
font-weight: bold;
text-shadow: 0 1px 1px #fcfdfe !important;
background-color: #cde5f5 !important;
background-image: -moz-linear-gradient(top, #ebf5fb, #b3d8ef) !important;
background-image: -o-linear-gradient(top, #ebf5fb, #b3d8ef) !important;
background-image: -webkit-gradient(linear, left top, left bottom, from(#ebf5fb), to(#b3d8ef)) !important;
background-image: -webkit-linear-gradient(top, #ebf5fb, #b3d8ef) !important;
background-image: linear-gradient(top, #ebf5fb, #b3d8ef) !important;
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#ebf5fb', EndColorStr='#b3d8ef');
border-radius: 10px !important;
-moz-border-radius: 10px !important;
-webkit-border-radius: 10px !important;
box-shadow: 0 2px 2px #fcfdfe, inset 0 1px 0px #fcfdfe;
-moz-box-shadow: 0 2px 2px #fcfdfe, inset 0 1px 0px #fcfdfe;
-webkit-box-shadow: inset 0 1px 0px #fcfdfe;
text-decoration: none;
}
.shareyourcart-button-orange:hover
{
background-color: #fff449 !important;
background-image: -moz-linear-gradient(top, #fff449, #ff9c01) !important;
background-image: -o-linear-gradient(top, #fff449, #ff9c01) !important;
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff449), to(#ff9c01)) !important;
background-image: -webkit-linear-gradient(top, #fff449, #ff9c01) !important;
background-image: linear-gradient(top, #fff449, #ff9c01) !important;
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#fff449', EndColorStr='#ff9c01');
text-shadow: 0 1px 1px #fff !important;
cursor:pointer;
}
.shareyourcart-button-blue:hover
{
background-color: #fff449;
background-image: -moz-linear-gradient(top, #f4fbff, #d1e6ef) !important;
background-image: -o-linear-gradient(top, #f4fbff, #d1e6ef) !important;
background-image: -webkit-gradient(linear, left top, left bottom, from(#f4fbff), to(#d1e6ef)) !important;
background-image: -webkit-linear-gradient(top, #f4fbff, #d1e6ef) !important;
background-image: linear-gradient(top, #f4fbff, #d1e6ef) !important;
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#f4fbff', EndColorStr='#d1e6ef') !important;
text-shadow: 0 1px 1px #fff;
cursor:pointer;
}
.shareyourcart-button-blue:hover, .shareyourcart-button-blue:visited{
color: #005fa9;
}
.shareyourcart-button-orange:active {
background-image: -moz-linear-gradient(top, #ff7a01, #fcc436);
background-image: -o-linear-gradient(top, #ff7a01, #fcc436);
background-image: -webkit-gradient(linear, left top, left bottom, from(#ff7a01), to(#fcc436));
background-image: -webkit-linear-gradient(top, #ff7a01, #fcc436);
background-image: linear-gradient(top, #ff7a01, #fcc436);
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#ff7a01', EndColorStr='#fcc436');
box-shadow: 0 0 2px #888, inset 0 1px 0px #fee6a9;
-moz-box-shadow: 0 0 2px #888, inset 0 1px 0px #fee6a9;
-webkit-box-shadow: 0 0 2px #888, inset 0 1px 0px #fee6a9;
}
.shareyourcart-button-blue:active {
background-image: -moz-linear-gradient(top, #d1e6ef, #f4fbff);
background-image: -o-linear-gradient(top, #d1e6ef, #f4fbff);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d1e6ef), to(#f4fbff));
background-image: -webkit-linear-gradient(top, #d1e6ef, #f4fbff);
background-image: linear-gradient(top, #d1e6ef, #f4fbff);
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#d1e6ef', EndColorStr='#f4fbff');
box-shadow: 0 0 2px #888, inset 0 1px 0px #fee6a9;
-moz-box-shadow: 0 0 2px #888, inset 0 1px 0px #fee6a9;
-webkit-box-shadow: 0 0 2px #888, inset 0 1px 0px #fee6a9;
}
.shareyourcart-button-orange p, .shareyourcart-button-blue p{
margin: 0px;
padding: 0px !important;
margin-bottom: 0px !important;
}
.shareyourcart-button-orange small, .shareyourcart-button-blue small{
display: block;
font-size: 11px;
font-weight: normal;
margin: 0px;
padding: 0px;
}
.shareyourcart-button-orange img, .shareyourcart-button-blue img{
float: left;
margin-top: 2px;
}
/* PLUGIN OPTIONS STYLE*/
.shareyourcart-logo{
margin-top: 15px;
display: block;
float: left;
height: 100%;
}
#button_skin{
width: 150px;
}
.form-table th{
padding-left: 0px;
}
.form-table a {
color:blue;
font-weight:bold;
}
.form-table a:hover {
text-decoration:underline;
}
div.updated p, div.error p{
margin: 1em 0px;
}
.regular-text {
width:320px;
}
li#toplevel_page_shareyourcart .wp-menu-toggle{
width:0px;
}
.form-table {
width:90%;
}
.form-table-api {
width:80%;
}
.table-small {
width:45%;
}
.table-small tr th {
text-align: left;
width: 50%;
}
.table-small tr td {
text-align: left;
}
.form-table td {
padding-bottom:8px;
padding-top:12px;
}
.form-table th {
padding-top: 7px;
text-align: center;
}
table tr td {
padding: 5px 0;
}
.buttonOption {
float:left;
width:33%;
height: 290px;
background: url('../img/spacer.png') right top repeat-y;
}
.buttonOption.last {
background: none;
}
label {
float:none !important;
}
pre {
background-color: #F9F9F9;
border: 1px dashed #2F6FAB;
color: black;
line-height: 1.1em;
padding: 1em;
font-family: sans-serif;
overflow:auto;
}
hr {
margin:0;
background-color:#d8d7cf;
}
select {
width: 150px;
}
.syc-slogan {
float: left;
font-size: 18px;
font-style: normal;
font-weight: bold;
margin-top: 40px;
}
.syc-update-nag {
line-height: 19px;
padding: 5px 0;
font-size: 12px;
text-align: center;
/*margin: 0 15px;*/
border-width: 1px;
border-style: solid;
/*border-top-width: 0;
border-top-style: none;*/
-moz-border-radius: 0 0 3px 3px;
-webkit-border-bottom-right-radius: 3px;
-webkit-border-bottom-left-radius: 3px;
-khtml-border-bottom-right-radius: 3px;
-khtml-border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
background-color: #FFFBCC;
border-color: #E6DB55;
color: #555;
}
.clr {
clear:both;
}
.wrap {
padding:10px;
}
.api-status {
line-height: 25px;
float: right;
}
.api-button {
width: 120px;
text-align: center !important;
}
.api-link {
color: #1122CC;
font-weight:bold;
text-decoration:underline;
}
.api-link:hover {
color: #1122CC;
font-weight:bold;
}
.green {
color: #118C11;
font-weight:bold;
}
.red {
color: #F71414;
font-weight:bold;
}
.buttonOptionLabel {
font-size: 18px;
}
.buttonOptionRadio {
margin:7px 5px 13px 0px;
}
.buttonTextarea {
width:280px;
height:230px;
}
.buttonCheckbox {
margin:4px 4px 5px 0;
}
.configure-button-container{
margin: auto;
margin-top: 10px;
width: 212px;
}
#button-container{
margin: auto;
width: 180px;
}
.button_iframe iframe
{
width: 58px;
height: 230px;
position: fixed;
top:360px;
right:0px;
}
.button_iframe-normal iframe
{
float:right;
height: 58px;
width: 230px;
position:relative;
z-index:99999;
}
/* ------- VERTICAL BUTTON STYLING -------------*/
.vertical{
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
position: absolute !important;
right: -165px;
position: fixed;
height: 235px;
width: 235px;
}
.vertical-left
{
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
position: absolute !important;
left: -85px;
position: fixed;
}
/* ------- VERTICAL BUTTON STYLING -------------*/
/* -------- UPDATE MESSAGES --------------- */
.wrap div.updated, .wrap div.error {
border-width: 1px;
border-style: solid;
padding: 0 .6em;
margin: 5px 0 15px;
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
background-color: lightYellow;
border-color: #E6DB55;
}
/* -------- FINISH UPDATE MESSAGES --------------- */

View File

@ -0,0 +1,43 @@
.shareyourcart-button-orange{color: #623505 !important;}
.shareyourcart-button-orange p,
.shareyourcart-button-blue p
{
margin: 0px;
padding: 0px;
margin-bottom: 0px !important;
line-height: 17px;
}
.shareyourcart-button-orange small,
.shareyourcart-button-blue small
{
display: block;
font-size: 11px;
font-weight: normal;
margin: 0px;
padding: 0px;
line-height: 17px;
}
.vertical{right: 0px;}
.vertical-left{left:0px;}
/* IE NEEDED STYLES (because ie doesn't display the button vertical on hover) */
.shareyourcart-button-blue.vertical:hover,
.shareyourcart-button-blue.vertical:active,
.shareyourcart-button-orange.vertical:hover,
.shareyourcart-button-orange.vertical:active
{
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#f4fbff', EndColorStr='#d1e6ef')
progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
.shareyourcart-button-blue.vertical-left:hover,
.shareyourcart-button-blue.vertical-left:active,
.shareyourcart-button-orange.vertical-left:hover,
.shareyourcart-button-orange.vertical-left:active
{
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#f4fbff', EndColorStr='#d1e6ef')
progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}

View File

@ -0,0 +1,19 @@
.button_iframe iframe {
width: 58px;
height: 230px;
position: fixed;
top:360px;
right:0px;
}
.button_iframe-normal iframe {
float:right;
height: 58px;
width: 230px;
position:relative;
z-index:1000;
}
.button_iframe-normal.button_height {
height: 60px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 781 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -0,0 +1,18 @@
<?php
/**
* This is the configuration for generating message translations
* for the app. It is used by the 'yiic message' command.
*/
return array(
'sourcePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..', //the "sdk" folder's parent ( the actual plugin )
'messagePath'=>dirname(__FILE__), //put in this directory
'translator' => 'SyC::t', //the functions name that we use to translate the SDK
'languages'=>array('ro','fr','cs'),
'fileTypes'=>array('php'),
'overwrite' => true, //override old translation file
'removeOld' => true, //remove old translations
'exclude'=>array(
'.svn',
'/messages',
),
);

View File

@ -0,0 +1,84 @@
<?php
/**
* Message translations.
*
* This file is automatically generated by 'yiic message' command.
* It contains the localizable messages extracted from source code.
* You may modify this file by translating the extracted messages.
*
* Each array element represents the translation (value) of a message (key).
* If the value is empty, the message is considered as not translated.
* Messages that no longer need translation will have their translations
* enclosed between a pair of '@@' marks.
*
* Message string can be used with plural forms format. Check i18n section
* of the guide for details.
*
* NOTE, this file must be saved in UTF-8 encoding.
*
* @version $Id: $
*/
return array (
'API Status:' => '',
'App Key' => '',
'Blue' => '',
'Build your own HTML button' => '',
'Button position' => '',
'Button skin' => '',
'Can\'t access your account?' => '',
'Check this if you want the button to be shown on it\'s own row' => '',
'Checkout page' => '',
'Client ID' => '',
'Configure' => '',
'Contact' => '',
'Create a ShareYourCart account' => '',
'Create account' => '',
'Create an account' => '',
'Custom Button' => '',
'Description:' => '',
'Disable' => '',
'Disabled' => '',
'Domain:' => '',
'Email:' => '',
'Enable' => '',
'Enabled' => '',
'Enter the domain and email you used when you created the ShareYourCart account' => '',
'Failed to save the coupon' => '',
'Floating' => '',
'For the button to work, you need to specify the following properties in the meta description area' => '',
'Generated by ShareYourCart.com' => '',
'Get a {value} discount' => '',
'Here you can enter the details that will be used by {brand}' => '',
'Hover image:' => '',
'I agree to create the account on {brand}' => '',
'If you want to fully style the {brand} button, use instead the following HTML code' => '',
'If you want to use the {brand} button directly in a <strong>theme</strong> or <strong>page template</strong> you have to use the following function call:' => '',
'If you want to use the {brand} button on a product\'s page, you need to <strong>append</strong> {product-property} to the {callback-url} value, where {product-property} is the product\'s id' => '',
'If you\'ve got 30 seconds, we\'d {link-1} love to know what ideal outcome you\'d like ShareYourCart to help bring to your business</a>, or if you have a private question, you can {link-2} contact us directly</a>' => '',
'Image:' => '',
'In order to see the {brand} button on a <strong>post</strong> or <strong>page</strong> you can use the following shortcode:' => '',
'Include the currency sign as well. I.e: $10' => '',
'Increase your social media exposure by 10%!' => '',
'Leave blank to use the main description' => '',
'New to ShareYourCart&trade;?' => '',
'Normal' => '',
'Orange' => '',
'Product Image:' => '',
'Product Price:' => '',
'Product page' => '',
'Recover my account' => '',
'Remarks' => '',
'Save' => '',
'Show button by default on: ' => '',
'Standard Button' => '',
'This plugin allows you to easilly set the above meta properties directly in the post or page edit form' => '',
'To position the {brand} button, you need to override the following CSS classes' => '',
'Use Image Button' => '',
'Use Standard Button' => '',
'Use wordpress\' featured image functionality. You can find it on the right side.' => '',
'You can choose how much of a discount to give (in fixed amount, percentage, or free shipping) and to which social media channels it should it be applied. You can also define what the advertisement should say, so that it fully benefits your sales.' => '',
'or' => '',
'{brand} helps you get more customers by motivating satisfied customers to talk with their friends about your products. Each customer that promotes your products, via social media, will receive a coupon that they can apply to their shopping cart in order to get a small discount.' => '',
'{css_class} for the horrizontal button' => '',
'{css_class} for the vertical button' => '',
);

View File

@ -0,0 +1,84 @@
<?php
/**
* Message translations.
*
* This file is automatically generated by 'yiic message' command.
* It contains the localizable messages extracted from source code.
* You may modify this file by translating the extracted messages.
*
* Each array element represents the translation (value) of a message (key).
* If the value is empty, the message is considered as not translated.
* Messages that no longer need translation will have their translations
* enclosed between a pair of '@@' marks.
*
* Message string can be used with plural forms format. Check i18n section
* of the guide for details.
*
* NOTE, this file must be saved in UTF-8 encoding.
*
* @version $Id: $
*/
return array (
'API Status:' => '',
'App Key' => '',
'Blue' => '',
'Build your own HTML button' => '',
'Button position' => '',
'Button skin' => '',
'Can\'t access your account?' => '',
'Check this if you want the button to be shown on it\'s own row' => '',
'Checkout page' => '',
'Client ID' => '',
'Configure' => '',
'Contact' => '',
'Create a ShareYourCart account' => '',
'Create account' => '',
'Create an account' => '',
'Custom Button' => '',
'Description:' => '',
'Disable' => '',
'Disabled' => '',
'Domain:' => '',
'Email:' => '',
'Enable' => '',
'Enabled' => '',
'Enter the domain and email you used when you created the ShareYourCart account' => '',
'Failed to save the coupon' => '',
'Floating' => '',
'For the button to work, you need to specify the following properties in the meta description area' => '',
'Generated by ShareYourCart.com' => '',
'Get a {value} discount' => '',
'Here you can enter the details that will be used by {brand}' => '',
'Hover image:' => '',
'I agree to create the account on {brand}' => '',
'If you want to fully style the {brand} button, use instead the following HTML code' => '',
'If you want to use the {brand} button directly in a <strong>theme</strong> or <strong>page template</strong> you have to use the following function call:' => '',
'If you want to use the {brand} button on a product\'s page, you need to <strong>append</strong> {product-property} to the {callback-url} value, where {product-property} is the product\'s id' => '',
'If you\'ve got 30 seconds, we\'d {link-1} love to know what ideal outcome you\'d like ShareYourCart to help bring to your business</a>, or if you have a private question, you can {link-2} contact us directly</a>' => '',
'Image:' => '',
'In order to see the {brand} button on a <strong>post</strong> or <strong>page</strong> you can use the following shortcode:' => '',
'Include the currency sign as well. I.e: $10' => '',
'Increase your social media exposure by 10%!' => '',
'Leave blank to use the main description' => '',
'New to ShareYourCart&trade;?' => '',
'Normal' => '',
'Orange' => '',
'Product Image:' => '',
'Product Price:' => '',
'Product page' => '',
'Recover my account' => '',
'Remarks' => '',
'Save' => '',
'Show button by default on: ' => '',
'Standard Button' => '',
'This plugin allows you to easilly set the above meta properties directly in the post or page edit form' => '',
'To position the {brand} button, you need to override the following CSS classes' => '',
'Use Image Button' => '',
'Use Standard Button' => '',
'Use wordpress\' featured image functionality. You can find it on the right side.' => '',
'You can choose how much of a discount to give (in fixed amount, percentage, or free shipping) and to which social media channels it should it be applied. You can also define what the advertisement should say, so that it fully benefits your sales.' => '',
'or' => '',
'{brand} helps you get more customers by motivating satisfied customers to talk with their friends about your products. Each customer that promotes your products, via social media, will receive a coupon that they can apply to their shopping cart in order to get a small discount.' => '',
'{css_class} for the horrizontal button' => '',
'{css_class} for the vertical button' => '',
);

View File

@ -0,0 +1,84 @@
<?php
/**
* Message translations.
*
* This file is automatically generated by 'yiic message' command.
* It contains the localizable messages extracted from source code.
* You may modify this file by translating the extracted messages.
*
* Each array element represents the translation (value) of a message (key).
* If the value is empty, the message is considered as not translated.
* Messages that no longer need translation will have their translations
* enclosed between a pair of '@@' marks.
*
* Message string can be used with plural forms format. Check i18n section
* of the guide for details.
*
* NOTE, this file must be saved in UTF-8 encoding.
*
* @version $Id: $
*/
return array (
'API Status:' => '',
'App Key' => '',
'Blue' => '',
'Build your own HTML button' => '',
'Button position' => '',
'Button skin' => '',
'Can\'t access your account?' => '',
'Check this if you want the button to be shown on it\'s own row' => '',
'Checkout page' => '',
'Client ID' => '',
'Configure' => '',
'Contact' => '',
'Create a ShareYourCart account' => '',
'Create account' => '',
'Create an account' => '',
'Custom Button' => '',
'Description:' => '',
'Disable' => '',
'Disabled' => '',
'Domain:' => '',
'Email:' => '',
'Enable' => '',
'Enabled' => '',
'Enter the domain and email you used when you created the ShareYourCart account' => '',
'Failed to save the coupon' => '',
'Floating' => '',
'For the button to work, you need to specify the following properties in the meta description area' => '',
'Generated by ShareYourCart.com' => '',
'Get a {value} discount' => '',
'Here you can enter the details that will be used by {brand}' => '',
'Hover image:' => '',
'I agree to create the account on {brand}' => '',
'If you want to fully style the {brand} button, use instead the following HTML code' => '',
'If you want to use the {brand} button directly in a <strong>theme</strong> or <strong>page template</strong> you have to use the following function call:' => '',
'If you want to use the {brand} button on a product\'s page, you need to <strong>append</strong> {product-property} to the {callback-url} value, where {product-property} is the product\'s id' => '',
'If you\'ve got 30 seconds, we\'d {link-1} love to know what ideal outcome you\'d like ShareYourCart to help bring to your business</a>, or if you have a private question, you can {link-2} contact us directly</a>' => '',
'Image:' => '',
'In order to see the {brand} button on a <strong>post</strong> or <strong>page</strong> you can use the following shortcode:' => '',
'Include the currency sign as well. I.e: $10' => '',
'Increase your social media exposure by 10%!' => '',
'Leave blank to use the main description' => '',
'New to ShareYourCart&trade;?' => '',
'Normal' => '',
'Orange' => '',
'Product Image:' => '',
'Product Price:' => '',
'Product page' => '',
'Recover my account' => '',
'Remarks' => '',
'Save' => '',
'Show button by default on: ' => '',
'Standard Button' => '',
'This plugin allows you to easilly set the above meta properties directly in the post or page edit form' => '',
'To position the {brand} button, you need to override the following CSS classes' => '',
'Use Image Button' => '',
'Use Standard Button' => '',
'Use wordpress\' featured image functionality. You can find it on the right side.' => '',
'You can choose how much of a discount to give (in fixed amount, percentage, or free shipping) and to which social media channels it should it be applied. You can also define what the advertisement should say, so that it fully benefits your sales.' => '',
'or' => '',
'{brand} helps you get more customers by motivating satisfied customers to talk with their friends about your products. Each customer that promotes your products, via social media, will receive a coupon that they can apply to their shopping cart in order to get a small discount.' => '',
'{css_class} for the horrizontal button' => '',
'{css_class} for the vertical button' => '',
);

View File

@ -0,0 +1,35 @@
<script type="text/javascript">
if(_gaq) _gaq.push(['_trackPageview', '/admin/create-view']);
</script>
<?php echo SyC::t('sdk','Create a ShareYourCart account'); ?>
<form method="POST">
<table>
<tr>
<td>
<label for="domain"><?php echo SyC::t('sdk','Domain:'); ?></label>
</td>
<td>
<input type="text" name="domain" id="domain" class="regular-text" value="<?php echo (isset($_POST['domain']) ? $_POST['domain'] : $this->getDomain()); ?>"/>
</td>
</tr>
<tr>
<td>
<label for="email"><?php echo SyC::t('sdk','Email:'); ?></label>
</td>
<td>
<input type="text" name="email" id="email" class="regular-text" value="<?php echo (isset($_POST['email']) ? $_POST['email'] : $this->getAdminEmail()); ?>"/>
</td>
</tr>
<tr>
<td colspan="2">
<input class="buttonCheckbox" name="syc-terms-agreement" id="syc-terms-agreement" <?php if( $_SERVER['REQUEST_METHOD'] !== 'POST' || isset($_POST['syc-terms-agreement'])){ echo 'checked="checked"'; } ?> type="checkbox" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/create-view/toogle-terms-agreement-click']);"><label for="syc-terms-agreement"><?php echo SyC::t('sdk','I agree to create the account on {brand}',array('{brand}' => '<a href="http://www.shareyourcart.com" target="_blank" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/create-view/logo-terms-click\']);">www.shareyourcart.com</a>')); ?></label>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="syc-create-account" value="<?php echo SyC::t('sdk','Create account'); ?>" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/create-view/save-click']);"/>
</td>
</tr>
</table>
<?php echo $html;?>
</form>

View File

@ -0,0 +1,30 @@
<script type="text/javascript">
if(_gaq) _gaq.push(['_trackPageview', '/admin/recover-view']);
</script>
<?php echo SyC::t('sdk','Enter the domain and email you used when you created the ShareYourCart account'); ?>
<form method="POST">
<table>
<tr>
<td>
<label for="domain"><?php echo SyC::t('sdk','Domain:'); ?></label>
</td>
<td>
<input type="text" name="domain" id="domain" class="regular-text" value="<?php echo (isset($_POST['domain']) ? $_POST['domain'] : $this->getDomain()); ?>"/>
</td>
</tr>
<tr>
<td>
<label for="email"><?php echo SyC::t('sdk','Email:'); ?></label>
</td>
<td>
<input type="text" name="email" id="email" class="regular-text" value="<?php echo (isset($_POST['email']) ? $_POST['email'] : $this->getAdminEmail()); ?>"/>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="syc-recover-account" value="<?php echo SyC::t('sdk','Recover my account'); ?>" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/recover-view/save-click']);" />
</td>
</tr>
</table>
<?php echo $html;?>
</form>

View File

@ -0,0 +1,23 @@
<link rel="stylesheet" type="text/css" href="<?php echo $this->createUrl(dirname(__FILE__).'/../css/admin-style.css'); ?>" />
<script type="text/javascript">
<?php if($this->SHAREYOURCART_URL == "www.shareyourcart.com"): //only if in production mode anonymously monitor the usage ?>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-2900571-7']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
<?php endif; ?>
window.onload = function() {
document.getElementById('syc-form').addEventListener('submit', changetext, false);
};
var changetext = function(){
var textarea = document.getElementById('syc_button_textarea').value;
document.getElementById('syc_button_textarea').value = encodeURIComponent(textarea);
}
</script>

View File

@ -0,0 +1,93 @@
<script type="text/javascript">
if(_gaq) _gaq.push(['_trackPageview', '/admin-view']);
</script>
<div class="wrap">
<?php if($show_header):?>
<?php echo $this->getUpdateNotification(); ?>
<h2>
<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart" class="shareyourcart-logo" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin-view/logo-click']);">
<img src="<?php echo $this->createUrl(dirname(__FILE__).'/../img/shareyourcart-logo.png'); ?>"/>
</a>
<div class="syc-slogan"><?php echo SyC::t('sdk','Increase your social media exposure by 10%!'); ?></div>
<?php
if(isset($this->adminFix)) echo "<br /><br /><br /><br /><br />";
else echo "<br class=\"clr\" /> ";
?>
</h2>
<?php endif; ?>
<?php if(!empty($status_message)): ?>
<div class="updated settings-error"><p><strong>
<?php echo $status_message; ?>
</strong></p></div>
<?php endif; ?>
<p><?php echo SyC::t('sdk','{brand} helps you get more customers by motivating satisfied customers to talk with their friends about your products. Each customer that promotes your products, via social media, will receive a coupon that they can apply to their shopping cart in order to get a small discount.',array('{brand}' => '<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart&trade;" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin-view/logo-click\']);">ShareYourCart&trade;</a>')); ?></p>
<br />
<div id="acount-options">
<form method="POST" name="account-form">
<fieldset>
<div class="api-status" align="right">
<?php echo SyC::t('sdk','API Status:'); ?>
<?php if($this->isActive()) : ?>
<span class="green"><?php echo SyC::t('sdk','Enabled'); ?></span>
<?php else :?>
<span class="red"><?php echo SyC::t('sdk','Disabled'); ?></span>
<?php endif;?>
<br />
<?php if($this->isActive()) : ?>
<input type="submit" value="<?php echo SyC::t('sdk','Disable'); ?>" name="disable-API" class="api-button" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin-view/disable-click']);" />
<?php else :?>
<input type="submit" value="<?php echo SyC::t('sdk','Enable'); ?>" name="enable-API" class="api-button" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin-view/enable-click']);" />
<?php endif;?>
</div>
<table class="form-table-api" name="shareyourcart_settings">
<tr>
<th scope="row"><?php echo SyC::t('sdk','Client ID'); ?></th>
<td><input type="text" name="client_id" id="client_id" class="regular-text" value="<?php echo $this->getClientId(); ?>"/></td>
</tr>
<tr>
<th scope="row"><?php echo SyC::t('sdk','App Key'); ?></th>
<td><input type="text" name="app_key" id="app_key" class="regular-text" value="<?php echo $this->getAppKey(); ?>"/></td>
</tr>
<tr>
<td></td>
<td><a href="?<?php echo http_build_query(array_merge($_GET,array('syc-account'=>'recover')),'','&')?>" class="api-link" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin-view/recover-click']);"><?php echo SyC::t('sdk',"Can't access your account?"); ?></a> <strong><?php echo SyC::t('sdk','or'); ?></strong> <?php echo SyC::t('sdk','New to ShareYourCart&trade;?'); ?> <a href="?<?php echo http_build_query(array_merge($_GET,array('syc-account'=>'create')),'','&')?>" id="account-recovery" class="api-link" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin-view/create-account-click']);"><?php echo SyC::t('sdk','Create an account'); ?></a></td>
</tr>
</table>
<?php echo $html;?>
<div class="submit"><input type="submit" name="syc-account-form" class="button" value="<?php echo SyC::t('sdk','Save'); ?>" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin-view/save-click']);"></div>
</fieldset>
</form>
</div>
<?php if($this->isActive()): //show the configure part only if it is active ?>
<br/>
<fieldset>
<p><?php echo SyC::t('sdk','You can choose how much of a discount to give (in fixed amount, percentage, or free shipping) and to which social media channels it should it be applied. You can also define what the advertisement should say, so that it fully benefits your sales.'); ?></p>
<br />
<form action="<?php echo $this->SHAREYOURCART_CONFIGURE; ?>" method="POST" id="configure-form" target="_blank">
<div class="configure-button-container" align="center">
<input type="submit" value="<?php echo SyC::t('sdk','Configure'); ?>" id="configure-button" class="shareyourcart-button-orange" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin-view/configure-click']);" />
<input type="hidden" name="app_key" value="<?php echo $this->getAppKey(); ?>" />
<input type="hidden" name="client_id" value="<?php echo $this->getClientId(); ?>" />
<input type="hidden" name="email" value="<?php echo $this->getAdminEmail(); ?>" />
</div>
</form>
</fieldset>
<?php if($show_footer):?>
<br />
<h2><?php echo SyC::t('sdk','Contact'); ?></h2>
<p><?php echo SyC::t('sdk',"If you've got 30 seconds, we'd {link-1} love to know what ideal outcome you'd like ShareYourCart to help bring to your business</a>, or if you have a private question, you can {link-2} contact us directly</a>", array('{link-1}' => '<a href="http://shareyourcart.uservoice.com" target="_blank" title="forum" class="api-link" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/forum-click\']);">', '{link-2}' => '<a href="http://www.shareyourcart.com/contact" target="_blank" class="api-link" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/contact-click\']);">')); ?></p>
<br />
<?php endif; ?>
<?php endif; //show only if the cart is active ?>
</div>

View File

@ -0,0 +1,11 @@
<a href="<?php echo $this->SHAREYOURCART_BUTTON_URL ?>" class="shareyourcart-button" <?php echo (isset($callback_url) && !empty($callback_url)) ? "data-syc-callback_url=$callback_url" : ''; ?> data-syc-layout="custom">
<?php echo $button_html;?>
</a>
<script type="text/javascript">
(function() {
var a = document.createElement('script'); a.type = 'text/javascript'; a.async = true;
a.src = '<?php echo $this->SHAREYOURCART_BUTTON_JS; ?>';
var b = document.getElementsByTagName('script')[0]; b.parentNode.insertBefore(a, b);
})();
</script>

View File

@ -0,0 +1,58 @@
<?php
// If only the hover is uploaded
if((!$button_img or !$button_img_width or !$button_img_height) and ($button_img_hover and $button_img_hover_width and $button_img_hover_height)) {
$button_img = $button_img_hover;
$button_img_width = $button_img_hover_width;
$button_img_height = $button_img_hover_height;
$button_img_hover = null;
$button_img_hover_width = null;
$button_img_hover_height = null;
}
$callbackDataAttr = '';
if(isset($callback_url) && !empty($callback_url)) {
$callbackDataAttr = 'data-syc-callback_url="' . $callback_url .'"';
}
?>
<a href="<?php echo $this->SHAREYOURCART_BUTTON_URL ?>" class="shareyourcart-button" <?php echo $callbackDataAttr; ?> data-syc-layout="custom">
ShareYourCart Discount
</a>
<style>
.shareyourcart-button {
display: block;
background: url('<?php echo $button_img;?>') left top;
width: <?php echo $button_img_width; ?>px;
height: <?php echo $button_img_height; ?>px;
text-indent: -9999px;
}
<?php
if($button_img_hover and $button_img_hover_width and $button_img_hover_height) {
?>
.shareyourcart-button:hover {
background-image: url('<?php echo $button_img_hover; ?>');
width: <?php echo $button_img_hover_width; ?>px;
height: <?php echo $button_img_hover_height; ?>px;
}
body:after {
content: url(<?php echo $button_img_hover; ?>);
background-image: url(<?php echo $button_img_hover; ?>);
visibility: hidden;
position: absolute;
left: -999em;
}
<?php
}
?>
</style>
<script type="text/javascript">
(function() {
var a = document.createElement('script'); a.type = 'text/javascript'; a.async = true;
a.src = '<?php echo $this->SHAREYOURCART_BUTTON_JS; ?>';
var b = document.getElementsByTagName('script')[0]; b.parentNode.insertBefore(a, b);
})();
</script>

View File

@ -0,0 +1,145 @@
<?php if(!$this->isActive()) return; //if the plugin is not active, do not show this page ?>
<script type="text/javascript">
if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view']);
</script>
<div class="wrap">
<?php if($show_header):?>
<?php echo $this->getUpdateNotification(); ?>
<h2>
<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart" class="shareyourcart-logo" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/logo-click']);">
<img src="<?php echo $this->createUrl(dirname(__FILE__).'/../img/shareyourcart-logo.png'); ?>"/>
</a>
<div class="syc-slogan"><?php echo SyC::t('sdk','Increase your social media exposure by 10%!'); ?></div>
<br clear="all" />
</h2>
<?php endif; ?>
<?php if (!empty($status_message)): ?>
<div class="updated settings-error"><p><strong>
<?php echo $status_message; ?>
</strong></p></div>
<?php endif; ?>
<div id="visual-options">
<form method="POST" enctype="multipart/form-data" id="syc-form">
<fieldset>
<div class="buttonOption">
<input class="buttonOptionRadio" type="radio" value="1" id="button_type_1" <?php if ($current_button_type == '1'||$current_button_type == '') echo 'checked' ?> name="button_type" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/default-click']);" />
<label class="buttonOptionLabel" for="button_type_1"><?php echo SyC::t('sdk','Use Standard Button'); ?></label>
<br /><br />
<table class="form-table shareyourcart_button_standard" name="shareyourcart_button_standard">
<tr align="center">
<th scope="row"><?php echo SyC::t('sdk','Button skin'); ?></th>
</tr>
<tr align="center">
<td>
<select name="button_skin" id="button_skin" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/button-skin-click']);">
<option name="orange" <?php echo $current_skin == 'orange' ? 'selected="selected"' : ''; ?> value="orange"><?php echo SyC::t('sdk','Orange'); ?></option>
<option name="blue" <?php echo $current_skin == 'blue' ? 'selected="selected"' : ''; ?> value="blue"><?php echo SyC::t('sdk','Blue'); ?></option>
<option name="light" <?php echo $current_skin == 'light' ? 'selected="selected"' : ''; ?> value="light"><?php echo SyC::t('sdk','Light'); ?></option>
<option name="dark" <?php echo $current_skin == 'dark' ? 'selected="selected"' : ''; ?> value="dark"><?php echo SyC::t('sdk','Dark'); ?></option>
</select>
</td>
</tr>
<tr align="center">
<th scope="row"><?php echo SyC::t('sdk','Button position'); ?></th>
</tr>
<tr align="center">
<td>
<select name="button_position" id="button_position" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/button-position-click']);">
<option name="normal" <?php echo $current_position == 'normal' ? 'selected="selected"' : ''; ?> value="normal"><?php echo SyC::t('sdk','Normal'); ?></option>
<option name="floating" <?php echo $current_position == 'floating' ? 'selected="selected"' : ''; ?> value="floating"><?php echo SyC::t('sdk','Floating'); ?></option>
</select>
</td>
</tr>
<!-- <tr align="center"> since we switched to <a> on the button, this does not seem to be needed anymore
<td>
<input class="buttonCheckbox" name="show_on_single_row" <?php echo $show_on_single_row ? 'checked="checked"' : ''; ?> type='checkbox' onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/toggle-show-on-single-row-click']);"><?php echo SyC::t('sdk','Check this if you want the button to be shown on it\'s own row'); ?></input>
</td>
</tr> -->
</table>
</div>
<div class="buttonOption">
<input class="buttonOptionRadio" type="radio" value="2" id="button_type_2" name="button_type" <?php if ($current_button_type == '2') echo 'checked' ?> onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/image-button-click']);"/>
<label class="buttonOptionLabel" for="button_type_2"><?php echo SyC::t('sdk','Use Image Button'); ?></label>
<br /><?php if (empty($button_img)){ ?><br /><?php } ?>
<table class="form-table shareyourcart_button_image" name="shareyourcart_button_image">
<tr align="center">
<th><label><?php echo SyC::t('sdk','Image:'); ?></label></th>
</tr>
<tr align="center">
<td>
<?php if (!empty($button_img)): ?>
<img src="<?php echo $button_img ?>" height="40" />
<?php endif; ?>
<br />
<input type="hidden" name="MAX_FILE_SIZE" value="100000000000" />
<input type="file" accept="image/gif, image/jpeg, image/jpg, image/png" name="button-img" id="button-img" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/upload-normal-img-click']);" />
</td>
</tr>
<tr align="center">
<th><label><?php echo SyC::t('sdk','Hover image:'); ?></label></th>
</tr>
<tr align="center">
<td>
<?php if (!empty($button_img_hover)): ?>
<img src="<?php echo $button_img_hover ?>" height="40" />
<?php endif; ?>
<br />
<input type="hidden" name="MAX_FILE_SIZE" value="100000000000" />
<input type="file" accept="image/gif, image/jpeg, image/jpg, image/png" name="button-img-hover" id="button-img-hover" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/upload-hover-img-click']);" />
</td>
</tr>
</table>
</div>
<div class="buttonOption last">
<input class="buttonOptionRadio" type="radio" value="3" id="button_type_3" name="button_type" <?php if ($current_button_type == '3') echo 'checked' ?> onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/custom-button-click']);"/>
<label class="buttonOptionLabel" for="button_type_3"><?php echo SyC::t('sdk','Build your own HTML button'); ?></label>
<table class="form-table shareyourcart_button_html" name="shareyourcart_button_html">
<tr>
<td>
<textarea id="syc_button_textarea" class="buttonTextarea" rows="7" cols="56" name="button_html"><?php echo ($button_html!=''?$button_html:'<button>'.SyC::t('sdk','Get a {value} discount',array('{value}' => '<div class="shareyourcart-discount"></div>')).'</button>'); ?></textarea>
</td>
</tr>
</table>
<?php echo $html; ?>
</div>
<br clear="all" />
<hr />
<br />
<table class="form-table table-small" name="shareyourcart_settings">
<tr>
<th scope="row" valign="top"><?php echo SyC::t('sdk','Show button by default on: '); ?></th>
<td>
<input class="buttonCheckbox" name="show_on_product" <?php echo $show_on_product ? 'checked="checked"' : ''; ?> type='checkbox' onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/toggle-show-on-product-click']);"><?php echo SyC::t('sdk','Product page'); ?></input>
<br />
<input class="buttonCheckbox" name="show_on_checkout" <?php echo $show_on_checkout ? 'checked="checked"' : ''; ?> type='checkbox' onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/toggle-show-on-checkout-click']);"><?php echo SyC::t('sdk','Checkout page'); ?></input>
</td>
</tr>
</table>
<div class="submit"><input type="submit" class="button" name="syc-visual-form" id="syc-visual-form" value="<?php echo SyC::t('sdk','Save'); ?>" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/save-click']);"></div>
</fieldset>
<br />
</form>
</div>
<?php if($show_footer):?>
<h2><?php echo SyC::t('sdk','Contact'); ?></h2>
<p><?php echo SyC::t('sdk',"If you've got 30 seconds, we'd {link-1} love to know what ideal outcome you'd like ShareYourCart to help bring to your business</a>, or if you have a private question, you can {link-2} contact us directly</a>", array('{link-1}' => '<a href="http://shareyourcart.uservoice.com" target="_blank" title="forum" class="api-link" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/forum-click\']);">', '{link-2}' => '<a href="http://www.shareyourcart.com/contact" target="_blank" class="api-link" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/contact-click\']);">')); ?></p>
<br />
<?php endif; ?>
</div>

View File

@ -0,0 +1,11 @@
<a href="<?php echo $this->SHAREYOURCART_BUTTON_URL ?>" class="shareyourcart-button <?php echo ( $this->getConfigValue('button_position') == 'floating' ? 'button_iframe' : 'button_iframe-normal');?> <?php echo ( !$this->getConfigValue('dont_set_height') ? 'button_height' : ''); ?>" <?php echo (isset($callback_url) && !empty($callback_url)) ? "data-syc-callback_url=$callback_url" : ''; ?> data-syc-skin="<?php echo $this->getConfigValue('button_skin');?>" data-syc-orientation="<?php echo $this->getConfigValue('button_position'); ?>" >
ShareYourCart Discount
</a>
<script type="text/javascript">
(function() {
var a = document.createElement('script'); a.type = 'text/javascript'; a.async = true;
a.src = '<?php echo $this->SHAREYOURCART_BUTTON_JS; ?>';
var b = document.getElementsByTagName('script')[0]; b.parentNode.insertBefore(a, b);
})();
</script>

View File

@ -0,0 +1,85 @@
<?php if(!$this->isActive()) return; //if the plugin is not active, do not show this page ?>
<script type="text/javascript">
if(_gaq) _gaq.push(['_trackPageview', '/admin/documentation']);
</script>
<div class="wrap">
<?php if($show_header):?>
<?php echo $this->getUpdateNotification(); ?>
<h2>
<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart" class="shareyourcart-logo" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/documentation/logo-click']);">
<img src="<?php echo $this->createUrl(dirname(__FILE__).'/../img/shareyourcart-logo.png'); ?>"/>
</a>
<div class="syc-slogan"><?php echo SyC::t('sdk','Increase your social media exposure by 10%!'); ?></div>
<br clear="all" />
</h2>
<?php endif; ?>
<div id="doc-content">
<h2><?php echo SyC::t('sdk','Standard Button'); ?></h2>
<p><?php echo SyC::t('sdk','In order to see the {brand} button on a <strong>post</strong> or <strong>page</strong> you can use the following shortcode:', array( '{brand}' => '<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart&trade;" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/logo-click\']);">ShareYourCart&trade;</a>')); ?></p>
<pre><code>[shareyourcart]</code></pre>
<p><?php echo SyC::t('sdk','If you want to use the {brand} button directly in a <strong>theme</strong> or <strong>page template</strong> you have to use the following function call:', array('{brand}' => '<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart&trade;" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/logo-click\']);">ShareYourCart&trade;</a>')); ?></p>
<pre><code>echo do_shortcode('[shareyourcart]');</code></pre>
<h3><?php echo SyC::t('sdk','Remarks'); ?></h3>
<ol>
<?php if (!(isset($action_url) && !empty($action_url))): //if no shopping cart is active ?>
<li><p><?php echo SyC::t('sdk','For the button to work, you need to specify the following properties in the meta description area'); ?></p>
<pre><code><?php echo SyC::htmlIndent(nl2br(htmlspecialchars('<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:og="http://ogp.me/ns#"
xmlns:syc="http://www.shareyourcart.com">
<head>
<meta property="og:image" content="http://www.example.com/product-image.jpg"/>
<meta property="syc:price" content="$10" />
<meta property="og:description"
content="
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Proin feugiat nunc quis nibh congue luctus.
Maecenas ac est nec turpis fermentum imperdiet.
"/>
...
</head>
...
</html>'))); ?></code></pre></li>
<li><?php echo SyC::t('sdk','This plugin allows you to easilly set the above meta properties directly in the post or page edit form'); ?></li>
<?php endif; ?>
<li><p><?php echo SyC::t('sdk','To position the {brand} button, you need to override the following CSS classes', array('{brand}' => '<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart&trade;" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/logo-click\']);">ShareYourCart&trade;</a>')); ?></p>
<ul>
<li><?php echo SyC::t('sdk','{css_class} for the horrizontal button', array('{css_class}' => '<code>button_iframe-normal</code>')); ?></li>
<li><?php echo SyC::t('sdk','{css_class} for the vertical button', array('{css_class}' => '<code>button_iframe</code>')); ?></li>
</ul>
</li>
</ol>
<h2><?php echo SyC::t('sdk','Custom Button'); ?></h2>
<p><?php echo SyC::t('sdk','If you want to fully style the {brand} button, use instead the following HTML code', array('{brand}' => '<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart&trade;" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/logo-click\']);">ShareYourCart&trade;</a>')); ?></p>
<?php $custom_button = '<button class="shareyourcart-button" data-syc-layout="custom"';
if (isset($action_url) && !empty($action_url)){
//if there is no action url, it means none of the supported shopping carts are active,
//so there would be no need for the callback attribute
$custom_button .= ' data-syc-callback_url="'.$action_url.'" ';
}
$custom_button .= '>
Get a <div class="shareyourcart-discount" ></div> discount
</button>'; ?>
<pre><code><?php echo SyC::htmlIndent(nl2br(htmlspecialchars($custom_button))); ?></code></pre>
<?php if (isset($action_url) && !empty($action_url)): //only show if a known shopping cart is active ?>
<h3><?php echo SyC::t('sdk','Remarks'); ?></h3>
<p><?php echo SyC::t('sdk','If you want to use the {brand} button on a product\'s page, you need to <strong>append</strong> {product-property} to the {callback-url} value, where {product-property} is the product\'s id', array('{brand}' => '<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart&trade;" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/logo-click\']);">ShareYourCart&trade;</a>', '{product-property}' => '<code>&p=&lt;product_id&gt;</code>', '{callback-url}' => '<strong>data-syc-callback_url</strong>')); ?></p>
<?php endif; ?>
<?php if($show_footer):?>
<h2><?php echo SyC::t('sdk','Contact'); ?></h2>
<p><?php echo SyC::t('sdk',"If you've got 30 seconds, we'd {link-1} love to know what ideal outcome you'd like ShareYourCart to help bring to your business</a>, or if you have a private question, you can {link-2} contact us directly</a>", array('{link-1}' => '<a href="http://shareyourcart.uservoice.com" target="_blank" title="forum" class="api-link" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/forum-click\']);">', '{link-2}' => '<a href="http://www.shareyourcart.com/contact" target="_blank" class="api-link" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/contact-click\']);">')); ?></p>
<br />
<?php endif; ?>
</div>
</div>

View File

@ -0,0 +1,15 @@
<link rel="stylesheet" type="text/css" href="<?php echo $this->createUrl(dirname(__FILE__).'/../css/style.css'); ?>" />
<!--[if lt IE 9]>
<link rel="stylesheet" href="<?php echo $this->createUrl(dirname(__FILE__).'/../css/ie.css'); ?>" type="text/css"/>
<![endif]-->
<meta property="syc:client_id" content="<?php echo $this->getClientId(); ?>" />
<?php if($this->isActive() & is_array($data)): ?>
<meta property="og:title" content="<?php echo htmlspecialchars(@$data['item_name']); ?>" />
<meta property="og:url" content="<?php echo @$data['item_url'] ?>" />
<meta property="og:description" content="<?php echo htmlspecialchars(@$data['item_description']); ?>" />
<meta property="og:image" content="<?php echo @$data['item_picture_url'] ?>" />
<meta property="syc:price" content="<?php echo @$data['item_price'] ?>" />
<?php endif; ?>

View File

@ -0,0 +1,5 @@
<?php if($this->hasNewerVersion()): //if there is a newer version, show the upgrade message?>
<div class="syc-update-nag">
<strong><?php echo SyC::t('sdk','{link}ShareYourCart {version}</a> is available! {link}Please update now</a>.', array('{version}' => $this->getConfigValue('latest_version'), '{link}' => '<a href="'.$this->getConfigValue("download_url").'" target="_blank">')); ?></strong>
</div>
<?php endif; ?>

View File

@ -198,6 +198,14 @@ class WC_Flat_Rate extends WC_Shipping_Method {
if ($per_order_cost) {
$extra_rate['cost']['order'] = $this_cost;
} else {
$total_quantity = 0;
// Shipping per item
foreach ( $package['contents'] as $item_id => $values )
if ( $values['quantity'] > 0 && $values['data']->needs_shipping() )
$total_quantity += $values['quantity'];
// Per-product shipping
$extra_rate['cost']['order'] = $this_cost * $total_quantity;
}
@ -307,7 +315,6 @@ class WC_Flat_Rate extends WC_Shipping_Method {
function item_shipping( $package ) {
// Per item shipping so we pass an array of costs (per item) instead of a single value
$costs = array();
$total_quantity = 0;
// Shipping per item
foreach ( $package['contents'] as $item_id => $values ) {
@ -327,9 +334,6 @@ class WC_Flat_Rate extends WC_Shipping_Method {
}
$costs[$item_id] = ( ( $cost + $fee ) * $values['quantity'] );
$total_quantity += $values['quantity'];
}
}

View File

@ -60,7 +60,7 @@ class WC_Product_Cat_List_Walker extends Walker {
if ( $args['current_category_ancestors'] && $args['current_category'] && in_array( $cat->term_id, $args['current_category_ancestors'] ) )
$output .= ' current-cat-parent';
$output .= '"><a href="' . get_term_link( $cat->slug, 'product_cat' ) . '">' . $cat->name . '</a>';
$output .= '"><a href="' . get_term_link( (int) $cat->term_id, 'product_cat' ) . '">' . $cat->name . '</a>';
if ( $args['show_count'] )
$output .= ' <span class="count">(' . $cat->count . ')</span>';

Binary file not shown.

View File

@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WooCommerce v1.5.4\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-04-18 14:33+0100\n"
"PO-Revision-Date: 2012-04-18 14:34+0100\n"
"POT-Creation-Date: 2012-04-22 15:43+0100\n"
"PO-Revision-Date: 2012-04-22 15:45+0100\n"
"Last-Translator: Frederik Svarre <FRS@FSLab.dk>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -111,20 +111,20 @@ msgid "No products found"
msgstr "Ingen produkter fundet"
# @ woocommerce
#: woocommerce-core-functions.php:586
#: woocommerce-core-functions.php:650
#: woocommerce-core-functions.php:592
#: woocommerce-core-functions.php:656
msgid "Download Permissions Granted"
msgstr "Downloadtilladelse givet"
# @ woocommerce
#: woocommerce-core-functions.php:684
#: woocommerce-core-functions.php:690
#: woocommerce.php:524
msgctxt "slug"
msgid "product"
msgstr "produkt"
# @ woocommerce
#: woocommerce-core-functions.php:777
#: woocommerce-core-functions.php:783
msgid "Select a category"
msgstr "Vælg en kategori"
@ -3249,608 +3249,616 @@ msgstr "mm"
msgid "in"
msgstr "in"
#: admin/woocommerce-admin-settings.php:642
msgid "yd"
msgstr "yd"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:648
#: admin/woocommerce-admin-settings.php:649
msgid "Product Reviews"
msgstr "Produktanmeldelser"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:648
#: admin/woocommerce-admin-settings.php:649
msgid "The following options affect product reviews (comments)."
msgstr "Følgende indstillinger påvirker produktanmeldelser (kommentarer)."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:651
#: admin/woocommerce-admin-settings.php:652
msgid "Ratings"
msgstr "Bedømmelser"
#: admin/woocommerce-admin-settings.php:652
#: admin/woocommerce-admin-settings.php:653
msgid "Enable the star rating field on the review form"
msgstr "Aktiver stjerne-bedømmelsesfeltet ved anmeldelsesformularen"
#: admin/woocommerce-admin-settings.php:661
#: admin/woocommerce-admin-settings.php:662
msgid "Ratings are required to leave a review"
msgstr "Bedømmelse er påkrævet for at afgive en anmeldelse"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:671
#: admin/woocommerce-admin-settings.php:672
msgid "Pricing Options"
msgstr "Prisindstillinger"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:671
#: admin/woocommerce-admin-settings.php:672
msgid "The following options affect how prices are displayed on the frontend."
msgstr "Følgende indstillinger påvirker hvordan priser vises på brugerfladen."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:674
#: admin/woocommerce-admin-settings.php:675
msgid "Currency Position"
msgstr "Valuta position"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:675
#: admin/woocommerce-admin-settings.php:676
msgid "This controls the position of the currency symbol."
msgstr "Denne kontrollerer positionen af valutasymbolet."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:682
#: admin/woocommerce-admin-settings.php:683
msgid "Left"
msgstr "Venstre"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:683
#: admin/woocommerce-admin-settings.php:684
msgid "Right"
msgstr "Højre"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:684
#: admin/woocommerce-admin-settings.php:685
msgid "Left (with space)"
msgstr "Venstre (med plads)"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:685
#: admin/woocommerce-admin-settings.php:686
msgid "Right (with space)"
msgstr "Højre (med plads)"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:691
#: admin/woocommerce-admin-settings.php:692
msgid "Thousand separator"
msgstr "Tusindeseparator"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:692
#: admin/woocommerce-admin-settings.php:693
msgid "This sets the thousand separator of displayed prices."
msgstr "Denne fastsætter tusindeseparatoren i viste priser. "
# @ woocommerce
#: admin/woocommerce-admin-settings.php:702
#: admin/woocommerce-admin-settings.php:703
msgid "Decimal separator"
msgstr "Decimalseparator"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:703
#: admin/woocommerce-admin-settings.php:704
msgid "This sets the decimal separator of displayed prices."
msgstr "Denne fastsætter decimalseparatoren i viste priser."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:713
#: admin/woocommerce-admin-settings.php:714
msgid "Number of decimals"
msgstr "Antallet af decimaler"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:714
#: admin/woocommerce-admin-settings.php:715
msgid "This sets the number of decimal points shown in displayed prices."
msgstr "Denne fastsætter antallet af decimaler vist i viste priser"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:724
#: admin/woocommerce-admin-settings.php:725
msgid "Trailing zeros"
msgstr "Efterfølgende nuller"
#: admin/woocommerce-admin-settings.php:725
#: admin/woocommerce-admin-settings.php:726
msgid "Remove zeros after the decimal point. e.g. <code>$10.00</code> becomes <code>$10</code>"
msgstr "Fjern nuller efter decimaltegnet. fx <code>$10.00</code> bliver <code>$10</code>"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:733
#: admin/woocommerce-admin-settings.php:734
msgid "Image Options"
msgstr "Billed indstillinger"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:733
#: admin/woocommerce-admin-settings.php:734
#, php-format
msgid "These settings affect the actual dimensions of images in your catalog - the display on the front-end will still be affected by CSS styles. After changing these settings you may need to <a href=\"%s\">regenerate your thumbnails</a>."
msgstr "Disse indstillinger påvirker dimensionerne på billeder i dit katalog - Visning på front-end siden vil stadig være påvirket af CSS styles. Efter ændring af disse indstillinger kan du blive nødt til at <a href=\"%s\">regenerere dine miniaturebilleder</a>."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:736
#: admin/woocommerce-admin-settings.php:737
msgid "Catalog Images"
msgstr "Katalog billeder"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:737
#: admin/woocommerce-admin-settings.php:738
msgid "This size is usually used in product listings"
msgstr "Denne størrelse anvendes normalt i produktlister"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:746
#: admin/woocommerce-admin-settings.php:747
msgid "Single Product Image"
msgstr "Enkelt Produkt Billede"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:747
#: admin/woocommerce-admin-settings.php:748
msgid "This is the size used by the main image on the product page."
msgstr "Dette er størrelsen, der bliver anvendt på det primære billede på produktsiden."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:756
#: admin/woocommerce-admin-settings.php:757
msgid "Product Thumbnails"
msgstr "Produktminiaturebilleder"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:757
#: admin/woocommerce-admin-settings.php:758
msgid "This size is usually used for the gallery of images on the product page."
msgstr "Denne størrelse anvendes normalt i galleribilleder på produktsiden."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:772
#: admin/woocommerce-admin-settings.php:773
msgid "Inventory Options"
msgstr "Beholdningsindstillinger"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:775
#: admin/woocommerce-admin-settings.php:776
msgid "Manage stock"
msgstr "Administrer lager"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:776
#: admin/woocommerce-admin-settings.php:777
msgid "Enable stock management"
msgstr "Aktiver lageradministration"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:783
#: admin/woocommerce-admin-settings.php:784
msgid "Notifications"
msgstr "Meddelelser"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:784
#: admin/woocommerce-admin-settings.php:785
msgid "Enable low stock notifications"
msgstr "Aktiver lav lagerstatus meddelelser"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:792
#: admin/woocommerce-admin-settings.php:793
msgid "Enable out of stock notifications"
msgstr "Aktiver ikke på lager meddelelser"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:800
#: admin/woocommerce-admin-settings.php:801
msgid "Low stock threshold"
msgstr "Lav lagergrænse"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:810
#: admin/woocommerce-admin-settings.php:811
msgid "Out of stock threshold"
msgstr "Ikke på lager grænse"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:820
#: admin/woocommerce-admin-settings.php:821
msgid "Out of stock visibility"
msgstr "Ikke på lager synlighed"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:821
#: admin/woocommerce-admin-settings.php:822
msgid "Hide out of stock items from the catalog"
msgstr "Skjul produkter der ikke er på laget fra kataloget"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:834
#: admin/woocommerce-admin-settings.php:1290
#: admin/woocommerce-admin-settings.php:835
#: admin/woocommerce-admin-settings.php:1300
msgid "Shipping Options"
msgstr "Forsendelsesmuligheder"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:834
#: admin/woocommerce-admin-settings.php:835
msgid "Shipping can be enabled and disabled from this section."
msgstr "Forsendelse kan aktiveres og deaktiveres fra denne sektion"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:837
#: admin/woocommerce-admin-settings.php:846
#: admin/woocommerce-admin-settings.php:855
#: admin/woocommerce-admin-settings.php:838
#: admin/woocommerce-admin-settings.php:847
#: admin/woocommerce-admin-settings.php:856
msgid "Shipping calculations"
msgstr "Forsendelsesberegninger"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:838
#: admin/woocommerce-admin-settings.php:839
msgid "Enable shipping"
msgstr "Aktiver forsendelse"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:847
#: admin/woocommerce-admin-settings.php:848
msgid "Enable the shipping calculator on the cart page"
msgstr "Aktiver forsendelsesberegneren på kurvsiden"
#: admin/woocommerce-admin-settings.php:856
#: admin/woocommerce-admin-settings.php:857
msgid "Hide shipping costs until an address is entered"
msgstr "Skjul forsendelsesomkostninger indtil en adresse er angivet"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:864
#: admin/woocommerce-admin-settings.php:865
msgid "Shipping destination"
msgstr "Forsendelsesdestination"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:865
#: admin/woocommerce-admin-settings.php:866
msgid "Only ship to the users billing address"
msgstr "Send kun til kundens faktureringsadresse"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:873
#: admin/woocommerce-admin-settings.php:874
msgid "Ship to billing address by default"
msgstr "Send til faktureringsadresse som standard"
#: admin/woocommerce-admin-settings.php:882
msgid "Collect shipping address even when not required"
msgstr "Indsaml forsendelsesadresse selvom den ikke er påkrævet"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:887
#: admin/woocommerce-admin-settings.php:896
msgid "Tax Options"
msgstr "Momsegenskaber"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:890
#: admin/woocommerce-admin-settings.php:899
msgid "Tax calculations"
msgstr "Momsberegninger"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:891
#: admin/woocommerce-admin-settings.php:900
msgid "Enable taxes and tax calculations"
msgstr "Aktiver moms og momsberegninger"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:899
#: admin/woocommerce-admin-settings.php:908
msgid "Display taxes on cart page"
msgstr "Vis moms på kurvsiden"
#: admin/woocommerce-admin-settings.php:907
#: admin/woocommerce-admin-settings.php:916
msgid "Display taxes even when the amount is zero"
msgstr "Vis moms selvom beløbet er nul"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:915
#: admin/woocommerce-admin-settings.php:924
msgid "Round tax at subtotal level, instead of per line"
msgstr "Afrund moms ved subtotal niveau i stedet for pr. linje"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:923
#: admin/woocommerce-admin-settings.php:932
msgid "Catalog Prices"
msgstr "Katalog priser"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:924
#: admin/woocommerce-admin-settings.php:933
msgid "Catalog prices defined including tax"
msgstr "Katalogpriser defineret incl. moms"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:933
#: admin/woocommerce-admin-settings.php:942
msgid "Display cart contents excluding tax"
msgstr "Vis kurvindhold ekskl. moms"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:942
#: admin/woocommerce-admin-settings.php:951
msgid "Display cart totals excluding tax"
msgstr "Vis kurvtotaler ekskl. moms"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:951
#: admin/woocommerce-admin-settings.php:960
msgid "Additional Tax classes"
msgstr "Yderligere momsklasser"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:952
#: admin/woocommerce-admin-settings.php:961
msgid "List 1 per line. This is in addition to the default <em>Standard Rate</em>."
msgstr "List 1 pr. linje. Dette er i tillæg med standardindstillingen <em>Standardsats</em>."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:953
#: admin/woocommerce-admin-settings.php:962
msgid "List product and shipping tax classes here, e.g. Zero Tax, Reduced Rate."
msgstr "List produkt og forsendelsesmoms klasser her, fx ingen moms, reduceret sats."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:957
#: admin/woocommerce-admin-settings.php:966
#, php-format
msgid "Reduced Rate%sZero Rate"
msgstr "Reduceret sats%snulsats"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:961
#: admin/woocommerce-admin-settings.php:970
msgid "Tax rates"
msgstr "Momssatser"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:962
#: admin/woocommerce-admin-settings.php:971
msgid "All fields are required."
msgstr "Alle felter er påkrævet."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:963
#: admin/woocommerce-admin-settings.php:972
msgid "To avoid rounding errors, insert tax rates with 4 decimal places."
msgstr "For at undgå afrundingsfejl, indsæt momssatser med 4 decimaler."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:976
#: admin/woocommerce-admin-settings.php:985
msgid "Email Recipient Options"
msgstr "E-mail modtagerindstillinger"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:979
#: admin/woocommerce-admin-settings.php:988
msgid "New order notifications"
msgstr "Ny ordre notifikationer"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:980
#: admin/woocommerce-admin-settings.php:989
msgid "The recipient of new order emails. Defaults to the admin email."
msgstr "Modtageren af ny ordre e-mails. Standard til admin e-mail."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:988
#: admin/woocommerce-admin-settings.php:997
msgid "Inventory notifications"
msgstr "Beholdningsmeddelelser"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:989
#: admin/woocommerce-admin-settings.php:998
msgid "The recipient of stock emails. Defaults to the admin email."
msgstr "Modtageren af lager e-mails. Standard til admin e-mailen."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:998
#: admin/woocommerce-admin-settings.php:1007
msgid "Email Sender Options"
msgstr "E-mail sendeindstillinger"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:998
#: admin/woocommerce-admin-settings.php:1007
msgid "The following options affect the sender (email address and name) used in WooCommerce emails."
msgstr "Følgende indstillinger påvirker afsenderen (e-mailadresse og navn) brugt i WooCommerce e-mails."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1001
#: admin/woocommerce-admin-settings.php:1010
msgid "\"From\" name"
msgstr "Afsendernavn"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1010
#: admin/woocommerce-admin-settings.php:1019
msgid "\"From\" email address"
msgstr "Afsender e-mailadresse"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1020
#: admin/woocommerce-admin-settings.php:1029
msgid "Email template"
msgstr "E-mail template"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1020
#: admin/woocommerce-admin-settings.php:1029
#, php-format
msgid "This section lets you customise the WooCommerce emails. <a href=\"%s\" target=\"_blank\">Click here to preview your email template</a>. For more advanced control copy <code>woocommerce/templates/emails/</code> to <code>yourtheme/woocommerce/emails/</code>."
msgstr "Denne sektion lader dig konfigurerer WooCommerce e-mails. <a href=\"%s\" target=\"_blank\">Klik her for at se din e-mailtemplate</a>. For mere advanceret kontrol kopier <code>woocommerce/templates/emails/</code> til <code>dittema/woocommerce/emails/</code>."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1023
#: admin/woocommerce-admin-settings.php:1032
msgid "Header image"
msgstr "Header billede"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1024
#: admin/woocommerce-admin-settings.php:1033
#, php-format
msgid "Enter a URL to an image you want to show in the email's header. Upload your image using the <a href=\"%s\">media uploader</a>."
msgstr "Angiv en URL til billedet du vil vise i e-mail header'en. Upload dit billede ved at bruge <a href=\"%s\">Medie uploader</a>."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1032
#: admin/woocommerce-admin-settings.php:1041
msgid "Email footer text"
msgstr "E-mail footer tekst"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1033
#: admin/woocommerce-admin-settings.php:1042
msgid "The text to appear in the footer of WooCommerce emails."
msgstr "Teksten der vises i bunden af WooCommerce e-mails."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1037
#: admin/woocommerce-admin-settings.php:1046
msgid "Powered by WooCommerce"
msgstr "Leveret af WooCommerce"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1041
#: admin/woocommerce-admin-settings.php:1050
msgid "Base colour"
msgstr "Basis farve"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1042
#: admin/woocommerce-admin-settings.php:1051
msgid "The base colour for WooCommerce email templates. Default <code>#557da1</code>."
msgstr "Basisfarven for WooCommerce e-mail templates. Standard <code>#557da1</code>."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1050
#: admin/woocommerce-admin-settings.php:1059
msgid "Background colour"
msgstr "Baggrundsfarve"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1051
#: admin/woocommerce-admin-settings.php:1060
msgid "The background colour for WooCommerce email templates. Default <code>#eeeeee</code>."
msgstr "Baggrundsfarven for WooCommerce e-mail templates. Standard <code>#eeeeee</code>."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1059
#: admin/woocommerce-admin-settings.php:1068
msgid "Email body background colour"
msgstr "E-mail body baggrundsfarve"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1060
#: admin/woocommerce-admin-settings.php:1069
msgid "The main body background colour. Default <code>#fdfdfd</code>."
msgstr "Body baggrundsfarven. Standard <code>#fdfdfd</code>."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1068
#: admin/woocommerce-admin-settings.php:1077
msgid "Email body text colour"
msgstr "E-mail body tekst farve"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1069
#: admin/woocommerce-admin-settings.php:1078
msgid "The main body text colour. Default <code>#505050</code>."
msgstr "Body tekst farven. Standard <code>#505050</code>."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1082
#: admin/woocommerce-admin-settings.php:1091
msgid "ShareThis"
msgstr "ShareThis"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1082
#: admin/woocommerce-admin-settings.php:1091
msgid "ShareThis offers a sharing widget which will allow customers to share links to products with their friends."
msgstr "ShareThis tilbyder en delings widget, som tillader kunder at dele produktlinks til deres venner."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1085
#: admin/woocommerce-admin-settings.php:1094
msgid "ShareThis Publisher ID"
msgstr "ShareThis udgiver ID"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1086
#: admin/woocommerce-admin-settings.php:1095
#, php-format
msgid "Enter your %1$sShareThis publisher ID%2$s to show social sharing buttons on product pages."
msgstr "Angiv dit %1$sShareThis udgiver ID%2$s for at vise delingsknapper på produktsider."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1095
#: admin/woocommerce-admin-settings.php:1104
msgid "ShareDaddy"
msgstr "ShareDaddy"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1095
#: admin/woocommerce-admin-settings.php:1104
msgid "ShareDaddy is a sharing plugin bundled with JetPack."
msgstr "ShareDaddy er et delingsplugin bundtet med JetPack."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1098
#: admin/woocommerce-admin-settings.php:1107
msgid "Output ShareDaddy button?"
msgstr "Vis ShareDaddy knap?"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1099
#: admin/woocommerce-admin-settings.php:1108
msgid "Enable this option to show the ShareDaddy button (if installed) on the product page."
msgstr "Aktiver denne indstilling for at vise ShareDaddy knappen (hvis installeret) på produktsider."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1107
#: admin/woocommerce-admin-settings.php:1116
msgid "Google Analytics"
msgstr "Google Analytics"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1107
#: admin/woocommerce-admin-settings.php:1116
msgid "Google Analytics is a free service offered by Google that generates detailed statistics about the visitors to a website."
msgstr "Google Analytics er en gratis service leveret af Google, som genererer detaljeret statistik omkring besøg på en hjemmeside.."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1110
#: admin/woocommerce-admin-settings.php:1119
msgid "Google Analytics ID"
msgstr "Google Analytics ID"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1111
#: admin/woocommerce-admin-settings.php:1120
msgid "Log into your google analytics account to find your ID. e.g. <code>UA-XXXXX-X</code>"
msgstr "Log ind på din Google Analytics konto for at finde dit ID. Fx <code>UA-XXXXX-X</code>"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1118
#: admin/woocommerce-admin-settings.php:1126
#: admin/woocommerce-admin-settings.php:1127
#: admin/woocommerce-admin-settings.php:1135
msgid "Tracking code"
msgstr "Tracking kode"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1119
#: admin/woocommerce-admin-settings.php:1128
msgid "Add tracking code to your site's footer. You don't need to enable this if using a 3rd party analytics plugin."
msgstr "Tilføj tracking kode til din sides footer. Du behøver ikke aktivere dette, hvis du bruger et tredjeparts Analytics plugin."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1127
#: admin/woocommerce-admin-settings.php:1136
msgid "Add eCommerce tracking code to the thankyou page"
msgstr "Tilføj eCommerce tracking kode til takkesiden"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1194
#: admin/woocommerce-admin-settings.php:1204
msgid "Your settings have been saved."
msgstr "Dine indstillinger er blevet gemt."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1228
#: admin/woocommerce-admin-settings.php:1238
msgid "<strong>Congratulations!</strong> &#8211; WooCommerce has been installed and setup. Enjoy :)"
msgstr "<strong>Tillykke!</strong> &#8211; WooCommerce er blevet installeret og opsat. God fornøjelse :)"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1253
#: admin/woocommerce-admin-settings.php:1361
#: admin/woocommerce-admin-settings.php:1374
#: admin/woocommerce-admin-settings.php:1263
#: admin/woocommerce-admin-settings.php:1371
#: admin/woocommerce-admin-settings.php:1384
msgid "Payment Gateways"
msgstr "Betalings Gateways"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1272
#: admin/woocommerce-admin-settings.php:1282
#, php-format
msgid "More functionality and gateway options available via <a href=\"%s\" target=\"_blank\">WC official extensions</a>."
msgstr "Mere funktionalitet og flere gatewayindstillinger tilgængelige via <a href=\"%s\" target=\"_blank\">WC officielle udvidelser</a>."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1306
#: admin/woocommerce-admin-settings.php:1316
msgid "Shipping Methods"
msgstr "Forsendelsesmetoder"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1307
#: admin/woocommerce-admin-settings.php:1317
msgid "Your activated shipping methods are listed below. Drag and drop rows to re-order them for display on the frontend."
msgstr "Dine aktiverede fragtmetoder er listet nedenfor. Træk og slip rækker for at organisere dem til visning på brugerfladen."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1311
#: admin/woocommerce-admin-settings.php:1379
#: admin/woocommerce-admin-settings.php:1321
#: admin/woocommerce-admin-settings.php:1389
msgid "Default"
msgstr "Standard"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1312
#: admin/woocommerce-admin-settings.php:1322
msgid "Shipping Method"
msgstr "Forsendelsesmetode"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1313
#: admin/woocommerce-admin-settings.php:1381
#: admin/woocommerce-admin-settings.php:1323
#: admin/woocommerce-admin-settings.php:1391
#: admin/post-types/shop_order.php:34
msgid "Status"
msgstr "Status"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1328
#: admin/woocommerce-admin-settings.php:1338
msgid "Method ID"
msgstr "Metode ID"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1375
#: admin/woocommerce-admin-settings.php:1385
msgid "Your activated payment gateways are listed below. Drag and drop rows to re-order them for display on the checkout."
msgstr "Dine aktiverede betalings gateways er listet nedenfor. Træk og slip rækker for at organisere dem til visning ved kassen."
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1380
#: admin/woocommerce-admin-settings.php:1390
msgid "Gateway"
msgstr "Gateway"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1397
#: admin/woocommerce-admin-settings.php:1407
msgid "Gateway ID"
msgstr "Gateway ID"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1433
#: admin/woocommerce-admin-settings.php:1443
msgid "Save changes"
msgstr "Gem ændringer"
# @ woocommerce
#: admin/woocommerce-admin-settings.php:1488
#: admin/woocommerce-admin-settings.php:1498
msgid "The changes you made will be lost if you navigate away from this page."
msgstr "Ændringerne du har foretaget dig vil gå tabt hvis du navigerer væk fra denne side."
@ -5663,10 +5671,10 @@ msgstr "<a href=\"%s\" class=\"button\">%s</a> Du kan ikke tilføje den mængde
# @ woocommerce
#: classes/class-wc-cart.php:1468
#: classes/class-wc-order.php:462
#: classes/class-wc-product.php:598
#: classes/class-wc-product.php:607
#: classes/class-wc-product.php:638
#: classes/class-wc-product.php:644
#: classes/class-wc-product.php:625
#: classes/class-wc-product.php:634
#: classes/class-wc-product.php:665
#: classes/class-wc-product.php:671
msgid "Free!"
msgstr "Gratis!"
@ -5752,42 +5760,42 @@ msgid "is not a valid email address."
msgstr "er ikke en gyldig e-mail adresse."
# @ woocommerce
#: classes/class-wc-checkout.php:219
#: classes/class-wc-checkout.php:218
msgid "Please enter an account username."
msgstr "Indtast venligst et konto brugernavn."
# @ woocommerce
#: classes/class-wc-checkout.php:220
#: classes/class-wc-checkout.php:219
msgid "Please enter an account password."
msgstr "Indtast venligst en konto adgangskode."
# @ woocommerce
#: classes/class-wc-checkout.php:225
#: classes/class-wc-checkout.php:224
msgid "Invalid email/username."
msgstr "Ugyldig e-mail/brugernavn."
# @ woocommerce
#: classes/class-wc-checkout.php:227
#: classes/class-wc-checkout.php:226
msgid "An account is already registered with that username. Please choose another."
msgstr "En konto er allerede registreret med dette brugernavn. Vælg venligst et andet."
# @ woocommerce
#: classes/class-wc-checkout.php:232
#: classes/class-wc-checkout.php:231
msgid "An account is already registered with your email address. Please login."
msgstr "En konto er allerede registreret med din e-mail adresse. Log venligst ind."
# @ woocommerce
#: classes/class-wc-checkout.php:238
#: classes/class-wc-checkout.php:237
msgid "You must accept our Terms &amp; Conditions."
msgstr "Du skal acceptere vores betingelser &amp; vilkår."
# @ woocommerce
#: classes/class-wc-checkout.php:246
#: classes/class-wc-checkout.php:245
msgid "Invalid shipping method."
msgstr "Ugyldig forsendelsesmetode."
# @ woocommerce
#: classes/class-wc-checkout.php:255
#: classes/class-wc-checkout.php:254
msgid "Invalid payment method."
msgstr "Ugyldig betalingsmetode."
@ -7885,30 +7893,30 @@ msgid "Order item stock reduced successfully."
msgstr "Ordreprodukters lagerstatus reduceret korrekt."
# @ woocommerce
#: classes/class-wc-product.php:414
#: classes/class-wc-product.php:441
#, php-format
msgid "%s in stock"
msgstr "%s på lager"
# @ woocommerce
#: classes/class-wc-product.php:417
#: classes/class-wc-product.php:444
msgid "(backorders allowed)"
msgstr "(restordrer tilladt)"
# @ woocommerce
#: classes/class-wc-product.php:424
#: classes/class-wc-product.php:437
#: classes/class-wc-product.php:451
#: classes/class-wc-product.php:464
msgid "Available on backorder"
msgstr "Findes på restordre"
# @ woocommerce
#: classes/class-wc-product.php:658
#: classes/class-wc-product.php:685
msgctxt "min_price"
msgid "From:"
msgstr "Fra:"
# @ woocommerce
#: classes/class-wc-product.php:702
#: classes/class-wc-product.php:729
#, php-format
msgid "Rated %s out of 5"
msgstr "Vurderet %s ud af 5"
@ -8847,27 +8855,27 @@ msgid "Quantity"
msgstr "Antal"
# @ woocommerce
#: templates/cart/cart.php:35
#: templates/cart/cart.php:37
msgid "Remove this item"
msgstr "Fjern dette produkt"
# @ woocommerce
#: templates/cart/cart.php:50
#: templates/cart/cart.php:58
msgid "Available on backorder."
msgstr "Findes på restordre."
# @ woocommerce
#: templates/cart/cart.php:93
#: templates/cart/cart.php:105
msgid "Apply Coupon"
msgstr "Anvend kupon"
# @ woocommerce
#: templates/cart/cart.php:98
#: templates/cart/cart.php:110
msgid "Update Cart"
msgstr "Opdater indkøbskurv"
# @ woocommerce
#: templates/cart/cart.php:98
#: templates/cart/cart.php:110
msgid "Proceed to Checkout &rarr;"
msgstr "Gå til kassen &rarr;"
@ -9049,8 +9057,8 @@ msgstr "Betal for ordre"
# @ woocommerce
#: templates/checkout/form-shipping.php:25
msgid "Ship to same address?"
msgstr "Send til samme adresse?"
msgid "Ship to billing address?"
msgstr "Send til faktureringsadresse?"
# @ woocommerce
#: templates/checkout/form-shipping.php:52

View File

@ -28,8 +28,8 @@ Keep a birds-eye view of incoming sales and reviews, stock levels and general st
= FEATURES =
Seriously, WooCommerce has got more features than you can shake a stick at. But dont just take our word for it, try it for yourself.
= BUNDLED GATEWAYS AND SHIPPING =
WooCommerce has enough power to be used straight out of the box and comes with the following payment gateways and shipping methods:
= BUNDLED GATEWAYS, SHIPPING AND INTEGRATIONS =
WooCommerce has enough power to be used straight out of the box and comes with the following payment gateways, shipping methods and third party integrations:
* PayPal Standard
* BACS
@ -40,6 +40,10 @@ WooCommerce has enough power to be used straight out of the box and comes with t
* International delivery
* Local delivery
* Local Pickup
* Google Analytics
* Sharedaddy
* ShareThis
* ShareYourCart
= EXTENSIONS =
Need a specific payment gateway? Perhaps additional shipping methods? WooCommerce has a plethora of eCommerce extensions available to provide just that: [View our extensions](http://www.woothemes.com/extensions/woocommerce-extensions/ "eCommerce extensions for WooCommerce from WooThemes").
@ -144,18 +148,38 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
== Changelog ==
= 1.5.5 =
* Feature - Settings now include colours for things like buttons and tabs.
* Feature - New integration section which allows other class-based integrations to be added.
* Feature - ShareYourCart integration built in.
* Feature - is_sold_individually() function for disabling quantity inputs for products
* Feature - Collect shipping address even when not required option
* Feature - Stock display options - show no stock amount, low stock amount, or always show stock amount
* Feature - woocommerce_form_field select type
* Tweak - Removed nonces from add to cart urls, this makes them easier to make use of; you can hardcode add to cart links or link to your add to cart link from other places without needing to use WC functions.
* Tweak - Cart.php display with more filters
* Tweak - is_product_category and is_product_tag support term argument
* Tweak - Added minus symbol before discount on view order page
* Tweak - Added yards as dimensions unit
* Tweak - Allow more readable flat rate options to be entered
* Tweak - Changed category and tag link to filter product list in admin panel
* Tweak - Removed product 'exists' variable in favour of the exists() method. Tweaked exist method to look for ID in DB.
* Tweak - Only use rm=2 for paypal when SSL is enabled, to avoid security warnings when returning to the site.
* Tweak - Show sku in stock reports.
* Tweak - When sending the order as a whole to paypal, send the shipping separately.
* Tweak - Clear cache along with transients
* Tweak - Protocol-relative AJAX URL
* Tweak - Hidden some uncommon settings
* Tweak - Fixed labels for settings API.
* Tweak - New WC_Order Class Formatting Filters and Function for totals (thanks thenbrent)
* Fix - Replacing use of deprecated function get_current_theme() with wp_get_theme()
* Fix - Body classes now correct for WordPress themes with non alphanumeric characters
* Fix - PayPal http_build_query &amp; -> & on some PHP 5.3 servers
* Fix - update_count_callback for tags
* Fix - Pass shipping calc state to checkout
* Fix - Removed space from postcode validation
* Fix - per product flat rate.
* Fix - Use term_id instead of term slug to get term link (allows numeric slugs for product categories)
* Fix - Replace spaces with + signs in download url after decode (allows + characters in email addresses for downloads)
* Localization - Slovak translation by Dušan Beleščák
* Localization - Updated localisations

View File

@ -79,7 +79,7 @@ function woocommerce_pay() {
</li>
<li class="total">
<?php _e('Total:', 'woocommerce'); ?>
<strong><?php echo woocommerce_price($order->order_total); ?></strong>
<strong><?php echo $order->get_formatted_order_total(); ?></strong>
</li>
<?php if ($order->payment_method_title) : ?>
<li class="method">

View File

@ -72,14 +72,16 @@ global $woocommerce;
<td class="product-quantity">
<?php
if ( $_product->is_sold_individually() ) {
echo '1';
$product_quantity = '1';
} else {
$data_min = apply_filters( 'woocommerce_cart_item_data_min', '', $_product );
$data_max = ( $_product->backorders_allowed() ) ? '' : $_product->get_stock_quantity();
$data_max = apply_filters( 'woocommerce_cart_item_data_max', $data_max, $_product );
printf( '<div class="quantity"><input name="cart[%s][qty]" data-min="%s" data-max="%s" value="%s" size="4" title="Qty" class="input-text qty text" maxlength="12" /></div>', $cart_item_key, $data_min, $data_max, esc_attr( $values['quantity'] ) );
$product_quantity = sprintf( '<div class="quantity"><input name="cart[%s][qty]" data-min="%s" data-max="%s" value="%s" size="4" title="Qty" class="input-text qty text" maxlength="12" /></div>', $cart_item_key, $data_min, $data_max, esc_attr( $values['quantity'] ) );
}
echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key );
?>
</td>
@ -102,7 +104,11 @@ global $woocommerce;
<?php if ( get_option( 'woocommerce_enable_coupons' ) == 'yes' ) { ?>
<div class="coupon">
<label for="coupon_code"><?php _e('Coupon', 'woocommerce'); ?>:</label> <input name="coupon_code" class="input-text" id="coupon_code" value="" /> <input type="submit" class="button" name="apply_coupon" value="<?php _e('Apply Coupon', 'woocommerce'); ?>" />
<?php do_action('woocommerce_cart_coupon'); ?>
</div>
<?php } ?>

View File

@ -7,7 +7,7 @@ if ( get_option( 'woocommerce_enable_coupons' ) == 'no' || get_option( 'woocomme
$info_message = apply_filters('woocommerce_checkout_coupon_message', __('Have a coupon?', 'woocommerce'));
?>
<p class="info"><?php echo $info_message; ?> <a href="#" class="showcoupon"><?php _e('Click here to enter your code', 'woocommerce'); ?></a></p>
<p class="woocommerce_info"><?php echo $info_message; ?> <a href="#" class="showcoupon"><?php _e('Click here to enter your code', 'woocommerce'); ?></a></p>
<form class="checkout_coupon" method="post">

View File

@ -8,6 +8,6 @@ if (get_option('woocommerce_enable_signup_and_login_from_checkout')=="no") retur
$info_message = apply_filters('woocommerce_checkout_login_message', __('Already registered?', 'woocommerce'));
?>
<p class="info"><?php echo $info_message; ?> <a href="#" class="showlogin"><?php _e('Click here to login', 'woocommerce'); ?></a></p>
<p class="woocommerce_info"><?php echo $info_message; ?> <a href="#" class="showlogin"><?php _e('Click here to login', 'woocommerce'); ?></a></p>
<?php woocommerce_login_form( array( 'message' => __('If you have shopped with us before, please enter your username and password in the boxes below. If you are a new customer please proceed to the Billing &amp; Shipping section.', 'woocommerce'), 'redirect' => get_permalink(woocommerce_get_page_id('checkout')) ) ); ?>

View File

@ -5,10 +5,10 @@
global $woocommerce;
?>
<?php if ( $woocommerce->cart->needs_shipping() && ! $woocommerce->cart->ship_to_billing_address_only() ) : ?>
<?php if ( ( $woocommerce->cart->needs_shipping() || get_option('woocommerce_require_shipping_address') == 'yes' ) && ! $woocommerce->cart->ship_to_billing_address_only() ) : ?>
<?php
if (!isset($_POST) || !$_POST) :
if ( empty( $_POST ) ) :
$shiptobilling = (get_option('woocommerce_ship_to_same_address')=='yes') ? 1 : 0;
$shiptobilling = apply_filters('woocommerce_shiptobilling_default', $shiptobilling);
@ -22,7 +22,7 @@ global $woocommerce;
<p class="form-row" id="shiptobilling">
<input id="shiptobilling-checkbox" class="input-checkbox" <?php checked($shiptobilling, 1); ?> type="checkbox" name="shiptobilling" value="1" />
<label for="shiptobilling-checkbox" class="checkbox"><?php _e('Ship to same address?', 'woocommerce'); ?></label>
<label for="shiptobilling-checkbox" class="checkbox"><?php _e('Ship to billing address?', 'woocommerce'); ?></label>
</p>
<h3><?php _e('Shipping Address', 'woocommerce'); ?></h3>

View File

@ -42,7 +42,7 @@ global $woocommerce;
</li>
<li class="total">
<?php _e('Total:', 'woocommerce'); ?>
<strong><?php echo woocommerce_price($order->order_total); ?></strong>
<strong><?php echo $order->get_formatted_order_total(); ?></strong>
</li>
<?php if ($order->payment_method_title) : ?>
<li class="method">

View File

@ -35,18 +35,7 @@ foreach ($items as $item) :
?></td>
<td style="text-align:left; vertical-align:middle; border: 1px solid #eee;"><?php echo $item['qty'] ;?></td>
<td style="text-align:left; vertical-align:middle; border: 1px solid #eee;"><?php
// Tax
if ( $order->display_cart_ex_tax || !$order->prices_include_tax ) :
$ex_tax_label = ( $order->prices_include_tax ) ? 1 : 0;
echo woocommerce_price( $order->get_line_subtotal( $item ), array('ex_tax_label' => $ex_tax_label ));
else :
echo woocommerce_price( $order->get_line_subtotal( $item, true ) );
endif;
?></td>
<td style="text-align:left; vertical-align:middle; border: 1px solid #eee;"><?php echo $order->get_formatted_line_subtotal( $item ); ?></td>
</tr>
<?php if ($show_purchase_note && $purchase_note = get_post_meta( $_product->id, '_purchase_note', true)) : ?>

View File

@ -46,7 +46,7 @@ if (!isset($woocommerce_loop['columns']) || !$woocommerce_loop['columns']) $wooc
endwhile; endif;
if ($woocommerce_loop['loop']==0) echo '<li class="info">'.__('No products found which match your selection.', 'woocommerce').'</li>';
if ($woocommerce_loop['loop']==0) echo '<li class="woocommerce_info">'.__('No products found which match your selection.', 'woocommerce').'</li>';
?>

View File

@ -44,7 +44,7 @@ if ($customer_orders) :
<a href="<?php echo esc_url( add_query_arg('order', $order->id, get_permalink(woocommerce_get_page_id('view_order'))) ); ?>"><?php echo $order->get_order_number(); ?></a> &ndash; <time title="<?php echo esc_attr( strtotime($order->order_date) ); ?>"><?php echo date_i18n(get_option('date_format'), strtotime($order->order_date)); ?></time>
</td>
<td class="order-shipto"><address><?php if ($order->get_formatted_shipping_address()) echo $order->get_formatted_shipping_address(); else echo '&ndash;'; ?></address></td>
<td class="order-total" width="1%"><?php echo woocommerce_price($order->order_total); ?></td>
<td class="order-total" width="1%"><?php echo $order->get_formatted_order_total(); ?></td>
<td class="order-status" style="text-align:left; white-space:nowrap;">
<?php echo ucfirst( __( $status->name, 'woocommerce' ) ); ?>
<?php if (in_array($order->status, array('pending', 'failed'))) : ?>

View File

@ -1,25 +1,9 @@
<?php
/**
* Single Product Share
*
* Sharing plugins can hook into here or you can add your own code directly.
*/
?>
<?php if (get_option('woocommerce_sharethis')) : ?>
<div class="social">
<iframe src="https://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>
<span class="st_twitter"></span><span class="st_email"></span><span class="st_sharethis"></span><span class="st_plusone_button"></span>
</div>
<?php $sharethis = (is_ssl()) ? 'https://ws.sharethis.com/button/buttons.js' : 'http://w.sharethis.com/button/buttons.js'; ?>
<script type="text/javascript">var switchTo5x=true;</script><script type="text/javascript" src="<?php echo $sharethis; ?>"></script>
<script type="text/javascript">stLight.options({publisher:"<?php echo get_option('woocommerce_sharethis'); ?>"});</script>
<?php endif; ?>
<?php if (get_option('woocommerce_sharedaddy') && function_exists('sharing_display')) : ?>
<div class="social"><?php echo sharing_display(); ?></div>
<?php endif; ?>
<?php do_action('woocommerce_share'); // Sharing plugins can hook into here ?>

View File

@ -9,7 +9,7 @@ $show_attr = ( get_option( 'woocommerce_enable_dimension_product_attributes' ) =
if ( $product->has_attributes() || ( $show_attr && $product->has_dimensions() ) || ( $show_attr && $product->has_weight() ) ) {
?>
<div class="panel" id="tab-attributes">
<div class="panel entry-content" id="tab-attributes">
<?php $heading = apply_filters('woocommerce_product_additional_information_heading', __('Additional Information', 'woocommerce')); ?>

View File

@ -6,7 +6,7 @@
global $woocommerce, $post;
if ( $post->post_content ) : ?>
<div class="panel" id="tab-description">
<div class="panel entry-content" id="tab-description">
<?php $heading = apply_filters('woocommerce_product_description_heading', __('Product Description', 'woocommerce')); ?>

View File

@ -6,7 +6,7 @@
global $woocommerce, $post;
if ( comments_open() ) : ?>
<div class="panel" id="tab-reviews">
<div class="panel entry-content" id="tab-reviews">
<?php comments_template(); ?>

View File

@ -4,7 +4,7 @@ $show_attr = ( get_option( 'woocommerce_enable_dimension_product_attributes' ) =
if ( $product->has_attributes() || ( $show_attr && $product->has_dimensions() ) || ( $show_attr && $product->has_weight() ) ) {
?>
<li><a href="#tab-attributes"><?php _e('Additional Information', 'woocommerce'); ?></a></li>
<li class="attributes_tab"><a href="#tab-attributes"><?php _e('Additional Information', 'woocommerce'); ?></a></li>
<?php
}
?>

View File

@ -1,5 +1,5 @@
<?php global $post;
if ( $post->post_content ) : ?>
<li><a href="#tab-description"><?php _e('Description', 'woocommerce'); ?></a></li>
<li class="description_tab"><a href="#tab-description"><?php _e('Description', 'woocommerce'); ?></a></li>
<?php endif; ?>

View File

@ -3,4 +3,4 @@
* Single Product Title
*/
?>
<h1 itemprop="name" class="product_title page-title"><?php the_title(); ?></h1>
<h1 itemprop="name" class="product_title entry-title"><?php the_title(); ?></h1>

View File

@ -37,9 +37,11 @@ wp_delete_post( get_option('woocommerce_pay_page_id'), true );
wp_delete_post( get_option('woocommerce_thanks_page_id'), true );
// Tables
$wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."woocommerce_attribute_taxonomies");
$wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."woocommerce_downloadable_product_permissions");
$wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."woocommerce_termmeta");
$wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "woocommerce_attribute_taxonomies" );
$wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "woocommerce_downloadable_product_permissions" );
$wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "woocommerce_termmeta" );
$wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->base_prefix . "shareyourcart_tokens" );
$wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->base_prefix . "shareyourcart_coupons" );
// Delete options
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'woocommerce_%';");

View File

@ -200,13 +200,13 @@ if (!function_exists('is_shop')) {
}
}
if (!function_exists('is_product_category')) {
function is_product_category() {
return is_tax( 'product_cat' );
function is_product_category( $term = '' ) {
return is_tax( 'product_cat', $term );
}
}
if (!function_exists('is_product_tag')) {
function is_product_tag() {
return is_tax( 'product_tag' );
function is_product_tag( $term = '' ) {
return is_tax( 'product_tag', $term );
}
}
if (!function_exists('is_product')) {
@ -528,9 +528,37 @@ if (!function_exists('woocommerce_hex_lighter')) {
return $color;
}
}
/**
* Detect if we should use a light or dark colour on a background colour
**/
if (!function_exists('woocommerce_light_or_dark')) {
function woocommerce_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) {
return (hexdec($color) > 0xffffff/2) ? $dark : $light;
//return ( hexdec( $color ) > 0xffffff / 2 ) ? $dark : $light;
$hex = str_replace( '#', '', $color );
$c_r = hexdec( substr( $hex, 0, 2 ) );
$c_g = hexdec( substr( $hex, 2, 2 ) );
$c_b = hexdec( substr( $hex, 4, 2 ) );
$brightness = ( ( $c_r * 299 ) + ( $c_g * 587 ) + ( $c_b * 114 ) ) / 1000;
return $brightness > 155 ? $dark : $light;
}
}
/**
* Format string as hex
**/
if (!function_exists('woocommerce_format_hex')) {
function woocommerce_format_hex( $hex ) {
$hex = trim( str_replace( '#', '', $hex ) );
if ( strlen( $hex ) == 3 ) {
$hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
}
if ( $hex ) return '#' . $hex;
}
}
@ -878,8 +906,9 @@ function woocommerce_order_terms( $the_term, $next_id, $taxonomy, $index=0, $ter
if( $term_in_level && null === $next_id )
$index = woocommerce_set_term_order($id, $index+1, $taxonomy, true);
return $index;
wp_cache_flush();
return $index;
}
/**

View File

@ -168,7 +168,7 @@ function woocommerce_list_pages($pages){
**/
function woocommerce_nav_menu_items( $items, $args ) {
if ( get_option('woocommerce_menu_logout_link')=='yes' && strstr($items, get_permalink(woocommerce_get_page_id('myaccount'))) && is_user_logged_in() ) :
$items .= '<li><a href="'. wp_logout_url(home_url()) .'">'.__('Logout', 'woocommerce').'</a></li>';
$items .= '<li class="logout"><a href="'. wp_logout_url(home_url()) .'">'.__('Logout', 'woocommerce').'</a></li>';
endif;
return $items;
@ -261,7 +261,7 @@ function woocommerce_update_cart_action() {
function woocommerce_add_to_cart_action( $url = false ) {
global $woocommerce;
if (empty($_REQUEST['add-to-cart']) || !$woocommerce->verify_nonce('add_to_cart', '_REQUEST')) return;
if ( empty( $_REQUEST['add-to-cart'] ) ) return;
$added_to_cart = false;
@ -797,7 +797,7 @@ function woocommerce_download_product() {
$download_file = (int) urldecode($_GET['download_file']);
$order_key = urldecode( $_GET['order'] );
$email = urldecode( $_GET['email'] );
$email = str_replace( ' ', '+', urldecode( $_GET['email'] ) );
if (!is_email($email)) :
wp_die( __('Invalid email address.', 'woocommerce') . ' <a href="'.home_url().'">' . __('Go to homepage &rarr;', 'woocommerce') . '</a>' );
@ -1033,136 +1033,6 @@ function woocommerce_download_product() {
endif;
}
/**
* Google Analytics standard tracking
**/
function woocommerce_google_tracking() {
global $woocommerce;
if ( is_admin() || current_user_can('manage_options') || get_option('woocommerce_ga_standard_tracking_enabled') == "no" ) return;
$tracking_id = get_option('woocommerce_ga_id');
if ( ! $tracking_id ) return;
$loggedin = ( is_user_logged_in() ) ? 'yes' : 'no';
if ( is_user_logged_in() ) {
$user_id = get_current_user_id();
$current_user = get_user_by('id', $user_id);
$username = $current_user->user_login;
} else {
$user_id = '';
$username = __('Guest', 'woocommerce');
}
?>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(
['_setAccount', '<?php echo $tracking_id; ?>'],
['_setCustomVar', 1, 'logged-in', '<?php echo $loggedin; ?>', 1],
['_setCustomVar', 2, 'user-id', '<?php echo $user_id; ?>', 1],
['_setCustomVar', 3, 'username', '<?php echo $username; ?>', 1],
['_trackPageview']
);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<?php
}
/**
* Google Analytics eCommerce tracking
**/
function woocommerce_ecommerce_tracking( $order_id ) {
global $woocommerce;
if ( is_admin() || current_user_can('manage_options') || get_option('woocommerce_ga_ecommerce_tracking_enabled') == "no" ) return;
$tracking_id = get_option('woocommerce_ga_id');
if ( ! $tracking_id ) return;
// Doing eCommerce tracking so unhook standard tracking from the footer
remove_action('wp_footer', 'woocommerce_google_tracking');
// Get the order and output tracking code
$order = new WC_Order($order_id);
$loggedin = (is_user_logged_in()) ? 'yes' : 'no';
if (is_user_logged_in()) {
$user_id = get_current_user_id();
$current_user = get_user_by('id', $user_id);
$username = $current_user->user_login;
} else {
$user_id = '';
$username = __('Guest', 'woocommerce');
}
?>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(
['_setAccount', '<?php echo $tracking_id; ?>'],
['_setCustomVar', 1, 'logged-in', '<?php echo $loggedin; ?>', 1],
['_setCustomVar', 2, 'user-id', '<?php echo $user_id; ?>', 1],
['_setCustomVar', 3, 'username', '<?php echo $username; ?>', 1],
['_trackPageview']
);
_gaq.push(['_addTrans',
'<?php echo $order_id; ?>', // order ID - required
'<?php bloginfo('name'); ?>', // affiliation or store name
'<?php echo $order->order_total; ?>', // total - required
'<?php echo $order->get_total_tax(); ?>', // tax
'<?php echo $order->get_shipping(); ?>', // shipping
'<?php echo $order->billing_city; ?>', // city
'<?php echo $order->billing_state; ?>', // state or province
'<?php echo $order->billing_country; ?>' // country
]);
// Order items
<?php if ($order->get_items()) foreach($order->get_items() as $item) : $_product = $order->get_product_from_item( $item ); ?>
_gaq.push(['_addItem',
'<?php echo $order_id; ?>', // order ID - required
'<?php if (!empty($_product->sku))
echo __('SKU:', 'woocommerce') . ' ' . $_product->sku;
else
echo $_product->id;
?>', // SKU/code - required
'<?php echo $item['name']; ?>', // product name
'<?php if (isset($_product->variation_data)){
echo woocommerce_get_formatted_variation( $_product->variation_data, true );
} else {
$out = array();
$categories = get_the_terms($_product->id, 'product_cat');
foreach ( $categories as $category ){
$out[] = $category->name;
}
echo join( "/", $out);
}
?>', // category or variation
'<?php echo ($item['line_total']/$item['qty']); ?>', // unit price - required
'<?php echo $item['qty']; ?>' // quantity - required
]);
<?php endforeach; ?>
_gaq.push(['_trackTrans']); // submits transaction to the Analytics servers
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<?php
}
/**
* ecommerce tracking with piwik
*/

View File

@ -137,8 +137,6 @@ add_action( 'init', 'woocommerce_process_registration' );
add_action('init', 'woocommerce_download_product');
/* Analytics */
add_action( 'wp_footer', 'woocommerce_google_tracking' );
add_action( 'woocommerce_thankyou', 'woocommerce_ecommerce_tracking' );
add_action( 'woocommerce_thankyou', 'woocommerce_ecommerce_tracking_piwik' );
/* RSS Feeds */

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
* Plugin Name: WooCommerce
* Plugin URI: http://www.woothemes.com/woocommerce/
* Description: An e-commerce toolkit that helps you sell anything. Beautifully.
* Version: 1.5.4
* Version: 1.5.5
* Author: WooThemes
* Author URI: http://woothemes.com
* Requires at least: 3.3
@ -32,7 +32,7 @@ class Woocommerce {
/** Version ***************************************************************/
var $version = '1.5.4';
var $version = '1.5.5';
/** URLS ******************************************************************/
@ -55,6 +55,7 @@ class Woocommerce {
var $countries;
var $woocommerce_email;
var $checkout;
var $integrations;
/** Taxonomies ************************************************************/
@ -111,11 +112,17 @@ class Woocommerce {
include( 'classes/class-wc-product.php' ); // Product class
include( 'classes/class-wc-product-variation.php' ); // Product variation class
include( 'classes/class-wc-tax.php' ); // Tax class
include( 'classes/class-wc-settings-api.php' ); // Settings API
// Include shipping modules and gateways
include( 'classes/class-wc-settings-api.php' );
// Include Core Payment Gateways
include( 'classes/gateways/class-wc-payment-gateways.php' );
include( 'classes/gateways/class-wc-payment-gateway.php' );
include( 'classes/gateways/class-wc-bacs.php' );
include( 'classes/gateways/class-wc-cheque.php' );
include( 'classes/gateways/class-wc-paypal.php' );
include( 'classes/gateways/class-wc-cod.php' );
// Include Core Shipping Methods
include( 'classes/shipping/class-wc-shipping.php' );
include( 'classes/shipping/class-wc-shipping-method.php' );
include( 'classes/shipping/class-wc-flat-rate.php' );
@ -123,10 +130,14 @@ class Woocommerce {
include( 'classes/shipping/class-wc-free-shipping.php' );
include( 'classes/shipping/class-wc-local-delivery.php' );
include( 'classes/shipping/class-wc-local-pickup.php' );
include( 'classes/gateways/class-wc-bacs.php' );
include( 'classes/gateways/class-wc-cheque.php' );
include( 'classes/gateways/class-wc-paypal.php' );
include( 'classes/gateways/class-wc-cod.php' );
// Include Core Integrations
include( 'classes/integrations/class-wc-integration.php' );
include( 'classes/integrations/class-wc-integrations.php' );
include( 'classes/integrations/google-analytics/class-wc-google-analytics.php' );
include( 'classes/integrations/sharethis/class-wc-sharethis.php' );
include( 'classes/integrations/sharedaddy/class-wc-sharedaddy.php' );
include( 'classes/integrations/shareyourcart/class-wc-shareyourcart.php' );
}
/**
@ -187,10 +198,12 @@ class Woocommerce {
$this->payment_gateways = new WC_Payment_gateways(); // Payment gateways. Loads and stores payment methods
$this->shipping = new WC_Shipping(); // Shipping class. loads and stores shipping methods
$this->countries = new WC_Countries(); // Countries class
$this->integrations = new WC_Integrations(); // Integrations class
// Init shipping and payment gateways
// Init shipping, payment gateways, and integrations
$this->shipping->init();
$this->payment_gateways->init();
$this->integrations->init();
// Classes/actions loaded for the frontend and for ajax requests
if ( ! is_admin() || defined('DOING_AJAX') ) {
@ -377,6 +390,12 @@ class Woocommerce {
if ( isset( $_SERVER['QUERY_STRING'] ) )
$_SERVER['REQUEST_URI'].='?'.$_SERVER['QUERY_STRING'];
}
// NGINX Proxy
if ( ! isset( $_SERVER['REMOTE_ADDR'] ) && isset( $_SERVER['HTTP_REMOTE_ADDR'] ) )
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_REMOTE_ADDR'];
if ( ! isset( $_SERVER['HTTPS'] ) && ! empty( $_SERVER['HTTP_HTTPS'] ) )
$_SERVER['HTTPS'] = $_SERVER['HTTP_HTTPS'];
}
/**
@ -1047,11 +1066,7 @@ class Woocommerce {
* Ajax URL
*/
function ajax_url() {
$url = admin_url( 'admin-ajax.php' );
$url = ( is_ssl() ) ? $url : str_replace( 'https', 'http', $url );
return $url;
return str_replace( array('https:', 'http:'), '', admin_url( 'admin-ajax.php' ) );
}
/**
@ -1351,6 +1366,8 @@ class Woocommerce {
$wpdb->query("DELETE FROM `$wpdb->options` WHERE `option_name` LIKE ('_transient_wc_product_total_stock_%')");
$wpdb->query("DELETE FROM `$wpdb->options` WHERE `option_name` LIKE ('_transient_wc_average_rating_%')");
}
wp_cache_flush();
}
/** Body Classes **********************************************************/