get_var("SHOW TABLES LIKE '" . XMASB_QUOTES_TABLE . "'") != XMASB_QUOTES_TABLE)
{
$sql = "CREATE TABLE " . XMASB_QUOTES_TABLE . " (
id mediumint(9) NOT NULL AUTO_INCREMENT,
author tinytext NOT NULL default '',
quote text NOT NULL,
imgsrc tinytext NOT NULL default '',
visible boolean NOT NULL default 1,
UNIQUE KEY id (id)
);";
require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
dbDelta($sql);
$author = "Bob Dole";
$quote = "The internet is a great way to get on the net.";
$insert = "INSERT INTO " . XMASB_QUOTES_TABLE . " (author, quote) VALUES "
. "('Bart', 'Remember, you can always find East by staring directly at the sun.'), "
. "('Homer', 'Kids, you tried your best and you failed miserably. The lesson is, never try.'), "
. "('Burns', 'A lifetime of working with nuclear power has left me with a healthy green glow... and left me as impotent as a Nevada boxing commissioner.'), "
. "('Lisa', 'Solitude never hurt anyone. Emily Dickinson lived alone, and she wrote some of the most beautiful poetry the world has ever known... then went crazy as a loon.'), "
. "('Marge', 'You should listen to your heart, and not the voices in your head.'), "
. "('Moe', 'Call this an unfair generalization if you must, but old people are no good at everything.'), "
. "(Ralph', 'Your toys are fun to touch. Mine are all sticky.')";
$results = $wpdb->query( $insert );
add_option("xmasb_quotes_db_version", $xmasb_quotes_db_version);
}
$installed_ver = get_option( "xmasb_quotes_db_version" );
if( $installed_ver != $xmasb_quotes_db_version )
{
$sql = "CREATE TABLE " . XMASB_QUOTES_TABLE . " (
id mediumint(9) NOT NULL AUTO_INCREMENT,
author tinytext NOT NULL default '',
quote text NOT NULL,
imgsrc tinytext NOT NULL default '',
visible boolean NOT NULL default 1,
UNIQUE KEY id (id)
);";
require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
dbDelta($sql);
update_option( "xmasb_quotes_db_version", $xmasb_quotes_db_version );
}
}
function xmasb_quotes_showlink()
{
$options = get_option('widget_xmasb_quotes');
$showlink = $options['showlink'] == 'yes' ? true : false;
if ( $showlink ) echo '
Cannot find the XmasB quotes plugin. If you have installed it check if you have activated it. If you have not installed it, you can download it from xmasb.com.