<?php
/**
 * Plugin Name: Boostify Blog AI
 * Description: Automates blog content creation for clients who need regular, SEO-focused articles.
 * Version: 1.1.8
 * Text Domain: boostify-blog-ai
 * Author: Precise Plugins
 * Author URI: https://profiles.wordpress.org/stonemdalton/
 * License: GPLv2 or later
 *
 * Requires at least: 5.0
 * Requires PHP: 8.0
 *
 */
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

define( 'BOOSTIFY_BLOG_AI_DIR', __DIR__ );
define( 'BOOSTIFY_BLOG_AI_BASENAME', dirname( __FILE__ ) );
define( 'BOOSTIFY_BLOG_AI_SLUG', plugin_basename( __FILE__ ));
define( 'BOOSTIFY_BLOG_AI_URL', plugin_dir_url( __FILE__ ) );
define( 'BOOSTIFY_BLOG_AI_ASSETS_DIR_URL', BOOSTIFY_BLOG_AI_URL . 'assets/' );

require_once BOOSTIFY_BLOG_AI_DIR . '/includes/functions.php';
require_once BOOSTIFY_BLOG_AI_DIR . '/includes/class-boostify-blog-ai-loader.php';


function boostify_blog_ai_add_cron_schedule( $schedules ) {
         
	$schedules['every_five_minutes'] = array(
			'interval'  => 300,
			'display'   => __( 'Every 5 Minutes', 'boostify-blog-ai' )
	);  

	return $schedules;
}
add_filter( 'cron_schedules', 'boostify_blog_ai_add_cron_schedule' );

register_activation_hook(__FILE__, 'boostify_blog_ai_activation');

function boostify_blog_ai_activation() {

    if ( ! wp_get_schedule( 'boostify_blog_ai_post_cron' ) ) {
       wp_schedule_event( time(), 'every_five_minutes', 'boostify_blog_ai_post_cron' );
		// wp_schedule_event( time(), 'hourly', 'boostify_blog_ai_post_cron' );
		
    }

    // Create post views tracking table
    require_once BOOSTIFY_BLOG_AI_DIR . '/includes/class-boostify-blog-ai-post-view-tracker.php';
    $post_view_tracker = new BOOSTIFY_BLOG_AI_POST_VIEW_TRACKER();
    $post_view_tracker->create_table();
}


register_deactivation_hook(__FILE__, 'boostify_blog_ai_deactivation');
function boostify_blog_ai_deactivation() {    
    wp_clear_scheduled_hook('boostify_blog_ai_post_cron');

}