本文整理汇总了PHP中DOMPDF::get_quirksmode方法的典型用法代码示例。如果您正苦于以下问题:PHP DOMPDF::get_quirksmode方法的具体用法?PHP DOMPDF::get_quirksmode怎么用?PHP DOMPDF::get_quirksmode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMPDF
的用法示例。
在下文中一共展示了DOMPDF::get_quirksmode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: list
/**
* load and parse a CSS file
*
* @param string $file
* @param int $origin
*/
function load_css_file($file, $origin = self::ORIG_AUTHOR) {
if ( $origin ) {
$this->_current_origin = $origin;
}
// Prevent circular references
if ( isset($this->_loaded_files[$file]) ) {
return;
}
$this->_loaded_files[$file] = true;
if ( strpos($file, "data:") === 0) {
$parsed = parse_data_uri($file);
$css = $parsed["data"];
}
else {
$parsed_url = explode_url($file);
list($this->_protocol, $this->_base_host, $this->_base_path, $filename) = $parsed_url;
// Fix submitted by Nick Oostveen for aliased directory support:
if ( $this->_protocol == "" ) {
$file = $this->_base_path . $filename;
}
else {
$file = build_url($this->_protocol, $this->_base_host, $this->_base_path, $filename);
}
set_error_handler("record_warnings");
$css = file_get_contents($file, null, $this->_dompdf->get_http_context());
restore_error_handler();
$good_mime_type = true;
// See http://the-stickman.com/web-development/php/getting-http-response-headers-when-using-file_get_contents/
if ( isset($http_response_header) && !$this->_dompdf->get_quirksmode() ) {
foreach($http_response_header as $_header) {
if ( preg_match("@Content-Type:\s*([\w/]+)@i", $_header, $matches) &&
($matches[1] !== "text/css") ) {
$good_mime_type = false;
}
}
}
if ( !$good_mime_type || $css == "" ) {
record_warnings(E_USER_WARNING, "Unable to load css file $file", __FILE__, __LINE__);
return;
}
}
$this->_parse_css($css);
}