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