<?php
/**
 * The plugin bootstrap file
 *
 * This file is read by WordPress to generate the plugin information in the plugin
 * admin area. This file also includes all of the dependencies used by the plugin,
 * registers the activation and deactivation functions, and defines a function
 * that starts the plugin.
 *
 * @link              http://www.datacake.com.br
 * @since             1.0.0
 * @package           Datacake_core
 *
 * @wordpress-plugin
 * Plugin Name:       Datacake CORE
 * Plugin URI:        http://www.datacake.com.br
 * Description:       Plugin Datacake para linkar com as Funcionalidade do Data ISP/ISP OG - Redirecionar cidade baseada no cookie
 * Version:           1.2.11
 * Author:            Paulo Peres Jr
 * Author URI:        https://github.com/PauloPeres
 * License:           GPL-2.0+
 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
 * Text Domain:       datacake_core
 * Domain Path:       /languages
 */
//namespace Datacake;

// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
	die;
}

/**
 * Currently plugin version.
 * Start at version 1.0.0 and use SemVer - https://semver.org
 * Rename this for your plugin and update it as you release new versions.
 */
define( 'DATACAKE_CORE_VERSION', '1.2.10' );

require_once __DIR__ . '/vendor/autoload.php';
//$loader->addPsr4('Datacake\\', __DIR__);

use Datacake\Core\Includes\DatacakeCoreActivator;
use Datacake\Core\Includes\DatacakeCoreDeactivator;


function activate_datacake_core() {
	DatacakeCoreActivator::activate();
}
function update_datacake_core() {
	// Isso parece estranho mas por causa do Wordpress Network pode ser que o register_activation_hook não rode
	// então temos que checar de qualquer maneira se o Plugin esta ativo
	DatacakeCoreActivator::activate();
	DatacakeCoreActivator::update();
}
function deactivate_datacake_core() {
	DatacakeCoreDeactivator::deactivate();
}


register_activation_hook( __FILE__, 'activate_datacake_core' );
register_deactivation_hook( __FILE__, 'deactivate_datacake_core' );
add_action( 'plugins_loaded', 'update_datacake_core' );

require_once __DIR__ . '/src/bootstrap.php';

