Skip to content

Commit

Permalink
Merge pull request bozdoz#206 from bozdoz/check-default-leaflet-version
Browse files Browse the repository at this point in the history
adds banner if default js url is out-of-sync
  • Loading branch information
hupe13 authored Feb 10, 2023
2 parents c5ab146 + a25d516 commit de81905
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions templates/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,23 @@ function verify_nonce () {
<?php
}
/** END FORM SUBMISSION */

/** CHECK LEAFLET VERSION */
$db_js_url = $settings->get('js_url');
$unpkg_url = "https://unpkg.com/leaflet";
$is_unpkg_url = substr_compare($db_js_url, $unpkg_url, 0, strlen($unpkg_url)) === 0;

if ($is_unpkg_url && $db_js_url !== $settings->options[ 'js_url' ]->default) {
?>
<div class="notice notice-info is-dismissible">
<p><?php
_e('Info: your leaflet version may be out-of-sync with the latest default version: ', 'leaflet-map');
echo Leaflet_Map::$leaflet_version;
?></p>
</div>
<?php
}
/** END LEAFLET VERSION */
?>

<p><?php echo $description; ?></p>
Expand Down

0 comments on commit de81905

Please sign in to comment.