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


PHP CSS::getDefaultValue方法代码示例

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


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

示例1: 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

示例2: parse

 function parse($value)
 {
     if ($value == 'inherit') {
         return CSS_PROPERTY_INHERIT;
     }
     // Remove spaces between color values in rgb() color definition; this will allow us to tread
     // this declaration as a single value
     $value = preg_replace("/\\s*,\\s*/", ",", $value);
     // Remove spaces before and after parens in rgb color definition
     $value = preg_replace("/rgb\\s*\\(\\s*(.*?)\\s*\\)/", 'rgb(\\1)', $value);
     $subvalues = explode(" ", $value);
     $border = CSS::getDefaultValue(CSS_BORDER);
     foreach ($subvalues as $subvalue) {
         $subvalue = trim(strtolower($subvalue));
         switch (CSSBorder::detect_border_value_type($subvalue)) {
             case BORDER_VALUE_COLOR:
                 $color_handler = CSS::get_handler(CSS_BORDER_COLOR);
                 $border_color = $color_handler->parse($subvalue);
                 $color_handler->setValue($border, $border_color);
                 break;
             case BORDER_VALUE_WIDTH:
                 $width_handler = CSS::get_handler(CSS_BORDER_WIDTH);
                 $border_width = $width_handler->parse($subvalue);
                 $width_handler->setValue($border, $border_width);
                 break;
             case BORDER_VALUE_STYLE:
                 $style_handler = CSS::get_handler(CSS_BORDER_STYLE);
                 $border_style = $style_handler->parse($subvalue);
                 $style_handler->setValue($border, $border_style);
                 break;
         }
     }
     return $border;
 }
开发者ID:dadigo,项目名称:simpleinvoices,代码行数:34,代码来源:css.border.inc.php

示例3: parse

 function parse($value)
 {
     $font = CSS::getDefaultValue(CSS_FONT);
     if ($value === 'inherit') {
         $font->style = CSS_PROPERTY_INHERIT;
         $font->weight = CSS_PROPERTY_INHERIT;
         $font->size = CSS_PROPERTY_INHERIT;
         $font->family = CSS_PROPERTY_INHERIT;
         $font->line_height = CSS_PROPERTY_INHERIT;
         return $font;
     }
     // according to CSS 2.1 standard,
     // value of 'font' CSS property can be represented as follows:
     //   [ <'font-style'> || <'font-variant'> || <'font-weight'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] |
     //   caption | icon | menu | message-box | small-caption | status-bar | inherit
     // Note that font-family value, unlike other values, can contain spaces (in this case it should be quoted)
     // Breaking value by spaces, we'll break such multi-word families.
     // Replace all white space sequences with only one space;
     // Remove spaces after commas; it will allow us
     // to split value correctly using look-backward expressions
     $value = preg_replace("/\\s+/", " ", $value);
     $value = preg_replace("/,\\s+/", ",", $value);
     $value = preg_replace("#\\s*/\\s*#", "/", $value);
     // Split value to subvalues by all whitespaces NOT preceeded by comma;
     // thus, we'll keep all alternative font-families together instead of breaking them.
     // Still we have a problem with multi-word family names.
     $subvalues = preg_split("/ /", $value);
     // Let's scan subvalues we've received and join values containing multiword family names
     $family_start = 0;
     $family_running = false;
     $family_double_quote = false;
     for ($i = 0, $num_subvalues = count($subvalues); $i < $num_subvalues; $i++) {
         $current_value = $subvalues[$i];
         if ($family_running) {
             $subvalues[$family_start] .= " " . $subvalues[$i];
             // Remove this subvalues from the subvalue list at all
             array_splice($subvalues, $i, 1);
             $num_subvalues--;
             $i--;
         }
         // Check if current subvalue contains beginning of multi-word family name
         // We can detect it by searching for single or double quote without pair
         if ($family_running && $family_double_quote && !preg_match('/^[^"]*("[^"]*")*[^"]*$/', $current_value)) {
             $family_running = false;
         } elseif ($family_running && !$family_double_quote && !preg_match("/^[^']*('[^']*')*[^']*\$/", $current_value)) {
             $family_running = false;
         } elseif (!$family_running && !preg_match("/^[^']*('[^']*')*[^']*\$/", $current_value)) {
             $family_running = true;
             $family_start = $i;
             $family_double_quote = false;
         } elseif (!$family_running && !preg_match('/^[^"]*("[^"]*")*[^"]*$/', $current_value)) {
             $family_running = true;
             $family_start = $i;
             $family_double_quote = true;
         }
     }
     // Now process subvalues one-by-one.
     foreach ($subvalues as $subvalue) {
         $subvalue = trim(strtolower($subvalue));
         $subvalue_type = detect_font_value_type($subvalue);
         switch ($subvalue_type) {
             case FONT_VALUE_STYLE:
                 $font->style = CSSFontStyle::parse($subvalue);
                 break;
             case FONT_VALUE_WEIGHT:
                 $font->weight = CSSFontWeight::parse($subvalue);
                 break;
             case FONT_VALUE_SIZE:
                 $size_subvalues = explode('/', $subvalue);
                 $font->size = CSSFontSize::parse($size_subvalues[0]);
                 if (isset($size_subvalues[1])) {
                     $handler =& CSS::get_handler(CSS_LINE_HEIGHT);
                     $font->line_height = $handler->parse($size_subvalues[1]);
                 }
                 break;
             case FONT_VALUE_FAMILY:
                 $font->family = CSSFontFamily::parse($subvalue);
                 break;
         }
     }
     return $font;
 }
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:82,代码来源:css.font.inc.php


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