C:/lib/adodb/session/adodb-compress-gzip.php Quellcode

adodb-compress-gzip.php
gehe zur Dokumentation dieser Datei
1 <?php
2 
3 
4 /*
5 V5.19dev ??-???-2014 (c) 2000-2014 John Lim (jlim#natsoft.com). All rights reserved.
6  Contributed by Ross Smith (adodb@netebb.com).
7  Released under both BSD license and Lesser GPL library license.
8  Whenever there is any discrepancy between the two licenses,
9  the BSD license will take precedence.
10  Set tabs to 4 for best viewing.
11 
12 */
13 
14 if (!function_exists('gzcompress')) {
15  trigger_error('gzip functions are not available', E_USER_ERROR);
16  return 0;
17 }
18 
19 /*
20 */
24  var $_level = null;
25 
28  var $_min_length = 1;
29 
32  function getLevel() {
33  return $this->_level;
34  }
35 
38  function setLevel($level) {
39  assert('$level >= 0');
40  assert('$level <= 9');
41  $this->_level = (int) $level;
42  }
43 
46  function getMinLength() {
47  return $this->_min_length;
48  }
49 
52  function setMinLength($min_length) {
53  assert('$min_length >= 0');
54  $this->_min_length = (int) $min_length;
55  }
56 
59  function ADODB_Compress_Gzip($level = null, $min_length = null) {
60  if (!is_null($level)) {
61  $this->setLevel($level);
62  }
63 
64  if (!is_null($min_length)) {
65  $this->setMinLength($min_length);
66  }
67  }
68 
71  function write($data, $key) {
72  if (strlen($data) < $this->_min_length) {
73  return $data;
74  }
75 
76  if (!is_null($this->_level)) {
77  return gzcompress($data, $this->_level);
78  } else {
79  return gzcompress($data);
80  }
81  }
82 
85  function read($data, $key) {
86  return $data ? gzuncompress($data) : $data;
87  }
88 
89 }
90 
91 return 1;
92 
93 ?>




Korrekturen, Hinweise und Ergänzungen

Bitte scheuen Sie sich nicht und melden Sie, was auf dieser Seite sachlich falsch oder irreführend ist, was ergänzt werden sollte, was fehlt usw. Dazu bitte oben aus dem Menü Seite den Eintrag Support Forum wählen. Es ist eine kostenlose Anmeldung erforderlich, um Anmerkungen zu posten. Unpassende Postings, Spam usw. werden kommentarlos entfernt.