<?php

/*
  Plugin Name: {$plugin_label}
  Description: {$short_description}
  Version: {$version}
  Author: {$author}  <{$email}>
  Plugin URL: {$author_uri}
  Author URL: {$author_uri}
 */

/*
  Copyright (C) <{$year}>  {$author}  <{$email}>

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License, version 2, as
  published by the Free Software Foundation.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
  Generated by Advanced Plugin Kickstarter
  Web Site URL - http://whimba.org/
  E-mail : whimba@gmail.com
  Generated date : {$date}
 */

require('{$prefix}config.php');

/**
 * Main Plugin's class
 * 
 * @package WordPress Plugins
 * @subpackage {$plugin_label}
 * @author {$author}  <{$email}>
 */
class {$prefix}{$plugin_name} {
	
    /**
     * Control Node
     * 
     * @var object 
     * @access private
     */
    private $control_node;


    /**
     * Constructor
     * 
     * @access public
     */
    public function __construct() {
		
	$this->upgrade();
		
        $this->control_node = new {$prefix}control_Control();
    }

    /**
     * Activation Hook
     * 
     * @access public
     * @global $wp_version;
     */
    static public function activate() {
        global $wp_version;

        /* WordPress Version check */
        $exit_msg = __('Plugin requires WordPress {$required} or newer. '
                . '<a href="http://codex.wordpress.org/Upgrading_WordPress">Update now!</a>', '{$plugin_name}');

        if (version_compare($wp_version, '{$required}', '<')) {
            exit($exit_msg);
        }
        
        /* PHP Versioning Check */
        $exit_msg = __('Plugin requires PHP version {$phpversion} or newer.', '{$plugin_name}');
        
        if (phpversion() < '{$phpversion}'){
            exit($exit_msg);
        }
    }

    /**
     * Deactivation Hook
     * 
     * @access public
     */
    static public function deactivate() {}
	
	/**
     * Uninstall Hook
     * 
     * @access public
     */
    static public function uninstall() {}
	
    /**
     * Check if plugin requires additional actions after upgrade
     * 
     * @access protected
     */
    protected function upgrade(){

        $upgrade_file = {$plugin_name_upper}_BASE_DIR . '__UPGRADED';
        if (!file_exists($upgrade_file)){
            //perform actions
            file_put_contents($upgrade_file, '1');
        }
    }

}

register_activation_hook(__FILE__, array('{$prefix}{$plugin_name}', 'activate'));
register_deactivation_hook(__FILE__, array('{$prefix}{$plugin_name}', 'deactivate'));
register_uninstall_hook(__FILE__, array('{$prefix}{$plugin_name}', 'uninstall'));

add_action('init', '{$prefix}{$plugin_name}_init');

?>