Skip to content

Commit

Permalink
Merge pull request #530 from takayukister/dev/5.5
Browse files Browse the repository at this point in the history
Use wpcf7_canonicalize()
  • Loading branch information
takayukister authored Aug 28, 2021
2 parents 3511257 + 59c9c95 commit 56bae20
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
22 changes: 12 additions & 10 deletions includes/pipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,22 @@ private function add_pipe( $text ) {
}

public function do_pipe( $input ) {
$input_canonical = wpcf7_canonicalize( $input, array(
'strto' => 'as-is',
) );

foreach ( $this->pipes as $pipe ) {
$before = html_entity_decode(
$pipe->before,
ENT_QUOTES | ENT_HTML5,
'UTF-8'
);

$after = html_entity_decode(
$pipe->after,
ENT_QUOTES | ENT_HTML5,
'UTF-8'
list( $before, $after ) = array_map(
function ( $item ) {
return wpcf7_canonicalize( $item, array(
'strto' => 'as-is',
) );
},
array( $pipe->before, $pipe->after )
);

if ( $before === $input ) {
if ( $input_canonical === $before ) {
return $after;
}
}
Expand Down
17 changes: 7 additions & 10 deletions includes/submission.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,16 +327,13 @@ private function setup_posted_data() {
-1, 1
);

$last_val = html_entity_decode(
$last_val,
ENT_QUOTES | ENT_HTML5,
'UTF-8'
);

$tied_item = html_entity_decode(
$tied_item,
ENT_QUOTES | ENT_HTML5,
'UTF-8'
list( $last_val, $tied_item ) = array_map(
function ( $item ) {
return wpcf7_canonicalize( $item, array(
'strto' => 'as-is',
) );
},
array( $last_val, $tied_item )
);

if ( $last_val === $tied_item ) {
Expand Down

0 comments on commit 56bae20

Please sign in to comment.