<script type="text/javascript"> /* <![CDATA[ */ window.intergeo_maps = []; /* ]]> */ </script> <?php if ($query->have_posts()) { ?> <div id="intergeo_lbrr_items"><?php $index = 0; while ($query->have_posts()) { $post = $query->next_post(); $id = intergeo_encode($post->ID); $json = json_decode($post->post_content, true); $delete_url = add_query_arg(array('map' => $id, 'do' => 'delete', 'noheader' => 'true', 'nonce' => wp_create_nonce($post->ID . filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP)))); $libraries = intergeo_check_libraries($json, $libraries); ?> <div class="intergeo_lbrr_item"<?php echo $index != 0 && $index % 3 == 0 ? ' style="clear:both"' : ''; ?> > <div class="intergeo_lbrr_wrapper"> <div class="intergeo_lbrr_map_wrapper"> <div class="intergeo_lbrr_map_loader"> <div id="intergeo_map<?php echo $id; ?> " class="intergeo_lbrr_map"></div>
function intergeo_shortcode($attrs, $address = '') { $args = shortcode_atts(array('id' => false, 'hook' => false, 'width' => false, 'height' => false, 'style' => false, 'zoom' => false), $attrs); $address = trim($address); if (empty($args['id']) && empty($address)) { return ''; } $json = array(); if (!empty($args['id'])) { $post = get_post(intergeo_decode($args['id'])); if (!$post || $post->post_type != INTERGEO_PLUGIN_NAME) { return ''; } $json = json_decode($post->post_content, true); } else { $args['id'] = intergeo_encode(rand(0, 100) . rand(0, 10000)); $json['zoom'] = intval($args['zoom']) ? intval($args['zoom']) : 15; } if (!empty($address)) { $json['address'] = $address; } if (trim($args['hook']) != '') { $json = apply_filters($args['hook'], $json); } wp_enqueue_style('intergeo-frontend'); intergeo_enqueue_google_maps_script(intergeo_check_libraries($json)); if (!wp_script_is('intergeo-rendering')) { wp_enqueue_script('intergeo-rendering', INTERGEO_ABSURL . 'js/rendering.js', array('jquery', 'google-maps-v3'), INTERGEO_VERSION); wp_localize_script('intergeo-rendering', 'intergeo_options', array('adsense' => array('publisher_id' => get_option('intergeo_adsense_publisher_id')))); } $container = array(); if (isset($json['container'])) { $container = $json['container']; unset($json['container']); } $width = !empty($container['width']) ? esc_attr($container['width']) : '100%'; if (trim($args['width']) != '') { $width = $args['width']; } if (is_numeric($width)) { $width .= 'px'; } $height = !empty($container['height']) ? esc_attr($container['height']) : '300px'; if (trim($args['height']) != '') { $height = $args['height']; } if (is_numeric($height)) { $height .= 'px'; } $styles = !empty($container['styles']) ? esc_attr($container['styles']) : ''; if (trim($args['style']) != '') { $styles = $args['style']; } return sprintf(' <div id="intergeo_map%1$s" class="intergeo_map_canvas" style="width:100%%;height:300px;width:%2$s;height:%3$s;%4$s"></div> <script type="text/javascript"> /* <![CDATA[ */ if (!window.intergeo_maps) window.intergeo_maps = []; window.intergeo_maps.push( { container: \'intergeo_map%1$s\', options: %5$s } ); if (!window.intergeo_maps_current) window.intergeo_maps_current = null; /* ]]> */ </script> ', $args['id'], $width, $height, $styles, json_encode($json)); }