Browse Source

Fix warnings in PHP7 in gettext library

Not sure how to commit this upstream, the library seems to be
unmaintained.
main
Fredrick Brennan 7 years ago
parent
commit
c2f7073dd4
  1. BIN
      inc/lib/gettext/.gettext.php.swp
  2. 5
      inc/lib/gettext/gettext.php
  3. 18
      inc/lib/gettext/streams.php

BIN
inc/lib/gettext/.gettext.php.swp

Binary file not shown.

5
inc/lib/gettext/gettext.php

@ -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

18
inc/lib/gettext/streams.php

@ -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);
}
};

Loading…
Cancel
Save