Contact Form Email - Version 1.2.75

Version Description

  • Added Elementor integration
Download this release

Release Info

Developer codepeople
Plugin Icon 128x128 Contact Form Email
Version 1.2.75
Comparing to
See all releases

Code changes from version 1.2.74 to 1.2.75

README.txt CHANGED
@@ -451,9 +451,14 @@ When you click a field already added into the contact form builder area, you can
451
  4. contact form validation settings
452
  5. Inserting a contact form into a page
453
  6. Built-in captcha image anti-spam protection
 
 
454
 
455
  == Changelog ==
456
 
 
 
 
457
  = 1.2.74 =
458
  * Fixed bug in form edition
459
 
@@ -983,5 +988,5 @@ When you click a field already added into the contact form builder area, you can
983
 
984
  == Upgrade Notice ==
985
 
986
- = 1.2.74 =
987
- * Fixed bug in form edition
451
  4. contact form validation settings
452
  5. Inserting a contact form into a page
453
  6. Built-in captcha image anti-spam protection
454
+ 7. New Wordpress Editor (Gutemberg) integration
455
+ 8. Elementor integration
456
 
457
  == Changelog ==
458
 
459
+ = 1.2.75 =
460
+ * Added Elementor integration
461
+
462
  = 1.2.74 =
463
  * Fixed bug in form edition
464
 
988
 
989
  == Upgrade Notice ==
990
 
991
+ = 1.2.75 =
992
+ * Added Elementor integration
controllers/elementor/cp-elementor-widget.inc.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!class_exists('CP_ContactFormToEmail_Elementor'))
4
+ {
5
+ class CP_ContactFormToEmail_Elementor {
6
+
7
+ private $prefix = 'cp_contactformtoemail';
8
+
9
+ function __construct() {
10
+ // Register widget for Elementor builder.
11
+ add_action('elementor/widgets/widgets_registered', array($this, 'register_elementor_widget'));
12
+ // Register 10Web category for Elementor widget if 10Web builder doesn't installed.
13
+ add_action('elementor/elements/categories_registered', array($this, 'register_widget_category'), 1, 1);
14
+ //fires after elementor editor styles and scripts are enqueued.
15
+ add_action('elementor/editor/after_enqueue_styles', array($this, 'enqueue_editor_styles'), 11);
16
+ if ((isset($_GET["action"]) && $_GET["action"] == 'elementor') || (isset($_GET["elementor-preview"]) ))
17
+ add_action('elementor/frontend/after_enqueue_styles', array($this, 'enqueue_frontend_styles'), 11);
18
+ }
19
+
20
+ function enqueue_editor_styles() {
21
+ // wp_enqueue_style('cfte-editor-styles', plugins_url('/elementor_icon.css', __FILE__), array(), '1.0.0');
22
+ }
23
+
24
+ function enqueue_frontend_styles() {
25
+ wp_enqueue_style('cfte-publicstyle', plugins_url('/../../css/stylepublic.css', __FILE__));
26
+
27
+ wp_deregister_script('query-stringify');
28
+ wp_register_script('query-stringify', plugins_url('/../../js/jQuery.stringify.js', __FILE__));
29
+
30
+ wp_deregister_script($this->prefix.'_validate_script');
31
+ wp_register_script($this->prefix.'_validate_script', plugins_url('/../../js/jquery.validate.js', __FILE__));
32
+ wp_enqueue_script( $this->prefix.'_builder_script',
33
+ plugins_url('/../../js/fbuilderf.jquery.js', __FILE__),array("jquery","jquery-ui-core","jquery-ui-datepicker","jquery-ui-widget","jquery-ui-position","jquery-ui-tooltip","query-stringify",$this->prefix."_validate_script"), false, true );
34
+ }
35
+
36
+ /**
37
+ * Register widget for Elementor builder.
38
+ */
39
+ function register_elementor_widget() {
40
+ if ( defined('ELEMENTOR_PATH') && class_exists('Elementor\Widget_Base') ) {
41
+ require_once dirname( __FILE__ ) . '/elementorwidget_class.inc.php';
42
+ }
43
+ }
44
+
45
+ /**
46
+ * Register 10Web category for Elementor widget if 10Web builder doesn't installed.
47
+ *
48
+ * @param $elements_manager
49
+ */
50
+ function register_widget_category( $elements_manager ) {
51
+ $elements_manager->add_category(
52
+ 'codepeople-widgets', array(
53
+ 'title' => __('CodePeople', 'codepeople-builder'),
54
+ 'icon' => 'fa fa-envelope',
55
+ ));
56
+ }
57
+
58
+ }
59
+
60
+ }
61
+
62
+ $cp_cfte_elementor_widget = new CP_ContactFormToEmail_Elementor;
63
+
64
+ ?>
controllers/elementor/elementorwidget_class.inc.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Elementor oEmbed Widget.
4
+ *
5
+ * Elementor widget that inserts an embbedable content into the page, from any given URL.
6
+ *
7
+ * @since 1.0.0
8
+ */
9
+ class Elementor_CPCFTE_Widget extends \Elementor\Widget_Base {
10
+
11
+ /**
12
+ * Get widget name.
13
+ *
14
+ * Retrieve widget name.
15
+ *
16
+ * @since 1.0.0
17
+ * @access public
18
+ *
19
+ * @return string Widget name.
20
+ */
21
+ public function get_name() {
22
+ return 'Contact Form to Email';
23
+ }
24
+
25
+ /**
26
+ * Get widget title.
27
+ *
28
+ * Retrieve widget title.
29
+ *
30
+ * @since 1.0.0
31
+ * @access public
32
+ *
33
+ * @return string Widget title.
34
+ */
35
+ public function get_title() {
36
+ return 'Contact Form to Email';
37
+ }
38
+
39
+ /**
40
+ * Get widget icon.
41
+ *
42
+ * Retrieve widget icon.
43
+ *
44
+ * @since 1.0.0
45
+ * @access public
46
+ *
47
+ * @return string Widget icon.
48
+ */
49
+ public function get_icon() {
50
+ return 'fa fa-envelope';
51
+ }
52
+
53
+ /**
54
+ * Get widget categories.
55
+ *
56
+ * Retrieve the list of categories the oEmbed widget belongs to.
57
+ *
58
+ * @since 1.0.0
59
+ * @access public
60
+ *
61
+ * @return array Widget categories.
62
+ */
63
+ public function get_categories() {
64
+ return [ 'codepeople-widgets' ];
65
+ }
66
+
67
+ /**
68
+ * Register oEmbed widget controls.
69
+ *
70
+ * Adds different input fields to allow the user to change and customize the widget settings.
71
+ *
72
+ * @since 1.0.0
73
+ * @access protected
74
+ */
75
+ protected function _register_controls() {
76
+
77
+ global $wpdb, $cp_cfte_plugin;
78
+
79
+ $this->start_controls_section(
80
+ 'content_section',
81
+ [
82
+ 'label' => __( 'Insert Contact Form to Email', 'contact-form-to-email' ),
83
+ 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
84
+ ]
85
+ );
86
+
87
+
88
+ $forms = array();
89
+ $rows = $wpdb->get_results("SELECT id,form_name FROM ".$wpdb->prefix.$cp_cfte_plugin->table_items." ORDER BY form_name");
90
+ foreach ($rows as $item)
91
+ $forms[$item->id] = $item->form_name;
92
+
93
+ $this->add_control(
94
+ 'formid',
95
+ [
96
+ 'label' => __( 'Select Form', 'contact-form-to-email' ),
97
+ 'type' => \Elementor\Controls_Manager::SELECT,
98
+ 'default' => '1',
99
+ 'options' => $forms,
100
+ ]
101
+ );
102
+
103
+ $this->end_controls_section();
104
+
105
+ }
106
+
107
+ /**
108
+ * Render widget output on the frontend.
109
+ *
110
+ * Written in PHP and used to generate the final HTML.
111
+ *
112
+ * @since 1.0.0
113
+ * @access protected
114
+ */
115
+ protected function render() {
116
+ global $cp_cfte_plugin;
117
+
118
+
119
+ $settings = $this->get_settings_for_display();
120
+ $id = $settings["formid"];
121
+
122
+ $cp_cfte_plugin->setId($id);
123
+
124
+ if ( ! \Elementor\Plugin::instance()->editor->is_edit_mode() )
125
+ {
126
+ echo $cp_cfte_plugin->filter_content( array("id" => $id) );
127
+ return;
128
+ }
129
+ else
130
+ {
131
+ $cp_cfte_plugin->print_counter = mt_rand(99999,999999);
132
+ $counter = $cp_cfte_plugin->print_counter;
133
+ echo '<fieldset class="ahbgutenberg_editor" disabled>';
134
+ echo $cp_cfte_plugin->filter_content( array("id" => $id) );
135
+ echo '</fieldset>';
136
+ echo '<script>'.
137
+ 'var id = "'.$counter.'";'.
138
+ 'var cp_appbooking_fbuilder_myconfig = {"obj":"{\"pub\":true,\"identifier\":\"_"+id+"\",\"messages\": {}}"};'.
139
+ 'var f = jQuery("#fbuilder_"+id).fbuilder(jQuery.parseJSON(cp_appbooking_fbuilder_myconfig.obj));'.
140
+ 'f.fBuild.loadData("form_structure_"+id);'.
141
+ '</script>';
142
+ }
143
+
144
+ }
145
+
146
+ }
147
+
148
+ \Elementor\Plugin::instance()->widgets_manager->register_widget_type(new Elementor_CPCFTE_Widget());
controllers/help/elementor.png ADDED
Binary file
controllers/help/gutemberg.png ADDED
Binary file
cp-main-class.inc.php CHANGED
@@ -6,9 +6,9 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
6
  private $prefix = 'cp_contactformtoemail';
7
  private $plugin_name = 'Contact Form to Email';
8
  private $plugin_URL = 'https://form2email.dwbooster.com';
9
- protected $table_items = "cftemail_forms";
10
  private $table_messages = "cftemail_messages";
11
- private $print_counter = 1;
12
  private $include_user_data_csv = false;
13
 
14
  public $shorttag = 'CONTACT_FORM_TO_EMAIL';
6
  private $prefix = 'cp_contactformtoemail';
7
  private $plugin_name = 'Contact Form to Email';
8
  private $plugin_URL = 'https://form2email.dwbooster.com';
9
+ public $table_items = "cftemail_forms";
10
  private $table_messages = "cftemail_messages";
11
+ public $print_counter = 1;
12
  private $include_user_data_csv = false;
13
 
14
  public $shorttag = 'CONTACT_FORM_TO_EMAIL';
cp-publish-wizzard.inc.php CHANGED
@@ -97,9 +97,34 @@ if ($this->get_param('cp_contactformtoemail_do_action_loaded') == 'wizard') {
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 ) {
@@ -110,6 +135,7 @@ if ($this->get_param('cp_contactformtoemail_do_action_loaded') == 'wizard') {
110
  }
111
  ?>
112
  </select>
 
113
  </td>
114
  </tr>
115
  <tr valign="top" id="ppost" style="display:none">
@@ -132,7 +158,7 @@ if ($this->get_param('cp_contactformtoemail_do_action_loaded') == 'wizard') {
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>
@@ -157,16 +183,18 @@ function mvpublish_displayviews(sel) {
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
  }
97
  </td>
98
  </tr>
99
  <tr valign="top" id="ppage" style="display:none">
100
+ <th valign="top"></th>
101
+ <td valign="top">
102
+
103
+ <h3 style="background:#cccccc; padding:5px;">Classic way? Just copy and paste the following shortcode into the page/post:</h3>
104
+
105
+ <div style="border: 1px dotted black; background-color: #FFFACD ;padding:15px; font-weight: bold; margin:10px;">
106
+ [<?php echo $this->shorttag; ?> id="<?php echo $this->item; ?>"]
107
+ </div>
108
+
109
+ <?php if (defined('ELEMENTOR_PATH')) { ?>
110
+ <br />
111
+ <h3 style="background:#cccccc; padding:5px;">Using Elementor?</h3>
112
+
113
+ <img src="<?php echo plugins_url('/controllers/help/elementor.png', __FILE__) ?>">
114
+ <?php } ?>
115
+
116
+ <br />
117
+ <h3 style="background:#cccccc; padding:5px;">Using New WordPress Editor (Gutemberg) ? </h3>
118
+
119
+ <img src="<?php echo plugins_url('/controllers/help/gutemberg.png', __FILE__) ?>">
120
+
121
+ <br />
122
+ <h3 style="background:#cccccc; padding:5px;">Using classic WordPress editor or other editors?</h3>
123
+
124
+ <?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>'; ?>
125
+ <?php _e('which has been added to your Upload/Insert Menu, just below the title of your Post/Page', 'cpappb'); ?>
126
+
127
+ <!-- <select name="publishpage">
128
  <?php
129
  $pages = get_pages();
130
  foreach ( $pages as $page ) {
135
  }
136
  ?>
137
  </select>
138
+ -->
139
  </td>
140
  </tr>
141
  <tr valign="top" id="ppost" style="display:none">
158
  </table>
159
  <hr size="1" />
160
  <div class="ahb-buttons-container">
161
+ <input type="submit" id="subbtnnow" value="Publish Contact Form" class="button button-primary" style="float:right;margin-right:10px" />
162
  <div class="clear"></div>
163
  </div>
164
  </form>
183
  function mvpublish_displayoption(sel) {
184
  document.getElementById("ppost").style.display = 'none';
185
  document.getElementById("ppage").style.display = 'none';
186
+ document.getElementById("posttitle").style.display = 'none';
187
+ document.getElementById("subbtnnow").style.display = '';
188
  if (sel.selectedIndex == 4)
189
  {
190
  alert('Widget option available only in commercial versions. Upgrade required for this option.');
191
  sel.selectedIndex = 0;
192
  }
193
+ else if (sel.selectedIndex == 2 || sel.selectedIndex == 3)
194
+ {
195
  document.getElementById("ppage").style.display = '';
196
+ document.getElementById("subbtnnow").style.display = 'none';
197
+ }
198
  else if (sel.selectedIndex == 1 || sel.selectedIndex == 0)
199
  document.getElementById("posttitle").style.display = '';
200
  }
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.74
7
  Author: CodePeople
8
  Author URI: https://form2email.dwbooster.com
9
  Text Domain: contact-form-to-email
@@ -132,4 +132,8 @@ function cpcfte_sbp_fix_conflict($option)
132
  return $option;
133
  }
134
 
 
 
 
 
135
  ?>
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.75
7
  Author: CodePeople
8
  Author URI: https://form2email.dwbooster.com
9
  Text Domain: contact-form-to-email
132
  return $option;
133
  }
134
 
135
+ // elementor integration
136
+ include_once dirname( __FILE__ ) . '/controllers/elementor/cp-elementor-widget.inc.php';
137
+
138
+
139
  ?>