<?php
/*
Plugin Name: Divi Module Mate
Plugin URI: 
Description: Adds a "More Modules..." tab to Divi Builder to make finding new modules easy.
Author: Divi Booster
Version: 1.1.0
Author URI: http://www.divibooster.com
*/

define('DBDMM_VERSION', '1.1.0');

// === Updates ===
$updatename = 'divi-module-mate';
$updateurl = 'https://d2r3n468jwgcbf.cloudfront.net/updates.json'; 
include_once(dirname(__FILE__).'/updater.php');
try {
	$MyUpdateChecker = new DBMM_UpdateChecker($updateurl, __FILE__, $updatename);
} catch (Exception $e) { }

// Load the Divi Builder CSS / JS
function db_module_mate_loader() {
	wp_enqueue_style('db_module_mate_admin_css', plugin_dir_url( __FILE__ ).'admin.css', array(), DBDMM_VERSION);
	wp_enqueue_script('db_module_mate_admin_js', plugin_dir_url( __FILE__ ).'admin.js', array(), DBDMM_VERSION);
}

add_action('admin_print_scripts-post-new.php', 'db_module_mate_loader');
add_action('admin_print_scripts-post.php', 'db_module_mate_loader');

// Load the Visual Builder CSS / JS
function db_module_mate_loader_visual() {
	wp_enqueue_style('db_module_mate_visual_css', plugin_dir_url( __FILE__ ).'visual-builder.css', array(), DBDMM_VERSION);
	wp_enqueue_script('db_module_mate_visual_js', plugin_dir_url( __FILE__ ).'visual-builder.js', array(), DBDMM_VERSION);
	wp_localize_script('db_module_mate_visual_js', 'diviModuleMate', array(
		'pluginDir' => plugin_dir_url(__FILE__),
	));
}
if (isset($_GET['et_fb']) and $_GET['et_fb']=='1') {
	add_action('wp_head', 'db_module_mate_loader_visual');
}