function dk_speakout_install()
{
    global $wpdb, $db_petitions, $db_signatures, $dk_speakout_version;
    dk_speakout_translate();
    $sql_create_tables = "\r\n\t\tCREATE TABLE `{$db_petitions}` (\r\n\t\t\t`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,\r\n\t\t\t`title` TEXT CHARACTER SET utf8 NOT NULL,\r\n\t\t\t`target_email` VARCHAR(300) CHARACTER SET utf8 NOT NULL,\r\n\t\t\t`email_subject` VARCHAR(200) CHARACTER SET utf8 NOT NULL,\r\n\t\t\t`greeting` VARCHAR(200) CHARACTER SET utf8 NOT NULL,\r\n\t\t\t`petition_message` LONGTEXT CHARACTER SET utf8 NOT NULL,\r\n\t\t\t`address_fields` VARCHAR(200) CHARACTER SET utf8 NOT NULL,\r\n\t\t\t`expires` CHAR(1) BINARY NOT NULL,\r\n\t\t\t`expiration_date` DATETIME NOT NULL,\r\n\t\t\t`created_date` DATETIME NOT NULL,\r\n\t\t\t`goal` INT(11) NOT NULL,\r\n\t\t\t`sends_email` CHAR(1) BINARY NOT NULL,\r\n\t\t\t`twitter_message` VARCHAR(120) CHARACTER SET utf8 NOT NULL,\r\n\t\t\t`requires_confirmation` CHAR(1) BINARY NOT NULL,\r\n\t\t\t`return_url` VARCHAR(200) CHARACTER SET utf8 NOT NULL,\r\n\t\t\t`displays_custom_field` CHAR(1) BINARY NOT NULL,\r\n\t\t\t`custom_field_label` VARCHAR(200) CHARACTER SET utf8 NOT NULL,\r\n\t\t\t`displays_optin` CHAR(1) BINARY NOT NULL,\r\n\t\t\t`optin_label` VARCHAR(200) CHARACTER SET utf8 NOT NULL,\r\n\t\t\t`is_editable` CHAR(1) BINARY NOT NULL,\r\n\t\t\tUNIQUE KEY  (`id`)\r\n\t\t);\r\n\t\tCREATE TABLE `{$db_signatures}` (\r\n\t\t\t`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,\r\n\t\t\t`petitions_id` BIGINT(20) NOT NULL,\r\n\t\t\t`first_name` VARCHAR(200) CHARACTER SET utf8 NOT NULL,\r\n\t\t\t`last_name` VARCHAR(200) CHARACTER SET utf8 NOT NULL,\r\n\t\t\t`email` VARCHAR(200) CHARACTER SET utf8 NOT NULL,\r\n\t\t\t`street_address` VARCHAR(200) CHARACTER SET utf8 NOT NULL,\r\n\t\t\t`city` VARCHAR(200) CHARACTER SET utf8 NOT NULL,\r\n\t\t\t`state` VARCHAR(200) CHARACTER SET utf8 NOT NULL,\r\n\t\t\t`postcode` VARCHAR(200) CHARACTER SET utf8 NOT NULL,\r\n\t\t\t`country` VARCHAR(200) CHARACTER SET utf8 NOT NULL,\r\n\t\t\t`custom_field` VARCHAR(400) CHARACTER SET utf8 NOT NULL,\r\n\t\t\t`optin` CHAR(1) BINARY NOT NULL,\r\n\t\t\t`date` DATETIME NOT NULL,\r\n\t\t\t`confirmation_code` VARCHAR(32) NOT NULL,\r\n\t\t\t`is_confirmed` CHAR(1) BINARY NOT NULL,\r\n\t\t\t`custom_message` LONGTEXT CHARACTER SET utf8 NOT NULL,\r\n\t\t\t`language` VARCHAR(10) CHARACTER SET utf8 NOT NULL,\r\n\t\t\tUNIQUE KEY  (`id`)\r\n\t\t);";
    // create database tables
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    dbDelta($sql_create_tables);
    // set default options
    $options = array("petitions_rows" => "20", "signatures_rows" => "50", "petition_theme" => "default", "button_text" => __("Sign Now", "dk_speakout"), "expiration_message" => __("This petition is now closed.", "dk_speakout"), "success_message" => "<strong>" . __("Thank you", "dk_speakout") . ", %first_name%.</strong>\r\n<p>" . __("Your signature has been added.", "dk_speakout") . "</p>", "already_signed_message" => __("This petition has already been signed using your email address.", "dk_speakout"), "share_message" => __("Share this with your friends:", "dk_speakout"), "confirm_subject" => __("Please confirm your email address", "dk_speakout"), "confirm_message" => __("Hello", "dk_speakout") . " %first_name%\r\n\r\n" . __("Thank you for singing our petition", "dk_speakout") . ". " . __("Please confirm your email address by clicking the link below:", "dk_speakout") . "\r\n%confirmation_link%\r\n\r\n" . get_bloginfo("name"), "confirm_email" => get_bloginfo("name") . " <" . get_bloginfo("admin_email") . ">", "optin_default" => "unchecked", "display_count" => "1", "signaturelist_theme" => "default", "signaturelist_header" => __("Latest Signatures", "dk_speakout"), "signaturelist_rows" => "50", "signaturelist_columns" => serialize(array("sig_date")), "widget_theme" => "default", "csv_signatures" => "all", "signaturelist_privacy" => "enabled");
    // add plugin options to wp_options table
    add_option('dk_speakout_options', $options);
    add_option('dk_speakout_version', $dk_speakout_version);
    // register options for translation in WPML
    include_once 'class.wpml.php';
    $wpml = new dk_speakout_WPML();
    $wpml->register_options($options);
}
function k12nn_locale_func($atts, $content = null)
{
    $a = shortcode_atts(array('locale' => 'en_US'), $atts);
    global $k12nn_locale;
    global $k12nn_previous_locale;
    $k12nn_previous_locale = get_locale();
    $k12nn_locale = $a['locale'];
    add_filter('locale', 'k12nn_redefine_locale');
    setlocale(LC_ALL, $k12nn_locale);
    if (function_exists('dk_speakout_translate')) {
        unload_textdomain('dk_speakout');
        dk_speakout_translate();
    }
    $return = do_shortcode($content);
    $k12nn_locale = $k12nn_previous_locale;
    remove_filter('locale', 'k12nn_redefine_locale');
    setlocale(LC_ALL, $k12nn_locale);
    if (function_exists('dk_speakout_translate')) {
        unload_textdomain('dk_speakout');
        dk_speakout_translate();
    }
    return $return;
}