prefix."lugmap"; if ( isset( $_POST['lugmap_api_key'] ) && isset( $_POST['lugmap_coord'] ) ) { if($_POST['lugmap_api_key']) update_option('lugmap_api_key', attribute_escape($_POST['lugmap_api_key'])); if($_POST['lugmap_coord']) update_option('lugmap_coord', attribute_escape($_POST['lugmap_coord'])); ?>
.
prefix."lugmap"; $lm_name = $wpdb->escape($_POST['lm_name']); $lm_org = $wpdb->escape($_POST['lm_org']); $lm_email = $wpdb->escape($_POST['lm_email']); $lm_web = $wpdb->escape($_POST['lm_web']); $lm_dsc = $wpdb->escape($_POST['lm_dsc']); $lm_point = $wpdb->escape(strtok($_POST['lm_point'],"()")); $wpdb->query(" INSERT INTO $table(name, cord, email, web, dsc, point) VALUES('$lm_name', '$lm_org', '$lm_email', '$lm_web', '$lm_dsc', '$lm_point') "); } /** * Gmaps markers generation */ function maplug_markers() { global $wpdb; $table = $wpdb->prefix."lugmap"; $markers = $wpdb->get_results("SELECT * FROM $table"); foreach($markers as $marker) { echo "\t"."var point = new GLatLng(".stripslashes($marker->point).");"."\n"; echo "\t"."var marker = createMarker(point,'".$marker->name."'.__("You must be registered to add stuff to map").'.
'; $output .= ''; return $output; } /** * Clean lugmap table */ function lugmap_clean() { global $wpdb; $table = $wpdb->prefix."lugmap"; $wpdb->query("DROP TABLE $table"); lugmap_install(); } /** * Creating database tables and the rest of needed stuff */ function lugmap_install() { global $wpdb; $table = $wpdb->prefix."lugmap"; $structure = "CREATE TABLE $table ( id INT(9) NOT NULL AUTO_INCREMENT, name VARCHAR(80) NOT NULL, cord VARCHAR(40) NOT NULL, email VARCHAR(40) NOT NULL, web VARCHAR(1000) NOT NULL, dsc VARCHAR(2000) NOT NULL, point VARCHAR(20) NOT NULL, UNIQUE KEY id (id) );"; $wpdb->query($structure); // Populate table $wpdb->query("INSERT INTO $table(name, cord, email, web, dsc, point) VALUES('Grupul pentru software liber', 'Adi Roiban', 'adiroiban@gmail.com', 'http://softwareliber.ro/', 'Cluj-Napoca...', '46.785831, 23.686945')"); add_option('lugmap_coord','45.943161, 24.96676'); add_option('lugmap_api_key','Please add your Google Maps key'); } $lugmap_domain = 'lugmap'; load_plugin_textdomain($lugmap_domain, PLUGINDIR.'/'.dirname(plugin_basename(__FILE__))); add_shortcode('LUGMAP', 'lugmap_content'); add_action('admin_menu', 'lugmap_admin'); add_action('wp_head', 'lugmap_header'); register_activation_hook(__FILE__,'lugmap_install'); ?>