Version Description
- Added publishing wizard
Download this release
Release Info
Developer | codepeople |
Plugin | Contact Form Email |
Version | 1.2.64 |
Comparing to | |
See all releases |
Code changes from version 1.2.63 to 1.2.64
- README.txt +5 -2
- cp-admin-int-list.inc.php +7 -1
- cp-main-class.inc.php +64 -1
- cp-publish-wizzard.inc.php +184 -0
- form-to-email.php +2 -1
README.txt
CHANGED
@@ -454,6 +454,9 @@ When you click a field already added into the contact form builder area, you can
|
|
454 |
|
455 |
== Changelog ==
|
456 |
|
|
|
|
|
|
|
457 |
= 1.2.63 =
|
458 |
* Improved messages list
|
459 |
|
@@ -950,5 +953,5 @@ When you click a field already added into the contact form builder area, you can
|
|
950 |
|
951 |
== Upgrade Notice ==
|
952 |
|
953 |
-
= 1.2.
|
954 |
-
*
|
454 |
|
455 |
== Changelog ==
|
456 |
|
457 |
+
= 1.2.64 =
|
458 |
+
* Added publishing wizard
|
459 |
+
|
460 |
= 1.2.63 =
|
461 |
* Improved messages list
|
462 |
|
953 |
|
954 |
== Upgrade Notice ==
|
955 |
|
956 |
+
= 1.2.64 =
|
957 |
+
* Added publishing wizard
|
cp-admin-int-list.inc.php
CHANGED
@@ -175,6 +175,11 @@ $nonce = wp_create_nonce( 'cfte_update_actions_plist' );
|
|
175 |
document.location = 'admin.php?page=<?php echo $this->menu_parameter; ?>&cal='+id+'&r='+Math.random();
|
176 |
}
|
177 |
|
|
|
|
|
|
|
|
|
|
|
178 |
function cp_viewMessages(id)
|
179 |
{
|
180 |
document.location = 'admin.php?page=<?php echo $this->menu_parameter; ?>&cal='+id+'&list=1&r='+Math.random();
|
@@ -230,7 +235,8 @@ $nonce = wp_create_nonce( 'cfte_update_actions_plist' );
|
|
230 |
|
231 |
<td nowrap>
|
232 |
<input class="button" type="button" name="calupdate_<?php echo $item->id; ?>" value="Rename" onclick="cp_updateItem(<?php echo $item->id; ?>);" />
|
233 |
-
<input class="button-primary button" type="button" name="calmanage_<?php echo $item->id; ?>" value="Settings" onclick="cp_manageSettings(<?php echo $item->id; ?>);" />
|
|
|
234 |
<input class="button" type="button" name="calmessages_<?php echo $item->id; ?>" value="Messages" onclick="cp_viewMessages(<?php echo $item->id; ?>);" />
|
235 |
<input class="button" type="button" name="calreport_<?php echo $item->id; ?>" value="Stats" onclick="cp_viewReport(<?php echo $item->id; ?>);" />
|
236 |
<input class="button" type="button" name="calclone_<?php echo $item->id; ?>" value="Clone" onclick="cp_cloneItem(<?php echo $item->id; ?>);" />
|
175 |
document.location = 'admin.php?page=<?php echo $this->menu_parameter; ?>&cal='+id+'&r='+Math.random();
|
176 |
}
|
177 |
|
178 |
+
function cp_publish(id)
|
179 |
+
{
|
180 |
+
document.location = 'admin.php?page=<?php echo $this->menu_parameter; ?>&pwizard=1&cal='+id+'&r='+Math.random();
|
181 |
+
}
|
182 |
+
|
183 |
function cp_viewMessages(id)
|
184 |
{
|
185 |
document.location = 'admin.php?page=<?php echo $this->menu_parameter; ?>&cal='+id+'&list=1&r='+Math.random();
|
235 |
|
236 |
<td nowrap>
|
237 |
<input class="button" type="button" name="calupdate_<?php echo $item->id; ?>" value="Rename" onclick="cp_updateItem(<?php echo $item->id; ?>);" />
|
238 |
+
<input class="button-primary button" type="button" name="calmanage_<?php echo $item->id; ?>" value="Settings" onclick="cp_manageSettings(<?php echo $item->id; ?>);" />
|
239 |
+
<input class="button-primary button" type="button" name="calpublish_<?php echo $item->id; ?>" value="<?php _e('Publish','cpappb'); ?>" onclick="cp_publish(<?php echo $item->id; ?>);" />
|
240 |
<input class="button" type="button" name="calmessages_<?php echo $item->id; ?>" value="Messages" onclick="cp_viewMessages(<?php echo $item->id; ?>);" />
|
241 |
<input class="button" type="button" name="calreport_<?php echo $item->id; ?>" value="Stats" onclick="cp_viewReport(<?php echo $item->id; ?>);" />
|
242 |
<input class="button" type="button" name="calclone_<?php echo $item->id; ?>" value="Clone" onclick="cp_cloneItem(<?php echo $item->id; ?>);" />
|
cp-main-class.inc.php
CHANGED
@@ -410,7 +410,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
|
|
410 |
|
411 |
public function settings_page() {
|
412 |
global $wpdb;
|
413 |
-
if ($this->get_param("cal"))
|
414 |
{
|
415 |
$this->item = $this->get_param("cal");
|
416 |
if (isset($_GET["edit"]) && $_GET["edit"] == '1')
|
@@ -419,6 +419,12 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
|
|
419 |
@include_once dirname( __FILE__ ) . '/cp-admin-int-message-list.inc.php';
|
420 |
else if ($this->get_param("report") == '1')
|
421 |
@include_once dirname( __FILE__ ) . '/cp-admin-int-report.inc.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
422 |
else
|
423 |
@include_once dirname( __FILE__ ) . '/cp-admin-int.inc.php';
|
424 |
}
|
@@ -483,6 +489,63 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
|
|
483 |
|
484 |
/* hook for checking posted data for the admin area */
|
485 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
486 |
function data_management() {
|
487 |
global $wpdb;
|
488 |
|
410 |
|
411 |
public function settings_page() {
|
412 |
global $wpdb;
|
413 |
+
if ($this->get_param("cal") || $this->get_param("cal") == '0' || $this->get_param("pwizard") == '1')
|
414 |
{
|
415 |
$this->item = $this->get_param("cal");
|
416 |
if (isset($_GET["edit"]) && $_GET["edit"] == '1')
|
419 |
@include_once dirname( __FILE__ ) . '/cp-admin-int-message-list.inc.php';
|
420 |
else if ($this->get_param("report") == '1')
|
421 |
@include_once dirname( __FILE__ ) . '/cp-admin-int-report.inc.php';
|
422 |
+
else if ($this->get_param("pwizard") == '1')
|
423 |
+
{
|
424 |
+
if ($this->get_param("cal"))
|
425 |
+
$this->item = $this->get_param("cal");
|
426 |
+
@include_once dirname( __FILE__ ) . '/cp-publish-wizzard.inc.php';
|
427 |
+
}
|
428 |
else
|
429 |
@include_once dirname( __FILE__ ) . '/cp-admin-int.inc.php';
|
430 |
}
|
489 |
|
490 |
/* hook for checking posted data for the admin area */
|
491 |
|
492 |
+
function data_management_loaded() {
|
493 |
+
global $wpdb;
|
494 |
+
|
495 |
+
$action = $this->get_param('cp_contactformtoemail_do_action_loaded');
|
496 |
+
if (!$action) return; // go out if the call isn't for this one
|
497 |
+
|
498 |
+
if ($this->get_param('cp_contactformtoemail_id')) $this->item = $this->get_param('cp_contactformtoemail_id');
|
499 |
+
|
500 |
+
if ($action == "wizard")
|
501 |
+
{
|
502 |
+
$shortcode = '['.$this->shorttag.' id="'.$this->item .'"]';
|
503 |
+
$this->postURL = $this->publish_on($_POST["whereto"], $_POST["publishpage"], $_POST["publishpost"], $shortcode, $_POST["posttitle"]);
|
504 |
+
return;
|
505 |
+
}
|
506 |
+
|
507 |
+
// ...
|
508 |
+
echo 'Some unexpected error happened. If you see this error contact the support service at https://form2email.dwbooster.com/contact-us';
|
509 |
+
|
510 |
+
exit();
|
511 |
+
}
|
512 |
+
|
513 |
+
|
514 |
+
private function publish_on($whereto, $publishpage = '', $publishpost = '', $content = '', $posttitle = 'Booking Form')
|
515 |
+
{
|
516 |
+
global $wpdb;
|
517 |
+
$id = '';
|
518 |
+
if ($whereto == '0' || $whereto =='1') // new page
|
519 |
+
{
|
520 |
+
$my_post = array(
|
521 |
+
'post_title' => $posttitle,
|
522 |
+
'post_type' => ($whereto == '0'?'page':'post'),
|
523 |
+
'post_content' => 'This is a <b>preview</b> page, remember to publish it if needed. You can edit the full form settings into the admin settings page.<br /><br /> '.$content,
|
524 |
+
'post_status' => 'draft'
|
525 |
+
);
|
526 |
+
|
527 |
+
// Insert the post into the database
|
528 |
+
$id = wp_insert_post( $my_post );
|
529 |
+
}
|
530 |
+
else
|
531 |
+
{
|
532 |
+
$id = ($whereto == '2'?$publishpage:$publishpost);
|
533 |
+
$post = get_post( $id );
|
534 |
+
$pos = strpos($post->post_content,$content);
|
535 |
+
if ($pos === false)
|
536 |
+
{
|
537 |
+
$my_post = array(
|
538 |
+
'ID' => $id,
|
539 |
+
'post_content' => $content.$post->post_content,
|
540 |
+
);
|
541 |
+
// Update the post into the database
|
542 |
+
wp_update_post( $my_post );
|
543 |
+
}
|
544 |
+
}
|
545 |
+
return get_permalink($id);
|
546 |
+
}
|
547 |
+
|
548 |
+
|
549 |
function data_management() {
|
550 |
global $wpdb;
|
551 |
|
cp-publish-wizzard.inc.php
ADDED
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if ( !is_admin() ) {echo 'Direct access not allowed.';exit;} ?>
|
2 |
+
|
3 |
+
<h1>Publish Contact Form to Email</h1>
|
4 |
+
|
5 |
+
<style type="text/css">
|
6 |
+
|
7 |
+
.ahb-buttons-container{margin:1em 1em 1em 0;}
|
8 |
+
.ahb-return-link{float:right;}
|
9 |
+
.ahb-mssg{margin-left:0 !important; }
|
10 |
+
.ahb-section-container {
|
11 |
+
border: 1px solid #e6e6e6;
|
12 |
+
padding:0px;
|
13 |
+
border-radius: 3px;
|
14 |
+
-webkit-box-flex: 1;
|
15 |
+
flex: 1;
|
16 |
+
margin: 1em 1em 1em 0;
|
17 |
+
min-width: 200px;
|
18 |
+
background: #ffffff;
|
19 |
+
position:relative;
|
20 |
+
}
|
21 |
+
.ahb-section{padding:20px;display:none;}
|
22 |
+
.ahb-section label{font-weight:600;}
|
23 |
+
.ahb-section-active{display:block;}
|
24 |
+
|
25 |
+
.ahb-row{display:none;}
|
26 |
+
.ahb-section table td,
|
27 |
+
.ahb-section table th{padding-left:0;padding-right:0;}
|
28 |
+
.ahb-section select,
|
29 |
+
.ahb-section input[type="text"]{width:100%;}
|
30 |
+
|
31 |
+
.cpmvcontainer { font-size:16px !important; }
|
32 |
+
</style>
|
33 |
+
|
34 |
+
<div class="ahb-buttons-container">
|
35 |
+
<a href="<?php print esc_attr(admin_url('admin.php?page='.$this->menu_parameter));?>" class="ahb-return-link">←Return to the calendars list</a>
|
36 |
+
<div class="clear"></div>
|
37 |
+
</div>
|
38 |
+
|
39 |
+
<form method="post" action="?page=cp_contactformtoemail&pwizard=1" name="regForm" id="regForm">
|
40 |
+
<input name="cp_contactformtoemail_do_action_loaded" type="hidden" value="wizard" />
|
41 |
+
|
42 |
+
<?php
|
43 |
+
|
44 |
+
if ($this->get_param('cp_contactformtoemail_do_action_loaded') == 'wizard') {
|
45 |
+
?>
|
46 |
+
<div class="ahb-section-container">
|
47 |
+
<div class="ahb-section ahb-section-active" data-step="1">
|
48 |
+
<h1>Great! Form successfully published</h1>
|
49 |
+
<p class="cpmvcontainer">The contact form was placed into the page <a href="<?php echo $this->postURL; ?>"><?php echo $this->postURL; ?></a>.</p>
|
50 |
+
<p class="cpmvcontainer">Now you can:</p>
|
51 |
+
<div style="clear:both"></div>
|
52 |
+
<button class="button button-primary cpmvcontainer" type="button" id="nextBtn" onclick="window.open('<?php echo $this->postURL; ?>');">View the Published Contact Form</button>
|
53 |
+
<div style="clear:both"></div>
|
54 |
+
<p class="cpmvcontainer">* Note: If the form was published in a new page or post it will be a 'draft', you have to publish the page/post in the future if needed.</p>
|
55 |
+
<div style="clear:both"></div>
|
56 |
+
<button class="button button-primary cpmvcontainer" type="button" id="nextBtn" onclick="window.open('?page=<?php echo $this->prefix; ?>&cal=<?php echo $this->get_param("cp_contactformtoemail_id"); ?>');">Edit the contact form settings</button>
|
57 |
+
<div style="clear:both"></div>
|
58 |
+
</div>
|
59 |
+
</div>
|
60 |
+
<div style="clear:both"></div>
|
61 |
+
<?php
|
62 |
+
} else {
|
63 |
+
?>
|
64 |
+
|
65 |
+
<div class="ahb-section-container">
|
66 |
+
<div class="ahb-section ahb-section-active" data-step="1">
|
67 |
+
<table class="form-table">
|
68 |
+
<tbody>
|
69 |
+
<tr valign="top">
|
70 |
+
<th><label>Select contact form</label></th>
|
71 |
+
<td>
|
72 |
+
<select id="cp_contactformtoemail_id" name="cp_contactformtoemail_id" onchange="reloadappbk(this);">
|
73 |
+
<?php
|
74 |
+
$myrows = $wpdb->get_results( "SELECT * FROM ". $wpdb->prefix.$this->table_items);
|
75 |
+
foreach ($myrows as $item)
|
76 |
+
echo '<option value="'.$item->id.'"'.($item->id==$this->item?' selected':'').'>'.$item->form_name.'</option>';
|
77 |
+
?>
|
78 |
+
</select>
|
79 |
+
</td>
|
80 |
+
</tr>
|
81 |
+
<tr valign="top">
|
82 |
+
<th><label>Where to publish it?</label></th>
|
83 |
+
<td>
|
84 |
+
<select name="whereto" onchange="mvpublish_displayoption(this);">
|
85 |
+
<option value="0">Into a new page</option>
|
86 |
+
<option value="1">Into a new post</option>
|
87 |
+
<option value="2">Into an existent page</option>
|
88 |
+
<option value="3">Into an existent post</option>
|
89 |
+
<option value="4" style="color:#bbbbbb">Widget in a sidebar, header or footer - upgrade required for this option -</option>
|
90 |
+
</select>
|
91 |
+
</td>
|
92 |
+
</tr>
|
93 |
+
<tr valign="top" id="posttitle">
|
94 |
+
<th><label>Page/Post Title</label></th>
|
95 |
+
<td>
|
96 |
+
<input type="text" name="posttitle" value="Contact Form" />
|
97 |
+
</td>
|
98 |
+
</tr>
|
99 |
+
<tr valign="top" id="ppage" style="display:none">
|
100 |
+
<th><label>Select page</label></th>
|
101 |
+
<td>
|
102 |
+
<select name="publishpage">
|
103 |
+
<?php
|
104 |
+
$pages = get_pages();
|
105 |
+
foreach ( $pages as $page ) {
|
106 |
+
$option = '<option value="' . $page->ID . '">';
|
107 |
+
$option .= $page->post_title;
|
108 |
+
$option .= '</option>';
|
109 |
+
echo $option;
|
110 |
+
}
|
111 |
+
?>
|
112 |
+
</select>
|
113 |
+
</td>
|
114 |
+
</tr>
|
115 |
+
<tr valign="top" id="ppost" style="display:none">
|
116 |
+
<th><label>Select post</label></th>
|
117 |
+
<td>
|
118 |
+
<select name="publishpost">
|
119 |
+
<?php
|
120 |
+
$pages = get_posts();
|
121 |
+
foreach ( $pages as $page ) {
|
122 |
+
$option = '<option value="' . $page->ID . '">';
|
123 |
+
$option .= $page->post_title;
|
124 |
+
$option .= '</option>';
|
125 |
+
echo $option;
|
126 |
+
}
|
127 |
+
?>
|
128 |
+
</select>
|
129 |
+
</td>
|
130 |
+
</tr>
|
131 |
+
<tbody>
|
132 |
+
</table>
|
133 |
+
<hr size="1" />
|
134 |
+
<div class="ahb-buttons-container">
|
135 |
+
<input type="submit" value="Publish Contact Form" class="button button-primary" style="float:right;margin-right:10px" />
|
136 |
+
<div class="clear"></div>
|
137 |
+
</div>
|
138 |
+
</form>
|
139 |
+
</div>
|
140 |
+
</div>
|
141 |
+
<?php } ?>
|
142 |
+
|
143 |
+
|
144 |
+
<script type="text/javascript">
|
145 |
+
|
146 |
+
function reloadappbk(item) {
|
147 |
+
document.location = '?page=<?php echo $this->prefix; ?>&pwizard=1&cal='+item.options[item.options.selectedIndex].value;
|
148 |
+
}
|
149 |
+
|
150 |
+
function mvpublish_displayviews(sel) {
|
151 |
+
if (sel.checked)
|
152 |
+
document.getElementById("nmonthsnum").style.display = '';
|
153 |
+
else
|
154 |
+
document.getElementById("nmonthsnum").style.display = 'none';
|
155 |
+
}
|
156 |
+
|
157 |
+
function mvpublish_displayoption(sel) {
|
158 |
+
document.getElementById("ppost").style.display = 'none';
|
159 |
+
document.getElementById("ppage").style.display = 'none';
|
160 |
+
document.getElementById("posttitle").style.display = 'none';
|
161 |
+
if (sel.selectedIndex == 4)
|
162 |
+
{
|
163 |
+
alert('Widget option available only in commercial versions. Upgrade required for this option.');
|
164 |
+
sel.selectedIndex = 0;
|
165 |
+
}
|
166 |
+
else if (sel.selectedIndex == 2)
|
167 |
+
document.getElementById("ppage").style.display = '';
|
168 |
+
else if (sel.selectedIndex == 3)
|
169 |
+
document.getElementById("ppost").style.display = '';
|
170 |
+
else if (sel.selectedIndex == 1 || sel.selectedIndex == 0)
|
171 |
+
document.getElementById("posttitle").style.display = '';
|
172 |
+
}
|
173 |
+
|
174 |
+
|
175 |
+
</script>
|
176 |
+
|
177 |
+
<div id="metabox_basic_settings" class="postbox" >
|
178 |
+
<h3 class='hndle' style="padding:5px;"><span><?php _e('Note','cpappb'); ?></span></h3>
|
179 |
+
<div class="inside">
|
180 |
+
<?php _e('You can also publish the form in a post/page, use the dedicated icon','cpappb'); ?> <?php echo '<img hspace="5" src="'.plugins_url('/images/cp_form.gif', __FILE__).'" alt="'.__('Insert '.$this->plugin_name).'" /></a>'; ?>
|
181 |
+
<?php _e('which has been added to your Upload/Insert Menu, just below the title of your Post/Page or under the "+" icon if using the Gutemberg editor.','cpappb'); ?>
|
182 |
+
<br /><br />
|
183 |
+
</div>
|
184 |
+
</div>
|
form-to-email.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Contact Form Email
|
4 |
Plugin URI: https://form2email.dwbooster.com/download
|
5 |
Description: Contact form that sends the data to email and also to a database list and CSV file.
|
6 |
-
Version: 1.2.
|
7 |
Author: CodePeople
|
8 |
Author URI: https://form2email.dwbooster.com
|
9 |
Text Domain: contact-form-to-email
|
@@ -89,6 +89,7 @@ if ( is_admin() ) {
|
|
89 |
add_filter("plugin_action_links_".plugin_basename(__FILE__), array($cp_cfte_plugin,'plugin_page_links'));
|
90 |
add_action('admin_menu', array($cp_cfte_plugin,'admin_menu') );
|
91 |
add_action( 'init', array($cp_cfte_plugin,'gutenberg_block') );
|
|
|
92 |
} else {
|
93 |
add_shortcode( $cp_cfte_plugin->shorttag, array($cp_cfte_plugin, 'filter_content') );
|
94 |
}
|
3 |
Plugin Name: Contact Form Email
|
4 |
Plugin URI: https://form2email.dwbooster.com/download
|
5 |
Description: Contact form that sends the data to email and also to a database list and CSV file.
|
6 |
+
Version: 1.2.64
|
7 |
Author: CodePeople
|
8 |
Author URI: https://form2email.dwbooster.com
|
9 |
Text Domain: contact-form-to-email
|
89 |
add_filter("plugin_action_links_".plugin_basename(__FILE__), array($cp_cfte_plugin,'plugin_page_links'));
|
90 |
add_action('admin_menu', array($cp_cfte_plugin,'admin_menu') );
|
91 |
add_action( 'init', array($cp_cfte_plugin,'gutenberg_block') );
|
92 |
+
add_action( 'wp_loaded', array($cp_cfte_plugin, 'data_management_loaded'));
|
93 |
} else {
|
94 |
add_shortcode( $cp_cfte_plugin->shorttag, array($cp_cfte_plugin, 'filter_content') );
|
95 |
}
|