WD Google Maps – Google Maps builder Plugin - Version 1.0.15

Version Description

  • Added: Review, User guide notices
Download this release

Release Info

Developer webdorado
Plugin Icon 128x128 WD Google Maps – Google Maps builder Plugin
Version 1.0.15
Comparing to
See all releases

Code changes from version 1.0.14 to 1.0.15

admin/controllers/GMWDControllerUninstall_gmwd.php CHANGED
@@ -38,7 +38,8 @@ class GMWDControllerUninstall_gmwd extends GMWDController{
38
  delete_option('gmwd_version');
39
  delete_option('gmwd_download_markers');
40
  delete_option('gmwd_pro');
41
-
 
42
  $this->view->complete_uninstalation();
43
 
44
  }
38
  delete_option('gmwd_version');
39
  delete_option('gmwd_download_markers');
40
  delete_option('gmwd_pro');
41
+ delete_option('gmwd_admin_notice');
42
+
43
  $this->view->complete_uninstalation();
44
 
45
  }
css/notices.css ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wd-admin-notice {
2
+ background: #fff;
3
+ border: 4px;
4
+ display: block;
5
+ min-height: 68px;
6
+ padding: 10px 40px 10px 125px;
7
+ position: relative;
8
+ }
9
+ .wd-admin-notice a {
10
+ color: #10738B;
11
+ }
12
+ .gmwd-notice-logo {
13
+ clear: both;
14
+ content: "";
15
+ display: block;
16
+ background-image: url("../images/icon-map.png");
17
+ background-size: 108px auto;
18
+ background-repeat: no-repeat;
19
+ background-position: 0 45%;
20
+ width: 125px;
21
+ position: absolute;
22
+ top: 0;
23
+ bottom: 0;
24
+ left: 5px;
25
+ }
26
+ .wd-admin-notice > .dashicons {
27
+ color: #424242;
28
+ position: absolute;
29
+ right: 20px;
30
+ top: 40%;
31
+ }
32
+ .wd-notice-title {
33
+ font-size: 24px;
34
+ margin: 0;
35
+ }
36
+ .wd-notice-body {
37
+ font-weight: normal;
38
+ margin: 5px 0;
39
+ }
40
+ .wd-notice-body:after {
41
+ clear: both;
42
+ content: "";
43
+ display: block;
44
+ }
45
+ .wd-notice-body li {
46
+ float: left;
47
+ margin-right: 20px;
48
+ }
49
+ .wd-notice-body .dashicons {
50
+ font-size: 17px;
51
+ }
52
+ .wd-blue {
53
+ color: #10738B;
54
+ }
55
+
56
+ .admin-notice-promo {
57
+ background: #fff;
58
+ border-top: 4px;
59
+ display: block;
60
+ min-height: 68px;
61
+ padding: 10px 40px 0px 10px;
62
+ margin: 10px 0;
63
+ position: relative;
64
+ }
65
+
66
+ .admin-notice-promo:after {
67
+ content: '';
68
+ display: table;
69
+ clear: both;
70
+ }
71
+
72
+ .close-promo {
73
+ position: absolute;
74
+ top: 5px;
75
+ right: 5px;
76
+ }
77
+
78
+ .promo {
79
+ background-position: center;
80
+ background-repeat: no-repeat;
81
+ background-size: 972px 200px;
82
+ height: 200px;
83
+ max-width: 100%;
84
+ }
85
+
86
+ .promo a {
87
+ display: block;
88
+ height: 100%;
89
+ }
gmwd_admin_class.php CHANGED
@@ -11,7 +11,7 @@ class GMWDAdmin{
11
  // Variables //
12
  ////////////////////////////////////////////////////////////////////////////////////////
13
  protected static $instance = null;
14
- private static $version = '1.0.14';
15
  ////////////////////////////////////////////////////////////////////////////////////////
16
  // Constructor & Destructor //
17
  ////////////////////////////////////////////////////////////////////////////////////////
11
  // Variables //
12
  ////////////////////////////////////////////////////////////////////////////////////////
13
  protected static $instance = null;
14
+ private static $version = '1.0.15';
15
  ////////////////////////////////////////////////////////////////////////////////////////
16
  // Constructor & Destructor //
17
  ////////////////////////////////////////////////////////////////////////////////////////
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://web-dorado.com/products/wordpress-google-maps-plugin.html
4
  Tags: directions, google map, google map plugin, google maps, google maps plugin, map, map markers, map plugin, map widget, maps, wp google map, wp google maps
5
  Requires at least: 3.4
6
  Tested up to: 4.6
7
- Stable tag: 1.0.14
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -110,8 +110,11 @@ After downloading the ZIP file of the Google Maps WD plugin,
110
 
111
  == Changelog ==
112
 
 
 
 
113
  = 1.0.14 =
114
- * Added: Advanced info window
115
 
116
  = 1.0.13 =
117
  * Fixed: Languages bug
4
  Tags: directions, google map, google map plugin, google maps, google maps plugin, map, map markers, map plugin, map widget, maps, wp google map, wp google maps
5
  Requires at least: 3.4
6
  Tested up to: 4.6
7
+ Stable tag: 1.0.15
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
110
 
111
  == Changelog ==
112
 
113
+ = 1.0.15 =
114
+ * Added: Review, User guide notices
115
+
116
  = 1.0.14 =
117
+ * Added: Advanced info window
118
 
119
  = 1.0.13 =
120
  * Fixed: Languages bug
wd-google-maps-notices.php ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) {
3
+ exit;
4
+ }
5
+
6
+ class GMWD_Notices {
7
+ protected $prefix = 'gmwd';
8
+ protected $plugin_url = GMWD_URL;
9
+ protected $plugin_version = "gmwd_version";
10
+ protected $plugin_name = 'Google Maps WD';
11
+ protected $promo_link = '';
12
+
13
+ public $notice_spam = 0;
14
+ public $notice_spam_max = 1;
15
+
16
+ // Basic actions to run
17
+ public function __construct() {
18
+
19
+ // Runs the admin notice ignore function incase a dismiss button has been clicked
20
+ add_action('admin_init', array($this, 'admin_notice_ignore'));
21
+ // Runs the admin notice temp ignore function incase a temp dismiss link has been clicked
22
+ add_action('admin_init', array($this, 'admin_notice_temp_ignore'));
23
+ add_action('admin_notices', array($this, 'wd_admin_notices'));
24
+ }
25
+
26
+ // Checks to ensure notices aren't disabled and the user has the correct permissions.
27
+ public function wd_admin_notice() {
28
+ $settings = get_option($this->prefix . '_admin_notice');
29
+ if (!isset($settings['disable_admin_notices']) || (isset($settings['disable_admin_notices']) && $settings['disable_admin_notices'] == 0)) {
30
+ if (current_user_can('manage_options')) {
31
+ return true;
32
+ }
33
+ }
34
+ return false;
35
+ }
36
+
37
+ // Primary notice function that can be called from an outside function sending necessary variables
38
+ public function admin_notice($admin_notices) {
39
+
40
+ // Check options
41
+ if (!$this->wd_admin_notice()) {
42
+ return false;
43
+ }
44
+ foreach ($admin_notices as $slug => $admin_notice) {
45
+ // Call for spam protection
46
+ if ($this->anti_notice_spam()) {
47
+ return false;
48
+ }
49
+
50
+ // Check for proper page to display on
51
+ if (isset( $admin_notices[$slug]['pages']) && is_array( $admin_notices[$slug]['pages'])) {
52
+ if (!$this->admin_notice_pages($admin_notices[$slug]['pages'])) {
53
+ return false;
54
+ }
55
+ }
56
+
57
+ // Check for required fields
58
+ if (!$this->required_fields($admin_notices[$slug])) {
59
+
60
+ // Get the current date then set start date to either passed value or current date value and add interval
61
+ $current_date = current_time("n/j/Y");
62
+ $start = (isset($admin_notices[$slug]['start']) ? $admin_notices[$slug]['start'] : $current_date);
63
+ $start = date("n/j/Y", strtotime($start));
64
+ $date_array = explode('/', $start);
65
+ $interval = (isset($admin_notices[$slug]['int']) ? $admin_notices[$slug]['int'] : 0);
66
+
67
+ $date_array[1] += $interval;
68
+ $start = date("n/j/Y", mktime(0, 0, 0, $date_array[0], $date_array[1], $date_array[2]));
69
+
70
+ // This is the main notices storage option
71
+ $admin_notices_option = get_option($this->prefix . '_admin_notice', array());
72
+ // Check if the message is already stored and if so just grab the key otherwise store the message and its associated date information
73
+ if (!array_key_exists( $slug, $admin_notices_option)) {
74
+ $admin_notices_option[$slug]['start'] = $start;
75
+ $admin_notices_option[$slug]['int'] = $interval;
76
+ update_option($this->prefix . '_admin_notice', $admin_notices_option);
77
+ }
78
+
79
+ // Sanity check to ensure we have accurate information
80
+ // New date information will not overwrite old date information
81
+ $admin_display_check = (isset($admin_notices_option[$slug]['dismissed']) ? $admin_notices_option[$slug]['dismissed'] : 0);
82
+ $admin_display_start = (isset($admin_notices_option[$slug]['start']) ? $admin_notices_option[$slug]['start'] : $start);
83
+ $admin_display_interval = (isset($admin_notices_option[$slug]['int']) ? $admin_notices_option[$slug]['int'] : $interval);
84
+ $admin_display_msg = (isset($admin_notices[$slug]['msg']) ? $admin_notices[$slug]['msg'] : '');
85
+ $admin_display_title = (isset($admin_notices[$slug]['title']) ? $admin_notices[$slug]['title'] : '');
86
+ $admin_display_link = (isset($admin_notices[$slug]['link']) ? $admin_notices[$slug]['link'] : '');
87
+ $output_css = false;
88
+
89
+ // Ensure the notice hasn't been hidden and that the current date is after the start date
90
+ if ($admin_display_check == 0 && strtotime($admin_display_start) <= strtotime($current_date)) {
91
+
92
+ // Get remaining query string
93
+ $query_str = (isset($admin_notices[$slug]['later_link']) ? $admin_notices[$slug]['later_link'] : esc_url(add_query_arg($this->prefix . '_admin_notice_ignore', $slug)));
94
+ if (strpos($slug, 'promo') === FALSE) {
95
+ // Admin notice display output
96
+ echo '<div class="update-nag wd-admin-notice">
97
+ <div class="' . $this->prefix . '-notice-logo"></div>
98
+ <p class="wd-notice-title">' . $admin_display_title . '</p>
99
+ <p class="wd-notice-body">' . $admin_display_msg . '</p>
100
+ <ul class="wd-notice-body wd-blue">' . $admin_display_link . '</ul>
101
+ <a href="' . $query_str . '" class="dashicons dashicons-dismiss"></a>
102
+ </div>';
103
+ }
104
+ else {
105
+ echo '<div class="admin-notice-promo">';
106
+ echo $admin_display_msg;
107
+ echo '<ul class="notice-body-promo blue">
108
+ ' . $admin_display_link . '
109
+ </ul>';
110
+ echo '<a href="' . $query_str . '" class="dashicons dashicons-dismiss close-promo"></a>';
111
+ echo '</div>';
112
+ }
113
+ $this->notice_spam += 1;
114
+ $output_css = true;
115
+ }
116
+ if ($output_css) {
117
+ wp_enqueue_style($this->prefix . '-admin-notices', $this->plugin_url . '/css/notices.css', array(), get_option($this->plugin_version));
118
+ }
119
+ }
120
+ }
121
+ }
122
+
123
+ // Spam protection check
124
+ public function anti_notice_spam() {
125
+ if ($this->notice_spam >= $this->notice_spam_max) {
126
+ return true;
127
+ }
128
+ return false;
129
+ }
130
+
131
+ // Ignore function that gets ran at admin init to ensure any messages that were dismissed get marked
132
+ public function admin_notice_ignore() {
133
+ // If user clicks to ignore the notice, update the option to not show it again
134
+ if (isset($_GET[$this->prefix . '_admin_notice_ignore'])) {
135
+ $admin_notices_option = get_option($this->prefix . '_admin_notice', array());
136
+ $admin_notices_option[$_GET[$this->prefix . '_admin_notice_ignore']]['dismissed'] = 1;
137
+ update_option($this->prefix . '_admin_notice', $admin_notices_option);
138
+ $query_str = remove_query_arg($this->prefix . '_admin_notice_ignore');
139
+ wp_redirect($query_str);
140
+ exit;
141
+ }
142
+ }
143
+
144
+ // Temp Ignore function that gets ran at admin init to ensure any messages that were temp dismissed get their start date changed
145
+ public function admin_notice_temp_ignore() {
146
+ // If user clicks to temp ignore the notice, update the option to change the start date - default interval of 14 days
147
+ if (isset($_GET[$this->prefix . '_admin_notice_temp_ignore'])) {
148
+ $admin_notices_option = get_option($this->prefix . '_admin_notice', array());
149
+ $current_date = current_time("n/j/Y");
150
+ $date_array = explode('/', $current_date);
151
+ $interval = (isset($_GET['wd_int']) ? $_GET['wd_int'] : 14);
152
+ $date_array[1] += $interval;
153
+ $new_start = date("n/j/Y", mktime(0, 0, 0, $date_array[0], $date_array[1], $date_array[2]));
154
+
155
+ $admin_notices_option[$_GET[$this->prefix . '_admin_notice_temp_ignore']]['start'] = $new_start;
156
+ $admin_notices_option[$_GET[$this->prefix . '_admin_notice_temp_ignore']]['dismissed'] = 0;
157
+ update_option($this->prefix . '_admin_notice', $admin_notices_option);
158
+ $query_str = remove_query_arg(array($this->prefix . '_admin_notice_temp_ignore', 'wd_int'));
159
+ wp_redirect( $query_str );
160
+ exit;
161
+ }
162
+ }
163
+
164
+ public function admin_notice_pages($pages) {
165
+ foreach ($pages as $key => $page) {
166
+ if (is_array($page)) {
167
+ if (isset($_GET['page']) && $_GET['page'] == $page[0] && isset($_GET['tab']) && $_GET['tab'] == $page[1]) {
168
+ return true;
169
+ }
170
+ }
171
+ else {
172
+ if ($page == 'all') {
173
+ return true;
174
+ }
175
+ if (get_current_screen()->id === $page) {
176
+ return true;
177
+ }
178
+ if (isset($_GET['page']) && $_GET['page'] == $page) {
179
+ return true;
180
+ }
181
+ }
182
+ return false;
183
+ }
184
+ }
185
+
186
+ // Required fields check
187
+ public function required_fields( $fields ) {
188
+ if (!isset( $fields['msg']) || (isset($fields['msg']) && empty($fields['msg']))) {
189
+ return true;
190
+ }
191
+ if (!isset( $fields['title']) || (isset($fields['title']) && empty($fields['title']))) {
192
+ return true;
193
+ }
194
+ return false;
195
+ }
196
+
197
+ // Special parameters function that is to be used in any extension of this class
198
+ public function special_parameters($admin_notices) {
199
+ // Intentionally left blank
200
+ }
201
+
202
+ public function wd_admin_notices() {
203
+ $two_week_review_ignore = add_query_arg(array($this->prefix . '_admin_notice_ignore' => 'two_week_review'));
204
+ $two_week_review_temp = add_query_arg(array($this->prefix . '_admin_notice_temp_ignore' => 'two_week_review', 'int' => 14));
205
+ $promo_close = add_query_arg(array($this->prefix . '_admin_notice_ignore' => 'ecommerce_promo'));
206
+
207
+ /*$notices['ecommerce_promo'] = array(
208
+ 'title' => __('Hey! How\'s It Going?', $this->prefix),
209
+ 'msg' => '<div class="promo" style="background-image: url(' . $this->plugin_url . '/images/Gallery-E-Commerce-banner.png);"><a href="' . $this->promo_link . '" target="_blank"></a></div>',
210
+ 'link' => '<li><span class="dashicons dashicons-dismiss"></span><a href="' . $promo_close . '">' . __('Never show again', $this->prefix) . '</a></li>',
211
+ 'int' => 3
212
+ ); */
213
+
214
+ $notices['two_week_review'] = array(
215
+ 'title' => __('Leave A Review?', $this->prefix),
216
+ 'msg' => sprintf(__('We hope you\'ve enjoyed using WordPress %s! Would you consider leaving us a review on WordPress.org?', $this->prefix), $this->plugin_name),
217
+ 'link' => '<li><span class="dashicons dashicons-external"></span><a href="https://wordpress.org/support/view/plugin-reviews/wd-google-maps?filter=5" target="_blank">' . __('Sure! I\'d love to!', $this->prefix) . '</a></li>
218
+ <li><span class="dashicons dashicons-smiley"></span><a href="' . $two_week_review_ignore . '"> ' . __('I\'ve already left a review', $this->prefix) . '</a></li>
219
+ <li><span class="dashicons dashicons-calendar-alt"></span><a href="' . $two_week_review_temp . '">' . __('Maybe Later', $this->prefix) . '</a></li>
220
+ <li><span class="dashicons dashicons-dismiss"></span><a href="' . $two_week_review_ignore . '">' . __('Never show again', $this->prefix) . '</a></li>',
221
+ 'later_link' => $two_week_review_temp,
222
+ 'int' => 14
223
+ );
224
+ $one_week_support = add_query_arg(array($this->prefix . '_admin_notice_ignore' => 'one_week_support'));
225
+ $notices['one_week_support'] = array(
226
+ 'title' => __('Hey! How\'s It Going?', $this->prefix),
227
+ 'msg' => sprintf(__('Thank you for using WordPress %s! We hope that you\'ve found everything you need, but if you have any questions:', $this->prefix), $this->plugin_name),
228
+ 'link' => '<li><span class="dashicons dashicons-media-text"></span><a target="_blank" href="https://web-dorado.com/wordpress-google-maps/installing.html">' . __('Check out User Guide', $this->prefix) . '</a></li>
229
+ <li><span class="dashicons dashicons-sos"></span><a target="_blank" href="https://web-dorado.com/forum/wordpress-google-maps-wd.html">' . __('Get Some Help', $this->prefix) . '</a></li>
230
+ <li><span class="dashicons dashicons-dismiss"></span><a href="' . $one_week_support . '">' . __('Never show again', $this->prefix) . '</a></li>',
231
+ 'int' => 7
232
+ );
233
+ $this->admin_notice($notices);
234
+ }
235
+ }
wd-google-maps.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Google Maps WD
5
  * Plugin URI: https://web-dorado.com/products/wordpress-google-maps-plugin.html
6
  * Description: Google Maps WD is an intuitive tool for creating Google maps with advanced markers, custom layers and overlays for your website.
7
- * Version: 1.0.14
8
  * Author: WebDorado
9
  * Author URI: http://web-dorado.com/
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
@@ -53,7 +53,10 @@ function gmwd_map($shortcode_id, $map_id ){
53
  }
54
  require_once( GMWD_DIR. '/widgets.php' );
55
 
56
-
 
 
 
57
 
58
 
59
  ?>
4
  * Plugin Name: Google Maps WD
5
  * Plugin URI: https://web-dorado.com/products/wordpress-google-maps-plugin.html
6
  * Description: Google Maps WD is an intuitive tool for creating Google maps with advanced markers, custom layers and overlays for your website.
7
+ * Version: 1.0.15
8
  * Author: WebDorado
9
  * Author URI: http://web-dorado.com/
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
53
  }
54
  require_once( GMWD_DIR. '/widgets.php' );
55
 
56
+ if (is_admin() && (!defined('DOING_AJAX') || !DOING_AJAX)) {
57
+ include_once(GMWD_DIR . '/wd-google-maps-notices.php');
58
+ new GMWD_Notices();
59
+ }
60
 
61
 
62
  ?>