forked from wp-plugins/osm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathosm-sc-info.php
More file actions
71 lines (63 loc) · 3.14 KB
/
osm-sc-info.php
File metadata and controls
71 lines (63 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/* (c) Copyright 2014 Michael Kang (wp-osm-plugin.HanBlog.Net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
echo '<p><img src="'.OSM_PLUGIN_URL.'/WP_OSM_Plugin_Logo.png" alt="Osm Logo"></p>';
echo '<h2>OpenStreetMap Plugin '.PLUGIN_VER.' </h2>';
global $post;
$post_org = $post;
$Counter = 0;
$CustomFieldName = get_option('osm_custom_field','OSM_geo_data');
$recentPosts = new WP_Query();
$starttime = microtime(true);
$recentPosts->query('meta_key='.$CustomFieldName.'&post_status=publish &showposts=-1 &post_type=post');
while ($recentPosts->have_posts()) : $recentPosts->the_post();
list($temp_lat, $temp_lon) = explode(',', get_post_meta($post->ID, $CustomFieldName, true));
if ($temp_lat != '' && $temp_lon != '') {
list($temp_lat, $temp_lon) = $this->checkLatLongRange('$marker_all_posts',$temp_lat, $temp_lon);
$Counter += 1;
}
endwhile;
$diff = microtime(true) - $starttime;
$sec = intval($diff);
$micro = $diff - $sec;
$final = strftime('%T', mktime(0, 0, $sec)) . str_replace('0.', '.', sprintf('%.3f', $micro));
$Counter = sprintf("%03d",$Counter);
$count_posts = wp_count_posts('post');
$published_posts = $count_posts->publish;
echo "published posts: ".$published_posts."<br>";
echo " geo tagged:".$Counter."; DB request took: ".$final."<br>";
$post = $post_org;
$post_org = $post;
$Counter = 0;
$starttime = microtime(true);
$recentPosts = new WP_Query();
$recentPosts->query('meta_key='.$CustomFieldName.'&post_status=publish'.'&showposts=-1'.'&post_type=page');
while ($recentPosts->have_posts()) : $recentPosts->the_post();
list($temp_lat, $temp_lon) = explode(',', get_post_meta($post->ID, $CustomFieldName, true));
if ($temp_lat != '' && $temp_lon != '') {
list($temp_lat, $temp_lon) = $this->checkLatLongRange('$marker_all_posts',$temp_lat, $temp_lon);
$Counter += 1;
}
endwhile;
$diff = microtime(true) - $starttime;
$sec = intval($diff);
$micro = $diff - $sec;
$final = strftime('%T', mktime(0, 0, $sec)) . str_replace('0.', '.', sprintf('%.3f', $micro));
$Counter = sprintf("%03d",$Counter);
$count_pages = wp_count_posts('page');
$published_pages = $count_pages->publish;
echo "published pages: ".$published_pages."<br>";
echo " geo tagged:".$Counter."; DB request took: ".$final."<br>";
$post = $post_org;
?>