Exemplo n.º 1
0
/**
 * Template callback for GeoMashupQuery::list_users()
 *
 * @since 1.3
 * @param object $user The user to display.
 */
function geo_mashup_user_default_template($user)
{
    GeoMashupQuery::set_the_user($user);
    ?>
<div id="div-user-<?php 
    echo esc_attr($user->ID);
    ?>
" class="vcard">
	<div class="fn">
		<span class="type"><?php 
    _e('Display Name');
    ?>
</span>: <span class="value"><?php 
    echo esc_attr($user->display_name);
    ?>
</span>
	</div>
	<?php 
    echo GeoMashup::location_info('fields=locality_name,admin_code&format=<div class="adr"><span class="locality">%s</span>, <span class="region">%s</span></div>');
    ?>
	<?php 
    if (isset($user->user_url) && strlen($user->user_url) > 7) {
        ?>
	<div class="url">
		<span class="type"><?php 
        _e('Website');
        ?>
</span>: <a class="value" href="<?php 
        echo esc_attr($user->user_url);
        ?>
"><?php 
        echo esc_attr($user->user_url);
        ?>
</a>
	</div>
	<?php 
    }
    ?>
</div>
<?php 
}
/**
 * Map template tag alias.
 *
 * Leave one old shortcode function in the global namespace, since Bruce used
 * it with function_exists() in his implementation guide.
 *
 * @since 1.0
 * @access public
 * @deprecated 1.2 Use GeoMashup::map()
 *
 * @param array $atts Shortcode arguments.
 */
function geo_mashup_map($atts)
{
    return GeoMashup::map($atts);
}
Exemplo n.º 3
0
 /**
  * Get locations of objects.
  *
  * <code>
  * $results = GeoMashupDB::get_object_locations( array( 
  * 	'object_name' => 'user', 
  * 	'minlat' => 30,
  * 	'maxlat' => 40, 
  * 	'minlon' => -106, 
  * 	'maxlat' => -103 ) 
  * );
  * </code>
  * 
  * @since 1.3
  *
  * @param string $query_args Override default args.
  * @return array Array of matching rows.
  */
 public static function get_object_locations($query_args = '')
 {
     global $wpdb;
     $default_args = array('minlat' => null, 'maxlat' => null, 'minlon' => null, 'maxlon' => null, 'radius_km' => null, 'radius_mi' => null, 'map_cat' => null, 'tax_query' => null, 'map_post_type' => 'any', 'object_name' => 'post', 'show_future' => 'false', 'suppress_filters' => false, 'limit' => 0, 'map_offset' => 0);
     $query_args = wp_parse_args($query_args, $default_args);
     // Construct the query
     $object_name = $query_args['object_name'];
     $object_store = self::object_storage($object_name);
     if (empty($object_store)) {
         return null;
     }
     // Giving tables an alias was a mistake, now filters depend on them
     $field_string = "gmlr.object_id, gmlr.geo_date, o.{$object_store['label_column']} as label, gml.*";
     $table_string = "{$wpdb->prefix}geo_mashup_locations gml " . "INNER JOIN {$wpdb->prefix}geo_mashup_location_relationships gmlr " . $wpdb->prepare('ON gmlr.object_name = %s AND gmlr.location_id = gml.id ', $object_name) . "INNER JOIN {$object_store['table']} o ON o.{$object_store['id_column']} = gmlr.object_id";
     $wheres = array();
     $groupby = '';
     $having = '';
     if ('post' == $object_name) {
         $field_string .= ', o.post_author';
         if ($query_args['show_future'] == 'true') {
             $wheres[] = 'post_status in ( \'publish\',\'future\' )';
         } else {
             if ($query_args['show_future'] == 'only') {
                 $wheres[] = 'post_status = \'future\'';
             } else {
                 $wheres[] = 'post_status = \'publish\'';
             }
         }
     } else {
         if ('comment' == $object_name) {
             $wheres[] = 'comment_approved = \'1\'';
         }
     }
     $location_args = wp_array_slice_assoc($query_args, array_keys(GM_Location_Query::get_defaults()));
     $location_query = new GM_Location_Query($location_args);
     // Handle inclusion and exclusion of terms
     if (!empty($query_args['tax_query']) and is_array($query_args['tax_query'])) {
         $tax_query = $query_args['tax_query'];
     } else {
         $tax_query = array();
     }
     if (!empty($query_args['map_cat'])) {
         $cats = preg_split('/[,\\s]+/', $query_args['map_cat']);
         $escaped_include_ids = array();
         $escaped_exclude_ids = array();
         foreach ($cats as $cat) {
             if (is_numeric($cat)) {
                 if ($cat < 0) {
                     $escaped_exclude_ids[] = abs($cat);
                     $escaped_exclude_ids = array_merge($escaped_exclude_ids, get_term_children($cat, 'category'));
                 } else {
                     $escaped_include_ids[] = intval($cat);
                     $escaped_include_ids = array_merge($escaped_include_ids, get_term_children($cat, 'category'));
                 }
             } else {
                 // Slugs might begin with a dash, so we only include them
                 $term = get_term_by('slug', $cat, 'category');
                 if ($term) {
                     $escaped_include_ids[] = $term->term_id;
                     $escaped_include_ids = array_merge($escaped_include_ids, get_term_children($term->term_id, 'category'));
                 }
             }
         }
         if (!empty($escaped_include_ids)) {
             $tax_query[] = array('taxonomy' => 'category', 'terms' => $escaped_include_ids, 'field' => 'term_id');
         }
         if (!empty($escaped_exclude_ids)) {
             $tax_query[] = array('taxonomy' => 'category', 'terms' => $escaped_exclude_ids, 'operator' => 'NOT IN', 'field' => 'term_id');
         }
     }
     // end if map_cat exists
     if (!empty($tax_query)) {
         $tax_clauses = get_tax_sql($tax_query, 'o', $object_store['id_column']);
         $table_string .= $tax_clauses['join'];
         $wheres[] = preg_replace('/^ AND/', '', $tax_clauses['where']);
         $groupby = 'GROUP BY gmlr.object_id';
     }
     if ('post' == $object_name) {
         // Handle inclusion and exclusion of post types
         if ('any' == $query_args['map_post_type']) {
             $include_post_types = '';
             $searchable_post_types = GeoMashup::get_searchable_post_types();
             if (!empty($searchable_post_types)) {
                 $include_post_types .= "o.post_type IN ('" . join("', '", array_map('esc_sql', $searchable_post_types)) . "')";
             }
             $wheres[] = $include_post_types;
         } else {
             if (!is_array($query_args['map_post_type'])) {
                 $query_args['map_post_type'] = preg_split('/[,\\s]+/', $query_args['map_post_type']);
             }
             $wheres[] = "o.post_type IN ('" . join("', '", $query_args['map_post_type']) . "')";
         }
     }
     if (!empty($query_args['object_id'])) {
         $wheres[] = 'gmlr.object_id = ' . esc_sql($query_args['object_id']);
     } else {
         if (!empty($query_args['object_ids'])) {
             $wheres[] = 'gmlr.object_id IN ( ' . esc_sql($query_args['object_ids']) . ' )';
         }
     }
     if (!empty($query_args['exclude_object_ids'])) {
         $wheres[] = 'gmlr.object_id NOT IN ( ' . esc_sql($query_args['exclude_object_ids']) . ' )';
     }
     list($l_cols, $l_join, $l_where, $l_groupby) = $location_query->get_sql('o', $object_store['id_column']);
     $field_string .= $l_cols;
     $table_string .= $l_join;
     if (empty($groupby) and !empty($l_groupby)) {
         $groupby = 'GROUP BY ' . $l_groupby;
     }
     $where = empty($wheres) ? '' : 'WHERE ' . implode(' AND ', $wheres) . $l_where;
     $sort = isset($query_args['sort']) ? $query_args['sort'] : $object_store['sort'];
     $sort = empty($sort) ? '' : 'ORDER BY ' . esc_sql($sort);
     $offset = absint($query_args['map_offset']);
     $limit = absint($query_args['limit']);
     if ($limit or $offset) {
         $limit = " LIMIT {$offset},{$limit}";
     } else {
         $limit = '';
     }
     if (!$query_args['suppress_filters']) {
         $field_string = apply_filters('geo_mashup_locations_fields', $field_string);
         $table_string = apply_filters('geo_mashup_locations_join', $table_string);
         $where = apply_filters('geo_mashup_locations_where', $where);
         $sort = apply_filters('geo_mashup_locations_orderby', $sort);
         $groupby = apply_filters('geo_mashup_locations_groupby', $groupby);
         $limit = apply_filters('geo_mashup_locations_limits', $limit);
         $suppress_post_filters = defined('GEO_MASHUP_SUPPRESS_POST_FILTERS') && GEO_MASHUP_SUPPRESS_POST_FILTERS;
         if ('post' === $object_name and !$suppress_post_filters and isset($GLOBALS['sitepress'])) {
             // Ok, we're catering to WPML here. If we ever integrate with a WP_Query object for posts,
             // this could be made more general
             // This filter will include all translatable post types, I hope
             add_filter('get_translatable_documents', array(__CLASS__, 'wpml_filter_get_translatable_documents'));
             // Apply post query filters, changing posts table references to our alias
             // As of WPML 2.9 these calls can trigger undefined variable notices
             $table_string = $GLOBALS['sitepress']->posts_join_filter($table_string, null);
             $table_string = str_replace($wpdb->posts . '.', 'o.', $table_string);
             $where = $GLOBALS['sitepress']->posts_where_filter($where, null);
             $where = str_replace($wpdb->posts . '.', 'o.', $where);
             remove_filter('get_translatable_documents', array(__CLASS__, 'wpml_filter_get_translatable_documents'));
         }
     }
     $query_string = "SELECT {$field_string} FROM {$table_string} {$where} {$groupby} {$having} {$sort} {$limit}";
     $wpdb->query($query_string);
     return $wpdb->last_result;
 }
 function widget($args, $instance)
 {
     // Arrange footer scripts
     GeoMashup::register_script('geo-mashup-search-form', 'js/search-form.js', array(), GEO_MASHUP_VERSION, true);
     wp_enqueue_script('geo-mashup-search-form');
     if (!empty($instance['find_me_button'])) {
         GeoMashup::register_script('geo-mashup-search-find-me', 'js/find-me.js', array('jquery'), GEO_MASHUP_VERSION, true);
         wp_localize_script('geo-mashup-search-find-me', 'geo_mashup_search_find_me_env', array('client_ip' => $_SERVER['REMOTE_ADDR'], 'fail_message' => __('Couldn\'t find you...', 'GeoMashup'), 'my_location_message' => __('My Location', 'GeoMashup')));
         wp_enqueue_script('geo-mashup-search-find-me');
     }
     /** @var $before_widget */
     /** @var $after_widget */
     /** @var $before_title */
     /** @var $after_title */
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     echo $before_widget . $before_title . $title . $after_title;
     $results_page_id = intval($instance['results_page_id']);
     if (!$results_page_id) {
         echo '<p class="error">';
         _e('No Geo Mashup Search result page found - check widget settings.', 'GeoMashup');
         echo '</p>';
         return;
     }
     // Set up template variables
     $widget =& $this;
     $action_url = get_permalink($results_page_id);
     $object_name = $instance['object_name'];
     $categories = array();
     if (!empty($instance['categories'])) {
         $category_args = '';
         if ('all' != $instance['categories']) {
             $category_args = 'include=' . $instance['categories'];
         }
         $categories = get_categories($category_args);
     }
     $radii = empty($instance['radius_list']) ? array() : wp_parse_id_list($instance['radius_list']);
     // Load the template
     $template = GeoMashup::locate_template('search-form');
     require $template;
     echo $after_widget;
 }
Exemplo n.º 5
0
<div id="geo-mashup-search-results">

	<h2><?php 
_e('Search results near', 'GeoMashup');
?>
 "<?php 
echo $search_text;
?>
"</h2>
	
	<?php 
if ($geo_mashup_search->have_posts()) {
    ?>

	<?php 
    echo GeoMashup::map(array('name' => 'search-results-map', 'search_text' => $search_text, 'object_ids' => $geo_mashup_search->get_the_ID_list(), 'center_lat' => $near_location['lat'], 'center_lng' => $near_location['lng'], 'search_lat' => $near_location['lat'], 'search_lng' => $near_location['lng'], 'object_name' => $object_name, 'zoom' => $approximate_zoom + 1));
    ?>

		<?php 
    if ($object_name == 'post') {
        ?>

			<?php 
        while ($geo_mashup_search->have_posts()) {
            $geo_mashup_search->the_post();
            ?>
					<div class="search-result">
						<h3><a href="<?php 
            the_permalink();
            ?>
" title=""><?php 
 /**
  * Print the form script in the footer if it's needed.
  *
  * @since 1.4
  */
 public function wp_footer()
 {
     global $geo_mashup_options;
     if ($this->add_form_script) {
         GeoMashup::register_script('geo-mashup-comment-form', 'js/comment-form.js', array('jquery'), GEO_MASHUP_VERSION, true);
         wp_localize_script('geo-mashup-comment-form', 'geo_mashup_comment_form_settings', array('geonames_username' => $geo_mashup_options->get('overall', 'geonames_username')));
         wp_print_scripts('geo-mashup-comment-form');
     }
 }
 /**
  * Issue 691
  */
 function test_map_content_with_object_ids()
 {
     $post_ids = $this->generate_rand_located_posts(3);
     $html = GeoMashup::map(array('object_name' => 'post', 'object_ids' => implode(',', $post_ids)));
     $this->assertContains('map_content=global', $html, 'Expected global map content when object_ids are passed.');
 }
Exemplo n.º 8
0
 /**
  * issue 718
  */
 function test_show_on_map_url_parameters()
 {
     global $geo_mashup_options;
     $page_id = $this->factory->post->create(array('post_type' => 'page'));
     $geo_mashup_options->set_valid_options(array(array('overall' => array('mashup_page' => $page_id))));
     $post_id = $this->factory->post->create();
     $location = $this->rand_location(4);
     GeoMashupDB::set_object_location('post', $post_id, $location, false);
     $test_query = new WP_Query(array('p' => $post_id));
     $test_query->the_post();
     $test_args = array('text' => 'TEST TEXT', 'zoom' => 10);
     $this->assertNotContains('text=', GeoMashup::show_on_map_link($test_args));
     $this->assertContains('zoom=10', GeoMashup::show_on_map_link($test_args));
 }
Exemplo n.º 9
0
        ?>
			
			<p class="postmeta">
			<?php 
        if (!is_page()) {
            ?>
			<span class="postauthor">Pubblicato il <?php 
            the_time('j M y');
            ?>
 alle <?php 
            the_time();
            ?>
</span> 
			<?php 
            if (is_callable(array('GeoMashup', 'show_on_map_link'))) {
                $linkString = GeoMashup::show_on_map_link('text=Map%20&show_icon=false');
                if ($linkString != "") {
                    echo ' &#183; ';
                    echo $linkString;
                }
            }
            ?>
			&#183; <?php 
            _e('Contenuto in:');
            ?>
 <?php 
            the_category(', ');
            ?>
			<?php 
            $posttags = get_the_tags($post->ID);
            if ($posttags) {
Exemplo n.º 10
0
<?php

/**
 * Data and dependencies for automated functional tests.
 * @package GeoMashup
 */
$width = 400;
$height = 400;
$name = 'test-map';
$global_locations = array("test_range" => array("lat" => "37.80338", "lng" => "-116.77927", "title" => "tonopah test range"), "cactus_flat" => array("lat" => "37.79133", "lng" => "-116.70951", "title" => "Cactus flat"), "west_intersection" => array("lat" => "37.82009", "lng" => "-116.697121", "title" => "Western intersection"), "south_intersection" => array("lat" => "37.793508", "lng" => "-116.671028", "title" => "Southern intersection"), "north_intersection" => array("lat" => "37.841784", "lng" => "-116.658325", "title" => "Northern intersection"));
$global_data = array("name" => $name, "width" => $width, "height" => $height, "map_type" => "G_NORMAL_MAP", "zoom" => "10", "background_color" => "c0c0c0", "map_control" => "GSmallZoomControl", "add_map_type_control" => array("G_NORMAL_MAP", "G_SATELLITE_MAP", "G_PHYSICAL_MAP"), "add_overview_control" => "true", "add_google_bar" => "false", "enable_scroll_wheel_zoom" => "true", "show_post" => "false", "show_future" => "true", "marker_select_info_window" => "false", "marker_select_highlight" => "true", "marker_select_center" => "true", "marker_select_attachments" => "false", "max_posts" => "", "auto_info_open" => "false", "cluster_max_zoom" => "9", "include_taxonomies" => array("test_tax"), "map_content" => "global", "ajaxurl" => admin_url('admin-ajax.php'), "siteurl" => home_url('/'), "url_path" => GEO_MASHUP_URL_PATH, "template_url_path" => get_stylesheet_directory_uri(), "custom_url_path" => "", "context_object_id" => 0, "object_data" => array("objects" => array(array("object_name" => "post", "object_id" => "1", "title" => $global_locations['test_range']['title'] . ' post', "lat" => $global_locations['test_range']['lat'], "lng" => $global_locations['test_range']['lng'], "author_name" => "admin", "terms" => array("test_tax" => array("1"))), array("object_name" => "post", "object_id" => "2", "title" => $global_locations['cactus_flat']['title'] . ' post', "lat" => $global_locations['cactus_flat']['lat'], "lng" => $global_locations['cactus_flat']['lng'], "author_name" => "admin", "terms" => array("test_tax" => array("3"))), array("object_name" => "post", "object_id" => "3", "title" => $global_locations['west_intersection']['title'] . ' post', "lat" => $global_locations['west_intersection']['lat'], "lng" => $global_locations['west_intersection']['lng'], "author_name" => "admin", "terms" => array("test_tax" => array("2"))), array("object_name" => "post", "object_id" => "4", "title" => $global_locations['south_intersection']['title'] . ' post', "lat" => $global_locations['south_intersection']['lat'], "lng" => $global_locations['south_intersection']['lng'], "author_name" => "admin", "terms" => array("test_tax" => array("2", "3"))), array("object_name" => "post", "object_id" => "5", "title" => $global_locations['north_intersection']['title'] . ' post', "lat" => $global_locations['north_intersection']['lat'], "lng" => $global_locations['north_intersection']['lng'], "author_name" => "admin", "terms" => array("test_tax" => array("2"))), array("object_name" => "post", "object_id" => "6", "title" => 'A second post at ' . $global_locations['cactus_flat']['title'], "lat" => $global_locations['cactus_flat']['lat'], "lng" => $global_locations['cactus_flat']['lng'], "author_name" => "admin", "terms" => array("test_tax" => array("1"))))), "check_all_label" => "Check/Uncheck All", "term_properties" => array("test_tax" => array("label" => "Test Taxonomy", "terms" => array("1" => array("name" => "Term One", "parent_id" => "", "color" => "red"), "2" => array("name" => "Term One Child", "parent_id" => "1", "color" => "fuchsia", "line_zoom" => "10"), "3" => array("name" => "Other Term", "parent_id" => "", "color" => "olive")))));
$test_apis = array('googlev3', 'openlayers');
$global_urls = array();
foreach ($test_apis as $test_api) {
    $api_data = $global_data;
    $api_data['map_api'] = $test_api;
    $data_key = $test_api . '-global-test';
    set_transient('gmm' . $data_key, $api_data);
    $global_urls[$test_api] = htmlspecialchars_decode(GeoMashup::build_home_url(array('geo_mashup_content' => 'render-map', 'map_data_key' => $data_key)));
}
$location_count = count($global_locations);
wp_localize_script('geo-mashup-tests', 'gm_test_data', compact('test_apis', 'global_urls', 'location_count', 'width', 'height', 'name'));
Exemplo n.º 11
0
    ?>
    <?php 
    echo wp_get_attachment_image(simple_fields_value("thumbnail"), 'infowindow');
    ?>
    <h2><a href="<?php 
    the_permalink();
    ?>
" title="<?php 
    the_title_attribute();
    ?>
"><?php 
    the_title();
    ?>
</a></h2>
    <p><?php 
    echo GeoMashup::location_info();
    ?>
</p>

    <?php 
    $website = simple_fields_value("website");
    $email = simple_fields_value("email");
    if (!empty($website)) {
        ?>
      <p><?php 
        echo link_to('Sito Internet', $website);
        ?>
</p>
    <?php 
    }
    if (!empty($email)) {
Exemplo n.º 12
0
<?php 
}
?>




<?php 
if (is_search() || is_archive()) {
    ?>
 <div style="height:400px;"><?php 
    echo GeoMashup::map("width=100%&height=400&zoom=auto");
    ?>
</div>
<div style="background:black; text-align:center"><?php 
    echo GeoMashup::term_legend("check_all=true&format=ul&check_all=false");
    ?>
</div> 
<?php 
}
?>




<div id="main">
<div class="container clearfix">



Exemplo n.º 13
0
/**
 * Print the Geo Mashup location editor HTML for an object.
 *
 * Goals for this interface are to make it usable for any kind of locatable
 * object, to be usable without javascript, functional on the front end or admin, 
 * and eventually adaptable to editing multiple locations for an object.
 *
 * It's assumed this will go inside an existing form for editing the object, 
 * such as the WordPress admin post edit form.
 *
 * @since 1.2
 * @see geo-mashup-ui-managers.php
 * @see geo-mashup-location-editor.js
 * @uses edit-form.css
 * @access public
 *
 * @param string $object_name The type of object, e.g. 'post', 'user', etc.
 * @param string $object_id The ID of the object being edited.
 * @param string $ui_manager Optionally the name of UI Manager class to use for AJAX operations.
 */
function geo_mashup_edit_form($object_name, $object_id, $ui_manager = '')
{
    global $geo_mashup_options;
    $help_class = 'geo-mashup-js';
    $add_input_style = 'style="display:none;"';
    $update_input_style = $delete_input_style = '';
    $coordinate_string = '';
    // Load any existing location for the object
    $location = GeoMashupDB::get_object_location($object_name, $object_id);
    if (empty($location)) {
        $location = GeoMashupDB::blank_object_location();
        $help_class = '';
        $add_input_style = '';
        $update_input_style = $delete_input_style = 'style="display:none;"';
    } else {
        $coordinate_string = $location->lat . ',' . $location->lng;
    }
    $post_location_name = $location->saved_name;
    $kml_url = '';
    // Set a Geo date default when needed & possible
    $date_missing = empty($location->geo_date) || '0000-00-00 00:00:00' == $location->geo_date;
    if ('post' == $object_name) {
        if ($date_missing) {
            // Geo date defaults to post date
            $post = get_post($object_id);
            $location->geo_date = $post->post_date;
            if (!empty($location->id)) {
                GeoMashupDB::set_object_location($object_name, $object_id, $location->id, false, $location->geo_date);
            }
        }
        // For posts, look for a KML attachment
        $kml_urls = GeoMashup::get_kml_attachment_urls($object_id);
        if (count($kml_urls) > 0) {
            $kml_url = array_pop($kml_urls);
        }
    } else {
        if ('user' == $object_name && $date_missing) {
            // Geo date defaults to registration date
            $user = get_userdata($object_id);
            $location->geo_date = $user->user_registered;
            if (!empty($location->id)) {
                GeoMashupDB::set_object_location($object_name, $object_id, $location->id, false, $location->geo_date);
            }
        } else {
            if ('comment' == $object_name && $date_missing) {
                // Geo date defaults to comment date
                $comment = get_comment($object_id);
                $location->geo_date = $comment->comment_date;
                if (!empty($location->id)) {
                    GeoMashupDB::set_object_location($object_name, $object_id, $location->id, false, $location->geo_date);
                }
            }
        }
    }
    if (empty($location->geo_date)) {
        $location_datetime = mktime();
    } else {
        $location_datetime = strtotime($location->geo_date);
    }
    $location_date = date('M j, Y', $location_datetime);
    $location_hour = date('G', $location_datetime);
    $location_minute = date('i', $location_datetime);
    // Load saved locations
    $saved_locations = GeoMashupDB::get_saved_locations();
    $saved_location_options = array();
    if (!empty($saved_locations)) {
        foreach ($saved_locations as $saved_location) {
            $escaped_name = str_replace(array("\r\n", "\r", "\n"), '', $saved_location->saved_name);
            if ($saved_location->id != $location->id) {
                $selected = '';
            } else {
                $selected = ' selected="selected"';
            }
            $saved_location_options[] = '<option value="' . esc_attr($saved_location->id . '|' . $saved_location->lat . '|' . $saved_location->lng . '|' . $saved_location->address) . '"' . $selected . '>' . esc_html($escaped_name) . '</option>';
        }
    }
    $saved_location_options = implode('', $saved_location_options);
    $nonce = wp_create_nonce('geo-mashup-edit');
    $static_maps_base_url = 'http://maps.google.com/maps/api/staticmap?sensor=false&amp;key=' . $geo_mashup_options->get('overall', 'google_key');
    ?>
	<div id="geo_mashup_location_editor">
	<div id="geo_mashup_ajax_message" class="geo-mashup-js ui-state-highlight"></div>
	<input id="geo_mashup_nonce" name="geo_mashup_nonce" type="hidden" value="<?php 
    echo $nonce;
    ?>
" />
	<input id="geo_mashup_changed" name="geo_mashup_changed" type="hidden" value="" />
	<?php 
    ob_start();
    ?>
	<table id="geo-mashup-location-table">
		<thead class="ui-widget-header">
		<tr>
			<th><?php 
    _e('Address', 'GeoMashup');
    ?>
</th>
			<th><?php 
    _e('Saved Name', 'GeoMashup');
    ?>
</th>
			<th><?php 
    _e('Geo Date', 'GeoMashup');
    ?>
</th>
		</tr>
		</thead>
		<tbody class="ui-widget-content">
		<tr id="geo_mashup_display" class="geo-mashup-display-row">
			<td class="geo-mashup-info">
				<div class="geo-mashup-address"><?php 
    echo esc_html($location->address);
    ?>
</div>
				<div class="geo-mashup-coordinates"><?php 
    echo esc_attr($coordinate_string);
    ?>
</div>
			</td>
			<td id="geo_mashup_saved_name_ui">
				<input id="geo_mashup_location_name" name="geo_mashup_location_name" size="50" type="text" value="<?php 
    echo esc_attr($post_location_name);
    ?>
" />
			</td>
			<td id="geo_mashup_date_ui">
				<input id="geo_mashup_date" name="geo_mashup_date" type="text" size="20" value="<?php 
    echo esc_attr($location_date);
    ?>
" /><br />
				@
				<input id="geo_mashup_hour" name="geo_mashup_hour" type="text" size="2" maxlength="2" value="<?php 
    echo esc_attr($location_hour);
    ?>
" />
				:
				<input id="geo_mashup_minute" name="geo_mashup_minute" type="text" size="2" maxlength="2" value="<?php 
    echo esc_attr($location_minute);
    ?>
" />
			</td>
			<td id="geo_mashup_ajax_buttons">
			</td>

		</tr>
		</tbody>
	</table>
	<?php 
    $location_table_html = ob_get_clean();
    ?>
	<?php 
    ob_start();
    ?>
	<div id="geo_mashup_map" class="geo-mashup-js">
		<?php 
    _e('Loading Google map. Check Geo Mashup options if the map fails to load.', 'GeoMashup');
    ?>
	</div>
	<?php 
    if (!empty($location->id)) {
        ?>
	<noscript>
		<div id="geo_mashup_static_map">
			<img src="<?php 
        echo $static_maps_base_url;
        ?>
&amp;size=400x300&amp;zoom=4&amp;markers=size:small|color:green|<?php 
        echo esc_attr($location->lat . ',' . $location->lng);
        ?>
" 
				alt="<?php 
        _e('Location Map Image', 'GeoMashup');
        ?>
" />
		</div>
	</noscript>
	<?php 
    }
    ?>
	<?php 
    $map_html = ob_get_clean();
    ?>
	<?php 
    ob_start();
    ?>
	<label for="geo_mashup_search"><?php 
    _e('Find a new location:', 'GeoMashup');
    ?>
	<input	id="geo_mashup_search" name="geo_mashup_search" type="text" size="35" />
	</label>

	<?php 
    _e('or select from', 'GeoMashup');
    ?>
 
	<select id="geo_mashup_select" name="geo_mashup_select"> 
		<option value=""><?php 
    _e('[Saved Locations]', 'GeoMashup');
    ?>
</option>
		<?php 
    echo $saved_location_options;
    ?>
	</select>
	<?php 
    $search_html = ob_get_clean();
    ?>

	<?php 
    echo empty($location->id) ? $search_html . $map_html . $location_table_html : $location_table_html . $map_html . $search_html;
    ?>

	<input id="geo_mashup_ui_manager" name="geo_mashup_ui_manager" type="hidden" value="<?php 
    echo $ui_manager;
    ?>
" />
	<input id="geo_mashup_object_id" name="geo_mashup_object_id" type="hidden" value="<?php 
    echo $object_id;
    ?>
" />
	<input id="geo_mashup_no_js" name="geo_mashup_no_js" type="hidden" value="true" />
	<input id="geo_mashup_location_id" name="geo_mashup_location_id" type="hidden" value="<?php 
    echo esc_attr($location->id);
    ?>
" />
	<input id="geo_mashup_location" name="geo_mashup_location" type="hidden" value="<?php 
    echo esc_attr($coordinate_string);
    ?>
" />
	<input id="geo_mashup_geoname" name="geo_mashup_geoname" type="hidden" value="<?php 
    echo esc_attr($location->geoname);
    ?>
" />
	<input id="geo_mashup_address" name="geo_mashup_address" type="hidden" value="<?php 
    echo esc_attr($location->address);
    ?>
" />
	<input id="geo_mashup_postal_code" name="geo_mashup_postal_code" type="hidden" value="<?php 
    echo esc_attr($location->postal_code);
    ?>
" />
	<input id="geo_mashup_country_code" name="geo_mashup_country_code" type="hidden" value="<?php 
    echo esc_attr($location->country_code);
    ?>
" />
	<input id="geo_mashup_admin_code" name="geo_mashup_admin_code" type="hidden" value="<?php 
    echo esc_attr($location->admin_code);
    ?>
" />
	<input id="geo_mashup_admin_name" name="geo_mashup_admin_name" type="hidden" value="" />
	<input id="geo_mashup_kml_url" name="geo_mashup_kml_url" type="hidden" value="<?php 
    echo $kml_url;
    ?>
" />
	<input id="geo_mashup_sub_admin_code" name="geo_mashup_sub_admin_code" type="hidden" value="<?php 
    echo esc_attr($location->sub_admin_code);
    ?>
" />
	<input id="geo_mashup_sub_admin_name" name="geo_mashup_sub_admin_name" type="hidden" value="" />
	<input id="geo_mashup_locality_name" name="geo_mashup_locality_name" type="hidden" value="<?php 
    echo esc_attr($location->locality_name);
    ?>
" />
	<div id="geo_mashup_submit" class="submit">
		<input id="geo_mashup_add_location" name="geo_mashup_add_location" type="submit" <?php 
    echo $add_input_style;
    ?>
 value="<?php 
    _e('Add Location', 'GeoMashup');
    ?>
" />
		<input id="geo_mashup_delete_location" name="geo_mashup_delete_location" type="submit" <?php 
    echo $delete_input_style;
    ?>
 value="<?php 
    _e('Delete', 'GeoMashup');
    ?>
" />
		<input id="geo_mashup_update_location" name="geo_mashup_update_location" type="submit" <?php 
    echo $update_input_style;
    ?>
 value="<?php 
    _e('Save', 'GeoMashup');
    ?>
" />
	</div>
	<div id="geo-mashup-inline-help-link-wrap" class="geo-mashup-js">
		<a href="#geo-mashup-inline-help" id="geo-mashup-inline-help-link"><?php 
    _e('help', 'GeoMashup');
    ?>
<span class="ui-icon ui-icon-triangle-1-s"></span></a>
	</div>
	<div id="geo-mashup-inline-help" class="<?php 
    echo $help_class;
    ?>
 ui-widget-content">
		<p><?php 
    _e('<em>Saved Name</em> is an optional name you may use to add entries to the Saved Locations menu.', 'GeoMashup');
    ?>
</p>
		<p><?php 
    _e('<em>Geo Date</em> associates a date (most formats work) and time with a location. Leave the default value if uncertain.', 'GeoMashup');
    ?>
</p>
		<div class="geo-mashup-js">
			<p><?php 
    _e('Put a green pin at a new location. There are many ways to do it:', 'GeoMashup');
    ?>
</p>
			<ul>
				<li><?php 
    _e('Search for a location name.', 'GeoMashup');
    ?>
</li>
				<li><?php 
    _e('For multiple search results, mouse over pins to see location names, and click a result pin to select that location.', 'GeoMashup');
    ?>
</li>
				<li><?php 
    _e('Search for a decimal latitude and longitude separated by a comma, like <em>40.123,-105.456</em>. Seven decimal places are stored. Negative latitude is used for the southern hemisphere, and negative longitude for the western hemisphere.', 'GeoMashup');
    ?>
</li> 
				<li><?php 
    _e('Search for a street address, like <em>123 main st, anytown, acity</em>.', 'GeoMashup');
    ?>
</li>
				<li><?php 
    _e('Click on the location. Zoom in if necessary so you can refine the location by dragging it or clicking a new location.', 'GeoMashup');
    ?>
</li>
			</ul>
			<p><?php 
    _e('To execute a search, type search text into the Find Location box and hit the enter key. If you type a name next to "Save As", the location will be saved under that name and added to the Saved Locations dropdown list.', 'GeoMashup');
    ?>
</p>
			<p><?php 
    _e('To remove the location (green pin), clear the search box and hit the enter key.', 'GeoMashup');
    ?>
</p>
			<p><?php 
    _e('When you are satisfied with the location, save or update.', 'GeoMashup');
    ?>
</p>
		</div>
		<noscript>
			<div>
				<p><?php 
    _e('To add or update location choose a saved location, or find a new location using one of these formats:', 'GeoMashup');
    ?>
</p>
				<ul>
					<li><?php 
    _e('A place name like <em>Yellowstone National Park</em>', 'GeoMashup');
    ?>
</li>
					<li><?php 
    _e('A decimal latitude and longitude, like <em>40.123,-105.456</em>.', 'GeoMashup');
    ?>
</li> 
					<li><?php 
    _e('A full or partial street address, like <em>123 main st, anytown, acity 12345 USA</em>.', 'GeoMashup');
    ?>
</li>
				</ul>
				<p><?php 
    _e('When you save or update, the closest match available will be saved as the location.', 'GeoMashup');
    ?>
</p>
			</div>
		</noscript>

	</div>
	</div><!-- id="geo_mashup_location_editor" -->
<?php 
}
        /**
         * Code for hacking form output
         * 
         * @access public
         * @return String
         */
        function formHack($args, $options)
        {
            extract($args);
            $output = "";
            if (class_exists('GeoMashupDB')) {
                global $geo_mashup_options;
                /* latest version: 1.2beta1x */
                if ($geo_mashup_options->get('overall', 'google_key')) {
                    $link_url = get_bloginfo('wpurl') . '/wp-content/plugins/geo-mashup';
                    $output = '
                  <style type="text/css"> #geo_mashup_map div { margin:0; } </style>
                  <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=' . $geo_mashup_options->get('overall', 'google_key') . '" type="text/javascript"></script>
                  <script src="' . $link_url . '/geo-mashup-admin.js" type="text/javascript"></script>
                  <script src="' . $link_url . '/JSONscriptRequest.js" type="text/javascript"></script>';
                    $output .= '
                  <?php               
                  $location =  GeoMashupDB::blank_location( );
                  $post_location_name = $location->saved_name;

                  if(isset($geo_mashup_location)) {
                        list($lat,$lng) = split(\',\',$geo_mashup_location);
                        $current_location = array( );
                        $current_location[\'lat\'] = trim( $lat );
                        $current_location[\'lng\'] = trim( $lng );
                        $current_location[\'saved_name\'] = $geo_mashup_location_name;
                        $current_location[\'geoname\'] = $geo_mashup_geoname;
                        $current_location[\'address\'] = $geo_mashup_address;
                        $current_location[\'postal_code\'] = $geo_mashup_postal_code;
                        $current_location[\'country_code\'] = $geo_mashup_country_code;
                        $current_location[\'admin_code\'] = $geo_mashup_admin_code;
                        $current_location[\'admin_name\'] = $geo_mashup_admin_name;
                        $current_location[\'sub_admin_code\'] = $geo_mashup_sub_admin_code;
                        $current_location[\'sub_admin_name\'] = $geo_mashup_sub_admin_name;
                        $current_location[\'locality_name\'] = $geo_mashup_locality_name;
                        $location = (object) $current_location;
                  } ?>';
                    $kml_url = '';
                    $saved_locations = GeoMashupDB::get_saved_locations();
                    $locations_json = '{';
                    /* don't need */
                    $locations_json .= '}';
                    $output .= '
                  <img id="geo_mashup_status_icon" src="' . $link_url . '/images/idle_icon.gif" style="float:right" />
                  <label for="geo_mashup_search">' . __('Find location:', 'GeoMashup') . '
                  <input id="geo_mashup_search" 
                         name="geo_mashup_search" 
                         type="text" 
                         size="35" 
                         value="<?php echo $geo_mashup_search; ?>"
                         onfocus="this.select(); GeoMashupAdmin.map.checkResize();"
                         onkeypress="return GeoMashupAdmin.searchKey(event, this.value)" />
                   </label>
                   <select id="geo_mashup_select" name="geo_mashup_select" onchange="GeoMashupAdmin.onSelectChange(this);" style="display:none;">
                        <option>' . __('[Saved Locations]', 'GeoMashup') . '</option>
                   </select>
                   <a href="#" onclick="document.getElementById(\'geo_mashup_inline_help\').style.display=\'block\'; return false;">' . __('Help', 'GeoMashup') . '</a>
                   <div id="geo_mashup_inline_help" style="padding:5px; border:2px solid blue; background-color:#ffc; display:none;">
                       <p>' . __('Put a green pin at the location for this post.', 'tdomf') . ' ' . __('There are many ways to do it:', 'tdomf') . '
                       <ul>
                        <li>' . __('Search for a location name.', 'tdomf') . '</li>
                        <li>' . __('For multiple search results, mouse over pins to see location names, and click a result pin to select that location.', 'tdomf') . '</li>
                        <li>' . __('Search for a decimal latitude and longitude, like <em>40.123,-105.456</em>.', 'tdomf') . '</li> 
                        <li>' . __('Search for a street address, like <em>123 main st, anytown, acity</em>.', 'tdomf') . '</li>
                        <li>' . __('Click on the location. Zoom in if necessary so you can refine the location by dragging it or clicking a new location.', 'tdomf') . '</li>
                       </ul>
                       ' . __('To execute a search, type search text into the Find Location box and hit the enter key.', 'tdomf') . '</p>
                       <p>' . __('To remove the location (green pin) for a post, clear the search box and hit the enter key.', 'tdomf') . '</p>
                       <p><a href="#" onclick="document.getElementById(\'geo_mashup_inline_help\').style.display=\'none\'; return false;">' . __('Close', 'tdomf') . '</a>
                   </div>
                   <div id="geo_mashup_map" style="width:400px;height:300px;">
                       ' . __('Loading Google map. Check Geo Mashup options if the map fails to load.', 'tdomf') . '
                   </div>
                   <script type="text/javascript">
                    //<![CDATA[
                    GeoMashupAdmin.registerMap(document.getElementById("geo_mashup_map"),
                            {"link_url":"' . $link_url . '",
                             "post_lat":"<?php echo $location->lat; ?>",
                             "post_lng":"<?php echo $location->lng; ?>",
                             "post_location_name":"<?php echo $post_location_name; ?>",
                             "saved_locations":' . $locations_json . ',
                             "kml_url":"' . $kml_url . '",
                             "status_icon":document.getElementById("geo_mashup_status_icon")});
                     // ]]>
                   </script>
                   <label for="geo_mashup_location_name" style="display:none;">' . __('Save As:', 'GeoMashup') . '
                        <input id="geo_mashup_location_name" name="geo_mashup_location_name" type="text" maxlength="50" size="45" style="display:none;"/>
                   </label>
                   <input id="geo_mashup_location" name="geo_mashup_location" type="hidden" value="<?php echo $location->lat; ?>,<?php echo $location->lng; ?>" />
                   <input id="geo_mashup_location_id" name="geo_mashup_location_id" type="hidden" value="<?php echo $location->id; ?>" />
                   <input id="geo_mashup_geoname" name="geo_mashup_geoname" type="hidden" value="<?php echo $location->geoname; ?>" />
                   <input id="geo_mashup_address" name="geo_mashup_address" type="hidden" value="<?php echo $location->address; ?>" />
                   <input id="geo_mashup_postal_code" name="geo_mashup_postal_code" type="hidden" value="<?php echo $location->postal_code; ?>" />
                   <input id="geo_mashup_country_code" name="geo_mashup_country_code" type="hidden" value="<?php echo $location->country_code; ?>" />
                   <input id="geo_mashup_admin_code" name="geo_mashup_admin_code" type="hidden" value="<?php echo $location->admin_code; ?>" />
                   <input id="geo_mashup_admin_name" name="geo_mashup_admin_name" type="hidden" value="<?php echo $location->admin_name; ?>" />
                   <input id="geo_mashup_sub_admin_code" name="geo_mashup_sub_admin_code" type="hidden" value="<?php echo $location->sub_admin_code; ?>" />
                   <input id="geo_mashup_sub_admin_name" name="geo_mashup_sub_admin_name" type="hidden" value="<?php echo $location->sub_admin_name; ?>" />
                   <input id="geo_mashup_locality_name" name="geo_mashup_locality_name" type="hidden" value="<?php echo $location->locality_name; ?>" />
                   <input id="geo_mashup_changed" name="geo_mashup_changed" type="hidden" value="" />';
                } else {
                    $output = __("<p>You must configure Geo Mashup before you can use it in TDO-Mini-Forms</p>", "tdomf");
                }
            } else {
                /* old version: 1.1.2.0 */
                $geomashupOptions = get_settings('geo_mashup_options');
                if (!is_array($geomashupOptions)) {
                    $geomashupOption = GeoMashup::default_options();
                }
                if ($geomashupOptions['google_key']) {
                    $link_url = get_bloginfo('wpurl') . '/wp-content/plugins/geo-mashup';
                    $output = '
                    <style type="text/css"> #geo_mashup_map div { margin:0; } </style>
                    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=' . $geomashupOptions['google_key'] . '" type="text/javascript"></script>
                    <script src="' . $link_url . '/geo-mashup-admin.js" type="text/javascript"></script>
                    <script src="' . $link_url . '/JSONscriptRequest.js" type="text/javascript"></script>';
                    if (!isset($geo_mashup_search)) {
                        $geo_mashup_search = "";
                    }
                    $output .= '<?php 
                   $post_lat = \'\';
                   $post_lng = \'\';
                   if(!isset($geo_mashup_location)) {
                       $geo_locations = get_settings(\'geo_locations\');
                       list($post_lat,$post_lng) = split(\',\',$geo_locations[\'default\']);
                   } else {
                       list($post_lat,$post_lng) = split(\',\',$geo_mashup_location);
                   }
                ?>';
                    $post_location_name = '';
                    $kml_url = '';
                    # We'll generate this once for the form hacker...
                    $locations_json = '{';
                    if (is_array($geo_locations)) {
                        $comma = '';
                        foreach ($geo_locations as $name => $latlng) {
                            list($lat, $lng) = split(',', $latlng);
                            $escaped_name = addslashes(str_replace(array("\r\n", "\r", "\n"), '', $name));
                            if ($lat == $post_lat && $lng == $post_lng) {
                                $post_location_name = $escaped_name;
                            }
                            $locations_json .= $comma . '"' . addslashes($name) . '":{"name":"' . $escaped_name . '","lat":"' . $lat . '","lng":"' . $lng . '"}';
                            $comma = ',';
                        }
                    }
                    $locations_json .= '}';
                    $output .= '
                <img id="geo_mashup_status_icon" src="' . $link_url . '/images/idle_icon.gif" style="float:right" />
                <label for="geo_mashup_search">' . __('Find location:', 'tdomf') . '
                <input id="geo_mashup_search" 
                    name="geo_mashup_search" 
                    type="text" 
                    size="35" 
                    value="<?php echo $geo_mashup_search; ?>"
                    onfocus="this.select(); GeoMashupAdmin.map.checkResize();"
                    onkeypress="return GeoMashupAdmin.searchKey(event, this.value);" />
                </label>
                <select id="geo_mashup_select" name="geo_mashup_select" onchange="GeoMashupAdmin.onSelectChange(this); " style="display:none;" >
                    <option>' . __('[Saved Locations]', 'GeoMashup') . '</option>
                </select>            
                <a href="#" onclick="document.getElementById(\'geo_mashup_inline_help\').style.display=\'block\'; return false;">' . __('help', 'tdomf') . '</a>
                <div id="geo_mashup_inline_help" style="padding:5px; border:2px solid blue; background-color:#ffc; display:none;">
                    <p>' . __('Put a green pin at the location for this post.', 'tdomf') . ' ' . __('There are many ways to do it:', 'tdomf') . '
                    <ul>
                        <li>' . __('Search for a location name.', 'tdomf') . '</li>
                        <li>' . __('For multiple search results, mouse over pins to see location names, and click a result pin to select that location.', 'tdomf') . '</li>
                        <li>' . __('Search for a decimal latitude and longitude, like <em>40.123,-105.456</em>.', 'tdomf') . '</li> 
                        <li>' . __('Search for a street address, like <em>123 main st, anytown, acity</em>.', 'tdomf') . '</li>
                        <li>' . __('Click on the location. Zoom in if necessary so you can refine the location by dragging it or clicking a new location.', 'tdomf') . '</li>
                    </ul>
                    ' . __('To execute a search, type search text into the Find Location box and hit the enter key.', 'tdomf') . '</p>
                    <p>' . __('To remove the location (green pin) for a post, clear the search box and hit the enter key.', 'tdomf') . '</p>
                    <p><a href="#" onclick="document.getElementById(\'geo_mashup_inline_help\').style.display=\'none\'; return false;">' . __('close', 'tdomf') . '</a>
                </div>
                <div id="geo_mashup_map" style="width:400px;height:300px;" class="clear">
                    ' . __('Loading Google map. Check Geo Mashup options if the map fails to load.', 'tdomf') . '
                </div>
                <script type="text/javascript">//<![CDATA[
                    GeoMashupAdmin.registerMap(document.getElementById("geo_mashup_map"),
                        {"link_url":"' . $link_url . '",
                        "post_lat":"<?php echo $post_lat; ?>",
                        "post_lng":"<?php echo $post_lng; ?>",
                        "post_location_name":"' . $post_location_name . '",
                        "saved_locations":' . $locations_json . ',
                        "kml_url":"' . $kml_url . '",
                        "status_icon":document.getElementById("geo_mashup_status_icon")});
                // ]]>
                </script>
                <label for="geo_mashup_location_name" style="display:none;">' . __('Save As:', 'tdomf') . '
                    <input id="geo_mashup_location_name" name="geo_mashup_location_name" type="text" size="45" style="display:none;" />
                </label>
                <input id="geo_mashup_location" name="geo_mashup_location" type="hidden" value="<?php echo $post_lat; ?>,<?php echo $post_lng; ?>" />';
                } else {
                    $output = __("<p>You must configure Geo Mashup before you can use it in TDO-Mini-Forms</p>", "tdomf");
                }
            }
            return $output;
        }
Exemplo n.º 15
0
Arquivo: single.php Projeto: valeie/bo
			</div>
		</div>
		-->
		<div class="col-sm-8 col-sm-offset-2">
			<div class="well">

				<article class="entry-content">
					<?php 
        echo the_content();
        ?>
				</article>
				
				<!-- GeoMashup -->
				<div id="geomashup">
                	<?php 
        echo GeoMashup::map('width=100%');
        ?>
       			</div>

				<div class="labels pull-right">Archivado en: 
					<?php 
        $posttags = get_the_tags();
        if ($posttags) {
            foreach ($posttags as $tag) {
                echo "<a class='label' href=\"";
                echo get_tag_link($tag->term_id);
                echo "\">" . $tag->name . "</a>";
            }
        }
        ?>
				</div>
    /**
     * Fuction to show the single post content.
     */
    function interface_theloop_for_single()
    {
        global $post;
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                do_action('interface_before_post');
                ?>
<section id="post-<?php 
                the_ID();
                ?>
" <?php 
                post_class();
                ?>
>
  <article>
    <header class="entry-header">
      <?php 
                if (get_the_time(get_option('date_format'))) {
                    ?>
      <div class="entry-meta"> 
<span class="cat-links">
        <?php 
                    the_category(', ');
                    ?>
        </span>
<h1 class="entry-title"><?php 
                    the_title();
                    ?>
</h1>

<div class="entry-meta clearfix">
        <div class="by-author vcard author"><span class="fn"><a href="<?php 
                    echo get_author_posts_url(get_the_author_meta('ID'));
                    ?>
" title="<?php 
                    esc_attr(the_author());
                    ?>
">
          <?php 
                    the_author();
                    ?>
          </a></span></div>
        <div class="date updated"><a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    echo esc_attr(get_the_time());
                    ?>
">
          <?php 
                    the_time(get_option('date_format'));
                    ?>
          </a></div>
        <?php 
                    if (comments_open()) {
                        ?>
        <div class="comments">
          <?php 
                        comments_popup_link(__('Sin comentarios', 'interface'), __('1 Comentario', 'interface'), __('% Comentarios', 'interface'), '', __('Comments Off', 'interface'));
                        ?>
        </div>
        <?php 
                    }
                    ?>
      </div>

      <!-- .entry-title -->

<?php 
                    $term_list = get_the_term_list(get_the_ID(), array('localidad', 'region', 'fecha', 'responsable'));
                    if (!empty($term_list)) {
                        ?>

<center>
<?php 
                        $images =& get_children(array('post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image'));
                        if (empty($images)) {
                            // no attachments here
                        } else {
                            echo '<br>';
                            foreach ($images as $attachment_id => $attachment) {
                                echo wp_get_attachment_link($attachment_id, 'icon') . ' ';
                            }
                            echo '<br><br>';
                        }
                        ?>
</center>

<blockquote>
<?php 
                        $my_meta = get_post_meta($post->ID, '_my_meta', TRUE);
                        if (!empty($my_meta['description'])) {
                            echo '<b>' . $my_meta['description'] . '</b><br><br>';
                        }
                        if (!empty($my_meta['name'])) {
                            echo '<strong>Dirección:</strong> ' . $my_meta['name'] . '<br>';
                        }
                        ?>

<?php 
                        $term_list = get_the_term_list(get_the_ID(), 'localidad');
                        if (!empty($term_list)) {
                            ?>
<strong>Localidad:</strong> <?php 
                            echo get_the_term_list($post->ID, 'localidad', '', ', ');
                        }
                        ?>


<?php 
                        $term_list = get_the_term_list(get_the_ID(), 'region');
                        if (!empty($term_list)) {
                            ?>
(<?php 
                            echo get_the_term_list($post->ID, 'region', '', ', ');
                            ?>
)<?php 
                        }
                        ?>
 <?php 
                        echo get_the_term_list($post->ID, 'responsable', '<br><strong>Autoría:</strong> ', ' | ');
                        ?>
 <?php 
                        echo get_the_term_list($post->ID, 'fecha', '<br><strong>Fecha:</strong> ', ', ');
                        ?>
 <br>

<?php 
                        if (function_exists('geo_mashup_map')) {
                            $coords = GeoMashup::post_coordinates();
                        }
                        if ($coords) {
                            echo '<strong>Coordenadas:</strong> ';
                            echo $coords['lat'];
                            echo ' / ';
                            echo $coords['lng'];
                            echo ' <a href="http://maps.google.com/maps?q=';
                            echo $coords['lat'];
                            echo ',';
                            echo $coords['lng'];
                            echo '" title="Ver en Google Maps" target="_blank">  →</a>';
                        }
                        ?>
<br>

<?php 
                        $my_meta = get_post_meta($post->ID, '_my_meta', TRUE);
                        if (!empty($my_meta['fuente'])) {
                            echo '[<a target="_blank" title="Información complementaria en nueva pestaña" href="' . $my_meta['fuente'] . '"><strong>+ info</strong></a>]<br>';
                        }
                        ?>

</blockquote>

<?php 
                        echo GeoMashup::map("width=100%&height=350&zoom=16");
                        ?>
<br>
<?php 
                    }
                    ?>


	<!-- .cat-links --> 
      </div>
      <!-- .entry-meta -->
     
      
      <div class="entry-meta clearfix">



      <div class="entry-meta clearfix">





<?php 
                    $term_list = get_the_term_list(get_the_ID(), array('localidad', 'region', 'fecha', 'responsable'));
                    if (empty($term_list)) {
                        if (has_post_thumbnail()) {
                            $image = '';
                            $title_attribute = apply_filters('the_title', get_the_title($post->ID));
                            $image .= '<figure class="">';
                            $image .= get_the_post_thumbnail($post->ID, 'featured', array('alt' => esc_attr($title_attribute))) . '';
                            $image .= '</figure>';
                            echo $image;
                        }
                        ?>




<?php 
                    }
                    ?>
        
      <!-- .entry-meta --> 
    </header>
    <!-- .entry-header -->
    <?php 
                }
                ?>


        
   





  


    <div class="entry-content clearfix">


      <?php 
                the_content();
                wp_link_pages(array('before' => '<div style="clear: both;"></div><div class="pagination clearfix">' . __('Pages:', 'interface'), 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>', 'pagelink' => '%', 'echo' => 1));
                ?>
    </div>
    <?php 
                if (get_the_time(get_option('date_format'))) {
                    ?>
  </header>
  <?php 
                }
                ?>

    <!-- entry content clearfix -->
    
    <?php 
                if (is_single()) {
                    $tag_list = get_the_tag_list('', __(' ', 'interface'));
                    if (!empty($tag_list)) {
                        ?>
    <footer class="entry-meta clearfix"> <span class="tag-links">
      <?php 
                        echo $tag_list;
                        ?>
      </span><!-- .tag-links --> 
    </footer>
    <!-- .entry-meta -->
    <?php 
                    }
                    do_action('interface_after_post_content');
                }
                do_action('interface_before_comments_template');
                comments_template();
                do_action('interface_after_comments_template');
                ?>
  </article>
</section>
<!-- .post -->
<?php 
                do_action('interface_after_post');
            }
        } else {
            ?>
<h1 class="entry-title">
  <?php 
            _e('No hay resultados para la búsqueda.', 'interface');
            ?>
</h1>
<?php 
        }
    }
Exemplo n.º 17
0
 /**
  * Full post template tag.
  *
  * Returns a placeholder where a related map should display the full post content 
  * of the currently selected marker.
  *
  * @since 1.1
  * @link http://github.com/cyberhobo/wordpress-geo-mashup/wiki/Tag-Reference#Full_Post
  * 
  * @param string|array $args Template tag arguments.
  * @return string Placeholder HTML.
  */
 public static function full_post($args = null)
 {
     $args = wp_parse_args($args);
     $for_map = 'gm';
     if (!empty($args['for_map'])) {
         $for_map = $args['for_map'];
     }
     // It's nice if click-to-load works in the full post display
     self::$add_loader_script = true;
     return '<div id="' . $for_map . '-post"></div>';
 }
Exemplo n.º 18
0
 /**
  * Run a query for object locations from GET parameters and print JSON results.
  * 
  * @since 1.2
  */
 public static function generate_location_json()
 {
     /* TODO: Try to track modification?
     		if ( !empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) {
     			$http_time = strtotime( $_SERVER['HTTP_IF_MODIFIED_SINCE'] );
     			$mod_time = strtotime( $post->post_modified_gmt . ' GMT' );
     			if ($mod_time <= $http_time) {
     				return status_header(304); // Not modified
     			}
     		}
     
     		status_header(200);
     		header( 'Last-Modified: ' . mysql2date( 'D, d M Y H:i:s', $post->post_modified_gmt, false ) . ' GMT' );
     		header( 'Content-type: text/xml; charset='.get_settings('blog_charset'), true);
     		header( 'Cache-control: max-age=300, must-revalidate', true);
     		header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + 300 ) . " GMT" );
     		header( 'Pragma:' );
     		 */
     status_header(200);
     header('Content-type: application/json; charset=' . get_option('blog_charset'), true);
     header('Cache-Control: no-cache;', true);
     header('Expires: -1;', true);
     $json = GeoMashup::get_locations_json($_REQUEST);
     if (isset($_REQUEST['callback'])) {
         $json = $_REQUEST['callback'] . '(' . $json . ')';
     }
     echo $json;
 }
Exemplo n.º 19
0
 /**
  * Render the requested map.
  *
  * @since 1.4
  * @uses do_action() geo_mashup_render_map Customize things (like scripts and styles) before the template is loaded. The mashup script (google v2 or mxn) is sent as a parameter.
  */
 public static function render_map()
 {
     self::enqueue_styles();
     $map_data = self::get_map_data();
     if (empty($map_data)) {
         status_header(500);
         _e('WordPress transients may not be working. Try deactivating or reconfiguring caching plugins.', 'GeoMashup');
         echo ' <a href="https://code.google.com/p/wordpress-geo-mashup/issues/detail?id=425" target="_top">issue 425</a>';
         exit;
     }
     self::extract_template_properties($map_data);
     self::enqueue_scripts($map_data);
     self::add_term_properties($map_data);
     // Store the properties for use by the template tag GeoMashupRenderMap::map_script
     self::$map_data = json_encode($map_data);
     // Load the template
     status_header(200);
     load_template(GeoMashup::locate_template('map-frame'));
 }
Exemplo n.º 20
0
 /**
  * Render the requested map.
  *
  * @since 1.4
  */
 public static function render_map()
 {
     global $geo_mashup_options, $geo_mashup_custom;
     // Include theme stylesheet if requested
     if ($geo_mashup_options->get('overall', 'theme_stylesheet_with_maps') == 'true') {
         wp_enqueue_style('theme-style', get_stylesheet_uri());
         self::enqueue_style('theme-style');
     }
     // Resolve map style
     $style_file_path = path_join(get_stylesheet_directory(), 'map-style.css');
     $style_url_path = '';
     if (is_readable($style_file_path)) {
         $style_url_path = path_join(get_stylesheet_directory_uri(), 'map-style.css');
     } else {
         if (isset($geo_mashup_custom)) {
             $style_url_path = $geo_mashup_custom->file_url('map-style.css');
         }
     }
     if (empty($style_url_path)) {
         GeoMashup::register_style('geo-mashup-map-style', 'css/map-style-default.css');
     } else {
         wp_register_style('geo-mashup-map-style', $style_url_path);
     }
     wp_enqueue_style('geo-mashup-map-style');
     self::enqueue_style('geo-mashup-map-style');
     if (isset($_GET['map_data_key'])) {
         // Map data is cached in a transient
         $map_data = get_transient('gmm' . $_GET['map_data_key']);
         if (!$map_data) {
             $map_parameters = get_transient('gmp' . $_GET['map_data_key']);
             if ($map_parameters) {
                 $map_data = GeoMashup::build_map_data($map_parameters);
             } else {
                 $map_data = GeoMashup::build_map_data('');
             }
         }
     } else {
         // Try building map data from the query string
         $map_data = GeoMashup::build_map_data($_GET);
     }
     // Queue scripts
     $mashup_dependencies = array('jquery');
     $language_code = GeoMashup::get_language_code();
     if ('google' == $map_data['map_api']) {
         // Google v2 base
         $google_2_url = 'http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=' . $geo_mashup_options->get('overall', 'google_key');
         if (!empty($language_code)) {
             $google_2_url .= '&amp;hl=' . $language_code;
         }
         wp_register_script('google-maps-2', $google_2_url, '', '', true);
         $mashup_dependencies[] = 'google-maps-2';
         $mashup_script = 'geo-mashup-google';
         if (!empty($map_data['cluster_max_zoom'])) {
             // Queue clustering scripts
             if ('clustermarker' == $map_data['cluster_lib']) {
                 GeoMashup::register_script('mapiconmaker', 'js/mapiconmaker.js', array('google-maps-2'), '1.1', true);
                 GeoMashup::register_script('clustermarker', 'js/ClusterMarker.js', array('mapiconmaker'), '1.3.2', true);
                 $mashup_dependencies[] = 'clustermarker';
             } else {
                 $map_data['cluster_lib'] = 'markerclusterer';
                 GeoMashup::register_script('markerclusterer', 'js/markerclusterer.js', array('google-maps-2', 'geo-mashup-google'), '1.0', true);
                 wp_enqueue_script('markerclusterer');
                 self::enqueue_script('markerclusterer');
             }
         }
     } else {
         // Mapstraction base
         $mashup_script = 'geo-mashup-mxn';
         GeoMashup::register_script('mxn', 'js/mxn/mxn.js', null, GEO_MASHUP_VERSION, true);
         GeoMashup::register_script('mxn-core', 'js/mxn/mxn.core.js', array('mxn'), GEO_MASHUP_VERSION, true);
     }
     // Mapstraction providers
     if ('openlayers' == $map_data['map_api']) {
         wp_register_script('openlayers', 'http://openlayers.org/api/OpenLayers.js', null, 'latest', true);
         wp_register_script('openstreetmap', 'http://www.openstreetmap.org/openlayers/OpenStreetMap.js', array('openlayers'), 'latest', true);
         GeoMashup::register_script('mxn-openlayers', 'js/mxn/mxn.openlayers.core.js', array('mxn-core', 'openstreetmap'), GEO_MASHUP_VERSION, true);
         GeoMashup::register_script('mxn-openlayers-gm', 'js/mxn/mxn.openlayers.geo-mashup.js', array('mxn-openlayers'), GEO_MASHUP_VERSION, true);
         $mashup_dependencies[] = 'mxn-openlayers-gm';
     } else {
         if ('googlev3' == $map_data['map_api']) {
             $google_3_url = 'http://maps.google.com/maps/api/js?sensor=false';
             if (!empty($language_code)) {
                 $google_3_url .= '&amp;language=' . $language_code;
             }
             wp_register_script('google-maps-3', $google_3_url, '', '', true);
             GeoMashup::register_script('mxn-googlev3', 'js/mxn/mxn.googlev3.core.js', array('mxn-core', 'google-maps-3'), GEO_MASHUP_VERSION, true);
             $mashup_dependencies[] = 'mxn-googlev3';
         }
     }
     // Geo Mashup scripts
     GeoMashup::register_script('geo-mashup', 'js/geo-mashup.js', $mashup_dependencies, GEO_MASHUP_VERSION, true);
     GeoMashup::register_script($mashup_script, 'js/' . $mashup_script . '.js', array('geo-mashup'), GEO_MASHUP_VERSION, true);
     wp_enqueue_script($mashup_script);
     self::enqueue_script($mashup_script);
     // Custom javascript
     $custom_js_url_path = '';
     if (isset($geo_mashup_custom)) {
         $custom_js_url_path = $geo_mashup_custom->file_url('custom-' . $map_data['map_api'] . '.js');
         if (!$custom_js_url_path and 'google' != $map_data['map_api']) {
             $custom_js_url_path = $geo_mashup_custom->file_url('custom-mxn.js');
         }
         if (!$custom_js_url_path) {
             $custom_js_url_path = $geo_mashup_custom->file_url('custom.js');
         }
     } else {
         if (is_readable('custom.js')) {
             $custom_js_url_path = path_join(GEO_MASHUP_URL_PATH, 'custom.js');
         }
     }
     if (!empty($custom_js_url_path)) {
         wp_enqueue_script('geo-mashup-custom', $custom_js_url_path, array($mashup_script));
         self::enqueue_script('geo-mashup-custom');
     }
     // Set height and width properties for the template
     $width = $map_data['width'];
     if (substr($width, -1) != '%') {
         $width .= 'px';
     }
     unset($map_data['width']);
     self::map_property('width', $width);
     $height = $map_data['height'];
     if (substr($height, -1) != '%') {
         $height .= 'px';
     }
     unset($map_data['height']);
     self::map_property('height', $height);
     if (isset($map_data['object_data']) and is_array($map_data['object_data'])) {
         $map_data['object_data'] = json_encode($map_data['object_data']);
     }
     array_walk($map_data, array('GeoMashupRenderMap', 'add_double_quotes'));
     if ('single' == $map_data['map_content']) {
         $category_opts = '{}';
     } else {
         $categories = get_categories(array('hide_empty' => false));
         $category_opts = '{';
         if (is_array($categories)) {
             $cat_comma = '';
             $category_color = $geo_mashup_options->get('global_map', 'category_color');
             $category_line_zoom = $geo_mashup_options->get('global_map', 'category_line_zoom');
             foreach ($categories as $category) {
                 $category_opts .= $cat_comma . '"' . $category->term_id . '":{"name":"' . esc_js($category->name) . '"';
                 $parent_id = '';
                 if (!empty($category->parent)) {
                     $parent_id = $category->parent;
                 }
                 $category_opts .= ',"parent_id":"' . $parent_id . '"';
                 if (!empty($category_color[$category->slug])) {
                     $category_opts .= ',"color_name":"' . $category_color[$category->slug] . '"';
                 }
                 if (!empty($category_line_zoom[$category->slug])) {
                     $category_opts .= ',"max_line_zoom":"' . $category_line_zoom[$category->slug] . '"';
                 }
                 $category_opts .= '}';
                 $cat_comma = ',';
             }
         }
         $category_opts .= '}';
     }
     $map_data['category_opts'] = $category_opts;
     // Store the properties for use by the template tag GeoMashupRenderMap::map_script
     self::$map_data = $map_data;
     // Load the template
     status_header(200);
     load_template(GeoMashup::locate_template('map-frame'));
 }