PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 3.3.1
JetFormBuilder — Dynamic Blocks Form Builder v3.3.1
3.6.5.2 3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 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 All 130 releases
jetformbuilder / modules / option-query / traits / option-query-trait.php
option-query-trait.php
88 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 namespace JFB_Modules\Option_Query\Traits;
5
6 // If this file is called directly, abort.
7 if ( ! defined( 'WPINC' ) ) {
8 die;
9 }
10
11 trait Option_Query_Trait {
12
13 /**
14 * Settings which used to display fetched things
15 *
16 * @var array
17 */
18 protected $settings = array();
19
20 /**
21 * Settings which used to query things
22 *
23 * @var array
24 */
25 protected $query = array();
26
27 protected $features = array(
28 'search' => true,
29 );
30
31 public function set_setting( string $name, $value ) {
32 $this->settings[ $name ] = $value;
33 }
34
35 public function get_setting( string $name ) {
36 return $this->settings[ $name ] ?? false;
37 }
38
39 public function has_setting( string $name ): bool {
40 return array_key_exists( $name, $this->settings );
41 }
42
43 public function set_settings( array $settings ) {
44 $this->settings = $settings;
45 }
46
47 public function get_settings(): array {
48 return $this->settings;
49 }
50
51 public function set_query( string $name, $value ) {
52 $this->query[ $name ] = $value;
53 }
54
55 public function get_query( string $name ) {
56 return $this->query[ $name ] ?? false;
57 }
58
59 public function has_query( string $name ): bool {
60 return array_key_exists( $name, $this->query );
61 }
62
63 public function delete_query( string $name ) {
64 unset( $this->query[ $name ] );
65 }
66
67 public function set_query_params( array $params ) {
68 $this->query = $params;
69 }
70
71 public function get_query_params(): array {
72 return $this->query;
73 }
74
75 public function is_support_feature( string $feature_name ): bool {
76 return (bool) ( $this->features[ $feature_name ] ?? false );
77 }
78
79 public function disable_feature( string $feature_name ) {
80 unset( $this->features[ $feature_name ] );
81 }
82
83 public function enable_feature( string $feature_name ) {
84 $this->features[ $feature_name ] = true;
85 }
86
87 }
88