Version Description
New: Notices
Download this release
Release Info
Developer | webdorado |
Plugin | Form Maker by WD – user-friendly drag & drop Form Builder plugin |
Version | 1.7.73 |
Comparing to | |
See all releases |
Code changes from version 1.7.71 to 1.7.73
- css/notices.css +54 -0
- fm_admin_class.php +176 -0
- form-maker.php +10 -2
- form_maker_notices_class.php +221 -0
- notices.php +35 -0
- readme.txt +4 -1
css/notices.css
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.fm-admin-notice {
|
2 |
+
background: #fff;
|
3 |
+
border-top: 4px;
|
4 |
+
display: block;
|
5 |
+
min-height: 68px;
|
6 |
+
padding: 10px 40px 10px 125px;
|
7 |
+
position: relative;
|
8 |
+
}
|
9 |
+
.fm-admin-notice a {
|
10 |
+
color: #10738B;
|
11 |
+
}
|
12 |
+
.fm-notice-logo {
|
13 |
+
clear: both;
|
14 |
+
content: "";
|
15 |
+
display: block;
|
16 |
+
background-image: url("https://d27sb3x2z8tu4g.cloudfront.net/images/productlogos/FormCreatorLogo.png?1428405817");
|
17 |
+
background-size: 108px 107px;
|
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 |
+
.fm-admin-notice > .dashicons {
|
27 |
+
color: #424242;
|
28 |
+
position: absolute;
|
29 |
+
right: 20px;
|
30 |
+
top: 40%;
|
31 |
+
}
|
32 |
+
.fm-notice-title {
|
33 |
+
font-size: 24px;
|
34 |
+
margin: 0;
|
35 |
+
}
|
36 |
+
.fm-notice-body {
|
37 |
+
font-weight: normal;
|
38 |
+
margin: 5px 0;
|
39 |
+
}
|
40 |
+
.fm-notice-body:after {
|
41 |
+
clear: both;
|
42 |
+
content: "";
|
43 |
+
display: block;
|
44 |
+
}
|
45 |
+
.fm-notice-body li {
|
46 |
+
float: left;
|
47 |
+
margin-right: 20px;
|
48 |
+
}
|
49 |
+
.fm-notice-body .dashicons {
|
50 |
+
font-size: 17px;
|
51 |
+
}
|
52 |
+
.fm-blue {
|
53 |
+
color: #10738B;
|
54 |
+
}
|
fm_admin_class.php
ADDED
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class FM_Admin {
|
4 |
+
|
5 |
+
public static $instance = null;
|
6 |
+
public $update_path = 'http://api.web-dorado.com/v1/_id_/version';
|
7 |
+
public $updates = array();
|
8 |
+
public $fm_plugins = array();
|
9 |
+
public $prefix = "fm_";
|
10 |
+
protected $notices = null;
|
11 |
+
public static function get_instance() {
|
12 |
+
if ( null == self::$instance ) {
|
13 |
+
self::$instance = new self;
|
14 |
+
}
|
15 |
+
|
16 |
+
return self::$instance;
|
17 |
+
}
|
18 |
+
|
19 |
+
private function __construct() {
|
20 |
+
$this->notices = new FM_Notices();
|
21 |
+
add_action( 'admin_menu', array( $this, 'check_for_update' ), 25 );
|
22 |
+
add_action( 'admin_init', array( $this, 'admin_notice_ignore' ) );
|
23 |
+
add_action( 'admin_notices', array($this, 'fm_admin_notices') );
|
24 |
+
}
|
25 |
+
|
26 |
+
public function get_plugin_data( $name ) {
|
27 |
+
|
28 |
+
$fm_plugins = array(
|
29 |
+
'form-maker/form-maker.php' => array(
|
30 |
+
'id' => 31,
|
31 |
+
'url' => 'https://web-dorado.com/products/wordpress-form.html',
|
32 |
+
'description' => 'WordPress Form Maker is a fresh and innovative form builder. This form builder is for generating various kinds of forms.',
|
33 |
+
'icon' => '',
|
34 |
+
'image' => plugins_url( 'assets/form-maker.png', __FILE__ )
|
35 |
+
),
|
36 |
+
'form-maker-export-import/fm_exp_imp.php' => array(
|
37 |
+
'id' => 66,
|
38 |
+
'url' => 'https://web-dorado.com/products/wordpress-form/add-ons/export-import.html',
|
39 |
+
'description' => 'Form Maker Export/Import WordPress plugin allows exporting and importing forms with/without submissions.',
|
40 |
+
'icon' => '',
|
41 |
+
'image' => plugins_url( 'assets/import_export.png', __FILE__ ),
|
42 |
+
),
|
43 |
+
'form-maker-mailchimp/fm_mailchimp.php' => array(
|
44 |
+
'id' => 101,
|
45 |
+
'url' => 'https://web-dorado.com/products/wordpress-form/add-ons/mailchimp.html',
|
46 |
+
'description' => 'This add-on is an integration of the Form Maker with MailChimp which allows to add contacts to your subscription lists just from submitted forms.',
|
47 |
+
'icon' => '',
|
48 |
+
'image' => plugins_url( 'assets/mailchimp.png', __FILE__ ),
|
49 |
+
),
|
50 |
+
'form-maker-reg/fm_reg.php' => array(
|
51 |
+
'id' => 103,
|
52 |
+
'url' => 'https://web-dorado.com/products/wordpress-form/add-ons/registration.html',
|
53 |
+
'description' => 'User Registration add-on integrates with Form maker forms allowing users to create accounts at your website.',
|
54 |
+
'icon' => '',
|
55 |
+
'image' => plugins_url( 'assets/reg.png', __FILE__ ),
|
56 |
+
),
|
57 |
+
'form-maker-post-generation/fm_post_generation.php' => array(
|
58 |
+
'id' => 105,
|
59 |
+
'url' => 'https://web-dorado.com/products/wordpress-form/add-ons/post-generation.html',
|
60 |
+
'description' => 'Post Generation add-on allows creating a post, page or custom post based on the submitted data.',
|
61 |
+
'icon' => '',
|
62 |
+
'image' => plugins_url( 'assets/post-generation-update.png', __FILE__ ),
|
63 |
+
),
|
64 |
+
'form-maker-conditional-emails/fm_conditional_emails.php' => array(
|
65 |
+
'id' => 109,
|
66 |
+
'url' => 'https://web-dorado.com/products/wordpress-form/add-ons/conditional-emails.html',
|
67 |
+
'description' => 'Conditional Emails add-on allows to send emails to different recipients depending on the submitted data .',
|
68 |
+
'icon' => '',
|
69 |
+
'image' => plugins_url( 'assets/conditional-emails-update.png', __FILE__ ),
|
70 |
+
)
|
71 |
+
);
|
72 |
+
|
73 |
+
return $fm_plugins[ $name ];
|
74 |
+
}
|
75 |
+
public function get_remote_version( $id ) {
|
76 |
+
$request = wp_remote_get( ( str_replace( '_id_', $id, $this->update_path ) ) );
|
77 |
+
if ( ! is_wp_error( $request ) || wp_remote_retrieve_response_code( $request ) === 200 ) {
|
78 |
+
return json_decode( $request['body'], true );
|
79 |
+
}
|
80 |
+
|
81 |
+
return false;
|
82 |
+
}
|
83 |
+
|
84 |
+
|
85 |
+
public function check_for_update() {
|
86 |
+
global $menu;
|
87 |
+
$fm_plugins = array();
|
88 |
+
$request_ids = array();
|
89 |
+
|
90 |
+
if ( ! function_exists( 'get_plugins' ) ) {
|
91 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
92 |
+
}
|
93 |
+
$all_plugins = get_plugins();
|
94 |
+
|
95 |
+
foreach ( $all_plugins as $name => $plugin ) {
|
96 |
+
if ( strpos( $name, "fm_" ) !== false or $name == "form-maker/form-maker.php" ) {
|
97 |
+
|
98 |
+
$data = $this->get_plugin_data( $name );
|
99 |
+
if ( $data['id'] > 0 ) {
|
100 |
+
$request_ids[] = $data['id'];
|
101 |
+
|
102 |
+
$fm_plugins[ $data['id'] ] = $plugin;
|
103 |
+
$fm_plugins[ $data['id'] ]['fm_data'] = $data;
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
$this->fm_plugins = $fm_plugins;
|
109 |
+
if ( false === $updates_available = get_transient( 'fm_update_check' ) ) {
|
110 |
+
if ( count( $request_ids ) > 0 ) {
|
111 |
+
$updates_available = array();
|
112 |
+
$remote_version = $this->get_remote_version( implode( '_', $request_ids ) );
|
113 |
+
if ( isset( $remote_version['body'] ) ) {
|
114 |
+
foreach ( $remote_version['body'] as $updated_plugin ) {
|
115 |
+
if ( isset( $updated_plugin['version'] ) && version_compare( $fm_plugins[ $updated_plugin['id'] ]['Version'], $updated_plugin['version'], '<' ) ) {
|
116 |
+
$updates_available [ $updated_plugin['id'] ] = $updated_plugin;
|
117 |
+
}
|
118 |
+
|
119 |
+
}
|
120 |
+
}
|
121 |
+
}
|
122 |
+
set_transient( 'fm_update_check', $updates_available, 12 * 60 * 60 );
|
123 |
+
}
|
124 |
+
$this->updates = $updates_available;
|
125 |
+
$updates_count = is_array( $updates_available ) ? count( $updates_available ) : 0;
|
126 |
+
add_submenu_page('manage_fm', 'Updates', 'Updates' . ' ' . '<span class="update-plugins count-' . $updates_count . '" title="title"><span class="update-count">' . $updates_count . '</span></span>', 'manage_options','updates_fm', 'updates_fm');
|
127 |
+
|
128 |
+
$uninstall_page = add_submenu_page('manage_fm', 'Uninstall', 'Uninstall', 'manage_options', 'uninstall_fm', 'form_maker');
|
129 |
+
add_action('admin_print_styles-' . $uninstall_page, 'form_maker_styles');
|
130 |
+
add_action('admin_print_scripts-' . $uninstall_page, 'form_maker_scripts');
|
131 |
+
|
132 |
+
if ( $updates_count > 0 ) {
|
133 |
+
foreach ( $menu as $key => $value ) {
|
134 |
+
|
135 |
+
if ( $menu[ $key ][2] == 'manage_fm' || $menu[ $key ][2] == 'updates_fm' ) {
|
136 |
+
$menu[ $key ][0] .= ' ' . '<span class="update-plugins count-' . $updates_count . '" title="title">
|
137 |
+
<span class="update-count">' . $updates_count . '</span></span>';
|
138 |
+
|
139 |
+
return;
|
140 |
+
}
|
141 |
+
|
142 |
+
}
|
143 |
+
}
|
144 |
+
|
145 |
+
}
|
146 |
+
|
147 |
+
public function plugin_updated() {
|
148 |
+
delete_transient( 'fm_update_check' );
|
149 |
+
}
|
150 |
+
|
151 |
+
function fm_admin_notices( ) {
|
152 |
+
// Notices filter and run the notices function.
|
153 |
+
|
154 |
+
$admin_notices = apply_filters( 'fm_admin_notices', array() );
|
155 |
+
$this->notices->admin_notice( $admin_notices );
|
156 |
+
|
157 |
+
}
|
158 |
+
|
159 |
+
// Ignore function that gets ran at admin init to ensure any messages that were dismissed get marked
|
160 |
+
public function admin_notice_ignore() {
|
161 |
+
|
162 |
+
$slug = ( isset( $_GET['fm_admin_notice_ignore'] ) ) ? $_GET['fm_admin_notice_ignore'] : '';
|
163 |
+
// If user clicks to ignore the notice, run this action
|
164 |
+
if ( isset($_GET['fm_admin_notice_ignore']) && current_user_can( 'manage_options' ) ) {
|
165 |
+
|
166 |
+
$admin_notices_option = get_option( 'fm_admin_notice', array() );
|
167 |
+
$admin_notices_option[ $_GET[ 'fm_admin_notice_ignore' ] ][ 'dismissed' ] = 1;
|
168 |
+
update_option( 'fm_admin_notice', $admin_notices_option );
|
169 |
+
$query_str = remove_query_arg( 'fm_admin_notice_ignore' );
|
170 |
+
wp_redirect( $query_str );
|
171 |
+
exit;
|
172 |
+
}
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
?>
|
form-maker.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Form Maker
|
4 |
* Plugin URI: https://web-dorado.com/products/form-maker-wordpress.html
|
5 |
* Description: This plugin is a modern and advanced tool for easy and fast creating of a WordPress Form. The backend interface is intuitive and user friendly which allows users far from scripting and programming to create WordPress Forms.
|
6 |
-
* Version: 1.7.
|
7 |
* Author: WebDorado
|
8 |
* Author URI: https://web-dorado.com/
|
9 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -124,6 +124,14 @@ add_action('wp_ajax_FormMakerEditCSS', 'form_maker_ajax'); // Edit css from form
|
|
124 |
add_action('wp_ajax_FormMakerSQLMapping', 'form_maker_ajax'); // Add/Edit SQLMaping from form options.
|
125 |
|
126 |
add_action('wp_ajax_select_data_from_db', 'form_maker_ajax'); // select data from db.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
function form_maker_ajax() {
|
128 |
require_once(WD_FM_DIR . '/framework/WDW_FM_Library.php');
|
129 |
$page = WDW_FM_Library::get('action');
|
@@ -261,7 +269,7 @@ function register_fmemailverification_cpt(){
|
|
261 |
// Activate plugin.
|
262 |
function form_maker_activate() {
|
263 |
$version = get_option("wd_form_maker_version");
|
264 |
-
$new_version = '1.7.
|
265 |
global $wpdb;
|
266 |
if (!$version) {
|
267 |
add_option("wd_form_maker_version", $new_version, '', 'no');
|
3 |
* Plugin Name: Form Maker
|
4 |
* Plugin URI: https://web-dorado.com/products/form-maker-wordpress.html
|
5 |
* Description: This plugin is a modern and advanced tool for easy and fast creating of a WordPress Form. The backend interface is intuitive and user friendly which allows users far from scripting and programming to create WordPress Forms.
|
6 |
+
* Version: 1.7.73
|
7 |
* Author: WebDorado
|
8 |
* Author URI: https://web-dorado.com/
|
9 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
124 |
add_action('wp_ajax_FormMakerSQLMapping', 'form_maker_ajax'); // Add/Edit SQLMaping from form options.
|
125 |
|
126 |
add_action('wp_ajax_select_data_from_db', 'form_maker_ajax'); // select data from db.
|
127 |
+
|
128 |
+
if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
|
129 |
+
require_once( 'fm_admin_class.php' );
|
130 |
+
include_once('form_maker_notices_class.php');
|
131 |
+
require_once('notices.php');
|
132 |
+
add_action( 'plugins_loaded', array( 'FM_Admin', 'get_instance' ) );
|
133 |
+
}
|
134 |
+
|
135 |
function form_maker_ajax() {
|
136 |
require_once(WD_FM_DIR . '/framework/WDW_FM_Library.php');
|
137 |
$page = WDW_FM_Library::get('action');
|
269 |
// Activate plugin.
|
270 |
function form_maker_activate() {
|
271 |
$version = get_option("wd_form_maker_version");
|
272 |
+
$new_version = '1.7.73';
|
273 |
global $wpdb;
|
274 |
if (!$version) {
|
275 |
add_option("wd_form_maker_version", $new_version, '', 'no');
|
form_maker_notices_class.php
ADDED
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
|
7 |
+
/**
|
8 |
+
* FM_Notices Class
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
class FM_Notices {
|
12 |
+
static $instance;
|
13 |
+
|
14 |
+
public static function instance() {
|
15 |
+
if ( ! isset( self::$instance ) ) {
|
16 |
+
self::$instance = new FM_Notices();
|
17 |
+
}
|
18 |
+
|
19 |
+
return self::$instance;
|
20 |
+
}
|
21 |
+
|
22 |
+
public $notice_spam = 0;
|
23 |
+
public $notice_spam_max = 1;
|
24 |
+
|
25 |
+
// Basic actions to run
|
26 |
+
public function __construct() {
|
27 |
+
|
28 |
+
// Runs the admin notice ignore function incase a dismiss button has been clicked
|
29 |
+
add_action( 'admin_init', array( $this, 'admin_notice_ignore' ) );
|
30 |
+
|
31 |
+
// Runs the admin notice temp ignore function incase a temp dismiss link has been clicked
|
32 |
+
add_action( 'admin_init', array( $this, 'admin_notice_temp_ignore' ) );
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
// Checks to ensure notices aren't disabled and the user has the correct permissions.
|
37 |
+
public function fm_admin_notice() {
|
38 |
+
|
39 |
+
$fm_settings = get_option( 'fm_admin_notice' );
|
40 |
+
if ( ! isset( $fm_settings['disable_admin_notices'] ) || ( isset( $fm_settings['disable_admin_notices'] ) && $fm_settings['disable_admin_notices'] == 0 ) ) {
|
41 |
+
if ( current_user_can( 'manage_options' ) ) {
|
42 |
+
return true;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
return false;
|
47 |
+
|
48 |
+
}
|
49 |
+
|
50 |
+
// Primary notice function that can be called from an outside function sending necessary variables
|
51 |
+
public function admin_notice( $admin_notices ) {
|
52 |
+
|
53 |
+
// Check options
|
54 |
+
if ( ! $this->fm_admin_notice() ) {
|
55 |
+
return false;
|
56 |
+
}
|
57 |
+
|
58 |
+
foreach ( $admin_notices as $slug => $admin_notice ) {
|
59 |
+
// Call for spam protection
|
60 |
+
if ( $this->anti_notice_spam() ) {
|
61 |
+
return false;
|
62 |
+
}
|
63 |
+
|
64 |
+
// Check for proper page to display on
|
65 |
+
if ( isset( $admin_notices[ $slug ]['pages'] ) && is_array( $admin_notices[ $slug ]['pages'] ) ) {
|
66 |
+
if ( ! $this->admin_notice_pages( $admin_notices[ $slug ]['pages'] ) ) {
|
67 |
+
return false;
|
68 |
+
}
|
69 |
+
}
|
70 |
+
// Check for required fields
|
71 |
+
if ( ! $this->required_fields( $admin_notices[ $slug ] ) ) {
|
72 |
+
// Get the current date then set start date to either passed value or current date value and add interval
|
73 |
+
$current_date = current_time( "n/j/Y" );
|
74 |
+
$start = ( isset( $admin_notices[ $slug ]['start'] ) ? $admin_notices[ $slug ]['start'] : $current_date );
|
75 |
+
$start = date( "n/j/Y", strtotime( $start ) );
|
76 |
+
$date_array = explode( '/', $start );
|
77 |
+
$interval = ( isset( $admin_notices[ $slug ]['int'] ) ? $admin_notices[ $slug ]['int'] : 0 );
|
78 |
+
$date_array[1] += $interval;
|
79 |
+
$start = date( "n/j/Y", mktime( 0, 0, 0, $date_array[0], $date_array[1], $date_array[2] ) );
|
80 |
+
|
81 |
+
// This is the main notices storage option
|
82 |
+
$admin_notices_option = get_option( 'fm_admin_notice', array() );
|
83 |
+
// Check if the message is already stored and if so just grab the key otherwise store the message and its associated date information
|
84 |
+
if ( ! array_key_exists( $slug, $admin_notices_option ) ) {
|
85 |
+
$admin_notices_option[ $slug ]['start'] = $start;
|
86 |
+
$admin_notices_option[ $slug ]['int'] = $interval;
|
87 |
+
update_option( 'fm_admin_notice', $admin_notices_option );
|
88 |
+
}
|
89 |
+
|
90 |
+
// Sanity check to ensure we have accurate information
|
91 |
+
// New date information will not overwrite old date information
|
92 |
+
$admin_display_check = ( isset( $admin_notices_option[ $slug ]['dismissed'] ) ? $admin_notices_option[ $slug ]['dismissed'] : 0 );
|
93 |
+
|
94 |
+
$admin_display_start = ( isset( $admin_notices_option[ $slug ]['start'] ) ? $admin_notices_option[ $slug ]['start'] : $start );
|
95 |
+
$admin_display_interval = ( isset( $admin_notices_option[ $slug ]['int'] ) ? $admin_notices_option[ $slug ]['int'] : $interval );
|
96 |
+
$admin_display_msg = ( isset( $admin_notices[ $slug ]['msg'] ) ? $admin_notices[ $slug ]['msg'] : '' );
|
97 |
+
$admin_display_title = ( isset( $admin_notices[ $slug ]['title'] ) ? $admin_notices[ $slug ]['title'] : '' );
|
98 |
+
$admin_display_link = ( isset( $admin_notices[ $slug ]['link'] ) ? $admin_notices[ $slug ]['link'] : '' );
|
99 |
+
$output_css = false;
|
100 |
+
// Ensure the notice hasn't been hidden and that the current date is after the start date
|
101 |
+
if ($admin_display_check == 0 && strtotime( $admin_display_start ) <= strtotime( $current_date )) {
|
102 |
+
|
103 |
+
// Get remaining query string
|
104 |
+
$query_str = esc_url( add_query_arg( 'fm_admin_notice_ignore', $slug ) );
|
105 |
+
|
106 |
+
// Admin notice display output
|
107 |
+
echo '<div class="update-nag fm-admin-notice">';
|
108 |
+
echo '<div class="fm-notice-logo"></div>';
|
109 |
+
echo ' <p class="fm-notice-title">';
|
110 |
+
echo $admin_display_title;
|
111 |
+
echo ' </p>';
|
112 |
+
echo ' <p class="fm-notice-body">';
|
113 |
+
echo $admin_display_msg;
|
114 |
+
echo ' </p>';
|
115 |
+
echo '<ul class="fm-notice-body fm-blue">
|
116 |
+
' . $admin_display_link . '
|
117 |
+
</ul>';
|
118 |
+
echo '<a href="' . $query_str . '" class="dashicons dashicons-dismiss"></a>';
|
119 |
+
echo '</div>';
|
120 |
+
|
121 |
+
$this->notice_spam += 1;
|
122 |
+
$output_css = true;
|
123 |
+
}
|
124 |
+
if ( $output_css ) {
|
125 |
+
wp_enqueue_style( 'fm-admin-notices', WD_FM_URL .'/css/notices.css?fm_ver=' . get_option("wd_form_maker_version") );
|
126 |
+
}
|
127 |
+
}
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
// Spam protection check
|
132 |
+
public function anti_notice_spam() {
|
133 |
+
|
134 |
+
if ( $this->notice_spam >= $this->notice_spam_max ) {
|
135 |
+
return true;
|
136 |
+
}
|
137 |
+
|
138 |
+
return false;
|
139 |
+
}
|
140 |
+
|
141 |
+
// Ignore function that gets ran at admin init to ensure any messages that were dismissed get marked
|
142 |
+
public function admin_notice_ignore() {
|
143 |
+
|
144 |
+
// If user clicks to ignore the notice, update the option to not show it again
|
145 |
+
if ( isset( $_GET['fm_admin_notice_ignore'] ) ) {
|
146 |
+
|
147 |
+
$admin_notices_option = get_option( 'fm_admin_notice', array() );
|
148 |
+
$admin_notices_option[ $_GET['fm_admin_notice_ignore'] ]['dismissed'] = 1;
|
149 |
+
update_option( 'fm_admin_notice', $admin_notices_option );
|
150 |
+
$query_str = remove_query_arg( 'fm_admin_notice_ignore' );
|
151 |
+
wp_redirect( $query_str );
|
152 |
+
exit;
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
// Temp Ignore function that gets ran at admin init to ensure any messages that were temp dismissed get their start date changed
|
157 |
+
public function admin_notice_temp_ignore() {
|
158 |
+
|
159 |
+
// If user clicks to temp ignore the notice, update the option to change the start date - default interval of 14 days
|
160 |
+
if ( isset( $_GET['fm_admin_notice_temp_ignore'] ) ) {
|
161 |
+
|
162 |
+
$admin_notices_option = get_option( 'fm_admin_notice', array() );
|
163 |
+
|
164 |
+
$current_date = current_time( "n/j/Y" );
|
165 |
+
$date_array = explode( '/', $current_date );
|
166 |
+
$interval = ( isset( $_GET['fm_int'] ) ? $_GET['fm_int'] : 14 );
|
167 |
+
$date_array[1] += $interval;
|
168 |
+
$new_start = date( "n/j/Y", mktime( 0, 0, 0, $date_array[0], $date_array[1], $date_array[2] ) );
|
169 |
+
|
170 |
+
$admin_notices_option[ $_GET['fm_admin_notice_temp_ignore'] ]['start'] = $new_start;
|
171 |
+
$admin_notices_option[ $_GET['fm_admin_notice_temp_ignore'] ]['dismissed'] = 0;
|
172 |
+
update_option( 'fm_admin_notice', $admin_notices_option );
|
173 |
+
$query_str = remove_query_arg( array( 'fm_admin_notice_temp_ignore', 'fm_int' ) );
|
174 |
+
wp_redirect( $query_str );
|
175 |
+
exit;
|
176 |
+
}
|
177 |
+
}
|
178 |
+
|
179 |
+
public function admin_notice_pages( $pages ) {
|
180 |
+
|
181 |
+
foreach ( $pages as $key => $page ) {
|
182 |
+
if ( is_array( $page ) ) {
|
183 |
+
if ( isset( $_GET['page'] ) && $_GET['page'] == $page[0] && isset( $_GET['tab'] ) && $_GET['tab'] == $page[1] ) {
|
184 |
+
return true;
|
185 |
+
}
|
186 |
+
} else {
|
187 |
+
if ( $page == 'all' ) {
|
188 |
+
return true;
|
189 |
+
}
|
190 |
+
if ( get_current_screen()->id === $page ) {
|
191 |
+
return true;
|
192 |
+
}
|
193 |
+
if ( isset( $_GET['page'] ) && $_GET['page'] == $page ) {
|
194 |
+
return true;
|
195 |
+
}
|
196 |
+
}
|
197 |
+
|
198 |
+
return false;
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
// Required fields check
|
203 |
+
public function required_fields( $fields ) {
|
204 |
+
if ( ! isset( $fields['msg'] ) || ( isset( $fields['msg'] ) && empty( $fields['msg'] ) ) ) {
|
205 |
+
return true;
|
206 |
+
}
|
207 |
+
|
208 |
+
if ( ! isset( $fields['title'] ) || ( isset( $fields['title'] ) && empty( $fields['title'] ) ) ) {
|
209 |
+
return true;
|
210 |
+
}
|
211 |
+
|
212 |
+
return false;
|
213 |
+
}
|
214 |
+
|
215 |
+
// Special parameters function that is to be used in any extension of this class
|
216 |
+
public function special_parameters( $admin_notices ) {
|
217 |
+
// Intentionally left blank
|
218 |
+
}
|
219 |
+
|
220 |
+
}
|
221 |
+
|
notices.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
4 |
+
|
5 |
+
function fm_admin_notices( $notices ) {
|
6 |
+
|
7 |
+
$one_week_support = add_query_arg( array( 'fm_admin_notice_ignore' => 'one_week_support' ) );
|
8 |
+
$notices['one_week_support'] = array(
|
9 |
+
'title' => __( 'Hey! How\'s It Going?', 'form-maker' ),
|
10 |
+
'msg' => __( 'Thank you for using WordPress Form Maker! We hope that you\'ve found everything you need, but if you have any questions:', 'form-maker' ),
|
11 |
+
'link' => '<li><span class="dashicons dashicons-media-text"></span><a target="_blank" href="https://web-dorado.com/wordpress-form-maker/installing.html">' . __( 'Check out User Guide', 'form-maker' ) . '</a></li>
|
12 |
+
<li><span class="dashicons dashicons-sos"></span><a target="_blank" href="https://web-dorado.com/forum/11-form-maker.html">' . __( 'Get Some Help' ,'form-maker' ) . '</a></li>
|
13 |
+
<li><span class="dashicons dashicons-dismiss"></span><a href="' . $one_week_support . '">' . __( 'Never show again' ,'form-maker' ) . '</a></li>',
|
14 |
+
'int' => 7
|
15 |
+
);
|
16 |
+
|
17 |
+
$two_week_review_ignore = add_query_arg( array( 'fm_admin_notice_ignore' => 'two_week_review' ) );
|
18 |
+
$two_week_review_temp = add_query_arg( array( 'fm_admin_notice_temp_ignore' => 'two_week_review', 'int' => 14 ) );
|
19 |
+
$notices['two_week_review'] = array(
|
20 |
+
'title' => __( 'Leave A Review?', 'fm_admin_notice' ),
|
21 |
+
'msg' => __( 'We hope you\'ve enjoyed using WordPress FormMaker! Would you consider leaving us a review on WordPress.org?', 'fm_admin_notice' ),
|
22 |
+
'link' => '<li><span class="dashicons dashicons-external"></span><a href="https://wordpress.org/support/view/plugin-reviews/form-maker?filter=5" target="_blank">' . __( 'Sure! I\'d love to!', 'fm_admin_notice' ) . '</a></li>
|
23 |
+
<li> <span class="dashicons dashicons-smiley"></span><a href="' . $two_week_review_ignore . '"> ' . __( 'I\'ve already left a review', 'fm_admin_notice' ) . '</a></li>
|
24 |
+
<li><span class="dashicons dashicons-calendar-alt"></span><a href="' . $two_week_review_temp . '">' . __( 'Maybe Later' ,'fm_admin_notice' ) . '</a></li>
|
25 |
+
<li><span class="dashicons dashicons-dismiss"></span><a href="' . $two_week_review_ignore . '">' . __( 'Never show again' ,'fm_admin_notice' ) . '</a></li>',
|
26 |
+
|
27 |
+
'int' => 14
|
28 |
+
);
|
29 |
+
|
30 |
+
|
31 |
+
return $notices;
|
32 |
+
}
|
33 |
+
|
34 |
+
add_filter( 'fm_admin_notices', 'fm_admin_notices' );
|
35 |
+
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://web-dorado.com/products/wordpress-form.html
|
|
4 |
Tags: form, forms, form builder, form maker, form manager, form plugin, form with recaptcha, forms plugin, multiple forms, paypal form, survey form, feedback form, feedback forms, contact form,contact form plugin, contact form builder, form creator, email form, secure form, web form, form to email, contact forms, custom forms, form widget, captcha form, wordpress contact form ,recaptcha contact form, form creation, contact form with auto reply, widget contact form, builder, feedback, contacts form plugin , custom contact form, contact us form, formular, formulario, admin, captcha, contact, database, email, javascript, jquery, page, plugin, survey, widget, custom form, forms creator, input, validation, send copy, form with captcha
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 4.3
|
7 |
-
Stable tag: 1.7.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -293,6 +293,9 @@ The Form Maker (Pro version) has simple PayPal integration. This allows the user
|
|
293 |
|
294 |
== Changelog ==
|
295 |
|
|
|
|
|
|
|
296 |
= 1.7.71 =
|
297 |
New Add-on: Conditional Emails
|
298 |
|
4 |
Tags: form, forms, form builder, form maker, form manager, form plugin, form with recaptcha, forms plugin, multiple forms, paypal form, survey form, feedback form, feedback forms, contact form,contact form plugin, contact form builder, form creator, email form, secure form, web form, form to email, contact forms, custom forms, form widget, captcha form, wordpress contact form ,recaptcha contact form, form creation, contact form with auto reply, widget contact form, builder, feedback, contacts form plugin , custom contact form, contact us form, formular, formulario, admin, captcha, contact, database, email, javascript, jquery, page, plugin, survey, widget, custom form, forms creator, input, validation, send copy, form with captcha
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 4.3
|
7 |
+
Stable tag: 1.7.73
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
293 |
|
294 |
== Changelog ==
|
295 |
|
296 |
+
= 1.7.73 =
|
297 |
+
New: Notices
|
298 |
+
|
299 |
= 1.7.71 =
|
300 |
New Add-on: Conditional Emails
|
301 |
|