prefix . "alm";
// **********************************************
// If table exists
// **********************************************
if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name) {
// Updated 2.0.5
// Check column 'name' exists in $wpdb - this is an upgrade checker.
$row = $wpdb->get_col("Show columns from $table_name like 'name'");
if(empty($row)){
$wpdb->query("ALTER TABLE $table_name ADD name TEXT NOT NULL");
$wpdb->update($table_name , array('name' => 'default'), array('id' => 1));
}
// ********
// @TO-DO - Upgrade test, will remove in future versions
// REMOVED - 2.1.3
// ********
$test = $wpdb->get_col("Show columns from $table_name like 'test'");
if(!empty($test)){
$wpdb->query("ALTER TABLE $table_name DROP test");
}
//Add column for repeater template alias
$alias = $wpdb->get_col("Show columns from $table_name like 'alias'");
if(empty($alias)){
$wpdb->query("ALTER TABLE $table_name ADD alias TEXT NOT NULL");
}
// Compare versions of repeaters, if template versions do not match, update the repeater with value from DB
$version = $wpdb->get_var("SELECT pluginVersion FROM $table_name WHERE name = 'default'");
if($version != ALM_VERSION){ // First, make sure versions do not match.
//Write to repeater file
$data = $wpdb->get_var("SELECT repeaterDefault FROM $table_name WHERE name = 'default'");
$f = ALM_PATH. 'core/repeater/default.php'; // File
$o = fopen($f, 'w+'); //Open file
$w = fwrite($o, $data); //Save the file
$r = fread($o, 100000); //Read it
fclose($o); //now close it
}
}
// **********************************************
// If table DOES NOT exist, create it.
// **********************************************
if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
$createRepeater = '
five additional repeaters and allow you to select unique repeaters for different content types throughout your theme.
It\'s easy, seriously! Simply build each repeater just the way you want them, then select a template from the list of available templates while building your shortcode.