rebase on oct-10-2023
This commit is contained in:
@@ -108,7 +108,7 @@ if ( ! class_exists( 'Translation_Entry', false ) ) :
|
||||
public function merge_with( &$other ) {
|
||||
$this->flags = array_unique( array_merge( $this->flags, $other->flags ) );
|
||||
$this->references = array_unique( array_merge( $this->references, $other->references ) );
|
||||
if ( $this->extracted_comments != $other->extracted_comments ) {
|
||||
if ( $this->extracted_comments !== $other->extracted_comments ) {
|
||||
$this->extracted_comments .= $other->extracted_comments;
|
||||
}
|
||||
|
||||
|
||||
@@ -206,9 +206,9 @@ if ( ! class_exists( 'MO', false ) ) :
|
||||
$magic_little_64 = (int) 2500072158;
|
||||
// 0xde120495
|
||||
$magic_big = ( (int) - 569244523 ) & 0xFFFFFFFF;
|
||||
if ( $magic_little == $magic || $magic_little_64 == $magic ) {
|
||||
if ( $magic_little === $magic || $magic_little_64 === $magic ) {
|
||||
return 'little';
|
||||
} elseif ( $magic_big == $magic ) {
|
||||
} elseif ( $magic_big === $magic ) {
|
||||
return 'big';
|
||||
} else {
|
||||
return false;
|
||||
@@ -229,7 +229,7 @@ if ( ! class_exists( 'MO', false ) ) :
|
||||
$endian = ( 'big' === $endian_string ) ? 'N' : 'V';
|
||||
|
||||
$header = $reader->read( 24 );
|
||||
if ( $reader->strlen( $header ) != 24 ) {
|
||||
if ( $reader->strlen( $header ) !== 24 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ if ( ! class_exists( 'MO', false ) ) :
|
||||
}
|
||||
|
||||
// Support revision 0 of MO format specs, only.
|
||||
if ( 0 != $header['revision'] ) {
|
||||
if ( 0 !== $header['revision'] ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -249,23 +249,23 @@ if ( ! class_exists( 'MO', false ) ) :
|
||||
|
||||
// Read originals' indices.
|
||||
$originals_lengths_length = $header['translations_lengths_addr'] - $header['originals_lengths_addr'];
|
||||
if ( $originals_lengths_length != $header['total'] * 8 ) {
|
||||
if ( $originals_lengths_length !== $header['total'] * 8 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$originals = $reader->read( $originals_lengths_length );
|
||||
if ( $reader->strlen( $originals ) != $originals_lengths_length ) {
|
||||
if ( $reader->strlen( $originals ) !== $originals_lengths_length ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Read translations' indices.
|
||||
$translations_lengths_length = $header['hash_addr'] - $header['translations_lengths_addr'];
|
||||
if ( $translations_lengths_length != $header['total'] * 8 ) {
|
||||
if ( $translations_lengths_length !== $header['total'] * 8 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$translations = $reader->read( $translations_lengths_length );
|
||||
if ( $reader->strlen( $translations ) != $translations_lengths_length ) {
|
||||
if ( $reader->strlen( $translations ) !== $translations_lengths_length ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ if ( ! class_exists( 'PO', false ) ) :
|
||||
|
||||
$po = $quote . implode( "{$slash}n{$quote}{$newline}{$quote}", explode( $newline, $input_string ) ) . $quote;
|
||||
// Add empty string on first line for readbility.
|
||||
if ( false !== strpos( $input_string, $newline ) &&
|
||||
if ( str_contains( $input_string, $newline ) &&
|
||||
( substr_count( $input_string, $newline ) > 1 || substr( $input_string, -strlen( $newline ) ) !== $newline ) ) {
|
||||
$po = "$quote$quote$newline$po";
|
||||
}
|
||||
@@ -505,10 +505,10 @@ if ( ! class_exists( 'PO', false ) ) :
|
||||
* @return string
|
||||
*/
|
||||
public static function trim_quotes( $s ) {
|
||||
if ( '"' === substr( $s, 0, 1 ) ) {
|
||||
if ( str_starts_with( $s, '"' ) ) {
|
||||
$s = substr( $s, 1 );
|
||||
}
|
||||
if ( '"' === substr( $s, -1, 1 ) ) {
|
||||
if ( str_ends_with( $s, '"' ) ) {
|
||||
$s = substr( $s, 0, -1 );
|
||||
}
|
||||
return $s;
|
||||
|
||||
@@ -60,7 +60,7 @@ if ( ! class_exists( 'POMO_Reader', false ) ) :
|
||||
*/
|
||||
public function readint32() {
|
||||
$bytes = $this->read( 4 );
|
||||
if ( 4 != $this->strlen( $bytes ) ) {
|
||||
if ( 4 !== $this->strlen( $bytes ) ) {
|
||||
return false;
|
||||
}
|
||||
$endian_letter = ( 'big' === $this->endian ) ? 'N' : 'V';
|
||||
@@ -77,7 +77,7 @@ if ( ! class_exists( 'POMO_Reader', false ) ) :
|
||||
*/
|
||||
public function readint32array( $count ) {
|
||||
$bytes = $this->read( 4 * $count );
|
||||
if ( 4 * $count != $this->strlen( $bytes ) ) {
|
||||
if ( 4 * $count !== $this->strlen( $bytes ) ) {
|
||||
return false;
|
||||
}
|
||||
$endian_letter = ( 'big' === $this->endian ) ? 'N' : 'V';
|
||||
@@ -194,7 +194,7 @@ if ( ! class_exists( 'POMO_FileReader', false ) ) :
|
||||
* @return bool
|
||||
*/
|
||||
public function seekto( $pos ) {
|
||||
if ( -1 == fseek( $this->_f, $pos, SEEK_SET ) ) {
|
||||
if ( -1 === fseek( $this->_f, $pos, SEEK_SET ) ) {
|
||||
return false;
|
||||
}
|
||||
$this->_pos = $pos;
|
||||
|
||||
@@ -120,7 +120,7 @@ if ( ! class_exists( 'Translations', false ) ) :
|
||||
* @param int $count number of items
|
||||
*/
|
||||
public function select_plural_form( $count ) {
|
||||
return 1 == $count ? 0 : 1;
|
||||
return 1 === (int) $count ? 0 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,7 +152,7 @@ if ( ! class_exists( 'Translations', false ) ) :
|
||||
isset( $translated->translations[ $index ] ) ) {
|
||||
return $translated->translations[ $index ];
|
||||
} else {
|
||||
return 1 == $count ? $singular : $plural;
|
||||
return 1 === (int) $count ? $singular : $plural;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,7 +366,7 @@ if ( ! class_exists( 'NOOP_Translations', false ) ) :
|
||||
* @return bool
|
||||
*/
|
||||
public function select_plural_form( $count ) {
|
||||
return 1 == $count ? 0 : 1;
|
||||
return 1 === (int) $count ? 0 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -383,7 +383,7 @@ if ( ! class_exists( 'NOOP_Translations', false ) ) :
|
||||
* @param string $context
|
||||
*/
|
||||
public function translate_plural( $singular, $plural, $count, $context = null ) {
|
||||
return 1 == $count ? $singular : $plural;
|
||||
return 1 === (int) $count ? $singular : $plural;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user