Make WordPress Core

Changeset 1584


Ignore:
Timestamp:
09/03/2004 04:29:11 AM (21 years ago)
Author:
rboren
Message:

Send Geo Url Header only if use_geo_positions is set. Bug 242. Patch from 2fargon.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r1575 r1584  
    835835    global $posts;
    836836
    837     if ($posts && 1 === count($posts) && ! empty($posts[0]->post_lat)) {
    838         // there's only one result  see if it has a geo code
    839         $row = $posts[0];
    840         $lat = $row->post_lat;
    841         $lon = $row->post_lon;
    842         $title = $row->post_title;
    843         if(($lon != null) && ($lat != null) ) {
    844             echo "<meta name=\"ICBM\" content=\"".$lat.", ".$lon."\" />\n";
    845             echo "<meta name=\"DC.title\" content=\"".convert_chars(strip_tags(htmlspecialchars(get_bloginfo("name"))))." - ".$title."\" />\n";
    846             echo "<meta name=\"geo.position\" content=\"".$lat.";".$lon."\" />\n";
    847             return;
    848         }
    849     } else {
    850         if(get_settings('use_default_geourl')) {
    851             // send the default here
    852             echo "<meta name='ICBM' content=\"". get_settings('default_geourl_lat') .", ". get_settings('default_geourl_lon') ."\" />\n";
    853             echo "<meta name='DC.title' content=\"".convert_chars(strip_tags(htmlspecialchars(get_bloginfo("name"))))."\" />\n";
    854             echo "<meta name='geo.position' content=\"". get_settings('default_geourl_lat') .";". get_settings('default_geourl_lon') ."\" />\n";
    855         }
    856     }
     837  if (get_settings('use_geo_positions')) {
     838        if ($posts && 1 === count($posts) && ! empty($posts[0]->post_lat)) {
     839            // there's only one result  see if it has a geo code
     840            $row = $posts[0];
     841            $lat = $row->post_lat;
     842            $lon = $row->post_lon;
     843            $title = $row->post_title;
     844            if(($lon != null) && ($lat != null) ) {
     845                echo "<meta name=\"ICBM\" content=\"".$lat.", ".$lon."\" />\n";
     846                echo "<meta name=\"DC.title\" content=\"".convert_chars(strip_tags(htmlspecialchars(get_bloginfo("name"))))." - ".$title."\" />\n";
     847                echo "<meta name=\"geo.position\" content=\"".$lat.";".$lon."\" />\n";
     848                return;
     849            }
     850        } else {
     851            if(get_settings('use_default_geourl')) {
     852                // send the default here
     853                echo "<meta name='ICBM' content=\"". get_settings('default_geourl_lat') .", ". get_settings('default_geourl_lon') ."\" />\n";
     854                echo "<meta name='DC.title' content=\"".convert_chars(strip_tags(htmlspecialchars(get_bloginfo("name"))))."\" />\n";
     855                echo "<meta name='geo.position' content=\"". get_settings('default_geourl_lat') .";". get_settings('default_geourl_lon') ."\" />\n";
     856            }
     857        }
     858    }
    857859}
    858860
Note: See TracChangeset for help on using the changeset viewer.