PluginProbe
Tableberg – Simple Gutenberg Table Block / 1.1.5
Tableberg – Simple Gutenberg Table Block v1.1.5
1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 trunk 0.0.2 0.2.1 0.3.2 0.3.3 0.4.1 0.5.0 0.5.1 0.5.2 0.5.3 0.5.4 0.5.5 0.5.6 0.5.7 All 42 releases
← All changes | renderer/utils.php +38 -0 1.1.31.1.5 View file →
@@ -45,4 +45,42 @@
45 45 */
46 46 function clamp($value, $min, $max) {
47 47 return max($min, min($value, $max));
48 48 }
49 +
50 +/**
51 + * Check whether a value is undefined.
52 + *
53 + * @param mixed $value Value to check.
54 + * @return bool
55 + */
56 +function is_undefined($value) {
57 + return null === $value || !isset($value);
58 +}
59 +
60 +/**
61 + * Generate CSS string from styles array.
62 + *
63 + * @param array $styles Styles array.
64 + * @return string
65 + */
66 +function generate_css_string($styles) {
67 + $css_string = '';
68 +
69 + foreach ($styles as $key => $value) {
70 + if (
71 + !is_undefined($value) &&
72 + false !== $value &&
73 + (
74 + !is_string($value) ||
75 + (
76 + trim($value) !== '' &&
77 + trim($value) !== 'undefined undefined undefined'
78 + )
79 + )
80 + ) {
81 + $css_string .= $key . ': ' . $value . '; ';
82 + }
83 + }
84 +
85 + return $css_string;
86 +}