Changeset 2951287
- Timestamp:
- 08/10/2023 08:03:13 AM (2 years ago)
- Location:
- bingmaps/trunk
- Files:
-
- 7 edited
-
bingmaps.php (modified) (2 diffs)
-
include/bingmapslib_dbase_api.php (modified) (5 diffs)
-
include/bingmapslib_escaping.php (modified) (1 diff)
-
include/bingmapslib_migrate.php (modified) (1 diff)
-
include/bingmapslib_utils.php (modified) (2 diffs)
-
lang/bingmaps.pot (modified) (3 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
bingmaps/trunk/bingmaps.php
r2940206 r2951287 6 6 Description: Adds a map to a web page using the Bing Maps API 7 7 Author: Malcolm Shergold 8 Version: 1. 3.28 Version: 1.4 9 9 Author URI: https://www.corondeck.co.uk 10 10 */ … … 30 30 31 31 define('BINGMAPS_CODE_PREFIX', BINGMAPS_DIR_NAME); 32 33 define('BINGMAPSLIB_PLUGIN_ID', 'StageShow'); 32 34 33 35 define('BINGMAPS_ADMINUSER_CAPABILITY', 'manage_options'); -
bingmaps/trunk/include/bingmapslib_dbase_api.php
r2940206 r2951287 249 249 } 250 250 251 function AddGenericDBFields(&$ saleDetails)252 { 253 $ saleDetails->organisation = $this->adminOptions['OrganisationID'];251 function AddGenericDBFields(&$event) 252 { 253 $event->organisation = $this->adminOptions['OrganisationID']; 254 254 if ($this->isOptionSet('HomePageURL')) 255 255 { 256 $ saleDetails->url = $this->getOption('HomePageURL');256 $event->url = $this->getOption('HomePageURL'); 257 257 } 258 258 else 259 259 { 260 $ saleDetails->url = get_option('home');260 $event->url = get_option('home'); 261 261 } 262 262 } … … 357 357 } 358 358 359 function URLsToAnchor($page) 360 { 361 $posnHTTP = 0; 362 363 // Look for a word followed by a URL 364 $URLRegex = "#(\w*\s)(https:[\w.\/\-\?\=]*)#"; 365 366 $matches = array(); 367 $noOfMatches = preg_match_all($URLRegex, $page, $matches); 368 if ($noOfMatches !== false) 369 { 370 for ($i=0; $i<$noOfMatches; $i++) 371 { 372 $entry = $matches[0][$i]; 373 $url = $matches[2][$i]; 374 $txt = BingMapsLibMigratePHPClass::Safe_trim($matches[1][$i]); 375 376 $page = BingMapsLibMigratePHPClass::Safe_str_replace($entry, '<a target="_blank" href="'.$url.'">'.$txt.'</a>', $page); 377 } 378 } 379 380 return $page; 381 } 382 359 383 function DeleteCapability($capID) 360 384 { … … 1070 1094 foreach($saleRecord as $ticket) 1071 1095 { 1072 $emailContent .= $this->AddE MailFields($section, $ticket);1096 $emailContent .= $this->AddEventToTemplate($section, $ticket); 1073 1097 } 1074 1098 break; … … 1097 1121 if (($posnPHP !== false) && ($posnEOL !== false)) 1098 1122 { 1099 $EMailSubject = $this->AddE MailFields(BingMapsLibMigratePHPClass::Safe_substr($mailTemplate, $posnPHP+1, $posnEOL-$posnPHP-1), $dbRecord[0]);1123 $EMailSubject = $this->AddEventToTemplate(BingMapsLibMigratePHPClass::Safe_substr($mailTemplate, $posnPHP+1, $posnEOL-$posnPHP-1), $dbRecord[0]); 1100 1124 $mailTemplate = BingMapsLibMigratePHPClass::Safe_substr($mailTemplate, $posnEOL); 1101 1125 } … … 1136 1160 1137 1161 // Process the rest of the mail template 1138 $emailContent = $this->AddE MailFields($mailTemplate, $dbRecord[0]);1162 $emailContent = $this->AddEventToTemplate($mailTemplate, $dbRecord[0]); 1139 1163 1140 1164 return 'OK'; 1141 1165 } 1142 1166 1143 function FormatEMailField($tag, $field, &$saleDetails) 1144 { 1145 return $saleDetails->$field; 1146 } 1147 1148 function AddEMailFields($EMailTemplate, $saleDetails) 1149 { 1150 foreach ($saleDetails as $key => $value) 1167 function RetrieveEventElement($tag, $field, &$event) 1168 { 1169 return $event->$field; 1170 } 1171 1172 function DoTemplateConditionals(&$EMailTemplate, $event) 1173 { 1174 $if_marker = '[if'; 1175 $if_text = $if_marker.' '; 1176 $ifnot_text = $if_marker.'not '; 1177 $endif_text = '[endif]'; 1178 $else_text = '[else]'; 1179 1180 $if_len = BingMapsLibMigratePHPClass::Safe_strlen($if_text); 1181 $ifnot_len = BingMapsLibMigratePHPClass::Safe_strlen($ifnot_text); 1182 $endif_len = BingMapsLibMigratePHPClass::Safe_strlen($endif_text); 1183 $else_len = BingMapsLibMigratePHPClass::Safe_strlen($else_text); 1184 1185 $offset = 0; 1186 $changes = 0; 1187 1188 // Loop while there are if markers 1189 while(true) 1190 { 1191 // Search backwards for if marker 1192 $nextPosn = BingMapsLibMigratePHPClass::Safe_strrpos($EMailTemplate, $if_marker, $offset); 1193 if ($nextPosn === false) break; 1194 1195 // Determine type of if statement 1196 if (BingMapsLibMigratePHPClass::Safe_substr($EMailTemplate, $nextPosn, $if_len) === $if_text) 1197 { 1198 $ifTagStartPosn = $nextPosn + $if_len; 1199 $dbCond = true; 1200 } 1201 else if (BingMapsLibMigratePHPClass::Safe_substr($EMailTemplate, $nextPosn, $ifnot_len) === $ifnot_text) 1202 { 1203 $ifTagStartPosn = $nextPosn + $ifnot_len; 1204 $dbCond = false; 1205 } 1206 else 1207 { 1208 $offset = $nextPosn - BingMapsLibMigratePHPClass::Safe_strlen($EMailTemplate) - 1; 1209 continue; 1210 } 1211 1212 $TemplateLen = BingMapsLibMigratePHPClass::Safe_strlen($EMailTemplate); 1213 1214 $ifTagEndPosn = BingMapsLibMigratePHPClass::Safe_strpos($EMailTemplate, ']', $ifTagStartPosn); 1215 $dbField = BingMapsLibMigratePHPClass::Safe_substr($EMailTemplate, $ifTagStartPosn, $ifTagEndPosn-$ifTagStartPosn); 1216 1217 // Search for end marker 1218 $sectionEnd = BingMapsLibMigratePHPClass::Safe_strpos($EMailTemplate, $endif_text, $nextPosn); 1219 if ($sectionEnd === false) 1220 return __('Missing Conditional end marker', 'bingmaps'); 1221 1222 // Search forwards for else marker (assumes later else markers have been processed) 1223 $elseStart = BingMapsLibMigratePHPClass::Safe_strpos($EMailTemplate, $else_text, $nextPosn); 1224 if ($elseStart === false) 1225 { 1226 $ifTrueStart = $ifTagEndPosn+1; 1227 $ifTrueEnd = $sectionEnd; 1228 $ifFalseStart = $sectionEnd; 1229 $ifFalseEnd = $sectionEnd; 1230 } 1231 else 1232 { 1233 $ifTrueStart = $ifTagEndPosn+1; 1234 $ifTrueEnd = $elseStart; 1235 $ifFalseStart = $elseStart + $else_len; 1236 $ifFalseEnd = $sectionEnd; 1237 } 1238 $endPosn = $sectionEnd + $endif_len; 1239 1240 $dbSet = false; 1241 if (isset($event->$dbField)) 1242 { 1243 if (is_numeric($event->$dbField)) 1244 { 1245 $dbSet = $event->$dbField > 0; 1246 } 1247 else 1248 { 1249 $dbSet = (BingMapsLibMigratePHPClass::Safe_strlen($event->$dbField) != 0); 1250 } 1251 } 1252 1253 $startText = BingMapsLibMigratePHPClass::Safe_substr($EMailTemplate, 0, $nextPosn); 1254 $endText = BingMapsLibMigratePHPClass::Safe_substr($EMailTemplate, $endPosn, $TemplateLen); 1255 1256 if ($dbSet == $dbCond) 1257 { 1258 // Replace the section including the conditional commands with the matched section 1259 $midText = BingMapsLibMigratePHPClass::Safe_substr($EMailTemplate, $ifTrueStart, $ifTrueEnd-$ifTrueStart); 1260 } 1261 else 1262 { 1263 // Replace the section with the else section (if it exists) 1264 $midText = BingMapsLibMigratePHPClass::Safe_substr($EMailTemplate, $ifFalseStart, $ifFalseEnd-$ifFalseStart); 1265 } 1266 1267 $EMailTemplate = $startText.$midText.$endText; 1268 $changes++; 1269 1270 $offset = 0 - BingMapsLibMigratePHPClass::Safe_strlen($midText) - BingMapsLibMigratePHPClass::Safe_strlen($endText); 1271 } 1272 1273 } 1274 1275 function AddEventToTemplate($EMailTemplate, $event) 1276 { 1277 foreach ($event as $key => $value) 1151 1278 { 1152 1279 $tag = '['.$key.']'; 1153 $value = $this-> FormatEMailField($tag, $key, $saleDetails);1280 $value = $this->RetrieveEventElement($tag, $key, $event); 1154 1281 $EMailTemplate = BingMapsLibMigratePHPClass::Safe_str_replace($tag, $value, $EMailTemplate); 1155 1282 } -
bingmaps/trunk/include/bingmapslib_escaping.php
r2940206 r2951287 85 85 } 86 86 87 static function Safe_EchoDownload($echoData) 88 { 89 // Not escaped as not output to browser .... 90 echo $echoData; 91 } 92 87 93 } 88 94 -
bingmaps/trunk/include/bingmapslib_migrate.php
r2940206 r2951287 136 136 { 137 137 if (is_null($string)) $string = ''; 138 return substr($string, $offset, $length); 138 // Bolt and braces code - Passing null length does not work on old versions of PHP 139 if (is_null($length)) 140 return substr($string, $offset); 141 else 142 return substr($string, $offset, $length); 139 143 } 140 144 -
bingmaps/trunk/include/bingmapslib_utils.php
r2940206 r2951287 356 356 } 357 357 358 static function GetHTTPNumber($reqArray, $elementId = 'undef', $defaultValue = null)358 static function GetHTTPNumber($reqArray, $elementId = 'undef', $defaultValue = '') 359 359 { 360 360 // This function will return the sanitised numeric array element … … 369 369 } 370 370 371 static function GetHTTPBool($reqArray, $elementId = 'undef') 372 { 373 if (!self::IsElementSet($reqArray, $elementId)) 374 return false; 375 $strval = self::GetArrayElement($reqArray, $elementId, false); 376 if (!is_numeric($strval)) 377 return false; 378 $boolVal = ($strval != 0); 379 return $boolVal; 380 } 381 371 382 static function GetHTTPFilenameElem($reqArray, $elementId, $defaultValue = '') 372 383 { -
bingmaps/trunk/lang/bingmaps.pot
r2940206 r2951287 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: MapView for Bing Maps 1. 3.2\n"5 "Project-Id-Version: MapView for Bing Maps 1.4\n" 6 6 "Report-Msgid-Bugs-To: http://wordpress.org/tag/bingmaps\n" 7 "POT-Creation-Date: 2023-0 7-17 16:22:16+00:00\n"7 "POT-Creation-Date: 2023-08-10 08:02:38+00:00\n" 8 8 "MIME-Version: 1.0\n" 9 9 "Content-Type: text/plain; charset=UTF-8\n" … … 48 48 msgstr "" 49 49 50 #: bingmaps.php:27 050 #: bingmaps.php:272 51 51 msgid "BingMaps Shortcode must specify centre Coordinates" 52 52 msgstr "" 53 53 54 #: bingmaps.php:27 754 #: bingmaps.php:279 55 55 msgid "BingMaps Shortcode must specify BOTH centre Coordinates" 56 56 msgstr "" 57 57 58 #: bingmaps.php:44 158 #: bingmaps.php:443 59 59 msgid "Overview" 60 60 msgstr "" 61 61 62 #: bingmaps.php:44 262 #: bingmaps.php:444 63 63 msgid "Settings" 64 64 msgstr "" … … 166 166 msgstr "" 167 167 168 #: include\mjslib_dbase_api.php:5 52168 #: include\mjslib_dbase_api.php:576 169 169 msgid "Session Debug Modes" 170 170 msgstr "" 171 171 172 #: include\mjslib_dbase_api.php:5 70172 #: include\mjslib_dbase_api.php:594 173 173 msgid "SSL over HTTP" 174 174 msgstr "" 175 175 176 #: include\mjslib_dbase_api.php:1325 176 #: include\mjslib_dbase_api.php:1332 177 msgid "Missing Conditional end marker" 178 msgstr "" 179 180 #: include\mjslib_dbase_api.php:1452 177 181 msgid "" 178 182 "WARNING: EMail Template contains one or mores lines with leading dots ('.')" -
bingmaps/trunk/readme.txt
r2940206 r2951287 3 3 Tags: pages, paypal, maps, bing, mapping, ordnance survey, OS, routes, walking 4 4 Requires at least: 3.0 5 Tested up to: 6. 2.26 Stable tag: 1. 3.25 Tested up to: 6.3 6 Stable tag: 1.4 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset
for help on using the changeset viewer.