PluginProbe
Contact Forms by Cimatti / 1.4.12
Contact Forms by Cimatti v1.4.12
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
contact-forms / contact-forms.php

contact-forms.php in Contact Forms by Cimatti 1.4.12, at contact-forms.php

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