Snazzy Maps - Version 1.0.3

Version Description

Release Date: April 8th, 2015

  • Bug Fix: Added some javascript to support more browsers and Google Maps plugins.
  • Bug Fix: Fixed up some PHP warning messages on the plugin pages.
Download this release

Release Info

Developer atmistinc
Plugin Icon 128x128 Snazzy Maps
Version 1.0.3
Comparing to
See all releases

Code changes from version 1.0.2 to 1.0.3

additional_php/Services_JSON.php CHANGED
@@ -380,7 +380,7 @@ class Services_JSON
380
  array_keys($var),
381
  array_values($var));
382
 
383
- foreach($properties as $property) {
384
  if(Services_JSON::isError($property)) {
385
  return $property;
386
  }
@@ -392,7 +392,7 @@ class Services_JSON
392
  // treat it like a regular array
393
  $elements = array_map(array($this, 'encode'), $var);
394
 
395
- foreach($elements as $element) {
396
  if(Services_JSON::isError($element)) {
397
  return $element;
398
  }
@@ -407,7 +407,7 @@ class Services_JSON
407
  array_keys($vars),
408
  array_values($vars));
409
 
410
- foreach($properties as $property) {
411
  if(Services_JSON::isError($property)) {
412
  return $property;
413
  }
380
  array_keys($var),
381
  array_values($var));
382
 
383
+ foreach((array)$properties as $property) {
384
  if(Services_JSON::isError($property)) {
385
  return $property;
386
  }
392
  // treat it like a regular array
393
  $elements = array_map(array($this, 'encode'), $var);
394
 
395
+ foreach((array)$elements as $element) {
396
  if(Services_JSON::isError($element)) {
397
  return $element;
398
  }
407
  array_keys($vars),
408
  array_values($vars));
409
 
410
+ foreach((array)$properties as $property) {
411
  if(Services_JSON::isError($property)) {
412
  return $property;
413
  }
admin/explore.php CHANGED
@@ -5,7 +5,7 @@ defined( 'ABSPATH' ) OR exit;
5
  define('PAGE_SIZE', 3);
6
 
7
  function render_options($options, $selected){
8
- foreach($options as $value => $text){
9
  ?>
10
  <option value="<?php echo $value;?>"
11
  <?php echo $value == $selected ? 'selected' : '' ?>>
5
  define('PAGE_SIZE', 3);
6
 
7
  function render_options($options, $selected){
8
+ foreach((array)$options as $value => $text){
9
  ?>
10
  <option value="<?php echo $value;?>"
11
  <?php echo $value == $selected ? 'selected' : '' ?>>
admin/index.php CHANGED
@@ -33,7 +33,8 @@ function admin_enqueue_script($hook){
33
 
34
  //Include the javascript
35
  $handle = 'admin-snazzymaps-js';
36
- wp_enqueue_script($handle, plugins_url('index.js', __FILE__), $deps = array('jquery'));
 
37
  wp_localize_script($handle, 'SnazzyData', array('API_KEY' => API_KEY,
38
  'API_BASE' => API_BASE,
39
  'USER_API_KEY' => get_option('MySnazzyAPIKey', null)));
@@ -42,9 +43,11 @@ function admin_enqueue_script($hook){
42
  'query-string' . _DS . 'query-string.js',
43
  'mustache' . _DS . 'mustache.min.js'
44
  );
45
- foreach($node_modules as $index => $node_module){
46
  wp_enqueue_script("admin-node-module-$index",
47
- resourceURL('node_modules' . _DS . $node_module));
 
 
48
  }
49
 
50
  //Include the bower components
@@ -53,21 +56,28 @@ function admin_enqueue_script($hook){
53
  _DS . 'bundled' . _DS . 'html5' .
54
  _DS . 'native.history.js'
55
  );
56
- foreach($bower_components as $index => $bower_component){
57
  wp_enqueue_script("admin-bower-component-$index",
58
- resourceURL('bower_components' . _DS . $bower_component));
 
 
59
  }
60
 
61
 
62
  //Include additional javascript
63
  $additional_js = array('jquery.base64.min.js');
64
- foreach($additional_js as $index => $js){
65
  wp_enqueue_script("additional-js-$index",
66
- resourceURL('additional_js' . _DS . $js));
 
 
67
  }
68
 
69
  //Include the css
70
- wp_enqueue_style('admin-snazzymaps-css', plugins_url('index.css', __FILE__));
 
 
 
71
  }
72
 
73
  function admin_add_custom_content(){
@@ -117,7 +127,7 @@ function admin_add_custom_content(){
117
  <h2 class="nav-tab-wrapper">
118
  <?php
119
  $tabs = array('Site Styles', 'Explore', 'Settings', 'Help');
120
- foreach($tabs as $index => $tab){
121
  ?>
122
  <a href="?page=snazzy_maps&tab=<?php echo $index;?>"
123
  class="nav-tab <?php echo $active_tab == $index ? 'nav-tab-active' : '';?>">
33
 
34
  //Include the javascript
35
  $handle = 'admin-snazzymaps-js';
36
+ wp_enqueue_script($handle, plugins_url('index.js', __FILE__), $deps = array('jquery'),
37
+ $ver = SNAZZY_VERSION_NUMBER);
38
  wp_localize_script($handle, 'SnazzyData', array('API_KEY' => API_KEY,
39
  'API_BASE' => API_BASE,
40
  'USER_API_KEY' => get_option('MySnazzyAPIKey', null)));
43
  'query-string' . _DS . 'query-string.js',
44
  'mustache' . _DS . 'mustache.min.js'
45
  );
46
+ foreach((array)$node_modules as $index => $node_module){
47
  wp_enqueue_script("admin-node-module-$index",
48
+ resourceURL('node_modules' . _DS . $node_module),
49
+ $deps = array(),
50
+ $ver = SNAZZY_VERSION_NUMBER);
51
  }
52
 
53
  //Include the bower components
56
  _DS . 'bundled' . _DS . 'html5' .
57
  _DS . 'native.history.js'
58
  );
59
+ foreach((array)$bower_components as $index => $bower_component){
60
  wp_enqueue_script("admin-bower-component-$index",
61
+ resourceURL('bower_components' . _DS . $bower_component),
62
+ $deps = array(),
63
+ $ver = SNAZZY_VERSION_NUMBER);
64
  }
65
 
66
 
67
  //Include additional javascript
68
  $additional_js = array('jquery.base64.min.js');
69
+ foreach((array)$additional_js as $index => $js){
70
  wp_enqueue_script("additional-js-$index",
71
+ resourceURL('additional_js' . _DS . $js),
72
+ $deps = array(),
73
+ $ver = SNAZZY_VERSION_NUMBER);
74
  }
75
 
76
  //Include the css
77
+ wp_enqueue_style('admin-snazzymaps-css',
78
+ plugins_url('index.css', __FILE__),
79
+ $deps = array(),
80
+ $ver = SNAZZY_VERSION_NUMBER);
81
  }
82
 
83
  function admin_add_custom_content(){
127
  <h2 class="nav-tab-wrapper">
128
  <?php
129
  $tabs = array('Site Styles', 'Explore', 'Settings', 'Help');
130
+ foreach((array)$tabs as $index => $tab){
131
  ?>
132
  <a href="?page=snazzy_maps&tab=<?php echo $index;?>"
133
  class="nav-tab <?php echo $active_tab == $index ? 'nav-tab-active' : '';?>">
admin/styles.php CHANGED
@@ -3,7 +3,7 @@ defined( 'ABSPATH' ) OR exit;
3
 
4
  //Removed closures for PHP 5.0.x support
5
  function _getStyleIndex(&$styles, $id){
6
- foreach($styles as $index => $style){
7
  if($style['id'] == $id){
8
  return $index;
9
  }
@@ -91,7 +91,7 @@ defined( 'ABSPATH' ) OR exit;
91
 
92
  <?php if (count($styles) > 0) { ?>
93
  <div class="results row">
94
- <?php foreach($styles as $index => $style){
95
  $isEnabled = !is_null($defaultStyle) && $defaultStyle['id'] == $style['id'];
96
  ?>
97
  <div class="style col-sm-6 col-md-4 <?php echo $isEnabled ? 'enabled' : '';?>">
3
 
4
  //Removed closures for PHP 5.0.x support
5
  function _getStyleIndex(&$styles, $id){
6
+ foreach((array)$styles as $index => $style){
7
  if($style['id'] == $id){
8
  return $index;
9
  }
91
 
92
  <?php if (count($styles) > 0) { ?>
93
  <div class="results row">
94
+ <?php foreach((array)$styles as $index => $style){
95
  $isEnabled = !is_null($defaultStyle) && $defaultStyle['id'] == $style['id'];
96
  ?>
97
  <div class="style col-sm-6 col-md-4 <?php echo $isEnabled ? 'enabled' : '';?>">
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://snazzymaps.com/about
4
  Tags: google,maps,google maps,styled maps,styles,color,schemes,themes
5
  Requires at least: 2.8
6
  Tested up to: 4.1.1
7
- Stable tag: 1.0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -45,20 +45,37 @@ already have on your site.*
45
  The Snazzy Maps plugin is free to use for personal and open source projects. Business licenses are available for
46
  single and multiple sites and can be purchased at https://snazzymaps.com/plugins
47
 
48
- = How do I add a Google Map? =
49
 
50
  This plugin does not add a Google Map to your page. It simply adds styles to your existing maps. If you haven't
51
- added a map yet, search [WordPress Plugins](https://wordpress.org/plugins) for a suitable Google Map plugin.
52
 
53
- = Snazzy Maps doesn't work with my Google Maps plugin! =
 
 
54
 
55
- We've tested Snazzy Maps with several different Google Maps plugins. If you happen to find one that our plugin doesn't
56
- work with please send us an email at support@snazzymaps.com.
 
 
 
 
 
 
57
 
58
- Also, the Snazzy Maps plugin cannot apply styles to maps created using the Google Maps Embed API. This is because of
 
 
59
  fundamental limitations on the way IFrames work on the web. We cannot access the map within Google's IFrame and cannot
60
  apply any styles to it. Sorry! Switching to a WordPress plugin that uses Google's JavaScript API will work instead.
61
 
 
 
 
 
 
 
 
62
  = How can I access my favorites or private styles from SnazzyMaps.com? =
63
 
64
  1. Sign up for an account at [SnazzyMaps.com](https://snazzymaps.com).
@@ -77,6 +94,12 @@ apply any styles to it. Sorry! Switching to a WordPress plugin that uses Google'
77
 
78
  == Changelog ==
79
 
 
 
 
 
 
 
80
  = 1.0.2 =
81
  Release Date: March 25th, 2015
82
 
4
  Tags: google,maps,google maps,styled maps,styles,color,schemes,themes
5
  Requires at least: 2.8
6
  Tested up to: 4.1.1
7
+ Stable tag: 1.0.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
45
  The Snazzy Maps plugin is free to use for personal and open source projects. Business licenses are available for
46
  single and multiple sites and can be purchased at https://snazzymaps.com/plugins
47
 
48
+ = How do I add a Google Map to my page? =
49
 
50
  This plugin does not add a Google Map to your page. It simply adds styles to your existing maps. If you haven't
51
+ added a map yet, search [WordPress Plugins](https://wordpress.org/plugins) for a suitable Google Maps plugin.
52
 
53
+ = What are some compatible Google Maps plugins? =
54
+
55
+ We've tested our plugin with the following Google Maps plugins. If you find another plugin that works please send us an email at support@snazzymaps.com.
56
 
57
+ - [WP Google Maps](https://wordpress.org/plugins/wp-google-maps/)
58
+ - [Comprehensive Google Map Plugin](https://wordpress.org/plugins/comprehensive-google-map-plugin/)
59
+ - [Leaflet Maps Marker](https://wordpress.org/plugins/leaflet-maps-marker/)
60
+ - [WP Google Map Plugin](https://wordpress.org/plugins/wp-google-map-plugin/)
61
+ - [WP Flexible Map](https://wordpress.org/plugins/wp-flexible-map/)
62
+ - [Basic Google Maps Placemarks](https://wordpress.org/plugins/basic-google-maps-placemarks/)
63
+ - [Pronamic Google Maps](https://wordpress.org/plugins/pronamic-google-maps/)
64
+ - [Robo Maps](https://wordpress.org/plugins/robo-maps/)
65
 
66
+ = Snazzy Maps doesn't work with my Google Maps plugin! =
67
+
68
+ The Snazzy Maps plugin cannot apply styles to maps created using the Google Maps Embed API. This is because of
69
  fundamental limitations on the way IFrames work on the web. We cannot access the map within Google's IFrame and cannot
70
  apply any styles to it. Sorry! Switching to a WordPress plugin that uses Google's JavaScript API will work instead.
71
 
72
+ The following plugins will not work with the Snazzy Maps WordPress plugin:
73
+
74
+ - [Geo Mashup](https://wordpress.org/plugins/geo-mashup/)
75
+ - [Embed Google Map](https://wordpress.org/plugins/embed-google-map/)
76
+
77
+ If you happen to find any other map plugins that don't work please send us an email at support@snazzymaps.com.
78
+
79
  = How can I access my favorites or private styles from SnazzyMaps.com? =
80
 
81
  1. Sign up for an account at [SnazzyMaps.com](https://snazzymaps.com).
94
 
95
  == Changelog ==
96
 
97
+ = 1.0.3 =
98
+ Release Date: April 8th, 2015
99
+
100
+ * Bug Fix: Added some javascript to support more browsers and Google Maps plugins.
101
+ * Bug Fix: Fixed up some PHP warning messages on the plugin pages.
102
+
103
  = 1.0.2 =
104
  Release Date: March 25th, 2015
105
 
snazzymaps.js CHANGED
@@ -1,15 +1 @@
1
- jQuery(document).ready(function($){
2
- try{
3
- var style = JSON.parse(SnazzyDataForSnazzyMaps['json']);
4
- (function(g, s) {
5
- var _map = g.Map;
6
- g.Map = function(map, options) {
7
- var that = Object.create(_map.prototype);
8
- options.styles = s;
9
- _map.apply(that, arguments);
10
- return that;
11
- };
12
- })(google.maps, style);
13
- }catch(error){/*Quietly die and leave the maps unstyled*/}
14
- });
15
-
1
+ !function(){"object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(e){return 10>e?"0"+e:e}function this_value(){return this.valueOf()}function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var r,n,o,a,i,u=gap,s=t[e];switch(s&&"object"==typeof s&&"function"==typeof s.toJSON&&(s=s.toJSON(e)),"function"==typeof rep&&(s=rep.call(t,e,s)),typeof s){case"string":return quote(s);case"number":return isFinite(s)?String(s):"null";case"boolean":case"null":return String(s);case"object":if(!s)return"null";if(gap+=indent,i=[],"[object Array]"===Object.prototype.toString.apply(s)){for(a=s.length,r=0;a>r;r+=1)i[r]=str(r,s)||"null";return o=0===i.length?"[]":gap?"[\n"+gap+i.join(",\n"+gap)+"\n"+u+"]":"["+i.join(",")+"]",gap=u,o}if(rep&&"object"==typeof rep)for(a=rep.length,r=0;a>r;r+=1)"string"==typeof rep[r]&&(n=rep[r],o=str(n,s),o&&i.push(quote(n)+(gap?": ":":")+o));else for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(o=str(n,s),o&&i.push(quote(n)+(gap?": ":":")+o));return o=0===i.length?"{}":gap?"{\n"+gap+i.join(",\n"+gap)+"\n"+u+"}":"{"+i.join(",")+"}",gap=u,o}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value);var cx,escapable,gap,indent,meta,rep;"function"!=typeof JSON.stringify&&(escapable=/[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(e,t,r){var n;if(gap="",indent="","number"==typeof r)for(n=0;r>n;n+=1)indent+=" ";else"string"==typeof r&&(indent=r);if(rep=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw new Error("JSON.stringify");return str("",{"":e})}),"function"!=typeof JSON.parse&&(cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,JSON.parse=function(text,reviver){function walk(e,t){var r,n,o=e[t];if(o&&"object"==typeof o)for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(n=walk(o,r),void 0!==n?o[r]=n:delete o[r]);return reviver.call(e,t,o)}var j;if(text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}();var _setRepeater=function(e,t){e();var r=setInterval(e,1);setTimeout(function(){clearInterval(r)},t)},indexOf=function(e){return indexOf="function"==typeof Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t=-1,r=-1;for(t=0;t<this.length;t++)if(this[t]===e){r=t;break}return r},indexOf.call(this,e)},_scripts=[],_scriptListeners=[],_notifyListeners=function(){for(var e=0;e<_scriptListeners.length;e++)_scriptListeners[e](this)},_registerScript=function(e){-1==indexOf.call(_scripts,e)&&(_scripts.push(e),e.addEventListener?e.addEventListener("load",_notifyListeners):e.readyState&&(e.onreadystatechange=_notifyListeners))};if("undefined"==typeof MutationObserver)_setRepeater(function(){for(var e=document.getElementsByTagName("script"),t=0;t<e.length;t++)_registerScript(e[t])},1e4);else{var observer=new MutationObserver(function(e){e.forEach(function(e){for(var t=0;t<e.addedNodes.length;t++)"SCRIPT"==e.addedNodes[t].tagName&&_registerScript(e.addedNodes[t])})});observer.observe(document,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),setTimeout(function(){observer.disconnect()},1e4)}var _tryWrapper=function(e){return function(){try{e()}catch(t){}}},_repeatAndForget=function(e){_tryWrapper(e)(),jQuery&&jQuery(document).ready(_tryWrapper(e)),_scriptListeners.push(_tryWrapper(e)),_setRepeater(_tryWrapper(e),3e3)};_tryWrapper(function(){var e=JSON.parse(SnazzyDataForSnazzyMaps.json),t=null,r=function(r,n){n||(n={styles:e});var o=new t(r,n);return _repeatAndForget(function(){o.styles!=e&&o.setOptions({styles:e})}),o};_repeatAndForget(function(){google&&google.maps&&google.maps.Map&&google.maps.Map!=r&&(t=google.maps.Map,google.maps.Map=r)})})()}();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
snazzymaps.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Snazzy Maps
4
  * Plugin URI: https://snazzymaps.com/plugins
5
  * Description: Apply styles to your Google Maps with the official Snazzy Maps WordPress plugin.
6
- * Version: 1.0.2
7
  * Author: Atmist
8
  * Author URI: http://atmist.com/
9
  * License: GPL2
@@ -30,6 +30,7 @@ defined( 'ABSPATH' ) OR exit;
30
  //This API key is used to explore the styles in snazzy maps
31
  define('API_BASE', 'https://snazzymaps.com/');
32
  define('API_KEY', 'ecaccc3c-44fa-486c-9503-5d473587a493');
 
33
 
34
  if(!defined('_DS')) {
35
  define('_DS', '/');
@@ -44,7 +45,7 @@ function _object_to_array($object)
44
  if (is_array($object) OR is_object($object))
45
  {
46
  $result = array();
47
- foreach($object as $key => $value)
48
  {
49
  $result[$key] = _object_to_array($value);
50
  }
@@ -68,7 +69,11 @@ function enqueue_script() {
68
  $uniqueStyle = get_option('SnazzyMapDefaultStyle');
69
  if(!empty($uniqueStyle) && !is_null($uniqueStyle)){
70
  $handle = 'snazzymaps-js';
71
- wp_enqueue_script($handle, plugins_url('snazzymaps.js', __FILE__), $deps = array('jquery'), $in_footer = true);
 
 
 
 
72
 
73
  //We have to use l10n_print_after so we can support older versions of WordPress
74
  $json = new Services_JSON();
3
  * Plugin Name: Snazzy Maps
4
  * Plugin URI: https://snazzymaps.com/plugins
5
  * Description: Apply styles to your Google Maps with the official Snazzy Maps WordPress plugin.
6
+ * Version: 1.0.3
7
  * Author: Atmist
8
  * Author URI: http://atmist.com/
9
  * License: GPL2
30
  //This API key is used to explore the styles in snazzy maps
31
  define('API_BASE', 'https://snazzymaps.com/');
32
  define('API_KEY', 'ecaccc3c-44fa-486c-9503-5d473587a493');
33
+ define('SNAZZY_VERSION_NUMBER', '1.0.3');
34
 
35
  if(!defined('_DS')) {
36
  define('_DS', '/');
45
  if (is_array($object) OR is_object($object))
46
  {
47
  $result = array();
48
+ foreach((array)$object as $key => $value)
49
  {
50
  $result[$key] = _object_to_array($value);
51
  }
69
  $uniqueStyle = get_option('SnazzyMapDefaultStyle');
70
  if(!empty($uniqueStyle) && !is_null($uniqueStyle)){
71
  $handle = 'snazzymaps-js';
72
+ wp_enqueue_script($handle,
73
+ plugins_url('snazzymaps.js', __FILE__),
74
+ $deps = array('jquery'),
75
+ $ver = SNAZZY_VERSION_NUMBER,
76
+ $in_footer = true);
77
 
78
  //We have to use l10n_print_after so we can support older versions of WordPress
79
  $json = new Services_JSON();