Beispiel #1
0
function gfullmap_plugin_install()
{
    $gfullmap_options = get_option('gfullmap_options');
    if (!$gfullmap_options) {
    }
    add_option('gfullmap_options', gfullmap_defaults());
    global $wpdb;
    $table_name = $wpdb->prefix . "fullwidthgooglemap";
    if ($wpdb->get_var("show tables like '{$table_name}'") == $table_name) {
    } else {
        create_fwgm_table();
        $table_name = $wpdb->prefix . "fullwidthgooglemap";
        $sql = "INSERT INTO " . $table_name . " values ('','gfullmap_options','1');";
        $wpdb->query($sql);
    }
}
function add_map_details()
{
    global $wpdb, $fwbm;
    $table_name = $wpdb->prefix . "fullwidthgooglemap";
    if (isset($_GET['add']) && $_GET['add'] == 1) {
        $option = $_POST['fullmap_option_name'];
        if (!get_option($_POST['fullmap_option_name'])) {
            if ($option) {
                $option = preg_replace('/[^a-z0-9\\s]/i', '', $option);
                $option = str_replace(" ", "_", $option);
                $options = get_option($option);
                if ($options) {
                    $fwbm = "Please Choose Different Name";
                } else {
                    $sql = "INSERT INTO " . $table_name . " values ('','" . $option . "','1');";
                    if ($wpdb->query($sql)) {
                        add_option($option, gfullmap_defaults());
                        $fwbm = 'Google Map Successfully Added';
                    }
                }
            } else {
                $fwbm = "Please Choose Different Name";
            }
        } else {
            $fwbm = "Please Choose Different Name";
        }
    } else {
        $fwbm = "Please Choose Different Name";
    }
    ?>
	<div class="show-message updated"> <?php 
    echo $fwbm;
    ?>
 </div>	
<?php 
}