Skip to content

Commit

Permalink
Update with the latest code from WP.org 2.3.28
Browse files Browse the repository at this point in the history
  • Loading branch information
bordoni committed Jan 5, 2023
1 parent fb9dcae commit 0054771
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 102 deletions.
2 changes: 1 addition & 1 deletion gigpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: GigPress
* Plugin URI: https://evnt.is/1aca
* Description: GigPress is a live performance listing and management plugin built for musicians and performers.
* Version: 2.3.26
* Version: 2.3.28
* Author: The Events Calendar
* Author URI: https://evnt.is/1aor
* Text Domain: gigpress
Expand Down
39 changes: 22 additions & 17 deletions lib/parsecsv.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,9 @@ function parse_string( $data = null ) {

// walk through each character
for ( $i = 0; $i < $strlen; $i ++ ) {
$ch = $data{$i};
$nch = ( isset( $data{$i + 1} ) ) ? $data{$i + 1} : false;
$pch = ( isset( $data{$i - 1} ) ) ? $data{$i - 1} : false;
$ch = $data[ $i ];
$nch = ( isset( $data[ $i + 1 ] ) ) ? $data[ $i + 1 ] : false;
$pch = ( isset( $data[ $i - 1 ] ) ) ? $data[ $i - 1 ] : false;

// open/close quotes, and inline quotes
if ( $ch == $this->enclosure ) {
Expand All @@ -373,9 +373,9 @@ function parse_string( $data = null ) {
$current .= $ch;
$i ++;
} elseif ( $nch != $this->delimiter && $nch != "\r" && $nch != "\n" ) {
for ( $x = ( $i + 1 ); isset( $data{$x} ) && ltrim( $data{$x}, $white_spaces ) == ''; $x ++ ) {
for ( $x = ( $i + 1 ); isset( $data[ $x ] ) && ltrim( $data[ $x ], $white_spaces ) == ''; $x ++ ) {
}
if ( $data{$x} == $this->delimiter ) {
if ( $data[ $x ] == $this->delimiter ) {
$enclosed = false;
$i = $x;
} else {
Expand Down Expand Up @@ -552,12 +552,19 @@ function _validate_row_conditions( $row = [], $conditions = null ) {
*/
function _validate_row_condition( $row, $condition ) {
$operators = [
'=', 'equals', 'is',
'!=', 'is not',
'<', 'is less than',
'>', 'is greater than',
'<=', 'is less than or equals',
'>=', 'is greater than or equals',
'=',
'equals',
'is',
'!=',
'is not',
'<',
'is less than',
'>',
'is greater than',
'<=',
'is less than or equals',
'>=',
'is greater than or equals',
'contains',
'does not contain',
];
Expand Down Expand Up @@ -712,7 +719,7 @@ function _enclose_value( $value = null ) {
if ( $value !== null && $value != '' ) {
$delimiter = preg_quote( $this->delimiter, '/' );
$enclosure = preg_quote( $this->enclosure, '/' );
if ( preg_match( "/" . $delimiter . "|" . $enclosure . "|\n|\r/i", $value ) || ( $value{0} == ' ' || substr( $value, - 1 ) == ' ' ) ) {
if ( preg_match( "/" . $delimiter . "|" . $enclosure . "|\n|\r/i", $value ) || ( $value[0] == ' ' || substr( $value, - 1 ) == ' ' ) ) {
$value = str_replace( $this->enclosure, $this->enclosure . $this->enclosure, $value );
$value = $this->enclosure . $value . $this->enclosure;
}
Expand Down Expand Up @@ -810,9 +817,9 @@ function auto( $file = null, $parse = true, $search_depth = null, $preferred = n

// walk specific depth finding posssible delimiter characters
for ( $i = 0; $i < $strlen; $i ++ ) {
$ch = $data{$i};
$nch = ( isset( $data{$i + 1} ) ) ? $data{$i + 1} : false;
$pch = ( isset( $data{$i - 1} ) ) ? $data{$i - 1} : false;
$ch = $data[ $i ];
$nch = ( isset( $data[ $i + 1 ] ) ) ? $data[ $i + 1 ] : false;
$pch = ( isset( $data[ $i - 1 ] ) ) ? $data[ $i - 1 ] : false;

// open and closing quotes
if ( $ch == $enclosure ) {
Expand Down Expand Up @@ -906,5 +913,3 @@ function _check_count( $char, $array, $depth, $preferred ) {
}

}

?>
Loading

0 comments on commit 0054771

Please sign in to comment.