-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathquick-admin-launcher.php
More file actions
94 lines (80 loc) · 2.43 KB
/
Copy pathquick-admin-launcher.php
File metadata and controls
94 lines (80 loc) · 2.43 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
<?php
/**
* Plugin Name: Quick Admin Launcher
* Plugin URI: https://wordpress.org/plugins/quick-admin-launcher/
* Description: Quick Admin Launcher is a WordPress plugin that allows to quickly launch any admin tool from a search box.
* Version: 1.1.1
* Author: dbeja
* Text Domain: quickal
* Domain Path: /languages
* Requires PHP: 7.4
*/
defined('ABSPATH') || die('No script kiddies please!');
define('QUICKAL_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('QUICKAL_PLUGIN_URL', plugin_dir_url(__FILE__));
define('QUICKAL_VERSION', '1.1.1');
// Load Composer autoloader
require_once QUICKAL_PLUGIN_DIR . '/vendor/autoload.php';
// Register activation and deactivation hooks
register_activation_hook(__FILE__, 'quickal_activate');
register_deactivation_hook(__FILE__, 'quickal_deactivate');
/**
* Plugin activation hook
*
* @since 1.0.0
* @return void
*/
function quickal_activate(): void
{
try {
// Set default settings if they don't exist
$options = get_option('quickal_settings');
if (false === $options) {
$defaults = \QUICKAL\Config\PluginConfig::getDefaults();
update_option('quickal_settings', $defaults);
}
// Log activation
if (defined('WP_DEBUG') && WP_DEBUG) {
error_log('[QuickAL] Plugin activated successfully');
}
} catch (\Exception $e) {
error_log('[QuickAL] Activation error: ' . $e->getMessage());
}
}
/**
* Plugin deactivation hook
*
* @since 1.0.0
* @return void
*/
function quickal_deactivate(): void
{
try {
// Clean up any temporary data if needed
if (defined('WP_DEBUG') && WP_DEBUG) {
error_log('[QuickAL] Plugin deactivated');
}
} catch (\Exception $e) {
error_log('[QuickAL] Deactivation error: ' . $e->getMessage());
}
}
/**
* Initialize the plugin with dependency injection
*
* @return void
*/
function quickal_init(): void
{
try {
// Create dependency injection container
$container = new \QUICKAL\DI\Container();
// Get the main plugin instance
$plugin = $container->get(\QUICKAL\QuickAL::class);
// Initialize the plugin
$plugin->init();
} catch (\Exception $e) {
error_log('[QuickAL] Initialization error: ' . $e->getMessage());
}
}
// Initialize plugin after WordPress is loaded
add_action('plugins_loaded', 'quickal_init');