当前位置: 首页>>代码示例>>PHP>>正文


PHP Value::fromData方法代码示例

本文整理汇总了PHP中Value::fromData方法的典型用法代码示例。如果您正苦于以下问题:PHP Value::fromData方法的具体用法?PHP Value::fromData怎么用?PHP Value::fromData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Value的用法示例。


在下文中一共展示了Value::fromData方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: parse

 function parse($value)
 {
     if ($value == 'inherit') {
         return CSS_PROPERTY_INHERIT;
     }
     $value = trim(strtolower($value));
     switch (strtolower($value)) {
         case "xx-small":
             return Value::fromData(BASE_FONT_SIZE_PT * 3 / 5, UNIT_PT);
         case "x-small":
             return Value::fromData(BASE_FONT_SIZE_PT * 3 / 4, UNIT_PT);
         case "small":
             return Value::fromData(BASE_FONT_SIZE_PT * 8 / 9, UNIT_PT);
         case "medium":
             return Value::fromData(BASE_FONT_SIZE_PT, UNIT_PT);
         case "large":
             return Value::fromData(BASE_FONT_SIZE_PT * 6 / 5, UNIT_PT);
         case "x-large":
             return Value::fromData(BASE_FONT_SIZE_PT * 3 / 2, UNIT_PT);
         case "xx-large":
             return Value::fromData(BASE_FONT_SIZE_PT * 2 / 1, UNIT_PT);
     }
     switch (strtolower($value)) {
         case "larger":
             return Value::fromData(1.2, UNIT_EM);
         case "smaller":
             return Value::fromData(0.83, UNIT_EM);
             // 0.83 = 1/1.2
     }
     if (preg_match("/(\\d+\\.?\\d*)%/i", $value, $matches)) {
         return Value::fromData($matches[1] / 100, UNIT_EM);
     }
     return Value::fromString($value);
 }
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:34,代码来源:css.font-size.inc.php

示例2: BoxNoteCall

 function BoxNoteCall(&$content, &$pipeline)
 {
     $this->GenericInlineBox();
     $this->_note_content =& $content;
     $this->copy_style($content);
     $this->put_height_constraint(new HCConstraint(null, null, null));
     /**
      * Prepare ::note-call box
      */
     $this->_note_call_box = InlineBox::create_from_text(CSSListStyleType::format_number(LST_DECIMAL, 99), WHITESPACE_NORMAL, $pipeline);
     $this->_note_call_box->copy_style($content);
     $this->_note_call_box->content[0]->copy_style($content);
     $font = $this->_note_call_box->content[0]->getCSSProperty(CSS_FONT);
     $font = $font->copy();
     $font->size->scale(0.75);
     $this->_note_call_box->content[0]->setCSSProperty(CSS_FONT, $font);
     $this->_note_call_box->content[0]->setCSSProperty(CSS_VERTICAL_ALIGN, VA_SUPER);
     $this->_note_call_box->content[0]->setCSSProperty(CSS_LINE_HEIGHT, CSS::getDefaultValue(CSS_LINE_HEIGHT));
     /**
      * Prepare ::marker box
      */
     $this->_note_marker_box = InlineBox::create_from_text(CSSListStyleType::format_number(LST_DECIMAL, 99), WHITESPACE_NORMAL, $pipeline);
     $this->_note_marker_box->copy_style($content);
     $this->_note_marker_box->content[0]->copy_style($content);
     $font = $this->_note_marker_box->content[0]->getCSSProperty(CSS_FONT);
     $font = $font->copy();
     $font->size->scale(0.5);
     $this->_note_marker_box->content[0]->setCSSProperty(CSS_FONT, $font);
     $margin = $this->_note_marker_box->content[0]->getCSSProperty(CSS_MARGIN);
     $margin = $margin->copy();
     $margin->right = Value::fromData(FOOTNOTE_MARKER_MARGIN, UNIT_PT);
     $this->_note_marker_box->content[0]->setCSSProperty(CSS_MARGIN, $margin);
     $this->_note_marker_box->content[0]->setCSSProperty(CSS_VERTICAL_ALIGN, VA_SUPER);
     $this->_note_marker_box->content[0]->setCSSProperty(CSS_LINE_HEIGHT, CSS::getDefaultValue(CSS_LINE_HEIGHT));
 }
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:35,代码来源:box.note-call.class.php

示例3: EdgePDF

 /**
  * Optimization: width/color fields of this class
  * never modified partially, so we could use one shared object 
  * as a default value
  */
 function EdgePDF()
 {
     static $default_width = null;
     if (is_null($default_width)) {
         $default_width =& Value::fromData(0, UNIT_PT);
     }
     static $default_color = null;
     if (is_null($default_color)) {
         $default_color =& new Color(array(0, 0, 0), true);
     }
     $this->width =& $default_width;
     $this->color =& $default_color;
     $this->style = BS_NONE;
     $this->_isDefaultColor = true;
 }
开发者ID:dadigo,项目名称:simpleinvoices,代码行数:20,代码来源:value.border.edge.class.php

示例4: doInherit

 function doInherit(&$state)
 {
     if ($state->get_propertyDefaultFlag(CSS_FONT_SIZE)) {
         $this->size = Value::fromData(1, UNIT_EM);
     }
     if ($this->style === CSS_PROPERTY_INHERIT) {
         $this->style = $state->getInheritedProperty(CSS_FONT_STYLE);
     }
     if ($this->weight === CSS_PROPERTY_INHERIT) {
         $this->weight = $state->getInheritedProperty(CSS_FONT_WEIGHT);
     }
     if ($this->size === CSS_PROPERTY_INHERIT) {
         $size = $state->getInheritedProperty(CSS_FONT_SIZE);
         $this->size = $size->copy();
     }
     if ($this->family === CSS_PROPERTY_INHERIT) {
         $this->family = $state->getInheritedProperty(CSS_FONT_FAMILY);
     }
     if ($this->line_height === CSS_PROPERTY_INHERIT) {
         $this->line_height = $state->getInheritedProperty(CSS_LINE_HEIGHT);
     }
 }
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:22,代码来源:value.font.class.php

示例5: default_value

 function default_value()
 {
     return Value::fromData(1, UNIT_PX);
 }
开发者ID:dadigo,项目名称:simpleinvoices,代码行数:4,代码来源:css.pseudo.cellpadding.inc.php

示例6: count

 function &getInheritedProperty($code)
 {
     $handler =& CSS::get_handler($code);
     $size = count($this->_state);
     for ($i = 0; $i < $size; $i++) {
         $value =& $handler->get($this->_state[$i]);
         if ($value != CSS_PROPERTY_INHERIT) {
             return $value;
         }
         // Prevent taking  the font-size property; as,  according to CSS
         // standard,  'inherit'  should mean  calculated  value, we  use
         // '1em' instead,  forcing the script to  take parent calculated
         // value later
         if ($code == CSS_FONT_SIZE) {
             $value =& Value::fromData(1, UNIT_EM);
             return $value;
         }
     }
     $null = null;
     return $null;
 }
开发者ID:isantiago,项目名称:foswiki,代码行数:21,代码来源:css.state.class.php

示例7: InlineBox

 function &create(&$root, &$pipeline)
 {
     // Create contents of this inline box
     if ($root->node_type() == XML_TEXT_NODE) {
         $css_state =& $pipeline->getCurrentCSSState();
         return InlineBox::create_from_text($root->content, $css_state->getProperty(CSS_WHITE_SPACE), $pipeline);
     } else {
         $box =& new InlineBox();
         $css_state =& $pipeline->getCurrentCSSState();
         $box->readCSS($css_state);
         // Initialize content
         $child = $root->first_child();
         while ($child) {
             $child_box =& create_pdf_box($child, $pipeline);
             $box->add_child($child_box);
             $child = $child->next_sibling();
         }
         // Add fake whitespace box with zero size for the anchor spans
         // We need this, as "reflow" functions will automatically remove empty inline boxes from the
         // document tree
         //
         if ($box->is_null()) {
             $css_state->pushState();
             $css_state->setProperty(CSS_FONT_SIZE, Value::fromData(0.01, UNIT_PT));
             $whitespace = WhitespaceBox::create($pipeline);
             $whitespace->readCSS($css_state);
             $box->add_child($whitespace);
             $css_state->popState();
         }
     }
     return $box;
 }
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:32,代码来源:box.inline.php

示例8: WidthConstraint

 function WidthConstraint()
 {
     $this->_min_width = Value::fromData(0, UNIT_PT);
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:4,代码来源:width.constraint.php

示例9: attr_cellpadding_before

function attr_cellpadding_before(&$root, &$pipeline)
{
    $css_state =& $pipeline->get_current_css_state();
    $handler =& CSS::get_handler(CSS_HTML2PS_CELLPADDING);
    $handler->replace(Value::fromData((int) $root->get_attribute('cellpadding'), UNIT_PX), $css_state);
}
开发者ID:isantiago,项目名称:foswiki,代码行数:6,代码来源:html.attrs.inc.php

示例10: CSSBorderWidth

 function CSSBorderWidth(&$owner)
 {
     $this->CSSSubProperty($owner);
     $this->_defaultValue = new BorderWidth(Value::fromData(0, UNIT_PT), Value::fromData(0, UNIT_PT), Value::fromData(0, UNIT_PT), Value::fromData(0, UNIT_PT));
 }
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:5,代码来源:css.border.width.inc.php


注:本文中的Value::fromData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。