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


PHP TCPDF_STATIC::getTagStyleFromCSSarray方法代码示例

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


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

示例1: getHtmlDomArray


//.........这里部分代码省略.........
                 // copy some values from parent
                 $parentkey = 0;
                 if ($key > 0) {
                     $parentkey = $dom[$key]['parent'];
                     $dom[$key]['hide'] = $dom[$parentkey]['hide'];
                     $dom[$key]['fontname'] = $dom[$parentkey]['fontname'];
                     $dom[$key]['fontstyle'] = $dom[$parentkey]['fontstyle'];
                     $dom[$key]['fontsize'] = $dom[$parentkey]['fontsize'];
                     $dom[$key]['font-stretch'] = $dom[$parentkey]['font-stretch'];
                     $dom[$key]['letter-spacing'] = $dom[$parentkey]['letter-spacing'];
                     $dom[$key]['stroke'] = $dom[$parentkey]['stroke'];
                     $dom[$key]['fill'] = $dom[$parentkey]['fill'];
                     $dom[$key]['clip'] = $dom[$parentkey]['clip'];
                     $dom[$key]['line-height'] = $dom[$parentkey]['line-height'];
                     $dom[$key]['bgcolor'] = $dom[$parentkey]['bgcolor'];
                     $dom[$key]['fgcolor'] = $dom[$parentkey]['fgcolor'];
                     $dom[$key]['strokecolor'] = $dom[$parentkey]['strokecolor'];
                     $dom[$key]['align'] = $dom[$parentkey]['align'];
                     $dom[$key]['listtype'] = $dom[$parentkey]['listtype'];
                     $dom[$key]['text-indent'] = $dom[$parentkey]['text-indent'];
                     $dom[$key]['border'] = array();
                     $dom[$key]['dir'] = $dom[$parentkey]['dir'];
                 }
                 // get attributes
                 preg_match_all('/([^=\\s]*)[\\s]*=[\\s]*"([^"]*)"/', $element, $attr_array, PREG_PATTERN_ORDER);
                 $dom[$key]['attribute'] = array();
                 // reset attribute array
                 while (list($id, $name) = each($attr_array[1])) {
                     $dom[$key]['attribute'][strtolower($name)] = $attr_array[2][$id];
                 }
                 if (!empty($css)) {
                     // merge CSS style to current style
                     list($dom[$key]['csssel'], $dom[$key]['cssdata']) = TCPDF_STATIC::getCSSdataArray($dom, $key, $css);
                     $dom[$key]['attribute']['style'] = TCPDF_STATIC::getTagStyleFromCSSarray($dom[$key]['cssdata']);
                 }
                 // split style attributes
                 if (isset($dom[$key]['attribute']['style']) and !empty($dom[$key]['attribute']['style'])) {
                     // get style attributes
                     preg_match_all('/([^;:\\s]*):([^;]*)/', $dom[$key]['attribute']['style'], $style_array, PREG_PATTERN_ORDER);
                     $dom[$key]['style'] = array();
                     // reset style attribute array
                     while (list($id, $name) = each($style_array[1])) {
                         // in case of duplicate attribute the last replace the previous
                         $dom[$key]['style'][strtolower($name)] = trim($style_array[2][$id]);
                     }
                     // --- get some style attributes ---
                     // text direction
                     if (isset($dom[$key]['style']['direction'])) {
                         $dom[$key]['dir'] = $dom[$key]['style']['direction'];
                     }
                     // display
                     if (isset($dom[$key]['style']['display'])) {
                         $dom[$key]['hide'] = trim(strtolower($dom[$key]['style']['display'])) == 'none';
                     }
                     // font family
                     if (isset($dom[$key]['style']['font-family'])) {
                         $dom[$key]['fontname'] = $this->getFontFamilyName($dom[$key]['style']['font-family']);
                     }
                     // list-style-type
                     if (isset($dom[$key]['style']['list-style-type'])) {
                         $dom[$key]['listtype'] = trim(strtolower($dom[$key]['style']['list-style-type']));
                         if ($dom[$key]['listtype'] == 'inherit') {
                             $dom[$key]['listtype'] = $dom[$parentkey]['listtype'];
                         }
                     }
                     // text-indent
开发者ID:TheTypoMaster,项目名称:myapps,代码行数:67,代码来源:tcpdf.php


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