Snazzy Maps - Version 1.0.2

Version Description

Release Date: March 25th, 2015

  • Bug Fix: Updated the plugin to work with older PHP and WordPress versions. We now support PHP 5.0.5 and later and WordPress 2.8 and later.
Download this release

Release Info

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

Code changes from version 1.0.1 to 1.0.2

additional_php/Services_JSON.php ADDED
@@ -0,0 +1,806 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
+
4
+ /**
5
+ * Converts to and from JSON format.
6
+ *
7
+ * JSON (JavaScript Object Notation) is a lightweight data-interchange
8
+ * format. It is easy for humans to read and write. It is easy for machines
9
+ * to parse and generate. It is based on a subset of the JavaScript
10
+ * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
11
+ * This feature can also be found in Python. JSON is a text format that is
12
+ * completely language independent but uses conventions that are familiar
13
+ * to programmers of the C-family of languages, including C, C++, C#, Java,
14
+ * JavaScript, Perl, TCL, and many others. These properties make JSON an
15
+ * ideal data-interchange language.
16
+ *
17
+ * This package provides a simple encoder and decoder for JSON notation. It
18
+ * is intended for use with client-side Javascript applications that make
19
+ * use of HTTPRequest to perform server communication functions - data can
20
+ * be encoded into JSON notation for use in a client-side javascript, or
21
+ * decoded from incoming Javascript requests. JSON format is native to
22
+ * Javascript, and can be directly eval()'ed with no further parsing
23
+ * overhead
24
+ *
25
+ * All strings should be in ASCII or UTF-8 format!
26
+ *
27
+ * LICENSE: Redistribution and use in source and binary forms, with or
28
+ * without modification, are permitted provided that the following
29
+ * conditions are met: Redistributions of source code must retain the
30
+ * above copyright notice, this list of conditions and the following
31
+ * disclaimer. Redistributions in binary form must reproduce the above
32
+ * copyright notice, this list of conditions and the following disclaimer
33
+ * in the documentation and/or other materials provided with the
34
+ * distribution.
35
+ *
36
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
37
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
38
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
39
+ * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
40
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
41
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
42
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
44
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
45
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
46
+ * DAMAGE.
47
+ *
48
+ * @category
49
+ * @package Services_JSON
50
+ * @author Michal Migurski <mike-json@teczno.com>
51
+ * @author Matt Knapp <mdknapp[at]gmail[dot]com>
52
+ * @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
53
+ * @copyright 2005 Michal Migurski
54
+ * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
55
+ * @license http://www.opensource.org/licenses/bsd-license.php
56
+ * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
57
+ */
58
+
59
+ /**
60
+ * Marker constant for Services_JSON::decode(), used to flag stack state
61
+ */
62
+ define('SERVICES_JSON_SLICE', 1);
63
+
64
+ /**
65
+ * Marker constant for Services_JSON::decode(), used to flag stack state
66
+ */
67
+ define('SERVICES_JSON_IN_STR', 2);
68
+
69
+ /**
70
+ * Marker constant for Services_JSON::decode(), used to flag stack state
71
+ */
72
+ define('SERVICES_JSON_IN_ARR', 3);
73
+
74
+ /**
75
+ * Marker constant for Services_JSON::decode(), used to flag stack state
76
+ */
77
+ define('SERVICES_JSON_IN_OBJ', 4);
78
+
79
+ /**
80
+ * Marker constant for Services_JSON::decode(), used to flag stack state
81
+ */
82
+ define('SERVICES_JSON_IN_CMT', 5);
83
+
84
+ /**
85
+ * Behavior switch for Services_JSON::decode()
86
+ */
87
+ define('SERVICES_JSON_LOOSE_TYPE', 16);
88
+
89
+ /**
90
+ * Behavior switch for Services_JSON::decode()
91
+ */
92
+ define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
93
+
94
+ /**
95
+ * Converts to and from JSON format.
96
+ *
97
+ * Brief example of use:
98
+ *
99
+ * <code>
100
+ * // create a new instance of Services_JSON
101
+ * $json = new Services_JSON();
102
+ *
103
+ * // convert a complexe value to JSON notation, and send it to the browser
104
+ * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
105
+ * $output = $json->encode($value);
106
+ *
107
+ * print($output);
108
+ * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
109
+ *
110
+ * // accept incoming POST data, assumed to be in JSON notation
111
+ * $input = file_get_contents('php://input', 1000000);
112
+ * $value = $json->decode($input);
113
+ * </code>
114
+ */
115
+ class Services_JSON
116
+ {
117
+ /**
118
+ * constructs a new JSON instance
119
+ *
120
+ * @param int $use object behavior flags; combine with boolean-OR
121
+ *
122
+ * possible values:
123
+ * - SERVICES_JSON_LOOSE_TYPE: loose typing.
124
+ * "{...}" syntax creates associative arrays
125
+ * instead of objects in decode().
126
+ * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
127
+ * Values which can't be encoded (e.g. resources)
128
+ * appear as NULL instead of throwing errors.
129
+ * By default, a deeply-nested resource will
130
+ * bubble up with an error, so all return values
131
+ * from encode() should be checked with isError()
132
+ */
133
+ function Services_JSON($use = 0)
134
+ {
135
+ $this->use = $use;
136
+ }
137
+
138
+ /**
139
+ * convert a string from one UTF-16 char to one UTF-8 char
140
+ *
141
+ * Normally should be handled by mb_convert_encoding, but
142
+ * provides a slower PHP-only method for installations
143
+ * that lack the multibye string extension.
144
+ *
145
+ * @param string $utf16 UTF-16 character
146
+ * @return string UTF-8 character
147
+ * @access private
148
+ */
149
+ function utf162utf8($utf16)
150
+ {
151
+ // oh please oh please oh please oh please oh please
152
+ if(function_exists('mb_convert_encoding')) {
153
+ return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
154
+ }
155
+
156
+ $bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
157
+
158
+ switch(true) {
159
+ case ((0x7F & $bytes) == $bytes):
160
+ // this case should never be reached, because we are in ASCII range
161
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
162
+ return chr(0x7F & $bytes);
163
+
164
+ case (0x07FF & $bytes) == $bytes:
165
+ // return a 2-byte UTF-8 character
166
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
167
+ return chr(0xC0 | (($bytes >> 6) & 0x1F))
168
+ . chr(0x80 | ($bytes & 0x3F));
169
+
170
+ case (0xFFFF & $bytes) == $bytes:
171
+ // return a 3-byte UTF-8 character
172
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
173
+ return chr(0xE0 | (($bytes >> 12) & 0x0F))
174
+ . chr(0x80 | (($bytes >> 6) & 0x3F))
175
+ . chr(0x80 | ($bytes & 0x3F));
176
+ }
177
+
178
+ // ignoring UTF-32 for now, sorry
179
+ return '';
180
+ }
181
+
182
+ /**
183
+ * convert a string from one UTF-8 char to one UTF-16 char
184
+ *
185
+ * Normally should be handled by mb_convert_encoding, but
186
+ * provides a slower PHP-only method for installations
187
+ * that lack the multibye string extension.
188
+ *
189
+ * @param string $utf8 UTF-8 character
190
+ * @return string UTF-16 character
191
+ * @access private
192
+ */
193
+ function utf82utf16($utf8)
194
+ {
195
+ // oh please oh please oh please oh please oh please
196
+ if(function_exists('mb_convert_encoding')) {
197
+ return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
198
+ }
199
+
200
+ switch(strlen($utf8)) {
201
+ case 1:
202
+ // this case should never be reached, because we are in ASCII range
203
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
204
+ return $utf8;
205
+
206
+ case 2:
207
+ // return a UTF-16 character from a 2-byte UTF-8 char
208
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
209
+ return chr(0x07 & (ord($utf8{0}) >> 2))
210
+ . chr((0xC0 & (ord($utf8{0}) << 6))
211
+ | (0x3F & ord($utf8{1})));
212
+
213
+ case 3:
214
+ // return a UTF-16 character from a 3-byte UTF-8 char
215
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
216
+ return chr((0xF0 & (ord($utf8{0}) << 4))
217
+ | (0x0F & (ord($utf8{1}) >> 2)))
218
+ . chr((0xC0 & (ord($utf8{1}) << 6))
219
+ | (0x7F & ord($utf8{2})));
220
+ }
221
+
222
+ // ignoring UTF-32 for now, sorry
223
+ return '';
224
+ }
225
+
226
+ /**
227
+ * encodes an arbitrary variable into JSON format
228
+ *
229
+ * @param mixed $var any number, boolean, string, array, or object to be encoded.
230
+ * see argument 1 to Services_JSON() above for array-parsing behavior.
231
+ * if var is a strng, note that encode() always expects it
232
+ * to be in ASCII or UTF-8 format!
233
+ *
234
+ * @return mixed JSON string representation of input var or an error if a problem occurs
235
+ * @access public
236
+ */
237
+ function encode($var)
238
+ {
239
+ switch (gettype($var)) {
240
+ case 'boolean':
241
+ return $var ? 'true' : 'false';
242
+
243
+ case 'NULL':
244
+ return 'null';
245
+
246
+ case 'integer':
247
+ return (int) $var;
248
+
249
+ case 'double':
250
+ case 'float':
251
+ return (float) $var;
252
+
253
+ case 'string':
254
+ // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
255
+ $ascii = '';
256
+ $strlen_var = strlen($var);
257
+
258
+ /*
259
+ * Iterate over every character in the string,
260
+ * escaping with a slash or encoding to UTF-8 where necessary
261
+ */
262
+ for ($c = 0; $c < $strlen_var; ++$c) {
263
+
264
+ $ord_var_c = ord($var{$c});
265
+
266
+ switch (true) {
267
+ case $ord_var_c == 0x08:
268
+ $ascii .= '\b';
269
+ break;
270
+ case $ord_var_c == 0x09:
271
+ $ascii .= '\t';
272
+ break;
273
+ case $ord_var_c == 0x0A:
274
+ $ascii .= '\n';
275
+ break;
276
+ case $ord_var_c == 0x0C:
277
+ $ascii .= '\f';
278
+ break;
279
+ case $ord_var_c == 0x0D:
280
+ $ascii .= '\r';
281
+ break;
282
+
283
+ case $ord_var_c == 0x22:
284
+ case $ord_var_c == 0x2F:
285
+ case $ord_var_c == 0x5C:
286
+ // double quote, slash, slosh
287
+ $ascii .= '\\'.$var{$c};
288
+ break;
289
+
290
+ case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
291
+ // characters U-00000000 - U-0000007F (same as ASCII)
292
+ $ascii .= $var{$c};
293
+ break;
294
+
295
+ case (($ord_var_c & 0xE0) == 0xC0):
296
+ // characters U-00000080 - U-000007FF, mask 110XXXXX
297
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
298
+ $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
299
+ $c += 1;
300
+ $utf16 = $this->utf82utf16($char);
301
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
302
+ break;
303
+
304
+ case (($ord_var_c & 0xF0) == 0xE0):
305
+ // characters U-00000800 - U-0000FFFF, mask 1110XXXX
306
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
307
+ $char = pack('C*', $ord_var_c,
308
+ ord($var{$c + 1}),
309
+ ord($var{$c + 2}));
310
+ $c += 2;
311
+ $utf16 = $this->utf82utf16($char);
312
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
313
+ break;
314
+
315
+ case (($ord_var_c & 0xF8) == 0xF0):
316
+ // characters U-00010000 - U-001FFFFF, mask 11110XXX
317
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
318
+ $char = pack('C*', $ord_var_c,
319
+ ord($var{$c + 1}),
320
+ ord($var{$c + 2}),
321
+ ord($var{$c + 3}));
322
+ $c += 3;
323
+ $utf16 = $this->utf82utf16($char);
324
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
325
+ break;
326
+
327
+ case (($ord_var_c & 0xFC) == 0xF8):
328
+ // characters U-00200000 - U-03FFFFFF, mask 111110XX
329
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
330
+ $char = pack('C*', $ord_var_c,
331
+ ord($var{$c + 1}),
332
+ ord($var{$c + 2}),
333
+ ord($var{$c + 3}),
334
+ ord($var{$c + 4}));
335
+ $c += 4;
336
+ $utf16 = $this->utf82utf16($char);
337
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
338
+ break;
339
+
340
+ case (($ord_var_c & 0xFE) == 0xFC):
341
+ // characters U-04000000 - U-7FFFFFFF, mask 1111110X
342
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
343
+ $char = pack('C*', $ord_var_c,
344
+ ord($var{$c + 1}),
345
+ ord($var{$c + 2}),
346
+ ord($var{$c + 3}),
347
+ ord($var{$c + 4}),
348
+ ord($var{$c + 5}));
349
+ $c += 5;
350
+ $utf16 = $this->utf82utf16($char);
351
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
352
+ break;
353
+ }
354
+ }
355
+
356
+ return '"'.$ascii.'"';
357
+
358
+ case 'array':
359
+ /*
360
+ * As per JSON spec if any array key is not an integer
361
+ * we must treat the the whole array as an object. We
362
+ * also try to catch a sparsely populated associative
363
+ * array with numeric keys here because some JS engines
364
+ * will create an array with empty indexes up to
365
+ * max_index which can cause memory issues and because
366
+ * the keys, which may be relevant, will be remapped
367
+ * otherwise.
368
+ *
369
+ * As per the ECMA and JSON specification an object may
370
+ * have any string as a property. Unfortunately due to
371
+ * a hole in the ECMA specification if the key is a
372
+ * ECMA reserved word or starts with a digit the
373
+ * parameter is only accessible using ECMAScript's
374
+ * bracket notation.
375
+ */
376
+
377
+ // treat as a JSON object
378
+ if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
379
+ $properties = array_map(array($this, 'name_value'),
380
+ array_keys($var),
381
+ array_values($var));
382
+
383
+ foreach($properties as $property) {
384
+ if(Services_JSON::isError($property)) {
385
+ return $property;
386
+ }
387
+ }
388
+
389
+ return '{' . join(',', $properties) . '}';
390
+ }
391
+
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
+ }
399
+ }
400
+
401
+ return '[' . join(',', $elements) . ']';
402
+
403
+ case 'object':
404
+ $vars = get_object_vars($var);
405
+
406
+ $properties = array_map(array($this, 'name_value'),
407
+ array_keys($vars),
408
+ array_values($vars));
409
+
410
+ foreach($properties as $property) {
411
+ if(Services_JSON::isError($property)) {
412
+ return $property;
413
+ }
414
+ }
415
+
416
+ return '{' . join(',', $properties) . '}';
417
+
418
+ default:
419
+ return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
420
+ ? 'null'
421
+ : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
422
+ }
423
+ }
424
+
425
+ /**
426
+ * array-walking function for use in generating JSON-formatted name-value pairs
427
+ *
428
+ * @param string $name name of key to use
429
+ * @param mixed $value reference to an array element to be encoded
430
+ *
431
+ * @return string JSON-formatted name-value pair, like '"name":value'
432
+ * @access private
433
+ */
434
+ function name_value($name, $value)
435
+ {
436
+ $encoded_value = $this->encode($value);
437
+
438
+ if(Services_JSON::isError($encoded_value)) {
439
+ return $encoded_value;
440
+ }
441
+
442
+ return $this->encode(strval($name)) . ':' . $encoded_value;
443
+ }
444
+
445
+ /**
446
+ * reduce a string by removing leading and trailing comments and whitespace
447
+ *
448
+ * @param $str string string value to strip of comments and whitespace
449
+ *
450
+ * @return string string value stripped of comments and whitespace
451
+ * @access private
452
+ */
453
+ function reduce_string($str)
454
+ {
455
+ $str = preg_replace(array(
456
+
457
+ // eliminate single line comments in '// ...' form
458
+ '#^\s*//(.+)$#m',
459
+
460
+ // eliminate multi-line comments in '/* ... */' form, at start of string
461
+ '#^\s*/\*(.+)\*/#Us',
462
+
463
+ // eliminate multi-line comments in '/* ... */' form, at end of string
464
+ '#/\*(.+)\*/\s*$#Us'
465
+
466
+ ), '', $str);
467
+
468
+ // eliminate extraneous space
469
+ return trim($str);
470
+ }
471
+
472
+ /**
473
+ * decodes a JSON string into appropriate variable
474
+ *
475
+ * @param string $str JSON-formatted string
476
+ *
477
+ * @return mixed number, boolean, string, array, or object
478
+ * corresponding to given JSON input string.
479
+ * See argument 1 to Services_JSON() above for object-output behavior.
480
+ * Note that decode() always returns strings
481
+ * in ASCII or UTF-8 format!
482
+ * @access public
483
+ */
484
+ function decode($str)
485
+ {
486
+ $str = $this->reduce_string($str);
487
+
488
+ switch (strtolower($str)) {
489
+ case 'true':
490
+ return true;
491
+
492
+ case 'false':
493
+ return false;
494
+
495
+ case 'null':
496
+ return null;
497
+
498
+ default:
499
+ $m = array();
500
+
501
+ if (is_numeric($str)) {
502
+ // Lookie-loo, it's a number
503
+
504
+ // This would work on its own, but I'm trying to be
505
+ // good about returning integers where appropriate:
506
+ // return (float)$str;
507
+
508
+ // Return float or int, as appropriate
509
+ return ((float)$str == (integer)$str)
510
+ ? (integer)$str
511
+ : (float)$str;
512
+
513
+ } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
514
+ // STRINGS RETURNED IN UTF-8 FORMAT
515
+ $delim = substr($str, 0, 1);
516
+ $chrs = substr($str, 1, -1);
517
+ $utf8 = '';
518
+ $strlen_chrs = strlen($chrs);
519
+
520
+ for ($c = 0; $c < $strlen_chrs; ++$c) {
521
+
522
+ $substr_chrs_c_2 = substr($chrs, $c, 2);
523
+ $ord_chrs_c = ord($chrs{$c});
524
+
525
+ switch (true) {
526
+ case $substr_chrs_c_2 == '\b':
527
+ $utf8 .= chr(0x08);
528
+ ++$c;
529
+ break;
530
+ case $substr_chrs_c_2 == '\t':
531
+ $utf8 .= chr(0x09);
532
+ ++$c;
533
+ break;
534
+ case $substr_chrs_c_2 == '\n':
535
+ $utf8 .= chr(0x0A);
536
+ ++$c;
537
+ break;
538
+ case $substr_chrs_c_2 == '\f':
539
+ $utf8 .= chr(0x0C);
540
+ ++$c;
541
+ break;
542
+ case $substr_chrs_c_2 == '\r':
543
+ $utf8 .= chr(0x0D);
544
+ ++$c;
545
+ break;
546
+
547
+ case $substr_chrs_c_2 == '\\"':
548
+ case $substr_chrs_c_2 == '\\\'':
549
+ case $substr_chrs_c_2 == '\\\\':
550
+ case $substr_chrs_c_2 == '\\/':
551
+ if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
552
+ ($delim == "'" && $substr_chrs_c_2 != '\\"')) {
553
+ $utf8 .= $chrs{++$c};
554
+ }
555
+ break;
556
+
557
+ case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
558
+ // single, escaped unicode character
559
+ $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
560
+ . chr(hexdec(substr($chrs, ($c + 4), 2)));
561
+ $utf8 .= $this->utf162utf8($utf16);
562
+ $c += 5;
563
+ break;
564
+
565
+ case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
566
+ $utf8 .= $chrs{$c};
567
+ break;
568
+
569
+ case ($ord_chrs_c & 0xE0) == 0xC0:
570
+ // characters U-00000080 - U-000007FF, mask 110XXXXX
571
+ //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
572
+ $utf8 .= substr($chrs, $c, 2);
573
+ ++$c;
574
+ break;
575
+
576
+ case ($ord_chrs_c & 0xF0) == 0xE0:
577
+ // characters U-00000800 - U-0000FFFF, mask 1110XXXX
578
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
579
+ $utf8 .= substr($chrs, $c, 3);
580
+ $c += 2;
581
+ break;
582
+
583
+ case ($ord_chrs_c & 0xF8) == 0xF0:
584
+ // characters U-00010000 - U-001FFFFF, mask 11110XXX
585
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
586
+ $utf8 .= substr($chrs, $c, 4);
587
+ $c += 3;
588
+ break;
589
+
590
+ case ($ord_chrs_c & 0xFC) == 0xF8:
591
+ // characters U-00200000 - U-03FFFFFF, mask 111110XX
592
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
593
+ $utf8 .= substr($chrs, $c, 5);
594
+ $c += 4;
595
+ break;
596
+
597
+ case ($ord_chrs_c & 0xFE) == 0xFC:
598
+ // characters U-04000000 - U-7FFFFFFF, mask 1111110X
599
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
600
+ $utf8 .= substr($chrs, $c, 6);
601
+ $c += 5;
602
+ break;
603
+
604
+ }
605
+
606
+ }
607
+
608
+ return $utf8;
609
+
610
+ } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
611
+ // array, or object notation
612
+
613
+ if ($str{0} == '[') {
614
+ $stk = array(SERVICES_JSON_IN_ARR);
615
+ $arr = array();
616
+ } else {
617
+ if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
618
+ $stk = array(SERVICES_JSON_IN_OBJ);
619
+ $obj = array();
620
+ } else {
621
+ $stk = array(SERVICES_JSON_IN_OBJ);
622
+ $obj = new stdClass();
623
+ }
624
+ }
625
+
626
+ array_push($stk, array('what' => SERVICES_JSON_SLICE,
627
+ 'where' => 0,
628
+ 'delim' => false));
629
+
630
+ $chrs = substr($str, 1, -1);
631
+ $chrs = $this->reduce_string($chrs);
632
+
633
+ if ($chrs == '') {
634
+ if (reset($stk) == SERVICES_JSON_IN_ARR) {
635
+ return $arr;
636
+
637
+ } else {
638
+ return $obj;
639
+
640
+ }
641
+ }
642
+
643
+ //print("\nparsing {$chrs}\n");
644
+
645
+ $strlen_chrs = strlen($chrs);
646
+
647
+ for ($c = 0; $c <= $strlen_chrs; ++$c) {
648
+
649
+ $top = end($stk);
650
+ $substr_chrs_c_2 = substr($chrs, $c, 2);
651
+
652
+ if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
653
+ // found a comma that is not inside a string, array, etc.,
654
+ // OR we've reached the end of the character list
655
+ $slice = substr($chrs, $top['where'], ($c - $top['where']));
656
+ array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
657
+ //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
658
+
659
+ if (reset($stk) == SERVICES_JSON_IN_ARR) {
660
+ // we are in an array, so just push an element onto the stack
661
+ array_push($arr, $this->decode($slice));
662
+
663
+ } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
664
+ // we are in an object, so figure
665
+ // out the property name and set an
666
+ // element in an associative array,
667
+ // for now
668
+ $parts = array();
669
+
670
+ if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
671
+ // "name":value pair
672
+ $key = $this->decode($parts[1]);
673
+ $val = $this->decode($parts[2]);
674
+
675
+ if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
676
+ $obj[$key] = $val;
677
+ } else {
678
+ $obj->$key = $val;
679
+ }
680
+ } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
681
+ // name:value pair, where name is unquoted
682
+ $key = $parts[1];
683
+ $val = $this->decode($parts[2]);
684
+
685
+ if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
686
+ $obj[$key] = $val;
687
+ } else {
688
+ $obj->$key = $val;
689
+ }
690
+ }
691
+
692
+ }
693
+
694
+ } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
695
+ // found a quote, and we are not inside a string
696
+ array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
697
+ //print("Found start of string at {$c}\n");
698
+
699
+ } elseif (($chrs{$c} == $top['delim']) &&
700
+ ($top['what'] == SERVICES_JSON_IN_STR) &&
701
+ ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
702
+ // found a quote, we're in a string, and it's not escaped
703
+ // we know that it's not escaped becase there is _not_ an
704
+ // odd number of backslashes at the end of the string so far
705
+ array_pop($stk);
706
+ //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
707
+
708
+ } elseif (($chrs{$c} == '[') &&
709
+ in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
710
+ // found a left-bracket, and we are in an array, object, or slice
711
+ array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
712
+ //print("Found start of array at {$c}\n");
713
+
714
+ } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
715
+ // found a right-bracket, and we're in an array
716
+ array_pop($stk);
717
+ //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
718
+
719
+ } elseif (($chrs{$c} == '{') &&
720
+ in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
721
+ // found a left-brace, and we are in an array, object, or slice
722
+ array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
723
+ //print("Found start of object at {$c}\n");
724
+
725
+ } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
726
+ // found a right-brace, and we're in an object
727
+ array_pop($stk);
728
+ //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
729
+
730
+ } elseif (($substr_chrs_c_2 == '/*') &&
731
+ in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
732
+ // found a comment start, and we are in an array, object, or slice
733
+ array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
734
+ $c++;
735
+ //print("Found start of comment at {$c}\n");
736
+
737
+ } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
738
+ // found a comment end, and we're in one now
739
+ array_pop($stk);
740
+ $c++;
741
+
742
+ for ($i = $top['where']; $i <= $c; ++$i)
743
+ $chrs = substr_replace($chrs, ' ', $i, 1);
744
+
745
+ //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
746
+
747
+ }
748
+
749
+ }
750
+
751
+ if (reset($stk) == SERVICES_JSON_IN_ARR) {
752
+ return $arr;
753
+
754
+ } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
755
+ return $obj;
756
+
757
+ }
758
+
759
+ }
760
+ }
761
+ }
762
+
763
+ /**
764
+ * @todo Ultimately, this should just call PEAR::isError()
765
+ */
766
+ function isError($data, $code = null)
767
+ {
768
+ if (class_exists('pear')) {
769
+ return PEAR::isError($data, $code);
770
+ } elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
771
+ is_subclass_of($data, 'services_json_error'))) {
772
+ return true;
773
+ }
774
+
775
+ return false;
776
+ }
777
+ }
778
+
779
+ if (class_exists('PEAR_Error')) {
780
+
781
+ class Services_JSON_Error extends PEAR_Error
782
+ {
783
+ function Services_JSON_Error($message = 'unknown error', $code = null,
784
+ $mode = null, $options = null, $userinfo = null)
785
+ {
786
+ parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
787
+ }
788
+ }
789
+
790
+ } else {
791
+
792
+ /**
793
+ * @todo Ultimately, this class shall be descended from PEAR_Error
794
+ */
795
+ class Services_JSON_Error
796
+ {
797
+ function Services_JSON_Error($message = 'unknown error', $code = null,
798
+ $mode = null, $options = null, $userinfo = null)
799
+ {
800
+
801
+ }
802
+ }
803
+
804
+ }
805
+
806
+ ?>
admin/index.css CHANGED
@@ -1 +1 @@
1
- .container{margin-right:auto;margin-left:auto;padding-left:10px;padding-right:10px}.container:before,.container:after{content:" ";display:table}.container:after{clear:both}@media (min-width: 768px){.container{width:750px;}}@media (min-width: 992px){.container{width:970px;}}@media (min-width: 1200px){.container{width:1170px;}}.container-fluid{margin-right:auto;margin-left:auto;padding-left:10px;padding-right:10px}.container-fluid:before,.container-fluid:after{content:" ";display:table}.container-fluid:after{clear:both}.row{margin-left:-10px;margin-right:-10px}.row:before,.row:after{content:" ";display:table}.row:after{clear:both}.col-xs-1,.col-sm-1,.col-md-1,.col-lg-1,.col-xs-2,.col-sm-2,.col-md-2,.col-lg-2,.col-xs-3,.col-sm-3,.col-md-3,.col-lg-3,.col-xs-4,.col-sm-4,.col-md-4,.col-lg-4,.col-xs-5,.col-sm-5,.col-md-5,.col-lg-5,.col-xs-6,.col-sm-6,.col-md-6,.col-lg-6,.col-xs-7,.col-sm-7,.col-md-7,.col-lg-7,.col-xs-8,.col-sm-8,.col-md-8,.col-lg-8,.col-xs-9,.col-sm-9,.col-md-9,.col-lg-9,.col-xs-10,.col-sm-10,.col-md-10,.col-lg-10,.col-xs-11,.col-sm-11,.col-md-11,.col-lg-11,.col-xs-12,.col-sm-12,.col-md-12,.col-lg-12{position:relative;min-height:1px;padding-left:10px;padding-right:10px}.col-xs-1,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-10,.col-xs-11,.col-xs-12{float:left}.col-xs-1{width:8.333333333%}.col-xs-2{width:16.666666667%}.col-xs-3{width:25%}.col-xs-4{width:33.333333333%}.col-xs-5{width:41.666666667%}.col-xs-6{width:50%}.col-xs-7{width:58.333333333%}.col-xs-8{width:66.666666667%}.col-xs-9{width:75%}.col-xs-10{width:83.333333333%}.col-xs-11{width:91.666666667%}.col-xs-12{width:100%}.col-xs-pull-0{right:auto}.col-xs-pull-1{right:8.333333333%}.col-xs-pull-2{right:16.666666667%}.col-xs-pull-3{right:25%}.col-xs-pull-4{right:33.333333333%}.col-xs-pull-5{right:41.666666667%}.col-xs-pull-6{right:50%}.col-xs-pull-7{right:58.333333333%}.col-xs-pull-8{right:66.666666667%}.col-xs-pull-9{right:75%}.col-xs-pull-10{right:83.333333333%}.col-xs-pull-11{right:91.666666667%}.col-xs-pull-12{right:100%}.col-xs-push-0{left:auto}.col-xs-push-1{left:8.333333333%}.col-xs-push-2{left:16.666666667%}.col-xs-push-3{left:25%}.col-xs-push-4{left:33.333333333%}.col-xs-push-5{left:41.666666667%}.col-xs-push-6{left:50%}.col-xs-push-7{left:58.333333333%}.col-xs-push-8{left:66.666666667%}.col-xs-push-9{left:75%}.col-xs-push-10{left:83.333333333%}.col-xs-push-11{left:91.666666667%}.col-xs-push-12{left:100%}.col-xs-offset-0{margin-left:0%}.col-xs-offset-1{margin-left:8.333333333%}.col-xs-offset-2{margin-left:16.666666667%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-4{margin-left:33.333333333%}.col-xs-offset-5{margin-left:41.666666667%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-7{margin-left:58.333333333%}.col-xs-offset-8{margin-left:66.666666667%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-10{margin-left:83.333333333%}.col-xs-offset-11{margin-left:91.666666667%}.col-xs-offset-12{margin-left:100%}@media (min-width: 768px){.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-10,.col-sm-11,.col-sm-12{float:left}.col-sm-1{width:8.333333333%}.col-sm-2{width:16.666666667%}.col-sm-3{width:25%}.col-sm-4{width:33.333333333%}.col-sm-5{width:41.666666667%}.col-sm-6{width:50%}.col-sm-7{width:58.333333333%}.col-sm-8{width:66.666666667%}.col-sm-9{width:75%}.col-sm-10{width:83.333333333%}.col-sm-11{width:91.666666667%}.col-sm-12{width:100%}.col-sm-pull-0{right:auto}.col-sm-pull-1{right:8.333333333%}.col-sm-pull-2{right:16.666666667%}.col-sm-pull-3{right:25%}.col-sm-pull-4{right:33.333333333%}.col-sm-pull-5{right:41.666666667%}.col-sm-pull-6{right:50%}.col-sm-pull-7{right:58.333333333%}.col-sm-pull-8{right:66.666666667%}.col-sm-pull-9{right:75%}.col-sm-pull-10{right:83.333333333%}.col-sm-pull-11{right:91.666666667%}.col-sm-pull-12{right:100%}.col-sm-push-0{left:auto}.col-sm-push-1{left:8.333333333%}.col-sm-push-2{left:16.666666667%}.col-sm-push-3{left:25%}.col-sm-push-4{left:33.333333333%}.col-sm-push-5{left:41.666666667%}.col-sm-push-6{left:50%}.col-sm-push-7{left:58.333333333%}.col-sm-push-8{left:66.666666667%}.col-sm-push-9{left:75%}.col-sm-push-10{left:83.333333333%}.col-sm-push-11{left:91.666666667%}.col-sm-push-12{left:100%}.col-sm-offset-0{margin-left:0%}.col-sm-offset-1{margin-left:8.333333333%}.col-sm-offset-2{margin-left:16.666666667%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-4{margin-left:33.333333333%}.col-sm-offset-5{margin-left:41.666666667%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-7{margin-left:58.333333333%}.col-sm-offset-8{margin-left:66.666666667%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-10{margin-left:83.333333333%}.col-sm-offset-11{margin-left:91.666666667%}.col-sm-offset-12{margin-left:100%}}@media (min-width: 992px){.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12{float:left}.col-md-1{width:8.333333333%}.col-md-2{width:16.666666667%}.col-md-3{width:25%}.col-md-4{width:33.333333333%}.col-md-5{width:41.666666667%}.col-md-6{width:50%}.col-md-7{width:58.333333333%}.col-md-8{width:66.666666667%}.col-md-9{width:75%}.col-md-10{width:83.333333333%}.col-md-11{width:91.666666667%}.col-md-12{width:100%}.col-md-pull-0{right:auto}.col-md-pull-1{right:8.333333333%}.col-md-pull-2{right:16.666666667%}.col-md-pull-3{right:25%}.col-md-pull-4{right:33.333333333%}.col-md-pull-5{right:41.666666667%}.col-md-pull-6{right:50%}.col-md-pull-7{right:58.333333333%}.col-md-pull-8{right:66.666666667%}.col-md-pull-9{right:75%}.col-md-pull-10{right:83.333333333%}.col-md-pull-11{right:91.666666667%}.col-md-pull-12{right:100%}.col-md-push-0{left:auto}.col-md-push-1{left:8.333333333%}.col-md-push-2{left:16.666666667%}.col-md-push-3{left:25%}.col-md-push-4{left:33.333333333%}.col-md-push-5{left:41.666666667%}.col-md-push-6{left:50%}.col-md-push-7{left:58.333333333%}.col-md-push-8{left:66.666666667%}.col-md-push-9{left:75%}.col-md-push-10{left:83.333333333%}.col-md-push-11{left:91.666666667%}.col-md-push-12{left:100%}.col-md-offset-0{margin-left:0%}.col-md-offset-1{margin-left:8.333333333%}.col-md-offset-2{margin-left:16.666666667%}.col-md-offset-3{margin-left:25%}.col-md-offset-4{margin-left:33.333333333%}.col-md-offset-5{margin-left:41.666666667%}.col-md-offset-6{margin-left:50%}.col-md-offset-7{margin-left:58.333333333%}.col-md-offset-8{margin-left:66.666666667%}.col-md-offset-9{margin-left:75%}.col-md-offset-10{margin-left:83.333333333%}.col-md-offset-11{margin-left:91.666666667%}.col-md-offset-12{margin-left:100%}}@media (min-width: 1200px){.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11,.col-lg-12{float:left}.col-lg-1{width:8.333333333%}.col-lg-2{width:16.666666667%}.col-lg-3{width:25%}.col-lg-4{width:33.333333333%}.col-lg-5{width:41.666666667%}.col-lg-6{width:50%}.col-lg-7{width:58.333333333%}.col-lg-8{width:66.666666667%}.col-lg-9{width:75%}.col-lg-10{width:83.333333333%}.col-lg-11{width:91.666666667%}.col-lg-12{width:100%}.col-lg-pull-0{right:auto}.col-lg-pull-1{right:8.333333333%}.col-lg-pull-2{right:16.666666667%}.col-lg-pull-3{right:25%}.col-lg-pull-4{right:33.333333333%}.col-lg-pull-5{right:41.666666667%}.col-lg-pull-6{right:50%}.col-lg-pull-7{right:58.333333333%}.col-lg-pull-8{right:66.666666667%}.col-lg-pull-9{right:75%}.col-lg-pull-10{right:83.333333333%}.col-lg-pull-11{right:91.666666667%}.col-lg-pull-12{right:100%}.col-lg-push-0{left:auto}.col-lg-push-1{left:8.333333333%}.col-lg-push-2{left:16.666666667%}.col-lg-push-3{left:25%}.col-lg-push-4{left:33.333333333%}.col-lg-push-5{left:41.666666667%}.col-lg-push-6{left:50%}.col-lg-push-7{left:58.333333333%}.col-lg-push-8{left:66.666666667%}.col-lg-push-9{left:75%}.col-lg-push-10{left:83.333333333%}.col-lg-push-11{left:91.666666667%}.col-lg-push-12{left:100%}.col-lg-offset-0{margin-left:0%}.col-lg-offset-1{margin-left:8.333333333%}.col-lg-offset-2{margin-left:16.666666667%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-4{margin-left:33.333333333%}.col-lg-offset-5{margin-left:41.666666667%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-7{margin-left:58.333333333%}.col-lg-offset-8{margin-left:66.666666667%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-10{margin-left:83.333333333%}.col-lg-offset-11{margin-left:91.666666667%}.col-lg-offset-12{margin-left:100%}}.sm-plugin .box-shadow-cell,.sm-plugin h2.nav-tab-wrapper,.sm-plugin h3.nav-tab-wrapper,.sm-plugin .sm-style{background-color:white;border:1px solid #e5e5e5;-webkit-box-shadow:0 1px 1px -1px rgba(0,0,0,0.1);box-shadow:0 1px 1px -1px rgba(0,0,0,0.1)}.sm-plugin *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.sm-plugin .clearfix:after{content:'';display:table;clear:both}.sm-plugin .button-error{background-color:#e74c3c;border-color:#d62c1a;color:white;-webkit-box-shadow:inset 0 1px 0 #ed7669,0 1px 0 rgba(0,0,0,0.08);box-shadow:inset 0 1px 0 #ed7669,0 1px 0 rgba(0,0,0,0.08)}.sm-plugin .button-error:hover,.sm-plugin .button-error:focus{background-color:#df2e1b;border-color:#d62c1a;color:white}.sm-plugin .welcome-panel{position:relative;margin-top:16px;margin-bottom:10px;padding:23px}.sm-plugin .welcome-box-close{position:absolute;top:0;right:0;padding:10px;opacity:0.6;-webkit-transition:opacity 0.15s ease;-o-transition:opacity 0.15s ease;transition:opacity 0.15s ease}.sm-plugin .welcome-box-close:hover,.sm-plugin .welcome-box-close:focus,.sm-plugin .welcome-box-close:active{opacity:1}.sm-plugin .footer{margin-top:20px;padding-top:20px;border-top:1px solid #e5e5e5}.sm-plugin .footer a{opacity:0.75;filter:alpha(opacity=75);-webkit-transition:opacity 0.15s ease;-o-transition:opacity 0.15s ease;transition:opacity 0.15s ease}.sm-plugin .footer a:hover,.sm-plugin .footer a:focus,.sm-plugin .footer a:active{opacity:1;filter:alpha(opacity=100);-webkit-box-shadow:none;box-shadow:none}.sm-plugin .footer .icon-brand{width:180px;height:55px;margin-right:20px}.sm-plugin .footer .social{display:inline-block;margin-top:5px;margin-bottom:5px;vertical-align:middle}.sm-plugin .footer .social a{position:relative;width:20px;height:20px;margin:10px;float:left}.sm-plugin .footer .social a:after{content:'';display:block;position:absolute;top:-10px;right:-10px;bottom:-10px;left:-10px}.sm-plugin h2.nav-tab-wrapper,.sm-plugin h3.nav-tab-wrapper{display:inline-block;width:100%;margin-top:16px;margin-bottom:16px;padding:5px 10px}.sm-plugin .nav-tab{padding:10px;background-color:transparent;border:none;color:#0074a2;font-weight:normal}.sm-plugin .nav-tab:focus{-webkit-box-shadow:none;box-shadow:none}.sm-plugin .nav-tab-active,.sm-plugin .nav-tab-active:hover{background-color:white;border:none;color:#333;font-weight:bold}.sm-plugin .nav-tab-container{margin-top:0;margin-left:0}.sm-plugin .tablenav{height:auto}.sm-plugin .tablenav .alignleft{width:100%}.sm-plugin .tablenav select{width:100%}.sm-plugin .tablenav.bottom{margin-top:-10px}.sm-plugin .tablenav a.disabled{color:lightgray;pointer-events:none;cursor:default}.sm-plugin .nothing{margin-top:80px;margin-bottom:80px;text-align:center}.sm-plugin .nothing p{font-size:18px;color:#999}.sm-plugin .tablenav-pages{margin-top:20px;text-align:center}@media (min-width: 783px){.sm-plugin .tablenav{margin-bottom:20px}.sm-plugin .tablenav .alignleft{width:auto}.sm-plugin .tablenav select{width:auto}.sm-plugin .tablenav.top.row{margin-left:-10px;margin-right:-10px}.sm-plugin .tablenav-pages{margin-top:0;text-align:right}}.sm-plugin .sm-style{position:relative;margin-bottom:20px}.sm-plugin .sm-map{position:relative;width:100%;height:250px;overflow:hidden;border:1px solid #f0f0f0}.sm-plugin .sm-map img{display:block;position:absolute;top:50%;left:50%;z-index:1;-webkit-transform:translate(-50%, -50%);-ms-transform:translate(-50%, -50%);-o-transform:translate(-50%, -50%);transform:translate(-50%, -50%)}.sm-plugin .sm-map .overlay-icon{display:block;position:absolute;top:0;left:0;width:0;height:0;z-index:2;border-top:36px solid rgba(46,162,204,0.85);border-left:36px solid rgba(46,162,204,0.85);border-right:36px solid transparent;border-bottom:36px solid transparent}.sm-plugin .sm-map [class*="icon-"]{position:absolute;top:-26px;left:-26px;width:24px;height:24px}.sm-plugin .sm-content{margin-top:-1px;padding:20px;border:1px solid #f0f0f0}.sm-plugin .sm-content h3{margin:0;font-weight:normal}.sm-plugin .sm-content .author{margin-bottom:4px}.sm-plugin .sm-content .button{margin-top:10px}.sm-plugin .sm-content .views,.sm-plugin .sm-content .favorites{display:block}.sm-plugin .sm-content [class*="icon-"]{width:13px;height:13px;margin-right:4px;margin-bottom:4px;opacity:0.7;filter:alpha(opacity=70)}.sm-plugin .api-form{display:inline-block;margin-bottom:20px;padding:20px}.sm-plugin .api-form>*{vertical-align:middle}@media (min-width: 600px) and (max-width: 767px){.sm-plugin .sm-map{width:50%;left:50%;border-left:none}.sm-plugin .sm-content{position:absolute;top:0;left:0;width:50%;height:100%;margin-top:0}}.sm-plugin [class*="icon-"]{display:inline-block;width:16px;height:16px;background-color:transparent;background-position:center;background-repeat:no-repeat;background-size:100%;vertical-align:middle}.sm-plugin .icon-star{background-image:url(images/star.svg)}.sm-plugin .icon-eye{background-image:url(images/eye.svg)}.sm-plugin .icon-googleplus{background-image:url(images/googleplus.svg)}.sm-plugin .icon-facebook{background-image:url(images/facebook.svg)}.sm-plugin .icon-twitter{background-image:url(images/twitter.svg)}.sm-plugin .icon-mail{background-image:url(images/mail.svg)}.sm-plugin .icon-checkmark{background-image:url(images/checkmark.svg)}.sm-plugin .icon-brand{background-image:url(images/logo-snazzymaps.svg)}.sm-plugin .icon-close{background-image:url(images/close.svg)}
1
+ .container{margin-right:auto;margin-left:auto;padding-left:10px;padding-right:10px}.container:after,.container:before{content:" ";display:table}.container:after{clear:both}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{margin-right:auto;margin-left:auto;padding-left:10px;padding-right:10px}.container-fluid:after,.container-fluid:before{content:" ";display:table}.container-fluid:after{clear:both}.row{margin-left:-10px;margin-right:-10px}.row:after,.row:before{content:" ";display:table}.row:after{clear:both}.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{position:relative;min-height:1px;padding-left:10px;padding-right:10px}.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{float:left}.col-xs-1{width:8.33333%}.col-xs-2{width:16.66667%}.col-xs-3{width:25%}.col-xs-4{width:33.33333%}.col-xs-5{width:41.66667%}.col-xs-6{width:50%}.col-xs-7{width:58.33333%}.col-xs-8{width:66.66667%}.col-xs-9{width:75%}.col-xs-10{width:83.33333%}.col-xs-11{width:91.66667%}.col-xs-12{width:100%}.col-xs-pull-0{right:auto}.col-xs-pull-1{right:8.33333%}.col-xs-pull-2{right:16.66667%}.col-xs-pull-3{right:25%}.col-xs-pull-4{right:33.33333%}.col-xs-pull-5{right:41.66667%}.col-xs-pull-6{right:50%}.col-xs-pull-7{right:58.33333%}.col-xs-pull-8{right:66.66667%}.col-xs-pull-9{right:75%}.col-xs-pull-10{right:83.33333%}.col-xs-pull-11{right:91.66667%}.col-xs-pull-12{right:100%}.col-xs-push-0{left:auto}.col-xs-push-1{left:8.33333%}.col-xs-push-2{left:16.66667%}.col-xs-push-3{left:25%}.col-xs-push-4{left:33.33333%}.col-xs-push-5{left:41.66667%}.col-xs-push-6{left:50%}.col-xs-push-7{left:58.33333%}.col-xs-push-8{left:66.66667%}.col-xs-push-9{left:75%}.col-xs-push-10{left:83.33333%}.col-xs-push-11{left:91.66667%}.col-xs-push-12{left:100%}.col-xs-offset-0{margin-left:0}.col-xs-offset-1{margin-left:8.33333%}.col-xs-offset-2{margin-left:16.66667%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-4{margin-left:33.33333%}.col-xs-offset-5{margin-left:41.66667%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-7{margin-left:58.33333%}.col-xs-offset-8{margin-left:66.66667%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-10{margin-left:83.33333%}.col-xs-offset-11{margin-left:91.66667%}.col-xs-offset-12{margin-left:100%}@media (min-width:768px){.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9{float:left}.col-sm-1{width:8.33333%}.col-sm-2{width:16.66667%}.col-sm-3{width:25%}.col-sm-4{width:33.33333%}.col-sm-5{width:41.66667%}.col-sm-6{width:50%}.col-sm-7{width:58.33333%}.col-sm-8{width:66.66667%}.col-sm-9{width:75%}.col-sm-10{width:83.33333%}.col-sm-11{width:91.66667%}.col-sm-12{width:100%}.col-sm-pull-0{right:auto}.col-sm-pull-1{right:8.33333%}.col-sm-pull-2{right:16.66667%}.col-sm-pull-3{right:25%}.col-sm-pull-4{right:33.33333%}.col-sm-pull-5{right:41.66667%}.col-sm-pull-6{right:50%}.col-sm-pull-7{right:58.33333%}.col-sm-pull-8{right:66.66667%}.col-sm-pull-9{right:75%}.col-sm-pull-10{right:83.33333%}.col-sm-pull-11{right:91.66667%}.col-sm-pull-12{right:100%}.col-sm-push-0{left:auto}.col-sm-push-1{left:8.33333%}.col-sm-push-2{left:16.66667%}.col-sm-push-3{left:25%}.col-sm-push-4{left:33.33333%}.col-sm-push-5{left:41.66667%}.col-sm-push-6{left:50%}.col-sm-push-7{left:58.33333%}.col-sm-push-8{left:66.66667%}.col-sm-push-9{left:75%}.col-sm-push-10{left:83.33333%}.col-sm-push-11{left:91.66667%}.col-sm-push-12{left:100%}.col-sm-offset-0{margin-left:0}.col-sm-offset-1{margin-left:8.33333%}.col-sm-offset-2{margin-left:16.66667%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-4{margin-left:33.33333%}.col-sm-offset-5{margin-left:41.66667%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-7{margin-left:58.33333%}.col-sm-offset-8{margin-left:66.66667%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-10{margin-left:83.33333%}.col-sm-offset-11{margin-left:91.66667%}.col-sm-offset-12{margin-left:100%}}@media (min-width:992px){.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9{float:left}.col-md-1{width:8.33333%}.col-md-2{width:16.66667%}.col-md-3{width:25%}.col-md-4{width:33.33333%}.col-md-5{width:41.66667%}.col-md-6{width:50%}.col-md-7{width:58.33333%}.col-md-8{width:66.66667%}.col-md-9{width:75%}.col-md-10{width:83.33333%}.col-md-11{width:91.66667%}.col-md-12{width:100%}.col-md-pull-0{right:auto}.col-md-pull-1{right:8.33333%}.col-md-pull-2{right:16.66667%}.col-md-pull-3{right:25%}.col-md-pull-4{right:33.33333%}.col-md-pull-5{right:41.66667%}.col-md-pull-6{right:50%}.col-md-pull-7{right:58.33333%}.col-md-pull-8{right:66.66667%}.col-md-pull-9{right:75%}.col-md-pull-10{right:83.33333%}.col-md-pull-11{right:91.66667%}.col-md-pull-12{right:100%}.col-md-push-0{left:auto}.col-md-push-1{left:8.33333%}.col-md-push-2{left:16.66667%}.col-md-push-3{left:25%}.col-md-push-4{left:33.33333%}.col-md-push-5{left:41.66667%}.col-md-push-6{left:50%}.col-md-push-7{left:58.33333%}.col-md-push-8{left:66.66667%}.col-md-push-9{left:75%}.col-md-push-10{left:83.33333%}.col-md-push-11{left:91.66667%}.col-md-push-12{left:100%}.col-md-offset-0{margin-left:0}.col-md-offset-1{margin-left:8.33333%}.col-md-offset-2{margin-left:16.66667%}.col-md-offset-3{margin-left:25%}.col-md-offset-4{margin-left:33.33333%}.col-md-offset-5{margin-left:41.66667%}.col-md-offset-6{margin-left:50%}.col-md-offset-7{margin-left:58.33333%}.col-md-offset-8{margin-left:66.66667%}.col-md-offset-9{margin-left:75%}.col-md-offset-10{margin-left:83.33333%}.col-md-offset-11{margin-left:91.66667%}.col-md-offset-12{margin-left:100%}}@media (min-width:1200px){.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9{float:left}.col-lg-1{width:8.33333%}.col-lg-2{width:16.66667%}.col-lg-3{width:25%}.col-lg-4{width:33.33333%}.col-lg-5{width:41.66667%}.col-lg-6{width:50%}.col-lg-7{width:58.33333%}.col-lg-8{width:66.66667%}.col-lg-9{width:75%}.col-lg-10{width:83.33333%}.col-lg-11{width:91.66667%}.col-lg-12{width:100%}.col-lg-pull-0{right:auto}.col-lg-pull-1{right:8.33333%}.col-lg-pull-2{right:16.66667%}.col-lg-pull-3{right:25%}.col-lg-pull-4{right:33.33333%}.col-lg-pull-5{right:41.66667%}.col-lg-pull-6{right:50%}.col-lg-pull-7{right:58.33333%}.col-lg-pull-8{right:66.66667%}.col-lg-pull-9{right:75%}.col-lg-pull-10{right:83.33333%}.col-lg-pull-11{right:91.66667%}.col-lg-pull-12{right:100%}.col-lg-push-0{left:auto}.col-lg-push-1{left:8.33333%}.col-lg-push-2{left:16.66667%}.col-lg-push-3{left:25%}.col-lg-push-4{left:33.33333%}.col-lg-push-5{left:41.66667%}.col-lg-push-6{left:50%}.col-lg-push-7{left:58.33333%}.col-lg-push-8{left:66.66667%}.col-lg-push-9{left:75%}.col-lg-push-10{left:83.33333%}.col-lg-push-11{left:91.66667%}.col-lg-push-12{left:100%}.col-lg-offset-0{margin-left:0}.col-lg-offset-1{margin-left:8.33333%}.col-lg-offset-2{margin-left:16.66667%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-4{margin-left:33.33333%}.col-lg-offset-5{margin-left:41.66667%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-7{margin-left:58.33333%}.col-lg-offset-8{margin-left:66.66667%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-10{margin-left:83.33333%}.col-lg-offset-11{margin-left:91.66667%}.col-lg-offset-12{margin-left:100%}}.sm-plugin .box-shadow-cell,.sm-plugin .sm-style,.sm-plugin h2.nav-tab-wrapper,.sm-plugin h3.nav-tab-wrapper{background-color:#fff;border:1px solid #e5e5e5;-webkit-box-shadow:0 1px 1px -1px rgba(0,0,0,.1);box-shadow:0 1px 1px -1px rgba(0,0,0,.1)}.sm-plugin *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.sm-plugin .clearfix:after{content:'';display:table;clear:both}.sm-plugin .button-error{background:#e74c3c;border-color:#d62c1a;color:#fff;-webkit-box-shadow:inset 0 1px 0 #ed7669,0 1px 0 rgba(0,0,0,.08);box-shadow:inset 0 1px 0 #ed7669,0 1px 0 rgba(0,0,0,.08)}.sm-plugin .button-error:focus,.sm-plugin .button-error:hover{background:#df2e1b;border-color:#d62c1a;color:#fff}.sm-plugin .welcome-panel{position:relative;margin-top:16px;margin-bottom:10px;padding:23px}.sm-plugin .welcome-box-close{position:absolute;top:0;right:0;padding:10px;opacity:.6;-webkit-transition:opacity .15s ease;-o-transition:opacity .15s ease;transition:opacity .15s ease}.sm-plugin .welcome-box-close:active,.sm-plugin .welcome-box-close:focus,.sm-plugin .welcome-box-close:hover{opacity:1}.sm-plugin .footer{margin-top:20px;padding-top:20px;border-top:1px solid #e5e5e5}.sm-plugin .footer a{opacity:.75;filter:alpha(opacity=75);-webkit-transition:opacity .15s ease;-o-transition:opacity .15s ease;transition:opacity .15s ease}.sm-plugin .footer a:active,.sm-plugin .footer a:focus,.sm-plugin .footer a:hover{opacity:1;filter:alpha(opacity=100);-webkit-box-shadow:none;box-shadow:none}.sm-plugin .footer .icon-brand{width:180px;height:55px;margin-right:20px}.sm-plugin .footer .social{display:inline-block;margin-top:5px;margin-bottom:5px;vertical-align:middle}.sm-plugin .footer .social a{position:relative;width:20px;height:20px;margin:10px;float:left}.sm-plugin .footer .social a:after{content:'';display:block;position:absolute;top:-10px;right:-10px;bottom:-10px;left:-10px}.sm-plugin h2.nav-tab-wrapper,.sm-plugin h3.nav-tab-wrapper{display:inline-block;width:100%;margin-top:16px;margin-bottom:16px;padding:5px 10px}.sm-plugin .nav-tab{padding:10px;background-color:transparent;border:none;color:#0074a2;font-weight:400}.sm-plugin .nav-tab:focus{-webkit-box-shadow:none;box-shadow:none}.sm-plugin .nav-tab-active,.sm-plugin .nav-tab-active:hover{background-color:#fff;border:none;color:#333;font-weight:700}.sm-plugin .nav-tab-container{margin-top:0;margin-left:0}.sm-plugin .tablenav{height:auto}.sm-plugin .tablenav .alignleft,.sm-plugin .tablenav select{width:100%}.sm-plugin .tablenav.bottom{margin-top:-10px}.sm-plugin .tablenav a.disabled{color:#d3d3d3;pointer-events:none;cursor:default}.sm-plugin .nothing{margin-top:80px;margin-bottom:80px;text-align:center}.sm-plugin .nothing p{font-size:18px;color:#999}.sm-plugin .tablenav-pages{margin-top:20px;text-align:center}@media (min-width:783px){.sm-plugin .tablenav{margin-bottom:20px}.sm-plugin .tablenav .alignleft,.sm-plugin .tablenav select{width:auto}.sm-plugin .tablenav.top.row{margin-left:-10px;margin-right:-10px}.sm-plugin .tablenav-pages{margin-top:0;text-align:right}}.sm-plugin .sm-style{position:relative;margin-bottom:20px}.sm-plugin .sm-map{position:relative;width:100%;height:250px;overflow:hidden;border:1px solid #f0f0f0}.sm-plugin .sm-map img{display:block;position:absolute;top:50%;left:50%;z-index:1;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);-o-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.sm-plugin .sm-map .overlay-icon{display:block;position:absolute;top:0;left:0;width:0;height:0;z-index:2;border-top:36px solid rgba(46,162,204,.85);border-left:36px solid rgba(46,162,204,.85);border-right:36px solid transparent;border-bottom:36px solid transparent}.sm-plugin .sm-map [class*=icon-]{position:absolute;top:-26px;left:-26px;width:24px;height:24px}.sm-plugin .sm-content{margin-top:-1px;padding:20px;border:1px solid #f0f0f0}.sm-plugin .sm-content h3{margin:0;font-weight:400}.sm-plugin .sm-content .author{margin-bottom:4px}.sm-plugin .sm-content .button{margin-top:10px}.sm-plugin .sm-content .favorites,.sm-plugin .sm-content .views{display:block}.sm-plugin .sm-content [class*=icon-]{width:13px;height:13px;margin-right:4px;margin-bottom:4px;opacity:.7;filter:alpha(opacity=70)}.sm-plugin .api-form{display:inline-block;margin-bottom:20px;padding:20px}.sm-plugin .api-form>*{vertical-align:middle}@media (min-width:600px) and (max-width:767px){.sm-plugin .sm-map{width:50%;left:50%;border-left:none}.sm-plugin .sm-content{position:absolute;top:0;left:0;width:50%;height:100%;margin-top:0}}.sm-plugin [class*=icon-]{display:inline-block;width:16px;height:16px;background-color:transparent;background-position:center;background-repeat:no-repeat;background-size:100%;vertical-align:middle}.sm-plugin .icon-star{background-image:url(images/star.svg)}.sm-plugin .icon-eye{background-image:url(images/eye.svg)}.sm-plugin .icon-googleplus{background-image:url(images/googleplus.svg)}.sm-plugin .icon-facebook{background-image:url(images/facebook.svg)}.sm-plugin .icon-twitter{background-image:url(images/twitter.svg)}.sm-plugin .icon-mail{background-image:url(images/mail.svg)}.sm-plugin .icon-checkmark{background-image:url(images/checkmark.svg)}.sm-plugin .icon-brand{background-image:url(images/logo-snazzymaps.svg)}.sm-plugin .icon-close{background-image:url(images/close.svg)}
admin/index.js CHANGED
@@ -24,34 +24,41 @@ jQuery(document).ready(function($){
24
  var endPoint = '';
25
  if(params.type == 'my-styles'){
26
  endPoint = 'my-styles.json';
27
- data['key'] = USER_API_KEY;
28
- if(USER_API_KEY == null){
29
  showError('<p>You need to add your API key in the <a href="?page=snazzy_maps&tab=2">Settings</a> tab.</p>');
30
  return;
31
  }
32
 
33
  }else if(params.type == 'my-favorites'){
34
  endPoint = 'favorites.json';
35
- data['key'] = USER_API_KEY;
36
- if(USER_API_KEY == null){
37
  showError('<p>You need to add your API key in the <a href="?page=snazzy_maps&tab=2">Settings</a> tab.</p>');
38
  return;
39
  }
40
  }
41
  else{
42
  endPoint = 'explore.json';
43
- data['key'] = API_KEY;
44
  $('.missing-api-key').hide();
45
  $('.results').show();
46
  $('.pagination').show();
47
  }
48
 
49
 
 
 
 
 
 
 
 
50
  var failedTimeout = setTimeout(function(){
51
  showError("<p>Oops, it seems that Snazzy Maps is temporarily down or your API key is incorrect.</p>");
52
  }, 3000);
53
  $.ajax({
54
- url: API_BASE + endPoint,
55
  jsonp: 'callback',
56
  data: data,
57
  dataType: 'jsonp',
@@ -107,25 +114,25 @@ jQuery(document).ready(function($){
107
  History.replaceState(oldParams, document.title, '?' + queryString.stringify(oldParams));
108
  };
109
 
110
- $(document).on('change', '#explore-list select', function(){
111
  var q = {};
112
  q[this.name] = $(this).val();
113
  q['ppage'] = 1; //Reset the page number because we are changing the results
114
  replaceGET(q);
115
  });
116
 
117
- $(document).on('submit', '.style', function(){
118
  $(this).find('input[name="new_style"]')
119
  .val($.base64.encode(JSON.stringify($(this).data('style'))));
120
  });
121
 
122
  //Pagination
123
- $(document).on('click', '.tablenav-pages a', function(){
124
  replaceGET({ ppage: $(this).data('page') });
125
  return false;
126
  });
127
 
128
- $(document).on('change', '.current-page', function(){
129
 
130
  var start = $('.first-page').data('page');
131
  var end = $('.last-page').data('page');
@@ -172,11 +179,11 @@ jQuery(document).ready(function($){
172
  $('.tablenav-pages .total-pages').html(options['totalPages']);
173
  if(options['totalPages'] > 0){
174
  $('.current-page').val(options['currentPage']);
175
- $('.current-page').prop('disabled', false);
176
  }
177
  else{
178
  $('.current-page').val(0);
179
- $('.current-page').prop('disabled', true);
180
  }
181
 
182
  }
24
  var endPoint = '';
25
  if(params.type == 'my-styles'){
26
  endPoint = 'my-styles.json';
27
+ data['key'] = SnazzyData['USER_API_KEY'];
28
+ if(SnazzyData['USER_API_KEY'] == null){
29
  showError('<p>You need to add your API key in the <a href="?page=snazzy_maps&tab=2">Settings</a> tab.</p>');
30
  return;
31
  }
32
 
33
  }else if(params.type == 'my-favorites'){
34
  endPoint = 'favorites.json';
35
+ data['key'] = SnazzyData['USER_API_KEY'];
36
+ if(SnazzyData['USER_API_KEY'] == null){
37
  showError('<p>You need to add your API key in the <a href="?page=snazzy_maps&tab=2">Settings</a> tab.</p>');
38
  return;
39
  }
40
  }
41
  else{
42
  endPoint = 'explore.json';
43
+ data['key'] = SnazzyData['API_KEY'];
44
  $('.missing-api-key').hide();
45
  $('.results').show();
46
  $('.pagination').show();
47
  }
48
 
49
 
50
+ //Clean up the data before getting the response
51
+ for(var key in data){
52
+ if(data[key] == undefined || data[key] == null || data[key] == "undefined"){
53
+ delete data[key];
54
+ }
55
+ }
56
+
57
  var failedTimeout = setTimeout(function(){
58
  showError("<p>Oops, it seems that Snazzy Maps is temporarily down or your API key is incorrect.</p>");
59
  }, 3000);
60
  $.ajax({
61
+ url: SnazzyData['API_BASE'] + endPoint,
62
  jsonp: 'callback',
63
  data: data,
64
  dataType: 'jsonp',
114
  History.replaceState(oldParams, document.title, '?' + queryString.stringify(oldParams));
115
  };
116
 
117
+ $('#explore-list select').live('change', function(){
118
  var q = {};
119
  q[this.name] = $(this).val();
120
  q['ppage'] = 1; //Reset the page number because we are changing the results
121
  replaceGET(q);
122
  });
123
 
124
+ $('.style').live('submit', function(){
125
  $(this).find('input[name="new_style"]')
126
  .val($.base64.encode(JSON.stringify($(this).data('style'))));
127
  });
128
 
129
  //Pagination
130
+ $('.tablenav-pages a').live('click', function(){
131
  replaceGET({ ppage: $(this).data('page') });
132
  return false;
133
  });
134
 
135
+ $('.current-page').live('change', function(){
136
 
137
  var start = $('.first-page').data('page');
138
  var end = $('.last-page').data('page');
179
  $('.tablenav-pages .total-pages').html(options['totalPages']);
180
  if(options['totalPages'] > 0){
181
  $('.current-page').val(options['currentPage']);
182
+ $('.current-page').attr('disabled', false);
183
  }
184
  else{
185
  $('.current-page').val(0);
186
+ $('.current-page').attr('disabled', true);
187
  }
188
 
189
  }
admin/index.php CHANGED
@@ -1,12 +1,10 @@
1
  <?php
2
  defined( 'ABSPATH' ) OR exit;
3
 
4
-
5
-
6
- include(plugin_dir_path(__FILE__) . DIRECTORY_SEPARATOR . 'styles.php');
7
- include(plugin_dir_path(__FILE__) . DIRECTORY_SEPARATOR . 'explore.php');
8
- include(plugin_dir_path(__FILE__) . DIRECTORY_SEPARATOR . 'settings.php');
9
- include(plugin_dir_path(__FILE__) . DIRECTORY_SEPARATOR . 'help.php');
10
 
11
 
12
  function admin_perform_post (){
@@ -35,44 +33,37 @@ function admin_enqueue_script($hook){
35
 
36
  //Include the javascript
37
  $handle = 'admin-snazzymaps-js';
38
- echo wp_register_script($handle, plugins_url('index.js', __FILE__), array('jquery'));
39
- echo wp_enqueue_script($handle, $deps = array('jquery'));
40
- wp_localize_script($handle, 'API_KEY', API_KEY);
41
- wp_localize_script($handle, 'API_BASE', API_BASE);
42
- wp_localize_script($handle, 'USER_API_KEY', get_option('MySnazzyAPIKey', null));
43
-
44
  //Include the node modules
45
  $node_modules = array(
46
- 'query-string' . DIRECTORY_SEPARATOR . 'query-string.js',
47
- 'mustache' . DIRECTORY_SEPARATOR . 'mustache.min.js'
48
  );
49
  foreach($node_modules as $index => $node_module){
50
- $handle = "admin-node-module-$index";
51
- echo wp_register_script($handle,
52
- resourceURL('node_modules' . DIRECTORY_SEPARATOR . $node_module));
53
- echo wp_enqueue_script($handle);
54
  }
55
 
56
  //Include the bower components
57
  $bower_components = array(
58
- 'history.js' . DIRECTORY_SEPARATOR . 'scripts' .
59
- DIRECTORY_SEPARATOR . 'bundled' . DIRECTORY_SEPARATOR . 'html5' .
60
- DIRECTORY_SEPARATOR . 'native.history.js'
61
  );
62
  foreach($bower_components as $index => $bower_component){
63
- $handle = "admin-bower-component-$index";
64
- echo wp_register_script($handle,
65
- resourceURL('bower_components' . DIRECTORY_SEPARATOR . $bower_component));
66
- echo wp_enqueue_script($handle);
67
  }
68
 
69
 
70
  //Include additional javascript
71
  $additional_js = array('jquery.base64.min.js');
72
  foreach($additional_js as $index => $js){
73
- $handle = "additional-js-$index";
74
- echo wp_register_script($handle, resourceURL('additional_js' . DIRECTORY_SEPARATOR . $js));
75
- echo wp_enqueue_script($handle);
76
  }
77
 
78
  //Include the css
1
  <?php
2
  defined( 'ABSPATH' ) OR exit;
3
 
4
+ include(plugin_dir_path(__FILE__) . _DS . 'styles.php');
5
+ include(plugin_dir_path(__FILE__) . _DS . 'explore.php');
6
+ include(plugin_dir_path(__FILE__) . _DS . 'settings.php');
7
+ include(plugin_dir_path(__FILE__) . _DS . 'help.php');
 
 
8
 
9
 
10
  function admin_perform_post (){
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)));
 
 
40
  //Include the node modules
41
  $node_modules = array(
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
51
  $bower_components = array(
52
+ 'history.js' . _DS . 'scripts' .
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
admin/styles.php CHANGED
@@ -1,7 +1,23 @@
1
  <?php
2
  defined( 'ABSPATH' ) OR exit;
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
 
 
 
5
 
6
  function admin_styles_head($tab){
7
 
@@ -9,25 +25,13 @@ defined( 'ABSPATH' ) OR exit;
9
  if($styles == null){
10
  $styles = array();
11
  }
12
- //Used to get a style by an id from the style array
13
- $getStyleIndex = function($id) use ($styles){
14
- foreach($styles as $index => $style){
15
- if($style['id'] == $id){
16
- return $index;
17
- }
18
- }
19
- return null;
20
- };
21
 
22
- $getStyle = function($id) use ($styles, $getStyleIndex){
23
- $index = $getStyleIndex($id);
24
- return !is_null($index) ? $styles[$index] : null;
25
- };
26
 
27
  //When a new style is selected we have to go through some checks
28
  if(isset($_POST['new_style'])){
29
- $newStyle = json_decode(base64_decode($_POST['new_style']), true);
30
- if(!$getStyle($newStyle['id'])){
 
31
  $styles[] = $newStyle;
32
  update_option('SnazzyMapStyles', $styles);
33
  }
@@ -40,25 +44,11 @@ defined( 'ABSPATH' ) OR exit;
40
  if($styles == null){
41
  $styles = array();
42
  }
43
-
44
- //Used to get a style by an id from the style array
45
- $getStyleIndex = function($id) use ($styles){
46
- foreach($styles as $index => $style){
47
- if($style['id'] == $id){
48
- return $index;
49
- }
50
- }
51
- return null;
52
- };
53
-
54
- $getStyle = function($id) use ($styles, $getStyleIndex){
55
- $index = $getStyleIndex($id);
56
- return !is_null($index) ? $styles[$index] : null;
57
- };
58
 
59
  //Delete the specified style from the array
60
  if(isset($_GET['action']) && $_GET['action'] == 'delete_style'){
61
- $index = $getStyleIndex($_GET['style']);
62
  $defaultStyle = get_option('SnazzyMapDefaultStyle', null);
63
  if(!is_null($index)){
64
  $oldStyle = $styles[$index];
@@ -74,7 +64,7 @@ defined( 'ABSPATH' ) OR exit;
74
 
75
  //Enable the specified style
76
  if(isset($_GET['action']) && $_GET['action'] == 'enable_style'){
77
- $index = $getStyleIndex($_GET['style']);
78
  if(!is_null($index)){
79
  update_option('SnazzyMapDefaultStyle', $styles[$index]);
80
  }
@@ -82,7 +72,7 @@ defined( 'ABSPATH' ) OR exit;
82
 
83
  //Disable the specified style
84
  if(isset($_GET['action']) && $_GET['action'] == 'disable_style'){
85
- $index = $getStyleIndex($_GET['style']);
86
  $defaultStyle = get_option('SnazzyMapDefaultStyle', null);
87
  if(!is_null($index) && !is_null($defaultStyle)
88
  && $styles[$index]['id'] == $defaultStyle['id']){
@@ -103,10 +93,6 @@ defined( 'ABSPATH' ) OR exit;
103
  <div class="results row">
104
  <?php foreach($styles as $index => $style){
105
  $isEnabled = !is_null($defaultStyle) && $defaultStyle['id'] == $style['id'];
106
-
107
- $styleAction = function($action) use ($style){
108
- return "?page=snazzy_maps&tab=0&action=$action&style=" . $style['id'];
109
- };
110
  ?>
111
  <div class="style col-sm-6 col-md-4 <?php echo $isEnabled ? 'enabled' : '';?>">
112
  <div class="sm-style">
@@ -144,17 +130,17 @@ defined( 'ABSPATH' ) OR exit;
144
  <?php
145
  if($isEnabled){
146
  ?>
147
- <a href="<?php echo $styleAction('disable_style'); ?>"
148
  class="button button-secondary button-large">Disable</a>
149
  <?php
150
  }
151
  else{
152
  ?>
153
- <a href="<?php echo $styleAction('enable_style'); ?>"
154
  class="button button-primary button-large">Enable</a>
155
  <?php
156
  } ?>
157
- <a href="<?php echo $styleAction('delete_style'); ?>"
158
  class="delete button button-error button-large">Remove</a>
159
  </div>
160
  </div>
1
  <?php
2
  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
+ }
10
+ }
11
+ return null;
12
+ }
13
+ function _getStyle(&$styles, $id){
14
+ $index = _getStyleIndex($styles, $id);
15
+ return !is_null($index) ? $styles[$index] : null;
16
+ }
17
 
18
+ function _styleAction(&$style, $action){
19
+ return "?page=snazzy_maps&tab=0&action=$action&style=" . $style['id'];
20
+ };
21
 
22
  function admin_styles_head($tab){
23
 
25
  if($styles == null){
26
  $styles = array();
27
  }
 
 
 
 
 
 
 
 
 
28
 
 
 
 
 
29
 
30
  //When a new style is selected we have to go through some checks
31
  if(isset($_POST['new_style'])){
32
+ $json = new Services_JSON();
33
+ $newStyle = _object_to_array($json->decode(base64_decode($_POST['new_style'])));
34
+ if(!_getStyle($styles, $newStyle['id'])){
35
  $styles[] = $newStyle;
36
  update_option('SnazzyMapStyles', $styles);
37
  }
44
  if($styles == null){
45
  $styles = array();
46
  }
47
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
  //Delete the specified style from the array
50
  if(isset($_GET['action']) && $_GET['action'] == 'delete_style'){
51
+ $index = _getStyleIndex($styles, $_GET['style']);
52
  $defaultStyle = get_option('SnazzyMapDefaultStyle', null);
53
  if(!is_null($index)){
54
  $oldStyle = $styles[$index];
64
 
65
  //Enable the specified style
66
  if(isset($_GET['action']) && $_GET['action'] == 'enable_style'){
67
+ $index = _getStyleIndex($styles, $_GET['style']);
68
  if(!is_null($index)){
69
  update_option('SnazzyMapDefaultStyle', $styles[$index]);
70
  }
72
 
73
  //Disable the specified style
74
  if(isset($_GET['action']) && $_GET['action'] == 'disable_style'){
75
+ $index = _getStyleIndex($styles, $_GET['style']);
76
  $defaultStyle = get_option('SnazzyMapDefaultStyle', null);
77
  if(!is_null($index) && !is_null($defaultStyle)
78
  && $styles[$index]['id'] == $defaultStyle['id']){
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' : '';?>">
98
  <div class="sm-style">
130
  <?php
131
  if($isEnabled){
132
  ?>
133
+ <a href="<?php echo _styleAction($style, 'disable_style'); ?>"
134
  class="button button-secondary button-large">Disable</a>
135
  <?php
136
  }
137
  else{
138
  ?>
139
+ <a href="<?php echo _styleAction($style, 'enable_style'); ?>"
140
  class="button button-primary button-large">Enable</a>
141
  <?php
142
  } ?>
143
+ <a href="<?php echo _styleAction($style, 'delete_style'); ?>"
144
  class="delete button button-error button-large">Remove</a>
145
  </div>
146
  </div>
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: atmistinc
3
  Donate link: https://snazzymaps.com/about
4
  Tags: google,maps,google maps,styled maps,styles,color,schemes,themes
5
- Requires at least: 3.5
6
- Tested up to: 4.1
7
- Stable tag: 1.0.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -77,6 +77,11 @@ apply any styles to it. Sorry! Switching to a WordPress plugin that uses Google'
77
 
78
  == Changelog ==
79
 
 
 
 
 
 
80
  = 1.0.1 =
81
  Release Date: March 17th, 2015
82
 
2
  Contributors: atmistinc
3
  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
 
77
 
78
  == Changelog ==
79
 
80
+ = 1.0.2 =
81
+ Release Date: March 25th, 2015
82
+
83
+ * Bug Fix: Updated the plugin to work with older PHP and WordPress versions. We now support PHP 5.0.5 and later and WordPress 2.8 and later.
84
+
85
  = 1.0.1 =
86
  Release Date: March 17th, 2015
87
 
snazzymaps.js CHANGED
@@ -1,6 +1,6 @@
1
  jQuery(document).ready(function($){
2
  try{
3
- var style = JSON.parse(SnazzyMapDefaultStyle['json']);
4
  (function(g, s) {
5
  var _map = g.Map;
6
  g.Map = function(map, options) {
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) {
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.1
7
  * Author: Atmist
8
  * Author URI: http://atmist.com/
9
  * License: GPL2
@@ -30,9 +30,28 @@ 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
 
35
- include(plugin_dir_path(__FILE__) . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR . 'index.php');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
  function resourceURL($file){
38
  return plugins_url($file, __FILE__);
@@ -46,13 +65,15 @@ add_action('init', 'init_plugin');
46
 
47
  //Pass the style information into the javascript file on the main page
48
  function enqueue_script() {
49
-
50
  $uniqueStyle = get_option('SnazzyMapDefaultStyle');
51
  if(!empty($uniqueStyle) && !is_null($uniqueStyle)){
52
  $handle = 'snazzymaps-js';
53
- wp_register_script($handle, plugins_url('snazzymaps.js', __FILE__), array('jquery'));
54
- wp_enqueue_script($handle, $in_footer = true);
55
- wp_localize_script($handle, 'SnazzyMapDefaultStyle', $uniqueStyle);
 
 
 
56
  }
57
  }
58
  add_action( 'wp_enqueue_scripts', 'enqueue_script');
@@ -62,7 +83,7 @@ add_action( 'wp_enqueue_scripts', 'enqueue_script');
62
  add_action( 'admin_enqueue_scripts', 'admin_enqueue_script');
63
 
64
  function admin_add_custom_menu(){
65
- add_theme_page('Snazzy Maps', 'Snazzy Maps', 'edit_theme_options', 'snazzy_maps', 'admin_add_custom_content');
66
  }
67
  add_action( 'admin_menu', 'admin_add_custom_menu');
68
 
@@ -70,7 +91,7 @@ add_action( 'admin_menu', 'admin_add_custom_menu');
70
  add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'my_plugin_action_links' );
71
 
72
  function my_plugin_action_links( $links ) {
73
- array_unshift($links, '<a href="'. get_admin_url(null, 'themes.php?page=snazzy_maps') .'">Settings</a>');
74
  return $links;
75
  }
76
 
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
  //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', '/');
36
+ }
37
+
38
+ include(plugin_dir_path(__FILE__) . _DS . 'admin' . _DS . 'index.php');
39
+ include(plugin_dir_path(__FILE__) . _DS . 'additional_php' . _DS . 'Services_JSON.php');
40
+
41
+ //Required for converting the data returned by the JSON Service
42
+ function _object_to_array($object)
43
+ {
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
+ }
51
+ return $result;
52
+ }
53
+ return $object;
54
+ }
55
 
56
  function resourceURL($file){
57
  return plugins_url($file, __FILE__);
65
 
66
  //Pass the style information into the javascript file on the main page
67
  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();
75
+ wp_localize_script($handle, 'SnazzyDataForSnazzyMaps',
76
+ array('l10n_print_after' => 'SnazzyDataForSnazzyMaps=' . $json->encode($uniqueStyle)));
77
  }
78
  }
79
  add_action( 'wp_enqueue_scripts', 'enqueue_script');
83
  add_action( 'admin_enqueue_scripts', 'admin_enqueue_script');
84
 
85
  function admin_add_custom_menu(){
86
+ add_theme_page('Snazzy Maps', 'Snazzy Maps', 'edit_themes', 'snazzy_maps', 'admin_add_custom_content');
87
  }
88
  add_action( 'admin_menu', 'admin_add_custom_menu');
89
 
91
  add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'my_plugin_action_links' );
92
 
93
  function my_plugin_action_links( $links ) {
94
+ array_unshift($links, '<a href="'. admin_url('themes.php?page=snazzy_maps') .'">Settings</a>');
95
  return $links;
96
  }
97