PluginProbe
Contact Forms by Cimatti / 1.9.2
Contact Forms by Cimatti v1.9.2
2.3.6 2.3.5 2.3.0 2.2.32 2.2.4 2.2.0 2.1.2 2.1.1 trunk 1.0 1.1 1.2 1.2.1 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 All 62 releases
← All changes | contact-forms.php +711 -762 1.3.81.9.2 View file →
@@ -1,762 +1,711 @@
1 -<?php
2 -/*
3 -Plugin Name: WordPress Contact Forms by Cimatti
4 -Description: Quickly create and publish forms in your WordPress powered website.
5 -Version: 1.3.8
6 -Plugin URI: http://www.cimatti.it/wordpress/contact-forms/
7 -Author: Cimatti Consulting
8 -Author URI: http://www.cimatti.it
9 -*/
10 -
11 -/*
12 -WordPress Contact Forms by Cimatti
13 -Copyright (c) 2011-2015 Andrea Cimatti
14 -
15 -This program is free software; you can redistribute it and/or
16 -modify it under the terms of the GNU General Public License
17 -as published by the Free Software Foundation; either version 2
18 -of the License, or (at your option) any later version.
19 -
20 -This program is distributed in the hope that it will be useful,
21 -but WITHOUT ANY WARRANTY; without even the implied warranty of
22 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 -GNU General Public License for more details.
24 -
25 -You should have received a copy of the GNU General Public License
26 -along with this program; if not, write to the Free Software
27 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28 -
29 -
30 -The full copy of the GNU General Public License is available here: http://www.gnu.org/licenses/gpl.txt
31 -
32 -*/
33 -
34 -define('ACCUA_FORMS_DB_VERSION', '3');
35 -define('ACCUA_FORMS_DIR_URL', plugin_dir_url( __FILE__ ));
36 -
37 -require_once('accua-form-api.php');
38 -require_once('accua-forms.php');
39 -require_once('accua-shortcode-button.php');
40 -
41 -function accua_dashboard_page_head(){
42 - $screen = get_current_screen();
43 - $screen->add_help_tab( array(
44 - 'id' => 'accua_help_tab',
45 - 'title' => __('WordPress Contact Forms by Cimatti'),
46 - 'content' => '<p>' . __( 'Marketing tools for WordPress', 'accua-form-api') . '</p>',
47 - ) );
48 -
49 - wp_enqueue_script('accua', plugins_url('/flot/jquery.flot.js', __FILE__ ), array( 'jquery' ));
50 - //wp_enqueue_style('accua_flot', plugins_url('/flot/layout.css', __FILE__ ));
51 - wp_enqueue_style('accua', plugins_url('accua.css', __FILE__ ), array(), '1');
52 -
53 -}
54 -
55 -function accua_dashboard_page()
56 -{
57 - global $wpdb;
58 - $num_posts = $wpdb->get_results("SELECT count(DISTINCT afs_post_id ) as num_row
59 - FROM {$wpdb->prefix}accua_forms_submissions WHERE afs_post_id <> 0 AND afs_status >= 0", ARRAY_A);
60 - $num_forms = $wpdb->get_results("SELECT count(DISTINCT afs_form_id ) as num_row
61 - FROM {$wpdb->prefix}accua_forms_submissions WHERE afs_status >= 0", ARRAY_A);
62 - $num_submissions = $wpdb->get_results("SELECT count(*) as num_row
63 - FROM {$wpdb->prefix}accua_forms_submissions WHERE afs_status >= 0", ARRAY_A);
64 -
65 - //seleziono i campi email
66 - $email_fields = array();
67 - $avail_fields = get_option('accua_forms_avail_fields', array());
68 - foreach($avail_fields as $key=>$single_field){
69 - if($single_field['type'] == 'email' || $single_field['type'] == 'autoreply_email')
70 - $email_fields[] = "'".$key."'";
71 - }
72 - $email_fields_string = implode(',',$email_fields);
73 - $num_emails = $wpdb->get_results("SELECT COUNT(DISTINCT (`afsv_value`)) as num_row
74 - FROM {$wpdb->prefix}accua_forms_submissions, {$wpdb->prefix}accua_forms_submissions_values
75 - WHERE `afs_id` = `afsv_sub_id`
76 - AND afsv_field_id IN ({$email_fields_string})
77 - AND afs_status >= 0", ARRAY_A);
78 -
79 -
80 - $forms_data = get_option('accua_forms_saved_forms', array());
81 -
82 - $fid = '';
83 - $fid_param = '';
84 - if (isset($_GET['fid'])) {
85 - $fid = stripslashes( (string) $_GET['fid'] );
86 - if (isset($forms_data[$fid])) {
87 - $fid_param = $wpdb->prepare('AND afs_form_id = %s', $fid);
88 - } else {
89 - $fid = '';
90 - }
91 - }
92 -
93 -
94 - //costruisco il grafico
95 -
96 - $query_grafico = $wpdb->get_results("SELECT YEAR( afs_submitted ) AS `year` , MONTH( afs_submitted ) AS `month` , COUNT( DISTINCT (`afs_id`) ) AS `submissions` , COUNT( DISTINCT (`afsv_value`)) AS `unique_submissions`
97 - FROM `{$wpdb->prefix}accua_forms_submissions`
98 - LEFT JOIN `{$wpdb->prefix}accua_forms_submissions_values` ON `afs_id` = `afsv_sub_id`
99 - WHERE afsv_field_id IN ({$email_fields_string})
100 - AND afs_status >= 0
101 - $fid_param
102 - GROUP BY `year` , `month`
103 - ORDER BY `year` DESC , `month` DESC");
104 - ?>
105 -
106 - <div id="accua_dashboard_page" class="accua_forms_admin_page wrap">
107 - <div id="icon-contact-forms-cimatti-logo" class="icon32"><br></div>
108 - <h2>WordPress Contact Forms by Cimatti</h2>
109 - <div class="metabox-holder accua-forms-metabox-holder">
110 - <div class="postbox ">
111 - <h3 class="hndle"><span><?php _e('Forms Stats', 'accua-form-api'); ?></span></h3>
112 - <div class="inside" id="dashboard_right_now">
113 - <table>
114 - <tr class="first"><td class="first b"><?php echo $num_forms[0]['num_row']; ?></td><td class="t"><?php _e('Forms', 'accua-form-api'); ?></td></tr>
115 - <tr class="first"><td class="first b"><?php echo $num_posts[0]['num_row']; ?></td><td class="t"><?php _e('Pages', 'accua-form-api'); ?></td></tr>
116 - <tr class="first"><td class="first b"><?php echo $num_submissions[0]['num_row']; ?></td><td class="t"><?php _e('Submissions', 'accua-form-api'); ?></td></tr>
117 - <tr class="first"><td class="first b"><?php echo $num_emails[0]['num_row']; ?></td><td class="t"><?php _e('Distinct Emails', 'accua-form-api'); ?></td></tr>
118 - </table>
119 - <form method="get">
120 - <input type="hidden" name="page" value="accua_forms" />
121 - <select name="fid">
122 - <?php
123 - $selected = ($fid === '') ? 'selected="selected"' : '';
124 - echo "<option value='' $selected >", __('Submissions from all forms', 'accua-form-api'),'</option>';
125 - foreach($forms_data as $ffid => $form) {
126 - $selected = ($fid == $ffid) ? 'selected="selected"' : '';
127 - $title = trim($form['title']);
128 - if ($title === '') {
129 - $title = $ffid;
130 - }
131 - $ffid = htmlspecialchars($ffid, ENT_QUOTES);
132 - $title = htmlspecialchars($title, ENT_QUOTES);
133 - echo "<option value='$ffid' $selected >$title</option>";
134 - }
135 - ?>
136 - </select>
137 - <input type="submit" value="<?php _e('filter', 'accua-form-api') ?>" />
138 - </form>
139 -
140 - <?php
141 - if ($query_grafico) {
142 - echo '<div id="accua-forms-graph-content" ><div id="accua-form-report-graph" style="width: 99%"></div></div>';
143 -
144 - $data = array(
145 - array( 'label' => __('Unique monthly Submissions', 'accua-form-api'), 'data' => array()),
146 - array( 'label' => __('Total monthly Submissions', 'accua-form-api'), 'data' => array()),
147 - );
148 - for($i=date('Y'); $i>=$query_grafico[count($query_grafico)-1]->year; $i-- ) {
149 - $start_month=12;
150 - $end_month = 1;
151 - if($i==date('Y')) $start_month= date('n');
152 - if($i==$query_grafico[count($query_grafico)-1]->year) $end_month=$query_grafico[count($query_grafico)-1]->month;
153 - for($j=$start_month;$j>=$end_month;$j--) {
154 - $time = mktime(0, 0, 0, $j , 1, $i) * 1000;
155 - $find=false;
156 - foreach ($query_grafico as $result){
157 - if(!$find && (int)$result->year == $i && (int)$result->month==$j) {
158 - $data[0]['data'][] = array($time, (int)$result->unique_submissions,$j, $i);
159 - $data[1]['data'][] = array($time, (int)$result->submissions,$j, $i);
160 - $find=true;
161 - }
162 - }
163 - if(!$find)
164 - {
165 - $data[0]['data'][] = array($time, 0,$j, $i);
166 - $data[1]['data'][] = array($time, 0,$j, $i);
167 - }
168 - }
169 - }
170 - ?>
171 - <script type="text/javascript">
172 - var data = <?php echo json_encode($data); ?> ;
173 - var options = {
174 - xaxis: {
175 - //autoscaleMargin: 0.005,
176 - mode: "time",
177 - timeformat: "%b %y",
178 - minTickSize: [1, "month"]
179 - },
180 - legend: {
181 - position: "nw"
182 - },
183 -
184 -
185 - };
186 - jQuery(document).ready(function($) {
187 - jQuery.plot($("#accua-form-report-graph"), data, options);
188 - });
189 -
190 - jQuery(window).resize(function() {
191 - jQuery.plot(jQuery("#accua-form-report-graph"), data, options);
192 - });
193 - </script>
194 - <?php
195 - } else {
196 - echo '<p style="height:100px;">', __('No forms submitted', 'accua-form-api'), '</p>';
197 - } ?>
198 - <?php
199 - $plugin_data = get_plugin_data(__FILE__);
200 - _e('Version', 'accua-form-api'); echo " ".$plugin_data['Version'];
201 - ?>
202 - </div>
203 -
204 - </div>
205 - <span id="accua-forms-version">by Cimatti - <a href="http://www.cimatti.it/wordpress/contact-forms/">www.cimatti.it/wordpress/contact-forms</a>
206 - <br /><?php
207 - $plugin_data = get_plugin_data( __FILE__ );
208 - _e('Version', 'accua-form-api'); echo " ".$plugin_data['Version'];
209 - ?></span>
210 - </div>
211 -<?php
212 -
213 -}
214 -
215 -register_activation_hook(__FILE__, 'accua_forms_install');
216 -function accua_forms_install(){
217 - load_plugin_textdomain( 'accua-form-api', false, ACCUA_FORM_API_PLUGIN_TEXTDOMAIN_PATH);
218 - $modified = false;
219 - $keys = get_option('accua_form_api_keys', array());
220 - if (!isset($keys['hash'])) {
221 - $modified = true;
222 - $keys['hash'] = wp_generate_password(64,true,true);
223 - }
224 - if (!isset($keys['aes'])) {
225 - $modified = true;
226 - $keys['aes'] = wp_generate_password(64,true,true);
227 - }
228 - if ($modified) {
229 - update_option('accua_form_api_keys', $keys);
230 - }
231 -
232 - global $wpdb;
233 -
234 - require_once(ABSPATH.'wp-admin/upgrade-functions.php');
235 -
236 - $charset_collate = '';
237 - if ( ! empty($wpdb->charset) )
238 - $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
239 - if ( ! empty($wpdb->collate) )
240 - $charset_collate .= " COLLATE $wpdb->collate";
241 -
242 - $old_db_version = (int) get_option('accua_forms_db_version', 0);
243 -
244 - if ($old_db_version < 3) {
245 - @ $wpdb->query("ALTER TABLE `{$wpdb->prefix}accua_forms_submissions` DROP INDEX uri");
246 - @ $wpdb->query("ALTER TABLE `{$wpdb->prefix}accua_forms_submissions` DROP INDEX referrer");
247 - }
248 -
249 - $sql = "CREATE TABLE `{$wpdb->prefix}accua_forms_submissions` (
250 - afs_id BIGINT(20) NOT NULL AUTO_INCREMENT,
251 - afs_form_id VARCHAR(77) NOT NULL DEFAULT '',
252 - afs_post_id BIGINT(20) NOT NULL DEFAULT 0,
253 - afs_ip VARCHAR(255) NOT NULL DEFAULT '',
254 - afs_uri TEXT NOT NULL DEFAULT '',
255 - afs_referrer TEXT NOT NULL DEFAULT '',
256 - afs_lang VARCHAR(60) NOT NULL DEFAULT '',
257 - afs_created TIMESTAMP NOT NULL DEFAULT 0,
258 - afs_submitted TIMESTAMP NOT NULL DEFAULT 0,
259 - afs_status TINYINT(1) NOT NULL DEFAULT 0,
260 - afs_stats TEXT NOT NULL DEFAULT '',
261 - PRIMARY KEY (afs_id),
262 - KEY form (afs_form_id, afs_status),
263 - KEY uri (afs_uri(250)),
264 - KEY pid (afs_post_id),
265 - KEY referrer (afs_referrer(250)),
266 - KEY status (afs_status, afs_id)
267 - ) $charset_collate;";
268 - dbDelta($sql);
269 -
270 - $sql = "CREATE TABLE `{$wpdb->prefix}accua_forms_submissions_values` (
271 - afsv_sub_id BIGINT(20) NOT NULL,
272 - afsv_field_id VARCHAR(77) NOT NULL,
273 - afsv_type varchar(255) NOT NULL DEFAULT '',
274 - afsv_value TEXT NOT NULL DEFAULT '',
275 - PRIMARY KEY (afsv_sub_id, afsv_field_id),
276 - KEY value_index (afsv_field_id(77), afsv_value(256))
277 - ) $charset_collate;";
278 - dbDelta($sql);
279 -
280 - $avail_fields = get_option('accua_forms_avail_fields', array());
281 -
282 - if (!is_array($avail_fields)) {
283 - $avail_fields = array();
284 - }
285 -
286 - if (empty($avail_fields) || ($old_db_version === 0)) {
287 - $avail_fields += array(
288 - 'first_name' => array(
289 - 'id' => 'first_name',
290 - 'name' => 'First Name',
291 - 'type' => 'textfield',
292 - 'description' => '',
293 - 'default_value' => '',
294 - 'allowed_values' => '',
295 - ),
296 - 'last_name' => array(
297 - 'id' => 'last_name',
298 - 'name' => 'Last Name',
299 - 'type' => 'textfield',
300 - 'description' => '',
301 - 'default_value' => '',
302 - 'allowed_values' => '',
303 - ),
304 - 'email' => array(
305 - 'id' => 'email',
306 - 'name' => 'Email',
307 - 'type' => 'autoreply_email',
308 - 'description' => '',
309 - 'default_value' => '',
310 - 'allowed_values' => '',
311 - ),
312 - 'address' => array(
313 - 'id' => 'address',
314 - 'name' => 'Address',
315 - 'type' => 'textfield',
316 - 'description' => '',
317 - 'default_value' => '',
318 - 'allowed_values' => '',
319 - ),
320 - 'city' => array(
321 - 'id' => 'city',
322 - 'name' => 'City',
323 - 'type' => 'textfield',
324 - 'description' => '',
325 - 'default_value' => '',
326 - 'allowed_values' => '',
327 - ),
328 - 'state_province' => array(
329 - 'id' => 'state_province',
330 - 'name' => 'State/Province',
331 - 'type' => 'textfield',
332 - 'description' => '',
333 - 'default_value' => '',
334 - 'allowed_values' => '',
335 - ),
336 - 'country' => array(
337 - 'id' => 'country',
338 - 'name' => 'Country',
339 - 'type' => 'select',
340 - 'description' => '',
341 - 'default_value' => '-',
342 - 'allowed_values' => "-|Select...
343 -Afghanistan
344 -Ã…land Islands
345 -Albania
346 -Algeria
347 -American Samoa
348 -Andorra
349 -Angola
350 -Anguilla
351 -Antarctica
352 -Antigua And Barbuda
353 -Argentina
354 -Armenia
355 -Aruba
356 -Australia
357 -Austria
358 -Azerbaijan
359 -Bahamas
360 -Bahrain
361 -Bangladesh
362 -Barbados
363 -Belarus
364 -Belgium
365 -Belize
366 -Benin
367 -Bermuda
368 -Bhutan
369 -Bolivia
370 -Bosnia And Herzegovina
371 -Botswana
372 -Bouvet Island
373 -Brazil
374 -British Indian Ocean Territory
375 -Brunei Darussalam
376 -Bulgaria
377 -Burkina Faso
378 -Burundi
379 -Cambodia
380 -Cameroon
381 -Canada
382 -Cape Verde
383 -Cayman Islands
384 -Central African Republic
385 -Chad
386 -Chile
387 -China
388 -Christmas Island
389 -Cocos (Keeling) Islands
390 -Colombia
391 -Comoros
392 -Congo
393 -Congo, The Democratic Republic Of The
394 -Cook Islands
395 -Costa Rica
396 -Côte D'Ivoire
397 -Croatia
398 -Cuba
399 -Cyprus
400 -Czech Republic
401 -Denmark
402 -Djibouti
403 -Dominica
404 -Dominican Republic
405 -Ecuador
406 -Egypt
407 -El Salvador
408 -Equatorial Guinea
409 -Eritrea
410 -Estonia
411 -Ethiopia
412 -Falkland Islands (Malvinas)
413 -Faroe Islands
414 -Fiji
415 -Finland
416 -France
417 -French Guiana
418 -French Polynesia
419 -French Southern Territories
420 -Gabon
421 -Gambia
422 -Georgia
423 -Germany
424 -Ghana
425 -Gibraltar
426 -Greece
427 -Greenland
428 -Grenada
429 -Guadeloupe
430 -Guam
431 -Guatemala
432 -Guernsey
433 -Guinea
434 -Guinea-Bissau
435 -Guyana
436 -Haiti
437 -Heard Island And Mcdonald Islands
438 -Holy See (Vatican City State)
439 -Honduras
440 -Hong Kong
441 -Hungary
442 -Iceland
443 -India
444 -Indonesia
445 -Iran, Islamic Republic Of
446 -Iraq
447 -Ireland
448 -Isle Of Man
449 -Israel
450 -Italy
451 -Jamaica
452 -Japan
453 -Jersey
454 -Jordan
455 -Kazakhstan
456 -Kenya
457 -Kiribati
458 -Korea, Democratic People'S Republic Of
459 -Korea, Republic Of
460 -Kuwait
461 -Kyrgyzstan
462 -Lao People'S Democratic Republic
463 -Latvia
464 -Lebanon
465 -Lesotho
466 -Liberia
467 -Libyan Arab Jamahiriya
468 -Liechtenstein
469 -Lithuania
470 -Luxembourg
471 -Macao
472 -Macedonia, The Former Yugoslav Republic Of
473 -Madagascar
474 -Malawi
475 -Malaysia
476 -Maldives
477 -Mali
478 -Malta
479 -Marshall Islands
480 -Martinique
481 -Mauritania
482 -Mauritius
483 -Mayotte
484 -Mexico
485 -Micronesia, Federated States Of
486 -Moldova, Republic Of
487 -Monaco
488 -Mongolia
489 -Montenegro
490 -Montserrat
491 -Morocco
492 -Mozambique
493 -Myanmar
494 -Namibia
495 -Nauru
496 -Nepal
497 -Netherlands
498 -Netherlands Antilles
499 -New Caledonia
500 -New Zealand
501 -Nicaragua
502 -Niger
503 -Nigeria
504 -Niue
505 -Norfolk Island
506 -Northern Mariana Islands
507 -Norway
508 -Oman
509 -Pakistan
510 -Palau
511 -Palestinian Territory, Occupied
512 -Panama
513 -Papua New Guinea
514 -Paraguay
515 -Peru
516 -Philippines
517 -Pitcairn
518 -Poland
519 -Portugal
520 -Puerto Rico
521 -Qatar
522 -Réunion
523 -Romania
524 -Russian Federation
525 -Rwanda
526 -Saint Barthélemy
527 -Saint Helena
528 -Saint Kitts And Nevis
529 -Saint Lucia
530 -Saint Martin
531 -Saint Pierre And Miquelon
532 -Saint Vincent And The Grenadines
533 -Samoa
534 -San Marino
535 -Sao Tome And Principe
536 -Saudi Arabia
537 -Senegal
538 -Serbia
539 -Seychelles
540 -Sierra Leone
541 -Singapore
542 -Slovakia
543 -Slovenia
544 -Solomon Islands
545 -Somalia
546 -South Africa
547 -South Georgia And The South Sandwich Islands
548 -Spain
549 -Sri Lanka
550 -Sudan
551 -Suriname
552 -Svalbard And Jan Mayen
553 -Swaziland
554 -Sweden
555 -Switzerland
556 -Syrian Arab Republic
557 -Taiwan, Province Of China
558 -Tajikistan
559 -Tanzania, United Republic Of
560 -Thailand
561 -Timor-Leste
562 -Togo
563 -Tokelau
564 -Tonga
565 -Trinidad And Tobago
566 -Tunisia
567 -Turkey
568 -Turkmenistan
569 -Turks And Caicos Islands
570 -Tuvalu
571 -Uganda
572 -Ukraine
573 -United Arab Emirates
574 -United Kingdom
575 -United States
576 -United States Minor Outlying Islands
577 -Uruguay
578 -Uzbekistan
579 -Vanuatu
580 -Venezuela, Bolivarian Republic Of
581 -Viet Nam
582 -Virgin Islands, British
583 -Virgin Islands, U.S.
584 -Wallis And Futuna
585 -Western Sahara
586 -Yemen
587 -Zambia
588 -Zimbabwe",
589 - ),
590 - 'message' => array(
591 - 'id' => 'message',
592 - 'name' => 'Message',
593 - 'type' => 'textarea',
594 - 'description' => '',
595 - 'default_value' => '',
596 - 'allowed_values' => '',
597 - ),
598 - 'captcha' => array(
599 - 'id' => 'captcha',
600 - 'name' => 'Captcha',
601 - 'type' => 'captcha',
602 - 'description' => '',
603 - 'default_value' => '',
604 - 'allowed_values' => '',
605 - ),
606 - );
607 - update_option('accua_forms_avail_fields', $avail_fields);
608 - }
609 -
610 - $form_data = get_option('accua_forms_default_form_data',array());
611 - if (!is_array($form_data)) {
612 - $form_data = array();
613 - }
614 -
615 - $form_data += array(
616 - 'success_message' => '<div style="padding: 10px; background-color: #fbf8b2; border: 1px solid #f7c84b;">
617 -<h2>Thank you {first_name} {last_name},</h2>
618 -We have received your contact request. Check your inbox for the confirmation message.
619 -
620 -<strong>Can\'t find the email?</strong>
621 -
622 -It doesn\'t happen often but your mailbox could apply strict spam rules that block our email from reaching your inbox. Try checking your spam folder.
623 -
624 -Also check that the email you entered in the form (<strong>{email}</strong>) is correct. If it is not exact you can submit the form again.
625 -
626 -For other possible problems you may have encountered do not hesitate to contact us
627 -
628 -</div>',
629 - 'error_message' => '<div style="padding: 10px; background-color: #fbf8b2; border: 1px solid #f7c84b;">
630 -<h2>Oops! Something went wrong.</h2>
631 -Internet is an awfully complex place and even though we take every precaution to make sure things run smoothly every once in a while things can go wrong that are not under our control.
632 -
633 -Please try filling in the form again.
634 -
635 -For other possible problems you may have encountered do not hesitate to contact us
636 -
637 -</div>',
638 - 'emails_from_name' => '',
639 - 'emails_from' => '',
640 - 'admin_emails_to' => get_option('admin_email', ''),
641 - 'emails_bcc' => '',
642 - 'admin_emails_subject' => 'A contact from your site',
643 - 'admin_emails_message' => '<table style="font-family: \'Lucida Sans\',\'Lucida Grande\', Verdana, Arial, Sans-Serif !important; background: #fff; margin-top: 10px; border: 1px solid #DDDDDD; max-width: 700px;" cellspacing="0" cellpadding="0" align="center">
644 -<tbody>
645 -<tr>
646 -<td>
647 -<table style="max-width:700px;" border="0" cellspacing="0" cellpadding="0" align="center">
648 -<tbody>
649 -<tr>
650 -<td>
651 -<table style="padding: 10px; background-color: #fbf8b2; border: 1px solid #f7c84b; max-width:700px;" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
652 -<tbody>
653 -<tr valign="top">
654 -<td style="max-width:22px;"></td>
655 -<td style="font-family: \'Lucida Sans\',\'Lucida Grande\', Verdana, Arial, Sans-Serif !important; padding: 15px 0px; max-width: 645px;">
656 -<table>
657 -<tbody>
658 -<tr>
659 -<td>On {__submitted_day_month_year} at {__submitted_hour} the following form was filled in.
660 -
661 -<hr />
662 -
663 -<strong>Page where the form was filled in</strong>
664 -<a href="{__url}">{__url}</a></td>
665 -</tr>
666 -<tr>
667 -<td id="submitted_html">{__submitted_html}</td>
668 -</tr>
669 -<tr>
670 -<td>[form_if {__referrer} [<strong>Referrer</strong> - where did the contact come from <em>before reaching the page</em>: {__referrer}]]</td>
671 -</tr>
672 -<tr>
673 -<td><strong>Contact IP</strong> {__ip}
674 -<hr />
675 -</td>
676 -</tr>
677 -<tr>
678 -<td>[form_if {__autoreply} [The contact received in his email <a href="mailto:{email}">{email}</a> the following confirmation message:
679 -<table>
680 -<tbody>
681 -<tr>
682 -<td>{__confirmation_emails_message}</td>
683 -</tr>
684 -</tbody>
685 -</table> ]]
686 -</td>
687 -</tr>
688 -</tbody>
689 -</table>
690 -</td>
691 -<td style="max-width:23px"></td>
692 -</tr>
693 -</tbody>
694 -</table>
695 -</td>
696 -</tr>
697 -</tbody>
698 -</table>
699 -</td>
700 -</tr>
701 -</tbody>
702 -</table>',
703 - 'confirmation_emails_subject' => 'Your message',
704 - 'confirmation_emails_message' => '<h2>Thank you {first_name} {last_name},</h2>
705 -Thank Your for your contact request.
706 -
707 -We will contact you as soon as possible.
708 -
709 -Sincerely,
710 -
711 -The Website Team
712 -
713 -<hr />',
714 -
715 - 'layout' => 'sidebyside',
716 - 'style_margin' => '',
717 - 'style_border_color' => '',
718 - 'style_border_width' => '',
719 - 'style_border_radius' => '',
720 - 'style_background_color' => '',
721 - 'style_padding' => '',
722 - 'style_color' => '',
723 - 'style_font_size' => '',
724 - 'style_field_spacing' => '',
725 - 'style_field_border_color' => '',
726 - 'style_field_border_width' => '',
727 - 'style_field_border_radius' => '',
728 - 'style_field_background_color' => '',
729 - 'style_field_padding' => '',
730 - 'style_field_color' => '',
731 - 'style_submit_border_color' => '',
732 - 'style_submit_border_width' => '',
733 - 'style_submit_border_radius' => '',
734 - 'style_submit_background_color' => '',
735 - 'style_submit_padding' => '',
736 - 'style_submit_color' => '',
737 - 'style_submit_font_size' => '',
738 - );
739 -
740 - update_option('accua_forms_default_form_data', $form_data);
741 - update_option('accua_forms_db_version', ACCUA_FORMS_DB_VERSION);
742 -}
743 -
744 -add_action('admin_init', 'accua_forms_check_db_version_and_update');
745 -function accua_forms_check_db_version_and_update() {
746 - $db_version = get_option('accua_forms_db_version', '');
747 - if (ACCUA_FORMS_DB_VERSION != $db_version) {
748 - accua_forms_install();
749 - }
750 -}
751 -
752 -add_filter( 'robots_txt', 'accua_forms_robots_txt', 10, 2);
753 -function accua_forms_robots_txt($output, $public) {
754 - if ($public) {
755 - $site_url = parse_url( site_url() );
756 - $path = ( !empty( $site_url['path'] ) ) ? $site_url['path'] : '';
757 - $output .= "\nUser-agent: *\n";
758 - $output .= "Allow: $path/wp-admin/js/\n";
759 - $output .= "Allow: $path/wp-admin/css/\n";
760 - }
761 - return $output;
762 -}
1 +<?php
2 +/*
3 +Plugin Name: WordPress Contact Forms by Cimatti
4 +Description: Quickly create and publish forms in your WordPress powered website.
5 +Version: 1.9.2
6 +Plugin URI: https://www.cimatti.it/wordpress/contact-forms/
7 +Author: Cimatti Consulting
8 +Author URI: https://www.cimatti.it
9 +Text Domain: contact-forms
10 +Domain Path: /languages
11 +Requires at least: 3.5
12 +License: GPLv2 or later
13 +License URI: http://www.gnu.org/licenses/gpl-2.0.html
14 +*/
15 +
16 +/*
17 +WordPress Contact Forms by Cimatti
18 +Copyright (c) 2011-2024 Andrea Cimatti
19 +
20 +This program is free software; you can redistribute it and/or
21 +modify it under the terms of the GNU General Public License
22 +as published by the Free Software Foundation; either version 2
23 +of the License, or (at your option) any later version.
24 +
25 +This program is distributed in the hope that it will be useful,
26 +but WITHOUT ANY WARRANTY; without even the implied warranty of
27 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 +GNU General Public License for more details.
29 +
30 +You should have received a copy of the GNU General Public License
31 +along with this program; if not, write to the Free Software
32 +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
33 +
34 +
35 +The full copy of the GNU General Public License is available here: http://www.gnu.org/licenses/gpl.txt
36 +
37 +*/
38 +
39 +define('ACCUA_FORMS_DB_VERSION', '12');
40 +define('ACCUA_FORMS_CSS_VERSION', '53');
41 +define('ACCUA_FORMS_JS_VERSION', '9');
42 +define('ACCUA_FORMS_FILE', __FILE__);
43 +define('ACCUA_FORMS_DIR_URL', plugin_dir_url( ACCUA_FORMS_FILE ));
44 +define('ACCUA_FORMS_DIR', dirname( ACCUA_FORMS_FILE ));
45 +
46 +require_once('accua-form-api.php');
47 +require_once('accua-forms.php');
48 +require_once('accua-shortcode-button.php');
49 +
50 +function accua_forms_dashboard_page_head(){
51 + $screen = get_current_screen();
52 + $screen->add_help_tab( array(
53 + 'id' => 'accua_help_tab',
54 + 'title' => __('Contact Forms Dashboard'),
55 + 'content' => '<p>' . __( 'Marketing tools for WordPress', 'contact-forms') . '</p>',
56 + ) );
57 +
58 + //wp_enqueue_script('accua', plugins_url('/flot/jquery.flot.js', ACCUA_FORMS_FILE ), array( 'jquery' ));
59 + wp_enqueue_script('accua_chart_js', plugins_url('/chartjs/Chart.min.js', ACCUA_FORMS_FILE ), array( 'jquery' ), ACCUA_FORMS_JS_VERSION);
60 + //wp_enqueue_style('accua_flot', plugins_url('/flot/layout.css', ACCUA_FORMS_FILE ));
61 + wp_enqueue_style('accua', plugins_url('accua.css', ACCUA_FORMS_FILE ), array(), ACCUA_FORMS_CSS_VERSION);
62 +
63 + /* Tentativo x drag and drop
64 + $page_hook_id = fx_smb_setings_page_id();
65 + /* Load the JavaScript needed for the settings screen. * /
66 + add_action( 'admin_enqueue_scripts', 'fx_smb_enqueue_scripts' );
67 + add_action( "admin_footer-{$page_hook_id}", 'fx_smb_footer_scripts' );
68 +
69 + /* Set number of column available. * /
70 + add_filter( 'screen_layout_columns', 'fx_smb_screen_layout_column', 10, 2 );
71 + */
72 +}
73 +
74 +/* COSA CARINA PER AGGIUNGERE WIDGET NELLA DASHBOARD DI WP
75 +todo: posso scegliere la sua posizione di default?
76 +*/
77 +add_action( 'wp_dashboard_setup', 'accua_contact_forms_dashboard_add_widgets' );
78 +function accua_contact_forms_dashboard_add_widgets() {
79 + wp_add_dashboard_widget( 'accua_contact_forms_dashboard_widget_news', __( 'Contact Forms', 'contact-forms' ), 'accua_contact_forms_dashboard_widget_news_handler' );
80 +}
81 +
82 +function accua_contact_forms_dashboard_widget_news_handler() {
83 + global $wpdb; ?>
84 + <table>
85 + <tr class="first">
86 + <?php $forms_data = get_option('accua_forms_saved_forms', array());
87 + $active_forms = count($forms_data); ?>
88 + <td class="first b"><?php echo $active_forms; ?></td><td class="t"><?php _e('Active forms', 'contact-forms'); ?></td>
89 + </tr>
90 + <tr class="first">
91 + <?php $pages = $wpdb->get_var("SELECT COUNT(DISTINCT afs_uri) FROM `{$wpdb->prefix}accua_forms_submissions`"); ?>
92 + <td class="first b"><?php echo $pages; ?></td><td class="t"><?php _e('Pages', 'contact-forms'); ?></td>
93 + </tr>
94 + <tr class="first">
95 + <?php $active_submissions = $wpdb->get_var("SELECT COUNT(*) FROM `{$wpdb->prefix}accua_forms_submissions` WHERE afs_status >= 0"); ?>
96 + <td class="first b"><?php echo $active_submissions; ?></td><td class="t"><?php _e('Submissions', 'contact-forms'); ?></td>
97 + </tr>
98 + <tr class="first">
99 + <?php $emails = $wpdb->get_var("SELECT COUNT(DISTINCT afsv_value) FROM `{$wpdb->prefix}accua_forms_submissions_values` WHERE afsv_type LIKE 'autoreply_email'"); ?>
100 + <td class="first b"><?php echo $emails; ?></td><td class="t"><?php _e('Distinct Emails', 'contact-forms'); ?></td>
101 + </tr>
102 + </table>
103 + <br />
104 + <span id="accua-forms-version"><a href="https://www.cimatti.it/wordpress/contact-forms/"><?php
105 + $plugin_data = get_plugin_data( ACCUA_FORMS_FILE );
106 + _e('Version', 'contact-forms'); echo " ".$plugin_data['Version']; ?></a> | <a href="admin.php?page=accua_forms" title="Contact Forms Dashboard"><?php _e('Dashboard', 'contact-forms'); ?></a>
107 + </span>
108 +
109 + <?php
110 +}
111 +
112 +function accua_forms_dashboard_page(){
113 + require_once ACCUA_FORMS_DIR.'/accua-forms-dashboard.php';
114 + return _accua_forms_dashboard_page();
115 +}
116 +
117 +
118 +register_activation_hook(ACCUA_FORMS_FILE, 'accua_forms_install');
119 +function accua_forms_install(){
120 + load_plugin_textdomain( 'contact-forms', false, ACCUA_FORM_API_PLUGIN_TEXTDOMAIN_PATH);
121 + $modified = false;
122 + $keys = get_option('accua_form_api_keys', array());
123 + if (!isset($keys['hash'])) {
124 + $modified = true;
125 + $keys['hash'] = wp_generate_password(64,true,true);
126 + }
127 + if (!isset($keys['aes'])) {
128 + $modified = true;
129 + $keys['aes'] = wp_generate_password(64,true,true);
130 + }
131 + if ($modified) {
132 + update_option('accua_form_api_keys', $keys);
133 + }
134 +
135 + global $wpdb;
136 +
137 + require_once(ABSPATH.'wp-admin/includes/upgrade.php');
138 +
139 + $charset_collate = '';
140 + if ( ! empty($wpdb->charset) )
141 + $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
142 + if ( ! empty($wpdb->collate) )
143 + $charset_collate .= " COLLATE $wpdb->collate";
144 +
145 + $old_db_version = (int) get_option('accua_forms_db_version', 0);
146 +
147 + if ($old_db_version < 3) {
148 + $wpdb_suppress_errors_status = $wpdb->suppress_errors();
149 + $wpdb->query("ALTER TABLE `{$wpdb->prefix}accua_forms_submissions` DROP INDEX uri");
150 + $wpdb->query("ALTER TABLE `{$wpdb->prefix}accua_forms_submissions` DROP INDEX referrer");
151 + $wpdb->suppress_errors($wpdb_suppress_errors_status);
152 + }
153 +
154 + $sql = "CREATE TABLE `{$wpdb->prefix}accua_forms_submissions` (
155 + afs_id BIGINT(20) NOT NULL AUTO_INCREMENT,
156 + afs_form_id VARCHAR(77) NOT NULL DEFAULT '',
157 + afs_post_id BIGINT(20) NOT NULL DEFAULT 0,
158 + afs_ip VARCHAR(255) NOT NULL DEFAULT '',
159 + afs_uri TEXT NOT NULL DEFAULT '',
160 + afs_referrer TEXT NOT NULL DEFAULT '',
161 + afs_lang VARCHAR(60) NOT NULL DEFAULT '',
162 + afs_created TIMESTAMP NOT NULL DEFAULT 0,
163 + afs_submitted TIMESTAMP NOT NULL DEFAULT 0,
164 + afs_status TINYINT(1) NOT NULL DEFAULT 0,
165 + afs_stats TEXT NOT NULL DEFAULT '',
166 + afs_lead_status TINYINT(1) NOT NULL DEFAULT 0,
167 + PRIMARY KEY (afs_id),
168 + KEY form (afs_form_id, afs_status),
169 + KEY uri (afs_uri(190)),
170 + KEY pid (afs_post_id),
171 + KEY referrer (afs_referrer(190)),
172 + KEY status (afs_status, afs_id),
173 + KEY submitted (afs_submitted),
174 + KEY lead_status (afs_lead_status, afs_status)
175 + ) $charset_collate;";
176 + dbDelta($sql);
177 +
178 + $sql = "CREATE TABLE `{$wpdb->prefix}accua_forms_submissions_values` (
179 + afsv_sub_id BIGINT(20) NOT NULL,
180 + afsv_field_id VARCHAR(77) NOT NULL,
181 + afsv_type varchar(255) NOT NULL DEFAULT '',
182 + afsv_value TEXT NOT NULL DEFAULT '',
183 + PRIMARY KEY (afsv_sub_id, afsv_field_id),
184 + KEY value_index (afsv_field_id(77), afsv_value(114))
185 + ) $charset_collate;";
186 + dbDelta($sql);
187 +
188 + /* creazione tabella per le note dell'utente
189 + sono relative a una compilazione
190 + possono esserci più note per ogni compilazione in date diverse
191 +
192 + */
193 + $sql = "CREATE TABLE `{$wpdb->prefix}accua_forms_submissions_notes` (
194 + afsn_sub_id BIGINT(20) NOT NULL,
195 + afsn_date TIMESTAMP NOT NULL DEFAULT 0,
196 + afsn_text TEXT NOT NULL DEFAULT '',
197 + afsn_user VARCHAR(100) NOT NULL DEFAULT '',
198 + PRIMARY KEY (afsn_sub_id, afsn_date),
199 + KEY afsn_sub_id (afsn_sub_id)
200 + ) $charset_collate;";
201 + dbDelta($sql);
202 +
203 +
204 + $avail_fields = get_option('accua_forms_avail_fields', array());
205 +
206 + if (!is_array($avail_fields)) {
207 + $avail_fields = array();
208 + }
209 +
210 + if (empty($avail_fields) || ($old_db_version === 0)) {
211 + $avail_fields += array(
212 + 'first_name' => array(
213 + 'id' => 'first_name',
214 + 'name' => 'First Name',
215 + 'type' => 'textfield',
216 + 'description' => '',
217 + 'default_value' => '',
218 + 'allowed_values' => '',
219 + ),
220 + 'last_name' => array(
221 + 'id' => 'last_name',
222 + 'name' => 'Last Name',
223 + 'type' => 'textfield',
224 + 'description' => '',
225 + 'default_value' => '',
226 + 'allowed_values' => '',
227 + ),
228 + 'email' => array(
229 + 'id' => 'email',
230 + 'name' => 'Email',
231 + 'type' => 'autoreply_email',
232 + 'description' => '',
233 + 'default_value' => '',
234 + 'allowed_values' => '',
235 + ),
236 + 'address' => array(
237 + 'id' => 'address',
238 + 'name' => 'Address',
239 + 'type' => 'textfield',
240 + 'description' => '',
241 + 'default_value' => '',
242 + 'allowed_values' => '',
243 + ),
244 + 'city' => array(
245 + 'id' => 'city',
246 + 'name' => 'City',
247 + 'type' => 'textfield',
248 + 'description' => '',
249 + 'default_value' => '',
250 + 'allowed_values' => '',
251 + ),
252 + 'state_province' => array(
253 + 'id' => 'state_province',
254 + 'name' => 'State/Province',
255 + 'type' => 'textfield',
256 + 'description' => '',
257 + 'default_value' => '',
258 + 'allowed_values' => '',
259 + ),
260 + 'country' => array(
261 + 'id' => 'country',
262 + 'name' => 'Country',
263 + 'type' => 'select',
264 + 'description' => '',
265 + 'default_value' => '-',
266 + 'allowed_values' => "-|Select...
267 +Afghanistan
268 +Ã…land Islands
269 +Albania
270 +Algeria
271 +American Samoa
272 +Andorra
273 +Angola
274 +Anguilla
275 +Antarctica
276 +Antigua And Barbuda
277 +Argentina
278 +Armenia
279 +Aruba
280 +Australia
281 +Austria
282 +Azerbaijan
283 +Bahamas
284 +Bahrain
285 +Bangladesh
286 +Barbados
287 +Belarus
288 +Belgium
289 +Belize
290 +Benin
291 +Bermuda
292 +Bhutan
293 +Bolivia
294 +Bosnia And Herzegovina
295 +Botswana
296 +Bouvet Island
297 +Brazil
298 +British Indian Ocean Territory
299 +Brunei Darussalam
300 +Bulgaria
301 +Burkina Faso
302 +Burundi
303 +Cambodia
304 +Cameroon
305 +Canada
306 +Cape Verde
307 +Cayman Islands
308 +Central African Republic
309 +Chad
310 +Chile
311 +China
312 +Christmas Island
313 +Cocos (Keeling) Islands
314 +Colombia
315 +Comoros
316 +Congo
317 +Congo, The Democratic Republic Of The
318 +Cook Islands
319 +Costa Rica
320 +Côte D'Ivoire
321 +Croatia
322 +Cuba
323 +Cyprus
324 +Czech Republic
325 +Denmark
326 +Djibouti
327 +Dominica
328 +Dominican Republic
329 +Ecuador
330 +Egypt
331 +El Salvador
332 +Equatorial Guinea
333 +Eritrea
334 +Estonia
335 +Ethiopia
336 +Falkland Islands (Malvinas)
337 +Faroe Islands
338 +Fiji
339 +Finland
340 +France
341 +French Guiana
342 +French Polynesia
343 +French Southern Territories
344 +Gabon
345 +Gambia
346 +Georgia
347 +Germany
348 +Ghana
349 +Gibraltar
350 +Greece
351 +Greenland
352 +Grenada
353 +Guadeloupe
354 +Guam
355 +Guatemala
356 +Guernsey
357 +Guinea
358 +Guinea-Bissau
359 +Guyana
360 +Haiti
361 +Heard Island And Mcdonald Islands
362 +Holy See (Vatican City State)
363 +Honduras
364 +Hong Kong
365 +Hungary
366 +Iceland
367 +India
368 +Indonesia
369 +Iran, Islamic Republic Of
370 +Iraq
371 +Ireland
372 +Isle Of Man
373 +Israel
374 +Italy
375 +Jamaica
376 +Japan
377 +Jersey
378 +Jordan
379 +Kazakhstan
380 +Kenya
381 +Kiribati
382 +Korea, Democratic People'S Republic Of
383 +Korea, Republic Of
384 +Kuwait
385 +Kyrgyzstan
386 +Lao People'S Democratic Republic
387 +Latvia
388 +Lebanon
389 +Lesotho
390 +Liberia
391 +Libyan Arab Jamahiriya
392 +Liechtenstein
393 +Lithuania
394 +Luxembourg
395 +Macao
396 +Macedonia, The Former Yugoslav Republic Of
397 +Madagascar
398 +Malawi
399 +Malaysia
400 +Maldives
401 +Mali
402 +Malta
403 +Marshall Islands
404 +Martinique
405 +Mauritania
406 +Mauritius
407 +Mayotte
408 +Mexico
409 +Micronesia, Federated States Of
410 +Moldova, Republic Of
411 +Monaco
412 +Mongolia
413 +Montenegro
414 +Montserrat
415 +Morocco
416 +Mozambique
417 +Myanmar
418 +Namibia
419 +Nauru
420 +Nepal
421 +Netherlands
422 +Netherlands Antilles
423 +New Caledonia
424 +New Zealand
425 +Nicaragua
426 +Niger
427 +Nigeria
428 +Niue
429 +Norfolk Island
430 +Northern Mariana Islands
431 +Norway
432 +Oman
433 +Pakistan
434 +Palau
435 +Palestinian Territory, Occupied
436 +Panama
437 +Papua New Guinea
438 +Paraguay
439 +Peru
440 +Philippines
441 +Pitcairn
442 +Poland
443 +Portugal
444 +Puerto Rico
445 +Qatar
446 +Réunion
447 +Romania
448 +Russian Federation
449 +Rwanda
450 +Saint Barthélemy
451 +Saint Helena
452 +Saint Kitts And Nevis
453 +Saint Lucia
454 +Saint Martin
455 +Saint Pierre And Miquelon
456 +Saint Vincent And The Grenadines
457 +Samoa
458 +San Marino
459 +Sao Tome And Principe
460 +Saudi Arabia
461 +Senegal
462 +Serbia
463 +Seychelles
464 +Sierra Leone
465 +Singapore
466 +Slovakia
467 +Slovenia
468 +Solomon Islands
469 +Somalia
470 +South Africa
471 +South Georgia And The South Sandwich Islands
472 +Spain
473 +Sri Lanka
474 +Sudan
475 +Suriname
476 +Svalbard And Jan Mayen
477 +Swaziland
478 +Sweden
479 +Switzerland
480 +Syrian Arab Republic
481 +Taiwan, Province Of China
482 +Tajikistan
483 +Tanzania, United Republic Of
484 +Thailand
485 +Timor-Leste
486 +Togo
487 +Tokelau
488 +Tonga
489 +Trinidad And Tobago
490 +Tunisia
491 +Turkey
492 +Turkmenistan
493 +Turks And Caicos Islands
494 +Tuvalu
495 +Uganda
496 +Ukraine
497 +United Arab Emirates
498 +United Kingdom
499 +United States
500 +United States Minor Outlying Islands
501 +Uruguay
502 +Uzbekistan
503 +Vanuatu
504 +Venezuela, Bolivarian Republic Of
505 +Viet Nam
506 +Virgin Islands, British
507 +Virgin Islands, U.S.
508 +Wallis And Futuna
509 +Western Sahara
510 +Yemen
511 +Zambia
512 +Zimbabwe",
513 + ),
514 + 'message' => array(
515 + 'id' => 'message',
516 + 'name' => 'Message',
517 + 'type' => 'textarea',
518 + 'description' => '',
519 + 'default_value' => '',
520 + 'allowed_values' => '',
521 + ),
522 + 'captcha' => array(
523 + 'id' => 'captcha',
524 + 'name' => 'Captcha',
525 + 'type' => 'captcha',
526 + 'description' => '',
527 + 'default_value' => '',
528 + 'allowed_values' => '',
529 + ),
530 + );
531 + update_option('accua_forms_avail_fields', $avail_fields);
532 + }
533 +
534 + $form_data = get_option('accua_forms_default_form_data',array());
535 + if (!is_array($form_data)) {
536 + $form_data = array();
537 + }
538 +
539 + $form_data += array(
540 + 'success_message' => '<div style="padding: 0px 30px 10px; background-color: #f4f4f4; border: 1px solid #ddd;">
541 +<h2>Thank you {first_name} {last_name},</h2>
542 +We have received your contact request. Check your inbox for the confirmation message.
543 +
544 +<strong>Can\'t find the email?</strong>
545 +
546 +It doesn\'t happen often but your mailbox could apply strict spam rules that block our email from reaching your inbox. Try checking your spam folder.
547 +
548 +Also check that the email you entered in the form (<strong>{email}</strong>) is correct. If it is not exact you can submit the form again.
549 +
550 +For other possible problems you may have encountered do not hesitate to contact us
551 +
552 +</div>',
553 + 'error_message' => '<div style="padding: 0px 30px 10px; background-color: #f4f4f4; border: 1px solid #ddd;">
554 +<h2>Oops! Something went wrong.</h2>
555 +Internet is an awfully complex place and even though we take every precaution to make sure things run smoothly every once in a while things can go wrong that are not under our control.
556 +
557 +Please try filling in the form again.
558 +
559 +For other possible problems you may have encountered do not hesitate to contact us
560 +
561 +</div>',
562 + 'emails_from_name' => '',
563 + 'emails_from' => '',
564 + 'admin_emails_to' => get_option('admin_email', ''),
565 + 'emails_bcc' => '',
566 + 'admin_emails_subject' => 'A contact from your site',
567 + 'admin_emails_message' => '<table style="font-family: \'Lucida Sans\',\'Lucida Grande\', Verdana, Arial, Sans-Serif !important; background: #fff; margin-top: 10px; border: 1px solid #DDDDDD; max-width: 700px;" cellspacing="0" cellpadding="0" align="center">
568 +<tbody>
569 +<tr>
570 +<td>
571 +<table style="max-width:700px;" border="0" cellspacing="0" cellpadding="0" align="center">
572 +<tbody>
573 +<tr>
574 +<td>
575 +<table style="padding: 10px; background-color: #f4f4f4; border: 1px solid #ddd; max-width:700px;" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
576 +<tbody>
577 +<tr valign="top">
578 +<td style="max-width:22px;"></td>
579 +<td style="font-family: \'Lucida Sans\',\'Lucida Grande\', Verdana, Arial, Sans-Serif !important; padding: 0px 30px 10px; max-width: 645px;">
580 +<table>
581 +<tbody>
582 +<tr>
583 +<td>On {__submitted_day_month_year} at {__submitted_hour} the following form was filled in.
584 +
585 +<hr />
586 +
587 +<strong>Page where the form was filled in</strong>
588 +<a href="{__url}">{__url}</a></td>
589 +</tr>
590 +<tr><td>
591 +<strong>Submission review page</strong>
592 +<a href="{__review_submission_url}">{__review_submission_url}</a>
593 +</td></tr>
594 +<tr>
595 +<td id="submitted_html">{__submitted_html}</td>
596 +</tr>
597 +<tr>
598 +<td>[form_if {__referrer} [<strong>Referrer</strong> - where did the contact come from <em>before reaching the page</em>: {__referrer}]]</td>
599 +</tr>
600 +<tr>
601 +<td><strong>Contact IP</strong> {__anonymized_ip}
602 +<hr />
603 +</td>
604 +</tr>
605 +<tr>
606 +<td>[form_if {__autoreply} [The contact received in his email <a href="mailto:{email}">{email}</a> the following confirmation message:
607 +<table>
608 +<tbody>
609 +<tr>
610 +<td>{__confirmation_emails_message}</td>
611 +</tr>
612 +</tbody>
613 +</table> ]]
614 +</td>
615 +</tr>
616 +</tbody>
617 +</table>
618 +</td>
619 +<td style="max-width:23px"></td>
620 +</tr>
621 +</tbody>
622 +</table>
623 +</td>
624 +</tr>
625 +</tbody>
626 +</table>
627 +</td>
628 +</tr>
629 +</tbody>
630 +</table>',
631 + 'confirmation_emails_subject' => 'Your message',
632 + 'confirmation_emails_message' => '<div>
633 +
634 +<h2>Thank you {first_name} {last_name},</h2>
635 +Thank Your for your contact request.
636 +
637 +We will contact you as soon as possible.
638 +
639 +Sincerely,
640 +
641 +The Website Team
642 +
643 +<hr />
644 +</div>',
645 +
646 + 'layout' => 'sidebyside',
647 + 'style_margin' => '',
648 + 'style_border_color' => '',
649 + 'style_border_width' => '',
650 + 'style_border_radius' => '',
651 + 'style_background_color' => '',
652 + 'style_padding' => '',
653 + 'style_color' => '',
654 + 'style_font_size' => '',
655 + 'style_field_spacing' => '',
656 + 'style_field_border_color' => '',
657 + 'style_field_border_width' => '',
658 + 'style_field_border_radius' => '',
659 + 'style_field_background_color' => '',
660 + 'style_field_padding' => '',
661 + 'style_field_color' => '',
662 + 'style_submit_border_color' => '',
663 + 'style_submit_border_width' => '',
664 + 'style_submit_border_radius' => '',
665 + 'style_submit_background_color' => '',
666 + 'style_submit_padding' => '',
667 + 'style_submit_color' => '',
668 + 'style_submit_font_size' => '',
669 + );
670 +
671 + update_option('accua_forms_default_form_data', $form_data);
672 + update_option('accua_forms_db_version', ACCUA_FORMS_DB_VERSION);
673 +}
674 +
675 +add_action('plugins_loaded', 'accua_forms_check_db_version_and_update', 9);
676 +function accua_forms_check_db_version_and_update() {
677 + $db_version = get_option('accua_forms_db_version', '');
678 + if (ACCUA_FORMS_DB_VERSION != $db_version) {
679 + accua_forms_install();
680 + }
681 +}
682 +
683 +add_filter( 'robots_txt', 'accua_forms_robots_txt', 10, 2);
684 +function accua_forms_robots_txt($output, $public) {
685 + if ($public) {
686 + $site_url = parse_url( site_url() );
687 + $path = ( !empty( $site_url['path'] ) ) ? $site_url['path'] : '';
688 + $output .= "\nUser-agent: *\n";
689 + $output .= "Allow: $path/wp-admin/js/\n";
690 + $output .= "Allow: $path/wp-admin/css/\n";
691 + }
692 + return $output;
693 +}
694 +
695 +function _accua_forms_json_encode($item) {
696 + static $version = NULL;
697 + if ($version === NULL) {
698 + $version = version_compare(PHP_VERSION, '5.3.0', '>=');
699 + }
700 + if ($version) {
701 + return json_encode($item, JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP);
702 + } else {
703 + return strtr(json_encode($item),
704 + array(
705 + '&' => '\\u0026',
706 + '<' => '\\u003C',
707 + '>' => '\\u003E',
708 + ));
709 + }
710 +}
711 +