-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.php
More file actions
420 lines (375 loc) · 10.6 KB
/
config.php
File metadata and controls
420 lines (375 loc) · 10.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
<?php
/**
* Plugin Configuration File
*
* This file contains all the configuration constants and settings for the plugin.
* Modify these values according to your plugin's needs.
*
* @package Plugin_Core
* @since 1.0.0
*/
// Prevent direct access
if (!defined('ABSPATH')) {
exit;
}
/**
* Plugin Configuration Constants
*/
// Plugin Information
define('Plugin_Core', 'Your Plugin Name');
define('YOUR_PLUGIN_SLUG', 'your-plugin-name');
define('YOUR_PLUGIN_VERSION', '1.0.0');
define('YOUR_PLUGIN_AUTHOR', 'Your Name');
define('YOUR_PLUGIN_AUTHOR_URI', 'https://your-website.com');
define('YOUR_PLUGIN_URI', 'https://your-plugin.com');
define('YOUR_PLUGIN_DESCRIPTION', 'A powerful WordPress plugin built with modern best practices.');
// Plugin Paths
define('YOUR_PLUGIN_PATH', plugin_dir_path(__FILE__));
define('YOUR_PLUGIN_URL', plugin_dir_url(__FILE__));
define('YOUR_PLUGIN_BASENAME', plugin_basename(__FILE__));
// Plugin Text Domain
define('YOUR_PLUGIN_TEXT_DOMAIN', 'your-plugin-name');
define('YOUR_PLUGIN_DOMAIN_PATH', '/languages');
// Plugin Prefixes
define('YOUR_PLUGIN_PREFIX', 'your_plugin');
define('YOUR_PLUGIN_OPTION_PREFIX', 'your_plugin_');
define('YOUR_PLUGIN_META_PREFIX', '_your_plugin_');
// Plugin Capabilities
define('YOUR_PLUGIN_CAPABILITY', 'manage_options');
define('YOUR_PLUGIN_EDIT_CAPABILITY', 'edit_posts');
// Plugin Settings
define('YOUR_PLUGIN_SETTINGS_PAGE', 'your-plugin-settings');
define('YOUR_PLUGIN_OPTIONS_GROUP', 'your_plugin_options');
// Plugin Database
define('YOUR_PLUGIN_DB_VERSION', '1.0');
define('YOUR_PLUGIN_TABLE_PREFIX', 'your_plugin_');
// Plugin Cache
define('YOUR_PLUGIN_CACHE_GROUP', 'your_plugin_cache');
define('YOUR_PLUGIN_CACHE_EXPIRATION', 3600); // 1 hour
// Plugin Security
define('YOUR_PLUGIN_NONCE_ACTION', 'your_plugin_nonce');
define('YOUR_PLUGIN_NONCE_NAME', 'your_plugin_nonce');
// Plugin REST API
define('YOUR_PLUGIN_REST_NAMESPACE', 'your-plugin/v1');
define('YOUR_PLUGIN_REST_BASE', 'your-plugin');
// Plugin AJAX
define('YOUR_PLUGIN_AJAX_ACTION', 'your_plugin_ajax');
// Plugin Hooks
define('YOUR_PLUGIN_HOOK_PREFIX', 'your_plugin_');
// Plugin Assets
define('YOUR_PLUGIN_ASSETS_URL', YOUR_PLUGIN_URL . 'assets/');
define('YOUR_PLUGIN_ADMIN_ASSETS_URL', YOUR_PLUGIN_URL . 'admin/assets/');
define('YOUR_PLUGIN_PUBLIC_ASSETS_URL', YOUR_PLUGIN_URL . 'public/assets/');
// Plugin Templates
define('YOUR_PLUGIN_TEMPLATES_PATH', YOUR_PLUGIN_PATH . 'templates/');
define('YOUR_PLUGIN_ADMIN_TEMPLATES_PATH', YOUR_PLUGIN_PATH . 'admin/templates/');
define('YOUR_PLUGIN_PUBLIC_TEMPLATES_PATH', YOUR_PLUGIN_PATH . 'public/templates/');
// Plugin Logs
define('YOUR_PLUGIN_LOG_PATH', YOUR_PLUGIN_PATH . 'logs/');
define('YOUR_PLUGIN_DEBUG_LOG', YOUR_PLUGIN_LOG_PATH . 'debug.log');
define('YOUR_PLUGIN_ERROR_LOG', YOUR_PLUGIN_LOG_PATH . 'error.log');
// Plugin Features
define('YOUR_PLUGIN_ENABLE_CACHE', true);
define('YOUR_PLUGIN_ENABLE_LOGGING', true);
define('YOUR_PLUGIN_ENABLE_DEBUG', false);
define('YOUR_PLUGIN_ENABLE_ANALYTICS', false);
// Plugin Development
define('YOUR_PLUGIN_DEV_MODE', false);
define('YOUR_PLUGIN_SHOW_DEBUG_INFO', false);
// Plugin Dependencies
define('YOUR_PLUGIN_MIN_WP_VERSION', '5.0');
define('YOUR_PLUGIN_MIN_PHP_VERSION', '8.2');
define('YOUR_PLUGIN_TESTED_WP_VERSION', '6.4');
// Plugin Requirements
define('YOUR_PLUGIN_REQUIRED_PLUGINS', [
// 'woocommerce/woocommerce.php' => 'WooCommerce',
// 'advanced-custom-fields/acf.php' => 'Advanced Custom Fields',
]);
// Plugin Post Types
define('YOUR_PLUGIN_CUSTOM_POST_TYPES', [
'your_custom_post' => [
'labels' => [
'name' => 'Custom Posts',
'singular_name' => 'Custom Post',
'menu_name' => 'Custom Posts',
'add_new' => 'Add New',
'add_new_item' => 'Add New Custom Post',
'edit_item' => 'Edit Custom Post',
'new_item' => 'New Custom Post',
'view_item' => 'View Custom Post',
'search_items' => 'Search Custom Posts',
'not_found' => 'No custom posts found',
'not_found_in_trash' => 'No custom posts found in trash',
],
'public' => true,
'has_archive' => true,
'supports' => ['title', 'editor', 'thumbnail', 'excerpt'],
'show_in_rest' => true,
'menu_icon' => 'dashicons-admin-generic',
'menu_position' => 20,
],
]);
// Plugin Taxonomies
define('YOUR_PLUGIN_CUSTOM_TAXONOMIES', [
'your_custom_taxonomy' => [
'post_types' => ['your_custom_post'],
'labels' => [
'name' => 'Custom Taxonomies',
'singular_name' => 'Custom Taxonomy',
'menu_name' => 'Custom Taxonomies',
'add_new_item' => 'Add New Custom Taxonomy',
'edit_item' => 'Edit Custom Taxonomy',
'new_item_name' => 'New Custom Taxonomy Name',
'search_items' => 'Search Custom Taxonomies',
'not_found' => 'No custom taxonomies found',
],
'hierarchical' => true,
'show_in_rest' => true,
],
]);
// Plugin Settings Fields
define('YOUR_PLUGIN_SETTINGS_FIELDS', [
'general' => [
'title' => 'General Settings',
'fields' => [
'enable_feature' => [
'type' => 'checkbox',
'label' => 'Enable Feature',
'description' => 'Enable the main plugin feature',
'default' => true,
],
'feature_setting' => [
'type' => 'text',
'label' => 'Feature Setting',
'description' => 'Configure the feature setting',
'default' => '',
],
],
],
'advanced' => [
'title' => 'Advanced Settings',
'fields' => [
'debug_mode' => [
'type' => 'checkbox',
'label' => 'Debug Mode',
'description' => 'Enable debug mode for development',
'default' => false,
],
'log_level' => [
'type' => 'select',
'label' => 'Log Level',
'description' => 'Set the logging level',
'options' => [
'error' => 'Error',
'warning' => 'Warning',
'info' => 'Info',
'debug' => 'Debug',
],
'default' => 'error',
],
],
],
]);
// Plugin Default Options
define('YOUR_PLUGIN_DEFAULT_OPTIONS', [
'enable_feature' => true,
'feature_setting' => '',
'debug_mode' => false,
'log_level' => 'error',
'cache_enabled' => true,
'cache_expiration' => 3600,
]);
// Plugin Hooks Configuration
define('YOUR_PLUGIN_HOOKS', [
'init' => [
'priority' => 10,
'accepted_args' => 0,
],
'wp_loaded' => [
'priority' => 10,
'accepted_args' => 0,
],
'admin_init' => [
'priority' => 10,
'accepted_args' => 0,
],
'wp_enqueue_scripts' => [
'priority' => 10,
'accepted_args' => 0,
],
'admin_enqueue_scripts' => [
'priority' => 10,
'accepted_args' => 1,
],
]);
// Plugin AJAX Actions
define('YOUR_PLUGIN_AJAX_ACTIONS', [
'your_plugin_action' => [
'callback' => 'your_plugin_ajax_callback',
'capability' => 'manage_options',
'nopriv' => false,
],
]);
// Plugin REST Routes
define('YOUR_PLUGIN_REST_ROUTES', [
'your-endpoint' => [
'methods' => ['GET', 'POST'],
'callback' => 'your_plugin_rest_callback',
'permission_callback' => 'your_plugin_rest_permission',
'args' => [
'id' => [
'required' => true,
'type' => 'integer',
'sanitize_callback' => 'absint',
],
],
],
]);
// Plugin Shortcodes
define('YOUR_PLUGIN_SHORTCODES', [
'your_shortcode' => [
'callback' => 'your_plugin_shortcode_callback',
'attributes' => [
'id' => '',
'class' => '',
],
],
]);
// Plugin Widgets
define('YOUR_PLUGIN_WIDGETS', [
'Your_Plugin_Widget' => [
'class' => 'Your_Plugin_Widget',
'file' => 'class-widget.php',
],
]);
// Plugin Cron Jobs
define('YOUR_PLUGIN_CRON_JOBS', [
'your_plugin_cron_hook' => [
'schedule' => 'hourly',
'callback' => 'your_plugin_cron_callback',
],
]);
// Plugin Database Tables
define('YOUR_PLUGIN_DB_TABLES', [
'your_plugin_table' => [
'name' => 'your_plugin_table',
'version' => '1.0',
'sql' => "
CREATE TABLE {prefix}your_plugin_table (
id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
title varchar(255) NOT NULL,
content longtext NOT NULL,
created_at datetime DEFAULT CURRENT_TIMESTAMP,
updated_at datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id),
KEY created_at (created_at)
) {charset_collate};
",
],
]);
// Plugin Uninstall Options
define('YOUR_PLUGIN_UNINSTALL_OPTIONS', [
'delete_data_on_uninstall' => false,
'delete_options_on_uninstall' => false,
'delete_tables_on_uninstall' => false,
'delete_files_on_uninstall' => false,
]);
// Plugin Security Settings
define('YOUR_PLUGIN_SECURITY', [
'enable_rate_limiting' => true,
'rate_limit_requests' => 100,
'rate_limit_window' => 3600,
'enable_csrf_protection' => true,
'enable_xss_protection' => true,
'enable_sql_injection_protection' => true,
]);
// Plugin Performance Settings
define('YOUR_PLUGIN_PERFORMANCE', [
'enable_caching' => true,
'cache_expiration' => 3600,
'enable_minification' => true,
'enable_compression' => true,
'enable_lazy_loading' => true,
]);
// Plugin Integration Settings
define('YOUR_PLUGIN_INTEGRATIONS', [
'woocommerce' => [
'enabled' => false,
'version' => '5.0',
],
'acf' => [
'enabled' => false,
'version' => '5.0',
],
'elementor' => [
'enabled' => false,
'version' => '3.0',
],
]);
// Plugin Localization
define('YOUR_PLUGIN_LOCALIZATION', [
'text_domain' => 'your-plugin-name',
'domain_path' => '/languages',
'supported_locales' => [
'en_US',
'es_ES',
'fr_FR',
'de_DE',
'it_IT',
'pt_BR',
],
]);
// Plugin Documentation
define('YOUR_PLUGIN_DOCUMENTATION', [
'readme_url' => 'https://your-plugin.com/docs',
'changelog_url' => 'https://your-plugin.com/changelog',
'support_url' => 'https://your-plugin.com/support',
'faq_url' => 'https://your-plugin.com/faq',
'video_tutorials_url' => 'https://your-plugin.com/tutorials',
]);
// Plugin Support
define('YOUR_PLUGIN_SUPPORT', [
'email' => 'support@your-plugin.com',
'website' => 'https://your-plugin.com',
'github' => 'https://github.com/your-username/your-plugin',
'discord' => 'https://discord.gg/your-plugin',
'slack' => 'https://your-plugin.slack.com',
]);
// Plugin License
define('YOUR_PLUGIN_LICENSE', [
'type' => 'GPL-2.0+',
'url' => 'http://www.gnu.org/licenses/gpl-2.0.txt',
'commercial' => false,
'updates' => false,
]);
// Plugin Analytics
define('YOUR_PLUGIN_ANALYTICS', [
'enabled' => false,
'tracking_id' => '',
'anonymize_ip' => true,
'respect_dnt' => true,
'debug_mode' => false,
]);
// Plugin Backup
define('YOUR_PLUGIN_BACKUP', [
'enabled' => false,
'auto_backup' => false,
'backup_interval' => 'daily',
'backup_retention' => 7,
'backup_location' => 'local',
]);
// Plugin Updates
define('YOUR_PLUGIN_UPDATES', [
'auto_update' => false,
'update_notifications' => true,
'beta_updates' => false,
'update_logging' => true,
]);
// Plugin Development
define('YOUR_PLUGIN_DEV', [
'debug_mode' => false,
'log_queries' => false,
'show_debug_bar' => false,
'profile_performance' => false,
'cache_debug' => false,
]);