/**
 * Install plugin
 */
function postplanner_activation()
{
    global $wp_version;
    $exit_msg = esc_html__('Post Planner requires WordPress 3.3 or newer. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please update.</a>', 'post-planner');
    if (version_compare($wp_version, "3.3", "<")) {
        exit($exit_msg);
    }
    if (!defined('POSTPLANNER_DB_VERSION')) {
        define('POSTPLANNER_DB_VERSION', '1.4');
    }
    if (!defined('POSTPLANNER_FILE')) {
        define('POSTPLANNER_FILE', __FILE__);
    }
    include_once 'includes/post-planner-library.class.php';
    if (get_option('PostPlanner_db_version')) {
        $installed_ver = get_option('PostPlanner_db_version');
    } else {
        $installed_ver = 0;
    }
    // if the installed version is not the same as the current version, run the install function
    if (POSTPLANNER_DB_VERSION != $installed_ver) {
        PostPlanner_Lib::install_plugin($installed_ver);
    }
}