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


PHP HtmlDumper::__construct方法代码示例

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


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

示例1: __construct

 /**
  * {@inheritdoc}
  */
 public function __construct($output = null, $charset = null)
 {
     $this->styles['default'] = str_replace('font:12px Menlo', "font:11px 'Source Code Pro', Menlo", $this->styles['default']);
     $this->styles['ctrl'] = 'color:#999';
     $this->dumpPrefix .= '<a class="sf-close sf-dump-index">×</a>';
     $header = $this->getDumpHeader();
     // max depth function
     $header = str_replace('function toggle(a, recursive) {', "function getLevel(elt) {\n" . "    var exit = false, level = 0, element = elt;\n" . "\n" . "    if (element.parentNode.className == 'sf-dump') {\n" . "        return 0;\n" . "    }\n" . "\n" . "    while(exit == false) {\n" . "        element = element.parentNode;\n" . "        level++;\n" . "        exit = !element.parentNode || element.parentNode.className == 'sf-dump';\n" . "    }\n" . "    return level;\n" . "}\n" . "\n" . 'function toggle(a, recursive) {', $header);
     // close button function
     $header = str_replace("var container = root;\n" . "addEventListener(root, 'mouseover', function (e) {", "addEventListener(container.querySelectorAll('.sf-close')[0], 'click', function(e) {\n" . "    e.target.parentNode.parentNode.removeChild(e.target.parentNode);\n" . "});\n" . "\n" . "addEventListener(document, 'selectionchange', function(e) {\n" . "    if (\n" . "        window.getSelection &&\n" . "        window.getSelection().toString() &&\n" . "        window.getSelection().anchorNode.parentNode.className.indexOf('sf-dump') >= 0\n" . "    ) {\n" . "        var ctrl = container.querySelectorAll('.sf-dump-ctrl');\n" . "        ctrl.forEach(function(node)\n" . "        {\n" . "           node.style.display = 'none';\n" . "        });\n" . "    }\n" . "}, false);\n" . "\n" . "addEventListener(root, 'mouseover', function (e) {", $header);
     // close button style
     $header = str_replace('pre.sf-dump span {', "pre.sf-dump a.sf-close {\n" . "    font-size:22px;\n" . "    position:absolute;\n" . "    right: 10px;\n" . "};\n" . "\n" . 'pre.sf-dump span {', $header);
     $expandLevel = DI::config()->getIfExists('varDumper/expandLevel');
     if (is_null($expandLevel)) {
         $expandLevel = 4;
     }
     $header = preg_replace("/if \\('sf-dump' != elt.parentNode.className\\) \\{.*\\}/mU", $expandLevel == false ? '' : 'if (getLevel(elt) > ' . $expandLevel . ') {toggle(a);}', $header, -1, $count);
     $this->setDumpHeader($header);
     $this->originalDumpPrefix = $this->dumpPrefix;
     parent::__construct($output, $charset);
 }
开发者ID:cawaphp,项目名称:cawa,代码行数:24,代码来源:HtmlDumper.php


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