prefix . "alm";
//If alm 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_results("SELECT COLUMN_NAME FROM $table_name.COLUMNS WHERE column_name = '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
$row2 = $wpdb->get_results("SELECT COLUMN_NAME FROM $table_name.COLUMNS WHERE column_name = 'test'");
if(empty($row2)){
$wpdb->query("ALTER TABLE $table_name ADD test TEXT NOT NULL");
$wpdb->update($table_name , array('test' => 'test value'), array('id' => 1));
}
// 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
}
}
}
/*
* alm_admin_vars
* Create admin variables and ajax nonce
*
* @since 2.0.0
*/
function alm_admin_vars() { ?>
A simple solution for lazy loading WordPress posts and pages