Version Description
Added: Support/rate us messages.
Download this release
Release Info
Developer | webdorado |
Plugin | Contact Form Builder – a plugin for creating contact and feedback forms |
Version | 1.0.30 |
Comparing to | |
See all releases |
Code changes from version 1.0.29 to 1.0.30
- contact-form-builder-notices.php +207 -0
- contact-form-builder.php +6 -2
- css/notices.css +54 -0
- images/notice.png +0 -0
- readme.txt +4 -1
contact-form-builder-notices.php
ADDED
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (!defined('ABSPATH')) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
+
|
6 |
+
class CFM_Notices {
|
7 |
+
protected $prefix = 'contact_form_maker';
|
8 |
+
protected $plugin_url = WD_CFM_URL;
|
9 |
+
protected $plugin_version = "wd_contact_form_maker_version";
|
10 |
+
protected $plugin_name = 'Contact Form Builder';
|
11 |
+
|
12 |
+
public $notice_spam = 0;
|
13 |
+
public $notice_spam_max = 1;
|
14 |
+
|
15 |
+
// Basic actions to run
|
16 |
+
public function __construct() {
|
17 |
+
// Runs the admin notice ignore function incase a dismiss button has been clicked
|
18 |
+
add_action('admin_init', array($this, 'admin_notice_ignore'));
|
19 |
+
// Runs the admin notice temp ignore function incase a temp dismiss link has been clicked
|
20 |
+
add_action('admin_init', array($this, 'admin_notice_temp_ignore'));
|
21 |
+
add_action('admin_notices', array($this, 'wd_admin_notices'));
|
22 |
+
}
|
23 |
+
|
24 |
+
// Checks to ensure notices aren't disabled and the user has the correct permissions.
|
25 |
+
public function wd_admin_notice() {
|
26 |
+
$settings = get_option($this->prefix . '_admin_notice');
|
27 |
+
if (!isset($settings['disable_admin_notices']) || (isset($settings['disable_admin_notices']) && $settings['disable_admin_notices'] == 0)) {
|
28 |
+
if (current_user_can('manage_options')) {
|
29 |
+
return true;
|
30 |
+
}
|
31 |
+
}
|
32 |
+
return false;
|
33 |
+
}
|
34 |
+
|
35 |
+
// Primary notice function that can be called from an outside function sending necessary variables
|
36 |
+
public function admin_notice($admin_notices) {
|
37 |
+
// Check options
|
38 |
+
if (!$this->wd_admin_notice()) {
|
39 |
+
return false;
|
40 |
+
}
|
41 |
+
foreach ($admin_notices as $slug => $admin_notice) {
|
42 |
+
// Call for spam protection
|
43 |
+
if ($this->anti_notice_spam()) {
|
44 |
+
return false;
|
45 |
+
}
|
46 |
+
|
47 |
+
// Check for proper page to display on
|
48 |
+
if (isset( $admin_notices[$slug]['pages']) && is_array( $admin_notices[$slug]['pages'])) {
|
49 |
+
if (!$this->admin_notice_pages($admin_notices[$slug]['pages'])) {
|
50 |
+
return false;
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
// Check for required fields
|
55 |
+
if (!$this->required_fields($admin_notices[$slug])) {
|
56 |
+
// Get the current date then set start date to either passed value or current date value and add interval
|
57 |
+
$current_date = current_time("n/j/Y");
|
58 |
+
$start = (isset($admin_notices[$slug]['start']) ? $admin_notices[$slug]['start'] : $current_date);
|
59 |
+
$start = date("n/j/Y", strtotime($start));
|
60 |
+
$date_array = explode('/', $start);
|
61 |
+
$interval = (isset($admin_notices[$slug]['int']) ? $admin_notices[$slug]['int'] : 0);
|
62 |
+
$date_array[1] += $interval;
|
63 |
+
$start = date("n/j/Y", mktime(0, 0, 0, $date_array[0], $date_array[1], $date_array[2]));
|
64 |
+
|
65 |
+
// This is the main notices storage option
|
66 |
+
$admin_notices_option = get_option($this->prefix . '_admin_notice', array());
|
67 |
+
// Check if the message is already stored and if so just grab the key otherwise store the message and its associated date information
|
68 |
+
if (!array_key_exists( $slug, $admin_notices_option)) {
|
69 |
+
$admin_notices_option[$slug]['start'] = $start;
|
70 |
+
$admin_notices_option[$slug]['int'] = $interval;
|
71 |
+
update_option($this->prefix . '_admin_notice', $admin_notices_option);
|
72 |
+
}
|
73 |
+
|
74 |
+
// Sanity check to ensure we have accurate information
|
75 |
+
// New date information will not overwrite old date information
|
76 |
+
$admin_display_check = (isset($admin_notices_option[$slug]['dismissed']) ? $admin_notices_option[$slug]['dismissed'] : 0);
|
77 |
+
$admin_display_start = (isset($admin_notices_option[$slug]['start']) ? $admin_notices_option[$slug]['start'] : $start);
|
78 |
+
$admin_display_interval = (isset($admin_notices_option[$slug]['int']) ? $admin_notices_option[$slug]['int'] : $interval);
|
79 |
+
$admin_display_msg = (isset($admin_notices[$slug]['msg']) ? $admin_notices[$slug]['msg'] : '');
|
80 |
+
$admin_display_title = (isset($admin_notices[$slug]['title']) ? $admin_notices[$slug]['title'] : '');
|
81 |
+
$admin_display_link = (isset($admin_notices[$slug]['link']) ? $admin_notices[$slug]['link'] : '');
|
82 |
+
$output_css = false;
|
83 |
+
// Ensure the notice hasn't been hidden and that the current date is after the start date
|
84 |
+
if ($admin_display_check == 0 && strtotime($admin_display_start) <= strtotime($current_date)) {
|
85 |
+
// Get remaining query string
|
86 |
+
$query_str = esc_url(add_query_arg($this->prefix . '_admin_notice_ignore', $slug));
|
87 |
+
// Admin notice display output
|
88 |
+
echo '<div class="update-nag wd-admin-notice">
|
89 |
+
<div class="wd-notice-logo"></div>
|
90 |
+
<p class="wd-notice-title">' . $admin_display_title . '</p>
|
91 |
+
<p class="wd-notice-body">' . $admin_display_msg . '</p>
|
92 |
+
<ul class="wd-notice-body wd-blue">' . $admin_display_link . '</ul>
|
93 |
+
<a href="' . $query_str . '" class="dashicons dashicons-dismiss"></a>
|
94 |
+
</div>';
|
95 |
+
$this->notice_spam += 1;
|
96 |
+
$output_css = true;
|
97 |
+
}
|
98 |
+
if ($output_css) {
|
99 |
+
wp_enqueue_style($this->prefix . '-admin-notices', $this->plugin_url . '/css/notices.css', array(), get_option($this->plugin_version));
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
// Spam protection check
|
106 |
+
public function anti_notice_spam() {
|
107 |
+
if ($this->notice_spam >= $this->notice_spam_max) {
|
108 |
+
return true;
|
109 |
+
}
|
110 |
+
return false;
|
111 |
+
}
|
112 |
+
|
113 |
+
// Ignore function that gets ran at admin init to ensure any messages that were dismissed get marked
|
114 |
+
public function admin_notice_ignore() {
|
115 |
+
// If user clicks to ignore the notice, update the option to not show it again
|
116 |
+
if (isset($_GET[$this->prefix . '_admin_notice_ignore'])) {
|
117 |
+
$admin_notices_option = get_option($this->prefix . '_admin_notice', array());
|
118 |
+
$admin_notices_option[$_GET[$this->prefix . '_admin_notice_ignore']]['dismissed'] = 1;
|
119 |
+
update_option($this->prefix . '_admin_notice', $admin_notices_option);
|
120 |
+
$query_str = remove_query_arg($this->prefix . '_admin_notice_ignore');
|
121 |
+
wp_redirect($query_str);
|
122 |
+
exit;
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
// Temp Ignore function that gets ran at admin init to ensure any messages that were temp dismissed get their start date changed
|
127 |
+
public function admin_notice_temp_ignore() {
|
128 |
+
// If user clicks to temp ignore the notice, update the option to change the start date - default interval of 14 days
|
129 |
+
if (isset($_GET[$this->prefix . '_admin_notice_temp_ignore'])) {
|
130 |
+
$admin_notices_option = get_option($this->prefix . '_admin_notice', array());
|
131 |
+
$current_date = current_time("n/j/Y");
|
132 |
+
$date_array = explode('/', $current_date);
|
133 |
+
$interval = (isset($_GET['wd_int']) ? $_GET['wd_int'] : 14);
|
134 |
+
$date_array[1] += $interval;
|
135 |
+
$new_start = date("n/j/Y", mktime(0, 0, 0, $date_array[0], $date_array[1], $date_array[2]));
|
136 |
+
|
137 |
+
$admin_notices_option[$_GET[$this->prefix . '_admin_notice_temp_ignore']]['start'] = $new_start;
|
138 |
+
$admin_notices_option[$_GET[$this->prefix . '_admin_notice_temp_ignore']]['dismissed'] = 0;
|
139 |
+
update_option($this->prefix . '_admin_notice', $admin_notices_option);
|
140 |
+
$query_str = remove_query_arg(array($this->prefix . '_admin_notice_temp_ignore', 'wd_int'));
|
141 |
+
wp_redirect( $query_str );
|
142 |
+
exit;
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
public function admin_notice_pages($pages) {
|
147 |
+
foreach ($pages as $key => $page) {
|
148 |
+
if (is_array($page)) {
|
149 |
+
if (isset($_GET['page']) && $_GET['page'] == $page[0] && isset($_GET['tab']) && $_GET['tab'] == $page[1]) {
|
150 |
+
return true;
|
151 |
+
}
|
152 |
+
}
|
153 |
+
else {
|
154 |
+
if ($page == 'all') {
|
155 |
+
return true;
|
156 |
+
}
|
157 |
+
if (get_current_screen()->id === $page) {
|
158 |
+
return true;
|
159 |
+
}
|
160 |
+
if (isset($_GET['page']) && $_GET['page'] == $page) {
|
161 |
+
return true;
|
162 |
+
}
|
163 |
+
}
|
164 |
+
return false;
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
// Required fields check
|
169 |
+
public function required_fields( $fields ) {
|
170 |
+
if (!isset( $fields['msg']) || (isset($fields['msg']) && empty($fields['msg']))) {
|
171 |
+
return true;
|
172 |
+
}
|
173 |
+
if (!isset( $fields['title']) || (isset($fields['title']) && empty($fields['title']))) {
|
174 |
+
return true;
|
175 |
+
}
|
176 |
+
return false;
|
177 |
+
}
|
178 |
+
|
179 |
+
// Special parameters function that is to be used in any extension of this class
|
180 |
+
public function special_parameters($admin_notices) {
|
181 |
+
// Intentionally left blank
|
182 |
+
}
|
183 |
+
|
184 |
+
public function wd_admin_notices() {
|
185 |
+
$one_week_support = add_query_arg(array($this->prefix . '_admin_notice_ignore' => 'one_week_support'));
|
186 |
+
$notices['one_week_support'] = array(
|
187 |
+
'title' => __('Hey! How\'s It Going?', $this->prefix),
|
188 |
+
'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),
|
189 |
+
'link' => '<li><span class="dashicons dashicons-media-text"></span><a target="_blank" href="https://web-dorado.com/wordpress-contact-form-builder/installing.html">' . __('Check out User Guide', $this->prefix) . '</a></li>
|
190 |
+
<li><span class="dashicons dashicons-sos"></span><a target="_blank" href="https://web-dorado.com/forum/contact-form-builder.html">' . __('Get Some Help', $this->prefix) . '</a></li>
|
191 |
+
<li><span class="dashicons dashicons-dismiss"></span><a href="' . $one_week_support . '">' . __('Never show again', $this->prefix) . '</a></li>',
|
192 |
+
'int' => 7
|
193 |
+
);
|
194 |
+
$two_week_review_ignore = add_query_arg(array($this->prefix . '_admin_notice_ignore' => 'two_week_review'));
|
195 |
+
$two_week_review_temp = add_query_arg(array($this->prefix . '_admin_notice_temp_ignore' => 'two_week_review', 'int' => 14));
|
196 |
+
$notices['two_week_review'] = array(
|
197 |
+
'title' => __('Leave A Review?', $this->prefix),
|
198 |
+
'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),
|
199 |
+
'link' => '<li><span class="dashicons dashicons-external"></span><a href="https://wordpress.org/support/view/plugin-reviews/contact-form-builder?filter=5" target="_blank">' . __('Sure! I\'d love to!', $this->prefix) . '</a></li>
|
200 |
+
<li><span class="dashicons dashicons-smiley"></span><a href="' . $two_week_review_ignore . '"> ' . __('I\'ve already left a review', $this->prefix) . '</a></li>
|
201 |
+
<li><span class="dashicons dashicons-calendar-alt"></span><a href="' . $two_week_review_temp . '">' . __('Maybe Later', $this->prefix) . '</a></li>
|
202 |
+
<li><span class="dashicons dashicons-dismiss"></span><a href="' . $two_week_review_ignore . '">' . __('Never show again', $this->prefix) . '</a></li>',
|
203 |
+
'int' => 14
|
204 |
+
);
|
205 |
+
$this->admin_notice($notices);
|
206 |
+
}
|
207 |
+
}
|
contact-form-builder.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Contact Form Builder
|
4 |
* Plugin URI: http://web-dorado.com/products/wordpress-contact-form-builder.html
|
5 |
* Description: Contact Form Builder is an advanced plugin to add contact forms into your website. It comes along with multiple default templates which can be customized.
|
6 |
-
* Version: 1.0.
|
7 |
* Author: WebDorado
|
8 |
* Author URI: http://web-dorado.com/
|
9 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -170,7 +170,7 @@ if (class_exists('WP_Widget')) {
|
|
170 |
// Activate plugin.
|
171 |
function contact_form_maker_activate() {
|
172 |
$version = get_option("wd_contact_form_maker_version");
|
173 |
-
$new_version = '1.0.
|
174 |
if ($version && version_compare($version, $new_version, '<')) {
|
175 |
require_once WD_CFM_DIR . "/contact-form-builder-update.php";
|
176 |
contact_form_maker_update($version);
|
@@ -607,4 +607,8 @@ function contact_form_maker_language_load() {
|
|
607 |
}
|
608 |
add_action('init', 'contact_form_maker_language_load');
|
609 |
|
|
|
|
|
|
|
|
|
610 |
?>
|
3 |
* Plugin Name: Contact Form Builder
|
4 |
* Plugin URI: http://web-dorado.com/products/wordpress-contact-form-builder.html
|
5 |
* Description: Contact Form Builder is an advanced plugin to add contact forms into your website. It comes along with multiple default templates which can be customized.
|
6 |
+
* Version: 1.0.30
|
7 |
* Author: WebDorado
|
8 |
* Author URI: http://web-dorado.com/
|
9 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
170 |
// Activate plugin.
|
171 |
function contact_form_maker_activate() {
|
172 |
$version = get_option("wd_contact_form_maker_version");
|
173 |
+
$new_version = '1.0.30';
|
174 |
if ($version && version_compare($version, $new_version, '<')) {
|
175 |
require_once WD_CFM_DIR . "/contact-form-builder-update.php";
|
176 |
contact_form_maker_update($version);
|
607 |
}
|
608 |
add_action('init', 'contact_form_maker_language_load');
|
609 |
|
610 |
+
if (is_admin() && (!defined('DOING_AJAX') || !DOING_AJAX)) {
|
611 |
+
include_once(WD_CFM_DIR . '/contact-form-builder-notices.php');
|
612 |
+
new CFM_Notices();
|
613 |
+
}
|
614 |
?>
|
css/notices.css
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
.wd-notice-logo {
|
13 |
+
clear: both;
|
14 |
+
content: "";
|
15 |
+
display: block;
|
16 |
+
background-image: url("../images/notice.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 |
+
}
|
images/notice.png
ADDED
Binary file
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://web-dorado.com/products/wordpress-contact-form-builder.html
|
|
4 |
Tags: form, forms, contact form, contact forms, contact form plugin, contact forms plugin, forms plugin, Contact Form Builder, contact form manager, multiple contact forms, custom form, Contact Form Builder with recaptcha, contact form with google map, feedback form, feedback forms, contact us, wordpress contact form, email form, feedback, web form, contact me, email, contact manager, contact us form, admin, captcha, contact, database, email, javascript, jquery, page, plugin, survey, widget, custom form, forms creator, text input, validation, send copy, form with captcha, advanced form, recaptcha, contact form with captcha
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 4.3
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -138,6 +138,9 @@ After downloading the ZIP file,
|
|
138 |
|
139 |
== Changelog ==
|
140 |
|
|
|
|
|
|
|
141 |
= 1.0.29 =
|
142 |
Added: RegExp for text fields.
|
143 |
|
4 |
Tags: form, forms, contact form, contact forms, contact form plugin, contact forms plugin, forms plugin, Contact Form Builder, contact form manager, multiple contact forms, custom form, Contact Form Builder with recaptcha, contact form with google map, feedback form, feedback forms, contact us, wordpress contact form, email form, feedback, web form, contact me, email, contact manager, contact us form, admin, captcha, contact, database, email, javascript, jquery, page, plugin, survey, widget, custom form, forms creator, text input, validation, send copy, form with captcha, advanced form, recaptcha, contact form with captcha
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 4.3
|
7 |
+
Stable tag: 1.0.30
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
138 |
|
139 |
== Changelog ==
|
140 |
|
141 |
+
= 1.0.30 =
|
142 |
+
Added: Support/rate us messages.
|
143 |
+
|
144 |
= 1.0.29 =
|
145 |
Added: RegExp for text fields.
|
146 |
|