PluginProbe ʕ •ᴥ•ʔ
Secure Custom Fields / 6.9.1
Secure Custom Fields v6.9.1
6.9.1 6.9.0 6.8.9 6.8.7 6.8.8 6.8.6 6.8.4 6.8.5 trunk 6.4.0-beta1 6.4.0-beta2 6.4.1 6.4.1-beta3 6.4.1-beta4 6.4.1-beta5 6.4.1-beta6 6.4.1-beta7 6.4.2 6.5.0 6.5.1 6.5.2 6.5.3 6.5.4 6.5.5 6.5.6 6.5.7 6.6.0 6.7.0 6.7.1 6.8.0 6.8.1 6.8.2 6.8.3
secure-custom-fields / includes / admin / beta-features / class-scf-beta-feature.php
secure-custom-fields / includes / admin / beta-features Last commit date
class-scf-beta-feature-editor-sidebar.php 1 year ago class-scf-beta-feature.php 1 year ago index.php 1 year ago
class-scf-beta-feature.php
94 lines
1 <?php
2 /**
3 * Base Beta Feature Class
4 *
5 * This class serves as the base for all beta features in Secure Custom Fields.
6 *
7 * @package Secure Custom Fields
8 * @since SCF 6.5.0
9 */
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit; // Exit if accessed directly
13 }
14
15 if ( ! class_exists( 'SCF_Admin_Beta_Feature' ) ) :
16 /**
17 * Class SCF_Admin_Beta_Feature
18 *
19 * Base class that all beta features must extend. Provides common functionality
20 * for managing beta feature settings and UI.
21 *
22 * @package Secure Custom Fields
23 * @since SCF 6.5.0
24 */
25 class SCF_Admin_Beta_Feature {
26
27 /**
28 * The beta feature name (unique identifier).
29 *
30 * @var string
31 */
32 public $name = '';
33
34 /**
35 * The beta feature title.
36 *
37 * @var string
38 */
39 public $title = '';
40
41 /**
42 * The beta feature description.
43 *
44 * @var string
45 */
46 public $description = '';
47
48 /**
49 * Constructor.
50 */
51 public function __construct() {
52 $this->initialize();
53 }
54
55 /**
56 * Initialize the beta feature.
57 *
58 * @return void
59 */
60 protected function initialize() {
61 // Override in child classes to initialize beta features.
62 }
63
64 /**
65 * Get the beta feature status (enabled/disabled).
66 *
67 * @return bool
68 */
69 public function is_enabled() {
70 return (bool) get_option( 'scf_beta_feature_' . $this->name . '_enabled', false );
71 }
72
73 /**
74 * Enable or disable the beta feature.
75 *
76 * @param bool $enabled Whether to enable or disable the beta feature.
77 * @return void
78 */
79 public function set_enabled( $enabled ) {
80 update_option( 'scf_beta_feature_' . $this->name . '_enabled', (bool) $enabled );
81 }
82
83 /**
84 * Clean up any beta feature-specific data.
85 * Child classes should override this if they store additional data.
86 *
87 * @return void
88 */
89 public function cleanup() {
90 delete_option( 'scf_beta_feature_' . $this->name . '_enabled' );
91 }
92 }
93 endif;
94