feat: Implement upsell functionality with repository and service layers
This commit is contained in:
32
sodino.php
32
sodino.php
@@ -67,6 +67,9 @@ register_deactivation_hook(__FILE__, 'sodino_deactivate');
|
||||
function sodino_deactivate() {
|
||||
// Flush rewrite rules
|
||||
flush_rewrite_rules();
|
||||
|
||||
// Clear analytics cron
|
||||
wp_clear_scheduled_hook('sodino_hourly_analytics');
|
||||
}
|
||||
|
||||
// Bootstrap the plugin
|
||||
@@ -84,12 +87,41 @@ function sodino_init() {
|
||||
|
||||
// Initialize public hooks
|
||||
require_once SODINO_PLUGIN_DIR . 'public/hooks/pricing-hooks.php';
|
||||
require_once SODINO_PLUGIN_DIR . 'public/hooks/analytics-hooks.php';
|
||||
require_once SODINO_PLUGIN_DIR . 'public/hooks/upsell-hooks.php';
|
||||
|
||||
// Schedule analytics aggregation if needed
|
||||
sodino_schedule_analytics();
|
||||
|
||||
// Load text domain
|
||||
load_plugin_textdomain('sodino', false, dirname(SODINO_PLUGIN_BASENAME) . '/languages/');
|
||||
}
|
||||
add_action('plugins_loaded', 'sodino_init');
|
||||
|
||||
/**
|
||||
* Schedule analytics cron job
|
||||
*/
|
||||
function sodino_schedule_analytics() {
|
||||
if (!wp_next_scheduled('sodino_hourly_analytics')) {
|
||||
wp_schedule_event(time(), 'hourly', 'sodino_hourly_analytics');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run analytics aggregation cron job
|
||||
*/
|
||||
function sodino_run_analytics_aggregation() {
|
||||
if (!class_exists('Sodino\Services\AnalyticsService')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$eventRepository = new Sodino\Repositories\EventRepository();
|
||||
$ruleRepository = new Sodino\Repositories\RuleRepository();
|
||||
$analyticsService = new Sodino\Services\AnalyticsService($eventRepository, $ruleRepository);
|
||||
$analyticsService->primeCache();
|
||||
}
|
||||
add_action('sodino_hourly_analytics', 'sodino_run_analytics_aggregation');
|
||||
|
||||
// WooCommerce missing notice
|
||||
function sodino_woocommerce_missing_notice() {
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user