<?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              https://flothemes.com/
 * @since             1.0.0
 * @package           Flo_Flex_Builder
 *
 * @wordpress-plugin
 * Plugin Name:       Flex Block
 * Plugin URI:        https://flothemes.com/flo-flex-builder/
 * Description:       Drag and Drop builder for FloThemes
 * Version:           2.0.0
 * Author:            Flothemes
 * Author URI:        https://flothemes.com/
 * License:           GPL-2.0+
 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
 * Text Domain:       flo-flex-builder
 * Domain Path:       /languages
 */

// 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( 'Flo_Flex_Builder_Version', '2.0.0' );

/**
 * The code that runs during plugin activation.
 * This action is documented in includes/class-flo-flex-builder-activator.php
 */
function activate_Flo_Flex_Builder() {
	require_once plugin_dir_path( __FILE__ ) . 'includes/class-flo-flex-builder-activator.php';
	Flo_Flex_Builder_Activator::activate();
}

/**
 * The code that runs during plugin deactivation.
 * This action is documented in includes/class-flo-flex-builder-deactivator.php
 */
function deactivate_Flo_Flex_Builder() {
	require_once plugin_dir_path( __FILE__ ) . 'includes/class-flo-flex-builder-deactivator.php';
	Flo_Flex_Builder_Deactivator::deactivate();
}


// // handle the plugin updates
// if ( ! class_exists( 'Flo_Flex_Builder_License_Menu' ) ) {
// 	require_once( plugin_dir_path( __FILE__ ) . 'api-manager/am-license-menu.php' );
//
// 	/**
// 	 * @param string $file             Must be __FILE__ from the root plugin file, or theme functions file.
// 	 * @param string $software_title   Must be exactly the same as the Software Title in the product.
// 	 * @param string $software_version This product's current software version.
// 	 * @param string $plugin_or_theme  'plugin' or 'theme'
// 	 * @param string $api_url          The URL to the site that is running the API Manager. Example: https://www.toddlahman.com/
// 	 *
// 	 * @return \AM_License_Submenu|null
// 	 */
// 	//Flo_Flex_Builder_License_Menu::instance( __FILE__, 'FloPack1', Flo_Flex_Builder_Version, 'plugin', 'http://localhost/flocom' );
// 	//Flo_Flex_Builder_License_Menu::instance( __FILE__, 'FloBakery', Flo_Flex_Builder_Version, 'plugin', 'https://flothemes.staging.wpengine.com/' ); // staging enviroment
// 	Flo_Flex_Builder_License_Menu::instance( __FILE__, 'FloPack1', Flo_Flex_Builder_Version, 'plugin', 'https://flothemes.com/' );  // production enviroment
// }

register_activation_hook( __FILE__, 'activate_Flo_Flex_Builder' );
register_deactivation_hook( __FILE__, 'deactivate_Flo_Flex_Builder' );

/**
 * The core plugin class that is used to define internationalization,
 * admin-specific hooks, and public-facing site hooks.
 */
require plugin_dir_path( __FILE__ ) . 'includes/class-flo-flex-builder.php';

/**
 * Begins execution of the plugin.
 *
 * Since everything within the plugin is registered via hooks,
 * then kicking off the plugin from this point in the file does
 * not affect the page life cycle.
 *
 * @since    1.0.0
 */
function run_Flo_Flex_Builder() {

	$plugin = new Flo_Flex_Builder();
	$plugin->run();

}
run_Flo_Flex_Builder();

add_action("admin_init", "include_flo_flex_builder_field");

if(!function_exists("include_flo_flex_builder_field")) {
	function include_flo_flex_builder_field() {
		include_once plugin_dir_path( __FILE__ ) . 'admin/partials/acf-flo-flex-builder/acf-flo-flex-builder.php';
	}
}
