Skip to content

Commit

Permalink
Merge pull request #916 from takayukister/dev/5.6
Browse files Browse the repository at this point in the history
Update submission.php
  • Loading branch information
takayukister authored Aug 7, 2022
2 parents 3df7afa + 2d91a4a commit c0e74c8
Showing 1 changed file with 52 additions and 2 deletions.
54 changes: 52 additions & 2 deletions includes/submission.php
Original file line number Diff line number Diff line change
Expand Up @@ -653,17 +653,33 @@ private function accepted() {
}


/**
* Adds user consent data to this submission.
*
* @param string $name Field name.
* @param string $conditions Conditions of consent.
*/
public function add_consent( $name, $conditions ) {
$this->consent[$name] = $conditions;
return true;
}


/**
* Collects user consent data.
*
* @return array User consent data.
*/
public function collect_consent() {
return (array) $this->consent;
}


/**
* Executes spam protections.
*
* @return bool True if spam captured.
*/
private function spam() {
$spam = false;

Expand Down Expand Up @@ -705,6 +721,11 @@ private function spam() {
}


/**
* Adds a spam log.
*
* @link https://contactform7.com/2019/05/31/why-is-this-message-marked-spam/
*/
public function add_spam_log( $args = '' ) {
$args = wp_parse_args( $args, array(
'agent' => '',
Expand All @@ -715,11 +736,19 @@ public function add_spam_log( $args = '' ) {
}


/**
* Retrieves the spam logging data.
*
* @return array Spam logging data.
*/
public function get_spam_log() {
return $this->spam_log;
}


/**
* Verifies that a correct security nonce was used.
*/
private function verify_nonce() {
if ( ! $this->contact_form->nonce_is_active() or ! is_user_logged_in() ) {
return true;
Expand All @@ -731,8 +760,9 @@ private function verify_nonce() {
}


/* Mail */

/**
* Function called just before sending email.
*/
private function before_send_mail() {
$abort = false;

Expand All @@ -746,6 +776,9 @@ private function before_send_mail() {
}


/**
* Sends emails based on user input values and contact form email templates.
*/
private function mail() {
$contact_form = $this->contact_form;

Expand Down Expand Up @@ -782,11 +815,20 @@ private function mail() {
}


/**
* Retrieves files uploaded through this submission.
*/
public function uploaded_files() {
return $this->uploaded_files;
}


/**
* Adds a file to the uploaded files array.
*
* @param string $name Field name.
* @param string|array $file_path File path or array of file paths.
*/
private function add_uploaded_file( $name, $file_path ) {
if ( ! wpcf7_is_name( $name ) ) {
return false;
Expand All @@ -811,6 +853,9 @@ private function add_uploaded_file( $name, $file_path ) {
}


/**
* Removes uploaded files.
*/
private function remove_uploaded_files() {
foreach ( (array) $this->uploaded_files as $file_path ) {
$paths = (array) $file_path;
Expand All @@ -829,6 +874,11 @@ private function remove_uploaded_files() {
}


/**
* Moves uploaded files to the tmp directory and validates them.
*
* @return bool True if no invalid file is found.
*/
private function unship_uploaded_files() {
$result = new WPCF7_Validation();

Expand Down

0 comments on commit c0e74c8

Please sign in to comment.