/** * Check which major version of PDFlib is installed * * @return int The mahor version number of PDFlib * @access private */ function _version() { $result = false; if (function_exists('pdf_get_majorversion')) { $version = pdf_get_majorversion(); } else { ob_start(); phpinfo(8); $php_info = ob_get_contents(); ob_end_clean(); if (ereg("<td[^>]*>PDFlib GmbH Version *<\\/td><td[^>]*>([^<]*)<\\/td>", $php_info, $result)) { $version = $result[1]; } } if (ereg('([0-9]{1,2})\\.[0-9]{1,2}(\\.[0-9]{1,2})?', trim($version), $result)) { return $result[1]; } else { return 0; } }
/** * Check which major version of PDFlib is installed * * @return int The mahor version number of PDFlib * @access private */ function _version() { $result = false; $version = ''; if (function_exists('pdf_get_majorversion')) { $version = pdf_get_majorversion(); } else { if (function_exists('pdf_get_value')) { $version = pdf_get_value($this->_pdf, 'major', 0); } else { ob_start(); phpinfo(8); $php_info = ob_get_contents(); ob_end_clean(); if (preg_match("/<td[^>]*>PDFlib GmbH Version *<\\/td><td[^>]*>([^<]*)<\\/td>/", $php_info, $result)) { $version = $result[1]; } } } if (preg_match('/([0-9]{1,2})\\.[0-9]{1,2}(\\.[0-9]{1,2})?/', trim($version), $result)) { return $result[1]; } else { return $version; } }