<?php
/*
Plugin Name:Quote Generator
Plugin URL: http://Wordpress.QuoteGeneratorPlus.com
Version: 3.0
Autor: Vitaliy Zakhodylo
Autor URL: http://QuoteGeneratorPlus.com
License: GPLv2 or later
Description: Online quote (sales) and appointment scheduling plugin.
*/

/**
 *Quote generator plugin allows clients,staff or both create a quote and/or schedule appointments on the web as well as see availability calendar in real time.
 *Quote generator plugin for field service, installation, service contracting companies, etc.
 *The Order submitted via the forms are sent to the email address provided in the WordPress settings and a copy can be sent to the user who filled out the form (optionally).
 *The booking form can be linked to a PayPal or Stripe payment process.
 */
require_once(sprintf("%s/qg-include.php", dirname(__FILE__)));
add_shortcode('quotegenerator', 'QG_Include');

if(!class_exists('Quote_Generator')){
	class Quote_Generator	{
 		public function __construct()		{
			require_once(sprintf("%s/settings.php", dirname(__FILE__)));
			$Quote_Generator_Settings = new Quote_Generator_Settings();
			$plugin = plugin_basename(__FILE__);
			add_filter("plugin_action_links_$plugin", array( $this, 'plugin_settings_link' ));
		}

		public static function activate()	{
			require_once(sprintf("%s/qg-options.php", dirname(__FILE__)));				
		} 

		public static function deactivate()	{
			for($xv=1; $xv<=40; $xv++){delete_option( 'setting_qg'.$xv );}
			for($x=0; $x<15; $x++){
			    delete_option( 'setting_qgname'.$x); delete_option( 'setting_qgform'.$x );
			}
		}

		function plugin_settings_link($links)	{
			$settings_link = '<a href="options-general.php?page=quotegenerator">Settings</a>';
			array_unshift($links, $settings_link);
			return $links;
		}
	}
}

if(class_exists('Quote_Generator')){
	register_activation_hook(__FILE__, array('Quote_Generator', 'activate'));
	register_deactivation_hook(__FILE__, array('Quote_Generator', 'deactivate'));
	$wp_plugin_template = new Quote_Generator();
}
