| 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.5.7 |
| 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-2022 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', '11'); |
| 37 |
define('ACCUA_FORMS_CSS_VERSION', '49'); |
| 38 |
define('ACCUA_FORMS_JS_VERSION', '6'); |
| 39 |
define('ACCUA_FORMS_DIR_URL', plugin_dir_url( __FILE__ )); |
| 40 |
define('ACCUA_FORMS_DIR', dirname( __FILE__ )); |
| 41 |
|
| 42 |
require_once('accua-form-api.php'); |
| 43 |
require_once('accua-forms.php'); |
| 44 |
require_once('accua-shortcode-button.php'); |
| 45 |
|
| 46 |
function accua_forms_dashboard_page_head(){ |
| 47 |
$referer = $_SERVER['HTTP_REFERER']; |
| 48 |
$referer = str_replace(['http://', 'https://'], '', $referer); |
| 49 |
$host = $_SERVER['HTTP_HOST']; |
| 50 |
|
| 51 |
if ( $host !== substr($referer, 0, strlen($host))) { |
| 52 |
wp_die("Accesso non consentito!"); |
| 53 |
} |
| 54 |
$screen = get_current_screen(); |
| 55 |
$screen->add_help_tab( array( |
| 56 |
'id' => 'accua_help_tab', |
| 57 |
'title' => __('Contact Forms Dashboard'), |
| 58 |
'content' => '<p>' . __( 'Marketing tools for WordPress', 'contact-forms') . '</p>', |
| 59 |
) ); |
| 60 |
|
| 61 |
//wp_enqueue_script('accua', plugins_url('/flot/jquery.flot.js', __FILE__ ), array( 'jquery' )); |
| 62 |
wp_enqueue_script('accua_chart_js', plugins_url('/chartjs/Chart.min.js', __FILE__ ), array( 'jquery' ), ACCUA_FORMS_JS_VERSION); |
| 63 |
//wp_enqueue_style('accua_flot', plugins_url('/flot/layout.css', __FILE__ )); |
| 64 |
wp_enqueue_style('accua', plugins_url('accua.css', __FILE__ ), array(), ACCUA_FORMS_CSS_VERSION); |
| 65 |
|
| 66 |
/* Tentativo x drag and drop |
| 67 |
$page_hook_id = fx_smb_setings_page_id(); |
| 68 |
/* Load the JavaScript needed for the settings screen. * / |
| 69 |
add_action( 'admin_enqueue_scripts', 'fx_smb_enqueue_scripts' ); |
| 70 |
add_action( "admin_footer-{$page_hook_id}", 'fx_smb_footer_scripts' ); |
| 71 |
|
| 72 |
/* Set number of column available. * / |
| 73 |
add_filter( 'screen_layout_columns', 'fx_smb_screen_layout_column', 10, 2 ); |
| 74 |
*/ |
| 75 |
} |
| 76 |
|
| 77 |
/* COSA CARINA PER AGGIUNGERE WIDGET NELLA DASHBOARD DI WP |
| 78 |
todo: posso scegliere la sua posizione di default? |
| 79 |
*/ |
| 80 |
add_action( 'wp_dashboard_setup', 'accua_contact_forms_dashboard_add_widgets' ); |
| 81 |
function accua_contact_forms_dashboard_add_widgets() { |
| 82 |
wp_add_dashboard_widget( 'accua_contact_forms_dashboard_widget_news', __( 'Contact Forms', 'contact-forms' ), 'accua_contact_forms_dashboard_widget_news_handler' ); |
| 83 |
} |
| 84 |
|
| 85 |
function accua_contact_forms_dashboard_widget_news_handler() { |
| 86 |
global $wpdb; ?> |
| 87 |
<table> |
| 88 |
<tr class="first"> |
| 89 |
<?php $forms_data = get_option('accua_forms_saved_forms', array()); |
| 90 |
$active_forms = count($forms_data); ?> |
| 91 |
<td class="first b"><?php echo $active_forms; ?></td><td class="t"><?php _e('Active forms', 'contact-forms'); ?></td> |
| 92 |
</tr> |
| 93 |
<tr class="first"> |
| 94 |
<?php $pages = $wpdb->get_var("SELECT COUNT(DISTINCT afs_uri) FROM `{$wpdb->prefix}accua_forms_submissions`"); ?> |
| 95 |
<td class="first b"><?php echo $pages; ?></td><td class="t"><?php _e('Pages', 'contact-forms'); ?></td> |
| 96 |
</tr> |
| 97 |
<tr class="first"> |
| 98 |
<?php $active_submissions = $wpdb->get_var("SELECT COUNT(*) FROM `{$wpdb->prefix}accua_forms_submissions` WHERE afs_status >= 0"); ?> |
| 99 |
<td class="first b"><?php echo $active_submissions; ?></td><td class="t"><?php _e('Submissions', 'contact-forms'); ?></td> |
| 100 |
</tr> |
| 101 |
<tr class="first"> |
| 102 |
<?php $emails = $wpdb->get_var("SELECT COUNT(DISTINCT afsv_value) FROM `{$wpdb->prefix}accua_forms_submissions_values` WHERE afsv_type LIKE 'autoreply_email'"); ?> |
| 103 |
<td class="first b"><?php echo $emails; ?></td><td class="t"><?php _e('Distinct Emails', 'contact-forms'); ?></td> |
| 104 |
</tr> |
| 105 |
</table> |
| 106 |
<br /> |
| 107 |
<span id="accua-forms-version"><a href="https://www.cimatti.it/wordpress/contact-forms/"><?php |
| 108 |
$plugin_data = get_plugin_data( __FILE__ ); |
| 109 |
_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> |
| 110 |
</span> |
| 111 |
|
| 112 |
<?php |
| 113 |
} |
| 114 |
|
| 115 |
function accua_forms_dashboard_page(){ |
| 116 |
require_once ACCUA_FORMS_DIR.'/accua-forms-dashboard.php'; |
| 117 |
return _accua_forms_dashboard_page(); |
| 118 |
} |
| 119 |
|
| 120 |
|
| 121 |
register_activation_hook(__FILE__, 'accua_forms_install'); |
| 122 |
function accua_forms_install(){ |
| 123 |
load_plugin_textdomain( 'contact-forms', false, ACCUA_FORM_API_PLUGIN_TEXTDOMAIN_PATH); |
| 124 |
$modified = false; |
| 125 |
$keys = get_option('accua_form_api_keys', array()); |
| 126 |
if (!isset($keys['hash'])) { |
| 127 |
$modified = true; |
| 128 |
$keys['hash'] = wp_generate_password(64,true,true); |
| 129 |
} |
| 130 |
if (!isset($keys['aes'])) { |
| 131 |
$modified = true; |
| 132 |
$keys['aes'] = wp_generate_password(64,true,true); |
| 133 |
} |
| 134 |
if ($modified) { |
| 135 |
update_option('accua_form_api_keys', $keys); |
| 136 |
} |
| 137 |
|
| 138 |
global $wpdb; |
| 139 |
|
| 140 |
require_once(ABSPATH.'wp-admin/upgrade-functions.php'); |
| 141 |
|
| 142 |
$charset_collate = ''; |
| 143 |
if ( ! empty($wpdb->charset) ) |
| 144 |
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; |
| 145 |
if ( ! empty($wpdb->collate) ) |
| 146 |
$charset_collate .= " COLLATE $wpdb->collate"; |
| 147 |
|
| 148 |
$old_db_version = (int) get_option('accua_forms_db_version', 0); |
| 149 |
|
| 150 |
if ($old_db_version < 3) { |
| 151 |
@ $wpdb->query("ALTER TABLE `{$wpdb->prefix}accua_forms_submissions` DROP INDEX uri"); |
| 152 |
@ $wpdb->query("ALTER TABLE `{$wpdb->prefix}accua_forms_submissions` DROP INDEX referrer"); |
| 153 |
} |
| 154 |
|
| 155 |
$sql = "CREATE TABLE `{$wpdb->prefix}accua_forms_submissions` ( |
| 156 |
afs_id BIGINT(20) NOT NULL AUTO_INCREMENT, |
| 157 |
afs_form_id VARCHAR(77) NOT NULL DEFAULT '', |
| 158 |
afs_post_id BIGINT(20) NOT NULL DEFAULT 0, |
| 159 |
afs_ip VARCHAR(255) NOT NULL DEFAULT '', |
| 160 |
afs_uri TEXT NOT NULL DEFAULT '', |
| 161 |
afs_referrer TEXT NOT NULL DEFAULT '', |
| 162 |
afs_lang VARCHAR(60) NOT NULL DEFAULT '', |
| 163 |
afs_created TIMESTAMP NOT NULL DEFAULT 0, |
| 164 |
afs_submitted TIMESTAMP NOT NULL DEFAULT 0, |
| 165 |
afs_status TINYINT(1) NOT NULL DEFAULT 0, |
| 166 |
afs_stats TEXT NOT NULL DEFAULT '', |
| 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 |
) $charset_collate;"; |
| 175 |
dbDelta($sql); |
| 176 |
|
| 177 |
$sql = "CREATE TABLE `{$wpdb->prefix}accua_forms_submissions_values` ( |
| 178 |
afsv_sub_id BIGINT(20) NOT NULL, |
| 179 |
afsv_field_id VARCHAR(77) NOT NULL, |
| 180 |
afsv_type varchar(255) NOT NULL DEFAULT '', |
| 181 |
afsv_value TEXT NOT NULL DEFAULT '', |
| 182 |
PRIMARY KEY (afsv_sub_id, afsv_field_id), |
| 183 |
KEY value_index (afsv_field_id(77), afsv_value(114)) |
| 184 |
) $charset_collate;"; |
| 185 |
dbDelta($sql); |
| 186 |
|
| 187 |
/* creazione tabella per le note dell'utente |
| 188 |
sono relative a una compilazione |
| 189 |
possono esserci più note per ogni compilazione in date diverse |
| 190 |
|
| 191 |
*/ |
| 192 |
$sql = "CREATE TABLE `{$wpdb->prefix}accua_forms_submissions_notes` ( |
| 193 |
afsn_sub_id BIGINT(20) NOT NULL, |
| 194 |
afsn_date TIMESTAMP NOT NULL DEFAULT 0, |
| 195 |
afsn_text TEXT NOT NULL DEFAULT '', |
| 196 |
afsn_user VARCHAR(100) NOT NULL DEFAULT '', |
| 197 |
PRIMARY KEY (afsn_sub_id, afsn_date), |
| 198 |
KEY afsn_sub_id (afsn_sub_id) |
| 199 |
) $charset_collate;"; |
| 200 |
dbDelta($sql); |
| 201 |
|
| 202 |
|
| 203 |
$avail_fields = get_option('accua_forms_avail_fields', array()); |
| 204 |
|
| 205 |
if (!is_array($avail_fields)) { |
| 206 |
$avail_fields = array(); |
| 207 |
} |
| 208 |
|
| 209 |
if (empty($avail_fields) || ($old_db_version === 0)) { |
| 210 |
$avail_fields += array( |
| 211 |
'first_name' => array( |
| 212 |
'id' => 'first_name', |
| 213 |
'name' => 'First Name', |
| 214 |
'type' => 'textfield', |
| 215 |
'description' => '', |
| 216 |
'default_value' => '', |
| 217 |
'allowed_values' => '', |
| 218 |
), |
| 219 |
'last_name' => array( |
| 220 |
'id' => 'last_name', |
| 221 |
'name' => 'Last Name', |
| 222 |
'type' => 'textfield', |
| 223 |
'description' => '', |
| 224 |
'default_value' => '', |
| 225 |
'allowed_values' => '', |
| 226 |
), |
| 227 |
'email' => array( |
| 228 |
'id' => 'email', |
| 229 |
'name' => 'Email', |
| 230 |
'type' => 'autoreply_email', |
| 231 |
'description' => '', |
| 232 |
'default_value' => '', |
| 233 |
'allowed_values' => '', |
| 234 |
), |
| 235 |
'address' => array( |
| 236 |
'id' => 'address', |
| 237 |
'name' => 'Address', |
| 238 |
'type' => 'textfield', |
| 239 |
'description' => '', |
| 240 |
'default_value' => '', |
| 241 |
'allowed_values' => '', |
| 242 |
), |
| 243 |
'city' => array( |
| 244 |
'id' => 'city', |
| 245 |
'name' => 'City', |
| 246 |
'type' => 'textfield', |
| 247 |
'description' => '', |
| 248 |
'default_value' => '', |
| 249 |
'allowed_values' => '', |
| 250 |
), |
| 251 |
'state_province' => array( |
| 252 |
'id' => 'state_province', |
| 253 |
'name' => 'State/Province', |
| 254 |
'type' => 'textfield', |
| 255 |
'description' => '', |
| 256 |
'default_value' => '', |
| 257 |
'allowed_values' => '', |
| 258 |
), |
| 259 |
'country' => array( |
| 260 |
'id' => 'country', |
| 261 |
'name' => 'Country', |
| 262 |
'type' => 'select', |
| 263 |
'description' => '', |
| 264 |
'default_value' => '-', |
| 265 |
'allowed_values' => "-|Select... |
| 266 |
Afghanistan |
| 267 |
� |
| 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> |
| 591 |
<td id="submitted_html">{__submitted_html}</td> |
| 592 |
</tr> |
| 593 |
<tr> |
| 594 |
<td>[form_if {__referrer} [<strong>Referrer</strong> - where did the contact come from <em>before reaching the page</em>: {__referrer}]]</td> |
| 595 |
</tr> |
| 596 |
<tr> |
| 597 |
<td><strong>Contact IP</strong> {__ip} |
| 598 |
<hr /> |
| 599 |
</td> |
| 600 |
</tr> |
| 601 |
<tr> |
| 602 |
<td>[form_if {__autoreply} [The contact received in his email <a href="mailto:{email}">{email}</a> the following confirmation message: |
| 603 |
<table> |
| 604 |
<tbody> |
| 605 |
<tr> |
| 606 |
<td>{__confirmation_emails_message}</td> |
| 607 |
</tr> |
| 608 |
</tbody> |
| 609 |
</table> ]] |
| 610 |
</td> |
| 611 |
</tr> |
| 612 |
</tbody> |
| 613 |
</table> |
| 614 |
</td> |
| 615 |
<td style="max-width:23px"></td> |
| 616 |
</tr> |
| 617 |
</tbody> |
| 618 |
</table> |
| 619 |
</td> |
| 620 |
</tr> |
| 621 |
</tbody> |
| 622 |
</table> |
| 623 |
</td> |
| 624 |
</tr> |
| 625 |
</tbody> |
| 626 |
</table>', |
| 627 |
'confirmation_emails_subject' => 'Your message', |
| 628 |
'confirmation_emails_message' => '<div> |
| 629 |
|
| 630 |
<h2>Thank you {first_name} {last_name},</h2> |
| 631 |
Thank Your for your contact request. |
| 632 |
|
| 633 |
We will contact you as soon as possible. |
| 634 |
|
| 635 |
Sincerely, |
| 636 |
|
| 637 |
The Website Team |
| 638 |
|
| 639 |
<hr /> |
| 640 |
</div>', |
| 641 |
|
| 642 |
'layout' => 'sidebyside', |
| 643 |
'style_margin' => '', |
| 644 |
'style_border_color' => '', |
| 645 |
'style_border_width' => '', |
| 646 |
'style_border_radius' => '', |
| 647 |
'style_background_color' => '', |
| 648 |
'style_padding' => '', |
| 649 |
'style_color' => '', |
| 650 |
'style_font_size' => '', |
| 651 |
'style_field_spacing' => '', |
| 652 |
'style_field_border_color' => '', |
| 653 |
'style_field_border_width' => '', |
| 654 |
'style_field_border_radius' => '', |
| 655 |
'style_field_background_color' => '', |
| 656 |
'style_field_padding' => '', |
| 657 |
'style_field_color' => '', |
| 658 |
'style_submit_border_color' => '', |
| 659 |
'style_submit_border_width' => '', |
| 660 |
'style_submit_border_radius' => '', |
| 661 |
'style_submit_background_color' => '', |
| 662 |
'style_submit_padding' => '', |
| 663 |
'style_submit_color' => '', |
| 664 |
'style_submit_font_size' => '', |
| 665 |
); |
| 666 |
|
| 667 |
update_option('accua_forms_default_form_data', $form_data); |
| 668 |
update_option('accua_forms_db_version', ACCUA_FORMS_DB_VERSION); |
| 669 |
} |
| 670 |
|
| 671 |
add_action('plugins_loaded', 'accua_forms_check_db_version_and_update', 9); |
| 672 |
function accua_forms_check_db_version_and_update() { |
| 673 |
$db_version = get_option('accua_forms_db_version', ''); |
| 674 |
if (ACCUA_FORMS_DB_VERSION != $db_version) { |
| 675 |
accua_forms_install(); |
| 676 |
} |
| 677 |
} |
| 678 |
|
| 679 |
add_filter( 'robots_txt', 'accua_forms_robots_txt', 10, 2); |
| 680 |
function accua_forms_robots_txt($output, $public) { |
| 681 |
if ($public) { |
| 682 |
$site_url = parse_url( site_url() ); |
| 683 |
$path = ( !empty( $site_url['path'] ) ) ? $site_url['path'] : ''; |
| 684 |
$output .= "\nUser-agent: *\n"; |
| 685 |
$output .= "Allow: $path/wp-admin/js/\n"; |
| 686 |
$output .= "Allow: $path/wp-admin/css/\n"; |
| 687 |
} |
| 688 |
return $output; |
| 689 |
} |
| 690 |
|
| 691 |
function _accua_forms_json_encode($item) { |
| 692 |
static $version = NULL; |
| 693 |
if ($version === NULL) { |
| 694 |
$version = version_compare(PHP_VERSION, '5.3.0', '>='); |
| 695 |
} |
| 696 |
if ($version) { |
| 697 |
return json_encode($item, JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP); |
| 698 |
} else { |
| 699 |
return strtr(json_encode($item), |
| 700 |
array( |
| 701 |
'&' => '\\u0026', |
| 702 |
'<' => '\\u003C', |
| 703 |
'>' => '\\u003E', |
| 704 |
)); |
| 705 |
} |
| 706 |
} |
| 707 |
|
| 708 |
|