PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.2.3
JetFormBuilder — Dynamic Blocks Form Builder v3.2.3
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / modules / jet-style / css-compilers / base-css-compiler.php
jetformbuilder / modules / jet-style / css-compilers Last commit date
base-css-compiler.php 2 years ago border-css-compiler.php 2 years ago border-radius-css-compiler.php 2 years ago
base-css-compiler.php
77 lines
1 <?php
2
3
4 namespace JFB_Modules\Jet_Style\Css_Compilers;
5
6 use Jet_Form_Builder\Classes\Arrayable\Array_Tools;
7
8 // If this file is called directly, abort.
9 if ( ! defined( 'WPINC' ) ) {
10 die;
11 }
12
13 /**
14 * @since 3.1.0
15 *
16 * Class Base_Css_Compiler
17 * @package Jet_Form_Builder\Compatibility\Wp_Experiments\Css_Compilers
18 */
19 class Base_Css_Compiler {
20
21 /**
22 * @var string
23 */
24 protected $css_var;
25 protected $path;
26
27 // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
28 public function is_supported( array $path ): bool {
29 return true;
30 }
31
32 // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
33 public function compile_declarations(
34 \WP_Style_Engine_CSS_Declarations $declarations,
35 array $root_styles,
36 array &$class_names
37 ) {
38 $declarations->add_declaration(
39 $this->css_var,
40 Array_Tools::get( $root_styles, $this->path, '' )
41 );
42 }
43
44 public function compile_class_names(
45 array &$class_names,
46 array $root_styles
47 ) {
48 if ( ! $this->has_hover_path() ||
49 empty( Array_Tools::get( $root_styles, $this->path, '' ) )
50 ) {
51 return;
52 }
53
54 // remove selector from path
55 $without_first = array_slice( $this->path, 1 );
56
57 $class_names[] = 'has-hover-' . implode( '-', $without_first );
58 }
59
60 protected function has_hover_path(): bool {
61 return false !== strpos( $this->path[0], ':hover' );
62 }
63
64 public function set_css_var( string $name ): Base_Css_Compiler {
65 $this->css_var = $name;
66
67 return $this;
68 }
69
70 public function set_path( array $path ): Base_Css_Compiler {
71 $this->path = $path;
72
73 return $this;
74 }
75
76 }
77