本文整理汇总了PHP中Frame类的典型用法代码示例。如果您正苦于以下问题:PHP Frame类的具体用法?PHP Frame怎么用?PHP Frame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Frame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
function render(Frame $frame)
{
$style = $frame->get_style();
list($x, $y, $w, $h) = $frame->get_padding_box();
$this->_set_opacity($frame->get_opacity($style->opacity));
// Draw our background, border and content
if (($bg = $style->background_color) !== "transparent") {
$this->_canvas->filled_rectangle($x, $y, $w, $h, $bg);
}
if (($url = $style->background_image) && $url !== "none") {
$this->_background_image($url, $x, $y, $w, $h, $style);
}
$this->_render_border($frame);
$this->_render_outline($frame);
if (DEBUG_LAYOUT && DEBUG_LAYOUT_BLOCKS) {
$this->_debug_layout($frame->get_border_box(), "red");
if (DEBUG_LAYOUT_PADDINGBOX) {
$this->_debug_layout($frame->get_padding_box(), "red", array(0.5, 0.5));
}
}
if (DEBUG_LAYOUT && DEBUG_LAYOUT_LINES && $frame->get_decorator()) {
foreach ($frame->get_decorator()->get_line_boxes() as $line) {
$frame->_debug_layout(array($line->x, $line->y, $line->w, $line->h), "orange");
}
}
}
示例2: render
function render(Frame $frame)
{
$style = $frame->get_style();
$bullet_style = $style->list_style_type;
$bullet_size = List_Bullet_Frame_Decorator::BULLET_SIZE;
$line_height = $style->length_in_pt($style->line_height, $frame->get_containing_block("w"));
$fill = false;
switch ($bullet_style) {
default:
case "disc":
$fill = true;
case "circle":
if (!$fill) {
$fill = false;
}
list($x, $y) = $frame->get_position();
$x += $bullet_size / 2;
$y += $line_height / 2 + $bullet_size / 4;
$r = $bullet_size / 4;
$this->_canvas->circle($x, $y, $r, $style->color, null, null, $fill);
break;
case "square":
list($x, $y) = $frame->get_position();
$w = $bullet_size / 2;
$x += $bullet_size / 2 - $w / 2;
$y += $line_height / 2;
$this->_canvas->filled_rectangle($x, $y, $w, $w, $style->color);
break;
}
}
示例3: _build_tree_r
protected function _build_tree_r(DomNode $node)
{
$frame = new Frame($node);
$id = $frame->get_id();
$this->_registry[$id] = $frame;
if (!$node->hasChildNodes()) {
return $frame;
}
$children = array();
for ($i = 0; $i < $node->childNodes->length; $i++) {
$children[] = $node->childNodes->item($i);
}
foreach ($children as $child) {
$node_name = mb_strtolower($child->nodeName);
if (in_array($node_name, self::$_HIDDEN_TAGS)) {
if ($node_name !== "head" && $node_name !== "style") {
$child->parentNode->removeChild($child);
}
continue;
}
if ($node_name === "#text" && $child->nodeValue == "") {
$child->parentNode->removeChild($child);
continue;
}
if ($node_name === "img" && $child->getAttribute("src") == "") {
$child->parentNode->removeChild($child);
continue;
}
$frame->append_child($this->_build_tree_r($child), false);
}
return $frame;
}
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:32,代码来源:frame_tree.cls.php
示例4: apply_page_style
function apply_page_style(Frame $frame, $page_number)
{
$style = $frame->get_style();
$page_styles = $style->get_stylesheet()->get_page_styles();
// http://www.w3.org/TR/CSS21/page.html#page-selectors
if (count($page_styles) > 1) {
$odd = $page_number % 2 == 1;
$first = $page_number == 1;
$style = clone $page_styles["base"];
// FIXME RTL
if ($odd && isset($page_styles[":right"])) {
$style->merge($page_styles[":right"]);
}
if ($odd && isset($page_styles[":odd"])) {
$style->merge($page_styles[":odd"]);
}
// FIXME RTL
if (!$odd && isset($page_styles[":left"])) {
$style->merge($page_styles[":left"]);
}
if (!$odd && isset($page_styles[":even"])) {
$style->merge($page_styles[":even"]);
}
if ($first && isset($page_styles[":first"])) {
$style->merge($page_styles[":first"]);
}
$frame->set_style($style);
}
}
示例5: render
function render(Frame $frame)
{
if (!DOMPDF_ENABLE_JAVASCRIPT) {
return;
}
$this->insert($frame->get_node()->nodeValue);
}
示例6: render
function render(Frame $frame)
{
if (!$this->_dompdf->get_option("enable_javascript")) {
return;
}
$this->insert($frame->get_node()->nodeValue);
}
示例7: __construct
/**
* Class constructor
*
* @param Frame $frame the bullet frame to decorate
* @param DOMPDF $dompdf the document's dompdf object
*/
function __construct(Frame $frame, DOMPDF $dompdf)
{
$style = $frame->get_style();
$url = $style->list_style_image;
$frame->get_node()->setAttribute("src", $url);
$this->_img = new Image_Frame_Decorator($frame, $dompdf);
parent::__construct($this->_img, $dompdf);
list($width, $height) = dompdf_getimagesize($this->_img->get_image_url());
// Resample the bullet image to be consistent with 'auto' sized images
// See also Image_Frame_Reflower::get_min_max_width
// Tested php ver: value measured in px, suffix "px" not in value: rtrim unnecessary.
$this->_width = (double) rtrim($width, "px") * 72 / DOMPDF_DPI;
$this->_height = (double) rtrim($height, "px") * 72 / DOMPDF_DPI;
//If an image is taller as the containing block/box, the box should be extended.
//Neighbour elements are overwriting the overlapping image areas.
//Todo: Where can the box size be extended?
//Code below has no effect.
//See block_frame_reflower _calculate_restricted_height
//See generated_frame_reflower, Dompdf:render() "list-item", "-dompdf-list-bullet"S.
//Leave for now
//if ($style->min_height < $this->_height ) {
// $style->min_height = $this->_height;
//}
//$style->height = "auto";
}
示例8: translate_attributes
static function translate_attributes(Frame $frame)
{
$node = $frame->get_node();
$tag = $node->tagName;
if (!isset(self::$__ATTRIBUTE_LOOKUP[$tag])) {
return;
}
$valid_attrs = self::$__ATTRIBUTE_LOOKUP[$tag];
$attrs = $node->attributes;
$style = rtrim($node->getAttribute(self::$_style_attr), "; ");
if ($style != "") {
$style .= ";";
}
foreach ($attrs as $attr => $attr_node) {
if (!isset($valid_attrs[$attr])) {
continue;
}
$value = $attr_node->value;
$target = $valid_attrs[$attr];
// Look up $value in $target, if $target is an array:
if (is_array($target)) {
if (isset($target[$value])) {
$style .= " " . self::_resolve_target($node, $target[$value], $value);
}
} else {
// otherwise use target directly
$style .= " " . self::_resolve_target($node, $target, $value);
}
}
if (!is_null($style)) {
$style = ltrim($style);
$node->setAttribute(self::$_style_attr, $style);
}
}
示例9: __construct
function __construct(Frame $frame, DOMPDF $dompdf) {
if ( !$frame->is_text_node() )
throw new DOMPDF_Exception("Text_Decorator can only be applied to #text nodes.");
parent::__construct($frame, $dompdf);
$this->_text_spacing = null;
}
示例10: render
/**
* Render frames recursively
*
* @param Frame $frame the frame to render
*/
function render(Frame $frame)
{
global $_dompdf_debug;
if ($_dompdf_debug) {
echo $frame;
flush();
}
$display = $frame->get_style()->display;
switch ($display) {
case "block":
case "list-item":
case "inline-block":
case "table":
case "table-row-group":
case "table-header-group":
case "table-footer-group":
case "inline-table":
$this->_render_frame("block", $frame);
break;
case "inline":
if ($frame->get_node()->nodeName === "#text") {
$this->_render_frame("text", $frame);
} else {
$this->_render_frame("inline", $frame);
}
break;
case "table-cell":
$this->_render_frame("table-cell", $frame);
break;
case "-dompdf-list-bullet":
$this->_render_frame("list-bullet", $frame);
break;
case "-dompdf-image":
$this->_render_frame("image", $frame);
break;
case "none":
$node = $frame->get_node();
if ($node->nodeName === "script") {
if ($node->getAttribute("type") === "text/php" || $node->getAttribute("language") === "php") {
// Evaluate embedded php scripts
$this->_render_frame("php", $frame);
} elseif ($node->getAttribute("type") === "text/javascript" || $node->getAttribute("language") === "javascript") {
// Insert JavaScript
$this->_render_frame("javascript", $frame);
}
}
// Don't render children, so skip to next iter
return;
default:
break;
}
// Check for begin frame callback
$this->_check_callbacks("begin_frame", $frame);
foreach ($frame->get_children() as $child) {
$this->render($child);
}
// Check for end frame callback
$this->_check_callbacks("end_frame", $frame);
}
示例11: __construct
function __construct(Frame $frame)
{
if ($frame->get_node()->nodeName != "#text") {
throw new DOMPDF_Exception("Text_Decorator can only be applied to #text nodes.");
}
parent::__construct($frame);
$this->_text_spacing = null;
}
示例12: copy
function copy(DomNode $node)
{
$frame = new Frame($node);
$frame->set_style(clone $this->_frame->get_original_style());
$deco = Frame_Factory::decorate_frame($frame);
$deco->set_root($this->_root);
return $deco;
}
示例13: deep_copy
function deep_copy()
{
$frame = new Frame($this->get_node()->cloneNode());
$frame->set_style(clone $this->_frame->get_original_style());
$deco = Frame_Factory::decorate_frame($frame, $this->_dompdf);
$deco->set_root($this->_root);
foreach ($this->get_children() as $child) {
$deco->append_child($child->deep_copy());
}
return $deco;
}
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:11,代码来源:frame_decorator.cls.php
示例14: __construct
function __construct(Frame $frame, DOMPDF $dompdf)
{
$style = $frame->get_style();
$url = $style->list_style_image;
$frame->get_node()->setAttribute("src", $url);
$this->_img = new Image_Frame_Decorator($frame, $dompdf);
parent::__construct($this->_img, $dompdf);
list($width, $height) = dompdf_getimagesize($this->_img->get_image_url());
$this->_width = (double) rtrim($width, "px") * 72 / DOMPDF_DPI;
$this->_height = (double) rtrim($height, "px") * 72 / DOMPDF_DPI;
}
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:11,代码来源:list_bullet_image_frame_decorator.cls.php
示例15: __construct
/**
* Class constructor
*
* @param Frame $frame the bullet frame to decorate
* @param DOMPDF $dompdf the document's dompdf object
*/
function __construct(Frame $frame, DOMPDF $dompdf)
{
$url = $frame->get_style()->list_style_image;
$frame->get_node()->setAttribute("src", $url);
$this->_img = new Image_Frame_Decorator($frame, $dompdf);
parent::__construct($this->_img, $dompdf);
list($width, $height) = getimagesize($this->_img->get_image_url());
// Resample the bullet image to be consistent with 'auto' sized images
$this->_width = (double) rtrim($width, "px") * 72 / DOMPDF_DPI;
$this->_height = (double) rtrim($height, "px") * 72 / DOMPDF_DPI;
}