Changeset 496995
- Timestamp:
- 01/29/2012 07:37:49 PM (14 years ago)
- Location:
- pulsemaps/trunk
- Files:
-
- 1 added
- 6 edited
- 1 moved
-
helper.html (added)
-
pm-config.php (modified) (1 diff)
-
pm-proxy.php (moved) (moved from pulsemaps/trunk/pm-plan.php) (3 diffs)
-
pm-settings-page.php (modified) (9 diffs)
-
pm-widget.php (modified) (2 diffs)
-
pulsemaps.php (modified) (9 diffs)
-
readme.txt (modified) (2 diffs)
-
style.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
pulsemaps/trunk/pm-config.php
r462179 r496995 1 1 <?php 2 2 3 global $pulsemaps_api; 4 $pulsemaps_api = 'http://api.pulsemaps.com'; 5 6 global $pulsemaps_site; 7 $pulsemaps_site = 'http://pulsemaps.com'; 3 global $pulsemaps_url; 4 $pulsemaps_url = 'https://pulsemaps.com'; 8 5 9 6 global $pulsemaps_version; 10 $pulsemaps_version = 8;7 $pulsemaps_version = 9; 11 8 12 9 $local_config = dirname(__FILE__) . '/pm-config-local.php'; -
pulsemaps/trunk/pm-proxy.php
r486545 r496995 1 1 <?php 2 2 3 /* Copyright 2011 Aito Software Inc. (email : [email protected])3 /* Copyright 2011-2012 Aito Software Inc. (email : [email protected]) 4 4 5 5 This program is free software; you can redistribute it and/or modify … … 17 17 */ 18 18 19 while(ob_get_level()) ob_end_clean();20 header('Connection: close');21 ignore_user_abort();22 ob_start();23 24 19 require_once('pm-config.php'); 25 $c = curl_init($pulsemaps_api . '/mapInfo/wp/'); 26 $data = array('key' => $_POST['key']); 27 curl_setopt($c, CURLOPT_POSTFIELDS, $data); 20 $c = curl_init($pulsemaps_url . '/mapInfo/wp/'); 21 curl_setopt($c, CURLOPT_POSTFIELDS, $_POST); 28 22 curl_exec($c); 29 23 $code = curl_getinfo($c, CURLINFO_HTTP_CODE); … … 33 27 die; 34 28 } 35 36 $size = ob_get_length();37 header("Content-Length: $size");38 ob_end_flush();39 flush();40 41 require('../../../wp-load.php');42 43 $c = curl_init($pulsemaps_api . '/mapInfo.json');44 $opts = get_option('pulsemaps_options');45 $data = array('key' => $opts['key']);46 curl_setopt($c, CURLOPT_POSTFIELDS, $data);47 curl_setopt($c, CURLOPT_RETURNTRANSFER, true);48 curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 5);49 $ret = curl_exec($c);50 $code = curl_getinfo($c, CURLINFO_HTTP_CODE);51 curl_close($c);52 if ($code == '200') {53 $d = json_decode($ret, true);54 if ($opts['plan'] != $d['planTag']) {55 $opts['plan'] = $d['planTag'];56 if ($opts['plan'] == 'free') {57 $opts['track_all'] = false;58 }59 update_option('pulsemaps_options', $opts);60 }61 } -
pulsemaps/trunk/pm-settings-page.php
r462179 r496995 1 1 <?php 2 2 3 /* Copyright 2011 Aito Software Inc. (email : [email protected])3 /* Copyright 2011-2012 Aito Software Inc. (email : [email protected]) 4 4 5 5 This program is free software; you can redistribute it and/or modify … … 36 36 echo "<script type='text/javascript' src='$url_js'></script>\n"; 37 37 38 global $pulsemaps_ api;38 global $pulsemaps_url; 39 39 $options = get_option('pulsemaps_options'); 40 40 $id = $options['id']; 41 $widget_url = "$pulsemaps_ api/widget.js?id=123456789¬rack=1&target=widget-preview";42 $url_load = plugins_url('pm-p lan.php', __FILE__);41 $widget_url = "$pulsemaps_url/widget.js?id=123456789¬rack=1&target=widget-preview"; 42 $url_load = plugins_url('pm-proxy.php', __FILE__); 43 43 ?> 44 44 <script type='text/javascript'> … … 48 48 jQuery(document).ready(function() { 49 49 pulsemaps.setHooks('<?php echo $widget_url; ?>'); 50 jQuery("#pulsemaps_plan_load").load("<?php echo $url_load; ?>", {key: "<?php echo $options['key']; ?>"}); 50 jQuery("#pulsemaps_plan_load").load("<?php echo $url_load; ?>", 51 {key: "<?php echo $options['key']; ?>", 52 version: "<?php echo pulsemaps_plugin_version(); ?>", 53 svn_id: "$Id: $", 54 wp_version: "<?php global $wp_version; echo $wp_version; ?>", 55 php_version: "<?php echo phpversion(); ?>"}); 51 56 }); 52 57 </script> … … 69 74 70 75 function pulsemaps_options_page() { 76 global $pulsemaps_url; 71 77 $opts = get_option('pulsemaps_options', array()); 72 78 $id = $opts['id']; 73 $style = get_option('pulsemaps_widget', 'default');74 global $pulsemaps_api;75 79 $siteurl = get_option('siteurl'); 76 if (!pulsemaps_tracking_active()) {77 echo '<div class="error"><p><strong>Visitor tracking is inactive. Drag the PulseMaps widget on a sidebar on the <a href="';78 echo get_option('siteurl') . '/wp-admin/widgets.php';79 echo '">widget admin page</a>.</strong></p></div>';80 }81 echo "<iframe style=\"display: none;\" src=\"$pulsemaps_api/mapOwner/?map=$id\"></iframe>";82 80 ?> 83 81 <div class="wrap"> 84 82 <div id="icon-options-general" class="icon32"><br></div> 85 83 <h2>PulseMaps Visitor Map</h2> 86 <div id="pulsemaps_plan">87 84 <div id="pulsemaps_descr"> 88 <div id="pulsemaps_plan_load" >85 <div id="pulsemaps_plan_load" <?php if (!$opts['activated']) { echo 'style="display: none;"'; } ?>> 89 86 <img src="<?php echo $siteurl; ?>/wp-admin/images/loading.gif" alt="loading..."> 90 87 </div> 91 88 </div> 92 <div id="pulsemaps_map"></div> 93 </div> 94 <script type="text/javascript" id="pulsemaps_<?php echo $id; ?>" src="<?php echo $pulsemaps_api; ?>/map.js?id=<?php echo $id; ?>&target=pulsemaps_map"></script> 95 <div id="pulsemaps_settings"> 89 <form style="display: none;" id="pulsemaps_activate" action="options.php" method="post"> 90 <?php settings_fields('pulsemaps_options'); ?> 91 <input type="hidden" name="pulsemaps_options[activated]" value="1"> 92 <input type="hidden" name="pulsemaps_options[frameheight]" value="<?php echo $opts['frameheight']; ?>"> 93 </form> 94 <script> 95 function pulsemaps_handler(height, active, reload) 96 { 97 document.getElementById('pulsemaps_iframe').height = parseInt(height); 98 if (active != 0) { 99 jQuery('#pulsemaps_settings').show(); 100 jQuery("input[name='pulsemaps_options[frameheight]']").val(height); 101 jQuery.post('options.php', jQuery('#pulsemaps_activate').serialize(), 102 function() { if (reload) { top.location.reload(true); } }); 103 } 104 } 105 </script> 106 <?php if (!$opts['activated']) { ?> 107 <iframe src="<?php echo "$pulsemaps_url/maps/$id/wp-info.html?settings_url="; 108 echo urlencode(pulsemaps_settings_url()); 109 echo "&plugin_url=" . urlencode(plugins_url('', __FILE__)); 110 echo "&admin_url=" . urlencode(pulsemaps_admin_url()); ?>" 111 id="pulsemaps_iframe" 112 style="width: 100%; overflow-y: hidden;" scrolling="no"></iframe> 113 <?php 114 } 115 $style = get_option('pulsemaps_widget', 'default'); 116 ?> 117 <div id="pulsemaps_settings" <?php if (!$opts['activated']) { echo 'style="display: none;"'; } ?>> 96 118 <form action="options.php" method="post"> 97 119 <?php settings_fields('pulsemaps_options'); ?> … … 121 143 add_settings_field('pulsemaps_widget_bgcolor', 'Background', 'pulsemaps_widget_bgcolor', 'pulsemaps', 'pulsemaps_options'); 122 144 add_settings_field('pulsemaps_widget_open', 'New Window', 'pulsemaps_widget_opennew', 'pulsemaps', 'pulsemaps_options'); 123 add_settings_field('pulsemaps_widget_dots', 'Real-time dots', 'pulsemaps_widget_dots', 'pulsemaps', 'pulsemaps_options');145 add_settings_field('pulsemaps_widget_dots', 'Real-time dots', 'pulsemaps_widget_dots', 'pulsemaps', 'pulsemaps_options'); 124 146 add_settings_field('pulsemaps_widget_meta', 'Text above small map', 'pulsemaps_widget_showmeta', 'pulsemaps', 'pulsemaps_options'); 125 147 if ($options['plan'] != 'free') { 126 add_settings_field('pulsemaps_track_all', 'Track without widget', 'pulsemaps_track_all', 'pulsemaps', 'pulsemaps_options');148 add_settings_field('pulsemaps_track_all', 'Track without widget', 'pulsemaps_track_all', 'pulsemaps', 'pulsemaps_options'); 127 149 } 128 150 } … … 276 298 } 277 299 300 function pulsemaps_validate_bool(&$options, $input, $field) { 301 if (isset($input[$field])) { 302 $options[$field] = (bool)$input[$field]; 303 } 304 } 278 305 279 306 function pulsemaps_options_validate($input) { … … 286 313 pulsemaps_validate_color($options, $input, 'custom_color'); 287 314 pulsemaps_validate_color($options, $input, 'custom_bgcolor'); 315 pulsemaps_validate_bool($options, $input, 'widget_dots'); 316 pulsemaps_validate_bool($options, $input, 'track_all'); 317 pulsemaps_validate_bool($options, $input, 'widget_new_window'); 318 pulsemaps_validate_bool($options, $input, 'activated'); 319 pulsemaps_validate_bool($options, $input, 'congrats'); 288 320 289 321 if (isset($input['widget_type'])) { … … 301 333 } 302 334 303 if (isset($input['widget_new_window'])) {304 $options['widget_new_window'] = true;305 } else {306 $options['widget_new_window'] = false;307 }308 309 335 if (isset($input['widget_meta'])) { 310 336 $widget_meta = trim($input['widget_meta']); … … 314 340 } 315 341 316 if (isset($input['widget_dots'])) {317 $options['widget_dots'] = true;318 } else {319 $options['widget_dots'] = false;320 }321 322 if (isset($input['track_all'])) {323 $options['track_all'] = true;324 } else {325 $options['track_all'] = false;326 }327 328 if (isset($input['settings_visited'])) {329 $options['settings_visited'] = true;330 }331 332 342 return $options; 333 343 } -
pulsemaps/trunk/pm-widget.php
r486205 r496995 26 26 function widget($args, $instance) { 27 27 global $wpdb; 28 global $pulsemaps_api; 29 global $pulsemaps_site; 28 global $pulsemaps_url; 30 29 extract( $args ); 31 30 $title = apply_filters('widget_title', $instance['title']); … … 40 39 $width = $opts['widget_width']; 41 40 42 $url = "$pulsemaps_ api/widget.js?id=$id&width=$width";41 $url = "$pulsemaps_url/widget.js?id=$id&width=$width"; 43 42 if ($opts['widget_type'] == 'satellite') { 44 43 $url .= "&type=satellite"; -
pulsemaps/trunk/pulsemaps.php
r486205 r496995 4 4 Plugin URI: http://pulsemaps.com/wordpress/ 5 5 Description: Show off your visitors on the world map. When people around the world visit your blog, the corresponding areas on the heat map widget light up! 6 Version: 1. 4.66 Version: 1.5 7 7 Author: Aito Software Inc. 8 8 License: GPLv2 or later 9 9 */ 10 10 11 /* Copyright 2011 -2012 Aito Software Inc. (email : [email protected])11 /* Copyright 2011, 2012 Aito Software Inc. (email : [email protected]) 12 12 13 13 This program is free software; you can redistribute it and/or modify … … 30 30 31 31 function pulsemaps_register() { 32 global $pulsemaps_ api;33 $c = curl_init($pulsemaps_ api. '/register');32 global $pulsemaps_url; 33 $c = curl_init($pulsemaps_url . '/register'); 34 34 $data = array('name' => get_option('blogname'), 35 35 'email' => get_option('admin_email'), … … 89 89 } 90 90 91 if (!isset($opts['settings_visited'])) { 92 $opts['settings_visited'] = !$first; 91 if (!isset($opts['congrats'])) { 92 $opts['congrats'] = false; 93 } 94 95 if (!isset($opts['activated'])) { 96 $opts['activated'] = true; 93 97 } 94 98 … … 115 119 $opts = get_option('pulsemaps_options', array()); 116 120 117 if (! isset($opts['key']) || !isset($opts['id'])) {121 if (!pulsemaps_registered()) { 118 122 $ret = pulsemaps_register(); 119 123 if ($ret['status'] == 'ok') { … … 143 147 $opts['widget_type'] = 'plain'; 144 148 } 149 if (!isset($opts['congrats'])) { 150 $opts['congrats'] = false; 151 } 152 if (!isset($opts['activated'])) { 153 $opts['activated'] = false; 154 } 145 155 146 156 update_option('pulsemaps_options', $opts); … … 156 166 } 157 167 158 159 function pulsemaps_settings_visited() { 160 $opts = get_option('pulsemaps_options', array()); 161 return $opts['settings_visited']; 162 } 163 168 function pulsemaps_registered() { 169 $opts = get_option('pulsemaps_options', array()); 170 return isset($opts['key']) && isset($opts['id']); 171 } 172 173 function pulsemaps_activated() { 174 $opts = get_option('pulsemaps_options', array()); 175 return $opts['activated']; 176 } 177 178 function pulsemaps_plugin_version() { 179 $plugin_data = get_plugin_data(__FILE__); 180 $plugin_version = $plugin_data['Version']; 181 return $plugin_version; 182 } 183 184 function pulsemaps_admin_url() { 185 if (function_exists('admin_url')) { 186 return admin_url(); 187 } else { 188 return get_option('siteurl') . '/wp-admin/'; 189 } 190 } 191 192 function pulsemaps_settings_url() { 193 return pulsemaps_admin_url() . 'options-general.php?page=pulsemaps'; 194 } 164 195 165 196 function pulsemaps_activate_notice() { 166 global $pulsemaps_ api;197 global $pulsemaps_url; 167 198 $opts = get_option('pulsemaps_options'); 168 199 $id = $opts['id']; 169 if (substr($_SERVER["PHP_SELF"], -11) == 'plugins.php' && !pulsemaps_tracking_active()) { 170 echo "<iframe style=\"display: none;\" src=\"$pulsemaps_api/mapOwner/?map=$id\"></iframe>"; 171 echo '<div class="error"><p><strong>Activate PulseMaps visitor tracking on the <a href="'; 172 echo get_option('siteurl') . '/wp-admin/widgets.php'; 173 echo '">widget admin page</a>. Check also the <a href="'; 174 echo get_option('siteurl') . '/wp-admin/options-general.php?page=pulsemaps'; 200 if (!pulsemaps_activated() && substr($_SERVER["PHP_SELF"], -11) != 'general.php' 201 && $_GET["page"] != "pulsemaps") { 202 echo '<div class="error"><p><strong>Activate the PulseMaps service on the <a href="'; 203 echo pulsemaps_settings_url(); 175 204 echo '">settings page</a>.</strong></p></div>'; 176 205 } else if (substr($_SERVER["PHP_SELF"], -11) == 'widgets.php') { … … 180 209 } 181 210 echo '><p><strong>Drag the PulseMaps widget to a sidebar on the right to activate.</strong></p></div>'; 182 echo '<div '; 183 if (!pulsemaps_settings_visited()) { 184 echo 'id="pulsemaps_activated" '; 185 } else { 186 echo 'style="display: none;" '; 187 } 188 echo 'class="updated"><p><strong>Remember to visit your <a href="'; 189 echo get_option('siteurl'). '/wp-admin/options-general.php?page=pulsemaps'; 190 echo '">PulseMaps settings page</a> to customize your widget.</strong></p></div>'; 191 } else { 192 if (!pulsemaps_settings_visited()) { 193 echo '<div class="updated"><p><strong>Remember to visit your <a href="'; 211 if (!$opts['congrats']) { 212 $opts['congrats'] = true; 213 update_option('pulsemaps_options', $opts); 214 echo '<div id="pulsemaps_activated" style="display: none;" '; 215 echo 'class="updated"><p><strong>All done! You can always visit the <a href="'; 194 216 echo get_option('siteurl'). '/wp-admin/options-general.php?page=pulsemaps'; 195 217 echo '">PulseMaps settings page</a> to customize your widget.</strong></p></div>'; 196 218 } 219 } else if (!pulsemaps_tracking_active() && pulsemaps_activated()) { 220 echo '<div class="error"><p><strong>Enable the PulseMaps widget on the <a href="'; 221 echo get_option('siteurl') . '/wp-admin/widgets.php'; 222 echo '">widget admin page</a> to start mapping visitors.</strong></p></div>'; 197 223 } 198 224 } … … 265 291 $opts = get_option('pulsemaps_options'); 266 292 if ($opts['track_all'] && !is_user_logged_in()) { 267 global $pulsemaps_ api;293 global $pulsemaps_url; 268 294 ?> 269 295 <script type="text/javascript"> 270 296 (function() { 271 297 var pm = document.createElement('script'); pm.type = 'text/javascript'; pm.async = true; 272 pm.src = "<?php echo $pulsemaps_ api.'/tracker.js?id='.$opts['id']; ?>";298 pm.src = "<?php echo $pulsemaps_url .'/tracker.js?id='.$opts['id']; ?>"; 273 299 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(pm, s); 274 300 })(); … … 279 305 280 306 add_action('wp_head', 'pulsemaps_async_tracker'); 307 308 309 function pulsemaps_bigmap($atts) { 310 $opts = get_option('pulsemaps_options', array()); 311 $id = $opts['id']; 312 global $pulsemaps_url; 313 $url = $pulsemaps_url . '/map.js?id=' . $id . '&target=pulsemaps_map'; 314 return "<div id=\"pulsemaps_map\" style=\"width: 512; height: 320px\"></div>\n" 315 . "<script type=\"text/javascript\">\n" 316 . "(function() {\n" 317 . " var pm=document.createElement(\"script\");\n" 318 . " pm.type = 'text/javascript';\n" 319 . " pm.async = true;\n" 320 . " pm.src = '" . $url . "';\n" 321 . " var s = document.getElementById('pulsemaps_map');\n" 322 . " s.parentNode.appendChild(pm);\n" 323 . "})();\n" 324 . "</script>\n"; 325 } 326 327 add_shortcode('pulsemaps', 'pulsemaps_bigmap'); -
pulsemaps/trunk/readme.txt
r486205 r496995 8 8 Requires at least: 2.9 9 9 Tested up to: 3.3.1 10 Stable tag: 1. 4.610 Stable tag: 1.5 11 11 12 12 Show off your visitors on the world map. When people around the world visit your blog, the corresponding areas on the heat map widget light up! … … 68 68 69 69 == Changelog == 70 71 = 1.5 = 72 73 * Creating/signing in to a PulseMaps account now required (so we can 74 provide better support and reduce abuse and fraud). 70 75 71 76 = 1.4.6 = -
pulsemaps/trunk/style.css
r414563 r496995 1 #pulsemaps_plan {2 width: 1000px;3 }4 5 #pulsemaps_map {6 width: 512px;7 height: 280px;8 float: right;9 }10 11 1 #pulsemaps_descr { 12 width: 450px; 13 float: left; 2 margin-bottom: 20px; 14 3 } 15 4
Note: See TracChangeset
for help on using the changeset viewer.