Changeset 3064212
- Timestamp:
- 04/03/2024 11:23:56 PM (2 years ago)
- Location:
- geolocate-comments
- Files:
-
- 2 edited
- 3 copied
-
tags/1.2 (copied) (copied from geolocate-comments/trunk)
-
tags/1.2/geolocate-comments.php (copied) (copied from geolocate-comments/trunk/geolocate-comments.php) (7 diffs)
-
tags/1.2/readme.txt (copied) (copied from geolocate-comments/trunk/readme.txt) (2 diffs)
-
trunk/geolocate-comments.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
geolocate-comments/tags/1.2/geolocate-comments.php
r2782903 r3064212 3 3 Plugin Name: Geolocate Comments 4 4 Plugin URI: https://www.jwz.org/geolocate-comments/ 5 Version: 1. 15 Version: 1.2 6 6 Description: Save the geolocation when a new comment is posted. 7 7 Author: Jamie Zawinski … … 9 9 */ 10 10 11 /* Copyright © 2022 Jamie Zawinski <jwz@jwz.org>11 /* Copyright © 2022-2023 Jamie Zawinski <jwz@jwz.org> 12 12 13 13 Permission to use, copy, modify, distribute, and sell this software and its … … 24 24 25 25 geolocate_service_urls - filter the preferences setting 26 geolocate_comment_text - filter the formatte ted location output26 geolocate_comment_text - filter the formatted location output 27 27 geolocate_user_agent_text - filter the formatteted UA output 28 28 … … 105 105 106 106 if ($json) { 107 $errmsg = ($json['response'] ? $json['response'] : // ip2location.com 108 ($json['message'] ? $json['message'] : // ipbase.com 109 '')); 107 $errmsg = (($json['response'] ?? '') 108 ? $json['response'] // ip2location.com 109 : (($json['message'] ?? '') 110 ? $json['message'] // ipbase.com 111 : '')); 110 112 if (preg_match ('/^OK/i', $errmsg)) 111 113 $errmsg = ''; … … 119 121 } 120 122 121 if ($json['data'] ) {123 if ($json['data'] ?? 0) { 122 124 $json = $json['data']; // ipbase.com/v2/ rather than ipbase.com/json/ 123 125 } … … 142 144 143 145 if ($rez == 'none') 144 return "";146 return apply_filters ('geolocate_comment_text', "", $comment, $loc, $rez); 145 147 146 148 if (!$loc) … … 294 296 } 295 297 296 if (!$rez || $rez == 'none')297 return $comment_text;298 299 298 $loc = geolocate_comment_text ($comment, null, $rez); 300 299 if (!$loc && $admin_p) 301 300 $loc = 'Location unknown'; 302 301 303 $ua = geolocate_user_agent_text ($comment); 302 $ua = ''; 303 if ($rez == 'city' || $rez == 'state') 304 $ua = geolocate_user_agent_text ($comment); 304 305 if ($ua) 305 306 $loc = $loc . ($loc ? '; ' : '') . $ua; -
geolocate-comments/tags/1.2/readme.txt
r2782903 r3064212 4 4 Tags: Geolocation, Comments 5 5 Requires at least: 2.7 6 Tested up to: 6. 0.27 Stable tag: 1. 16 Tested up to: 6.5 7 Stable tag: 1.2 8 8 License: MIT 9 9 … … 35 35 * Support a few other sites. 36 36 37 = 1.2 = 38 * Better error messages. 39 * Added `geolocate_comment_text` filter. 40 -
geolocate-comments/trunk/geolocate-comments.php
r2782903 r3064212 3 3 Plugin Name: Geolocate Comments 4 4 Plugin URI: https://www.jwz.org/geolocate-comments/ 5 Version: 1. 15 Version: 1.2 6 6 Description: Save the geolocation when a new comment is posted. 7 7 Author: Jamie Zawinski … … 9 9 */ 10 10 11 /* Copyright © 2022 Jamie Zawinski <jwz@jwz.org>11 /* Copyright © 2022-2023 Jamie Zawinski <jwz@jwz.org> 12 12 13 13 Permission to use, copy, modify, distribute, and sell this software and its … … 24 24 25 25 geolocate_service_urls - filter the preferences setting 26 geolocate_comment_text - filter the formatte ted location output26 geolocate_comment_text - filter the formatted location output 27 27 geolocate_user_agent_text - filter the formatteted UA output 28 28 … … 105 105 106 106 if ($json) { 107 $errmsg = ($json['response'] ? $json['response'] : // ip2location.com 108 ($json['message'] ? $json['message'] : // ipbase.com 109 '')); 107 $errmsg = (($json['response'] ?? '') 108 ? $json['response'] // ip2location.com 109 : (($json['message'] ?? '') 110 ? $json['message'] // ipbase.com 111 : '')); 110 112 if (preg_match ('/^OK/i', $errmsg)) 111 113 $errmsg = ''; … … 119 121 } 120 122 121 if ($json['data'] ) {123 if ($json['data'] ?? 0) { 122 124 $json = $json['data']; // ipbase.com/v2/ rather than ipbase.com/json/ 123 125 } … … 142 144 143 145 if ($rez == 'none') 144 return "";146 return apply_filters ('geolocate_comment_text', "", $comment, $loc, $rez); 145 147 146 148 if (!$loc) … … 294 296 } 295 297 296 if (!$rez || $rez == 'none')297 return $comment_text;298 299 298 $loc = geolocate_comment_text ($comment, null, $rez); 300 299 if (!$loc && $admin_p) 301 300 $loc = 'Location unknown'; 302 301 303 $ua = geolocate_user_agent_text ($comment); 302 $ua = ''; 303 if ($rez == 'city' || $rez == 'state') 304 $ua = geolocate_user_agent_text ($comment); 304 305 if ($ua) 305 306 $loc = $loc . ($loc ? '; ' : '') . $ua; -
geolocate-comments/trunk/readme.txt
r2782903 r3064212 4 4 Tags: Geolocation, Comments 5 5 Requires at least: 2.7 6 Tested up to: 6. 0.27 Stable tag: 1. 16 Tested up to: 6.5 7 Stable tag: 1.2 8 8 License: MIT 9 9 … … 35 35 * Support a few other sites. 36 36 37 = 1.2 = 38 * Better error messages. 39 * Added `geolocate_comment_text` filter. 40
Note: See TracChangeset
for help on using the changeset viewer.