PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 1.6.4
Kubio AI Page Builder v1.6.4
2.8.4 2.8.3 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 4 years ago Props 3 years ago BlockStyleRender.php 4 years ago DynamicStyles.php 3 years ago GlobalStyleRender.php 4 years ago MainAttribute.php 4 years ago ParserUtils.php 4 years ago StyleManager.php 4 years ago StyleParser.php 4 years ago StyleRender.php 3 years ago Utils.php 4 years ago
DynamicStyles.php
62 lines
1 <?php
2
3
4 namespace Kubio\Core\StyleManager;
5
6 use Kubio\Core\LodashBasic;
7
8 class DynamicStyles {
9
10
11 public static function hSpaceParent( $spaceByMedia ) {
12 $style = array();
13 foreach ( $spaceByMedia as $media => $mediaValue ) {
14 $style[ $media ] = array();
15 if ( isset( $mediaValue['value'] ) ) {
16 $halfSpace = number_format( $mediaValue['value'] / 2, 0 );
17 $style[ $media ]['marginLeft'] = -$halfSpace . 'px';
18 $style[ $media ]['marginRight'] = -$halfSpace . 'px';
19 }
20 }
21 return $style;
22 }
23
24 public static function hSpace( $spaceByMedia ) {
25 $style = array();
26
27 foreach ( $spaceByMedia as $media => $mediaValue ) {
28 $style[ $media ] = array();
29 if ( isset( $mediaValue['value'] ) ) {
30 $halfSpace = number_format( $mediaValue['value'] / 2, 0 );
31 $style[ $media ]['paddingLeft'] = $halfSpace . 'px';
32 $style[ $media ]['paddingRight'] = $halfSpace . 'px';
33 }
34 }
35 return $style;
36 }
37
38 public static function vSpace( $spaceByMedia, $negative = false ) {
39 $style = array();
40 foreach ( $spaceByMedia as $media => $mediaValue ) {
41 $style[ $media ] = array();
42 if ( isset( $mediaValue['value'] ) ) {
43 $style[ $media ]['marginBottom'] = ( $negative ? '-' : '' ) . $mediaValue['value'] . 'px';
44 }
45 }
46 return $style;
47 }
48
49 public static function typographyHolders( $typographyHoldersByMedia ) {
50
51 $typographyByMedia = array();
52 foreach ( $typographyHoldersByMedia as $media => $holders ) {
53 $typographyByMedia[ $media ] = array(
54 'typography' => array(
55 'holders' => $holders,
56 ),
57 );
58 }
59 return $typographyByMedia;
60 }
61 }
62