<?php
/**
 * Plugin Name: Google Maps Divi Simplified
 * Description: A simple Divi Builder module that displays a Google Static Map from an address.
 * Version: 0.5.6
 * Author: Bartosz "Bart" Klemensowski
 * Author URI: https://skylandnj.com
 * Requires at least: 6.0
 * Requires PHP: 7.4
 * License: GPL-2.0-or-later
 * Text Domain: google-maps-divi-simplified
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

define( 'GMDS_PLUGIN_FILE', __FILE__ );
define( 'GMDS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'GMDS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'GMDS_OPTION_API_KEY', 'gmds_google_maps_api_key' );
define( 'GMDS_OPTION_DIRECTIONS_ORIGIN', 'gmds_directions_origin_address' );

require_once GMDS_PLUGIN_DIR . 'includes/class-gmds-admin.php';

add_action( 'init', 'gmds_load_textdomain' );
add_action( 'plugins_loaded', array( 'GMDS_Admin', 'init' ) );
add_action( 'divi_extensions_init', 'gmds_initialize_extension' );

/**
 * Load plugin translations.
 *
 * @return void
 */
function gmds_load_textdomain() {
	load_plugin_textdomain( 'google-maps-divi-simplified', false, dirname( plugin_basename( GMDS_PLUGIN_FILE ) ) . '/languages' );
}

/**
 * Bootstrap the Divi extension class.
 *
 * @return void
 */
function gmds_initialize_extension() {
	require_once GMDS_PLUGIN_DIR . 'includes/class-gmds-extension.php';
}
