Ejemplo n.º 1
0
	function create_maps_meta()
	{
		$sql = "CREATE TABLE IF NOT EXISTS ".map_bank_meta_table()." (
				`meta_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
				`map_id` int(10) NOT NULL,
				`map_meta_key` varchar(255) NOT NULL,
				`map_meta_value` longtext NOT NULL,
				PRIMARY KEY (`meta_id`)
				) DEFAULT CHARSET=utf8 COLLATE utf8_general_ci";
		dbDelta($sql);
	}
Ejemplo n.º 2
0
Archivo: view.php Proyecto: Acens/Ejudi
<?php

global $wpdb;
$unique_id = rand(100, 10000);
$frontend_map = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . map_bank_meta_table() . " INNER JOIN " . map_bank_create_new_map_table() . " ON " . map_bank_create_new_map_table() . ".id = " . map_bank_meta_table() . ".map_id WHERE " . map_bank_create_new_map_table() . ".id = %d or " . map_bank_create_new_map_table() . ".parent_id = %d", $map_id, $map_id));
if (!function_exists("get_frontend_map_settings")) {
    function get_frontend_map_settings($id, $map_settings, $map_type)
    {
        $map_settings_array = array();
        foreach ($map_settings as $row) {
            if ($row->map_id == $id) {
                $map_settings_array["{$row->map_meta_key}"] = $row->map_meta_value;
                if ($map_type != "map") {
                    $map_settings_array["id"] = $row->id;
                }
            }
        }
        return $map_settings_array;
    }
}
if (!function_exists("get_frontend_geo_settings")) {
    function get_frontend_geo_settings($id, $map_settings, $match)
    {
        $map_marker_array = array();
        foreach ($map_settings as $row) {
            if ($row->parent_id == $id && $row->map_type == $match) {
                $marker = get_frontend_map_settings($row->id, $map_settings, $match);
                array_push($map_marker_array, $marker);
            }
        }
        return array_unique($map_marker_array, SORT_REGULAR);
Ejemplo n.º 3
0
	function form($instance)
	{
		global $wpdb;
		$unique_id = rand(100, 10000);
		$instance = wp_parse_args((array)$instance, array("title" => "","map_id" => "0","mapWidth" => "200","mapHeight" => "300",
		"zoomlevel" => "7", "mapscrollwheel" => TRUE,"mapborder" => TRUE,"mappx" => "px", "mapborderwidth" =>"2","mappx_h" => "px", "mapborderstyle" => "1",
		"mapborderradius" =>"1", "mapbordercolor" => "#000000", "show_title"=> TRUE));
		$title = $instance["title"];
		$maps = $wpdb->get_results
		(
			$wpdb->prepare
			(
				"SELECT * FROM " . map_bank_meta_table(). " INNER JOIN ".map_bank_create_new_map_table().
				" ON ".map_bank_create_new_map_table().".id = ".map_bank_meta_table().".map_id WHERE ".map_bank_create_new_map_table().
				".parent_id = %d and " . map_bank_create_new_map_table() . ".map_type=%s and ".map_bank_meta_table().".map_meta_key=%s ORDER BY " .map_bank_create_new_map_table().".id DESC " ,
				0,
				"map",
				"map_title"
			)
		);
		?>
		<p>
			<label for="<?php echo $this->get_field_id("title"); ?>"><?php _e("Title", map_bank); ?>:</label> <input
			 class="widefat" id="<?php echo $this->get_field_id("title"); ?>"
			 name="<?php echo $this->get_field_name("title"); ?>" type="text"
			 value="<?php echo esc_attr($title); ?>"/>
		</p>
		<p>
			<label for="<?php echo $this->get_field_id("map_id"); ?>"><?php _e("Select Map", map_bank); ?> : </label>
			<select size="1" name="<?php echo $this->get_field_name("map_id"); ?>"
				 id="<?php echo $this->get_field_id("map_id"); ?>" class="widefat">
				<option value="0"><?php _e("Select a Map", map_bank); ?> </option>
				<?php
				if ($maps) {
					foreach ($maps as $map) 
					{
						echo "<option value=\"" . $map->id . "\"";
						if ($map->id == $instance["map_id"]) echo "selected=\"selected\"";
						echo ">" . stripslashes(html_entity_decode($map->map_meta_value)) . "</option>" . "\n\t";
					}
				}
				?>
			</select>
		</p>
		<p>
			<label><?php _e("Width", map_bank); ?>:</label>
			<br>
			<input type="text" size="5"  name="<?php echo $this->get_field_name("mapWidth"); ?>" id="<?php echo $this->get_field_id("mapWidth"); ?>" 
			 value="<?php echo intval($instance["mapWidth"]);?>" class="widefat" />
		</p>
		<p>
			<label><?php _e("Height", map_bank); ?>:</label><br>
			<input type="text" size="5" name="<?php echo $this->get_field_name("mapHeight"); ?>" id="<?php echo $this->get_field_id("mapHeight"); ?>" 
			value="<?php echo intval($instance["mapHeight"]);?>" class="widefat" />
		</p>
		<p>
			<label for="<?php echo $this->get_field_id("zoomlevel"); ?>"><?php _e("Zoom Level", map_bank); ?>
			:</label>
			<select name="<?php echo $this->get_field_name("zoomlevel"); ?>" 
				id="<?php echo $this->get_field_id("zoomlevel"); ?>" class="widefat">
				<?php
				for($flag = 1;$flag <=20;$flag++)
				{
					?>
					<option value="<?php echo $flag;?>" <?php echo $flag == 12 ? "selected=\"selected\"" : ""; ?>><?php echo $flag . "";?></option>
					<?php 
				}
				?>
			</select>
		</p>
		<p>
			<label  for="<?php echo $this->get_field_id("mapscrollwheel"); ?>"><?php _e("Scrolling Wheel", map_bank); ?>
				:</label>
			<input type="checkbox" class="widefat" name="<?php echo $this->get_field_name("mapscrollwheel"); ?>" 
			id="<?php echo $this->get_field_id("mapscrollwheel"); ?>" value="1" <?php checked(TRUE, $instance["mapscrollwheel"]); ?>/>
		</p>
		<p>
			<label style="padding-right: 20px;" for="<?php echo $this->get_field_id("mapborder"); ?>"><?php _e("Map Border", map_bank); ?>
				:</label>
			<input type="checkbox" disabled="disabled" onclick="show_map_settings<?php echo $unique_id;?>();" class="widefat" name="<?php echo $this->get_field_name("mapborder"); ?>" 
			 id="<?php echo $this->get_field_id("mapborder"); ?>" value="1" <?php checked(TRUE, $instance["mapborder"]); ?>/></br>
			 <i class="widget_premium_feature"><?php _e(" (Available in Premium Editions)", map_bank); ?></i>
		</p>
		<div id="div_map_settings<?php echo $unique_id;?>" style="display: none;">
			<p>
				<label for="<?php echo $this->get_field_id("mapborderwidth"); ?>"><?php _e("Map Border Width", map_bank); ?>
				:</label>
				<select disabled="disabled" name="<?php echo $this->get_field_name("mapborderwidth"); ?>" 
					id="<?php echo $this->get_field_id("mapborderwidth"); ?>" class="widefat">
					<?php
						for($flag = 1;$flag <=20;$flag++)
						{
							?>
							<option value="<?php echo $flag;?>"><?php echo $flag. " px";?> <i class="widget_premium_feature"><?php _e(" (Available in Premium Editions)", map_bank); ?></i></option>
							<?php 
						}
						?>
				</select>
			</p>
			<p>
				<label for="<?php echo $this->get_field_id("mapborderstyle"); ?>"><?php _e("Map Border Style", map_bank); ?>
				:</label>
				<select disabled="disabled" name="<?php echo $this->get_field_name("mapborderstyle"); ?>" 
					id="<?php echo $this->get_field_id("mapborderstyle"); ?>" class="widefat">
					<option value="Solid"><?php _e("Solid", map_bank); ?><i class="widget_premium_feature"><?php _e(" (Available in Premium Editions)", map_bank); ?></i></option>
					<option value="Dotted"><?php _e("Dotted", map_bank); ?><i class="widget_premium_feature"><?php _e(" (Available in Premium Editions)", map_bank); ?></i></option>
					<option value="Dashed"><?php _e("Dashed", map_bank); ?><i class="widget_premium_feature"><?php _e(" (Available in Premium Editions)", map_bank); ?></i></option>
				</select>
			</p>
			<p>
				<label for="<?php echo $this->get_field_id("mapbordercolor"); ?>"><?php _e("Map Border Color", map_bank); ?>
				:</label>
				<input disabled="disabled" type="text" size="5"  name="<?php echo $this->get_field_name("mapbordercolor"); ?>" id="<?php echo $this->get_field_id("mapbordercolor"); ?>" 
				value="<?php echo esc_attr($instance["mapbordercolor"]);?><?php _e(" (Available in Premium Editions)", map_bank); ?>" class="widefat" />
			</p>
			<p>
				<label for="<?php echo $this->get_field_id("mapborderradius"); ?>"><?php _e("Map Border Radius", map_bank); ?>
				:</label>
				<select disabled="disabled" name="<?php echo $this->get_field_name("mapborderradius"); ?>" 
					id="<?php echo $this->get_field_id("mapborderradius"); ?>" class="widefat">
					<?php
					for($flag = 1;$flag <=20;$flag++)
					{
						?>
						<option value="<?php echo $flag;?>"><?php echo $flag. " px";?><i class="widget_premium_feature"><?php _e(" (Available in Premium Editions)", map_bank); ?></i></option>
						<?php 
					}
					?>
				</select>
			</p>
		</div>
		<p>
			<label style="padding-right: 27px;" for="<?php echo $this->get_field_id("show_title"); ?>"><?php _e("Show_Title", map_bank); ?>
			:</label>
			<input type="checkbox" class="widefat" name="<?php echo $this->get_field_name("show_title"); ?>"  
			id="<?php echo $this->get_field_id("show_title"); ?>" value="1" <?php checked(TRUE, $instance["show_title"]); ?>/>
		</p>
		<script type="text/javascript">
			jQuery(document).ready(function () {
				jQuery("#<?php echo $this->get_field_id("zoomlevel"); ?>").val("<?php echo $instance["zoomlevel"]; ?>");
				jQuery("#<?php echo $this->get_field_id("mapborderwidth"); ?>").val("<?php echo $instance["mapborderwidth"]; ?>");
				jQuery("#<?php echo $this->get_field_id("mapborderstyle"); ?>").val("<?php echo $instance["mapborderstyle"]; ?>");
				jQuery("#<?php echo $this->get_field_id("mapborderradius"); ?>").val("<?php echo $instance["mapborderradius"]; ?>");
				jQuery("#<?php echo $this->get_field_id("mappx"); ?>").val("<?php echo $instance["mappx"]; ?>");
				show_map_settings<?php echo $unique_id;?>();
			});
			
			function show_map_settings<?php echo $unique_id;?>()
			{
				var mapBorder = jQuery("#<?php echo $this->get_field_id("mapborder");?>").prop("checked");
				if(mapBorder == true)
				{
					jQuery("#div_map_settings<?php echo $unique_id;?>").css("display","block");
				}
				else
				{
					jQuery("#div_map_settings<?php echo $unique_id;?>").css("display","none");
				}
				
			}
		</script>
		<?php 
	}
Ejemplo n.º 4
0
} else {
    switch ($gmb_role) {
        case "administrator":
            $user_role_permission = "manage_options";
            break;
        case "editor":
            $user_role_permission = "publish_pages";
            break;
        case "author":
            $user_role_permission = "publish_posts";
            break;
    }
    if (!current_user_can($user_role_permission)) {
        return;
    } else {
        $map_details = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . map_bank_meta_table() . " INNER JOIN " . map_bank_create_new_map_table() . " ON " . map_bank_create_new_map_table() . ".id = " . map_bank_meta_table() . ".map_id WHERE " . map_bank_create_new_map_table() . ".parent_id = %d and " . map_bank_create_new_map_table() . ".map_type=%s and " . map_bank_meta_table() . ".map_meta_key=%s ORDER BY " . map_bank_create_new_map_table() . ".id DESC ", 0, "map", "map_title"));
        ?>
		<div id="map-bank" style="display:none;">
			<div class="fluid-layout responsive">
				<div style="padding:0px 0 3px 10px;">
					<h3 class="label-shortcode"><?php 
        _e("Insert Google Map Bank Shortcode", map_bank);
        ?>
</h3>
					<span>
						<i><?php 
        _e("Select a map below to add it to your post or page.", map_bank);
        ?>
</i>
					</span>
				</div>
Ejemplo n.º 5
0
<?php
global $wpdb;
$unique_id = rand(100, 10000);
$frontend_map = $wpdb->get_results
(
	$wpdb->prepare
	(
		"SELECT * FROM " . map_bank_meta_table(). " INNER JOIN ".map_bank_create_new_map_table().
		" ON ".map_bank_create_new_map_table().".id = ".map_bank_meta_table().".map_id WHERE ".map_bank_create_new_map_table().
		".id = %d or ".map_bank_create_new_map_table().".parent_id = %d",
		$map_id,
		$map_id
	)
);
if(!function_exists("get_frontend_map_settings"))
{
	function get_frontend_map_settings($id,$map_settings,$map_type)
	{
		$map_settings_array = array();
		foreach ($map_settings as $row)
		{
			if ($row->map_id == $id)
			{
				$map_settings_array["$row->map_meta_key"] = $row->map_meta_value;
				if($map_type != "map")
				{
					$map_settings_array["id"] = $row->id;
				}
			}
		}
		return $map_settings_array;
Ejemplo n.º 6
0
             $meta_map_key["map_id"] = intval($_REQUEST["map_id"]);
             $meta_map_key["map_meta_key"] = $key;
             $meta_map_value["map_meta_value"] = $val;
             $insert->update_data(map_bank_meta_table(), $meta_map_value, $meta_map_key);
         }
         die;
     }
     break;
 case "single_map_delete":
     if (wp_verify_nonce($_REQUEST["_wpnonce"], "one_map_delete")) {
         $wpdb->query($wpdb->prepare("DELETE FROM " . map_bank_meta_table() . " WHERE map_id IN (SELECT id FROM " . map_bank_create_new_map_table() . " WHERE parent_id = %d)", intval($_REQUEST["map_id"])));
         $wpdb->query($wpdb->prepare("DELETE FROM " . map_bank_create_new_map_table() . " WHERE parent_id = %d)", intval($_REQUEST["map_id"])));
         $delete_single_map = new save_data();
         $where = array();
         $where["map_id"] = intval($_REQUEST["map_id"]);
         $delete_single_map->delete_data(map_bank_meta_table(), $where);
         $where = array();
         $where["parent_id"] = intval($_REQUEST["map_id"]);
         $delete_single_map->delete_data(map_bank_create_new_map_table(), $where);
         $where = array();
         $where["id"] = intval($_REQUEST["map_id"]);
         $delete_single_map->delete_data(map_bank_create_new_map_table(), $where);
         die;
     }
     break;
 case "google_map_plugin_updates":
     if (wp_verify_nonce($_REQUEST["_wpnonce"], "update_plugin_nonce")) {
         $plugin_update = esc_attr($_REQUEST["google_map_updates"]);
         update_option("google-maps-bank-automatic-update", $plugin_update);
         die;
     }
Ejemplo n.º 7
0
         $user_role_permission = "manage_options";
         break;
     case "editor":
         $user_role_permission = "publish_pages";
         break;
     case "author":
         $user_role_permission = "publish_posts";
         break;
 }
 if (!current_user_can($user_role_permission)) {
     return;
 } else {
     if (isset($_REQUEST["map_id"])) {
         $map_id = intval($_REQUEST["map_id"]);
     }
     $map_settings = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . map_bank_meta_table() . " INNER JOIN " . map_bank_create_new_map_table() . " ON " . map_bank_create_new_map_table() . ".id = " . map_bank_meta_table() . ".map_id WHERE " . map_bank_create_new_map_table() . ".id = %d or " . map_bank_create_new_map_table() . ".parent_id = %d ORDER BY " . map_bank_create_new_map_table() . ".id DESC ", $map_id, $map_id));
     if (!function_exists("get_map_settings")) {
         function get_map_settings($id, $map_settings, $map_type)
         {
             $map_settings_array = array();
             foreach ($map_settings as $row) {
                 if ($row->map_id == $id) {
                     $map_settings_array["{$row->map_meta_key}"] = $row->map_meta_value;
                     $map_settings_array["creation_date"] = $row->creation_date;
                     if ($map_type != "map") {
                         $map_settings_array["id"] = $row->id;
                     }
                 }
             }
             return $map_settings_array;
         }
Ejemplo n.º 8
0
            $user_role_permission = "publish_pages";
            break;
        case "author":
            $user_role_permission = "publish_posts";
            break;
    }
    if (!current_user_can($user_role_permission)) {
        return;
    } else {
        $marker_one_delete = wp_create_nonce("marker_delete");
        $bulk_marker_delete = wp_create_nonce("marker_delete_bulk");
        $polygon_one_delete = wp_create_nonce("polygon_delete");
        $bulk_polygon_delete = wp_create_nonce("polygon_delete_bulk");
        $polyline_one_delete = wp_create_nonce("polyline_delete");
        $bulk_polyline_delete = wp_create_nonce("polyline_delete_bulk");
        $map_data_details = $wpdb->get_results($wpdb->prepare("SELECT " . map_bank_meta_table() . ".map_meta_value," . map_bank_create_new_map_table() . ".id FROM " . map_bank_meta_table() . " INNER JOIN " . map_bank_create_new_map_table() . " ON " . map_bank_create_new_map_table() . ".id = " . map_bank_meta_table() . ".map_id WHERE " . map_bank_create_new_map_table() . ".map_type = %s AND " . map_bank_meta_table() . ".map_meta_key = %s ORDER BY " . map_bank_create_new_map_table() . ".id DESC ", "map", "map_title"));
        if (isset($_REQUEST["map_id"])) {
            if (file_exists(MAP_BK_PLUGIN_DIR . "/lib/get-map-settings.php")) {
                include_once MAP_BK_PLUGIN_DIR . "/lib/get-map-settings.php";
            }
            $map_marker_count = $wpdb->get_var($wpdb->prepare("SELECT count(id) FROM " . map_bank_create_new_map_table() . " where  parent_id = %d AND map_type = %s ", $map_id, "marker"));
            $map_polygon_count = $wpdb->get_var($wpdb->prepare("SELECT count(id) FROM " . map_bank_create_new_map_table() . " WHERE parent_id = %d AND map_type = %s ", $map_id, "polygon"));
            $map_polylines_count = $wpdb->get_var($wpdb->prepare("SELECT count(id) FROM " . map_bank_create_new_map_table() . " WHERE parent_id = %d AND map_type = %s ", $map_id, "polyline"));
        }
        ?>
		<form id="frm_manage_map" name="frm_manage_map" class="layout-form" style="width:1000px;">
			<div class="fluid-layout">
				<div class="layout-span12 responsive">
					<div class="widget-layout">
						<div class="widget-layout-title">
							<h4><?php 
Ejemplo n.º 9
0
			$user_role_permission = "publish_posts";
		break;
	}
	if (!current_user_can($user_role_permission))
	{
		return;
	}
	else
	{
		$map_details = $wpdb->get_results
		(
			$wpdb->prepare
			(
				"SELECT * FROM " . map_bank_meta_table(). " INNER JOIN ".map_bank_create_new_map_table().
				" ON ".map_bank_create_new_map_table().".id = ".map_bank_meta_table().".map_id WHERE ".map_bank_create_new_map_table().
				".parent_id = %d and " . map_bank_create_new_map_table() . ".map_type=%s and ".map_bank_meta_table().".map_meta_key=%s ORDER BY " .map_bank_create_new_map_table().".id DESC ",
				0,
				"map",
				"map_title"
			)
		);
		?>
		<div id="map-bank" style="display:none;">
			<div class="fluid-layout responsive">
				<div style="padding:0px 0 3px 10px;">
					<h3 class="label-shortcode"><?php _e("Insert Google Map Bank Shortcode", map_bank); ?></h3>
					<span>
						<i><?php _e("Select a map below to add it to your post or page.", map_bank); ?></i>
					</span>
				</div>
				<div class="layout-span12 responsive" style="padding:15px 15px 0 0;">