| 1813 | * Decompression of deflated string while staying compatible with the majority of servers. |
| 1814 | * |
| 1815 | * Certain Servers will return deflated data with headers which PHP's gziniflate() |
| 1816 | * function cannot handle out of the box. The following function lifted from |
| 1817 | * http://au2.php.net/manual/en/function.gzinflate.php#77336 will attempt to deflate |
| 1818 | * the various return forms used. |
| 1819 | * |
| 1820 | * @since 2.8.1 |
| 1821 | * @link http://au2.php.net/manual/en/function.gzinflate.php#77336 |
| 1822 | * |
| 1823 | * @param string $gzData String to decompress. |
| 1824 | * @return string|bool False on failure. |
| 1825 | */ |
| 1826 | function compatible_gzinflate($gzData) { |
| 1827 | if ( substr($gzData, 0, 3) == "\x1f\x8b\x08" ) { |
| 1828 | $i = 10; |
| 1829 | $flg = ord( substr($gzData, 3, 1) ); |
| 1830 | if ( $flg > 0 ) { |
| 1831 | if ( $flg & 4 ) { |
| 1832 | list($xlen) = unpack('v', substr($gzData, $i, 2) ); |
| 1833 | $i = $i + 2 + $xlen; |
| 1834 | } |
| 1835 | if ( $flg & 8 ) |
| 1836 | $i = strpos($gzData, "\0", $i) + 1; |
| 1837 | if ( $flg & 16 ) |
| 1838 | $i = strpos($gzData, "\0", $i) + 1; |
| 1839 | if ( $flg & 2 ) |
| 1840 | $i = $i + 2; |
| 1841 | } |
| 1842 | return gzinflate( substr($gzData, $i, -8) ); |
| 1843 | } else { |
| 1844 | return false; |
| 1845 | } |
| 1846 | } |
| 1847 | |
| 1848 | /** |