Changeset 724647
- Timestamp:
- 06/09/2013 02:05:44 PM (13 years ago)
- Location:
- pulsemaps/trunk
- Files:
-
- 2 added
- 6 edited
-
pm-proxy.php (modified) (2 diffs)
-
pm-register.php (added)
-
pm-settings-page.php (modified) (6 diffs)
-
pm-util.php (added)
-
pm-widget.php (modified) (2 diffs)
-
pulsemaps.php (modified) (8 diffs)
-
readme.txt (modified) (3 diffs)
-
settings.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pulsemaps/trunk/pm-proxy.php
r499390 r724647 1 1 <?php 2 2 3 /* Copyright 2011-201 2Aito Software Inc. (email : [email protected])3 /* Copyright 2011-2013 Aito Software Inc. (email : [email protected]) 4 4 5 5 This program is free software; you can redistribute it and/or modify … … 18 18 19 19 require_once('pm-config.php'); 20 $c = curl_init($pulsemaps_url . $_POST['path']); 21 curl_setopt($c, CURLOPT_POSTFIELDS, $_POST); 22 curl_setopt($c, CURLOPT_HEADER, true); 23 curl_setopt($c, CURLOPT_RETURNTRANSFER, true); 24 $data = curl_exec($c); 25 $info = curl_getinfo($c); 26 curl_close($c); 27 $header_size = $info["header_size"]; 28 $headers = substr($data, 0, $header_size); 29 foreach (explode("\n", $headers) as $header) { 30 $header = rtrim($header); 31 if ($header && strpos($header, 'Transfer-Encoding') === false) { 32 header($header); 33 } 34 } 20 require_once('pm-util.php'); 35 21 36 echo substr($data, $header_size); 22 $r = pulsemaps_post_request($pulsemaps_url . $_POST['path'], 23 array('key' => $_POST['key'])); 24 print $r; -
pulsemaps/trunk/pm-settings-page.php
r499372 r724647 1 1 <?php 2 2 3 /* Copyright 2011-201 2Aito Software Inc. (email : [email protected])3 /* Copyright 2011-2013 Aito Software Inc. (email : [email protected]) 4 4 5 5 This program is free software; you can redistribute it and/or modify … … 39 39 $options = get_option('pulsemaps_options'); 40 40 $id = $options['id']; 41 $widget_url = "$pulsemaps_url/widget.js?id=123456789¬rack=1&target=widget-preview";42 $proxy_url = plugins_url('pm-proxy.php', __FILE__);43 41 $siteurl = get_option('siteurl'); 44 ?> 45 <script type='text/javascript'> 46 function updatePreview() { 47 pulsemaps.updatePreview('<?php echo $widget_url; ?>'); 48 } 49 function showMessage(msg) { 50 jQuery("#pulsemaps_message").html("<p><strong>" + msg + "</strong></p>").show(); 51 } 52 function updateInfo() { 53 jQuery("#pulsemaps_plan_load").html('<img src="<?php echo $siteurl; ?>/wp-admin/images/loading.gif" alt="loading...">'); 54 jQuery("#pulsemaps_plan_load").load("<?php echo $proxy_url; ?>", 55 {path: "/maps/<?php echo $options['id']; ?>/wp-info.html", 56 url: "<?php echo $proxy_url; ?>", 57 site_url: "<?php echo $siteurl; ?>", 58 id: "<?php echo $options['id']; ?>", 59 key: "<?php echo $options['key']; ?>", 60 version: "<?php echo pulsemaps_plugin_version(); ?>", 61 return_to: "<?php echo pulsemaps_settings_url(); ?>", 62 svn_id: "$Id: $", 63 wp_version: "<?php global $wp_version; echo $wp_version; ?>", 64 php_version: "<?php echo phpversion(); ?>"}); 65 } 66 jQuery(document).ready(function() { 67 pulsemaps.setHooks('<?php echo $widget_url; ?>'); 68 updateInfo(); 69 }); 70 </script> 71 <?php 72 } 73 42 } 74 43 75 44 function pulsemaps_admin_footer() { 76 echo "<div id=\"script-container\">< script type='text/javascript'>updatePreview();</script></div>\n";45 echo "<div id=\"script-container\"></div>\n"; 77 46 } 78 47 … … 86 55 } 87 56 57 88 58 function pulsemaps_options_page() { 59 if (!pulsemaps_registered()) { 60 pulsemaps_register_page(); 61 } else { 62 pulsemaps_settings_page(); 63 } 64 } 65 66 67 function pulsemaps_register_page() { 68 global $pulsemaps_url; 69 $tags = 'utm_source=wordpress&utm_medium=integration&utm_campaign=wp_plugin_' . pulsemaps_plugin_version(); 70 ?> 71 <h2>Install PulseMaps</h2> 72 73 <h3>Sign in to your PulseMaps account to continue</h3> 74 75 <form id="pulsemaps_install_form" method="post"> 76 <table class="form-table"> 77 <tr> 78 <th style="width: 100px;"><label for="email">Email</label></th> 79 <td> 80 <input tabindex="1" style="width: 200px;" id="email" name="email" size="32" type="text" class="regular-text" value="" /> 81 <a href="<?php echo "$pulsemaps_url/?$tags"; ?>" target="_blank">(don't have a PulseMaps account yet?)</a> 82 </td> 83 </tr> 84 <tr> 85 <th style="width: 100px;"><label for="password">Password</label></th> 86 <td> 87 <input tabindex="1" style="width: 200px;" id="password" name="password" size="32" type="password" class="regular-text"> 88 <a href="<?php echo "$pulsemaps_url/forgot/?$tags"; ?>" target="_blank">(forgot your password?)</a> 89 </td> 90 </tr> 91 </table> 92 <table class="form-table"> 93 <tr> 94 <th> 95 <input tabindex="1" style="float: left; margin-right: 10px;" id="pulsemaps_install_button" type="submit" class="button button-primary button-large" value="Install »" /> 96 <img id="pulsemaps_install_loading" style="padding-top: 8px; display: none;" src="<?php echo pulsemaps_admin_url(); ?>images/loading.gif" alt="loading..."> 97 </th> 98 <td> 99 <div style="padding-top: 3px; color: #ff6060; font-size: 120%;" id="pulsemaps_install_error"></div> 100 </td> 101 </table> 102 </form> 103 <?php 104 } 105 106 function pulsemaps_settings_page() { 89 107 global $pulsemaps_url; 90 108 $opts = get_option('pulsemaps_options', array()); 91 109 $id = $opts['id']; 92 110 ?> 111 <div id="pulsemaps_data" 112 data-url="<?php echo $pulsemaps_url; ?>" 113 data-admin-url="<?php echo pulsemaps_admin_url(); ?>" 114 data-proxy-url="<?php echo plugins_url('pm-proxy.php', __FILE__); ?>" 115 data-id="<?php echo $opts['id']; ?>" 116 data-key="<?php echo $opts['key']; ?>" 117 ></div> 93 118 <div id="pulsemaps_message" style="display: none;" class="updated"></div> 94 119 <div class="wrap"> 95 120 <div id="icon-options-general" class="icon32"><br></div> 96 <h2>PulseMaps Visitor Map</h2>121 <h2>PulseMaps Settings</h2> 97 122 <div id="pulsemaps_descr"> 98 123 <div id="pulsemaps_plan_load"> 99 124 </div> 100 125 </div> 101 <form style="display: none;" id="pulsemaps_activate" action="options.php" method="post"> 102 <?php settings_fields('pulsemaps_options'); ?> 103 <input type="hidden" name="pulsemaps_options[activated]" value="1"> 104 </form> 105 <script> 106 function pulsemaps_activate(data) 107 { 108 jQuery('#pulsemaps_settings').show(); 109 <?php if (!$opts['activated']) { ?> 110 jQuery.post('options.php', jQuery('#pulsemaps_activate').serialize()); 111 jQuery('#pulsemaps_widget_msg').show(); 112 <?php } ?> 113 if (data.reload) { 114 updateInfo(); 115 } 116 if (data.message) { 117 showMessage(data.message); 118 } 119 } 120 </script> 121 <div id="pulsemaps_settings" <?php if (!$opts['activated']) { echo 'style="display: none;"'; } ?>> 126 <div id="pulsemaps_settings"> 122 127 <form action="options.php" method="post"> 123 128 <?php settings_fields('pulsemaps_options'); ?> … … 149 154 add_settings_field('pulsemaps_widget_dots', 'Real-time dots', 'pulsemaps_widget_dots', 'pulsemaps', 'pulsemaps_options'); 150 155 add_settings_field('pulsemaps_widget_meta', 'Text above small map', 'pulsemaps_widget_showmeta', 'pulsemaps', 'pulsemaps_options'); 151 if ($options['plan'] != 'free') {152 add_settings_field('pulsemaps_track_all', 'Track without widget', 'pulsemaps_track_all', 'pulsemaps', 'pulsemaps_options');153 }154 156 } 155 157 … … 217 219 } 218 220 219 function pulsemaps_track_all() {220 $options = get_option('pulsemaps_options');221 $track_all = $options['track_all'];222 ?>223 <input id="track-all" class="widget-param" type="checkbox" name="pulsemaps_options[track_all]" value="1" <?php checked(1 == $track_all); ?> />224 <label for="track-all">Track also pages without the widget.</label>225 <?php226 }227 221 228 222 function pulsemaps_widget_color() { … … 318 312 pulsemaps_validate_color($options, $input, 'custom_bgcolor'); 319 313 pulsemaps_validate_bool($options, $input, 'widget_dots'); 320 pulsemaps_validate_bool($options, $input, 'track_all');321 314 pulsemaps_validate_bool($options, $input, 'widget_new_window'); 322 315 pulsemaps_validate_bool($options, $input, 'activated'); -
pulsemaps/trunk/pm-widget.php
r515577 r724647 1 1 <?php 2 2 3 /* Copyright 2011-201 2Aito Software Inc. (email : [email protected])3 /* Copyright 2011-2013 Aito Software Inc. (email : [email protected]) 4 4 5 5 This program is free software; you can redistribute it and/or modify … … 48 48 } 49 49 $url .= '&meta=' . $opts['widget_meta']; 50 51 if ($opts['track_all'] || is_user_logged_in()) { 52 $url .= '¬rack=1'; 53 } 50 $url .= '¬rack=1'; 54 51 55 52 if (!$opts['widget_dots']) { -
pulsemaps/trunk/pulsemaps.php
r521043 r724647 3 3 Plugin Name: PulseMaps 4 4 Plugin URI: http://pulsemaps.com/wordpress/ 5 Description: S how 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. 65 Description: See where your visitors come from on the world map. 6 Version: 1.7 7 7 Author: Aito Software Inc. 8 8 License: GPLv2 or later 9 9 */ 10 10 11 /* Copyright 2011-201 2Aito Software Inc. (email : [email protected])11 /* Copyright 2011-2013 Aito Software Inc. (email : [email protected]) 12 12 13 13 This program is free software; you can redistribute it and/or modify … … 28 28 require_once('pm-widget.php'); 29 29 require_once('pm-settings-page.php'); 30 31 function pulsemaps_register() { 32 global $pulsemaps_url; 33 $c = curl_init($pulsemaps_url . '/register'); 34 $data = array('name' => get_option('blogname'), 35 'email' => get_option('admin_email'), 36 'url' => get_option('home')); 37 curl_setopt($c, CURLOPT_POSTFIELDS, $data); 38 curl_setopt($c, CURLOPT_RETURNTRANSFER, true); 39 $ret = curl_exec($c); 40 $code = curl_getinfo($c, CURLINFO_HTTP_CODE); 41 curl_close($c); 42 43 return json_decode($ret, true); 44 } 45 30 require_once('pm-register.php'); 46 31 47 32 function pulsemaps_upgrade($opts, $first) { … … 71 56 } 72 57 73 if (!isset($opts['track_all'])) {74 $opts['track_all'] = false;75 }76 77 58 if (!isset($opts['widget_dots'])) { 78 59 $opts['widget_dots'] = true; … … 119 100 $opts = get_option('pulsemaps_options', array()); 120 101 121 if (!pulsemaps_registered()) {122 $ret = pulsemaps_register();123 if ($ret['status'] == 'ok') {124 $opts['key'] = $ret['key'];125 $opts['id'] = $ret['id'];126 } else {127 error_log(json_encode($ret));128 }129 }130 131 102 if (!isset($opts['widget_width'])) { 132 103 $opts['widget_width'] = 220; … … 169 140 } 170 141 142 143 function pulsemaps_registered() { 144 $opts = get_option('pulsemaps_options', array()); 145 return isset($opts['key']) && isset($opts['id']); 146 } 147 148 171 149 function pulsemaps_refresh() { 150 if (!pulsemaps_registered()) { 151 return; 152 } 153 172 154 global $pulsemaps_url; 173 155 $opts = get_option('pulsemaps_options', array()); … … 189 171 190 172 191 function pulsemaps_tracking_active() {192 if (is_active_widget(false, false, 'pulsemapswidget', true)) {193 return true;194 }195 $opts = get_option('pulsemaps_options', array());196 return $opts['track_all'];197 }198 199 function pulsemaps_registered() {200 $opts = get_option('pulsemaps_options', array());201 return isset($opts['key']) && isset($opts['id']);202 }203 204 function pulsemaps_activated() {205 $opts = get_option('pulsemaps_options', array());206 return $opts['activated'];207 }208 209 173 function pulsemaps_plugin_version() { 210 174 $plugin_data = get_plugin_data(__FILE__); … … 226 190 227 191 function pulsemaps_activate_notice() { 228 global $pulsemaps_url;229 192 $opts = get_option('pulsemaps_options'); 230 193 $id = $opts['id']; 231 if (! pulsemaps_activated()&& substr($_SERVER["PHP_SELF"], -11) != 'general.php'194 if (!$opts['id'] && substr($_SERVER["PHP_SELF"], -11) != 'general.php' 232 195 && $_GET["page"] != "pulsemaps") { 233 echo '<div class="error"><p><strong>Activate the PulseMaps service on the <a href="';196 echo '<div class="error"><p><strong>Activate PulseMaps for this site on the <a href="'; 234 197 echo pulsemaps_settings_url(); 235 198 echo '">settings page</a>.</strong></p></div>'; 236 } else if (substr($_SERVER["PHP_SELF"], -11) == 'widgets.php') {237 echo '<div id="pulsemaps_not_active" class="error" ';238 if (pulsemaps_tracking_active()) {239 echo 'style="display: none;"';240 }241 echo '><p><strong>Drag the PulseMaps widget to a sidebar on the right to activate.</strong></p></div>';242 if (!$opts['congrats']) {243 $opts['congrats'] = true;244 update_option('pulsemaps_options', $opts);245 echo '<div id="pulsemaps_activated" style="display: none;" ';246 echo 'class="updated"><p><strong>All done! You can always visit the <a href="';247 echo get_option('siteurl'). '/wp-admin/options-general.php?page=pulsemaps';248 echo '">PulseMaps settings page</a> to customize your widget.</strong></p></div>';249 }250 } else {251 $hide = pulsemaps_tracking_active() || !pulsemaps_activated();252 echo '<div id="pulsemaps_widget_msg" class="error"';253 if ($hide) {254 echo ' style="display: none;"';255 }256 echo '><p><strong>Enable the PulseMaps widget on the <a href="';257 echo get_option('siteurl') . '/wp-admin/widgets.php';258 echo '">widget admin page</a> to start mapping visitors.</strong></p></div>';259 199 } 260 200 } 261 201 add_action('admin_notices', 'pulsemaps_activate_notice'); 262 202 263 function pulsemaps_widgets_css() { 264 ?> 265 <style type="text/css" media="all"> 266 .pulsemaps-red-border { 267 border-color: #c00 !important; 268 } 269 .pulsemaps-red-bg { 270 background-color: #ffebe8 !important; 271 } 272 </style> 273 <?php 274 } 275 276 add_action("admin_print_scripts-widgets.php", 'pulsemaps_widgets_css'); 277 278 function pulsemaps_widgets_script() { 279 ?> 280 <script type='text/javascript'> 281 var pulsemaps = pulsemaps || {}; 282 pulsemaps.showRed = function() { 283 jQuery('div.widget[id*=_pulsemapswidget] .widget-title').addClass('pulsemaps-red-bg'); 284 jQuery('div.widget[id*=_pulsemapswidget] .widget-top').addClass('pulsemaps-red-border'); 285 jQuery('div.widget[id*=_pulsemapswidget]').addClass('pulsemaps-red-border'); 286 } 287 pulsemaps.hideRed = function() { 288 jQuery('div.widget[id*=_pulsemapswidget] .widget-title').removeClass('pulsemaps-red-bg'); 289 jQuery('div.widget[id*=_pulsemapswidget] .widget-top').removeClass('pulsemaps-red-border'); 290 jQuery('div.widget[id*=_pulsemapswidget]').removeClass('pulsemaps-red-border'); 291 } 292 pulsemaps.origSaveOrder = wpWidgets.saveOrder; 293 pulsemaps.saveOrder = function(sb) { 294 if (jQuery('#widgets-right').find('div.widget[id*=_pulsemapswidget]').length) { 295 jQuery('#pulsemaps_not_active').slideUp(); 296 jQuery('#pulsemaps_activated').slideDown(); 297 pulsemaps.hideRed(); 298 } else { 299 jQuery('#pulsemaps_not_active').slideDown(); 300 jQuery('#pulsemaps_activated').slideUp(); 301 pulsemaps.showRed(); 302 } 303 pulsemaps.origSaveOrder.call(wpWidgets, sb); 304 } 305 wpWidgets.saveOrder = pulsemaps.saveOrder; 306 307 if (jQuery('#widgets-right').find('div.widget[id*=_pulsemapswidget]').length == 0) { 308 pulsemaps.showRed(); 309 } 310 </script> 311 <?php 312 } 313 add_action("admin_footer-widgets.php", 'pulsemaps_widgets_script'); 203 314 204 315 205 function pulsemaps_plugin_actions($links, $file) { … … 326 216 function pulsemaps_async_tracker() { 327 217 $opts = get_option('pulsemaps_options'); 328 if ( $opts['track_all'] &&!is_user_logged_in()) {218 if (!is_user_logged_in()) { 329 219 global $pulsemaps_url; 330 220 ?> -
pulsemaps/trunk/readme.txt
r521043 r724647 5 5 Plugin URI: http://pulsemaps.com/wordpress/ 6 6 Donate link: http://pulsemaps.com/pricing/ 7 Tags: visitor map, statistics, heat map, traffic counter, traffic widget, visitors counter, hit counter, geo, geolocation, location, country, stats, widget, visitors, density map, analytics8 Requires at least: 2.99 Tested up to: 3. 3.17 Tags: visitor map, world map, heat map, traffic counter, traffic widget, visitors counter, hit counter, geo, geolocation, location, country, stats, widget, visitors, density map, analytics 8 Requires at least: 3.0 9 Tested up to: 3.5.1 10 10 Stable tag: 1.6 11 11 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!12 Show off your website visitors on the world map. When people around the world visit your blog, the corresponding areas on the heat map widget light up! 13 13 14 14 == Description == … … 37 37 1. Upload the folder `pulsemaps` to the `/wp-content/plugins/` directory 38 38 2. Activate the plugin through the 'Plugins' menu in WordPress 39 3. Activate the PulseMaps widget through the 'Appearance' / 'Widgets' menu in Wordpress39 3. Register your site on the 'Settings' / 'PulseMaps' menu in WordPress 40 40 41 41 == Screenshots == … … 51 51 = What browsers does the widget support? = 52 52 53 The widget has been tested to work on all commonbrowsers, such as Internet Explorer, Firefox, Chrome, Safari, and Opera, as well as mobile Safari and the Android browser.53 The widget has been tested to work on all major browsers, such as Internet Explorer, Firefox, Chrome, Safari, and Opera, as well as mobile Safari and the Android browser. 54 54 55 55 = What PHP versions are supported? = 56 56 57 PHP 5 with the curl extension is required. 58 59 = Why doesn't my map show any visitors? = 60 61 Make sure the map widget is present and visible on all pages you want to track. To track visits without the widget, upgrade to the VIP plan. 62 63 = Why is the visit count different from other trackers? = 64 65 Tracking visits is not an exact science. Many hit counters will increase the counter for every time a page was requested from the web server. For various reasons, this could lead to misleadingly high visit counts. PulseMaps only tracks actual page views by actual browsers, almost always operated by an actual human. 66 67 PulseMaps keeps track of visits and page views. A page view is recorded when a page is viewed on a browser. Page views from the same user are grouped into visits. A pause of 30 minutes or more between page views causes a new visit to be recorded. So for example, if a user visits your site and views 10 pages within 5 minutes, the number on the widget is increased by only one. If the same user comes back and views a couple more pages after an hour, a second visit is recorded. Click through to the map details page to see the number of page views. 57 PHP 5 is required. 68 58 69 59 == Changelog == 60 61 = 1.7 = 62 63 * Bug fixes to registration process. 64 * Widget no longer required on page to track page views. 65 * The curl PHP extension is no longer required. 70 66 71 67 = 1.6 = -
pulsemaps/trunk/settings.js
r462179 r724647 47 47 } 48 48 jQuery('#script-container').append(scr); 49 } 49 }; 50 51 pulsemaps.install = function(event) { 52 event.preventDefault(); 53 54 var btn = jQuery('#pulsemaps_install_button'); 55 var loader = jQuery('#pulsemaps_install_loading'); 56 var msg = jQuery('#pulsemaps_install_error'); 57 58 if (btn.hasClass('button-disabled')) { 59 return; 60 } 61 62 btn.addClass('button-disabled'); 63 loader.show(); 64 msg.hide(); 65 66 var data = {'email': jQuery('#email').val(), 67 'password': jQuery('#password').val(), 68 'action': 'pulsemaps_register'}; 69 jQuery.ajax({ 70 type: 'POST', 71 url: ajaxurl, 72 data: data, 73 dataType: 'json', 74 success: function(data, status) { 75 if (data.status != 'ok') { 76 msg.html(data.errorMessage).show(); 77 btn.removeClass('button-disabled'); 78 loader.hide(); 79 } else { 80 location.reload(); 81 } 82 }, 83 error: function(request, status, error) { 84 var html = 'An error occurred when connecting to your WordPress server. Please try again later.<br/>'; 85 html += 'If the problem persists, contact <a href="mailto:[email protected]">[email protected]</a> and include the following information:<br/><br/>'; 86 html += 'Status: ' + status + '<br/>'; 87 html += 'Error: ' + error + '<br/>'; 88 msg.html(html).show(); 89 btn.removeClass('button-disabled'); 90 loader.hide(); 91 } 92 }); 93 }; 50 94 51 95 pulsemaps.setHooks = function(url) { … … 55 99 }); 56 100 jQuery("form").submit(function() { window.onbeforeunload = null; }); 57 } 101 }; 102 103 pulsemaps.loadInfo = function() { 104 var data = jQuery('#pulsemaps_data'); 105 var admin_url = data.data('admin-url'); 106 var proxy_url = data.data('proxy-url'); 107 var id = data.data('id'); 108 var key = data.data('key'); 109 jQuery("#pulsemaps_plan_load").html('<img src="' + admin_url + '/images/loading.gif" alt="loading...">'); 110 jQuery("#pulsemaps_plan_load").load(proxy_url, 111 {path: '/maps/' + id + '/wp-info.html', 112 key: key}); 113 }; 114 115 116 jQuery(document).ready(function() { 117 var data = jQuery('#pulsemaps_data'); 118 if (data.length) { 119 var url = data.data('url'); 120 var id = data.data('id'); 121 url += '/widget.js?id=' + id + '¬rack=1&target=widget-preview'; 122 pulsemaps.setHooks(url); 123 pulsemaps.updatePreview(url); 124 pulsemaps.loadInfo(); 125 } else { 126 jQuery('#pulsemaps_install_form').submit(pulsemaps.install); 127 } 128 });
Note: See TracChangeset
for help on using the changeset viewer.