Completed
Push — master ( 164033...8b1af5 )
by Justin
07:24
created

css.php ➔ wpsc_is_style_enabled()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
add_action( 'wp_enqueue_scripts'        , '_wpsc_te2_enqueue_styles', 1 );
4
5
function _wpsc_te2_enqueue_styles() {
6
	wp_register_style( 'wpsc-common', wpsc_locate_asset_uri( 'css/common.css' ), array(), WPSC_VERSION );
7
8
	do_action( 'wpsc_register_styles' );
9
10
	wpsc_enqueue_style( 'wpsc-common' );
11
12
	if ( apply_filters( 'wpsc_add_inline_style', true ) ) {
13
		wp_add_inline_style( 'wpsc-common', _wpsc_get_inline_style() );
14
	}
15
16
	do_action( 'wpsc_enqueue_styles' );
17
}
18
19
/**
20
 * Inline style that ensure the product summary's width take the thumbnail width
21
 * into consideration.
22
 *
23
 * @access private
24
 * @since  0.1
25
 *
26
 * @return string CSS output
27
 */
28
function _wpsc_get_inline_style() {
29
	$archive_width     = get_option( 'product_image_width' );
30
	$single_width      = get_option( 'single_view_image_width' );
31
	$tax_width         = get_option( 'category_image_width' );
32
	$thumbnail_padding = apply_filters( 'wpsc_thumbnail_padding', 15 );
33
34
	ob_start();
35
	?>
36
	.wpsc-page-main-store .wpsc-product-summary {
37
		width: -moz-calc(100% - <?php echo $archive_width + $thumbnail_padding; ?>px);
38
		width: -webkit-calc(100% - <?php echo $archive_width + $thumbnail_padding; ?>px);
39
		width: calc(100% - <?php echo $archive_width + $thumbnail_padding; ?>px);
40
	}
41
42
	.wpsc-page-single .wpsc-product-summary {
43
		width: -moz-calc(100% - <?php echo $single_width + $thumbnail_padding; ?>px);
44
		width: -webkit-calc(100% - <?php echo $single_width + $thumbnail_padding; ?>px);
45
		width: calc(100% - <?php echo $single_width + $thumbnail_padding; ?>px);
46
	}
47
48
	.wpsc-page-taxonomy .wpsc-product-summary {
49
		width: -moz-calc(100% - <?php echo $tax_width + $thumbnail_padding; ?>px);
50
		width: -webkit-calc(100% - <?php echo $tax_width + $thumbnail_padding; ?>px);
51
		width: calc(100% - <?php echo $tax_width + $thumbnail_padding; ?>px);
52
	}
53
	<?php
54
	return ob_get_clean();
55
}
56