PluginProbe
Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder / trunk
Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder vtrunk
3.5.0 trunk 1.0.10 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.6.1 1.0.7 1.0.8 1.0.9 1.1 1.1.1 1.2 1.3 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.5 1.5.1 1.5.2 All 109 releases
buttonizer-multifunctional-button / app / Core / buttonizer / wp-php-core / src / PluginConfig.php

PluginConfig.php in Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder trunk, at app/Core/buttonizer/wp-php-core/src/PluginConfig.php

176 lines 4.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Central configuration object for shared Buttonizer plugin code.
4 *
5 * Each plugin initializes this with its own constants early in the boot process.
6 * All shared code reads from PluginConfig instead of plugin-specific constants.
7 *
8 * @package Core
9 *
10 * @license proprietary
11 * Modified by buttonizer on 04-August-2026 using {@see https://github.com/BrianHenryIE/strauss}.
12 */
13
14 namespace Buttonizer\Core;
15
16 class PluginConfig
17 {
18 private static ?array $config = null;
19
20 /**
21 * Initialize the plugin configuration.
22 *
23 * Must be called once during plugin bootstrap, before any shared code is used.
24 *
25 * @param array $config Configuration array with plugin-specific values.
26 */
27 public static function init(array $config): void
28 {
29 self::$config = $config;
30 }
31
32 /**
33 * Get a configuration value by key.
34 *
35 * @param string $key Configuration key.
36 * @param mixed $default Default value if key is not set.
37 *
38 * @return mixed
39 */
40 public static function get(string $key, $default = null)
41 {
42 return self::$config[$key] ?? $default;
43 }
44
45 /**
46 * Plugin name / option prefix (e.g. "buttonizer", "bz_contact_button").
47 */
48 public static function name(): string
49 {
50 return self::$config['name'];
51 }
52
53 /**
54 * Plugin root directory path.
55 */
56 public static function dir(): string
57 {
58 return self::$config['dir'];
59 }
60
61 /**
62 * Plugin app/ directory path.
63 */
64 public static function appDir(): string
65 {
66 return self::$config['app_dir'];
67 }
68
69 /**
70 * Plugin slug (directory basename).
71 */
72 public static function slug(): string
73 {
74 return self::$config['slug'];
75 }
76
77 /**
78 * Plugin version string.
79 */
80 public static function version(): string
81 {
82 return self::$config['version'];
83 }
84
85 /**
86 * Main plugin file path.
87 */
88 public static function pluginFile(): string
89 {
90 return self::$config['plugin_file'];
91 }
92
93 /**
94 * Plugin basename (e.g. "buttonizer-for-wordpress/buttonizer.php").
95 */
96 public static function baseName(): string
97 {
98 return self::$config['base_name'];
99 }
100
101 /**
102 * Buttonizer API base URI (e.g. "https://api.buttonizer.io").
103 */
104 public static function apiUri(): string
105 {
106 return self::$config['api_uri'];
107 }
108
109 /**
110 * Sibling plugins configuration for connection sharing.
111 *
112 * Each entry maps a sibling plugin name to its option keys:
113 * [
114 * 'plugin_name' => [
115 * 'token_option' => 'plugin_name_site_connection',
116 * 'settings_option' => 'plugin_name_settings',
117 * 'account_option' => 'plugin_name_account',
118 * ],
119 * ]
120 *
121 * @return array
122 */
123 public static function siblings(): array
124 {
125 return self::$config['siblings'] ?? [];
126 }
127
128 /**
129 * WordPress admin page slug (e.g. "Buttonizer", "bz_button_contact").
130 */
131 public static function pageSlug(): string
132 {
133 return self::$config['page_slug'];
134 }
135
136 /**
137 * WordPress text domain for translations.
138 */
139 public static function textDomain(): string
140 {
141 return self::$config['text_domain'];
142 }
143
144 /**
145 * WordPress.org review URL for the plugin.
146 */
147 public static function reviewUrl(): string
148 {
149 return self::$config['review_url'] ?? '';
150 }
151
152 /**
153 * HTML notice element ID for the admin review notice.
154 */
155 public static function noticeId(): string
156 {
157 return self::$config['notice_id'] ?? 'buttonizer-admin-notice';
158 }
159
160 /**
161 * JS function name for the admin notice dismiss handler.
162 */
163 public static function noticeJsFunction(): string
164 {
165 return self::$config['notice_js_function'] ?? 'buttonizerAdminNotice';
166 }
167
168 /**
169 * Referral slug for community/knowledge base links.
170 */
171 public static function referralSlug(): string
172 {
173 return self::$config['referral_slug'] ?? '';
174 }
175 }
176