<?php
/*
Plugin Name: Banners
Plugin URI: http://test218.irontec.com
Description: Manager Home Banners
Version: 1.0
Author: Dani
Author URI: http://test218.irontec.com
*/

define( 'Banners_VERSION', '1.0' );
define( 'Banners_URL', WP_PLUGIN_URL . '/Banners' );

// Activation hook
register_activation_hook( __FILE__, 'Banners_activation' );

/*
 Activation of the plugin.
*/
function Banners_activation() {
    Banners_install_db();
}

/*
 Installation of the DB tables
*/
function Banners_install_db () {
    global $wpdb;
    
    /**
     * Options Imgs
     */
    if (get_option('banner1_img_es')) {
        delete_option('banner1_img_es');
    } else {
        add_option('banner1_img_es', '');
    }
    
    if (get_option('banner1_img_eu')) {
        delete_option('banner1_img_eu');
    } else {
        add_option('banner1_img_eu', '');
    }
    
    if (get_option('banner2_img_es')) {
        delete_option('banner2_img_es');
    } else {
        add_option('banner2_img_es', '');
    }
    
    if (get_option('banner2_img_eu')) {
        delete_option('banner2_img_eu');
    } else {
        add_option('banner2_img_eu', '');
    }
    
    /**
     * Options Urls
     */
    if (get_option('banner1_url_es')) {
        delete_option('banner1_url_es');
    } else {
        add_option('banner1_url_es', '');
    }
    
    if (get_option('banner1_url_eu')) {
        delete_option('banner1_url_eu');
    } else {
        add_option('banner1_url_eu', '');
    }
    
    if (get_option('banner2_url_es')) {
        delete_option('banner2_url_es');
    } else {
        add_option('banner2_url_es', '');
    }
    
    if (get_option('banner2_url_eu')) {
        delete_option('banner2_url_eu');
    } else {
        add_option('banner2_url_eu', '');
    }
    
    /**
     * Options Text Alt
     */
    if (get_option('banner1_alt_es')) {
        delete_option('banner1_alt_es');
    } else {
        add_option('banner1_alt_es', '');
    }
    
    if (get_option('banner1_alt_eu')) {
        delete_option('banner1_alt_eu');
    } else {
        add_option('banner1_alt_eu', '');
    }
    
    if (get_option('banner2_alt_es')) {
        delete_option('banner2_alt_es');
    } else {
        add_option('banner2_alt_es', '');
    }
    
    if (get_option('banner2_alt_eu')) {
        delete_option('banner2_alt_eu');
    } else {
        add_option('banner2_alt_eu', '');
    }
    
}

require_once( dirname(__FILE__) . '/admin/admin_pages.php');