PluginProbe
bBlocks – Essential Gutenberg Blocks & Patterns Collection / 2.1.8
bBlocks – Essential Gutenberg Blocks & Patterns Collection v2.1.8
2.1.8 2.1.7 2.1.6 2.1.5 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.43 2.0.42 2.0.41 2.0.40 2.0.39 2.0.38 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.5.1 1.5.2 1.5.3 All 108 releases
b-blocks / includes / StyleGenerator.php

StyleGenerator.php in bBlocks – Essential Gutenberg Blocks & Patterns Collection 2.1.8, at includes/StyleGenerator.php

35 lines 698 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 class BBlocksStyleGenerator
8 {
9 public static $styles = [];
10 public static function addStyle($selector, $styles)
11 {
12 if (array_key_exists($selector, self::$styles)) {
13 self::$styles[$selector] = wp_parse_args(self::$styles[$selector], $styles);
14 } else {
15 self::$styles[$selector] = $styles;
16 }
17 }
18 public static function renderStyle()
19 {
20 $output = '';
21 foreach (self::$styles as $selector => $style) {
22 $new = '';
23 foreach ($style as $property => $value) {
24 if ( '' === $value ) {
25 $new .= "$property ;";
26 } else {
27 $new .= " $property: $value;";
28 }
29 }
30 $output .= "$selector { $new }";
31 }
32 return $output;
33 }
34 }
35