1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-27 17:00:52 +01:00

Fix warnings in PHP7 in gettext library

Not sure how to commit this upstream, the library seems to be
unmaintained.
This commit is contained in:
Fredrick Brennan 2017-11-05 21:17:20 +08:00
parent ac8f15f0f2
commit c2f7073dd4
3 changed files with 19 additions and 4 deletions

Binary file not shown.

View File

@ -98,7 +98,7 @@ class gettext_reader {
* @param object Reader the StreamReader object
* @param boolean enable_cache Enable or disable caching of strings (default on)
*/
function gettext_reader($Reader, $enable_cache = true) {
function __construct($Reader, $enable_cache = true) {
// If there isn't a StreamReader, turn on short circuit mode.
if (! $Reader || isset($Reader->error) ) {
$this->short_circuit = true;
@ -129,6 +129,9 @@ class gettext_reader {
$this->originals = $this->readint();
$this->translations = $this->readint();
}
function gettext_reader($Reader, $enable_cache = true) {
self::__construct($Reader, $enable_cache);
}
/**
* Loads the translation tables from the MO file into the cache

View File

@ -49,11 +49,15 @@ class StringReader {
var $_pos;
var $_str;
function StringReader($str='') {
function __construct($str='') {
$this->_str = $str;
$this->_pos = 0;
}
function StringReader($str='') {
self::__construct($str);
}
function read($bytes) {
$data = substr($this->_str, $this->_pos, $bytes);
$this->_pos += $bytes;
@ -86,7 +90,7 @@ class FileReader {
var $_fd;
var $_length;
function FileReader($filename) {
function __construct($filename) {
if (file_exists($filename)) {
$this->_length=filesize($filename);
@ -102,6 +106,10 @@ class FileReader {
}
}
function FileReader($filename) {
self::__construct($filename);
}
function read($bytes) {
if ($bytes) {
fseek($this->_fd, $this->_pos);
@ -143,7 +151,7 @@ class FileReader {
// Preloads entire file in memory first, then creates a StringReader
// over it (it assumes knowledge of StringReader internals)
class CachedFileReader extends StringReader {
function CachedFileReader($filename) {
function __construct($filename) {
if (file_exists($filename)) {
$length=filesize($filename);
@ -161,6 +169,10 @@ class CachedFileReader extends StringReader {
return false;
}
}
function CachedFileReader($filename) {
self::__construct($filename);
}
};