wp_enqueue_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css', '', '4.0.1', false);
} */
if (isset($_POST['alter_charset'])) {
    global $maxbuttons_installed_version;
    global $wpdb;
    $table_name = maxUtils::get_buttons_table_name();
    $sql = "ALTER TABLE " . $table_name . " CONVERT TO CHARACTER SET utf8";
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    $wpdb->query($sql);
    $response = 'CHARSET now utf_8 COLLATE utf8_general_ci';
} else {
    $response = '';
}
if (isset($_POST["reset_cache"])) {
    $button = new maxButton();
    $button->reset_cache();
}
if (isset($_POST["remigrate"])) {
    $install = MB()->getClass("install");
    $install::create_database_table();
    $install::migrate();
}
if (isset($_POST["replace"]) && check_admin_referer('mb_bulk_edit', 'bulk_edit')) {
    $search = $_POST["search"];
    $replace = $_POST["replace"];
    $field = $_POST["replace_field"];
    $button = new maxButton();
    if ($field == '') {
        exit("FATAL");
    }
    $admin = MB()->getClass('admin');
 static function create_database_table()
 {
     //global $maxbuttons_installed_version;
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     $table_name = maxUtils::get_buttons_table_name();
     $button = new maxButton();
     $blocks = $button->getDefinedBlocks();
     // IMPORTANT: There MUST be two spaces between the PRIMARY KEY keywords
     // and the column name, and the column name MUST be in parenthesis.
     $sql = "CREATE TABLE " . $table_name . " ( \n\t\t\t\t\tid int NOT NULL AUTO_INCREMENT, \n\t\t\t\t\t name varchar(100) NULL, \n\t\t\t\t\t status varchar(10) default 'publish' NOT NULL, \n\t\t\t\t\t cache text, \n\t\t\t\t";
     foreach ($blocks as $block) {
         $sql .= "" . $block . " TEXT NULL, \n ";
     }
     $sql .= " PRIMARY KEY  (id) )";
     if (!static::maxbuttons_database_table_exists($table_name)) {
         //require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
         $result = dbDelta($sql);
     }
     if (static::maxbuttons_database_table_exists($table_name) && (get_option(MAXBUTTONS_VERSION_KEY) != MAXBUTTONS_VERSION_NUM || get_option(MAXBUTTONS_VERSION_KEY) == '')) {
         //require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
         dbDelta($sql);
     }
     // Reset the cache if there were any left from before
     $button->reset_cache();
     // Collection table
     $collection_table_name = maxUtils::get_collection_table_name();
     $sql = "CREATE TABLE " . $collection_table_name . " ( \n\t\t\t\t\tmeta_id int NOT NULL AUTO_INCREMENT, \n\t\t\t\t\tcollection_id int NOT NULL, \n\t\t\t\t\tcollection_key varchar(255), \n\t\t\t\t\tcollection_value text, \n\t\t\t\t\tPRIMARY KEY(meta_id) ) \n\t\t\t\t\t\n\t\t\t\t";
     dbDelta($sql);
     $collection_trans_table = maxUtils::get_coltrans_table_name();
     $sql = "CREATE TABLE {$collection_trans_table} ( \n \t\t\t\tname varchar(1000), \n\t\t\t\tvalue varchar(255),\n\t\t\t\texpire int,\n\t\t\t\tKEY(name) ); \n\t\t";
     $res = dbDelta($sql);
     //else exit( __("Something went wrong when creating database table", "maxbuttons") );
 }