Plugin Directory

Changeset 2951287


Ignore:
Timestamp:
08/10/2023 08:03:13 AM (2 years ago)
Author:
Malcolm-OPH
Message:

Release 1.4

Location:
bingmaps/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • bingmaps/trunk/bingmaps.php

    r2940206 r2951287  
    66Description: Adds a map to a web page using the Bing Maps API
    77Author: Malcolm Shergold
    8 Version: 1.3.2
     8Version: 1.4
    99Author URI: https://www.corondeck.co.uk
    1010*/
     
    3030   
    3131    define('BINGMAPS_CODE_PREFIX', BINGMAPS_DIR_NAME);
     32   
     33    define('BINGMAPSLIB_PLUGIN_ID', 'StageShow');
    3234
    3335    define('BINGMAPS_ADMINUSER_CAPABILITY', 'manage_options');
  • bingmaps/trunk/include/bingmapslib_dbase_api.php

    r2940206 r2951287  
    249249        }
    250250
    251         function AddGenericDBFields(&$saleDetails)
    252         {
    253             $saleDetails->organisation = $this->adminOptions['OrganisationID'];
     251        function AddGenericDBFields(&$event)
     252        {
     253            $event->organisation = $this->adminOptions['OrganisationID'];
    254254            if ($this->isOptionSet('HomePageURL'))
    255255            {
    256                 $saleDetails->url = $this->getOption('HomePageURL');
     256                $event->url = $this->getOption('HomePageURL');
    257257            }
    258258            else
    259259            {
    260                 $saleDetails->url = get_option('home');
     260                $event->url = get_option('home');
    261261            }
    262262        }
     
    357357        }
    358358
     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       
    359383        function DeleteCapability($capID)
    360384        {
     
    10701094                    foreach($saleRecord as $ticket)
    10711095                    {
    1072                         $emailContent .= $this->AddEMailFields($section, $ticket);
     1096                        $emailContent .= $this->AddEventToTemplate($section, $ticket);
    10731097                    }
    10741098                    break;
     
    10971121            if (($posnPHP !== false) && ($posnEOL !== false))
    10981122            {
    1099                 $EMailSubject = $this->AddEMailFields(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]);
    11001124                $mailTemplate = BingMapsLibMigratePHPClass::Safe_substr($mailTemplate, $posnEOL);
    11011125            }
     
    11361160
    11371161            // Process the rest of the mail template
    1138             $emailContent = $this->AddEMailFields($mailTemplate, $dbRecord[0]);
     1162            $emailContent = $this->AddEventToTemplate($mailTemplate, $dbRecord[0]);
    11391163
    11401164            return 'OK';
    11411165        }
    11421166
    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)
    11511278            {
    11521279                $tag = '['.$key.']';
    1153                 $value = $this->FormatEMailField($tag, $key, $saleDetails);
     1280                $value = $this->RetrieveEventElement($tag, $key, $event);
    11541281                $EMailTemplate = BingMapsLibMigratePHPClass::Safe_str_replace($tag, $value, $EMailTemplate);
    11551282            }
  • bingmaps/trunk/include/bingmapslib_escaping.php

    r2940206 r2951287  
    8585        }
    8686
     87        static function Safe_EchoDownload($echoData)
     88        {
     89            // Not escaped as not output to browser ....
     90            echo $echoData;
     91        }
     92       
    8793    }
    8894       
  • bingmaps/trunk/include/bingmapslib_migrate.php

    r2940206 r2951287  
    136136        {
    137137            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);
    139143        }
    140144
  • bingmaps/trunk/include/bingmapslib_utils.php

    r2940206 r2951287  
    356356        }
    357357
    358         static function GetHTTPNumber($reqArray, $elementId = 'undef', $defaultValue = null)
     358        static function GetHTTPNumber($reqArray, $elementId = 'undef', $defaultValue = '')
    359359        {
    360360            // This function will return the sanitised numeric array element
     
    369369        }
    370370
     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       
    371382        static function GetHTTPFilenameElem($reqArray, $elementId, $defaultValue = '')
    372383        {
  • bingmaps/trunk/lang/bingmaps.pot

    r2940206 r2951287  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: MapView for Bing Maps 1.3.2\n"
     5"Project-Id-Version: MapView for Bing Maps 1.4\n"
    66"Report-Msgid-Bugs-To: http://wordpress.org/tag/bingmaps\n"
    7 "POT-Creation-Date: 2023-07-17 16:22:16+00:00\n"
     7"POT-Creation-Date: 2023-08-10 08:02:38+00:00\n"
    88"MIME-Version: 1.0\n"
    99"Content-Type: text/plain; charset=UTF-8\n"
     
    4848msgstr ""
    4949
    50 #: bingmaps.php:270
     50#: bingmaps.php:272
    5151msgid "BingMaps Shortcode must specify centre Coordinates"
    5252msgstr ""
    5353
    54 #: bingmaps.php:277
     54#: bingmaps.php:279
    5555msgid "BingMaps Shortcode must specify BOTH centre Coordinates"
    5656msgstr ""
    5757
    58 #: bingmaps.php:441
     58#: bingmaps.php:443
    5959msgid "Overview"
    6060msgstr ""
    6161
    62 #: bingmaps.php:442
     62#: bingmaps.php:444
    6363msgid "Settings"
    6464msgstr ""
     
    166166msgstr ""
    167167
    168 #: include\mjslib_dbase_api.php:552
     168#: include\mjslib_dbase_api.php:576
    169169msgid "Session Debug Modes"
    170170msgstr ""
    171171
    172 #: include\mjslib_dbase_api.php:570
     172#: include\mjslib_dbase_api.php:594
    173173msgid "SSL over HTTP"
    174174msgstr ""
    175175
    176 #: include\mjslib_dbase_api.php:1325
     176#: include\mjslib_dbase_api.php:1332
     177msgid "Missing Conditional end marker"
     178msgstr ""
     179
     180#: include\mjslib_dbase_api.php:1452
    177181msgid ""
    178182"WARNING: EMail Template contains one or mores lines with leading dots ('.')"
  • bingmaps/trunk/readme.txt

    r2940206 r2951287  
    33Tags: pages, paypal, maps, bing, mapping, ordnance survey, OS, routes, walking
    44Requires at least: 3.0
    5 Tested up to: 6.2.2
    6 Stable tag: 1.3.2
     5Tested up to: 6.3
     6Stable tag: 1.4
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.