<?php // $Header: /cvsroot/html2ps/css.pseudo.cellpadding.inc.php,v 1.6 2006/09/07 18:38:14 Konstantin Exp $ class CSSCellPadding extends CSSPropertyHandler { function CSSCellPadding() { $this->CSSPropertyHandler(true, false); } function default_value() { return Value::fromData(1, UNIT_PX); } function parse($value) { return Value::fromString($value); } function getPropertyCode() { return CSS_HTML2PS_CELLPADDING; } function getPropertyName() { return '-html2ps-cellpadding'; } } CSS::register_css_property(new CSSCellPadding());
{ $parent_display = $old_state[CSS_DISPLAY]; if ($parent_display === "table-row") { $new_state[CSS_MIN_HEIGHT] = $old_state[CSS_MIN_HEIGHT]; return; } $new_state[CSS_MIN_HEIGHT] = is_inline_element($parent_display) ? $this->get($old_state) : $this->default_value(); } function _getAutoValue() { return $this->default_value(); } function default_value() { return $this->_defaultValue->copy(); } function parse($value) { return ValueMinHeight::fromString($value); } function getPropertyCode() { return CSS_MIN_HEIGHT; } function getPropertyName() { return 'min-height'; } } CSS::register_css_property(new CSSMinHeight());
<?php // $Header: /cvsroot/html2ps/css.direction.inc.php,v 1.7 2006/07/09 09:07:44 Konstantin Exp $ define('DIRECTION_LTR', 1); define('DIRECTION_RTF', 1); class CSSDirection extends CSSPropertyStringSet { function CSSDirection() { $this->CSSPropertyStringSet(true, true, array('lrt' => DIRECTION_LTR, 'rtl' => DIRECTION_RTF)); } function default_value() { return DIRECTION_LTR; } function get_property_code() { return CSS_DIRECTION; } function get_property_name() { return 'direction'; } } CSS::register_css_property(new CSSDirection());
function CSSLetterSpacing() { $this->CSSPropertyHandler(false, true); $this->_default_value = Value::fromString("0"); } function default_value() { return $this->_default_value; } function parse($value) { $value = trim($value); if ($value === 'inherit') { return CSS_PROPERTY_INHERIT; } if ($value === 'normal') { return $this->_default_value; } return Value::fromString($value); } function getPropertyCode() { return CSS_LETTER_SPACING; } function getPropertyName() { return 'letter-spacing'; } } CSS::register_css_property(new CSSLetterSpacing());
<?php // $Header: /cvsroot/html2ps/css.html2ps.pseudoelements.inc.php,v 1.1 2006/09/07 18:38:14 Konstantin Exp $ define('CSS_HTML2PS_PSEUDOELEMENTS_NONE', 0); define('CSS_HTML2PS_PSEUDOELEMENTS_BEFORE', 1); define('CSS_HTML2PS_PSEUDOELEMENTS_AFTER', 2); class CSSHTML2PSPseudoelements extends CSSPropertyHandler { function CSSHTML2PSPseudoelements() { $this->CSSPropertyHandler(false, false); } function default_value() { return CSS_HTML2PS_PSEUDOELEMENTS_NONE; } function parse($value) { return $value; } function getPropertyCode() { return CSS_HTML2PS_PSEUDOELEMENTS; } function getPropertyName() { return '-html2ps-pseudoelements'; } } CSS::register_css_property(new CSSHTML2PSPseudoelements());
<?php // $Header: /cvsroot/html2ps/css.color.inc.php,v 1.13 2007/01/24 18:55:51 Konstantin Exp $ class CSSColor extends CSSPropertyHandler { function CSSColor() { $this->CSSPropertyHandler(true, true); } function default_value() { return new Color(array(0, 0, 0), false); } function parse($value) { if ($value === 'inherit') { return CSS_PROPERTY_INHERIT; } return parse_color_declaration($value); } function get_property_code() { return CSS_COLOR; } function get_property_name() { return 'color'; } } CSS::register_css_property(new CSSColor());
if (preg_match("/\\b(thin|medium|thick|[+-]?\\d+(.\\d*)?(em|ex|px|in|cm|mm|pt|pc)?)\\b/i", $value)) { return BORDER_VALUE_WIDTH; } if (preg_match("/\\b(none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset)\\b/", $value)) { return BORDER_VALUE_STYLE; } return; } } $border = new CSSBorder(); CSS::register_css_property($border); CSS::register_css_property(new CSSBorderColor($border)); CSS::register_css_property(new CSSBorderWidth($border)); CSS::register_css_property(new CSSBorderStyle($border)); CSS::register_css_property(new CSSBorderTop($border, 'top')); CSS::register_css_property(new CSSBorderRight($border, 'right')); CSS::register_css_property(new CSSBorderBottom($border, 'bottom')); CSS::register_css_property(new CSSBorderLeft($border, 'left')); CSS::register_css_property(new CSSBorderLeftColor($border)); CSS::register_css_property(new CSSBorderTopColor($border)); CSS::register_css_property(new CSSBorderRightColor($border)); CSS::register_css_property(new CSSBorderBottomColor($border)); CSS::register_css_property(new CSSBorderLeftStyle($border)); CSS::register_css_property(new CSSBorderTopStyle($border)); CSS::register_css_property(new CSSBorderRightStyle($border)); CSS::register_css_property(new CSSBorderBottomStyle($border)); CSS::register_css_property(new CSSBorderLeftWidth($border)); CSS::register_css_property(new CSSBorderTopWidth($border)); CSS::register_css_property(new CSSBorderRightWidth($border)); CSS::register_css_property(new CSSBorderBottomWidth($border));
} function getPropertyName() { return 'margin-left'; } } class CSSMarginBottom extends CSSSubFieldProperty { function parse($value) { if ($value === 'inherit') { return CSS_PROPERTY_INHERIT; } return MarginSideValue::init($value); } function getPropertyCode() { return CSS_MARGIN_BOTTOM; } function getPropertyName() { return 'margin-bottom'; } } $mh = new CSSMargin(); CSS::register_css_property($mh); CSS::register_css_property(new CSSMarginLeft($mh, 'left')); CSS::register_css_property(new CSSMarginRight($mh, 'right')); CSS::register_css_property(new CSSMarginTop($mh, 'top')); CSS::register_css_property(new CSSMarginBottom($mh, 'bottom'));
*/ class CSSBottom extends CSSPropertyHandler { function CSSBottom() { $this->CSSPropertyHandler(false, false); $this->_autoValue = ValueBottom::fromString('auto'); } function _getAutoValue() { return $this->_autoValue->copy(); } function default_value() { return $this->_getAutoValue(); } function getPropertyCode() { return CSS_BOTTOM; } function getPropertyName() { return 'bottom'; } function parse($value) { return ValueBottom::fromString($value); } } CSS::register_css_property(new CSSBottom());
{ function CSSTextIndent() { $this->CSSPropertyHandler(true, true); } function default_value() { return new TextIndentValuePDF(array(0, false)); } function parse($value) { if ($value === 'inherit') { return CSS_PROPERTY_INHERIT; } if (is_percentage($value)) { return new TextIndentValuePDF(array((int) $value, true)); } else { return new TextIndentValuePDF(array($value, false)); } } function getPropertyCode() { return CSS_TEXT_INDENT; } function getPropertyName() { return 'text-indent'; } } CSS::register_css_property(new CSSTextIndent());
<?php // $Header: /cvsroot/html2ps/css.float.inc.php,v 1.7 2006/07/09 09:07:44 Konstantin Exp $ define('FLOAT_NONE', 0); define('FLOAT_LEFT', 1); define('FLOAT_RIGHT', 2); class CSSFloat extends CSSPropertyStringSet { function CSSFloat() { $this->CSSPropertyStringSet(false, false, array('left' => FLOAT_LEFT, 'right' => FLOAT_RIGHT, 'none' => FLOAT_NONE)); } function default_value() { return FLOAT_NONE; } function get_property_code() { return CSS_FLOAT; } function get_property_name() { return 'float'; } } CSS::register_css_property(new CSSFloat());
} function default_value() { return TA_LEFT; } function value2pdf($value) { switch ($value) { case TA_LEFT: return "ta_left"; case TA_RIGHT: return "ta_right"; case TA_CENTER: return "ta_center"; case TA_JUSTIFY: return "ta_justify"; default: return "ta_left"; } } function get_property_code() { return CSS_TEXT_ALIGN; } function get_property_name() { return 'text-align'; } } CSS::register_css_property(new CSSTextAlign());
<?php class CSSZIndex extends CSSPropertyHandler { function CSSZIndex() { $this->CSSPropertyHandler(false, false); } function default_value() { return 0; } function parse($value) { if ($value === 'inherit') { return CSS_PROPERTY_INHERIT; } return (int) $value; } function get_property_code() { return CSS_Z_INDEX; } function get_property_name() { return 'z-index'; } } CSS::register_css_property(new CSSZIndex());
function CSSWordSpacing() { $this->CSSPropertyHandler(false, true); $this->_default_value = Value::fromString("0"); } function default_value() { return $this->_default_value; } function parse($value) { $value = trim($value); if ($value === 'inherit') { return CSS_PROPERTY_INHERIT; } if ($value === 'normal') { return $this->_default_value; } return Value::fromString($value); } function getPropertyCode() { return CSS_WORD_SPACING; } function getPropertyName() { return 'word-spacing'; } } CSS::register_css_property(new CSSWordSpacing());
<?php // $Header: /cvsroot/html2ps/css.color.inc.php,v 1.13 2007/01/24 18:55:51 Konstantin Exp $ class CSSPage extends CSSPropertyHandler { function CSSPage() { $this->CSSPropertyHandler(true, true); } function default_value() { return 'auto'; } function parse($value) { return $value; } function getPropertyCode() { return CSS_PAGE; } function getPropertyName() { return 'page'; } } CSS::register_css_property(new CSSPage());
<?php // $Header: /cvsroot/html2ps/css.page-break-after.inc.php,v 1.3 2007/01/09 20:13:48 Konstantin Exp $ class CSSPageBreakAfter extends CSSPageBreak { function get_property_code() { return CSS_PAGE_BREAK_AFTER; } function get_property_name() { return 'page-break-after'; } } CSS::register_css_property(new CSSPageBreakAfter());
if (preg_match('/^(\\w+)(?:\\s+(portrait|landscape))?$/', $value, $matches)) { $name = $matches[1]; $landscape = isset($matches[2]) && $matches[2] == 'landscape'; $media =& Media::predefined($name); if (is_null($media)) { return null; } return array('size' => array('width' => $media->get_width(), 'height' => $media->get_height()), 'landscape' => $landscape); } // Second, attempt to create media with predefined size $parts = preg_split('/\\s+/', $value); $width_str = $parts[0]; $height_str = isset($parts[1]) ? $parts[1] : $parts[0]; $width = units2pt($width_str); $height = units2pt($height_str); if ($width == 0 || $height == 0) { return null; } return array('size' => array('width' => $width / mm2pt(1) / pt2pt(1), 'height' => $height / mm2pt(1) / pt2pt(1)), 'landscape' => false); } function getPropertyCode() { return CSS_SIZE; } function getPropertyName() { return 'size'; } } CSS::register_css_property(new CSSSize());
} function get_parent() { if (isset($this->_stack[1])) { return $this->_stack[1][0]; } else { return 'block'; } } function default_value() { return "inline"; } function getPropertyCode() { return CSS_DISPLAY; } function getPropertyName() { return 'display'; } function parse($value) { return trim(strtolower($value)); } } CSS::register_css_property(new CSSDisplay()); function is_inline_element($display) { return $display == "inline" || $display == "inline-table" || $display == "compact" || $display == "run-in" || $display == "-button" || $display == "-checkbox" || $display == "-iframe" || $display == "-image" || $display == "inline-block" || $display == "-radio" || $display == "-select"; }
<?php class CSSPseudoFormRadioGroup extends CSSPropertyHandler { function CSSPseudoFormRadioGroup() { $this->CSSPropertyHandler(true, true); } function default_value() { return null; } function parse($value) { return $value; } function getPropertyCode() { return CSS_HTML2PS_FORM_RADIOGROUP; } function getPropertyName() { return '-html2ps-form-radiogroup'; } } CSS::register_css_property(new CSSPseudoFormRadioGroup());
} // Check if user specified empty value if ($value === '') { return new WCNone(); } // Check if this value is 'auto' - default value of this property if ($value === 'auto') { return new WCNone(); } if (substr($value, strlen($value) - 1, 1) == '%') { // Percentage return new WCFraction((double) $value / 100); } else { // Constant return new WCConstant(trim($value)); } } function get_property_code() { return CSS_WIDTH; } function get_property_name() { return 'width'; } } $width = new CSSCompositeWidth(); CSS::register_css_property($width); CSS::register_css_property(new CSSWidth($width)); CSS::register_css_property(new CSSMinWidth($width, '_min_width'));
<?php class CSSHTML2PSPixels extends CSSPropertyHandler { function CSSHTML2PSPixels() { $this->CSSPropertyHandler(false, false); } function &default_value() { $value = 800; return $value; } function &parse($value) { $value_data = (int) $value; return $value_data; } function get_property_code() { return CSS_HTML2PS_PIXELS; } function get_property_name() { return '-html2ps-pixels'; } } CSS::register_css_property(new CSSHTML2PSPixels());
<?php // $Header: /cvsroot/html2ps/css.overflow.inc.php,v 1.8 2006/09/07 18:38:14 Konstantin Exp $ define('OVERFLOW_VISIBLE', 0); define('OVERFLOW_HIDDEN', 1); class CSSOverflow extends CSSPropertyStringSet { function CSSOverflow() { $this->CSSPropertyStringSet(false, false, array('inherit' => CSS_PROPERTY_INHERIT, 'hidden' => OVERFLOW_HIDDEN, 'scroll' => OVERFLOW_HIDDEN, 'auto' => OVERFLOW_HIDDEN, 'visible' => OVERFLOW_VISIBLE)); } function default_value() { return OVERFLOW_VISIBLE; } function get_property_code() { return CSS_OVERFLOW; } function get_property_name() { return 'overflow'; } } CSS::register_css_property(new CSSOverflow());
<?php // $Header: /cvsroot/html2ps/css.pseudo.listcounter.inc.php,v 1.4 2006/09/07 18:38:14 Konstantin Exp $ class CSSPseudoListCounter extends CSSPropertyHandler { function CSSPseudoListCounter() { $this->CSSPropertyHandler(true, false); } function default_value() { return 0; } function getPropertyCode() { return CSS_HTML2PS_LIST_COUNTER; } function getPropertyName() { return '-html2ps-list-counter'; } function parse($value) { return (int) $value; } } CSS::register_css_property(new CSSPseudoListCounter());
<?php // $Header: /var/cvs/arsgate/client_cpanel/include/html2pdf/css.pseudo.localalign.inc.php,v 1.2 2008-06-08 18:29:03 cvs Exp $ define('LA_LEFT', 0); define('LA_CENTER', 1); define('LA_RIGHT', 2); class CSSLocalAlign extends CSSPropertyHandler { function CSSLocalAlign() { $this->CSSPropertyHandler(false, false); } function default_value() { return LA_LEFT; } function parse($value) { return $value; } function getPropertyCode() { return CSS_HTML2PS_LOCALALIGN; } function getPropertyName() { return '-html2ps-localalign'; } } CSS::register_css_property(new CSSLocalAlign());
<?php // $Header: /cvsroot/html2ps/css.page-break-before.inc.php,v 1.1.2.1 2006/11/16 03:19:36 Konstantin Exp $ class CSSPageBreakBefore extends CSSPageBreak { function get_property_code() { return CSS_PAGE_BREAK_BEFORE; } function get_property_name() { return 'page-break-before'; } } CSS::register_css_property(new CSSPageBreakBefore());
{ return strlen($value) > 0 && $value[0] != "#"; } function is_local_link($value) { return strlen($value) > 0 && $value[0] == "#"; } function parse($value, &$pipeline) { // Keep local links (starting with sharp sign) as-is if (CSSPseudoLinkTarget::is_local_link($value)) { return $value; } $data = @parse_url($value); if (!isset($data['scheme']) || $data['scheme'] == "" || $data['scheme'] == "http") { return $pipeline->guess_url($value); } else { return $value; } } function getPropertyCode() { return CSS_HTML2PS_LINK_TARGET; } function getPropertyName() { return '-html2ps-link-target'; } } CSS::register_css_property(new CSSPseudoLinkTarget());
} function get_property_name() { return 'padding-left'; } } class CSSPaddingBottom extends CSSSubFieldProperty { function parse($value) { if ($value === 'inherit') { return CSS_PROPERTY_INHERIT; } return PaddingSideValue::init($value); } function get_property_code() { return CSS_PADDING_BOTTOM; } function get_property_name() { return 'padding-bottom'; } } $ph = new CSSPadding(); CSS::register_css_property($ph); CSS::register_css_property(new CSSPaddingLeft($ph, 'left')); CSS::register_css_property(new CSSPaddingRight($ph, 'right')); CSS::register_css_property(new CSSPaddingTop($ph, 'top')); CSS::register_css_property(new CSSPaddingBottom($ph, 'bottom'));
require_once HTML2PS_DIR . 'value.top.php'; class CSSTop extends CSSPropertyHandler { function CSSTop() { $this->CSSPropertyHandler(false, false); $this->_autoValue = ValueTop::fromString('auto'); } function _getAutoValue() { return $this->_autoValue->copy(); } function default_value() { return $this->_getAutoValue(); } function getPropertyCode() { return CSS_TOP; } function getPropertyName() { return 'top'; } function parse($value) { return ValueTop::fromString($value); } } CSS::register_css_property(new CSSTop());
<?php class CSSOrphans extends CSSPropertyHandler { function CSSOrphans() { $this->CSSPropertyHandler(true, false); } function default_value() { return 2; } function parse($value) { return (int) $value; } function getPropertyCode() { return CSS_ORPHANS; } function getPropertyName() { return 'orphans'; } } CSS::register_css_property(new CSSOrphans());
<?php class CSSPseudoLinkDestination extends CSSPropertyHandler { function CSSPseudoLinkDestination() { $this->CSSPropertyHandler(false, false); } function default_value() { return null; } function parse($value) { return $value; } function getPropertyCode() { return CSS_HTML2PS_LINK_DESTINATION; } function getPropertyName() { return '-html2ps-link-destination'; } } CSS::register_css_property(new CSSPseudoLinkDestination());