PluginProbe
Gutenify – Visual Site Builder Blocks & Starter Templates / 0.0.2
Gutenify – Visual Site Builder Blocks & Starter Templates v0.0.2
1.9.0 1.8.0 1.7.0 1.6.6 1.6.5 1.6.4 trunk 0.0.1 0.0.2 0.0.3 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 All 74 releases
gutenify / inc / blocks / count-down / frontend / style.php

style.php in Gutenify – Visual Site Builder Blocks & Starter Templates 0.0.2, at inc/blocks/count-down/frontend/style.php

102 lines 4.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Gutenify Count Down Block style file.
4 *
5 * @package Gutenify
6 */
7
8 // Exit if accessed directly.
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 function gutenify_count_down_style( $blockId, $attributes ){
14 $containerWidthKey = 'containerWidth';
15
16 // Wrapper Styles.
17 $containerDesktopWidth = ! empty( $attributes[ $containerWidthKey ]['desktop']['value'] ) ? absint( $attributes[ $containerWidthKey ]['desktop']['value'] ) : '';
18 $containerDesktopWidthUnit = ! empty( $attributes[ $containerWidthKey ]['desktop']['unit'] ) ? $attributes[ $containerWidthKey ]['desktop']['unit'] : '%';
19
20 $containerTabletWidth = ! empty( $attributes[ $containerWidthKey ]['tablet']['value'] ) ? absint( $attributes[ $containerWidthKey ]['tablet']['value'] ) : '';
21 $containerTabletWidthUnit = ! empty( $attributes[ $containerWidthKey ]['tablet']['unit'] ) ? $attributes[ $containerWidthKey ]['tablet']['unit'] : '%';
22
23 $containerMobileWidth = ! empty( $attributes[ $containerWidthKey ]['mobile']['value'] ) ? absint( $attributes[ $containerWidthKey ]['mobile']['value'] ) : '';
24 $containerMobileWidthUnit = ! empty( $attributes[ $containerWidthKey ]['mobile']['unit'] ) ? $attributes[ $containerWidthKey ]['mobile']['unit'] : '%';
25
26 // Positon
27 $counterPosition = ! empty( $attributes['counterPosition'] ) ? $attributes['counterPosition'] : 'center';
28 $counterPositionRight = 'center' === $counterPosition || 'right' === $counterPosition ? 'auto' : 0;
29 $counterPositionLeft = 'center' === $counterPosition || 'left' === $counterPosition ? 'auto' : 0;
30
31 // Box Background
32 $boxBackgroundColor = ! empty( $attributes['backgroundAttrs']['color'] ) ? $attributes['backgroundAttrs']['color'] : '#fff';
33 $boxBorderColor = ! empty( $attributes['borderAttrs']['color'] ) ? $attributes['borderAttrs']['color'] : '#fff';
34 $boxBorderWidth = ! empty( $attributes['borderAttrs']['width'] ) ? $attributes['borderAttrs']['width'] : 0;
35
36 // Digit style
37 $digitFontFamily = ! empty( $attributes['digitAttrs']['typography']['fontFamily'] ) ? $attributes['digitAttrs']['typography']['fontFamily'] . ', sans-serif' : false;
38 $digitColor = ! empty( $attributes['digitAttrs']['color'] ) ? $attributes['digitAttrs']['color'] : false;
39 $titleColor = ! empty( $attributes['titleAttrs']['color'] ) ? $attributes['titleAttrs']['color'] : false;
40
41 return '#' . $blockId . ' {
42 '. ( ! empty( $containerDesktopWidth ) ? 'width: ' . $containerDesktopWidth . $containerDesktopWidthUnit.';' : '' ).'
43 margin-top: 0;
44 margin-bottom: 0;
45 margin-right: ' . $counterPositionLeft . ';
46 margin-left: ' . $counterPositionRight . ';
47 }
48
49 #' . $blockId . ' .time-part{
50 background: '.$boxBackgroundColor.';
51 border:'.$boxBorderWidth.'px solid '.$boxBorderColor.';
52 margin-left:'. ( ! empty( $attributes['boxSpacing']['desktop']['value'] ) ? $attributes['boxSpacing']['desktop']['value'].'px;' : '0' ).';
53 }
54
55 #' . $blockId . ' .time-part:first-child{
56 margin-left:0;
57 }
58
59 #' . $blockId . ' .time-part span{
60 ' . Gutenify_Helpers::typography_style( $attributes['digitAttrs']['typography'], 'desktop' ) . '
61 ' . ( ! empty( $digitColor ) ? 'color: ' . $digitColor . ';' : '' ) . '
62 }
63
64 #' . $blockId . ' .time-part .smalltext{
65 ' . Gutenify_Helpers::typography_style( $attributes['titleAttrs']['typography'], 'desktop' ) . '
66 ' . ( ! empty( $titleColor ) ? 'color: ' . $titleColor . ';' : '' ) . '
67 }
68
69 @media only screen and (max-width: 768px) {
70 #' . $blockId . ' {
71 '. ( ! empty( $containerTabletWidth ) ? 'width: ' . $containerTabletWidth . $containerTabletWidthUnit.';' : '' ).'
72 }
73
74 #' . $blockId . ' .time-part{
75 margin-left:'. ( ! empty( $attributes['boxSpacing']['tablet']['value'] ) ? $attributes['boxSpacing']['tablet']['value'].'px;' : '0' ).';
76 }
77
78
79 #' . $blockId . ' .time-part span{
80 ' . Gutenify_Helpers::typography_style( $attributes['digitAttrs']['typography'], 'tablet' ) . '
81 }
82
83 #' . $blockId . ' .time-part .smalltext{
84 ' . Gutenify_Helpers::typography_style( $attributes['titleAttrs']['typography'], 'tablet' ) . '
85 }
86 }
87 @media only screen and (max-width: 360px) {
88 #' . $blockId . ' {
89 '. ( ! empty( $containerMobileWidth ) ? 'width: ' . $containerMobileWidth . $containerMobileWidthUnit.';' : '' ).'
90 }
91 #' . $blockId . ' .time-part{
92 margin-left:'. ( ! empty( $attributes['boxSpacing']['mobile']['value'] ) ? $attributes['boxSpacing']['mobile']['value'].'px;' : '0' ).';
93 }
94
95 #' . $blockId . ' .time-part span{
96 ' . Gutenify_Helpers::typography_style( $attributes['digitAttrs']['typography'], 'mobile' ) . '
97 }
98 #' . $blockId . ' .time-part .smalltext{
99 ' . Gutenify_Helpers::typography_style( $attributes['titleAttrs']['typography'], 'mobile' ) . '
100 }
101 }';
102 }