Version Description
- 2017-08-01
Download this release
Release Info
| Developer | codeinwp |
| Plugin | |
| Version | 2.0.1 |
| Comparing to | |
| See all releases | |
Code changes from version 2.0.0 to 2.0.1
- CHANGELOG.md +3 -2
- includes/class-pirateforms.php +2 -1
- languages/pirate-forms.pot +46 -36
- pirate-forms.php +2 -2
- public/class-pirateforms-public.php +446 -401
- public/css/front.css +1 -1
- public/partials/pirateforms-form.php +24 -24
- readme.txt +13 -0
- vendor/autoload.php +1 -1
- vendor/autoload_52.php +1 -1
- vendor/composer/autoload_real.php +5 -5
- vendor/composer/autoload_real_52.php +3 -3
- vendor/composer/installed.json +3 -2
CHANGELOG.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
|
| 2 |
-
### v2.0.
|
| 3 |
**Changes:**
|
| 4 |
-
|
|
|
|
| 5 |
### v2.0.0 - 2017-08-01
|
| 6 |
**Changes:**
|
| 7 |
* Major code refactor ( Please TEST BEFORE updating).
|
| 1 |
|
| 2 |
+
### v2.0.1 - 2017-08-01
|
| 3 |
**Changes:**
|
| 4 |
+
* Fixed backwards compatibility with Zerif themes
|
| 5 |
+
|
| 6 |
### v2.0.0 - 2017-08-01
|
| 7 |
**Changes:**
|
| 8 |
* Major code refactor ( Please TEST BEFORE updating).
|
includes/class-pirateforms.php
CHANGED
|
@@ -69,7 +69,7 @@ class PirateForms {
|
|
| 69 |
public function __construct() {
|
| 70 |
|
| 71 |
$this->plugin_name = 'pirateforms';
|
| 72 |
-
$this->version = '2.0.
|
| 73 |
|
| 74 |
$this->load_dependencies();
|
| 75 |
$this->set_locale();
|
|
@@ -162,6 +162,7 @@ class PirateForms {
|
|
| 162 |
$this->loader->add_action( 'pirate_unittesting_template_redirect', $plugin_public, 'template_redirect' );
|
| 163 |
|
| 164 |
$this->loader->add_filter( 'widget_text', $plugin_public, 'widget_text_filter', 9 );
|
|
|
|
| 165 |
|
| 166 |
add_shortcode( 'pirate_forms', array( $plugin_public, 'display_form' ) );
|
| 167 |
}
|
| 69 |
public function __construct() {
|
| 70 |
|
| 71 |
$this->plugin_name = 'pirateforms';
|
| 72 |
+
$this->version = '2.0.1';
|
| 73 |
|
| 74 |
$this->load_dependencies();
|
| 75 |
$this->set_locale();
|
| 162 |
$this->loader->add_action( 'pirate_unittesting_template_redirect', $plugin_public, 'template_redirect' );
|
| 163 |
|
| 164 |
$this->loader->add_filter( 'widget_text', $plugin_public, 'widget_text_filter', 9 );
|
| 165 |
+
$this->loader->add_filter( 'pirate_forms_public_controls', $plugin_public, 'compatibility_class', 9 );
|
| 166 |
|
| 167 |
add_shortcode( 'pirate_forms', array( $plugin_public, 'display_form' ) );
|
| 168 |
}
|
languages/pirate-forms.pot
CHANGED
|
@@ -4,7 +4,7 @@ msgid ""
|
|
| 4 |
msgstr ""
|
| 5 |
"Project-Id-Version: Free & Simple Contact Form Plugin - Pirateforms 2.0.0\n"
|
| 6 |
"Report-Msgid-Bugs-To: https://github.com/Codeinwp/pirate-forms/issues\n"
|
| 7 |
-
"POT-Creation-Date: 2017-08-01
|
| 8 |
"MIME-Version: 1.0\n"
|
| 9 |
"Content-Type: text/plain; charset=utf-8\n"
|
| 10 |
"Content-Transfer-Encoding: 8bit\n"
|
|
@@ -437,107 +437,117 @@ msgstr ""
|
|
| 437 |
msgid "Subtext:"
|
| 438 |
msgstr ""
|
| 439 |
|
| 440 |
-
#: includes/class-pirateforms.php:
|
| 441 |
msgid "Add New Contact"
|
| 442 |
msgstr ""
|
| 443 |
|
| 444 |
-
#: includes/class-pirateforms.php:
|
| 445 |
msgid "New Contact"
|
| 446 |
msgstr ""
|
| 447 |
|
| 448 |
-
#: includes/class-pirateforms.php:
|
| 449 |
msgid "Edit Contact"
|
| 450 |
msgstr ""
|
| 451 |
|
| 452 |
-
#: includes/class-pirateforms.php:
|
| 453 |
msgid "View Contact"
|
| 454 |
msgstr ""
|
| 455 |
|
| 456 |
-
#: includes/class-pirateforms.php:
|
| 457 |
msgid "All Contacts"
|
| 458 |
msgstr ""
|
| 459 |
|
| 460 |
-
#: includes/class-pirateforms.php:
|
| 461 |
msgid "Search Contacts"
|
| 462 |
msgstr ""
|
| 463 |
|
| 464 |
-
#: includes/class-pirateforms.php:
|
| 465 |
msgid "Parent Contacts:"
|
| 466 |
msgstr ""
|
| 467 |
|
| 468 |
-
#: includes/class-pirateforms.php:
|
| 469 |
msgid "No contacts found."
|
| 470 |
msgstr ""
|
| 471 |
|
| 472 |
-
#: includes/class-pirateforms.php:
|
| 473 |
msgid "No contacts found in Trash."
|
| 474 |
msgstr ""
|
| 475 |
|
| 476 |
-
#: includes/class-pirateforms.php:
|
| 477 |
msgid "Contacts from Pirate Forms"
|
| 478 |
msgstr ""
|
| 479 |
|
| 480 |
-
#: public/class-pirateforms-public.php:
|
| 481 |
msgid "Nonce failed!"
|
| 482 |
msgstr ""
|
| 483 |
|
| 484 |
-
#: public/class-pirateforms-public.php:
|
| 485 |
msgid "Form submission failed!"
|
| 486 |
msgstr ""
|
| 487 |
|
| 488 |
-
#: public/class-pirateforms-public.php:
|
| 489 |
msgid "Contact form submission from"
|
| 490 |
msgstr ""
|
| 491 |
|
| 492 |
-
#: public/class-pirateforms-public.php:
|
| 493 |
msgid "Please enter one or more Contact submission recipients"
|
| 494 |
msgstr ""
|
| 495 |
|
| 496 |
-
#: public/class-pirateforms-public.php:
|
| 497 |
msgid "IP address: "
|
| 498 |
msgstr ""
|
| 499 |
|
| 500 |
-
#: public/class-pirateforms-public.php:
|
| 501 |
msgid "IP search:"
|
| 502 |
msgstr ""
|
| 503 |
|
| 504 |
-
#: public/class-pirateforms-public.php:
|
| 505 |
msgid "Came from: "
|
| 506 |
msgstr ""
|
| 507 |
|
| 508 |
-
#: public/class-pirateforms-public.php:
|
| 509 |
msgid "Sent from page: "
|
| 510 |
msgstr ""
|
| 511 |
|
| 512 |
-
#: public/class-pirateforms-public.php:
|
| 513 |
-
|
|
|
|
| 514 |
msgstr ""
|
| 515 |
|
| 516 |
-
#: public/class-pirateforms-public.php:
|
| 517 |
msgid "Form submission blocked!"
|
| 518 |
msgstr ""
|
| 519 |
|
| 520 |
-
#: public/class-pirateforms-public.php:
|
| 521 |
-
#: public/class-pirateforms-public.php:817
|
| 522 |
-
msgid "Wrong reCAPTCHA"
|
| 523 |
-
msgstr ""
|
| 524 |
-
|
| 525 |
-
#: public/class-pirateforms-public.php:847
|
| 526 |
msgid "Uploaded file is not allowed for file type"
|
| 527 |
msgstr ""
|
| 528 |
|
| 529 |
-
#: public/class-pirateforms-public.php:
|
| 530 |
msgid "Uploaded file is too large"
|
| 531 |
msgstr ""
|
| 532 |
|
| 533 |
-
#: public/class-pirateforms-public.php:
|
| 534 |
msgid "There was an unknown error uploading the file."
|
| 535 |
msgstr ""
|
| 536 |
|
| 537 |
-
#: public/
|
|
|
|
|
|
|
|
|
|
|
|
|
| 538 |
msgid "Sorry, an error occured."
|
| 539 |
msgstr ""
|
| 540 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 541 |
#. Plugin Name of the plugin/theme
|
| 542 |
msgid "Free & Simple Contact Form Plugin - Pirateforms"
|
| 543 |
msgstr ""
|
|
@@ -558,27 +568,27 @@ msgstr ""
|
|
| 558 |
msgid "http://themeisle.com"
|
| 559 |
msgstr ""
|
| 560 |
|
| 561 |
-
#: includes/class-pirateforms.php:
|
| 562 |
msgctxt "post type general name"
|
| 563 |
msgid "Contacts"
|
| 564 |
msgstr ""
|
| 565 |
|
| 566 |
-
#: includes/class-pirateforms.php:
|
| 567 |
msgctxt "post type singular name"
|
| 568 |
msgid "Contact"
|
| 569 |
msgstr ""
|
| 570 |
|
| 571 |
-
#: includes/class-pirateforms.php:
|
| 572 |
msgctxt "admin menu"
|
| 573 |
msgid "Contacts"
|
| 574 |
msgstr ""
|
| 575 |
|
| 576 |
-
#: includes/class-pirateforms.php:
|
| 577 |
msgctxt "add new on admin bar"
|
| 578 |
msgid "Contact"
|
| 579 |
msgstr ""
|
| 580 |
|
| 581 |
-
#: includes/class-pirateforms.php:
|
| 582 |
msgctxt "contact"
|
| 583 |
msgid "Add New"
|
| 584 |
msgstr ""
|
| 4 |
msgstr ""
|
| 5 |
"Project-Id-Version: Free & Simple Contact Form Plugin - Pirateforms 2.0.0\n"
|
| 6 |
"Report-Msgid-Bugs-To: https://github.com/Codeinwp/pirate-forms/issues\n"
|
| 7 |
+
"POT-Creation-Date: 2017-08-01 13:19:16+00:00\n"
|
| 8 |
"MIME-Version: 1.0\n"
|
| 9 |
"Content-Type: text/plain; charset=utf-8\n"
|
| 10 |
"Content-Transfer-Encoding: 8bit\n"
|
| 437 |
msgid "Subtext:"
|
| 438 |
msgstr ""
|
| 439 |
|
| 440 |
+
#: includes/class-pirateforms.php:225
|
| 441 |
msgid "Add New Contact"
|
| 442 |
msgstr ""
|
| 443 |
|
| 444 |
+
#: includes/class-pirateforms.php:226
|
| 445 |
msgid "New Contact"
|
| 446 |
msgstr ""
|
| 447 |
|
| 448 |
+
#: includes/class-pirateforms.php:227
|
| 449 |
msgid "Edit Contact"
|
| 450 |
msgstr ""
|
| 451 |
|
| 452 |
+
#: includes/class-pirateforms.php:228
|
| 453 |
msgid "View Contact"
|
| 454 |
msgstr ""
|
| 455 |
|
| 456 |
+
#: includes/class-pirateforms.php:229
|
| 457 |
msgid "All Contacts"
|
| 458 |
msgstr ""
|
| 459 |
|
| 460 |
+
#: includes/class-pirateforms.php:230
|
| 461 |
msgid "Search Contacts"
|
| 462 |
msgstr ""
|
| 463 |
|
| 464 |
+
#: includes/class-pirateforms.php:231
|
| 465 |
msgid "Parent Contacts:"
|
| 466 |
msgstr ""
|
| 467 |
|
| 468 |
+
#: includes/class-pirateforms.php:232
|
| 469 |
msgid "No contacts found."
|
| 470 |
msgstr ""
|
| 471 |
|
| 472 |
+
#: includes/class-pirateforms.php:233
|
| 473 |
msgid "No contacts found in Trash."
|
| 474 |
msgstr ""
|
| 475 |
|
| 476 |
+
#: includes/class-pirateforms.php:237
|
| 477 |
msgid "Contacts from Pirate Forms"
|
| 478 |
msgstr ""
|
| 479 |
|
| 480 |
+
#: public/class-pirateforms-public.php:121
|
| 481 |
msgid "Nonce failed!"
|
| 482 |
msgstr ""
|
| 483 |
|
| 484 |
+
#: public/class-pirateforms-public.php:130
|
| 485 |
msgid "Form submission failed!"
|
| 486 |
msgstr ""
|
| 487 |
|
| 488 |
+
#: public/class-pirateforms-public.php:140
|
| 489 |
msgid "Contact form submission from"
|
| 490 |
msgstr ""
|
| 491 |
|
| 492 |
+
#: public/class-pirateforms-public.php:167
|
| 493 |
msgid "Please enter one or more Contact submission recipients"
|
| 494 |
msgstr ""
|
| 495 |
|
| 496 |
+
#: public/class-pirateforms-public.php:182
|
| 497 |
msgid "IP address: "
|
| 498 |
msgstr ""
|
| 499 |
|
| 500 |
+
#: public/class-pirateforms-public.php:183
|
| 501 |
msgid "IP search:"
|
| 502 |
msgstr ""
|
| 503 |
|
| 504 |
+
#: public/class-pirateforms-public.php:188
|
| 505 |
msgid "Came from: "
|
| 506 |
msgstr ""
|
| 507 |
|
| 508 |
+
#: public/class-pirateforms-public.php:192
|
| 509 |
msgid "Sent from page: "
|
| 510 |
msgstr ""
|
| 511 |
|
| 512 |
+
#: public/class-pirateforms-public.php:326
|
| 513 |
+
#: public/class-pirateforms-public.php:338
|
| 514 |
+
msgid "Wrong reCAPTCHA"
|
| 515 |
msgstr ""
|
| 516 |
|
| 517 |
+
#: public/class-pirateforms-public.php:391
|
| 518 |
msgid "Form submission blocked!"
|
| 519 |
msgstr ""
|
| 520 |
|
| 521 |
+
#: public/class-pirateforms-public.php:423
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 522 |
msgid "Uploaded file is not allowed for file type"
|
| 523 |
msgstr ""
|
| 524 |
|
| 525 |
+
#: public/class-pirateforms-public.php:431
|
| 526 |
msgid "Uploaded file is too large"
|
| 527 |
msgstr ""
|
| 528 |
|
| 529 |
+
#: public/class-pirateforms-public.php:447
|
| 530 |
msgid "There was an unknown error uploading the file."
|
| 531 |
msgstr ""
|
| 532 |
|
| 533 |
+
#: public/class-pirateforms-public.php:818
|
| 534 |
+
msgid "Submit"
|
| 535 |
+
msgstr ""
|
| 536 |
+
|
| 537 |
+
#: public/partials/pirateforms-form.php:29
|
| 538 |
msgid "Sorry, an error occured."
|
| 539 |
msgstr ""
|
| 540 |
|
| 541 |
+
#: vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-licenser.php:476
|
| 542 |
+
msgid ""
|
| 543 |
+
"Updating this theme will lose any customizations you have made. Cancel to "
|
| 544 |
+
"stop, OK to update."
|
| 545 |
+
msgstr ""
|
| 546 |
+
|
| 547 |
+
#: vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-widget-dashboard-blog.php:212
|
| 548 |
+
msgid "Install"
|
| 549 |
+
msgstr ""
|
| 550 |
+
|
| 551 |
#. Plugin Name of the plugin/theme
|
| 552 |
msgid "Free & Simple Contact Form Plugin - Pirateforms"
|
| 553 |
msgstr ""
|
| 568 |
msgid "http://themeisle.com"
|
| 569 |
msgstr ""
|
| 570 |
|
| 571 |
+
#: includes/class-pirateforms.php:220
|
| 572 |
msgctxt "post type general name"
|
| 573 |
msgid "Contacts"
|
| 574 |
msgstr ""
|
| 575 |
|
| 576 |
+
#: includes/class-pirateforms.php:221
|
| 577 |
msgctxt "post type singular name"
|
| 578 |
msgid "Contact"
|
| 579 |
msgstr ""
|
| 580 |
|
| 581 |
+
#: includes/class-pirateforms.php:222
|
| 582 |
msgctxt "admin menu"
|
| 583 |
msgid "Contacts"
|
| 584 |
msgstr ""
|
| 585 |
|
| 586 |
+
#: includes/class-pirateforms.php:223
|
| 587 |
msgctxt "add new on admin bar"
|
| 588 |
msgid "Contact"
|
| 589 |
msgstr ""
|
| 590 |
|
| 591 |
+
#: includes/class-pirateforms.php:224
|
| 592 |
msgctxt "contact"
|
| 593 |
msgid "Add New"
|
| 594 |
msgstr ""
|
pirate-forms.php
CHANGED
|
@@ -16,7 +16,7 @@
|
|
| 16 |
* Plugin Name: Free & Simple Contact Form Plugin - Pirateforms
|
| 17 |
* Plugin URI: http://themeisle.com/plugins/pirate-forms/
|
| 18 |
* Description: Easily creates a nice looking, simple contact form on your WP site.
|
| 19 |
-
* Version: 2.0.
|
| 20 |
* Author: Themeisle
|
| 21 |
* Author URI: http://themeisle.com
|
| 22 |
* Text Domain: pirate-forms
|
|
@@ -34,7 +34,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
| 34 |
|
| 35 |
define( 'PIRATEFORMS_NAME', 'Pirate Forms' );
|
| 36 |
define( 'PIRATEFORMS_SLUG', 'pirate-forms' );
|
| 37 |
-
define( 'PIRATE_FORMS_VERSION', '2.0.
|
| 38 |
define( 'PIRATEFORMS_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
|
| 39 |
define( 'PIRATEFORMS_URL', plugin_dir_url( __FILE__ ) );
|
| 40 |
define( 'PIRATEFORMS_BASENAME', plugin_basename( __FILE__ ) );
|
| 16 |
* Plugin Name: Free & Simple Contact Form Plugin - Pirateforms
|
| 17 |
* Plugin URI: http://themeisle.com/plugins/pirate-forms/
|
| 18 |
* Description: Easily creates a nice looking, simple contact form on your WP site.
|
| 19 |
+
* Version: 2.0.1
|
| 20 |
* Author: Themeisle
|
| 21 |
* Author URI: http://themeisle.com
|
| 22 |
* Text Domain: pirate-forms
|
| 34 |
|
| 35 |
define( 'PIRATEFORMS_NAME', 'Pirate Forms' );
|
| 36 |
define( 'PIRATEFORMS_SLUG', 'pirate-forms' );
|
| 37 |
+
define( 'PIRATE_FORMS_VERSION', '2.0.1' );
|
| 38 |
define( 'PIRATEFORMS_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
|
| 39 |
define( 'PIRATEFORMS_URL', plugin_dir_url( __FILE__ ) );
|
| 40 |
define( 'PIRATEFORMS_BASENAME', plugin_basename( __FILE__ ) );
|
public/class-pirateforms-public.php
CHANGED
|
@@ -27,7 +27,7 @@ class PirateForms_Public {
|
|
| 27 |
*
|
| 28 |
* @since 1.0.0
|
| 29 |
* @access private
|
| 30 |
-
* @var string
|
| 31 |
*/
|
| 32 |
private $plugin_name;
|
| 33 |
|
|
@@ -36,7 +36,7 @@ class PirateForms_Public {
|
|
| 36 |
*
|
| 37 |
* @since 1.0.0
|
| 38 |
* @access private
|
| 39 |
-
* @var string
|
| 40 |
*/
|
| 41 |
private $version;
|
| 42 |
|
|
@@ -44,13 +44,14 @@ class PirateForms_Public {
|
|
| 44 |
* Initialize the class and set its properties.
|
| 45 |
*
|
| 46 |
* @since 1.0.0
|
| 47 |
-
*
|
| 48 |
-
* @param string $
|
|
|
|
| 49 |
*/
|
| 50 |
public function __construct( $plugin_name, $version ) {
|
| 51 |
|
| 52 |
$this->plugin_name = $plugin_name;
|
| 53 |
-
$this->version
|
| 54 |
|
| 55 |
}
|
| 56 |
|
|
@@ -108,10 +109,10 @@ class PirateForms_Public {
|
|
| 108 |
}
|
| 109 |
|
| 110 |
// separate the nonce from a form that is displayed in the widget vs. one that is not
|
| 111 |
-
$nonce_append
|
| 112 |
|
| 113 |
// Session variable for form errors
|
| 114 |
-
$error_key
|
| 115 |
$_SESSION[ $error_key ] = array();
|
| 116 |
|
| 117 |
// If nonce is not valid, beat it
|
|
@@ -119,6 +120,7 @@ class PirateForms_Public {
|
|
| 119 |
if ( ! wp_verify_nonce( $_POST['wordpress-nonce'], get_bloginfo( 'admin_email' ) . $nonce_append ) ) {
|
| 120 |
$_SESSION[ $error_key ]['nonce'] = __( 'Nonce failed!', 'pirate-forms' );
|
| 121 |
do_action( 'themeisle_log_event', PIRATEFORMS_NAME, 'Nonce failed', 'error', __FILE__, __LINE__ );
|
|
|
|
| 122 |
return false;
|
| 123 |
}
|
| 124 |
}
|
|
@@ -141,9 +143,9 @@ class PirateForms_Public {
|
|
| 141 |
$body .= '<table>';
|
| 142 |
|
| 143 |
$pirate_forms_contact_email = null;
|
| 144 |
-
$fields
|
| 145 |
foreach ( $fields as $field ) {
|
| 146 |
-
$value
|
| 147 |
if ( PirateForms_Util::get_option( 'pirateformsopt_' . $field . '_field' ) === 'req' && empty( $value ) ) {
|
| 148 |
$_SESSION[ $error_key ][ 'pirate-forms-contact-' . $field ] = PirateForms_Util::get_option( 'pirateformsopt_label_err_' . $field );
|
| 149 |
} elseif ( ! empty( $value ) ) {
|
|
@@ -238,16 +240,16 @@ class PirateForms_Public {
|
|
| 238 |
$headers = "From: $send_from_name <$send_from>\r\nReply-To: $pirate_forms_contact_name <$pirate_forms_contact_email>\r\nContent-type: text/html";
|
| 239 |
add_action( 'phpmailer_init', array( $this, 'phpmailer' ) );
|
| 240 |
|
| 241 |
-
$attachments
|
| 242 |
if ( is_bool( $attachments ) ) {
|
| 243 |
return false;
|
| 244 |
}
|
| 245 |
|
| 246 |
-
$subject
|
| 247 |
|
| 248 |
do_action( 'pirate_forms_before_sending', $site_recipients, $subject, $body, $headers, $attachments );
|
| 249 |
do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'before sending email to = %s, subject = %s, body = %s, headers = %s, attachments = %s', $site_recipients, $subject, $body, $headers, print_r( $attachments, true ) ), 'debug', __FILE__, __LINE__ );
|
| 250 |
-
$response
|
| 251 |
do_action( 'pirate_forms_after_sending', $response, $site_recipients, $subject, $body, $headers, $attachments );
|
| 252 |
do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'after sending email, response = %s', $response ), 'debug', __FILE__, __LINE__ );
|
| 253 |
|
|
@@ -269,7 +271,7 @@ class PirateForms_Public {
|
|
| 269 |
|
| 270 |
do_action( 'pirate_forms_before_sending_confirm', $pirate_forms_contact_email, $subject, $confirm_body, $headers );
|
| 271 |
do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'before sending confirm email to = %s, subject = %s, body = %s, headers = %s', $pirate_forms_contact_email, $subject, $confirm_body, $headers ), 'debug', __FILE__, __LINE__ );
|
| 272 |
-
$response
|
| 273 |
do_action( 'pirate_forms_after_sending_confirm', $response, $pirate_forms_contact_email, $subject, $confirm_body, $headers );
|
| 274 |
do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'after sending confirm email response = %s', $response ), 'debug', __FILE__, __LINE__ );
|
| 275 |
if ( ! $response ) {
|
|
@@ -308,281 +310,38 @@ class PirateForms_Public {
|
|
| 308 |
}
|
| 309 |
|
| 310 |
/**
|
| 311 |
-
*
|
| 312 |
-
*
|
| 313 |
-
* @since 1.0.0
|
| 314 |
-
*/
|
| 315 |
-
public function widget_text_filter( $content ) {
|
| 316 |
-
if ( ! preg_match( '[pirate_forms]', $content ) ) {
|
| 317 |
-
return $content;
|
| 318 |
-
}
|
| 319 |
-
$content = do_shortcode( $content );
|
| 320 |
-
|
| 321 |
-
return $content;
|
| 322 |
-
}
|
| 323 |
-
|
| 324 |
-
/**
|
| 325 |
-
* Display the form
|
| 326 |
*
|
| 327 |
-
* @
|
| 328 |
*/
|
| 329 |
-
|
| 330 |
-
$
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
$elements[] = array(
|
| 340 |
-
'type' => 'text',
|
| 341 |
-
'id' => 'form_honeypot',
|
| 342 |
-
'name' => 'honeypot',
|
| 343 |
-
'slug' => 'honeypot',
|
| 344 |
-
'wrap' => array(
|
| 345 |
-
'type' => 'div',
|
| 346 |
-
'class' => 'form_field_wrap hidden',
|
| 347 |
-
'style' => 'display: none',
|
| 348 |
-
),
|
| 349 |
-
);
|
| 350 |
-
|
| 351 |
-
$elements[] = array(
|
| 352 |
-
'type' => 'hidden',
|
| 353 |
-
'id' => 'pirate_forms_from_widget',
|
| 354 |
-
'value' => empty( $atts['from'] ) ? 0 : 1,
|
| 355 |
-
);
|
| 356 |
-
|
| 357 |
-
$nonce_append = isset( $_POST['pirate_forms_from_widget'] ) && intval( $_POST['pirate_forms_from_widget'] ) === 1 ? 'yes' : 'no';
|
| 358 |
-
|
| 359 |
-
$error_key = wp_create_nonce( get_bloginfo( 'admin_email' ) . ( empty( $atts['from'] ) ? 'no' : 'yes' ) );
|
| 360 |
-
|
| 361 |
-
$thank_you_message = '';
|
| 362 |
-
/* thank you message */
|
| 363 |
-
if ( ( ( isset( $_GET['pcf'] ) && $_GET['pcf'] == 1 ) || ( isset( $_POST['pirate-forms-contact-submit'] ) ) )
|
| 364 |
-
&& empty( $_SESSION[ $error_key ] )
|
| 365 |
-
&& wp_verify_nonce( $_POST['wordpress-nonce'], get_bloginfo( 'admin_email' ) . ( empty( $atts['from'] ) ? 'no' : 'yes' ) )
|
| 366 |
-
) {
|
| 367 |
-
$thank_you_message = sanitize_text_field( PirateForms_Util::get_option( 'pirateformsopt_label_submit' ) );
|
| 368 |
-
}
|
| 369 |
-
$pirate_form->set_element( 'thank_you_message', $thank_you_message );
|
| 370 |
-
|
| 371 |
-
/**
|
| 372 |
-
******** FormBuilder */
|
| 373 |
-
if ( 'yes' === PirateForms_Util::get_option( 'pirateformsopt_nonce' ) ) {
|
| 374 |
-
$elements[] = array(
|
| 375 |
-
'type' => 'hidden',
|
| 376 |
-
'id' => 'wordpress-nonce',
|
| 377 |
-
'value' => wp_create_nonce( get_bloginfo( 'admin_email' ) . $nonce_append ),
|
| 378 |
-
);
|
| 379 |
-
}
|
| 380 |
-
$pirate_forms_options = get_option( 'pirate_forms_settings_array' );
|
| 381 |
-
if ( ! empty( $pirate_forms_options ) ) :
|
| 382 |
-
$field = $pirate_forms_options['pirateformsopt_name_field'];
|
| 383 |
-
$label = $pirate_forms_options['pirateformsopt_label_name'];
|
| 384 |
-
|
| 385 |
-
/**
|
| 386 |
-
****** Name field */
|
| 387 |
-
if ( ! empty( $field ) && ! empty( $label ) ) :
|
| 388 |
-
$required = $field === 'req' ? true : false;
|
| 389 |
-
$wrap_classes = array(
|
| 390 |
-
'contact_name_wrap pirate_forms_three_inputs ',
|
| 391 |
-
);
|
| 392 |
-
// If this field was submitted with invalid data
|
| 393 |
-
if ( isset( $_SESSION[ $error_key ]['contact-name'] ) ) {
|
| 394 |
-
$wrap_classes[] = 'error';
|
| 395 |
-
}
|
| 396 |
-
$elements[] = array(
|
| 397 |
-
'placeholder' => stripslashes( sanitize_text_field( $label ) ),
|
| 398 |
-
'required' => $required,
|
| 399 |
-
'required_msg' => PirateForms_Util::get_option( 'pirateformsopt_label_err_name' ),
|
| 400 |
-
'type' => 'text',
|
| 401 |
-
'id' => 'pirate-forms-contact-name',
|
| 402 |
-
'class' => 'form-control',
|
| 403 |
-
'wrap' => array(
|
| 404 |
-
'type' => 'div',
|
| 405 |
-
'class' => implode( ' ', apply_filters( 'pirateform_wrap_classes_name', $wrap_classes ) ),
|
| 406 |
-
),
|
| 407 |
-
'value' => isset( $_REQUEST['pirate-forms-contact-name'] ) ? $_REQUEST['pirate-forms-contact-name'] : '',
|
| 408 |
-
);
|
| 409 |
-
endif;
|
| 410 |
-
|
| 411 |
-
$field = $pirate_forms_options['pirateformsopt_email_field'];
|
| 412 |
-
$label = $pirate_forms_options['pirateformsopt_label_email'];
|
| 413 |
-
|
| 414 |
-
/**
|
| 415 |
-
****** Email field */
|
| 416 |
-
if ( ! empty( $field ) && ! empty( $label ) ) :
|
| 417 |
-
$required = $field === 'req' ? true : false;
|
| 418 |
-
$wrap_classes = array(
|
| 419 |
-
'contact_email_wrap pirate_forms_three_inputs ',
|
| 420 |
-
);
|
| 421 |
-
// If this field was submitted with invalid data
|
| 422 |
-
if ( isset( $_SESSION[ $error_key ]['contact-email'] ) ) {
|
| 423 |
-
$wrap_classes[] = 'error';
|
| 424 |
-
}
|
| 425 |
-
$elements[] = array(
|
| 426 |
-
'placeholder' => stripslashes( sanitize_text_field( $label ) ),
|
| 427 |
-
'required' => $required,
|
| 428 |
-
'required_msg' => PirateForms_Util::get_option( 'pirateformsopt_label_err_email' ),
|
| 429 |
-
'type' => 'email',
|
| 430 |
-
'id' => 'pirate-forms-contact-email',
|
| 431 |
-
'class' => 'form-control',
|
| 432 |
-
'wrap' => array(
|
| 433 |
-
'type' => 'div',
|
| 434 |
-
'class' => implode( ' ', apply_filters( 'pirateform_wrap_classes_email', $wrap_classes ) ),
|
| 435 |
-
),
|
| 436 |
-
'value' => isset( $_REQUEST['pirate-forms-contact-email'] ) ? $_REQUEST['pirate-forms-contact-email'] : '',
|
| 437 |
-
);
|
| 438 |
-
endif;
|
| 439 |
-
|
| 440 |
-
$field = $pirate_forms_options['pirateformsopt_subject_field'];
|
| 441 |
-
$label = $pirate_forms_options['pirateformsopt_label_subject'];
|
| 442 |
-
|
| 443 |
-
/**
|
| 444 |
-
****** Subject field */
|
| 445 |
-
if ( ! empty( $field ) && ! empty( $label ) ) :
|
| 446 |
-
$required = $field === 'req' ? true : false;
|
| 447 |
-
$wrap_classes = array(
|
| 448 |
-
'contact_subject_wrap pirate_forms_three_inputs ',
|
| 449 |
-
);
|
| 450 |
-
// If this field was submitted with invalid data
|
| 451 |
-
if ( isset( $_SESSION[ $error_key ]['contact-subject'] ) ) {
|
| 452 |
-
$wrap_classes[] = 'error';
|
| 453 |
-
}
|
| 454 |
-
$elements[] = array(
|
| 455 |
-
'placeholder' => stripslashes( sanitize_text_field( $label ) ),
|
| 456 |
-
'required' => $required,
|
| 457 |
-
'required_msg' => PirateForms_Util::get_option( 'pirateformsopt_label_err_subject' ),
|
| 458 |
-
'type' => 'text',
|
| 459 |
-
'id' => 'pirate-forms-contact-subject',
|
| 460 |
-
'class' => 'form-control',
|
| 461 |
-
'wrap' => array(
|
| 462 |
-
'type' => 'div',
|
| 463 |
-
'class' => implode( ' ', apply_filters( 'pirateform_wrap_classes_subject', $wrap_classes ) ),
|
| 464 |
-
),
|
| 465 |
-
'value' => isset( $_REQUEST['pirate-forms-contact-subject'] ) ? $_REQUEST['pirate-forms-contact-subject'] : '',
|
| 466 |
-
);
|
| 467 |
-
endif;
|
| 468 |
-
|
| 469 |
-
$field = $pirate_forms_options['pirateformsopt_message_field'];
|
| 470 |
-
$label = $pirate_forms_options['pirateformsopt_label_message'];
|
| 471 |
-
|
| 472 |
-
/**
|
| 473 |
-
****** Message field */
|
| 474 |
-
if ( ! empty( $field ) && ! empty( $label ) ) :
|
| 475 |
-
$required = $field === 'req' ? true : false;
|
| 476 |
-
$wrap_classes = array( 'contact_message_wrap ' );
|
| 477 |
-
// If this field was submitted with invalid data
|
| 478 |
-
if ( isset( $_SESSION[ $error_key ]['contact-message'] ) ) {
|
| 479 |
-
$wrap_classes[] = 'error';
|
| 480 |
-
}
|
| 481 |
-
$elements[] = array(
|
| 482 |
-
'placeholder' => stripslashes( sanitize_text_field( $label ) ),
|
| 483 |
-
'required' => $required,
|
| 484 |
-
'required_msg' => PirateForms_Util::get_option( 'pirateformsopt_label_err_no_content' ),
|
| 485 |
-
'type' => 'textarea',
|
| 486 |
-
'class' => 'form-control',
|
| 487 |
-
'id' => 'pirate-forms-contact-message',
|
| 488 |
-
'wrap' => array(
|
| 489 |
-
'type' => 'div',
|
| 490 |
-
'class' => implode( ' ', apply_filters( 'pirateform_wrap_classes_message', $wrap_classes ) ),
|
| 491 |
-
),
|
| 492 |
-
'value' => isset( $_REQUEST['pirate-forms-contact-message'] ) ? $_REQUEST['pirate-forms-contact-message'] : '',
|
| 493 |
-
);
|
| 494 |
-
endif;
|
| 495 |
-
|
| 496 |
-
$field = $pirate_forms_options['pirateformsopt_attachment_field'];
|
| 497 |
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
$
|
| 503 |
-
// If this field was submitted with invalid data
|
| 504 |
-
if ( isset( $_SESSION[ $error_key ]['contact-attachment'] ) ) {
|
| 505 |
-
$wrap_classes[] = 'error';
|
| 506 |
-
}
|
| 507 |
-
$elements[] = array(
|
| 508 |
-
'placeholder' => stripslashes( sanitize_text_field( $label ) ),
|
| 509 |
-
'required' => $required,
|
| 510 |
-
'required_msg' => PirateForms_Util::get_option( 'pirateformsopt_label_err_no_attachment' ),
|
| 511 |
-
'type' => 'file',
|
| 512 |
-
'class' => 'form-control',
|
| 513 |
-
'id' => 'pirate-forms-attachment',
|
| 514 |
-
'wrap' => array(
|
| 515 |
-
'type' => 'div',
|
| 516 |
-
'class' => implode( ' ', apply_filters( 'pirateform_wrap_classes_attachment', $wrap_classes ) ),
|
| 517 |
-
),
|
| 518 |
-
);
|
| 519 |
endif;
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
if ( ! empty( $pirate_forms_options['pirateformsopt_recaptcha_secretkey'] ) && ! empty( $pirate_forms_options['pirateformsopt_recaptcha_sitekey'] ) && ! empty( $pirate_forms_options['pirateformsopt_recaptcha_field'] ) && ( $pirate_forms_options['pirateformsopt_recaptcha_field'] == 'yes' ) ) :
|
| 523 |
-
$pirateformsopt_recaptcha_sitekey = $pirate_forms_options['pirateformsopt_recaptcha_sitekey'];
|
| 524 |
-
$pirateformsopt_recaptcha_secretkey = $pirate_forms_options['pirateformsopt_recaptcha_secretkey'];
|
| 525 |
-
$elements[] = array(
|
| 526 |
-
'placeholder' => stripslashes( sanitize_text_field( $label ) ),
|
| 527 |
-
'type' => 'div',
|
| 528 |
-
'class' => 'g-recaptcha pirate-forms-g-recaptcha',
|
| 529 |
-
'custom' => array( 'data-sitekey' => $pirateformsopt_recaptcha_sitekey ),
|
| 530 |
-
'id' => 'pirate-forms-captcha',
|
| 531 |
-
'wrap' => array(
|
| 532 |
-
'type' => 'div',
|
| 533 |
-
'class' => implode( ' ', apply_filters( 'pirateform_wrap_classes_captcha', array('col-xs-12 col-sm-6 col-lg-6 form_field_wrap form_captcha_wrap') ) ),
|
| 534 |
-
),
|
| 535 |
-
);
|
| 536 |
endif;
|
|
|
|
|
|
|
| 537 |
|
| 538 |
-
|
| 539 |
-
****** Submit button */
|
| 540 |
-
$pirateformsopt_label_submit_btn = '';
|
| 541 |
-
if ( ! empty( $pirate_forms_options['pirateformsopt_label_submit_btn'] ) ) {
|
| 542 |
-
$pirateformsopt_label_submit_btn = $pirate_forms_options['pirateformsopt_label_submit_btn'];
|
| 543 |
-
}
|
| 544 |
-
if ( empty( $pirateformsopt_label_submit_btn ) ) {
|
| 545 |
-
$pirateformsopt_label_submit_btn = __( 'Submit', 'pirate-forms' );
|
| 546 |
}
|
| 547 |
-
$elements[] = array(
|
| 548 |
-
'type' => 'button',
|
| 549 |
-
'id' => 'pirate-forms-contact-submit',
|
| 550 |
-
'class' => 'pirate-forms-submit-button btn btn-primary',
|
| 551 |
-
'wrap' => array(
|
| 552 |
-
'type' => 'div',
|
| 553 |
-
'class' => implode( ' ', apply_filters( 'pirateform_wrap_classes_submit', array( 'col-xs-12 col-sm-6 col-lg-6 form_field_wrap contact_submit_wrap' ) ) ),
|
| 554 |
-
),
|
| 555 |
-
'value' => $pirateformsopt_label_submit_btn,
|
| 556 |
-
);
|
| 557 |
endif;
|
| 558 |
|
| 559 |
-
|
| 560 |
-
if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
|
| 561 |
-
$elements[] = array(
|
| 562 |
-
'type' => 'hidden',
|
| 563 |
-
'id' => 'contact-referrer',
|
| 564 |
-
'value' => $_SERVER['HTTP_REFERER'],
|
| 565 |
-
);
|
| 566 |
-
}
|
| 567 |
-
|
| 568 |
-
/* Referring page, if sent via URL query */
|
| 569 |
-
if ( ! empty( $_REQUEST['src'] ) || ! empty( $_REQUEST['ref'] ) ) {
|
| 570 |
-
$elements[] = array(
|
| 571 |
-
'type' => 'hidden',
|
| 572 |
-
'id' => 'referring-page',
|
| 573 |
-
'value' => ! empty( $_REQUEST['src'] ) ? $_REQUEST['src'] : $_REQUEST['ref'],
|
| 574 |
-
);
|
| 575 |
-
}
|
| 576 |
-
|
| 577 |
-
/* Are there any submission errors? */
|
| 578 |
-
$errors = '';
|
| 579 |
-
if ( ! empty( $_SESSION[ $error_key ] ) ) {
|
| 580 |
-
$pirate_form->set_element( 'errors', $_SESSION[ $error_key ] );
|
| 581 |
-
unset( $_SESSION[ $error_key ] );
|
| 582 |
-
}
|
| 583 |
-
|
| 584 |
-
do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'displaying elements %s', print_r( $elements, true ) ), 'debug', __FILE__, __LINE__ );
|
| 585 |
-
return $pirate_form->build_form( apply_filters( 'pirate_forms_public_controls', $elements ) );
|
| 586 |
}
|
| 587 |
|
| 588 |
/**
|
|
@@ -600,6 +359,7 @@ class PirateForms_Public {
|
|
| 600 |
* @param string $error_key the key for the session object.
|
| 601 |
* @param string $email the email id to check.
|
| 602 |
* @param string $ip the IP to check.
|
|
|
|
| 603 |
* @since 1.0.0
|
| 604 |
*/
|
| 605 |
public function is_blacklisted( $error_key, $email, $ip ) {
|
|
@@ -614,8 +374,8 @@ class PirateForms_Public {
|
|
| 614 |
foreach ( $blocked_arr as $ip_or_email ) {
|
| 615 |
$ip_or_email = trim( $ip_or_email );
|
| 616 |
if (
|
| 617 |
-
|
| 618 |
-
|
| 619 |
) {
|
| 620 |
$final_blocked_arr[] = $ip_or_email;
|
| 621 |
}
|
|
@@ -629,6 +389,7 @@ class PirateForms_Public {
|
|
| 629 |
in_array( $ip, $final_blocked_arr )
|
| 630 |
) {
|
| 631 |
$_SESSION[ $error_key ]['blacklist-blocked'] = __( 'Form submission blocked!', 'pirate-forms' );
|
|
|
|
| 632 |
return true;
|
| 633 |
}
|
| 634 |
}
|
|
@@ -637,35 +398,64 @@ class PirateForms_Public {
|
|
| 637 |
}
|
| 638 |
|
| 639 |
/**
|
| 640 |
-
*
|
| 641 |
*
|
| 642 |
-
* @
|
|
|
|
|
|
|
| 643 |
*/
|
| 644 |
-
function
|
| 645 |
-
$
|
| 646 |
-
|
| 647 |
-
|
| 648 |
-
|
| 649 |
-
|
| 650 |
-
)
|
| 651 |
-
|
| 652 |
-
|
| 653 |
-
|
| 654 |
-
|
| 655 |
-
|
| 656 |
-
|
| 657 |
-
|
|
|
|
|
|
|
|
|
|
| 658 |
|
| 659 |
-
|
| 660 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 661 |
|
| 662 |
-
|
| 663 |
-
|
| 664 |
-
|
| 665 |
-
|
| 666 |
-
|
| 667 |
-
|
| 668 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 669 |
}
|
| 670 |
|
| 671 |
/**
|
|
@@ -696,7 +486,39 @@ class PirateForms_Public {
|
|
| 696 |
}
|
| 697 |
|
| 698 |
/**
|
| 699 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 700 |
*
|
| 701 |
* @since 1.0.0
|
| 702 |
*/
|
|
@@ -758,6 +580,285 @@ class PirateForms_Public {
|
|
| 758 |
return $filename;
|
| 759 |
}
|
| 760 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 761 |
/**
|
| 762 |
* Alter the phpmailer object
|
| 763 |
*
|
|
@@ -772,111 +873,55 @@ class PirateForms_Public {
|
|
| 772 |
$pirateformsopt_use_secure = PirateForms_Util::get_option( 'pirateformsopt_use_secure' );
|
| 773 |
$pirateformsopt_use_smtp_authentication = PirateForms_Util::get_option( 'pirateformsopt_use_smtp_authentication' );
|
| 774 |
if ( ! empty( $pirateformsopt_use_smtp ) && ( $pirateformsopt_use_smtp == 'yes' ) && ! empty( $pirateformsopt_smtp_host ) && ! empty( $pirateformsopt_smtp_port ) ) :
|
| 775 |
-
|
| 776 |
-
|
| 777 |
-
|
| 778 |
-
|
| 779 |
-
|
| 780 |
-
|
| 781 |
-
|
| 782 |
-
|
| 783 |
-
endif;
|
| 784 |
-
|
| 785 |
-
if ( ! empty( $pirateformsopt_use_secure ) ) {
|
| 786 |
-
$phpmailer->SMTPSecure = $pirateformsopt_use_secure;
|
| 787 |
-
}
|
| 788 |
-
// @codingStandardsIgnoreEnd
|
| 789 |
-
endif;
|
| 790 |
-
}
|
| 791 |
-
|
| 792 |
-
/**
|
| 793 |
-
* Validate CAPTCHA
|
| 794 |
-
*
|
| 795 |
-
* @param string $error_key the key for the session object.
|
| 796 |
-
*/
|
| 797 |
-
function validate_captcha( $error_key ) {
|
| 798 |
-
$pirateformsopt_recaptcha_sitekey = PirateForms_Util::get_option( 'pirateformsopt_recaptcha_sitekey' );
|
| 799 |
-
$pirateformsopt_recaptcha_secretkey = PirateForms_Util::get_option( 'pirateformsopt_recaptcha_secretkey' );
|
| 800 |
-
$pirateformsopt_recaptcha_field = PirateForms_Util::get_option( 'pirateformsopt_recaptcha_field' );
|
| 801 |
-
if ( ! empty( $pirateformsopt_recaptcha_secretkey ) && ! empty( $pirateformsopt_recaptcha_sitekey ) && ! empty( $pirateformsopt_recaptcha_field ) && ( $pirateformsopt_recaptcha_field == 'yes' ) ) :
|
| 802 |
-
if ( isset( $_POST['g-recaptcha-response'] ) ) {
|
| 803 |
-
$captcha = $_POST['g-recaptcha-response'];
|
| 804 |
-
}
|
| 805 |
-
if ( ! $captcha ) {
|
| 806 |
-
$_SESSION[ $error_key ]['pirate-forms-captcha'] = __( 'Wrong reCAPTCHA', 'pirate-forms' );
|
| 807 |
-
return false;
|
| 808 |
-
}
|
| 809 |
-
$response = wp_remote_get( 'https://www.google.com/recaptcha/api/siteverify?secret=' . $pirateformsopt_recaptcha_secretkey . '&response=' . $captcha . '&remoteip=' . $_SERVER['REMOTE_ADDR'] );
|
| 810 |
-
if ( ! empty( $response ) ) :
|
| 811 |
-
$response_body = wp_remote_retrieve_body( $response );
|
| 812 |
endif;
|
| 813 |
-
|
| 814 |
-
|
| 815 |
-
|
| 816 |
-
if ( isset( $result['success'] ) && ( $result['success'] == false ) ) {
|
| 817 |
-
$_SESSION[ $error_key ]['pirate-forms-captcha'] = __( 'Wrong reCAPTCHA', 'pirate-forms' );
|
| 818 |
-
return false;
|
| 819 |
}
|
|
|
|
| 820 |
endif;
|
| 821 |
-
|
| 822 |
-
return true;
|
| 823 |
}
|
| 824 |
|
| 825 |
/**
|
| 826 |
-
*
|
| 827 |
*
|
| 828 |
-
* @param
|
| 829 |
-
*
|
|
|
|
| 830 |
*/
|
| 831 |
-
function
|
| 832 |
-
|
| 833 |
-
|
| 834 |
-
|
| 835 |
-
|
| 836 |
-
if ( ! empty( $use_files ) && ( $use_files == 'yes' ) ) {
|
| 837 |
-
$pirate_forms_attach_file = isset( $_FILES['pirate-forms-attachment'] ) ? $_FILES['pirate-forms-attachment'] : '';
|
| 838 |
-
if ( ! empty( $pirate_forms_attach_file ) && ! empty( $pirate_forms_attach_file['name'] ) ) {
|
| 839 |
-
/* Validate file type */
|
| 840 |
-
$file_types_allowed = 'jpg|jpeg|png|gif|pdf|doc|docx|ppt|pptx|odt|avi|ogg|m4a|mov|mp3|mp4|mpg|wav|wmv';
|
| 841 |
-
$pirate_forms_file_types_allowed = $file_types_allowed;
|
| 842 |
-
$pirate_forms_file_types_allowed = trim( $pirate_forms_file_types_allowed, '|' );
|
| 843 |
-
$pirate_forms_file_types_allowed = '(' . $pirate_forms_file_types_allowed . ')';
|
| 844 |
-
$pirate_forms_file_types_allowed = '/\.' . $pirate_forms_file_types_allowed . '$/i';
|
| 845 |
-
if ( ! preg_match( $pirate_forms_file_types_allowed, $pirate_forms_attach_file['name'] ) ) {
|
| 846 |
-
do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'file invalid: expected %s got %s', $file_types_allowed, $pirate_forms_attach_file['name'] ), 'error', __FILE__, __LINE__ );
|
| 847 |
-
$_SESSION[ $error_key ]['pirate-forms-upload-failed-type'] = __( 'Uploaded file is not allowed for file type', 'pirate-forms' );
|
| 848 |
-
return false;
|
| 849 |
}
|
| 850 |
-
|
| 851 |
-
|
| 852 |
-
|
| 853 |
-
do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'file too large: expected %d got %d', $pirate_forms_file_size_allowed, $pirate_forms_attach_file['size'] ), 'error', __FILE__, __LINE__ );
|
| 854 |
-
$_SESSION[ $error_key ]['pirate-forms-upload-failed-size'] = __( 'Uploaded file is too large', 'pirate-forms' );
|
| 855 |
-
return false;
|
| 856 |
}
|
| 857 |
-
$
|
| 858 |
-
|
| 859 |
-
|
| 860 |
-
$filename = $pirate_forms_attach_file['name'];
|
| 861 |
-
$filename = $this->canonicalize( $filename );
|
| 862 |
-
$filename = sanitize_file_name( $filename );
|
| 863 |
-
$filename = $this->antiscript_file_name( $filename );
|
| 864 |
-
$filename = wp_unique_filename( $uploads_dir, $filename );
|
| 865 |
-
$new_file = trailingslashit( $uploads_dir ) . $filename;
|
| 866 |
-
try {
|
| 867 |
-
if ( false === move_uploaded_file( $pirate_forms_attach_file['tmp_name'], $new_file ) ) {
|
| 868 |
-
do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'unable to move the uploaded file from %s to %s', $pirate_forms_attach_file['tmp_name'], $new_file ), 'error', __FILE__, __LINE__ );
|
| 869 |
-
throw new Exception( __( 'There was an unknown error uploading the file.', 'pirate-forms' ) );
|
| 870 |
-
}
|
| 871 |
-
} catch ( Exception $ex ) {
|
| 872 |
-
do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'unable to move the uploaded file from %s to %s with error %s', $pirate_forms_attach_file['tmp_name'], $new_file, $ex->getMessage() ), 'error', __FILE__, __LINE__ );
|
| 873 |
-
$_SESSION[ $error_key ]['pirate-forms-upload-failed-general'] = $ex->getMessage();
|
| 874 |
}
|
| 875 |
-
if (
|
| 876 |
-
$
|
|
|
|
| 877 |
}
|
| 878 |
-
|
| 879 |
-
|
| 880 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 881 |
}
|
| 882 |
}
|
| 27 |
*
|
| 28 |
* @since 1.0.0
|
| 29 |
* @access private
|
| 30 |
+
* @var string $plugin_name The ID of this plugin.
|
| 31 |
*/
|
| 32 |
private $plugin_name;
|
| 33 |
|
| 36 |
*
|
| 37 |
* @since 1.0.0
|
| 38 |
* @access private
|
| 39 |
+
* @var string $version The current version of this plugin.
|
| 40 |
*/
|
| 41 |
private $version;
|
| 42 |
|
| 44 |
* Initialize the class and set its properties.
|
| 45 |
*
|
| 46 |
* @since 1.0.0
|
| 47 |
+
*
|
| 48 |
+
* @param string $plugin_name The name of the plugin.
|
| 49 |
+
* @param string $version The version of this plugin.
|
| 50 |
*/
|
| 51 |
public function __construct( $plugin_name, $version ) {
|
| 52 |
|
| 53 |
$this->plugin_name = $plugin_name;
|
| 54 |
+
$this->version = $version;
|
| 55 |
|
| 56 |
}
|
| 57 |
|
| 109 |
}
|
| 110 |
|
| 111 |
// separate the nonce from a form that is displayed in the widget vs. one that is not
|
| 112 |
+
$nonce_append = isset( $_POST['pirate_forms_from_widget'] ) && intval( $_POST['pirate_forms_from_widget'] ) === 1 ? 'yes' : 'no';
|
| 113 |
|
| 114 |
// Session variable for form errors
|
| 115 |
+
$error_key = wp_create_nonce( get_bloginfo( 'admin_email' ) . $nonce_append );
|
| 116 |
$_SESSION[ $error_key ] = array();
|
| 117 |
|
| 118 |
// If nonce is not valid, beat it
|
| 120 |
if ( ! wp_verify_nonce( $_POST['wordpress-nonce'], get_bloginfo( 'admin_email' ) . $nonce_append ) ) {
|
| 121 |
$_SESSION[ $error_key ]['nonce'] = __( 'Nonce failed!', 'pirate-forms' );
|
| 122 |
do_action( 'themeisle_log_event', PIRATEFORMS_NAME, 'Nonce failed', 'error', __FILE__, __LINE__ );
|
| 123 |
+
|
| 124 |
return false;
|
| 125 |
}
|
| 126 |
}
|
| 143 |
$body .= '<table>';
|
| 144 |
|
| 145 |
$pirate_forms_contact_email = null;
|
| 146 |
+
$fields = array( 'name', 'email', 'subject', 'message' );
|
| 147 |
foreach ( $fields as $field ) {
|
| 148 |
+
$value = isset( $_POST[ 'pirate-forms-contact-' . $field ] ) ? sanitize_text_field( trim( $_POST[ 'pirate-forms-contact-' . $field ] ) ) : '';
|
| 149 |
if ( PirateForms_Util::get_option( 'pirateformsopt_' . $field . '_field' ) === 'req' && empty( $value ) ) {
|
| 150 |
$_SESSION[ $error_key ][ 'pirate-forms-contact-' . $field ] = PirateForms_Util::get_option( 'pirateformsopt_label_err_' . $field );
|
| 151 |
} elseif ( ! empty( $value ) ) {
|
| 240 |
$headers = "From: $send_from_name <$send_from>\r\nReply-To: $pirate_forms_contact_name <$pirate_forms_contact_email>\r\nContent-type: text/html";
|
| 241 |
add_action( 'phpmailer_init', array( $this, 'phpmailer' ) );
|
| 242 |
|
| 243 |
+
$attachments = $this->get_attachments( $error_key );
|
| 244 |
if ( is_bool( $attachments ) ) {
|
| 245 |
return false;
|
| 246 |
}
|
| 247 |
|
| 248 |
+
$subject = 'Contact on ' . htmlspecialchars_decode( get_bloginfo( 'name' ) );
|
| 249 |
|
| 250 |
do_action( 'pirate_forms_before_sending', $site_recipients, $subject, $body, $headers, $attachments );
|
| 251 |
do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'before sending email to = %s, subject = %s, body = %s, headers = %s, attachments = %s', $site_recipients, $subject, $body, $headers, print_r( $attachments, true ) ), 'debug', __FILE__, __LINE__ );
|
| 252 |
+
$response = wp_mail( $site_recipients, $subject, $body, $headers, $attachments );
|
| 253 |
do_action( 'pirate_forms_after_sending', $response, $site_recipients, $subject, $body, $headers, $attachments );
|
| 254 |
do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'after sending email, response = %s', $response ), 'debug', __FILE__, __LINE__ );
|
| 255 |
|
| 271 |
|
| 272 |
do_action( 'pirate_forms_before_sending_confirm', $pirate_forms_contact_email, $subject, $confirm_body, $headers );
|
| 273 |
do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'before sending confirm email to = %s, subject = %s, body = %s, headers = %s', $pirate_forms_contact_email, $subject, $confirm_body, $headers ), 'debug', __FILE__, __LINE__ );
|
| 274 |
+
$response = wp_mail( $pirate_forms_contact_email, $subject, $confirm_body, $headers );
|
| 275 |
do_action( 'pirate_forms_after_sending_confirm', $response, $pirate_forms_contact_email, $subject, $confirm_body, $headers );
|
| 276 |
do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'after sending confirm email response = %s', $response ), 'debug', __FILE__, __LINE__ );
|
| 277 |
if ( ! $response ) {
|
| 310 |
}
|
| 311 |
|
| 312 |
/**
|
| 313 |
+
* Validate CAPTCHA
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 314 |
*
|
| 315 |
+
* @param string $error_key the key for the session object.
|
| 316 |
*/
|
| 317 |
+
function validate_captcha( $error_key ) {
|
| 318 |
+
$pirateformsopt_recaptcha_sitekey = PirateForms_Util::get_option( 'pirateformsopt_recaptcha_sitekey' );
|
| 319 |
+
$pirateformsopt_recaptcha_secretkey = PirateForms_Util::get_option( 'pirateformsopt_recaptcha_secretkey' );
|
| 320 |
+
$pirateformsopt_recaptcha_field = PirateForms_Util::get_option( 'pirateformsopt_recaptcha_field' );
|
| 321 |
+
if ( ! empty( $pirateformsopt_recaptcha_secretkey ) && ! empty( $pirateformsopt_recaptcha_sitekey ) && ! empty( $pirateformsopt_recaptcha_field ) && ( $pirateformsopt_recaptcha_field == 'yes' ) ) :
|
| 322 |
+
if ( isset( $_POST['g-recaptcha-response'] ) ) {
|
| 323 |
+
$captcha = $_POST['g-recaptcha-response'];
|
| 324 |
+
}
|
| 325 |
+
if ( ! $captcha ) {
|
| 326 |
+
$_SESSION[ $error_key ]['pirate-forms-captcha'] = __( 'Wrong reCAPTCHA', 'pirate-forms' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 327 |
|
| 328 |
+
return false;
|
| 329 |
+
}
|
| 330 |
+
$response = wp_remote_get( 'https://www.google.com/recaptcha/api/siteverify?secret=' . $pirateformsopt_recaptcha_secretkey . '&response=' . $captcha . '&remoteip=' . $_SERVER['REMOTE_ADDR'] );
|
| 331 |
+
if ( ! empty( $response ) ) :
|
| 332 |
+
$response_body = wp_remote_retrieve_body( $response );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 333 |
endif;
|
| 334 |
+
if ( ! empty( $response_body ) ) :
|
| 335 |
+
$result = json_decode( $response_body, true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 336 |
endif;
|
| 337 |
+
if ( isset( $result['success'] ) && ( $result['success'] == false ) ) {
|
| 338 |
+
$_SESSION[ $error_key ]['pirate-forms-captcha'] = __( 'Wrong reCAPTCHA', 'pirate-forms' );
|
| 339 |
|
| 340 |
+
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 341 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 342 |
endif;
|
| 343 |
|
| 344 |
+
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 345 |
}
|
| 346 |
|
| 347 |
/**
|
| 359 |
* @param string $error_key the key for the session object.
|
| 360 |
* @param string $email the email id to check.
|
| 361 |
* @param string $ip the IP to check.
|
| 362 |
+
*
|
| 363 |
* @since 1.0.0
|
| 364 |
*/
|
| 365 |
public function is_blacklisted( $error_key, $email, $ip ) {
|
| 374 |
foreach ( $blocked_arr as $ip_or_email ) {
|
| 375 |
$ip_or_email = trim( $ip_or_email );
|
| 376 |
if (
|
| 377 |
+
filter_var( $ip_or_email, FILTER_VALIDATE_IP ) ||
|
| 378 |
+
filter_var( $ip_or_email, FILTER_VALIDATE_EMAIL )
|
| 379 |
) {
|
| 380 |
$final_blocked_arr[] = $ip_or_email;
|
| 381 |
}
|
| 389 |
in_array( $ip, $final_blocked_arr )
|
| 390 |
) {
|
| 391 |
$_SESSION[ $error_key ]['blacklist-blocked'] = __( 'Form submission blocked!', 'pirate-forms' );
|
| 392 |
+
|
| 393 |
return true;
|
| 394 |
}
|
| 395 |
}
|
| 398 |
}
|
| 399 |
|
| 400 |
/**
|
| 401 |
+
* Get attachments, if any
|
| 402 |
*
|
| 403 |
+
* @param string $error_key the key for the session object.
|
| 404 |
+
*
|
| 405 |
+
* @throws Exception When file uploading fails.
|
| 406 |
*/
|
| 407 |
+
function get_attachments( $error_key ) {
|
| 408 |
+
$attachments = '';
|
| 409 |
+
/**
|
| 410 |
+
******* Validate Attachment */
|
| 411 |
+
$use_files = PirateForms_Util::get_option( 'pirateformsopt_attachment_field' );
|
| 412 |
+
if ( ! empty( $use_files ) && ( $use_files == 'yes' ) ) {
|
| 413 |
+
$pirate_forms_attach_file = isset( $_FILES['pirate-forms-attachment'] ) ? $_FILES['pirate-forms-attachment'] : '';
|
| 414 |
+
if ( ! empty( $pirate_forms_attach_file ) && ! empty( $pirate_forms_attach_file['name'] ) ) {
|
| 415 |
+
/* Validate file type */
|
| 416 |
+
$file_types_allowed = 'jpg|jpeg|png|gif|pdf|doc|docx|ppt|pptx|odt|avi|ogg|m4a|mov|mp3|mp4|mpg|wav|wmv';
|
| 417 |
+
$pirate_forms_file_types_allowed = $file_types_allowed;
|
| 418 |
+
$pirate_forms_file_types_allowed = trim( $pirate_forms_file_types_allowed, '|' );
|
| 419 |
+
$pirate_forms_file_types_allowed = '(' . $pirate_forms_file_types_allowed . ')';
|
| 420 |
+
$pirate_forms_file_types_allowed = '/\.' . $pirate_forms_file_types_allowed . '$/i';
|
| 421 |
+
if ( ! preg_match( $pirate_forms_file_types_allowed, $pirate_forms_attach_file['name'] ) ) {
|
| 422 |
+
do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'file invalid: expected %s got %s', $file_types_allowed, $pirate_forms_attach_file['name'] ), 'error', __FILE__, __LINE__ );
|
| 423 |
+
$_SESSION[ $error_key ]['pirate-forms-upload-failed-type'] = __( 'Uploaded file is not allowed for file type', 'pirate-forms' );
|
| 424 |
|
| 425 |
+
return false;
|
| 426 |
+
}
|
| 427 |
+
/* Validate file size */
|
| 428 |
+
$pirate_forms_file_size_allowed = 1048576; // default size 1 MB
|
| 429 |
+
if ( $pirate_forms_attach_file['size'] > $pirate_forms_file_size_allowed ) {
|
| 430 |
+
do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'file too large: expected %d got %d', $pirate_forms_file_size_allowed, $pirate_forms_attach_file['size'] ), 'error', __FILE__, __LINE__ );
|
| 431 |
+
$_SESSION[ $error_key ]['pirate-forms-upload-failed-size'] = __( 'Uploaded file is too large', 'pirate-forms' );
|
| 432 |
|
| 433 |
+
return false;
|
| 434 |
+
}
|
| 435 |
+
$this->init_uploads();
|
| 436 |
+
$uploads_dir = $this->get_upload_tmp_dir();
|
| 437 |
+
$uploads_dir = $this->maybe_add_random_dir( $uploads_dir );
|
| 438 |
+
$filename = $pirate_forms_attach_file['name'];
|
| 439 |
+
$filename = $this->canonicalize( $filename );
|
| 440 |
+
$filename = sanitize_file_name( $filename );
|
| 441 |
+
$filename = $this->antiscript_file_name( $filename );
|
| 442 |
+
$filename = wp_unique_filename( $uploads_dir, $filename );
|
| 443 |
+
$new_file = trailingslashit( $uploads_dir ) . $filename;
|
| 444 |
+
try {
|
| 445 |
+
if ( false === move_uploaded_file( $pirate_forms_attach_file['tmp_name'], $new_file ) ) {
|
| 446 |
+
do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'unable to move the uploaded file from %s to %s', $pirate_forms_attach_file['tmp_name'], $new_file ), 'error', __FILE__, __LINE__ );
|
| 447 |
+
throw new Exception( __( 'There was an unknown error uploading the file.', 'pirate-forms' ) );
|
| 448 |
+
}
|
| 449 |
+
} catch ( Exception $ex ) {
|
| 450 |
+
do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'unable to move the uploaded file from %s to %s with error %s', $pirate_forms_attach_file['tmp_name'], $new_file, $ex->getMessage() ), 'error', __FILE__, __LINE__ );
|
| 451 |
+
$_SESSION[ $error_key ]['pirate-forms-upload-failed-general'] = $ex->getMessage();
|
| 452 |
+
}
|
| 453 |
+
if ( ! empty( $new_file ) ) {
|
| 454 |
+
$attachments = $new_file;
|
| 455 |
+
}
|
| 456 |
+
}// End if().
|
| 457 |
+
}// End if().
|
| 458 |
+
return $attachments;
|
| 459 |
}
|
| 460 |
|
| 461 |
/**
|
| 486 |
}
|
| 487 |
|
| 488 |
/**
|
| 489 |
+
* Return the temporary upload dir
|
| 490 |
+
*
|
| 491 |
+
* @since 1.0.0
|
| 492 |
+
*/
|
| 493 |
+
function get_upload_tmp_dir() {
|
| 494 |
+
return $this->get_upload_dir( 'dir' ) . '/pirate_forms_uploads';
|
| 495 |
+
}
|
| 496 |
+
|
| 497 |
+
/**
|
| 498 |
+
* Return the upload dir
|
| 499 |
+
*
|
| 500 |
+
* @since 1.0.0
|
| 501 |
+
*/
|
| 502 |
+
function get_upload_dir( $type = false ) {
|
| 503 |
+
$uploads = wp_upload_dir();
|
| 504 |
+
$uploads = apply_filters(
|
| 505 |
+
'pirate_forms_upload_dir', array(
|
| 506 |
+
'dir' => $uploads['basedir'],
|
| 507 |
+
'url' => $uploads['baseurl'],
|
| 508 |
+
)
|
| 509 |
+
);
|
| 510 |
+
if ( 'dir' == $type ) {
|
| 511 |
+
return $uploads['dir'];
|
| 512 |
+
}
|
| 513 |
+
if ( 'url' == $type ) {
|
| 514 |
+
return $uploads['url'];
|
| 515 |
+
}
|
| 516 |
+
|
| 517 |
+
return $uploads;
|
| 518 |
+
}
|
| 519 |
+
|
| 520 |
+
/**
|
| 521 |
+
* Add a random directory for uploading
|
| 522 |
*
|
| 523 |
* @since 1.0.0
|
| 524 |
*/
|
| 580 |
return $filename;
|
| 581 |
}
|
| 582 |
|
| 583 |
+
/**
|
| 584 |
+
* Change the content of the widget
|
| 585 |
+
*
|
| 586 |
+
* @since 1.0.0
|
| 587 |
+
*/
|
| 588 |
+
public function widget_text_filter( $content ) {
|
| 589 |
+
if ( ! preg_match( '[pirate_forms]', $content ) ) {
|
| 590 |
+
return $content;
|
| 591 |
+
}
|
| 592 |
+
$content = do_shortcode( $content );
|
| 593 |
+
|
| 594 |
+
return $content;
|
| 595 |
+
}
|
| 596 |
+
|
| 597 |
+
/**
|
| 598 |
+
* Display the form
|
| 599 |
+
*
|
| 600 |
+
* @since 1.0.0
|
| 601 |
+
*/
|
| 602 |
+
public function display_form( $atts, $content = null ) {
|
| 603 |
+
$atts = shortcode_atts(
|
| 604 |
+
array(
|
| 605 |
+
'from' => '',
|
| 606 |
+
), $atts
|
| 607 |
+
);
|
| 608 |
+
|
| 609 |
+
$elements = array();
|
| 610 |
+
$pirate_form = new PirateForms_PhpFormBuilder();
|
| 611 |
+
|
| 612 |
+
$elements[] = array(
|
| 613 |
+
'type' => 'text',
|
| 614 |
+
'id' => 'form_honeypot',
|
| 615 |
+
'name' => 'honeypot',
|
| 616 |
+
'slug' => 'honeypot',
|
| 617 |
+
'wrap' => array(
|
| 618 |
+
'type' => 'div',
|
| 619 |
+
'class' => 'form_field_wrap hidden',
|
| 620 |
+
'style' => 'display: none',
|
| 621 |
+
),
|
| 622 |
+
);
|
| 623 |
+
|
| 624 |
+
$elements[] = array(
|
| 625 |
+
'type' => 'hidden',
|
| 626 |
+
'id' => 'pirate_forms_from_widget',
|
| 627 |
+
'value' => empty( $atts['from'] ) ? 0 : 1,
|
| 628 |
+
);
|
| 629 |
+
|
| 630 |
+
$nonce_append = isset( $_POST['pirate_forms_from_widget'] ) && intval( $_POST['pirate_forms_from_widget'] ) === 1 ? 'yes' : 'no';
|
| 631 |
+
|
| 632 |
+
$error_key = wp_create_nonce( get_bloginfo( 'admin_email' ) . ( empty( $atts['from'] ) ? 'no' : 'yes' ) );
|
| 633 |
+
|
| 634 |
+
$thank_you_message = '';
|
| 635 |
+
/* thank you message */
|
| 636 |
+
if ( ( ( isset( $_GET['pcf'] ) && $_GET['pcf'] == 1 ) || ( isset( $_POST['pirate-forms-contact-submit'] ) ) )
|
| 637 |
+
&& empty( $_SESSION[ $error_key ] )
|
| 638 |
+
&& wp_verify_nonce( $_POST['wordpress-nonce'], get_bloginfo( 'admin_email' ) . ( empty( $atts['from'] ) ? 'no' : 'yes' ) )
|
| 639 |
+
) {
|
| 640 |
+
$thank_you_message = sanitize_text_field( PirateForms_Util::get_option( 'pirateformsopt_label_submit' ) );
|
| 641 |
+
}
|
| 642 |
+
$pirate_form->set_element( 'thank_you_message', $thank_you_message );
|
| 643 |
+
|
| 644 |
+
/**
|
| 645 |
+
******** FormBuilder */
|
| 646 |
+
if ( 'yes' === PirateForms_Util::get_option( 'pirateformsopt_nonce' ) ) {
|
| 647 |
+
$elements[] = array(
|
| 648 |
+
'type' => 'hidden',
|
| 649 |
+
'id' => 'wordpress-nonce',
|
| 650 |
+
'value' => wp_create_nonce( get_bloginfo( 'admin_email' ) . $nonce_append ),
|
| 651 |
+
);
|
| 652 |
+
}
|
| 653 |
+
$pirate_forms_options = get_option( 'pirate_forms_settings_array' );
|
| 654 |
+
if ( ! empty( $pirate_forms_options ) ) :
|
| 655 |
+
$field = $pirate_forms_options['pirateformsopt_name_field'];
|
| 656 |
+
$label = $pirate_forms_options['pirateformsopt_label_name'];
|
| 657 |
+
|
| 658 |
+
/**
|
| 659 |
+
****** Name field */
|
| 660 |
+
if ( ! empty( $field ) && ! empty( $label ) ) :
|
| 661 |
+
$required = $field === 'req' ? true : false;
|
| 662 |
+
$wrap_classes = array(
|
| 663 |
+
'contact_name_wrap pirate_forms_three_inputs ',
|
| 664 |
+
);
|
| 665 |
+
// If this field was submitted with invalid data
|
| 666 |
+
if ( isset( $_SESSION[ $error_key ]['contact-name'] ) ) {
|
| 667 |
+
$wrap_classes[] = 'error';
|
| 668 |
+
}
|
| 669 |
+
$elements[] = array(
|
| 670 |
+
'placeholder' => stripslashes( sanitize_text_field( $label ) ),
|
| 671 |
+
'required' => $required,
|
| 672 |
+
'required_msg' => PirateForms_Util::get_option( 'pirateformsopt_label_err_name' ),
|
| 673 |
+
'type' => 'text',
|
| 674 |
+
'id' => 'pirate-forms-contact-name',
|
| 675 |
+
'class' => 'form-control',
|
| 676 |
+
'wrap' => array(
|
| 677 |
+
'type' => 'div',
|
| 678 |
+
'class' => implode( ' ', apply_filters( 'pirateform_wrap_classes_name', $wrap_classes ) ),
|
| 679 |
+
),
|
| 680 |
+
'value' => isset( $_REQUEST['pirate-forms-contact-name'] ) ? $_REQUEST['pirate-forms-contact-name'] : '',
|
| 681 |
+
);
|
| 682 |
+
endif;
|
| 683 |
+
|
| 684 |
+
$field = $pirate_forms_options['pirateformsopt_email_field'];
|
| 685 |
+
$label = $pirate_forms_options['pirateformsopt_label_email'];
|
| 686 |
+
|
| 687 |
+
/**
|
| 688 |
+
****** Email field */
|
| 689 |
+
if ( ! empty( $field ) && ! empty( $label ) ) :
|
| 690 |
+
$required = $field === 'req' ? true : false;
|
| 691 |
+
$wrap_classes = array(
|
| 692 |
+
'contact_email_wrap pirate_forms_three_inputs ',
|
| 693 |
+
);
|
| 694 |
+
// If this field was submitted with invalid data
|
| 695 |
+
if ( isset( $_SESSION[ $error_key ]['contact-email'] ) ) {
|
| 696 |
+
$wrap_classes[] = 'error';
|
| 697 |
+
}
|
| 698 |
+
$elements[] = array(
|
| 699 |
+
'placeholder' => stripslashes( sanitize_text_field( $label ) ),
|
| 700 |
+
'required' => $required,
|
| 701 |
+
'required_msg' => PirateForms_Util::get_option( 'pirateformsopt_label_err_email' ),
|
| 702 |
+
'type' => 'email',
|
| 703 |
+
'id' => 'pirate-forms-contact-email',
|
| 704 |
+
'class' => 'form-control',
|
| 705 |
+
'wrap' => array(
|
| 706 |
+
'type' => 'div',
|
| 707 |
+
'class' => implode( ' ', apply_filters( 'pirateform_wrap_classes_email', $wrap_classes ) ),
|
| 708 |
+
),
|
| 709 |
+
'value' => isset( $_REQUEST['pirate-forms-contact-email'] ) ? $_REQUEST['pirate-forms-contact-email'] : '',
|
| 710 |
+
);
|
| 711 |
+
endif;
|
| 712 |
+
|
| 713 |
+
$field = $pirate_forms_options['pirateformsopt_subject_field'];
|
| 714 |
+
$label = $pirate_forms_options['pirateformsopt_label_subject'];
|
| 715 |
+
|
| 716 |
+
/**
|
| 717 |
+
****** Subject field */
|
| 718 |
+
if ( ! empty( $field ) && ! empty( $label ) ) :
|
| 719 |
+
$required = $field === 'req' ? true : false;
|
| 720 |
+
$wrap_classes = array(
|
| 721 |
+
'contact_subject_wrap pirate_forms_three_inputs ',
|
| 722 |
+
);
|
| 723 |
+
// If this field was submitted with invalid data
|
| 724 |
+
if ( isset( $_SESSION[ $error_key ]['contact-subject'] ) ) {
|
| 725 |
+
$wrap_classes[] = 'error';
|
| 726 |
+
}
|
| 727 |
+
$elements[] = array(
|
| 728 |
+
'placeholder' => stripslashes( sanitize_text_field( $label ) ),
|
| 729 |
+
'required' => $required,
|
| 730 |
+
'required_msg' => PirateForms_Util::get_option( 'pirateformsopt_label_err_subject' ),
|
| 731 |
+
'type' => 'text',
|
| 732 |
+
'id' => 'pirate-forms-contact-subject',
|
| 733 |
+
'class' => 'form-control',
|
| 734 |
+
'wrap' => array(
|
| 735 |
+
'type' => 'div',
|
| 736 |
+
'class' => implode( ' ', apply_filters( 'pirateform_wrap_classes_subject', $wrap_classes ) ),
|
| 737 |
+
),
|
| 738 |
+
'value' => isset( $_REQUEST['pirate-forms-contact-subject'] ) ? $_REQUEST['pirate-forms-contact-subject'] : '',
|
| 739 |
+
);
|
| 740 |
+
endif;
|
| 741 |
+
|
| 742 |
+
$field = $pirate_forms_options['pirateformsopt_message_field'];
|
| 743 |
+
$label = $pirate_forms_options['pirateformsopt_label_message'];
|
| 744 |
+
|
| 745 |
+
/**
|
| 746 |
+
****** Message field */
|
| 747 |
+
if ( ! empty( $field ) && ! empty( $label ) ) :
|
| 748 |
+
$required = $field === 'req' ? true : false;
|
| 749 |
+
$wrap_classes = array( 'col-sm-12 col-lg-12 form_field_wrap contact_message_wrap ' );
|
| 750 |
+
// If this field was submitted with invalid data
|
| 751 |
+
if ( isset( $_SESSION[ $error_key ]['contact-message'] ) ) {
|
| 752 |
+
$wrap_classes[] = 'error';
|
| 753 |
+
}
|
| 754 |
+
$elements[] = array(
|
| 755 |
+
'placeholder' => stripslashes( sanitize_text_field( $label ) ),
|
| 756 |
+
'required' => $required,
|
| 757 |
+
'required_msg' => PirateForms_Util::get_option( 'pirateformsopt_label_err_no_content' ),
|
| 758 |
+
'type' => 'textarea',
|
| 759 |
+
'class' => 'form-control',
|
| 760 |
+
'id' => 'pirate-forms-contact-message',
|
| 761 |
+
'wrap' => array(
|
| 762 |
+
'type' => 'div',
|
| 763 |
+
'class' => implode( ' ', apply_filters( 'pirateform_wrap_classes_message', $wrap_classes ) ),
|
| 764 |
+
),
|
| 765 |
+
'value' => isset( $_REQUEST['pirate-forms-contact-message'] ) ? $_REQUEST['pirate-forms-contact-message'] : '',
|
| 766 |
+
);
|
| 767 |
+
endif;
|
| 768 |
+
|
| 769 |
+
$field = $pirate_forms_options['pirateformsopt_attachment_field'];
|
| 770 |
+
|
| 771 |
+
/**
|
| 772 |
+
****** Message field */
|
| 773 |
+
if ( ! empty( $field ) && 'no' !== $field ) :
|
| 774 |
+
$required = $field === 'req' ? true : false;
|
| 775 |
+
$wrap_classes = array( 'contact_attachment_wrap ' );
|
| 776 |
+
// If this field was submitted with invalid data
|
| 777 |
+
if ( isset( $_SESSION[ $error_key ]['contact-attachment'] ) ) {
|
| 778 |
+
$wrap_classes[] = 'error';
|
| 779 |
+
}
|
| 780 |
+
$elements[] = array(
|
| 781 |
+
'placeholder' => stripslashes( sanitize_text_field( $label ) ),
|
| 782 |
+
'required' => $required,
|
| 783 |
+
'required_msg' => PirateForms_Util::get_option( 'pirateformsopt_label_err_no_attachment' ),
|
| 784 |
+
'type' => 'file',
|
| 785 |
+
'class' => 'form-control',
|
| 786 |
+
'id' => 'pirate-forms-attachment',
|
| 787 |
+
'wrap' => array(
|
| 788 |
+
'type' => 'div',
|
| 789 |
+
'class' => implode( ' ', apply_filters( 'pirateform_wrap_classes_attachment', $wrap_classes ) ),
|
| 790 |
+
),
|
| 791 |
+
);
|
| 792 |
+
endif;
|
| 793 |
+
/**
|
| 794 |
+
******* ReCaptcha */
|
| 795 |
+
if ( ! empty( $pirate_forms_options['pirateformsopt_recaptcha_secretkey'] ) && ! empty( $pirate_forms_options['pirateformsopt_recaptcha_sitekey'] ) && ! empty( $pirate_forms_options['pirateformsopt_recaptcha_field'] ) && ( $pirate_forms_options['pirateformsopt_recaptcha_field'] == 'yes' ) ) :
|
| 796 |
+
$pirateformsopt_recaptcha_sitekey = $pirate_forms_options['pirateformsopt_recaptcha_sitekey'];
|
| 797 |
+
$pirateformsopt_recaptcha_secretkey = $pirate_forms_options['pirateformsopt_recaptcha_secretkey'];
|
| 798 |
+
$elements[] = array(
|
| 799 |
+
'placeholder' => stripslashes( sanitize_text_field( $label ) ),
|
| 800 |
+
'type' => 'div',
|
| 801 |
+
'class' => 'g-recaptcha pirate-forms-g-recaptcha',
|
| 802 |
+
'custom' => array( 'data-sitekey' => $pirateformsopt_recaptcha_sitekey ),
|
| 803 |
+
'id' => 'pirate-forms-captcha',
|
| 804 |
+
'wrap' => array(
|
| 805 |
+
'type' => 'div',
|
| 806 |
+
'class' => implode( ' ', apply_filters( 'pirateform_wrap_classes_captcha', array( 'col-xs-12 col-sm-6 col-lg-6 form_field_wrap form_captcha_wrap' ) ) ),
|
| 807 |
+
),
|
| 808 |
+
);
|
| 809 |
+
endif;
|
| 810 |
+
|
| 811 |
+
/**
|
| 812 |
+
****** Submit button */
|
| 813 |
+
$pirateformsopt_label_submit_btn = '';
|
| 814 |
+
if ( ! empty( $pirate_forms_options['pirateformsopt_label_submit_btn'] ) ) {
|
| 815 |
+
$pirateformsopt_label_submit_btn = $pirate_forms_options['pirateformsopt_label_submit_btn'];
|
| 816 |
+
}
|
| 817 |
+
if ( empty( $pirateformsopt_label_submit_btn ) ) {
|
| 818 |
+
$pirateformsopt_label_submit_btn = __( 'Submit', 'pirate-forms' );
|
| 819 |
+
}
|
| 820 |
+
$elements[] = array(
|
| 821 |
+
'type' => 'button',
|
| 822 |
+
'id' => 'pirate-forms-contact-submit',
|
| 823 |
+
'class' => 'pirate-forms-submit-button btn btn-primary',
|
| 824 |
+
'wrap' => array(
|
| 825 |
+
'type' => 'div',
|
| 826 |
+
'class' => implode( ' ', apply_filters( 'pirateform_wrap_classes_submit', array( 'col-xs-12 col-sm-6 col-lg-6 form_field_wrap contact_submit_wrap' ) ) ),
|
| 827 |
+
),
|
| 828 |
+
'value' => $pirateformsopt_label_submit_btn,
|
| 829 |
+
);
|
| 830 |
+
endif;
|
| 831 |
+
|
| 832 |
+
/* Referring site or page, if any */
|
| 833 |
+
if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
|
| 834 |
+
$elements[] = array(
|
| 835 |
+
'type' => 'hidden',
|
| 836 |
+
'id' => 'contact-referrer',
|
| 837 |
+
'value' => $_SERVER['HTTP_REFERER'],
|
| 838 |
+
);
|
| 839 |
+
}
|
| 840 |
+
|
| 841 |
+
/* Referring page, if sent via URL query */
|
| 842 |
+
if ( ! empty( $_REQUEST['src'] ) || ! empty( $_REQUEST['ref'] ) ) {
|
| 843 |
+
$elements[] = array(
|
| 844 |
+
'type' => 'hidden',
|
| 845 |
+
'id' => 'referring-page',
|
| 846 |
+
'value' => ! empty( $_REQUEST['src'] ) ? $_REQUEST['src'] : $_REQUEST['ref'],
|
| 847 |
+
);
|
| 848 |
+
}
|
| 849 |
+
|
| 850 |
+
/* Are there any submission errors? */
|
| 851 |
+
$errors = '';
|
| 852 |
+
if ( ! empty( $_SESSION[ $error_key ] ) ) {
|
| 853 |
+
$pirate_form->set_element( 'errors', $_SESSION[ $error_key ] );
|
| 854 |
+
unset( $_SESSION[ $error_key ] );
|
| 855 |
+
}
|
| 856 |
+
|
| 857 |
+
do_action( 'themeisle_log_event', PIRATEFORMS_NAME, sprintf( 'displaying elements %s', print_r( $elements, true ) ), 'debug', __FILE__, __LINE__ );
|
| 858 |
+
|
| 859 |
+
return $pirate_form->build_form( apply_filters( 'pirate_forms_public_controls', $elements ) );
|
| 860 |
+
}
|
| 861 |
+
|
| 862 |
/**
|
| 863 |
* Alter the phpmailer object
|
| 864 |
*
|
| 873 |
$pirateformsopt_use_secure = PirateForms_Util::get_option( 'pirateformsopt_use_secure' );
|
| 874 |
$pirateformsopt_use_smtp_authentication = PirateForms_Util::get_option( 'pirateformsopt_use_smtp_authentication' );
|
| 875 |
if ( ! empty( $pirateformsopt_use_smtp ) && ( $pirateformsopt_use_smtp == 'yes' ) && ! empty( $pirateformsopt_smtp_host ) && ! empty( $pirateformsopt_smtp_port ) ) :
|
| 876 |
+
// @codingStandardsIgnoreStart
|
| 877 |
+
$phpmailer->isSMTP();
|
| 878 |
+
$phpmailer->Host = $pirateformsopt_smtp_host;
|
| 879 |
+
if ( ! empty( $pirateformsopt_use_smtp_authentication ) && ( $pirateformsopt_use_smtp_authentication == 'yes' ) && ! empty( $pirateformsopt_smtp_username ) && ! empty( $pirateformsopt_smtp_password ) ) :
|
| 880 |
+
$phpmailer->SMTPAuth = true; // Force it to use Username and Password to authenticate
|
| 881 |
+
$phpmailer->Port = $pirateformsopt_smtp_port;
|
| 882 |
+
$phpmailer->Username = $pirateformsopt_smtp_username;
|
| 883 |
+
$phpmailer->Password = $pirateformsopt_smtp_password;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 884 |
endif;
|
| 885 |
+
|
| 886 |
+
if ( ! empty( $pirateformsopt_use_secure ) ) {
|
| 887 |
+
$phpmailer->SMTPSecure = $pirateformsopt_use_secure;
|
|
|
|
|
|
|
|
|
|
| 888 |
}
|
| 889 |
+
// @codingStandardsIgnoreEnd
|
| 890 |
endif;
|
|
|
|
|
|
|
| 891 |
}
|
| 892 |
|
| 893 |
/**
|
| 894 |
+
* Alter classes and wrapper of form elements for compatibility reasons with differen themes.
|
| 895 |
*
|
| 896 |
+
* @param array $elements The form elements.
|
| 897 |
+
*
|
| 898 |
+
* @return array The form elements.
|
| 899 |
*/
|
| 900 |
+
public function compatibility_class( $elements ) {
|
| 901 |
+
if ( function_exists( 'zerif_setup' ) ) {
|
| 902 |
+
foreach ( $elements as $k => $element ) {
|
| 903 |
+
if ( $element['id'] == 'pirate-forms-contact-submit' ) {
|
| 904 |
+
$elements[ $k ]['class'] = 'btn btn-primary custom-button red-btn pirate-forms-submit-button';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 905 |
}
|
| 906 |
+
if ( $element['id'] == 'pirate-forms-contact-name' ) {
|
| 907 |
+
$elements[ $k ]['wrap']['class'] = 'col-lg-4 col-sm-4 form_field_wrap';
|
| 908 |
+
$elements[ $k ]['class'] = 'form-control input';
|
|
|
|
|
|
|
|
|
|
| 909 |
}
|
| 910 |
+
if ( $element['id'] == 'pirate-forms-contact-email' ) {
|
| 911 |
+
$elements[ $k ]['wrap']['class'] = 'col-lg-4 col-sm-4 form_field_wrap';
|
| 912 |
+
$elements[ $k ]['class'] = 'form-control input';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 913 |
}
|
| 914 |
+
if ( $element['id'] == 'pirate-forms-contact-subject' ) {
|
| 915 |
+
$elements[ $k ]['wrap']['class'] = 'col-lg-4 col-sm-4 form_field_wrap';
|
| 916 |
+
$elements[ $k ]['class'] = 'form-control input';
|
| 917 |
}
|
| 918 |
+
if ( $element['id'] == 'pirate-forms-contact-message' ) {
|
| 919 |
+
$elements[ $k ]['wrap']['class'] = 'col-lg-12 col-sm-12 form_field_wrap';
|
| 920 |
+
$elements[ $k ]['class'] = 'form-control input';
|
| 921 |
+
}
|
| 922 |
+
}
|
| 923 |
+
}
|
| 924 |
+
|
| 925 |
+
return $elements;
|
| 926 |
}
|
| 927 |
}
|
public/css/front.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
/*
|
| 2 |
-
Version: 2.0.
|
| 3 |
*/
|
| 4 |
.pirate_forms_wrap .form_field_wrap {
|
| 5 |
margin-bottom: 20px;
|
| 1 |
/*
|
| 2 |
+
Version: 2.0.1
|
| 3 |
*/
|
| 4 |
.pirate_forms_wrap .form_field_wrap {
|
| 5 |
margin-bottom: 20px;
|
public/partials/pirateforms-form.php
CHANGED
|
@@ -13,43 +13,44 @@
|
|
| 13 |
*/
|
| 14 |
?>
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
<div class="pirate_forms_wrap">
|
| 21 |
-
<?php
|
| 22 |
-
|
| 23 |
-
if ( ! empty( $this->errors ) ) :
|
| 24 |
-
$output .= '<div class="col-sm-12 col-lg-12 pirate_forms_error_box">';
|
| 25 |
-
$output .= '<p>' . __( 'Sorry, an error occured.','pirate-forms' ) . '</p>';
|
| 26 |
-
$output .= '</div>';
|
| 27 |
-
foreach ( $this->errors as $err ) :
|
| 28 |
$output .= '<div class="col-sm-12 col-lg-12 pirate_forms_error_box">';
|
| 29 |
-
|
| 30 |
$output .= '</div>';
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
-
|
| 34 |
|
| 35 |
-
|
| 36 |
-
?>
|
| 37 |
|
| 38 |
<?php echo $this->form_start; ?>
|
| 39 |
|
| 40 |
<div class="pirate_forms_three_inputs_wrap">
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
<?php echo $this->contact_email; ?>
|
| 45 |
|
|
|
|
| 46 |
|
| 47 |
-
|
| 48 |
</div>
|
| 49 |
|
| 50 |
-
<div class="col-sm-12 col-lg-12 form_field_wrap contact_message_wrap ">
|
| 51 |
<?php echo $this->contact_message; ?>
|
| 52 |
-
|
| 53 |
|
| 54 |
<?php if ( isset( $this->attachment ) ) { ?>
|
| 55 |
<div class="col-sm-12 col-lg-12 form_field_wrap contact_attachment_wrap ">
|
|
@@ -63,9 +64,8 @@ if ( ! empty( $this->errors ) ) :
|
|
| 63 |
</div>
|
| 64 |
<?php } ?>
|
| 65 |
|
| 66 |
-
<div class="col-xs-12 col-sm-6 col-lg-6 form_field_wrap contact_submit_wrap">
|
| 67 |
<?php echo $this->contact_submit; ?>
|
| 68 |
-
|
| 69 |
|
| 70 |
<?php echo $this->form_end; ?>
|
| 71 |
<div class="pirate_forms_clearfix"></div>
|
| 13 |
*/
|
| 14 |
?>
|
| 15 |
|
| 16 |
+
<?php
|
| 17 |
+
if ( ! empty( $this->thank_you_message ) ) :
|
| 18 |
+
?>
|
| 19 |
+
<div class="col-sm-12 col-lg-12 pirate_forms_thankyou_wrap">
|
| 20 |
+
<p><?php echo $this->thank_you_message; ?></p>
|
| 21 |
+
</div>
|
| 22 |
+
<?php endif; ?>
|
| 23 |
|
| 24 |
<div class="pirate_forms_wrap">
|
| 25 |
+
<?php
|
| 26 |
+
$output = '';
|
| 27 |
+
if ( ! empty( $this->errors ) ) :
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
$output .= '<div class="col-sm-12 col-lg-12 pirate_forms_error_box">';
|
| 29 |
+
$output .= '<p>' . __( 'Sorry, an error occured.', 'pirate-forms' ) . '</p>';
|
| 30 |
$output .= '</div>';
|
| 31 |
+
foreach ( $this->errors as $err ) :
|
| 32 |
+
$output .= '<div class="col-sm-12 col-lg-12 pirate_forms_error_box">';
|
| 33 |
+
$output .= "<p>$err</p>";
|
| 34 |
+
$output .= '</div>';
|
| 35 |
+
endforeach;
|
| 36 |
|
| 37 |
+
endif;
|
| 38 |
|
| 39 |
+
echo $output;
|
| 40 |
+
?>
|
| 41 |
|
| 42 |
<?php echo $this->form_start; ?>
|
| 43 |
|
| 44 |
<div class="pirate_forms_three_inputs_wrap">
|
| 45 |
+
<?php echo $this->contact_name; ?>
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
+
<?php echo $this->contact_email; ?>
|
| 48 |
|
| 49 |
+
<?php echo $this->contact_subject; ?>
|
| 50 |
</div>
|
| 51 |
|
|
|
|
| 52 |
<?php echo $this->contact_message; ?>
|
| 53 |
+
|
| 54 |
|
| 55 |
<?php if ( isset( $this->attachment ) ) { ?>
|
| 56 |
<div class="col-sm-12 col-lg-12 form_field_wrap contact_attachment_wrap ">
|
| 64 |
</div>
|
| 65 |
<?php } ?>
|
| 66 |
|
|
|
|
| 67 |
<?php echo $this->contact_submit; ?>
|
| 68 |
+
|
| 69 |
|
| 70 |
<?php echo $this->form_end; ?>
|
| 71 |
<div class="pirate_forms_clearfix"></div>
|
readme.txt
CHANGED
|
@@ -84,6 +84,14 @@ You can follow the full documentation [here](http://docs.themeisle.com/article/4
|
|
| 84 |
[http://docs.themeisle.com/article/431-how-to-change-font-in-pirate-forms](http://docs.themeisle.com/article/431-how-to-change-font-in-pirate-forms)
|
| 85 |
|
| 86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
== Installation ==
|
| 88 |
|
| 89 |
Activating the Pirate Contact Form plugin is just like any other plugin. If you've uploaded the plugin package to your server already, skip to step 5 below:
|
|
@@ -105,6 +113,11 @@ Activating the Pirate Contact Form plugin is just like any other plugin. If you'
|
|
| 105 |
4. Screenshot 4. Enabling SMTP
|
| 106 |
|
| 107 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
= 2.0.0 - 2017-08-01 =
|
| 109 |
|
| 110 |
* Major code refactor ( Please TEST BEFORE updating).
|
| 84 |
[http://docs.themeisle.com/article/431-how-to-change-font-in-pirate-forms](http://docs.themeisle.com/article/431-how-to-change-font-in-pirate-forms)
|
| 85 |
|
| 86 |
|
| 87 |
+
= How you can overwrite the default form template in Pirate Forms =
|
| 88 |
+
[http://docs.themeisle.com/article/664-how-you-can-overwrite-the-default-form-template-in-pirate-forms](http://docs.themeisle.com/article/664-how-you-can-overwrite-the-default-form-template-in-pirate-forms)
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
= What actions and filters are available in Pirate Forms =
|
| 92 |
+
[http://docs.themeisle.com/article/663-what-actions-and-filters-are-available-in-pirate-forms](http://docs.themeisle.com/article/663-what-actions-and-filters-are-available-in-pirate-forms)
|
| 93 |
+
|
| 94 |
+
|
| 95 |
== Installation ==
|
| 96 |
|
| 97 |
Activating the Pirate Contact Form plugin is just like any other plugin. If you've uploaded the plugin package to your server already, skip to step 5 below:
|
| 113 |
4. Screenshot 4. Enabling SMTP
|
| 114 |
|
| 115 |
== Changelog ==
|
| 116 |
+
= 2.0.1 - 2017-08-01 =
|
| 117 |
+
|
| 118 |
+
* Fixed backwards compatibility with Zerif themes
|
| 119 |
+
|
| 120 |
+
|
| 121 |
= 2.0.0 - 2017-08-01 =
|
| 122 |
|
| 123 |
* Major code refactor ( Please TEST BEFORE updating).
|
vendor/autoload.php
CHANGED
|
@@ -4,4 +4,4 @@
|
|
| 4 |
|
| 5 |
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
| 6 |
|
| 7 |
-
return
|
| 4 |
|
| 5 |
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
| 6 |
|
| 7 |
+
return ComposerAutoloaderInitc5c968f47d29c52d25f37143f61a236b::getLoader();
|
vendor/autoload_52.php
CHANGED
|
@@ -4,4 +4,4 @@
|
|
| 4 |
|
| 5 |
require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
|
| 6 |
|
| 7 |
-
return
|
| 4 |
|
| 5 |
require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
|
| 6 |
|
| 7 |
+
return ComposerAutoloaderInite8c84b227df2c7a8d0e5941c35929b93::getLoader();
|
vendor/composer/autoload_real.php
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
|
| 3 |
// autoload_real.php @generated by Composer
|
| 4 |
|
| 5 |
-
class
|
| 6 |
{
|
| 7 |
private static $loader;
|
| 8 |
|
|
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit7cbb4fd5eee0547f9ee43571b2c6da84
|
|
| 19 |
return self::$loader;
|
| 20 |
}
|
| 21 |
|
| 22 |
-
spl_autoload_register(array('
|
| 23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
| 24 |
-
spl_autoload_unregister(array('
|
| 25 |
|
| 26 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
| 27 |
foreach ($map as $namespace => $path) {
|
|
@@ -42,14 +42,14 @@ class ComposerAutoloaderInit7cbb4fd5eee0547f9ee43571b2c6da84
|
|
| 42 |
|
| 43 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
| 44 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
| 45 |
-
|
| 46 |
}
|
| 47 |
|
| 48 |
return $loader;
|
| 49 |
}
|
| 50 |
}
|
| 51 |
|
| 52 |
-
function
|
| 53 |
{
|
| 54 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
| 55 |
require $file;
|
| 2 |
|
| 3 |
// autoload_real.php @generated by Composer
|
| 4 |
|
| 5 |
+
class ComposerAutoloaderInitc5c968f47d29c52d25f37143f61a236b
|
| 6 |
{
|
| 7 |
private static $loader;
|
| 8 |
|
| 19 |
return self::$loader;
|
| 20 |
}
|
| 21 |
|
| 22 |
+
spl_autoload_register(array('ComposerAutoloaderInitc5c968f47d29c52d25f37143f61a236b', 'loadClassLoader'), true, true);
|
| 23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
| 24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitc5c968f47d29c52d25f37143f61a236b', 'loadClassLoader'));
|
| 25 |
|
| 26 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
| 27 |
foreach ($map as $namespace => $path) {
|
| 42 |
|
| 43 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
| 44 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
| 45 |
+
composerRequirec5c968f47d29c52d25f37143f61a236b($fileIdentifier, $file);
|
| 46 |
}
|
| 47 |
|
| 48 |
return $loader;
|
| 49 |
}
|
| 50 |
}
|
| 51 |
|
| 52 |
+
function composerRequirec5c968f47d29c52d25f37143f61a236b($fileIdentifier, $file)
|
| 53 |
{
|
| 54 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
| 55 |
require $file;
|
vendor/composer/autoload_real_52.php
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
|
| 3 |
// autoload_real_52.php generated by xrstf/composer-php52
|
| 4 |
|
| 5 |
-
class
|
| 6 |
private static $loader;
|
| 7 |
|
| 8 |
public static function loadClassLoader($class) {
|
|
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit0b2dc368ea60463e13ae4557665d52c4 {
|
|
| 19 |
return self::$loader;
|
| 20 |
}
|
| 21 |
|
| 22 |
-
spl_autoload_register(array('
|
| 23 |
self::$loader = $loader = new xrstf_Composer52_ClassLoader();
|
| 24 |
-
spl_autoload_unregister(array('
|
| 25 |
|
| 26 |
$vendorDir = dirname(dirname(__FILE__));
|
| 27 |
$baseDir = dirname($vendorDir);
|
| 2 |
|
| 3 |
// autoload_real_52.php generated by xrstf/composer-php52
|
| 4 |
|
| 5 |
+
class ComposerAutoloaderInite8c84b227df2c7a8d0e5941c35929b93 {
|
| 6 |
private static $loader;
|
| 7 |
|
| 8 |
public static function loadClassLoader($class) {
|
| 19 |
return self::$loader;
|
| 20 |
}
|
| 21 |
|
| 22 |
+
spl_autoload_register(array('ComposerAutoloaderInite8c84b227df2c7a8d0e5941c35929b93', 'loadClassLoader'), true /*, true */);
|
| 23 |
self::$loader = $loader = new xrstf_Composer52_ClassLoader();
|
| 24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInite8c84b227df2c7a8d0e5941c35929b93', 'loadClassLoader'));
|
| 25 |
|
| 26 |
$vendorDir = dirname(dirname(__FILE__));
|
| 27 |
$baseDir = dirname($vendorDir);
|
vendor/composer/installed.json
CHANGED
|
@@ -38,7 +38,7 @@
|
|
| 38 |
"version_normalized": "9999999-dev",
|
| 39 |
"source": {
|
| 40 |
"type": "git",
|
| 41 |
-
"url": "
|
| 42 |
"reference": "ebbbe0398ef8ee9922d17704e1dd2e9114e53ccb"
|
| 43 |
},
|
| 44 |
"dist": {
|
|
@@ -71,7 +71,8 @@
|
|
| 71 |
"wordpress"
|
| 72 |
],
|
| 73 |
"support": {
|
| 74 |
-
"issues": "https://github.com/Codeinwp/themeisle-sdk/issues"
|
|
|
|
| 75 |
}
|
| 76 |
}
|
| 77 |
]
|
| 38 |
"version_normalized": "9999999-dev",
|
| 39 |
"source": {
|
| 40 |
"type": "git",
|
| 41 |
+
"url": "https://github.com/Codeinwp/themeisle-sdk.git",
|
| 42 |
"reference": "ebbbe0398ef8ee9922d17704e1dd2e9114e53ccb"
|
| 43 |
},
|
| 44 |
"dist": {
|
| 71 |
"wordpress"
|
| 72 |
],
|
| 73 |
"support": {
|
| 74 |
+
"issues": "https://github.com/Codeinwp/themeisle-sdk/issues",
|
| 75 |
+
"source": "https://github.com/Codeinwp/themeisle-sdk/tree/master"
|
| 76 |
}
|
| 77 |
}
|
| 78 |
]
|
