Version Description
- 2015/01/10
- lots of rewrites
- additional features can now be activated by subscribing to our newsletter
Download this release
Release Info
| Developer | WebFactory |
| Plugin | |
| Version | 2.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.95 to 2.0
- css/gmw-admin.css +44 -3
- css/gmw.css +157 -5
- gmw-tracking.php +1 -1
- gmw-widget.php +91 -43
- google-maps-widget.php +112 -7
- js/gmw-admin.js +117 -2
- js/gmw.js +9 -4
- readme.txt +6 -1
css/gmw-admin.css
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
/*
|
| 2 |
* Google Maps Widget
|
| 3 |
-
* (c) Web factory Ltd, 2012 -
|
| 4 |
*/
|
| 5 |
|
| 6 |
.gmw-label {
|
| 7 |
-
width:
|
| 8 |
display: inline-block;
|
| 9 |
}
|
| 10 |
|
|
@@ -22,7 +22,48 @@
|
|
| 22 |
}
|
| 23 |
|
| 24 |
.gmw-tabs select {
|
| 25 |
-
min-width:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
}
|
| 27 |
|
| 28 |
/*
|
| 1 |
/*
|
| 2 |
* Google Maps Widget
|
| 3 |
+
* (c) Web factory Ltd, 2012 - 2015
|
| 4 |
*/
|
| 5 |
|
| 6 |
.gmw-label {
|
| 7 |
+
width: 115px;
|
| 8 |
display: inline-block;
|
| 9 |
}
|
| 10 |
|
| 22 |
}
|
| 23 |
|
| 24 |
.gmw-tabs select {
|
| 25 |
+
min-width: 230px;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
option.promo {
|
| 29 |
+
color: #e14d43;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
#gmw_promo_dialog ul {
|
| 33 |
+
list-style-position: inside;
|
| 34 |
+
list-style-type: circle;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
#gmw_promo_dialog #gmw_email {
|
| 38 |
+
margin-bottom: 10px;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
#gmw_promo_dialog .error {
|
| 42 |
+
color: #dd3d36;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
#gmw_promo_dialog .center {
|
| 46 |
+
text-align: center;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
#gmw_promo_dialog h3 {
|
| 50 |
+
margin-top: 0;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
#gmw_dialog_activate {
|
| 54 |
+
display: none;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
#gmw_dialog_subscribe {
|
| 58 |
+
display: block;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
#gmw-info h3 {
|
| 62 |
+
margin: 25px 0 5px 0;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
#gmw-info p {
|
| 66 |
+
margin-top: 5px;
|
| 67 |
}
|
| 68 |
|
| 69 |
/*
|
css/gmw.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/*
|
| 2 |
* Google Maps Widget
|
| 3 |
-
* (c) Web factory Ltd, 2012 -
|
| 4 |
*/
|
| 5 |
|
| 6 |
.gmw-header, .gmw-footer {
|
|
@@ -48,7 +48,7 @@
|
|
| 48 |
.gmw-dark #cboxLoadingGraphic{background:url(../images/loading.gif) no-repeat center center;}
|
| 49 |
|
| 50 |
.gmw-dark #cboxPrevious, .gmw-dark #cboxNext, .gmw-dark #cboxSlideshow, .gmw-dark #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; }
|
| 51 |
-
|
| 52 |
.gmw-dark #cboxPrevious:active, .gmw-dark #cboxNext:active, .gmw-dark #cboxSlideshow:active, .gmw-dark #cboxClose:active {outline:0;}
|
| 53 |
|
| 54 |
.gmw-dark #cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;}
|
|
@@ -58,8 +58,8 @@
|
|
| 58 |
.gmw-dark #cboxNext:hover{background-position:-50px -25px;}
|
| 59 |
.gmw-dark #cboxClose{position:absolute; bottom:0; right:0; background:url(../images/controls.png) no-repeat -25px 0; width:25px; height:25px; text-indent:-9999px;}
|
| 60 |
.gmw-dark #cboxClose:hover{background-position:-25px -25px;}
|
| 61 |
-
|
| 62 |
-
|
| 63 |
/* light */
|
| 64 |
#cboxOverlay.gmw-light {background:#fff;}
|
| 65 |
#colorbox.gmw-light {outline:0;}
|
|
@@ -86,4 +86,156 @@
|
|
| 86 |
.gmw-light .cboxSlideshow_on #cboxSlideshow{background-position:-75px -25px; right:44px;}
|
| 87 |
.gmw-light .cboxSlideshow_on #cboxSlideshow:hover{background-position:-100px -25px;}
|
| 88 |
.gmw-light .cboxSlideshow_off #cboxSlideshow{background-position:-100px 0px; right:44px;}
|
| 89 |
-
.gmw-light .cboxSlideshow_off #cboxSlideshow:hover{background-position:-75px -25px;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
/*
|
| 2 |
* Google Maps Widget
|
| 3 |
+
* (c) Web factory Ltd, 2012 - 2015
|
| 4 |
*/
|
| 5 |
|
| 6 |
.gmw-header, .gmw-footer {
|
| 48 |
.gmw-dark #cboxLoadingGraphic{background:url(../images/loading.gif) no-repeat center center;}
|
| 49 |
|
| 50 |
.gmw-dark #cboxPrevious, .gmw-dark #cboxNext, .gmw-dark #cboxSlideshow, .gmw-dark #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; }
|
| 51 |
+
|
| 52 |
.gmw-dark #cboxPrevious:active, .gmw-dark #cboxNext:active, .gmw-dark #cboxSlideshow:active, .gmw-dark #cboxClose:active {outline:0;}
|
| 53 |
|
| 54 |
.gmw-dark #cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;}
|
| 58 |
.gmw-dark #cboxNext:hover{background-position:-50px -25px;}
|
| 59 |
.gmw-dark #cboxClose{position:absolute; bottom:0; right:0; background:url(../images/controls.png) no-repeat -25px 0; width:25px; height:25px; text-indent:-9999px;}
|
| 60 |
.gmw-dark #cboxClose:hover{background-position:-25px -25px;}
|
| 61 |
+
|
| 62 |
+
|
| 63 |
/* light */
|
| 64 |
#cboxOverlay.gmw-light {background:#fff;}
|
| 65 |
#colorbox.gmw-light {outline:0;}
|
| 86 |
.gmw-light .cboxSlideshow_on #cboxSlideshow{background-position:-75px -25px; right:44px;}
|
| 87 |
.gmw-light .cboxSlideshow_on #cboxSlideshow:hover{background-position:-100px -25px;}
|
| 88 |
.gmw-light .cboxSlideshow_off #cboxSlideshow{background-position:-100px 0px; right:44px;}
|
| 89 |
+
.gmw-light .cboxSlideshow_off #cboxSlideshow:hover{background-position:-75px -25px;}
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
/* blue */
|
| 93 |
+
#cboxOverlay.gmw-noimage-blue { background:#80a2ba; }
|
| 94 |
+
.gmw-noimage-blue #cboxTopLeft, .gmw-noimage-blue #cboxTopCenter, .gmw-noimage-blue #cboxTopRight, .gmw-noimage-blue #cboxBottomLeft, .gmw-noimage-blue #cboxBottomCenter, .gmw-noimage-blue #cboxBottomRight, .gmw-noimage-blue #cboxMiddleLeft, .gmw-noimage-blue #cboxMiddleRight {
|
| 95 |
+
background:#0d4270;
|
| 96 |
+
}
|
| 97 |
+
#colorbox.gmw-noimage-blue {
|
| 98 |
+
outline: 1px solid #3175a5;
|
| 99 |
+
-webkit-box-shadow: 0px 0px 25px rgba(50, 50, 50, 0.5);
|
| 100 |
+
-moz-box-shadow: 0px 0px 25px rgba(50, 50, 50, 0.5);
|
| 101 |
+
box-shadow: 0px 0px 25px rgba(50, 50, 50, 0.5);
|
| 102 |
+
}
|
| 103 |
+
.gmw-noimage-blue #cboxTopLeft{width:15px; height:15px; }
|
| 104 |
+
.gmw-noimage-blue #cboxTopCenter{height:15px; }
|
| 105 |
+
.gmw-noimage-blue #cboxTopRight{width:15px; height:15px; }
|
| 106 |
+
.gmw-noimage-blue #cboxBottomLeft{width:15px; height:15px; }
|
| 107 |
+
.gmw-noimage-blue #cboxBottomCenter{height:15px; }
|
| 108 |
+
.gmw-noimage-blue #cboxBottomRight{width:15px; height:15px; }
|
| 109 |
+
.gmw-noimage-blue #cboxMiddleLeft{width:15px; }
|
| 110 |
+
.gmw-noimage-blue #cboxMiddleRight{width:15px; }
|
| 111 |
+
|
| 112 |
+
.gmw-noimage-blue #cboxContent{background:#0d4270; overflow:visible;}
|
| 113 |
+
.gmw-noimage-blue .cboxIframe {background:#fff;}
|
| 114 |
+
.gmw-noimage-blue .cboxPhoto {margin-bottom:28px; margin-top:0 !important;}
|
| 115 |
+
.gmw-noimage-blue .cboxPhoto.withLongCaption { margin-bottom:12px; }
|
| 116 |
+
.gmw-noimage-blue span.better-caption { text-align:center; }
|
| 117 |
+
.gmw-noimage-blue #cboxError{padding:50px; border:1px solid #ccc;}
|
| 118 |
+
.gmw-noimage-blue #cboxLoadedContent{margin-bottom:8px; font-style: italic; }
|
| 119 |
+
.gmw-noimage-blue #cboxTitle{
|
| 120 |
+
display:none !important;
|
| 121 |
+
position:absolute; bottom:18px; clear:both; text-align:center; width:100%; color:#999; min-height:16px; overflow:hidden;
|
| 122 |
+
}
|
| 123 |
+
.gmw-noimage-blue .better-caption { display:none !important; }
|
| 124 |
+
.gmw-noimage-blue #cboxCurrent{
|
| 125 |
+
position:absolute; bottom:0px; left:100px; color:#CCCCCC; text-transform:capitalize; display:inline-block; padding-left:1.5em;
|
| 126 |
+
font-size:11px; line-height:20px; left:45%;
|
| 127 |
+
}
|
| 128 |
+
.gmw-noimage-blue #cboxLoadingOverlay{background:#fff url(../images/loading.gif) no-repeat 50% 50%;}
|
| 129 |
+
|
| 130 |
+
/* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
|
| 131 |
+
.gmw-noimage-blue #cboxPrevious, .gmw-noimage-blue #cboxNext, .gmw-noimage-blue #cboxSlideshow, .gmw-noimage-blue #cboxClose {
|
| 132 |
+
border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; text-transform:capitalize;
|
| 133 |
+
-webkit-border-radius:5px; border-radius:5px;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
/* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
|
| 137 |
+
.gmw-noimage-blue #cboxPrevious:active, .gmw-noimage-blue #cboxNext:active, .gmw-noimage-blue #cboxSlideshow:active, .gmw-noimage-blue #cboxClose:active {outline:0;}
|
| 138 |
+
button:focus{ outline:1px dotted #000000; }
|
| 139 |
+
|
| 140 |
+
.gmw-noimage-blue #cboxSlideshow{position:absolute; bottom:0px; right:62px; }
|
| 141 |
+
.gmw-noimage-blue #cboxPrevious{position:absolute; bottom:0px; left:0; }
|
| 142 |
+
.gmw-noimage-blue #cboxNext{position:absolute; bottom:0px; left:76px; }
|
| 143 |
+
.gmw-noimage-blue #cboxClose{position:absolute; bottom:0; right:0; display:block; }
|
| 144 |
+
|
| 145 |
+
/* Button Styles */
|
| 146 |
+
.gmw-noimage-blue #cboxPrevious,
|
| 147 |
+
.gmw-noimage-blue #cboxNext,
|
| 148 |
+
.gmw-noimage-blue #cboxSlideshow,
|
| 149 |
+
.gmw-noimage-blue #cboxClose {
|
| 150 |
+
color:#D2D2D2;
|
| 151 |
+
font-size:12px; line-height:12px;
|
| 152 |
+
background-color: #0b2a44;
|
| 153 |
+
border-right: 1px solid #061c2f;
|
| 154 |
+
border-bottom: 1px solid #061c2f;
|
| 155 |
+
padding: 6px 10px;
|
| 156 |
+
transition: all 0.35s ease;
|
| 157 |
+
}
|
| 158 |
+
.gmw-noimage-blue #cboxPrevious:hover,
|
| 159 |
+
.gmw-noimage-blue #cboxNext:hover,
|
| 160 |
+
.gmw-noimage-blue #cboxSlideshow:hover,
|
| 161 |
+
.gmw-noimage-blue #cboxClose:hover {
|
| 162 |
+
background-color: #cccccc; color:#444444;
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
/*
|
| 167 |
+
IE7 and IE8. This style is not applied to IE9.
|
| 168 |
+
*/
|
| 169 |
+
/*.gmw-noimage-blue .cboxIE #colorbox {} */
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
/* rounded */
|
| 173 |
+
#cboxOverlay.gmw-noimage-rounded {
|
| 174 |
+
background:#fff;
|
| 175 |
+
}
|
| 176 |
+
.gmw-noimage-rounded #cboxTopLeft, .gmw-noimage-rounded #cboxTopCenter, .gmw-noimage-rounded #cboxTopRight, .gmw-noimage-rounded #cboxBottomLeft, .gmw-noimage-rounded #cboxBottomCenter, .gmw-noimage-rounded #cboxBottomRight, .gmw-noimage-rounded #cboxMiddleLeft, .gmw-noimage-rounded #cboxMiddleRight {
|
| 177 |
+
background:#ffffff;
|
| 178 |
+
}
|
| 179 |
+
#colorbox.gmw-noimage-rounded {
|
| 180 |
+
outline: 1px solid #D5D5D5;
|
| 181 |
+
-webkit-box-shadow: 0px 0px 25px rgba(50, 50, 50, 0.5);
|
| 182 |
+
-moz-box-shadow: 0px 0px 25px rgba(50, 50, 50, 0.5);
|
| 183 |
+
box-shadow: 0px 0px 25px rgba(50, 50, 50, 0.5);
|
| 184 |
+
-webkit-border-radius: 8px;
|
| 185 |
+
border-radius: 8px;
|
| 186 |
+
}
|
| 187 |
+
.gmw-noimage-rounded #cboxTopLeft{width:15px; height:15px; }
|
| 188 |
+
.gmw-noimage-rounded #cboxTopCenter{height:15px; }
|
| 189 |
+
.gmw-noimage-rounded #cboxTopRight{width:15px; height:15px; }
|
| 190 |
+
.gmw-noimage-rounded #cboxBottomLeft{width:15px; height:15px; }
|
| 191 |
+
.gmw-noimage-rounded #cboxBottomCenter{height:15px; }
|
| 192 |
+
.gmw-noimage-rounded #cboxBottomRight{width:15px; height:15px; }
|
| 193 |
+
.gmw-noimage-rounded #cboxMiddleLeft{width:15px; }
|
| 194 |
+
.gmw-noimage-rounded #cboxMiddleRight{width:15px; }
|
| 195 |
+
|
| 196 |
+
.gmw-noimage-rounded #cboxContent{background:#fff; overflow:visible;}
|
| 197 |
+
.gmw-noimage-rounded .cboxIframe {background:#fff;}
|
| 198 |
+
.gmw-noimage-rounded .cboxPhoto {margin-bottom:28px; margin-top:0 !important;}
|
| 199 |
+
.gmw-noimage-rounded .cboxPhoto.withLongCaption { margin-bottom:12px; }
|
| 200 |
+
.gmw-noimage-rounded span.better-caption { line-height:16px; text-align:left; margin-bottom:6px; display:block; }
|
| 201 |
+
.gmw-noimage-rounded #cboxError{padding:50px; border:1px solid #ccc;}
|
| 202 |
+
.gmw-noimage-rounded #cboxLoadedContent{margin-bottom:24px; font-style: italic; }
|
| 203 |
+
.gmw-noimage-rounded #cboxTitle{ position:absolute; bottom:0px; clear:both; text-align:left; width:100%; color:#999; min-height:16px; overflow:hidden; }
|
| 204 |
+
.gmw-noimage-rounded #cboxCurrent{position:absolute; bottom:0px; left:100px; color:#999; text-transform:capitalize; display:inline-block; padding-left:1.5em; }
|
| 205 |
+
.gmw-noimage-rounded #cboxLoadingOverlay{background:#fff url(../images/loading.gif) no-repeat 50% 50%;}
|
| 206 |
+
|
| 207 |
+
/* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
|
| 208 |
+
.gmw-noimage-rounded #cboxPrevious, .gmw-noimage-rounded #cboxNext, .gmw-noimage-rounded #cboxSlideshow, .gmw-noimage-rounded #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; text-transform:capitalize; }
|
| 209 |
+
|
| 210 |
+
/* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
|
| 211 |
+
.gmw-noimage-rounded #cboxPrevious:active, .gmw-noimage-rounded #cboxNext:active, .gmw-noimage-rounded #cboxSlideshow:active, .gmw-noimage-rounded #cboxClose:active {outline:0;}
|
| 212 |
+
button:focus{ outline:1px dotted #ffffff; }
|
| 213 |
+
|
| 214 |
+
.gmw-noimage-rounded #cboxSlideshow{position:absolute; bottom:0px; right:52px; color:#444;}
|
| 215 |
+
.gmw-noimage-rounded #cboxPrevious{position:absolute; bottom:0px; left:0; color:#444;}
|
| 216 |
+
.gmw-noimage-rounded #cboxNext{position:absolute; bottom:0px; left:63px; color:#444;}
|
| 217 |
+
.gmw-noimage-rounded #cboxClose{position:absolute; bottom:0; right:0; display:block; color:#444;}
|
| 218 |
+
|
| 219 |
+
/* Button Styles */
|
| 220 |
+
.gmw-noimage-rounded #cboxPrevious,
|
| 221 |
+
.gmw-noimage-rounded #cboxNext,
|
| 222 |
+
.gmw-noimage-rounded #cboxSlideshow,
|
| 223 |
+
.gmw-noimage-rounded #cboxClose {
|
| 224 |
+
color: #777777;
|
| 225 |
+
font-size:10px; line-height:12px;
|
| 226 |
+
background-color: #dddddd;
|
| 227 |
+
border-right: 1px solid #ccc;
|
| 228 |
+
border-bottom: 1px solid #ccc;
|
| 229 |
+
padding: 4px 8px;
|
| 230 |
+
}
|
| 231 |
+
.gmw-noimage-rounded #cboxPrevious:hover,
|
| 232 |
+
.gmw-noimage-rounded #cboxNext:hover,
|
| 233 |
+
.gmw-noimage-rounded #cboxSlideshow:hover,
|
| 234 |
+
.gmw-noimage-rounded #cboxClose:hover {
|
| 235 |
+
background-color: #cccccc; color:#444444;
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
/*
|
| 239 |
+
IE7 and IE8. This style is not applied to IE9.
|
| 240 |
+
*/
|
| 241 |
+
/*.gmw-noimage-rounded .cboxIE #colorbox {} */
|
gmw-tracking.php
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
/*
|
| 3 |
* Google Maps Widget
|
| 4 |
* Plugin usage tracking
|
| 5 |
-
* (c) Web factory Ltd, 2012 -
|
| 6 |
*/
|
| 7 |
|
| 8 |
|
| 2 |
/*
|
| 3 |
* Google Maps Widget
|
| 4 |
* Plugin usage tracking
|
| 5 |
+
* (c) Web factory Ltd, 2012 - 2015
|
| 6 |
*/
|
| 7 |
|
| 8 |
|
gmw-widget.php
CHANGED
|
@@ -2,11 +2,11 @@
|
|
| 2 |
/*
|
| 3 |
* Google Maps Widget
|
| 4 |
* Widget definition, admin GUI and front-end functions
|
| 5 |
-
* (c) Web factory Ltd, 2012 -
|
| 6 |
*/
|
| 7 |
|
| 8 |
|
| 9 |
-
// include only file
|
| 10 |
if (!defined('ABSPATH')) {
|
| 11 |
die();
|
| 12 |
}
|
|
@@ -40,7 +40,7 @@ class GoogleMapsWidget extends WP_Widget {
|
|
| 40 |
'thumb_zoom' => '13',
|
| 41 |
'thumb_header' => '',
|
| 42 |
'thumb_footer' => '',
|
| 43 |
-
'
|
| 44 |
'thumb_link_type' => 'lightbox',
|
| 45 |
'thumb_link' => '',
|
| 46 |
'lightbox_width' => '550',
|
|
@@ -99,19 +99,35 @@ class GoogleMapsWidget extends WP_Widget {
|
|
| 99 |
|
| 100 |
$lightbox_skins = array(array('val' => 'light', 'label' => __('Light (default)', 'google-maps-widget')),
|
| 101 |
array('val' => 'dark', 'label' => __('Dark', 'google-maps-widget')));
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
$thumb_pin_types = array(array('val' => 'predefined', 'label' => __('Predefined (default)', 'google-maps-widget')),
|
| 104 |
-
|
| 105 |
|
| 106 |
$thumb_link_types = array(array('val' => 'lightbox', 'label' => __('Lightbox (default)', 'google-maps-widget')),
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
echo '<p><label for="' . $this->get_field_id('title') . '">' . __('Title', 'google-maps-widget') . ':</label><input class="widefat" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" type="text" value="' . esc_attr($title) . '" /></p>';
|
| 112 |
echo '<p><label for="' . $this->get_field_id('address') . '">' . __('Address', 'google-maps-widget') . ':</label><input class="widefat" id="' . $this->get_field_id('address') . '" name="' . $this->get_field_name('address') . '" type="text" value="' . esc_attr($address) . '" /></p>';
|
| 113 |
|
| 114 |
-
echo '<div class="gmw-tabs" id="tab-' . $this->id . '"><ul><li><a href="#gmw-thumb">' . __('Thumbnail map', 'google-maps-widget') . '</a></li><li><a href="#gmw-lightbox">' . __('Lightbox map', 'google-maps-widget') . '</a></li></ul>';
|
| 115 |
echo '<div id="gmw-thumb">';
|
| 116 |
|
| 117 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_width') . '">' . __('Map Size', 'google-maps-widget') . ':</label>';
|
|
@@ -123,7 +139,7 @@ class GoogleMapsWidget extends WP_Widget {
|
|
| 123 |
echo '<select id="' . $this->get_field_id('thumb_type') . '" name="' . $this->get_field_name('thumb_type') . '">';
|
| 124 |
GMW::create_select_options($map_types_thumb, $thumb_type);
|
| 125 |
echo '</select></p>';
|
| 126 |
-
|
| 127 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_pin_type') . '">' . __('Pin Type', 'google-maps-widget') . ':</label>';
|
| 128 |
echo '<select class="gmw_thumb_pin_type" id="' . $this->get_field_id('thumb_pin_type') . '" name="' . $this->get_field_name('thumb_pin_type') . '">';
|
| 129 |
GMW::create_select_options($thumb_pin_types, $thumb_pin_type);
|
|
@@ -138,7 +154,7 @@ class GoogleMapsWidget extends WP_Widget {
|
|
| 138 |
echo '<select id="' . $this->get_field_id('thumb_pin_size') . '" name="' . $this->get_field_name('thumb_pin_size') . '">';
|
| 139 |
GMW::create_select_options($pin_sizes, $thumb_pin_size);
|
| 140 |
echo '</select></p>';
|
| 141 |
-
|
| 142 |
echo '<p class="gmw_thumb_pin_type_custom_section"><label class="gmw-label gmw-label-wide" for="' . $this->get_field_id('thumb_pin_img') . '">' . __('Custom Pin Image URL', 'google-maps-widget') . ':</label>';
|
| 143 |
echo '<input type="text" class="regular-text" id="' . $this->get_field_id('thumb_pin_img') . '" name="' . $this->get_field_name('thumb_pin_img') . '" value="' . esc_attr($thumb_pin_img) . '">';
|
| 144 |
|
|
@@ -152,18 +168,22 @@ class GoogleMapsWidget extends WP_Widget {
|
|
| 152 |
GMW::create_select_options($thumb_link_types, $thumb_link_type);
|
| 153 |
echo '</select></p>';
|
| 154 |
|
| 155 |
-
echo '<p class="gmw_thumb_link_section"><label class="gmw-label" for="' . $this->get_field_id('thumb_link') . '">' . __('Custom
|
| 156 |
echo '<input class="regular-text" id="' . $this->get_field_id('thumb_link') . '" name="' . $this->get_field_name('thumb_link') . '" type="text" value="' . esc_attr($thumb_link) . '" /></p>';
|
| 157 |
|
| 158 |
-
echo '<p><label for="' . $this->get_field_id('
|
| 159 |
-
echo '<
|
| 160 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
|
| 162 |
echo '<p><label for="' . $this->get_field_id('thumb_header') . '">' . __('Text Above Map', 'google-maps-widget') . ':</label>';
|
| 163 |
-
echo '<textarea class="widefat" rows="3" cols="20" id="' . $this->get_field_id('thumb_header') . '" name="' . $this->get_field_name('thumb_header') . '">'. $thumb_header . '</textarea></p>';
|
| 164 |
|
| 165 |
echo '<p><label for="' . $this->get_field_id('thumb_footer') . '">' . __('Text Below Map', 'google-maps-widget') . ':</label>';
|
| 166 |
-
echo '<textarea class="widefat" rows="3" cols="20" id="' . $this->get_field_id('thumb_footer') . '" name="' . $this->get_field_name('thumb_footer') . '">'. $thumb_footer . '</textarea></p>';
|
| 167 |
|
| 168 |
echo '</div>'; // thumbnail tab
|
| 169 |
echo '<div id="gmw-lightbox">';
|
|
@@ -183,28 +203,49 @@ class GoogleMapsWidget extends WP_Widget {
|
|
| 183 |
GMW::create_select_options($zoom_levels, $lightbox_zoom);
|
| 184 |
echo '</select></p>';
|
| 185 |
|
| 186 |
-
echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_skin') . '">' . __('Skin', 'google-maps-widget') . ':</label>';
|
| 187 |
-
echo '<select id="' . $this->get_field_id('lightbox_skin') . '" name="' . $this->get_field_name('lightbox_skin') . '">';
|
| 188 |
GMW::create_select_options($lightbox_skins, $lightbox_skin);
|
|
|
|
|
|
|
|
|
|
| 189 |
echo '</select></p>';
|
| 190 |
|
| 191 |
-
echo '<p><label for="' . $this->get_field_id('lightbox_bubble') . '">' . __('
|
| 192 |
-
echo '<
|
| 193 |
-
|
|
|
|
| 194 |
|
| 195 |
-
echo '<p><label for="' . $this->get_field_id('lightbox_title') . '">' . __('
|
| 196 |
-
echo '<
|
| 197 |
-
|
|
|
|
| 198 |
|
| 199 |
echo '<p><label for="' . $this->get_field_id('lightbox_header') . '">' . __('Header Text', 'google-maps-widget') . ':</label>';
|
| 200 |
-
echo '<textarea class="widefat" rows="3" cols="20" id="' . $this->get_field_id('lightbox_header') . '" name="' . $this->get_field_name('lightbox_header') . '">'. $lightbox_header . '</textarea></p>';
|
| 201 |
|
| 202 |
echo '<p><label for="' . $this->get_field_id('lightbox_footer') . '">' . __('Footer Text', 'google-maps-widget') . ':</label>';
|
| 203 |
-
echo '<textarea class="widefat" rows="3" cols="20" id="' . $this->get_field_id('lightbox_footer') . '" name="' . $this->get_field_name('lightbox_footer') . '">'. $lightbox_footer . '</textarea></p>';
|
| 204 |
|
| 205 |
echo '</div>'; // lightbox tab
|
| 206 |
-
|
| 207 |
-
echo '<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
} // form
|
| 209 |
|
| 210 |
|
|
@@ -226,13 +267,13 @@ class GoogleMapsWidget extends WP_Widget {
|
|
| 226 |
$instance['thumb_link'] = trim($new_instance['thumb_link']);
|
| 227 |
$instance['thumb_header'] = trim($new_instance['thumb_header']);
|
| 228 |
$instance['thumb_footer'] = trim($new_instance['thumb_footer']);
|
| 229 |
-
$instance['
|
| 230 |
$instance['lightbox_width'] = (int) $new_instance['lightbox_width'];
|
| 231 |
$instance['lightbox_height'] = (int) $new_instance['lightbox_height'];
|
| 232 |
$instance['lightbox_type'] = $new_instance['lightbox_type'];
|
| 233 |
$instance['lightbox_zoom'] = $new_instance['lightbox_zoom'];
|
| 234 |
-
$instance['lightbox_bubble'] =
|
| 235 |
-
$instance['lightbox_title'] =
|
| 236 |
$instance['lightbox_header'] = trim($new_instance['lightbox_header']);
|
| 237 |
$instance['lightbox_footer'] = trim($new_instance['lightbox_footer']);
|
| 238 |
$instance['lightbox_skin'] = $new_instance['lightbox_skin'];
|
|
@@ -245,6 +286,11 @@ class GoogleMapsWidget extends WP_Widget {
|
|
| 245 |
function widget($args, $instance) {
|
| 246 |
$out = $tmp = '';
|
| 247 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
extract($args, EXTR_SKIP);
|
| 249 |
|
| 250 |
$ll = '';
|
|
@@ -259,7 +305,7 @@ class GoogleMapsWidget extends WP_Widget {
|
|
| 259 |
if (!$lang) {
|
| 260 |
$lang = 'en';
|
| 261 |
}
|
| 262 |
-
|
| 263 |
// legacy fix for older versions; it's auto-fixed on first widget save but has to be here
|
| 264 |
if(!$instance['lightbox_skin']) {
|
| 265 |
$instance['lightbox_skin'] = 'light';
|
|
@@ -283,17 +329,11 @@ class GoogleMapsWidget extends WP_Widget {
|
|
| 283 |
if (!isset($instance['thumb_pin_type']) || empty($instance['thumb_pin_type'])) {
|
| 284 |
$instance['thumb_pin_type'] = 'predefined';
|
| 285 |
}
|
| 286 |
-
|
| 287 |
if (!isset($instance['thumb_link_type']) || empty($instance['thumb_link_type'])) {
|
| 288 |
$instance['thumb_link_type'] = 'lightbox';
|
| 289 |
}
|
| 290 |
|
| 291 |
-
if (isset($instance['thumb_new_colors']) && $instance['thumb_new_colors']) {
|
| 292 |
-
$instance['thumb_new_colors'] = 'true';
|
| 293 |
-
} else {
|
| 294 |
-
$instance['thumb_new_colors'] = 'false';
|
| 295 |
-
}
|
| 296 |
-
|
| 297 |
$title = empty($instance['title'])? ' ' : apply_filters('widget_title', $instance['title']);
|
| 298 |
if (!empty($title)) {
|
| 299 |
$out .= $before_title . $title . $after_title;
|
|
@@ -303,13 +343,13 @@ class GoogleMapsWidget extends WP_Widget {
|
|
| 303 |
$tmp .= wpautop(do_shortcode($instance['thumb_header']));
|
| 304 |
}
|
| 305 |
$tmp .= '<p>';
|
| 306 |
-
|
| 307 |
if ($instance['thumb_link_type'] == 'lightbox') {
|
| 308 |
$alt = __('Click to open larger map', 'google-maps-widget');
|
| 309 |
} else {
|
| 310 |
$alt = esc_attr($instance['address']);
|
| 311 |
}
|
| 312 |
-
|
| 313 |
if ($instance['thumb_link_type'] == 'lightbox') {
|
| 314 |
$tmp .= '<a class="gmw-thumbnail-map gmw-lightbox-enabled" href="#gmw-dialog-' . $widget_id . '" title="' . __('Click to open larger map', 'google-maps-widget') . '">';
|
| 315 |
} elseif ($instance['thumb_link_type'] == 'custom') {
|
|
@@ -324,7 +364,15 @@ class GoogleMapsWidget extends WP_Widget {
|
|
| 324 |
} else {
|
| 325 |
$tmp .= 'markers=icon:' . urlencode($instance['thumb_pin_img']);
|
| 326 |
}
|
| 327 |
-
$tmp .= '%7Clabel:A%7C' . urlencode($instance['address']) . '&language=' . $lang
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 328 |
if ($instance['thumb_link_type'] == 'lightbox' || $instance['thumb_link_type'] == 'custom') {
|
| 329 |
$tmp .= '</a>';
|
| 330 |
}
|
| 2 |
/*
|
| 3 |
* Google Maps Widget
|
| 4 |
* Widget definition, admin GUI and front-end functions
|
| 5 |
+
* (c) Web factory Ltd, 2012 - 2015
|
| 6 |
*/
|
| 7 |
|
| 8 |
|
| 9 |
+
// this is an include only file
|
| 10 |
if (!defined('ABSPATH')) {
|
| 11 |
die();
|
| 12 |
}
|
| 40 |
'thumb_zoom' => '13',
|
| 41 |
'thumb_header' => '',
|
| 42 |
'thumb_footer' => '',
|
| 43 |
+
'thumb_color_scheme' => '',
|
| 44 |
'thumb_link_type' => 'lightbox',
|
| 45 |
'thumb_link' => '',
|
| 46 |
'lightbox_width' => '550',
|
| 99 |
|
| 100 |
$lightbox_skins = array(array('val' => 'light', 'label' => __('Light (default)', 'google-maps-widget')),
|
| 101 |
array('val' => 'dark', 'label' => __('Dark', 'google-maps-widget')));
|
| 102 |
+
|
| 103 |
+
$lightbox_bubbles = array(array('val' => '0', 'label' => __('Hide', 'google-maps-widget')),
|
| 104 |
+
array('val' => '1', 'label' => __('Show (default)', 'google-maps-widget')));
|
| 105 |
+
|
| 106 |
+
$lightbox_titles = array(array('val' => '0', 'label' => __('Do not show map title on lightbox', 'google-maps-widget')),
|
| 107 |
+
array('val' => '1', 'label' => __('Show map title on lightbox (default)', 'google-maps-widget')));
|
| 108 |
+
|
| 109 |
$thumb_pin_types = array(array('val' => 'predefined', 'label' => __('Predefined (default)', 'google-maps-widget')),
|
| 110 |
+
array('val' => 'custom', 'label' => __('Custom', 'google-maps-widget')));
|
| 111 |
|
| 112 |
$thumb_link_types = array(array('val' => 'lightbox', 'label' => __('Lightbox (default)', 'google-maps-widget')),
|
| 113 |
+
array('val' => 'custom', 'label' => __('Custom URL', 'google-maps-widget')),
|
| 114 |
+
array('val' => 'nolink', 'label' => __('Disable link', 'google-maps-widget')));
|
| 115 |
+
|
| 116 |
+
$thumb_color_schemes = array(array('val' => 'default', 'label' => __('Default', 'gmw')),
|
| 117 |
+
array('val' => 'new', 'label' => __('Refreshed by Google', 'gmw')));
|
| 118 |
+
|
| 119 |
+
if (GMW::is_activated()) {
|
| 120 |
+
array_push($thumb_color_schemes, array('val' => 'apple', 'label' => __('Apple', 'google-maps-widget')),
|
| 121 |
+
array('val' => 'gray', 'label' => __('Gray', 'google-maps-widget')),
|
| 122 |
+
array('val' => 'paper', 'label' => __('Paper', 'google-maps-widget')));
|
| 123 |
+
array_push($lightbox_skins, array('val' => 'noimage-blue', 'label' => __('Blue', 'google-maps-widget')),
|
| 124 |
+
array('val' => 'noimage-rounded', 'label' => __('Rounded', 'google-maps-widget')));
|
| 125 |
+
}
|
| 126 |
|
| 127 |
echo '<p><label for="' . $this->get_field_id('title') . '">' . __('Title', 'google-maps-widget') . ':</label><input class="widefat" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" type="text" value="' . esc_attr($title) . '" /></p>';
|
| 128 |
echo '<p><label for="' . $this->get_field_id('address') . '">' . __('Address', 'google-maps-widget') . ':</label><input class="widefat" id="' . $this->get_field_id('address') . '" name="' . $this->get_field_name('address') . '" type="text" value="' . esc_attr($address) . '" /></p>';
|
| 129 |
|
| 130 |
+
echo '<div class="gmw-tabs" id="tab-' . $this->id . '"><ul><li><a href="#gmw-thumb">' . __('Thumbnail map', 'google-maps-widget') . '</a></li><li><a href="#gmw-lightbox">' . __('Lightbox map', 'google-maps-widget') . '</a></li><li><a href="#gmw-info">' . __('Info & Support', 'google-maps-widget') . '</a></li></ul>';
|
| 131 |
echo '<div id="gmw-thumb">';
|
| 132 |
|
| 133 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_width') . '">' . __('Map Size', 'google-maps-widget') . ':</label>';
|
| 139 |
echo '<select id="' . $this->get_field_id('thumb_type') . '" name="' . $this->get_field_name('thumb_type') . '">';
|
| 140 |
GMW::create_select_options($map_types_thumb, $thumb_type);
|
| 141 |
echo '</select></p>';
|
| 142 |
+
|
| 143 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_pin_type') . '">' . __('Pin Type', 'google-maps-widget') . ':</label>';
|
| 144 |
echo '<select class="gmw_thumb_pin_type" id="' . $this->get_field_id('thumb_pin_type') . '" name="' . $this->get_field_name('thumb_pin_type') . '">';
|
| 145 |
GMW::create_select_options($thumb_pin_types, $thumb_pin_type);
|
| 154 |
echo '<select id="' . $this->get_field_id('thumb_pin_size') . '" name="' . $this->get_field_name('thumb_pin_size') . '">';
|
| 155 |
GMW::create_select_options($pin_sizes, $thumb_pin_size);
|
| 156 |
echo '</select></p>';
|
| 157 |
+
|
| 158 |
echo '<p class="gmw_thumb_pin_type_custom_section"><label class="gmw-label gmw-label-wide" for="' . $this->get_field_id('thumb_pin_img') . '">' . __('Custom Pin Image URL', 'google-maps-widget') . ':</label>';
|
| 159 |
echo '<input type="text" class="regular-text" id="' . $this->get_field_id('thumb_pin_img') . '" name="' . $this->get_field_name('thumb_pin_img') . '" value="' . esc_attr($thumb_pin_img) . '">';
|
| 160 |
|
| 168 |
GMW::create_select_options($thumb_link_types, $thumb_link_type);
|
| 169 |
echo '</select></p>';
|
| 170 |
|
| 171 |
+
echo '<p class="gmw_thumb_link_section"><label class="gmw-label" for="' . $this->get_field_id('thumb_link') . '">' . __('Custom URL', 'google-maps-widget') . ':</label>';
|
| 172 |
echo '<input class="regular-text" id="' . $this->get_field_id('thumb_link') . '" name="' . $this->get_field_name('thumb_link') . '" type="text" value="' . esc_attr($thumb_link) . '" /></p>';
|
| 173 |
|
| 174 |
+
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_color_scheme') . '">' . __('Color Scheme', 'google-maps-widget') . ':</label>';
|
| 175 |
+
echo '<select class="gmw_thumb_color_scheme" id="' . $this->get_field_id('thumb_color_scheme') . '" name="' . $this->get_field_name('thumb_color_scheme') . '">';
|
| 176 |
+
GMW::create_select_options($thumb_color_schemes, $thumb_color_scheme);
|
| 177 |
+
if (!GMW::is_activated()) {
|
| 178 |
+
echo '<option class="promo" value="-1">' . __('Add more schemes for free', 'google-maps-widget') . '</option>';
|
| 179 |
+
}
|
| 180 |
+
echo '</select></p>';
|
| 181 |
|
| 182 |
echo '<p><label for="' . $this->get_field_id('thumb_header') . '">' . __('Text Above Map', 'google-maps-widget') . ':</label>';
|
| 183 |
+
echo '<textarea class="widefat" rows="3" cols="20" id="' . $this->get_field_id('thumb_header') . '" name="' . $this->get_field_name('thumb_header') . '">'. esc_textarea($thumb_header) . '</textarea></p>';
|
| 184 |
|
| 185 |
echo '<p><label for="' . $this->get_field_id('thumb_footer') . '">' . __('Text Below Map', 'google-maps-widget') . ':</label>';
|
| 186 |
+
echo '<textarea class="widefat" rows="3" cols="20" id="' . $this->get_field_id('thumb_footer') . '" name="' . $this->get_field_name('thumb_footer') . '">'. esc_textarea($thumb_footer) . '</textarea></p>';
|
| 187 |
|
| 188 |
echo '</div>'; // thumbnail tab
|
| 189 |
echo '<div id="gmw-lightbox">';
|
| 203 |
GMW::create_select_options($zoom_levels, $lightbox_zoom);
|
| 204 |
echo '</select></p>';
|
| 205 |
|
| 206 |
+
echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_skin') . '">' . __('Lightbox Skin', 'google-maps-widget') . ':</label>';
|
| 207 |
+
echo '<select class="gmw_lightbox_skin" id="' . $this->get_field_id('lightbox_skin') . '" name="' . $this->get_field_name('lightbox_skin') . '">';
|
| 208 |
GMW::create_select_options($lightbox_skins, $lightbox_skin);
|
| 209 |
+
if (!GMW::is_activated()) {
|
| 210 |
+
echo '<option class="promo" value="-1">' . __('Add more skins for free', 'google-maps-widget') . '</option>';
|
| 211 |
+
}
|
| 212 |
echo '</select></p>';
|
| 213 |
|
| 214 |
+
echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_bubble') . '">' . __('Address Bubble', 'google-maps-widget') . ':</label>';
|
| 215 |
+
echo '<select id="' . $this->get_field_id('lightbox_bubble') . '" name="' . $this->get_field_name('lightbox_bubble') . '">';
|
| 216 |
+
GMW::create_select_options($lightbox_bubbles, $lightbox_bubble);
|
| 217 |
+
echo '</select></p>';
|
| 218 |
|
| 219 |
+
echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_title') . '">' . __('Map Title', 'google-maps-widget') . ': </label>';
|
| 220 |
+
echo '<select id="' . $this->get_field_id('lightbox_title') . '" name="' . $this->get_field_name('lightbox_title') . '">';
|
| 221 |
+
GMW::create_select_options($lightbox_titles, $lightbox_title);
|
| 222 |
+
echo '</select></p>';
|
| 223 |
|
| 224 |
echo '<p><label for="' . $this->get_field_id('lightbox_header') . '">' . __('Header Text', 'google-maps-widget') . ':</label>';
|
| 225 |
+
echo '<textarea class="widefat" rows="3" cols="20" id="' . $this->get_field_id('lightbox_header') . '" name="' . $this->get_field_name('lightbox_header') . '">'. esc_textarea($lightbox_header) . '</textarea></p>';
|
| 226 |
|
| 227 |
echo '<p><label for="' . $this->get_field_id('lightbox_footer') . '">' . __('Footer Text', 'google-maps-widget') . ':</label>';
|
| 228 |
+
echo '<textarea class="widefat" rows="3" cols="20" id="' . $this->get_field_id('lightbox_footer') . '" name="' . $this->get_field_name('lightbox_footer') . '">'. esc_textarea($lightbox_footer) . '</textarea></p>';
|
| 229 |
|
| 230 |
echo '</div>'; // lightbox tab
|
| 231 |
+
|
| 232 |
+
echo '<div id="gmw-info">';
|
| 233 |
+
echo '<h3>Support</h3><p>If you have any problems, questions or would like a new feature added post it on the <a href="https://wordpress.org/support/plugin/google-maps-widget" target="_blank">official support forum</a>. It\'s the only place to get support. Since it\'s free and community powered please be patient. <a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?business=gordan@webfactoryltd.com&cmd=_xclick¤cy_code=USD&amount=19&item_name=Premium%20support%20for%20Google%20Maps%20Widget">Premium support</a> is available for $19.</p>';
|
| 234 |
+
echo '<h3>Activate extra features & options</h3><p>If you subscribe to our mailing list we\'ll instantly activate additional features in the plugin! At the moment those features are 3 additional thumbnail map skins and 2 additional lightbox skins. More <i>activate by subscribing</i> features will be available soon!<br>';
|
| 235 |
+
if (GMW::is_activated()) {
|
| 236 |
+
echo 'You\'ve already subscribed and activated extra features. Thank you!';
|
| 237 |
+
} else {
|
| 238 |
+
echo 'Subscribe and <a class="open_promo_dialog" href="#">activate extra features</a>.';
|
| 239 |
+
}
|
| 240 |
+
echo '</p>';
|
| 241 |
+
echo '<h3>Rate the plugin & spread the word</h3><p>It won\'t take you more than a minute but it will help us immensely. So please - <a href="https://wordpress.org/support/view/plugin-reviews/google-maps-widget" target="_blank">rate the plugin</a>. Or spread the word by <a href="https://twitter.com/intent/tweet?via=WebFactoryLtd&text=' . urlencode('I\'m using the #free Google Maps Widget for #wordpress. You can grab it too at http://goo.gl/2qcbbf') . '" target="_blank">tweeting about it</a>. Thank you!</p>';
|
| 242 |
+
echo '</div>'; // info tab
|
| 243 |
+
|
| 244 |
+
echo '</div><p></p>'; // tabs
|
| 245 |
+
|
| 246 |
+
if (!GMW::is_activated()) {
|
| 247 |
+
echo '<p><i>' . __('Subscribe to our newsletter and <a href="#" class="open_promo_dialog">get extra features</a> for free.', 'google-maps-widget') . '</i></p>';
|
| 248 |
+
}
|
| 249 |
} // form
|
| 250 |
|
| 251 |
|
| 267 |
$instance['thumb_link'] = trim($new_instance['thumb_link']);
|
| 268 |
$instance['thumb_header'] = trim($new_instance['thumb_header']);
|
| 269 |
$instance['thumb_footer'] = trim($new_instance['thumb_footer']);
|
| 270 |
+
$instance['thumb_color_scheme'] = $new_instance['thumb_color_scheme'];
|
| 271 |
$instance['lightbox_width'] = (int) $new_instance['lightbox_width'];
|
| 272 |
$instance['lightbox_height'] = (int) $new_instance['lightbox_height'];
|
| 273 |
$instance['lightbox_type'] = $new_instance['lightbox_type'];
|
| 274 |
$instance['lightbox_zoom'] = $new_instance['lightbox_zoom'];
|
| 275 |
+
$instance['lightbox_bubble'] = $new_instance['lightbox_bubble'];
|
| 276 |
+
$instance['lightbox_title'] = $new_instance['lightbox_title'];
|
| 277 |
$instance['lightbox_header'] = trim($new_instance['lightbox_header']);
|
| 278 |
$instance['lightbox_footer'] = trim($new_instance['lightbox_footer']);
|
| 279 |
$instance['lightbox_skin'] = $new_instance['lightbox_skin'];
|
| 286 |
function widget($args, $instance) {
|
| 287 |
$out = $tmp = '';
|
| 288 |
|
| 289 |
+
$thumb_styles = array(
|
| 290 |
+
'apple' => 'style=feature:water|element:geometry|color:0xa2daf2|&style=feature:landscape.man_made|element:geometry|color:0xf7f1df|&style=feature:landscape.natural|element:geometry|color:0xd0e3b4|&style=feature:landscape.natural.terrain|element:geometry|visibility:off|&style=feature:poi.park|element:geometry|color:0xbde6ab|&style=feature:poi|element:labels|visibility:off|&style=feature:poi.medical|element:geometry|color:0xfbd3da|&style=feature:poi.business|element:all|visibility:off|&style=feature:road|element:geometry.stroke|visibility:off|&style=feature:road|element:labels|visibility:off|&style=feature:road.highway|element:geometry.fill|color:0xffe15f|&style=feature:road.highway|element:geometry.stroke|color:0xefd151|&style=feature:road.arterial|element:geometry.fill|color:0xffffff|&style=feature:road.local|element:geometry.fill|color:black|&style=feature:transit.station.airport|element:geometry.fill|color:0xcfb2db|',
|
| 291 |
+
'gray' => 'style=feature:landscape|element:all|saturation:-100|lightness:65|visibility:on|&style=feature:poi|element:all|saturation:-100|lightness:51|visibility:simplified|&style=feature:road.highway|element:all|saturation:-100|visibility:simplified|&style=feature:road.arterial|element:all|saturation:-100|lightness:30|visibility:on|&style=feature:road.local|element:all|saturation:-100|lightness:40|visibility:on|&style=feature:transit|element:all|saturation:-100|visibility:simplified|&style=feature:administrative.province|element:all|visibility:off|&style=feature:water|element:labels|visibility:on|lightness:-25|saturation:-100|&style=feature:water|element:geometry|hue:0xffff00|lightness:-25|saturation:-97|',
|
| 292 |
+
'paper' => 'style=feature:landscape|element:all|hue:0xF1FF00|saturation:-27.4|lightness:9.4|gamma:1|&style=feature:road.highway|element:all|hue:0x0099FF|saturation:-20|lightness:36.4|gamma:1|&style=feature:road.arterial|element:all|hue:0x00FF4F|saturation:0|lightness:0|gamma:1|&style=feature:road.local|element:all|hue:0xFFB300|saturation:-38|lightness:11.2|gamma:1|&style=feature:water|element:all|hue:0x00B6FF|saturation:4.2|lightness:-63.4|gamma:1|&style=feature:poi|element:all|hue:0x9FFF00|saturation:0|lightness:0|gamma:1|');
|
| 293 |
+
|
| 294 |
extract($args, EXTR_SKIP);
|
| 295 |
|
| 296 |
$ll = '';
|
| 305 |
if (!$lang) {
|
| 306 |
$lang = 'en';
|
| 307 |
}
|
| 308 |
+
|
| 309 |
// legacy fix for older versions; it's auto-fixed on first widget save but has to be here
|
| 310 |
if(!$instance['lightbox_skin']) {
|
| 311 |
$instance['lightbox_skin'] = 'light';
|
| 329 |
if (!isset($instance['thumb_pin_type']) || empty($instance['thumb_pin_type'])) {
|
| 330 |
$instance['thumb_pin_type'] = 'predefined';
|
| 331 |
}
|
| 332 |
+
|
| 333 |
if (!isset($instance['thumb_link_type']) || empty($instance['thumb_link_type'])) {
|
| 334 |
$instance['thumb_link_type'] = 'lightbox';
|
| 335 |
}
|
| 336 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 337 |
$title = empty($instance['title'])? ' ' : apply_filters('widget_title', $instance['title']);
|
| 338 |
if (!empty($title)) {
|
| 339 |
$out .= $before_title . $title . $after_title;
|
| 343 |
$tmp .= wpautop(do_shortcode($instance['thumb_header']));
|
| 344 |
}
|
| 345 |
$tmp .= '<p>';
|
| 346 |
+
|
| 347 |
if ($instance['thumb_link_type'] == 'lightbox') {
|
| 348 |
$alt = __('Click to open larger map', 'google-maps-widget');
|
| 349 |
} else {
|
| 350 |
$alt = esc_attr($instance['address']);
|
| 351 |
}
|
| 352 |
+
|
| 353 |
if ($instance['thumb_link_type'] == 'lightbox') {
|
| 354 |
$tmp .= '<a class="gmw-thumbnail-map gmw-lightbox-enabled" href="#gmw-dialog-' . $widget_id . '" title="' . __('Click to open larger map', 'google-maps-widget') . '">';
|
| 355 |
} elseif ($instance['thumb_link_type'] == 'custom') {
|
| 364 |
} else {
|
| 365 |
$tmp .= 'markers=icon:' . urlencode($instance['thumb_pin_img']);
|
| 366 |
}
|
| 367 |
+
$tmp .= '%7Clabel:A%7C' . urlencode($instance['address']) . '&language=' . $lang;
|
| 368 |
+
if (!isset($instance['thumb_color_scheme']) || $instance['thumb_color_scheme'] == 'default') {
|
| 369 |
+
$tmp .= '&visual_refresh=false';
|
| 370 |
+
} elseif ($instance['thumb_color_scheme'] == 'new') {
|
| 371 |
+
$tmp .= '&visual_refresh=true';
|
| 372 |
+
} elseif (GMW::is_activated()) {
|
| 373 |
+
$tmp .= '&' . str_replace('&', '&', $thumb_styles[$instance['thumb_color_scheme']]);
|
| 374 |
+
}
|
| 375 |
+
$tmp .= '">';
|
| 376 |
if ($instance['thumb_link_type'] == 'lightbox' || $instance['thumb_link_type'] == 'custom') {
|
| 377 |
$tmp .= '</a>';
|
| 378 |
}
|
google-maps-widget.php
CHANGED
|
@@ -4,12 +4,12 @@ Plugin Name: Google Maps Widget
|
|
| 4 |
Plugin URI: http://www.googlemapswidget.com/
|
| 5 |
Description: Display a single-image super-fast loading Google map in a widget. A larger, full featured map is available on click in a lightbox.
|
| 6 |
Author: Web factory Ltd
|
| 7 |
-
Version:
|
| 8 |
Author URI: http://www.webfactoryltd.com/
|
| 9 |
Text Domain: google-maps-widget
|
| 10 |
Domain Path: lang
|
| 11 |
|
| 12 |
-
Copyright 2012 -
|
| 13 |
|
| 14 |
This program is free software; you can redistribute it and/or modify
|
| 15 |
it under the terms of the GNU General Public License, version 2, as
|
|
@@ -31,7 +31,7 @@ if (!defined('ABSPATH')) {
|
|
| 31 |
}
|
| 32 |
|
| 33 |
|
| 34 |
-
define('GMW_VER', '
|
| 35 |
define('GMW_OPTIONS', 'gmw_options');
|
| 36 |
define('GMW_CRON', 'gmw_cron');
|
| 37 |
|
|
@@ -49,6 +49,7 @@ class GMW {
|
|
| 49 |
// check if minimal required WP version is used
|
| 50 |
self::check_wp_version(3.3);
|
| 51 |
|
|
|
|
| 52 |
self::upgrade();
|
| 53 |
|
| 54 |
// aditional links in plugin description
|
|
@@ -59,6 +60,13 @@ class GMW {
|
|
| 59 |
// enqueue admin scripts
|
| 60 |
add_action('admin_enqueue_scripts', array(__CLASS__, 'admin_enqueue_scripts'));
|
| 61 |
add_action('customize_controls_enqueue_scripts', array(__CLASS__, 'admin_enqueue_scripts'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
} else {
|
| 63 |
// enqueue frontend scripts
|
| 64 |
add_action('wp_enqueue_scripts', array(__CLASS__, 'enqueue_scripts'));
|
|
@@ -163,14 +171,14 @@ class GMW {
|
|
| 163 |
} // foreach $widgets
|
| 164 |
|
| 165 |
echo $out;
|
| 166 |
-
} //
|
| 167 |
|
| 168 |
|
| 169 |
// enqueue frontend scripts if necessary
|
| 170 |
static function enqueue_scripts() {
|
| 171 |
if (is_active_widget(false, false, 'googlemapswidget', true)) {
|
| 172 |
wp_enqueue_style('gmw', plugins_url('/css/gmw.css', __FILE__), array(), GMW_VER);
|
| 173 |
-
wp_enqueue_script('gmw-colorbox', plugins_url('/js/jquery.colorbox
|
| 174 |
wp_enqueue_script('gmw', plugins_url('/js/gmw.js', __FILE__), array('jquery'), GMW_VER, true);
|
| 175 |
}
|
| 176 |
} // enqueue_scripts
|
|
@@ -182,8 +190,11 @@ class GMW {
|
|
| 182 |
|
| 183 |
if (self::is_plugin_admin_page() || isset($wp_customize)) {
|
| 184 |
wp_enqueue_script('jquery-ui-tabs');
|
|
|
|
| 185 |
wp_enqueue_script('gmw-cookie', plugins_url('js/jquery.cookie.js', __FILE__), array('jquery'), GMW_VER, true);
|
| 186 |
wp_enqueue_script('gmw-admin', plugins_url('js/gmw-admin.js', __FILE__), array('jquery'), GMW_VER, true);
|
|
|
|
|
|
|
| 187 |
wp_enqueue_style('gmw-admin', plugins_url('css/gmw-admin.css', __FILE__), array(), GMW_VER);
|
| 188 |
} // if
|
| 189 |
} // admin_enqueue_scripts
|
|
@@ -201,6 +212,100 @@ class GMW {
|
|
| 201 |
} // is_plugin_admin_page
|
| 202 |
|
| 203 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
// helper function for creating dropdowns
|
| 205 |
static function create_select_options($options, $selected = null, $output = true) {
|
| 206 |
$out = "\n";
|
|
@@ -220,7 +325,7 @@ class GMW {
|
|
| 220 |
}
|
| 221 |
} // create_select_options
|
| 222 |
|
| 223 |
-
|
| 224 |
// fetch coordinates based on the address
|
| 225 |
static function get_coordinates($address, $force_refresh = false) {
|
| 226 |
$address_hash = md5('gmw' . $address);
|
|
@@ -231,7 +336,7 @@ class GMW {
|
|
| 231 |
|
| 232 |
if (!is_wp_error($result) && $result['response']['code'] == 200) {
|
| 233 |
$data = new SimpleXMLElement($result['body']);
|
| 234 |
-
|
| 235 |
if ($data->status == 'OK') {
|
| 236 |
$cache_value['lat'] = (string) $data->result->geometry->location->lat;
|
| 237 |
$cache_value['lng'] = (string) $data->result->geometry->location->lng;
|
| 4 |
Plugin URI: http://www.googlemapswidget.com/
|
| 5 |
Description: Display a single-image super-fast loading Google map in a widget. A larger, full featured map is available on click in a lightbox.
|
| 6 |
Author: Web factory Ltd
|
| 7 |
+
Version: 2.0
|
| 8 |
Author URI: http://www.webfactoryltd.com/
|
| 9 |
Text Domain: google-maps-widget
|
| 10 |
Domain Path: lang
|
| 11 |
|
| 12 |
+
Copyright 2012 - 2015 Web factory Ltd (email : gmw@webfactoryltd.com)
|
| 13 |
|
| 14 |
This program is free software; you can redistribute it and/or modify
|
| 15 |
it under the terms of the GNU General Public License, version 2, as
|
| 31 |
}
|
| 32 |
|
| 33 |
|
| 34 |
+
define('GMW_VER', '2.0');
|
| 35 |
define('GMW_OPTIONS', 'gmw_options');
|
| 36 |
define('GMW_CRON', 'gmw_cron');
|
| 37 |
|
| 49 |
// check if minimal required WP version is used
|
| 50 |
self::check_wp_version(3.3);
|
| 51 |
|
| 52 |
+
// check some variables
|
| 53 |
self::upgrade();
|
| 54 |
|
| 55 |
// aditional links in plugin description
|
| 60 |
// enqueue admin scripts
|
| 61 |
add_action('admin_enqueue_scripts', array(__CLASS__, 'admin_enqueue_scripts'));
|
| 62 |
add_action('customize_controls_enqueue_scripts', array(__CLASS__, 'admin_enqueue_scripts'));
|
| 63 |
+
|
| 64 |
+
// JS dialog markup
|
| 65 |
+
add_action('admin_footer', array(__CLASS__, 'admin_dialogs_markup'));
|
| 66 |
+
|
| 67 |
+
// register AJAX endpoints
|
| 68 |
+
add_action('wp_ajax_gmw_subscribe', array(__CLASS__, 'email_subscribe'));
|
| 69 |
+
add_action('wp_ajax_gmw_activate', array(__CLASS__, 'activate_via_code'));
|
| 70 |
} else {
|
| 71 |
// enqueue frontend scripts
|
| 72 |
add_action('wp_enqueue_scripts', array(__CLASS__, 'enqueue_scripts'));
|
| 171 |
} // foreach $widgets
|
| 172 |
|
| 173 |
echo $out;
|
| 174 |
+
} // dialogs_markup
|
| 175 |
|
| 176 |
|
| 177 |
// enqueue frontend scripts if necessary
|
| 178 |
static function enqueue_scripts() {
|
| 179 |
if (is_active_widget(false, false, 'googlemapswidget', true)) {
|
| 180 |
wp_enqueue_style('gmw', plugins_url('/css/gmw.css', __FILE__), array(), GMW_VER);
|
| 181 |
+
wp_enqueue_script('gmw-colorbox', plugins_url('/js/jquery.colorbox.min.js', __FILE__), array('jquery'), GMW_VER, true);
|
| 182 |
wp_enqueue_script('gmw', plugins_url('/js/gmw.js', __FILE__), array('jquery'), GMW_VER, true);
|
| 183 |
}
|
| 184 |
} // enqueue_scripts
|
| 190 |
|
| 191 |
if (self::is_plugin_admin_page() || isset($wp_customize)) {
|
| 192 |
wp_enqueue_script('jquery-ui-tabs');
|
| 193 |
+
wp_enqueue_script('jquery-ui-dialog');
|
| 194 |
wp_enqueue_script('gmw-cookie', plugins_url('js/jquery.cookie.js', __FILE__), array('jquery'), GMW_VER, true);
|
| 195 |
wp_enqueue_script('gmw-admin', plugins_url('js/gmw-admin.js', __FILE__), array('jquery'), GMW_VER, true);
|
| 196 |
+
|
| 197 |
+
wp_enqueue_style('wp-jquery-ui-dialog');
|
| 198 |
wp_enqueue_style('gmw-admin', plugins_url('css/gmw-admin.css', __FILE__), array(), GMW_VER);
|
| 199 |
} // if
|
| 200 |
} // admin_enqueue_scripts
|
| 212 |
} // is_plugin_admin_page
|
| 213 |
|
| 214 |
|
| 215 |
+
// check if activate-by-subscribing features have been activated
|
| 216 |
+
static function is_activated() {
|
| 217 |
+
$options = get_option(GMW_OPTIONS);
|
| 218 |
+
|
| 219 |
+
if (isset($options['activated']) && $options['activated'] === true) {
|
| 220 |
+
return true;
|
| 221 |
+
} else {
|
| 222 |
+
return false;
|
| 223 |
+
}
|
| 224 |
+
} // is_activated
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
// echo markup for promo dialog; only on widgets page
|
| 228 |
+
static function admin_dialogs_markup() {
|
| 229 |
+
if (!self::is_plugin_admin_page()) {
|
| 230 |
+
return false;
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
$out = '<div id="gmw_promo_dialog" style="display: none;">';
|
| 234 |
+
$out .= '<div id="gmw_dialog_subscribe"><h3 class="center">Subscribe to our newsletter and get extra features & options for free</h3>';
|
| 235 |
+
$out .= '<p class="center"><input type="text" id="gmw_name" name="gmw_name" placeholder="Your name"> <input type="text" name="gmw_email" id="gmw_email" placeholder="Your email"></p>';
|
| 236 |
+
//$out .= '<p class="error center">Error message that is not always visible</p>';
|
| 237 |
+
$out .= '<p class="center"><a id="gmw_subscribe" href="#" class="button button-primary">Subscribe & activate features</a> <a href="#" class="button button-secondary" id="gmw_already_subscribed">I\'m already subscribed</a></p>';
|
| 238 |
+
$out .= '<p><b>Why subscribe?</b></p><ul><li>we\'ll never share your email address</li><li>we won\'t spam you or overwhelm with emails</li><li>be the first to get notified about new features</li><li>you\'ll get all future upgrades for free as well</li><li>you\'ll get discounts for our premium WP plugins</li></ul>';
|
| 239 |
+
$out .= '</div>';
|
| 240 |
+
$out .= '<div id="gmw_dialog_activate"><h3 class="center">Enter your code and activate extra features</h3><p class="center"><input type="text" id="gmw_code" name="gmw_code" placeholder="Your activation code"> <a href="#" class="button button-primary" id="gmw_activate">Activate</a></p>';
|
| 241 |
+
//$out .= '<p class="error center">Error message</p>';
|
| 242 |
+
$out .= '<p><b>FAQ</b></p><ul><li>Already subscribed? Enter your activation code above.</li><li>Didn\'t receive the email? Check your SPAM folder.</li><li>Lost your code or having other problems? <a href="mailto:gmw@webfactoryltd.com?subject=Lost+activation+code">Email us</a>.</li><li>Code is valid for an unlimited number of plugin installations.</li></ul>';
|
| 243 |
+
$out .= '</div>'; // activate screen
|
| 244 |
+
$out .= '</div>'; // dialog
|
| 245 |
+
|
| 246 |
+
echo $out;
|
| 247 |
+
} // admin_dialogs_markup
|
| 248 |
+
|
| 249 |
+
|
| 250 |
+
// send user's email to MailChimp via our server
|
| 251 |
+
static function email_subscribe() {
|
| 252 |
+
$name = trim($_POST['name']);
|
| 253 |
+
$email = trim($_POST['email']);
|
| 254 |
+
if (defined('WPLANG')) {
|
| 255 |
+
$lang = strtolower(substr(WPLANG, 0, 2));
|
| 256 |
+
} else {
|
| 257 |
+
$lang = 'en';
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
$res = wp_remote_post('http://www.googlemapswidget.com/subscribe.php', array('body' => array('name' => $name, 'email' => $email, 'lang' => $lang, 'ip' => $_SERVER['REMOTE_ADDR'], 'site' => get_home_url())));
|
| 261 |
+
|
| 262 |
+
// something's wrong with our server
|
| 263 |
+
if ($res['response']['code'] != 200 || is_wp_error($res)) {
|
| 264 |
+
echo 'err';
|
| 265 |
+
die();
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
if ($res['body'] == 'ok') {
|
| 269 |
+
echo "ok";
|
| 270 |
+
die();
|
| 271 |
+
} elseif ($res['body'] == 'duplicate') {
|
| 272 |
+
echo "duplicate";
|
| 273 |
+
die();
|
| 274 |
+
} else {
|
| 275 |
+
// todo var_dump($res['body']);
|
| 276 |
+
echo 'err';
|
| 277 |
+
die();
|
| 278 |
+
}
|
| 279 |
+
} // email_subscribe
|
| 280 |
+
|
| 281 |
+
|
| 282 |
+
// check activation code and save if valid
|
| 283 |
+
static function activate_via_code() {
|
| 284 |
+
$code = trim($_GET['code']);
|
| 285 |
+
|
| 286 |
+
if (self::validate_activation_code($code)) {
|
| 287 |
+
$options = get_option(GMW_OPTIONS);
|
| 288 |
+
$options['activation_code'] = $code;
|
| 289 |
+
$options['activated'] = true;
|
| 290 |
+
update_option(GMW_OPTIONS, $options);
|
| 291 |
+
|
| 292 |
+
die("1");
|
| 293 |
+
} else {
|
| 294 |
+
die("0");
|
| 295 |
+
}
|
| 296 |
+
} // email_activate
|
| 297 |
+
|
| 298 |
+
|
| 299 |
+
// check if activation code for additional features is valid
|
| 300 |
+
static function validate_activation_code($code) {
|
| 301 |
+
if (strlen($code) == 6 && ($code[0] + $code[5]) == 9) {
|
| 302 |
+
return true;
|
| 303 |
+
} else {
|
| 304 |
+
return false;
|
| 305 |
+
}
|
| 306 |
+
} // validate_activation_code
|
| 307 |
+
|
| 308 |
+
|
| 309 |
// helper function for creating dropdowns
|
| 310 |
static function create_select_options($options, $selected = null, $output = true) {
|
| 311 |
$out = "\n";
|
| 325 |
}
|
| 326 |
} // create_select_options
|
| 327 |
|
| 328 |
+
|
| 329 |
// fetch coordinates based on the address
|
| 330 |
static function get_coordinates($address, $force_refresh = false) {
|
| 331 |
$address_hash = md5('gmw' . $address);
|
| 336 |
|
| 337 |
if (!is_wp_error($result) && $result['response']['code'] == 200) {
|
| 338 |
$data = new SimpleXMLElement($result['body']);
|
| 339 |
+
|
| 340 |
if ($data->status == 'OK') {
|
| 341 |
$cache_value['lat'] = (string) $data->result->geometry->location->lat;
|
| 342 |
$cache_value['lng'] = (string) $data->result->geometry->location->lng;
|
js/gmw-admin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
/*
|
| 2 |
* Google Maps Widget
|
| 3 |
-
* (c) Web factory Ltd, 2012 -
|
| 4 |
*/
|
| 5 |
|
| 6 |
jQuery(function($) {
|
|
@@ -9,6 +9,9 @@ jQuery(function($) {
|
|
| 9 |
change_link_type(el);
|
| 10 |
$('.gmw_thumb_pin_type', el).on('change', function() { change_pin_type(el) });
|
| 11 |
$('.gmw_thumb_link_type', el).on('change', function() { change_link_type(el) });
|
|
|
|
|
|
|
|
|
|
| 12 |
el_id = $(el).attr('id');
|
| 13 |
$(el).tabs({ active: get_active_tab(el_id),
|
| 14 |
activate: function(event, ui) { save_active_tab(this); }
|
|
@@ -35,7 +38,7 @@ jQuery(function($) {
|
|
| 35 |
$('.gmw_thumb_link_section', widget).hide();
|
| 36 |
}
|
| 37 |
} // link_type
|
| 38 |
-
|
| 39 |
// show/hide custom pin URL field based on user's pin type choice
|
| 40 |
function change_pin_type(widget) {
|
| 41 |
if ($('.gmw_thumb_pin_type', widget).val() == 'custom') {
|
|
@@ -47,6 +50,107 @@ jQuery(function($) {
|
|
| 47 |
}
|
| 48 |
} // pin_type
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
// re-tab on GUI rebuild
|
| 51 |
$('div[id*="googlemapswidget"]').ajaxSuccess(function(event, request, option) {
|
| 52 |
$('.gmw-tabs').each(function(i, el) {
|
|
@@ -54,10 +158,21 @@ jQuery(function($) {
|
|
| 54 |
change_link_type(el);
|
| 55 |
$('.gmw_thumb_pin_type', el).on('change', function() { change_pin_type(el) });
|
| 56 |
$('.gmw_thumb_link_type', el).on('change', function() { change_link_type(el) });
|
|
|
|
|
|
|
|
|
|
| 57 |
el_id = $(el).attr('id');
|
| 58 |
$(el).tabs({ active: get_active_tab(el_id),
|
| 59 |
activate: function(event, ui) { save_active_tab(this); }
|
| 60 |
});
|
| 61 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
});
|
| 63 |
}); // onload
|
| 1 |
/*
|
| 2 |
* Google Maps Widget
|
| 3 |
+
* (c) Web factory Ltd, 2012 - 2015
|
| 4 |
*/
|
| 5 |
|
| 6 |
jQuery(function($) {
|
| 9 |
change_link_type(el);
|
| 10 |
$('.gmw_thumb_pin_type', el).on('change', function() { change_pin_type(el) });
|
| 11 |
$('.gmw_thumb_link_type', el).on('change', function() { change_link_type(el) });
|
| 12 |
+
$('.gmw_thumb_color_scheme', el).on('change', function() { gmw_promo_option_change(el, '.gmw_thumb_color_scheme') });
|
| 13 |
+
$('.gmw_lightbox_skin', el).on('change', function() { gmw_promo_option_change(el, '.gmw_lightbox_skin') });
|
| 14 |
+
|
| 15 |
el_id = $(el).attr('id');
|
| 16 |
$(el).tabs({ active: get_active_tab(el_id),
|
| 17 |
activate: function(event, ui) { save_active_tab(this); }
|
| 38 |
$('.gmw_thumb_link_section', widget).hide();
|
| 39 |
}
|
| 40 |
} // link_type
|
| 41 |
+
|
| 42 |
// show/hide custom pin URL field based on user's pin type choice
|
| 43 |
function change_pin_type(widget) {
|
| 44 |
if ($('.gmw_thumb_pin_type', widget).val() == 'custom') {
|
| 50 |
}
|
| 51 |
} // pin_type
|
| 52 |
|
| 53 |
+
// opens promo dialog when special value is selected in widget's options
|
| 54 |
+
function gmw_promo_option_change(widget, el) {
|
| 55 |
+
if (($(el, widget).val()) == '-1') {
|
| 56 |
+
$(el, widget).find('option').attr('selected', '');
|
| 57 |
+
$(el, widget).find('option:first').attr('selected', 'selected');
|
| 58 |
+
gmw_open_promo_dialog(widget);
|
| 59 |
+
}
|
| 60 |
+
} // promo_option_change
|
| 61 |
+
|
| 62 |
+
// open promo/activation dialog
|
| 63 |
+
$('.open_promo_dialog').on('click', function(e) {
|
| 64 |
+
gmw_open_promo_dialog(this);
|
| 65 |
+
|
| 66 |
+
e.preventDefault();
|
| 67 |
+
return false;
|
| 68 |
+
});
|
| 69 |
+
|
| 70 |
+
// button in dialog
|
| 71 |
+
$('#gmw_already_subscribed').on('click', function(e) {
|
| 72 |
+
$('#gmw_dialog_subscribe').hide();
|
| 73 |
+
$('#gmw_dialog_activate').show();
|
| 74 |
+
|
| 75 |
+
e.preventDefault();
|
| 76 |
+
return false;
|
| 77 |
+
});
|
| 78 |
+
|
| 79 |
+
// button in dialog
|
| 80 |
+
$('#gmw_subscribe').on('click', function(e) {
|
| 81 |
+
e.preventDefault();
|
| 82 |
+
|
| 83 |
+
if ($('#gmw_name').val().length < 3) {
|
| 84 |
+
alert('Please double-check your name.');
|
| 85 |
+
$('#gmw_name').focus().select();
|
| 86 |
+
return false;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
| 90 |
+
if (!re.test($('#gmw_email').val())) {
|
| 91 |
+
alert('Please double-check your email address.');
|
| 92 |
+
$('#gmw_email').focus().select();
|
| 93 |
+
return false;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
$.post(ajaxurl, { action: 'gmw_subscribe', 'name': $('#gmw_name').val(), 'email': $('#gmw_email').val()}, function(data) {
|
| 97 |
+
if (data == 'ok') {
|
| 98 |
+
$('#gmw_dialog_subscribe').hide();
|
| 99 |
+
$('#gmw_dialog_activate').show();
|
| 100 |
+
alert('Check your inbox. Email with activation code is on its way.');
|
| 101 |
+
} else if (data == 'duplicate') {
|
| 102 |
+
$('#gmw_dialog_subscribe').hide();
|
| 103 |
+
$('#gmw_dialog_activate').show();
|
| 104 |
+
alert('You are already subscribed to our list. One activation code is valid for all sites so just use the code you already have.');
|
| 105 |
+
} else {
|
| 106 |
+
alert('Something is not right on our end. Sorry :( Try again later.');
|
| 107 |
+
}
|
| 108 |
+
});
|
| 109 |
+
|
| 110 |
+
return false;
|
| 111 |
+
});
|
| 112 |
+
|
| 113 |
+
// button in dialog
|
| 114 |
+
// check code and activate
|
| 115 |
+
$('#gmw_activate').on('click', function(e) {
|
| 116 |
+
e.preventDefault();
|
| 117 |
+
|
| 118 |
+
$.get(ajaxurl, { action: 'gmw_activate', 'code': $('#gmw_code').val()}, function(data) {
|
| 119 |
+
if (data == '1') {
|
| 120 |
+
alert('Superb! Extra features are active ;)');
|
| 121 |
+
if ($('#gmw_promo_dialog').data('widget-id')) {
|
| 122 |
+
$('#' + $('#gmw_promo_dialog').data('widget-id') + ' .widget-control-save').trigger('click');
|
| 123 |
+
}
|
| 124 |
+
$('#gmw_promo_dialog').dialog('close');
|
| 125 |
+
} else {
|
| 126 |
+
alert('Please double-check the code. It does not appear to be valid.');
|
| 127 |
+
$('#gmw_code').focus().select();
|
| 128 |
+
}
|
| 129 |
+
});
|
| 130 |
+
|
| 131 |
+
return false;
|
| 132 |
+
});
|
| 133 |
+
|
| 134 |
+
// open promo/activation dialog
|
| 135 |
+
function gmw_open_promo_dialog(widget) {
|
| 136 |
+
$('#gmw_dialog_subscribe').show();
|
| 137 |
+
$('#gmw_dialog_activate').hide();
|
| 138 |
+
|
| 139 |
+
$('#gmw_promo_dialog').dialog({
|
| 140 |
+
'dialogClass' : 'wp-dialog',
|
| 141 |
+
'modal' : true,
|
| 142 |
+
'width': 650,
|
| 143 |
+
'title': 'Google Maps Widget - activate extra features',
|
| 144 |
+
'autoOpen' : false,
|
| 145 |
+
'closeOnEscape' : true,
|
| 146 |
+
close: function(event, ui) { $('#gmw_promo_dialog').data('widget-id', '') }
|
| 147 |
+
}).dialog('open');
|
| 148 |
+
|
| 149 |
+
if (widget) {
|
| 150 |
+
$('#gmw_promo_dialog').data('widget-id', $(widget).parents('div.widget').attr('id'));
|
| 151 |
+
}
|
| 152 |
+
} // open_promo_dialog
|
| 153 |
+
|
| 154 |
// re-tab on GUI rebuild
|
| 155 |
$('div[id*="googlemapswidget"]').ajaxSuccess(function(event, request, option) {
|
| 156 |
$('.gmw-tabs').each(function(i, el) {
|
| 158 |
change_link_type(el);
|
| 159 |
$('.gmw_thumb_pin_type', el).on('change', function() { change_pin_type(el) });
|
| 160 |
$('.gmw_thumb_link_type', el).on('change', function() { change_link_type(el) });
|
| 161 |
+
$('.gmw_thumb_color_scheme', el).on('change', function() { gmw_promo_option_change(el, '.gmw_thumb_color_scheme'); });
|
| 162 |
+
$('.gmw_lightbox_skin', el).on('change', function() { gmw_promo_option_change(el, '.gmw_lightbox_skin') });
|
| 163 |
+
|
| 164 |
el_id = $(el).attr('id');
|
| 165 |
$(el).tabs({ active: get_active_tab(el_id),
|
| 166 |
activate: function(event, ui) { save_active_tab(this); }
|
| 167 |
});
|
| 168 |
});
|
| 169 |
+
|
| 170 |
+
// todo fix multiple actions on single selector
|
| 171 |
+
$('.open_promo_dialog').on('click', function(e) {
|
| 172 |
+
gmw_open_promo_dialog(this);
|
| 173 |
+
|
| 174 |
+
e.preventDefault();
|
| 175 |
+
return false;
|
| 176 |
+
});
|
| 177 |
});
|
| 178 |
}); // onload
|
js/gmw.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
/*
|
| 2 |
* Google Maps Widget
|
| 3 |
-
* (c) Web factory Ltd, 2012 -
|
| 4 |
*/
|
| 5 |
|
| 6 |
jQuery(function($) {
|
| 7 |
-
$('a.gmw-thumbnail-map.gmw-lightbox-enabled').click(function() {
|
|
|
|
|
|
|
| 8 |
dialog = $($(this).attr('href'));
|
| 9 |
map_width = dialog.attr('data-map-width');
|
| 10 |
map_height = dialog.attr('data-map-height');
|
|
@@ -12,10 +14,13 @@ jQuery(function($) {
|
|
| 12 |
map_title = dialog.attr('title');
|
| 13 |
map_skin = dialog.attr('data-map-skin');
|
| 14 |
|
| 15 |
-
|
| 16 |
content.filter('.gmw-map').html('<iframe width="' + map_width + 'px" height="' + map_height + 'px" src="' + map_url + '"></iframe>');
|
| 17 |
|
| 18 |
-
$.colorbox({ html: content,
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
return false;
|
| 21 |
});
|
| 1 |
/*
|
| 2 |
* Google Maps Widget
|
| 3 |
+
* (c) Web factory Ltd, 2012 - 2015
|
| 4 |
*/
|
| 5 |
|
| 6 |
jQuery(function($) {
|
| 7 |
+
$('a.gmw-thumbnail-map.gmw-lightbox-enabled').click(function(e) {
|
| 8 |
+
e.preventDefault();
|
| 9 |
+
|
| 10 |
dialog = $($(this).attr('href'));
|
| 11 |
map_width = dialog.attr('data-map-width');
|
| 12 |
map_height = dialog.attr('data-map-height');
|
| 14 |
map_title = dialog.attr('title');
|
| 15 |
map_skin = dialog.attr('data-map-skin');
|
| 16 |
|
| 17 |
+
content = $(dialog.html());
|
| 18 |
content.filter('.gmw-map').html('<iframe width="' + map_width + 'px" height="' + map_height + 'px" src="' + map_url + '"></iframe>');
|
| 19 |
|
| 20 |
+
$.colorbox({ html: content,
|
| 21 |
+
title: map_title,
|
| 22 |
+
className: 'gmw-' + map_skin,
|
| 23 |
+
closeButton: false });
|
| 24 |
|
| 25 |
return false;
|
| 26 |
});
|
readme.txt
CHANGED
|
@@ -6,7 +6,7 @@ License: GPLv2 or later
|
|
| 6 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 7 |
Requires at least: 3.3
|
| 8 |
Tested up to: 4.1
|
| 9 |
-
Stable tag:
|
| 10 |
|
| 11 |
Displays a single-image super-fast loading Google map in a widget. A larger map with all the usual features is available on click in a lightbox.
|
| 12 |
|
|
@@ -111,6 +111,11 @@ If you can figure it out open a thread in the support forums.
|
|
| 111 |
4. Widget options - lightbox map
|
| 112 |
|
| 113 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
= 1.95 =
|
| 115 |
* 2014/12/19
|
| 116 |
* minor WP v4.1 updates
|
| 6 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 7 |
Requires at least: 3.3
|
| 8 |
Tested up to: 4.1
|
| 9 |
+
Stable tag: 2.0
|
| 10 |
|
| 11 |
Displays a single-image super-fast loading Google map in a widget. A larger map with all the usual features is available on click in a lightbox.
|
| 12 |
|
| 111 |
4. Widget options - lightbox map
|
| 112 |
|
| 113 |
== Changelog ==
|
| 114 |
+
= 2.0 =
|
| 115 |
+
* 2015/01/10
|
| 116 |
+
* lots of rewrites
|
| 117 |
+
* additional features can now be activated by subscribing to our newsletter
|
| 118 |
+
|
| 119 |
= 1.95 =
|
| 120 |
* 2014/12/19
|
| 121 |
* minor WP v4.1 updates
|
