PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / trunk
Kubio AI Page Builder vtrunk
2.8.2 2.8.1 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.9.0 2.0.0 2.1.1 2.1.2 2.1.3 2.2.0 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.5 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.6.2 2.6.3 2.6.5 2.6.6 2.6.7 2.7.0 2.7.1 2.7.2 2.7.3 2.8.0
kubio / lib / src / Core / StyleManager / DynamicStyles.php
kubio / lib / src / Core / StyleManager Last commit date
Generics 1 year ago Props 1 month ago BlockStyleRender.php 1 year ago DynamicStyles.php 1 year ago GlobalStyleRender.php 1 year ago MainAttribute.php 4 years ago ParserUtils.php 1 year ago StyleManager.php 2 years ago StyleParser.php 1 year ago StyleRender.php 1 year ago Utils.php 1 year ago
DynamicStyles.php
61 lines
1 <?php
2
3
4 namespace Kubio\Core\StyleManager;
5
6
7 class DynamicStyles {
8
9
10 public static function hSpaceParent( $spaceByMedia ) {
11 $style = array();
12 foreach ( $spaceByMedia as $media => $mediaValue ) {
13 $style[ $media ] = array();
14 if ( isset( $mediaValue['value'] ) ) {
15 $halfSpace = number_format( $mediaValue['value'] / 2, 0 );
16 $style[ $media ]['marginLeft'] = -$halfSpace . 'px';
17 $style[ $media ]['marginRight'] = -$halfSpace . 'px';
18 }
19 }
20 return $style;
21 }
22
23 public static function hSpace( $spaceByMedia ) {
24 $style = array();
25
26 foreach ( $spaceByMedia as $media => $mediaValue ) {
27 $style[ $media ] = array();
28 if ( isset( $mediaValue['value'] ) ) {
29 $halfSpace = number_format( $mediaValue['value'] / 2, 0 );
30 $style[ $media ]['paddingLeft'] = $halfSpace . 'px';
31 $style[ $media ]['paddingRight'] = $halfSpace . 'px';
32 }
33 }
34 return $style;
35 }
36
37 public static function vSpace( $spaceByMedia, $negative = false ) {
38 $style = array();
39 foreach ( $spaceByMedia as $media => $mediaValue ) {
40 $style[ $media ] = array();
41 if ( isset( $mediaValue['value'] ) ) {
42 $style[ $media ]['marginBottom'] = ( $negative ? '-' : '' ) . $mediaValue['value'] . 'px';
43 }
44 }
45 return $style;
46 }
47
48 public static function typographyHolders( $typographyHoldersByMedia ) {
49
50 $typographyByMedia = array();
51 foreach ( $typographyHoldersByMedia as $media => $holders ) {
52 $typographyByMedia[ $media ] = array(
53 'typography' => array(
54 'holders' => $holders,
55 ),
56 );
57 }
58 return $typographyByMedia;
59 }
60 }
61