function get_pano_description() { global $wpdb; $pano_table_name = get_pano_table_name(); $text_table_name = get_pano_text_table_name(); $language_code = get_user_language(); $url = $_SERVER['HTTP_REFERER']; $parts = explode('?pano_id=', $url); $pano_id = $parts[1]; if ($pano_id == NULL) { $pano_id = 1; } // DB query joining the pano table and the pano text table $panos = $wpdb->get_results("SELECT wppt.description FROM " . $pano_table_name . " wpp " . "INNER JOIN " . $text_table_name . " wppt ON " . "wppt.pano_id = " . "'" . $pano_id . "'" . "WHERE wppt.language_code = " . $language_code, ARRAY_A); return $panos; }
function panno_uninstall() { global $wpdb; // Get all the table names $pano_table_name = get_pano_table_name(); $pano_text_table_name = get_pano_text_table_name(); $quest_table_name = get_quest_table_name(); $quest_text_table_name = get_quest_text_table_name(); $mission_table_name = get_mission_table_name(); $mission_text_table_name = get_mission_text_table_name(); $hotspot_table_name = get_hotspot_table_name(); $progress_table_name = get_user_progress_table_name(); $skill_progress_table_name = get_user_skill_progress_table_name(); $skill_bonus_pts_table_name = get_user_skill_bonus_pts_table_name(); $type_table_name = get_type_table_name(); $prereq_table_name = get_prereq_table_name(); $activation_code_table_name = get_activation_code_table_name(); $ads_table_name = get_ads_table_name(); $ads_text_table_name = get_ads_text_table_name(); $domain_table_name = get_domain_table_name(); $tool_table_name = get_tool_table_name(); // Drop all the tables $wpdb->query("DROP TABLE IF EXISTS {$pano_table_name}"); $wpdb->query("DROP TABLE IF EXISTS {$pano_text_table_name}"); $wpdb->query("DROP TABLE IF EXISTS {$quest_text_table_name}"); $wpdb->query("DROP TABLE IF EXISTS {$quest_text_table_name}"); $wpdb->query("DROP TABLE IF EXISTS {$mission_table_name}"); $wpdb->query("DROP TABLE IF EXISTS {$mission_text_table_name}"); $wpdb->query("DROP TABLE IF EXISTS {$hotspot_table_name}"); $wpdb->query("DROP TABLE IF EXISTS {$progress_table_name}"); $wpdb->query("DROP TABLE IF EXISTS {$skill_progress_table_name}"); $wpdb->query("DROP TABLE IF EXISTS {$skill_bonus_pts_table_name}"); $wpdb->query("DROP TABLE IF EXISTS {$type_table_name}"); $wpdb->query("DROP TABLE IF EXISTS {$prereq_table_name}"); $wpdb->query("DROP TABLE IF EXISTS {$activation_code_table_name}"); $wpdb->query("DROP TABLE IF EXISTS {$ads_table_name}"); $wpdb->query("DROP TABLE IF EXISTS {$ads_text_table_name}"); $wpdb->query("DROP TABLE IF EXISTS {$domain_table_name}"); $wpdb->query("DROP TABLE IF EXISTS {$tool_table_name}"); echo "bbbbbbbbb"; // Update the db version to 0 so the next time the plugin is run it will reinstall update_option("panno_db_version", PANO_DB_VERSION); }
function get_pano_description() { global $wpdb; $pano_table_name = get_pano_table_name(); $text_table_name = get_pano_text_table_name(); $language_code = get_user_language(); // DB query joining the pano table and the pano text table $panos = $wpdb->get_results("SELECT wpp.id, wppt.description FROM " . $pano_table_name . " wpp " . "INNER JOIN " . $text_table_name . " wppt ON " . "wppt.pano_id = wpp.id " . "WHERE wppt.language_code = " . $language_code, ARRAY_A); return $panos; }
function delete_pano($pano_id) { global $wpdb; $pano_table_name = get_pano_table_name(); $text_table_name = get_pano_text_table_name(); $wpdb->delete($pano_table_name, array('id' => $pano_id)); $wpdb->delete($text_table_name, array('pano_id' => $pano_id)); }
function build_pano_text_sql() { $table_name = get_pano_text_table_name(); $sql = 'CREATE TABLE ' . $table_name . ' ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `pano_id` int(11) NOT NULL, `language_code` varchar(2) NOT NULL DEFAULT "", `title` varchar(255) NOT NULL DEFAULT "", `name` varchar(255) NOT NULL DEFAULT "", `description` text, `show_desc_onload` TINYINT DEFAULT 0, PRIMARY KEY (`id`) );'; return $sql; }