• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP twig_jsonencode_filter函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中twig_jsonencode_filter函数的典型用法代码示例。如果您正苦于以下问题:PHP twig_jsonencode_filter函数的具体用法?PHP twig_jsonencode_filter怎么用?PHP twig_jsonencode_filter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: block_ewz_recaptcha_widget

 public function block_ewz_recaptcha_widget($context, array $blocks = array())
 {
     // line 2
     ob_start();
     // line 3
     echo "    ";
     if ($this->getAttribute($this->getAttribute(isset($context["form"]) ? $context["form"] : $this->getContext($context, "form"), "vars", array()), "ewz_recaptcha_enabled", array())) {
         // line 4
         echo "        ";
         if ($this->getAttribute(isset($context["attr"]) ? $context["attr"] : null, "options", array(), "any", true, true)) {
             // line 5
             echo "            <script type=\"text/javascript\">\n                var RecaptchaOptions = ";
             // line 6
             echo twig_jsonencode_filter($this->getAttribute(isset($context["attr"]) ? $context["attr"] : $this->getContext($context, "attr"), "options", array()));
             echo "\n            </script>\n        ";
         }
         // line 9
         echo "        <script src=\"";
         echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute(isset($context["form"]) ? $context["form"] : $this->getContext($context, "form"), "vars", array()), "url_challenge", array()), "html", null, true);
         echo "\" type=\"text/javascript\"></script>\n        <noscript>\n            <iframe src=\"";
         // line 11
         echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute(isset($context["form"]) ? $context["form"] : $this->getContext($context, "form"), "vars", array()), "url_noscript", array()), "html", null, true);
         echo "\" height=\"300\" width=\"500\"></iframe><br/>\n            <textarea name=\"recaptcha_challenge_field\" rows=\"3\" cols=\"40\"></textarea>\n            <input type=\"hidden\" name=\"recaptcha_response_field\" value=\"manual_challenge\"/>\n        </noscript>\n    ";
     }
     echo trim(preg_replace('/>\\s+</', '><', ob_get_clean()));
 }
开发者ID:austinpapp,项目名称:push-notifications-temp,代码行数:26,代码来源:19fdd47b0d809aa6fb898b1fb07423d3dce7108a96ef2504178e9f188a94.php


示例2: doDisplay

 protected function doDisplay(array $context, array $blocks = array())
 {
     $context = array_merge($this->env->getGlobals(), $context);
     // line 1
     echo twig_jsonencode_filter(array("error" => array("code" => $this->getContext($context, 'status_code'), "message" => $this->getContext($context, 'status_text'))));
     echo "\n";
 }
开发者ID:roninvn,项目名称:MeetingApp,代码行数:7,代码来源:985a3ecc475332a25f2da56490e6.php


示例3: doDisplay

 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 2
     echo "\n";
     // line 3
     $context["option"] = array("class" => $this->getAttribute(isset($context["field"]) ? $context["field"] : null, "class", array(), "any", true, true) ? _twig_default_filter($this->getAttribute(isset($context["field"]) ? $context["field"] : null, "class", array()), "") : "", "height" => $this->getAttribute(isset($context["field"]) ? $context["field"] : null, "height", array(), "any", true, true) ? _twig_default_filter($this->getAttribute(isset($context["field"]) ? $context["field"] : null, "height", array()), "300px") : "300px", "label" => $this->getAttribute(isset($context["field"]) ? $context["field"] : null, "label", array(), "any", true, true) ? _twig_default_filter($this->getAttribute(isset($context["field"]) ? $context["field"] : null, "label", array()), "") : "", "required" => $this->getAttribute(isset($context["field"]) ? $context["field"] : null, "required", array(), "any", true, true) ? _twig_default_filter($this->getAttribute(isset($context["field"]) ? $context["field"] : null, "required", array()), false) : false, "errortext" => $this->getAttribute(isset($context["field"]) ? $context["field"] : null, "error", array(), "any", true, true) ? _twig_default_filter($this->getAttribute(isset($context["field"]) ? $context["field"] : null, "error", array()), "") : "", "info" => $this->getAttribute(isset($context["field"]) ? $context["field"] : null, "info", array(), "any", true, true) ? _twig_default_filter($this->getAttribute(isset($context["field"]) ? $context["field"] : null, "info", array()), "info.markdown") : "info.markdown");
     // line 11
     echo "\n";
     // line 13
     echo "\n";
     // line 14
     $context["ukkit_conf"] = array("height" => $this->getAttribute(isset($context["option"]) ? $context["option"] : null, "height", array()), "lblMarkedview" => $this->env->getExtension('Bolt')->trans("field.markdown.label.markedview"), "lblPreview" => $this->env->getExtension('Bolt')->trans("field.markdown.label.preview"), "markdown" => true, "markedOptions" => array("breaks" => false), "toolbar" => array(0 => "bold", 1 => "italic", 2 => "link", 3 => "image", 4 => "blockquote", 5 => "listUl", 6 => "listOl"));
     // line 24
     echo "\n";
     // line 25
     $context["attr_text"] = array("class" => $this->getAttribute(isset($context["option"]) ? $context["option"] : null, "class", array()), "data_errortext" => $this->getAttribute(isset($context["option"]) ? $context["option"] : null, "errortext", array()), "data_uk_htmleditor" => twig_jsonencode_filter(isset($context["ukkit_conf"]) ? $context["ukkit_conf"] : null), "id" => isset($context["key"]) ? $context["key"] : null, "name" => isset($context["name"]) ? $context["name"] : null, "required" => $this->getAttribute(isset($context["option"]) ? $context["option"] : null, "required", array()), "style" => $this->getAttribute(isset($context["option"]) ? $context["option"] : null, "height", array()) ? "height: " . $this->getAttribute(isset($context["option"]) ? $context["option"] : null, "height", array()) . " !important;" : "");
     // line 34
     echo "\n";
     // line 36
     echo "\n<fieldset class=\"markdown\">\n    <div class=\"col-sm-12\">\n        <label class=\"control-label\">";
     // line 39
     echo twig_escape_filter($this->env, $this->getAttribute(isset($context["macro"]) ? $context["macro"] : null, "infopop", array(0 => isset($context["labelkey"]) ? $context["labelkey"] : null, 1 => $this->getAttribute(isset($context["option"]) ? $context["option"] : null, "info", array())), "method"), "html", null, true);
     echo "</label>\n        <textarea";
     // line 40
     echo twig_escape_filter($this->env, $this->getAttribute(isset($context["macro"]) ? $context["macro"] : null, "attr", array(0 => isset($context["attr_text"]) ? $context["attr_text"] : null), "method"), "html", null, true);
     echo ">";
     echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute(isset($context["context"]) ? $context["context"] : null, "content", array(), "any", false, true), "get", array(0 => isset($context["contentkey"]) ? $context["contentkey"] : null), "method", true, true) ? _twig_default_filter($this->getAttribute($this->getAttribute(isset($context["context"]) ? $context["context"] : null, "content", array(), "any", false, true), "get", array(0 => isset($context["contentkey"]) ? $context["contentkey"] : null), "method"), "") : "", "html", null, true);
     echo "</textarea>\n    </div>\n</fieldset>\n";
 }
开发者ID:bearlikelion,项目名称:im,代码行数:29,代码来源:2fe003b6f55a097af536970e205d84f565ac75ac927277acd19d611d17b4404c.php


示例4: jsonEncodeFilter

 /**
  * This method will JSON encode a variable. We're overriding Twig's default implementation to set some stricter
  * encoding options on text/html/xml requests.
  *
  * @param mixed    $value   The value to JSON encode.
  * @param null|int $options Either null or a bitmask consisting of JSON_HEX_QUOT, JSON_HEX_TAG, JSON_HEX_AMP,
  *                          JSON_HEX_APOS, JSON_NUMERIC_CHECK, JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES,
  *                          JSON_FORCE_OBJECT
  *
  * @return mixed The JSON encoded value.
  */
 public function jsonEncodeFilter($value, $options = null)
 {
     if ($options === null && in_array(HeaderHelper::getMimeType(), array('text/html', 'application/xhtml+xml'))) {
         $options = JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_QUOT;
     }
     return twig_jsonencode_filter($value, $options);
 }
开发者ID:scisahaha,项目名称:generator-craft,代码行数:18,代码来源:CraftTwigExtension.php


示例5: doDisplay

 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     echo "require({\n    shim: {\n        'oro/routes': {\n            deps: ['routing'],\n            init: function(routing) {\n                ";
     // line 6
     if (!$this->getAttribute(isset($context["app"]) ? $context["app"] : null, "debug", array())) {
         // line 7
         echo "                routing.setBaseUrl(";
         echo twig_jsonencode_filter(twig_slice($this->env, $this->env->getExtension('asset')->getAssetUrl(""), 0, -1));
         echo ");\n                ";
     }
     // line 9
     echo "                return routing;\n            }\n        }\n    },\n    map: {\n        '*': {\n            'routing': 'oro/routes'\n        },\n        'oro/routes': {\n            'routing': 'routing'\n        }\n    },\n    paths: {\n    ";
     // line 22
     if ($this->getAttribute(isset($context["app"]) ? $context["app"] : null, "debug", array())) {
         // line 23
         echo "        'oro/routes': '";
         echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath("fos_js_routing_js", array("callback" => "fos.Router.setData")), "js", null, true);
         echo "'\n    ";
     } else {
         // line 25
         echo "        'oro/routes': '../js/routes'\n    ";
     }
     // line 27
     echo "    }\n});\n";
 }
开发者ID:aml-bendall,项目名称:ExpandAkeneoApi,代码行数:26,代码来源:b121afe994067765632e6f476b2ce5a2e678886605c29d43715d0cb1ec7ed246.php


示例6: doDisplay

 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     echo "<div class=\"RealTimeMap\" style=\"position:relative; overflow:hidden;\"\n     data-standalone=\"";
     // line 2
     echo twig_escape_filter($this->env, array_key_exists("mapIsStandaloneNotWidget", $context) ? _twig_default_filter(isset($context["mapIsStandaloneNotWidget"]) ? $context["mapIsStandaloneNotWidget"] : $this->getContext($context, "mapIsStandaloneNotWidget"), 0) : 0, "html", null, true);
     echo "\"\n     data-config=\"";
     // line 3
     echo twig_escape_filter($this->env, twig_jsonencode_filter(isset($context["config"]) ? $context["config"] : $this->getContext($context, "config")), "html", null, true);
     echo "\"\n     tabindex=\"0\">\n\n    <div class=\"RealTimeMap_container\">\n        <div class=\"RealTimeMap_map\" style=\"overflow:hidden;\"></div>\n        <div class=\"realTimeMap_overlay\">\n            ";
     // line 9
     if ($this->getAttribute(isset($context["config"]) ? $context["config"] : null, "showFooterMessage", array(), "any", true, true) ? _twig_default_filter($this->getAttribute(isset($context["config"]) ? $context["config"] : null, "showFooterMessage", array()), true) : true) {
         // line 10
         echo "            <span class=\"showing_visits_of\" style=\"display:none;\">";
         echo twig_escape_filter($this->env, call_user_func_array($this->env->getFilter('translate')->getCallable(), array("UserCountryMap_ShowingVisits")), "html", null, true);
         echo "\n                <span class=\"realTimeMap_timeSpan\" style=\"font-weight:bold;\"></span>\n            </span>\n            ";
     }
     // line 14
     echo "            <span class=\"no_data\" style=\"display:none;\">";
     echo twig_escape_filter($this->env, call_user_func_array($this->env->getFilter('translate')->getCallable(), array("CoreHome_ThereIsNoDataForThisReport")), "html", null, true);
     echo "</span>\n            <span class=\"loading_data\">";
     // line 15
     echo twig_escape_filter($this->env, call_user_func_array($this->env->getFilter('translate')->getCallable(), array("General_LoadingData")), "html", null, true);
     echo "...</span>\n            <img src=\"plugins/UserCountryMap/images/realtimemap-loading.gif\" style=\"vertical-align:baseline;position:relative;left:-2px;\">\n        </div>\n        ";
     // line 18
     if ($this->getAttribute(isset($context["config"]) ? $context["config"] : null, "showDateTime", array(), "any", true, true) ? _twig_default_filter($this->getAttribute(isset($context["config"]) ? $context["config"] : null, "showDateTime", array()), true) : true) {
         // line 19
         echo "        <div class=\"realTimeMap_overlay realTimeMap_datetime\"></div>\n        ";
     }
     // line 21
     echo "    </div>\n    <div class=\"RealTimeMap_meta\">\n        <span class=\"loadingPiwik\">\n            <img src=\"plugins/Morpheus/images/loading-blue.gif\"> ";
     // line 24
     echo twig_escape_filter($this->env, call_user_func_array($this->env->getFilter('translate')->getCallable(), array("General_LoadingData")), "html", null, true);
     echo "...\n        </span>\n    </div>\n\n</div>\n<script type=\"text/javascript\">UserCountryMap.RealtimeMap.initElements();</script>";
 }
开发者ID:abhinay100,项目名称:piwikapp,代码行数:35,代码来源:fed742ed4e06b336e48834edec4fb912f82419ae92e84468d412006942aa02f2.php


示例7: doDisplay

 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     echo "<table ";
     if (array_key_exists("class", $context)) {
         echo "class='";
         echo twig_escape_filter($this->env, isset($context["class"]) ? $context["class"] : $this->getContext($context, "class"), "html", null, true);
         echo "'";
     }
     echo " >\n    <thead>\n        <tr>\n            <th scope=\"col\">Key</th>\n            <th scope=\"col\">Value</th>\n        </tr>\n    </thead>\n    <tbody>\n        ";
     // line 9
     $context['_parent'] = (array) $context;
     $context['_seq'] = twig_ensure_traversable(twig_sort_filter($this->getAttribute(isset($context["bag"]) ? $context["bag"] : $this->getContext($context, "bag"), "keys", array())));
     foreach ($context['_seq'] as $context["_key"] => $context["key"]) {
         // line 10
         echo "            <tr>\n                <th>";
         // line 11
         echo twig_escape_filter($this->env, $context["key"], "html", null, true);
         echo "</th>\n                ";
         // line 13
         echo "                <td>";
         echo twig_escape_filter($this->env, twig_jsonencode_filter($this->getAttribute(isset($context["bag"]) ? $context["bag"] : $this->getContext($context, "bag"), "get", array(0 => $context["key"]), "method"), 64 | 256), "html", null, true);
         echo "</td>\n            </tr>\n        ";
     }
     $_parent = $context['_parent'];
     unset($context['_seq'], $context['_iterated'], $context['_key'], $context['key'], $context['_parent'], $context['loop']);
     $context = array_intersect_key($context, $_parent) + $_parent;
     // line 16
     echo "    </tbody>\n</table>\n";
 }
开发者ID:jeremie38,项目名称:tpphp,代码行数:30,代码来源:294e791c5ea4d93f9eb84ce94046b071c2ef58397c3bdaa14b5a0b85a62e00d7.php


示例8: doDisplay

 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     echo "<div id=\"fb-root\"></div>\n";
     // line 2
     if (!$this->getContext($context, "async")) {
         // line 3
         echo "<script type=\"text/javascript\" src=\"http://connect.facebook.net/";
         echo twig_escape_filter($this->env, $this->getContext($context, "culture"), "html", null, true);
         echo "/all.js\"></script>\n";
     }
     // line 5
     echo "<script type=\"text/javascript\">\n";
     // line 7
     if ($this->getContext($context, "async")) {
         // line 8
         echo "window.fbAsyncInit = function() {\n";
     }
     // line 10
     echo "  FB.init(";
     echo twig_jsonencode_filter(array("appId" => $this->getContext($context, "appId"), "xfbml" => $this->getContext($context, "xfbml"), "oauth" => $this->getContext($context, "oauth"), "status" => $this->getContext($context, "status"), "cookie" => $this->getContext($context, "cookie"), "logging" => $this->getContext($context, "logging")));
     echo ");\n";
     // line 11
     if ($this->getContext($context, "async")) {
         // line 12
         echo "  ";
         echo $this->getContext($context, "fbAsyncInit");
         echo "\n};\n\n(function() {\n  var e = document.createElement('script');\n  e.src = document.location.protocol + ";
         // line 17
         echo twig_jsonencode_filter(sprintf("//connect.facebook.net/%s/all.js", $this->getContext($context, "culture")));
         echo ";\n  e.async = true;\n  document.getElementById('fb-root').appendChild(e);\n}());\n";
     }
     // line 23
     echo "</script>\n";
 }
开发者ID:rfanjul,项目名称:sfMongoFacebookTwitter,代码行数:35,代码来源:52cb54bd5b240337407adf5e86ba.php


示例9: block_input_attributes

 public function block_input_attributes($context, array $blocks = array())
 {
     // line 11
     echo "    type=\"text\"\n    data-grav-field-datetime\n    data-date-formats=\"";
     // line 13
     echo twig_escape_filter($this->env, twig_jsonencode_filter(array("format" => isset($context["js_dateformat"]) ? $context["js_dateformat"] : null)), "html_attr");
     echo "\"\n    ";
     // line 14
     if ($this->getAttribute($this->getAttribute(isset($context["field"]) ? $context["field"] : null, "validate", array()), "min", array())) {
         echo "min=\"";
         echo null === $this->getAttribute($this->getAttribute(isset($context["field"]) ? $context["field"] : null, "validate", array()), "min", array()) ? $this->getAttribute($this->getAttribute(isset($context["field"]) ? $context["field"] : null, "validate", array()), "min", array()) : twig_date_format_filter($this->env, $this->getAttribute($this->getAttribute(isset($context["field"]) ? $context["field"] : null, "validate", array()), "min", array()), isset($context["php_dateformat"]) ? $context["php_dateformat"] : null);
         echo "\"";
     }
     // line 15
     echo "    ";
     if ($this->getAttribute($this->getAttribute(isset($context["field"]) ? $context["field"] : null, "validate", array()), "max", array())) {
         echo "max=\"";
         echo null === $this->getAttribute($this->getAttribute(isset($context["field"]) ? $context["field"] : null, "validate", array()), "max", array()) ? $this->getAttribute($this->getAttribute(isset($context["field"]) ? $context["field"] : null, "validate", array()), "max", array()) : twig_date_format_filter($this->env, $this->getAttribute($this->getAttribute(isset($context["field"]) ? $context["field"] : null, "validate", array()), "max", array()), isset($context["php_dateformat"]) ? $context["php_dateformat"] : null);
         echo "\"";
     }
     // line 16
     echo "    ";
     $this->displayParentBlock("input_attributes", $context, $blocks);
     echo "\n";
 }
开发者ID:BenjaminPoilve,项目名称:Seed-Up-Website,代码行数:25,代码来源:58c24b106ca4b456dd23948d964019b9f864093b2c1d7bb9c11481d64401baae.php


示例10: doDisplay

 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     echo "<div class=\"";
     echo twig_escape_filter($this->env, isset($context["cssIdentifier"]) ? $context["cssIdentifier"] : $this->getContext($context, "cssIdentifier"), "html", null, true);
     echo " ";
     echo twig_escape_filter($this->env, isset($context["cssClass"]) ? $context["cssClass"] : $this->getContext($context, "cssClass"), "html", null, true);
     echo "\"\n     data-props=\"";
     // line 2
     echo twig_escape_filter($this->env, twig_jsonencode_filter(isset($context["clientSideProperties"]) ? $context["clientSideProperties"] : $this->getContext($context, "clientSideProperties")), "html", null, true);
     echo "\"\n     data-params=\"";
     // line 3
     echo twig_escape_filter($this->env, twig_jsonencode_filter(isset($context["clientSideParameters"]) ? $context["clientSideParameters"] : $this->getContext($context, "clientSideParameters")), "html", null, true);
     echo "\">\n     ";
     // line 4
     $template = $this->env->resolveTemplate($context["implView"]->getTemplateFile());
     $template->display(array_merge($context, $context["implView"]->getTemplateVars(isset($context["implOverride"]) ? $context["implOverride"] : $this->getContext($context, "implOverride"))));
     // line 5
     echo "</div>\n<script>\$(document).ready(function () { require('";
     // line 6
     echo twig_escape_filter($this->env, isset($context["jsNamespace"]) ? $context["jsNamespace"] : $this->getContext($context, "jsNamespace"), "html", null, true);
     echo "').";
     echo twig_escape_filter($this->env, isset($context["jsClass"]) ? $context["jsClass"] : $this->getContext($context, "jsClass"), "html", null, true);
     echo ".initElements(); });</script>";
 }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:25,代码来源:76e4f21452ecc8af473644f9315354524680a1ea63977c895c83c933e5ab.php


示例11: doDisplay

 protected function doDisplay(array $context, array $blocks = array())
 {
     $__internal_b3a06b7d0e322b7e3a01f7ab3182288c77c6940258883e2ae9f5f2edc60fec34 = $this->env->getExtension("native_profiler");
     $__internal_b3a06b7d0e322b7e3a01f7ab3182288c77c6940258883e2ae9f5f2edc60fec34->enter($__internal_b3a06b7d0e322b7e3a01f7ab3182288c77c6940258883e2ae9f5f2edc60fec34_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "WebProfilerBundle:Profiler:base_js.html.twig"));
     // line 1
     echo "<script>/*<![CDATA[*/\n    ";
     // line 5
     echo "\n    Sfjs = (function() {\n        \"use strict\";\n\n        var classListIsSupported = 'classList' in document.documentElement;\n\n        if (classListIsSupported) {\n            var hasClass = function (el, cssClass) { return el.classList.contains(cssClass); };\n            var removeClass = function(el, cssClass) { el.classList.remove(cssClass); };\n            var addClass = function(el, cssClass) { el.classList.add(cssClass); };\n            var toggleClass = function(el, cssClass) { el.classList.toggle(cssClass); };\n        } else {\n            var hasClass = function (el, cssClass) { return el.className.match(new RegExp('\\\\b' + cssClass + '\\\\b')); };\n            var removeClass = function(el, cssClass) { el.className = el.className.replace(new RegExp('\\\\b' + cssClass + '\\\\b'), ' '); };\n            var addClass = function(el, cssClass) { if (!hasClass(el, cssClass)) { el.className += \" \" + cssClass; } };\n            var toggleClass = function(el, cssClass) { hasClass(el, cssClass) ? removeClass(el, cssClass) : addClass(el, cssClass); };\n        }\n\n        var noop = function() {},\n\n            collectionToArray = function (collection) {\n                var length = collection.length || 0,\n                    results = new Array(length);\n\n                while (length--) {\n                    results[length] = collection[length];\n                }\n\n                return results;\n            },\n\n            profilerStorageKey = 'sf2/profiler/',\n\n            request = function(url, onSuccess, onError, payload, options) {\n                var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');\n                options = options || {};\n                options.maxTries = options.maxTries || 0;\n                xhr.open(options.method || 'GET', url, true);\n                xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n                xhr.onreadystatechange = function(state) {\n                    if (4 !== xhr.readyState) {\n                        return null;\n                    }\n\n                    if (xhr.status == 404 && options.maxTries > 1) {\n                        setTimeout(function(){\n                            options.maxTries--;\n                            request(url, onSuccess, onError, payload, options);\n                        }, 500);\n\n                        return null;\n                    }\n\n                    if (200 === xhr.status) {\n                        (onSuccess || noop)(xhr);\n                    } else {\n                        (onError || noop)(xhr);\n                    }\n                };\n                xhr.send(payload || '');\n            },\n\n            getPreference = function(name) {\n                if (!window.localStorage) {\n                    return null;\n                }\n\n                return localStorage.getItem(profilerStorageKey + name);\n            },\n\n            setPreference = function(name, value) {\n                if (!window.localStorage) {\n                    return null;\n                }\n\n                localStorage.setItem(profilerStorageKey + name, value);\n            },\n\n            requestStack = [],\n\n            renderAjaxRequests = function() {\n                var requestCounter = document.querySelectorAll('.sf-toolbar-ajax-requests');\n                if (!requestCounter.length) {\n                    return;\n                }\n\n                var ajaxToolbarPanel = document.querySelector('.sf-toolbar-block-ajax');\n                var tbodies = document.querySelectorAll('.sf-toolbar-ajax-request-list');\n                var state = 'ok';\n                if (tbodies.length) {\n                    var tbody = tbodies[0];\n\n                    var rows = document.createDocumentFragment();\n\n                    if (requestStack.length) {\n                        for (var i = 0; i < requestStack.length; i++) {\n                            var request = requestStack[i];\n\n                            var row = document.createElement('tr');\n                            rows.appendChild(row);\n\n                            var methodCell = document.createElement('td');\n                            if (request.error) {\n                                methodCell.className = 'sf-ajax-request-error';\n                            }\n                            methodCell.textContent = request.method;\n                            row.appendChild(methodCell);\n\n                            var pathCell = document.createElement('td');\n                            pathCell.className = 'sf-ajax-request-url';\n                            if ('GET' === request.method) {\n                                var pathLink = document.createElement('a');\n                                pathLink.setAttribute('href', request.url);\n                                pathLink.textContent = request.url;\n                                pathCell.appendChild(pathLink);\n                            } else {\n                                pathCell.textContent = request.url;\n                            }\n                            pathCell.setAttribute('title', request.url);\n                            row.appendChild(pathCell);\n\n                            var durationCell = document.createElement('td');\n                            durationCell.className = 'sf-ajax-request-duration';\n\n                            if (request.duration) {\n                                durationCell.textContent = request.duration + \"ms\";\n                            } else {\n                                durationCell.textContent = '-';\n                            }\n                            row.appendChild(durationCell);\n\n                            row.appendChild(document.createTextNode(' '));\n                            var profilerCell = document.createElement('td');\n\n                            if (request.profilerUrl) {\n                                var profilerLink = document.createElement('a');\n                                profilerLink.setAttribute('href', request.profilerUrl);\n                                profilerLink.textContent = request.profile;\n                                profilerCell.appendChild(profilerLink);\n                            } else {\n                                profilerCell.textContent = 'n/a';\n                            }\n\n                            row.appendChild(profilerCell);\n\n                            var requestState = 'ok';\n                            if (request.error) {\n                                requestState = 'error';\n                                if (state != \"loading\" && i > requestStack.length - 4) {\n                                    state = 'error';\n                                }\n                            } else if (request.loading) {\n                                requestState = 'loading';\n                                state = 'loading';\n                            }\n                            row.className = 'sf-ajax-request sf-ajax-request-' + requestState;\n                        }\n\n                        var infoSpan = document.querySelectorAll(\".sf-toolbar-ajax-info\")[0];\n                        var children = collectionToArray(tbody.children);\n                        for (var i = 0; i < children.length; i++) {\n                            tbody.removeChild(children[i]);\n                        }\n                        tbody.appendChild(rows);\n\n                        if (infoSpan) {\n                            var text = requestStack.length + ' AJAX request' + (requestStack.length > 1 ? 's' : '');\n                            infoSpan.textContent = text;\n                        }\n\n                        ajaxToolbarPanel.style.display = 'block';\n                    } else {\n                        ajaxToolbarPanel.style.display = 'none';\n                    }\n                }\n\n                requestCounter[0].textContent = requestStack.length;\n\n                var className = 'sf-toolbar-ajax-requests sf-toolbar-value';\n                requestCounter[0].className = className;\n\n                if (state == 'ok') {\n                    Sfjs.removeClass(ajaxToolbarPanel, 'sf-ajax-request-loading');\n                    Sfjs.removeClass(ajaxToolbarPanel, 'sf-toolbar-status-red');\n                } else if (state == 'error') {\n                    Sfjs.addClass(ajaxToolbarPanel, 'sf-toolbar-status-red');\n                } else {\n                    Sfjs.addClass(ajaxToolbarPanel, 'sf-ajax-request-loading');\n                }\n            };\n\n        var addEventListener;\n\n        var el = document.createElement('div');\n        if (!'addEventListener' in el) {\n            addEventListener = function (element, eventName, callback) {\n                element.attachEvent('on' + eventName, callback);\n            };\n        } else {\n            addEventListener = function (element, eventName, callback) {\n                element.addEventListener(eventName, callback, false);\n            };\n        }\n\n        ";
     // line 209
     if (array_key_exists("excluded_ajax_paths", $context)) {
         // line 210
         echo "            if (window.XMLHttpRequest && XMLHttpRequest.prototype.addEventListener) {\n                var proxied = XMLHttpRequest.prototype.open;\n\n                XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {\n                    var self = this;\n\n                    /* prevent logging AJAX calls to static and inline files, like templates */\n                    var path = url;\n                    if (url.substr(0, 1) === '/') {\n                        if (0 === url.indexOf('";
         // line 219
         echo twig_escape_filter($this->env, twig_escape_filter($this->env, $this->getAttribute(isset($context["request"]) ? $context["request"] : $this->getContext($context, "request"), "basePath", array()), "js"), "html", null, true);
         echo "')) {\n                            path = url.substr(";
         // line 220
         echo twig_escape_filter($this->env, twig_length_filter($this->env, $this->getAttribute(isset($context["request"]) ? $context["request"] : $this->getContext($context, "request"), "basePath", array())), "html", null, true);
         echo ");\n                        }\n                    }\n                    else if (0 === url.indexOf('";
         // line 223
         echo twig_escape_filter($this->env, twig_escape_filter($this->env, $this->getAttribute(isset($context["request"]) ? $context["request"] : $this->getContext($context, "request"), "schemeAndHttpHost", array()) . $this->getAttribute(isset($context["request"]) ? $context["request"] : $this->getContext($context, "request"), "basePath", array()), "js"), "html", null, true);
         echo "')) {\n                        path = url.substr(";
         // line 224
         echo twig_escape_filter($this->env, twig_length_filter($this->env, $this->getAttribute(isset($context["request"]) ? $context["request"] : $this->getContext($context, "request"), "schemeAndHttpHost", array()) . $this->getAttribute(isset($context["request"]) ? $context["request"] : $this->getContext($context, "request"), "basePath", array())), "html", null, true);
         echo ");\n                    }\n\n                    if (path.substr(0, 1) === '/' && !path.match(new RegExp(";
         // line 227
         echo twig_jsonencode_filter(isset($context["excluded_ajax_paths"]) ? $context["excluded_ajax_paths"] : $this->getContext($context, "excluded_ajax_paths"));
         echo "))) {\n                        var stackElement = {\n                            loading: true,\n                            error: false,\n                            url: url,\n                            method: method,\n                            start: new Date()\n                        };\n\n                        requestStack.push(stackElement);\n\n                        this.addEventListener('readystatechange', function() {\n                            if (self.readyState == 4) {\n                                stackElement.duration = new Date() - stackElement.start;\n                                stackElement.loading = false;\n                                stackElement.error = self.status < 200 || self.status >= 400;\n                                stackElement.profile = self.getResponseHeader(\"X-Debug-Token\");\n                                stackElement.profilerUrl = self.getResponseHeader(\"X-Debug-Token-Link\");\n\n                                Sfjs.renderAjaxRequests();\n                            }\n                        }, false);\n\n                        Sfjs.renderAjaxRequests();\n                    }\n\n                    proxied.apply(this, Array.prototype.slice.call(arguments));\n                };\n            }\n        ";
     }
     // line 257
     echo "\n        return {\n            hasClass: hasClass,\n\n            removeClass: removeClass,\n\n            addClass: addClass,\n\n            toggleClass: toggleClass,\n\n            getPreference: getPreference,\n\n            setPreference: setPreference,\n\n            addEventListener: addEventListener,\n\n            request: request,\n\n            renderAjaxRequests: renderAjaxRequests,\n\n            load: function(selector, url, onSuccess, onError, options) {\n                var el = document.getElementById(selector);\n\n                if (el && el.getAttribute('data-sfurl') !== url) {\n                    request(\n                        url,\n                        function(xhr) {\n                            el.innerHTML = xhr.responseText;\n                            el.setAttribute('data-sfurl', url);\n                            removeClass(el, 'loading');\n                            (onSuccess || noop)(xhr, el);\n                        },\n                        function(xhr) { (onError || noop)(xhr, el); },\n                        '',\n                        options\n                    );\n                }\n\n                return this;\n            },\n\n            toggle: function(selector, elOn, elOff) {\n                var tmp = elOn.style.display,\n                    el = document.getElementById(selector);\n\n                elOn.style.display = elOff.style.display;\n                elOff.style.display = tmp;\n\n                if (el) {\n                    el.style.display = 'none' === tmp ? 'none' : 'block';\n                }\n\n                return this;\n            },\n\n            createTabs: function() {\n                var tabGroups = document.querySelectorAll('.sf-tabs');\n\n                /* create the tab navigation for each group of tabs */\n                for (var i = 0; i < tabGroups.length; i++) {\n                    var tabs = tabGroups[i].querySelectorAll('.tab');\n                    var tabNavigation = document.createElement('ul');\n                    tabNavigation.className = 'tab-navigation';\n\n                    for (var j = 0; j < tabs.length; j++) {\n                        var tabId = 'tab-' + i + '-' + j;\n                        var tabTitle = tabs[j].querySelector('.tab-title').innerHTML;\n\n                        var tabNavigationItem = document.createElement('li');\n                        tabNavigationItem.setAttribute('data-tab-id', tabId);\n                        if (j == 0) { Sfjs.addClass(tabNavigationItem, 'active'); }\n                        if (Sfjs.hasClass(tabs[j], 'disabled')) { Sfjs.addClass(tabNavigationItem, 'disabled'); }\n                        tabNavigationItem.innerHTML = tabTitle;\n                        tabNavigation.appendChild(tabNavigationItem);\n\n                        var tabContent = tabs[j].querySelector('.tab-content');\n                        tabContent.parentElement.setAttribute('id', tabId);\n                    }\n\n                    tabGroups[i].insertBefore(tabNavigation, tabGroups[i].firstChild);\n                }\n\n                /* display the active tab and add the 'click' event listeners */\n                for (i = 0; i < tabGroups.length; i++) {\n                    tabNavigation = tabGroups[i].querySelectorAll('.tab-navigation li');\n\n                    for (j = 0; j < tabNavigation.length; j++) {\n                        tabId = tabNavigation[j].getAttribute('data-tab-id');\n                        document.getElementById(tabId).querySelector('.tab-title').className = 'hidden';\n\n                        if (Sfjs.hasClass(tabNavigation[j], 'active')) {\n                            document.getElementById(tabId).className = 'block';\n                        } else {\n                            document.getElementById(tabId).className = 'hidden';\n                        }\n\n                        tabNavigation[j].addEventListener('click', function(e) {\n                            var activeTab = e.target || e.srcElement;\n\n                            /* needed because when the tab contains HTML contents, user can click */\n                            /* on any of those elements instead of their parent '<li>' element */\n                            while (activeTab.tagName.toLowerCase() !== 'li') {\n                                activeTab = activeTab.parentNode;\n                            }\n\n                            /* get the full list of tabs through the parent of the active tab element */\n                            var tabNavigation = activeTab.parentNode.children;\n                            for (var k = 0; k < tabNavigation.length; k++) {\n                                var tabId = tabNavigation[k].getAttribute('data-tab-id');\n                                document.getElementById(tabId).className = 'hidden';\n                                Sfjs.removeClass(tabNavigation[k], 'active');\n                            }\n\n                            Sfjs.addClass(activeTab, 'active');\n                            var activeTabId = activeTab.getAttribute('data-tab-id');\n                            document.getElementById(activeTabId).className = 'block';\n                        });\n                    }\n                }\n            },\n\n            createToggles: function() {\n                var toggles = document.querySelectorAll('.sf-toggle');\n\n                for (var i = 0; i < toggles.length; i++) {\n                    var elementSelector = toggles[i].getAttribute('data-toggle-selector');\n                    var element = document.querySelector(elementSelector);\n\n                    Sfjs.addClass(element, 'sf-toggle-content');\n\n                    if (toggles[i].hasAttribute('data-toggle-initial') && toggles[i].getAttribute('data-toggle-initial') == 'display') {\n                        Sfjs.addClass(element, 'sf-toggle-visible');\n                    } else {\n                        Sfjs.addClass(element, 'sf-toggle-hidden');\n                    }\n\n                    Sfjs.addEventListener(toggles[i], 'click', function(e) {\n                        e.preventDefault();\n\n                        var toggle = e.target || e.srcElement;\n\n                        /* needed because when the toggle contains HTML contents, user can click */\n                        /* on any of those elements instead of their parent '.sf-toggle' element */\n                        while (!Sfjs.hasClass(toggle, 'sf-toggle')) {\n                            toggle = toggle.parentNode;\n                        }\n\n                        var element = document.querySelector(toggle.getAttribute('data-toggle-selector'));\n\n                        Sfjs.toggleClass(element, 'sf-toggle-hidden');\n                        Sfjs.toggleClass(element, 'sf-toggle-visible');\n\n                        /* the toggle doesn't change its contents when clicking on it */\n                        if (!toggle.hasAttribute('data-toggle-alt-content')) {\n                            return;\n                        }\n\n                        if (!toggle.hasAttribute('data-toggle-original-content')) {\n                            toggle.setAttribute('data-toggle-original-content', toggle.innerHTML);\n                        }\n\n                        var currentContent = toggle.innerHTML;\n                        var originalContent = toggle.getAttribute('data-toggle-original-content');\n                        var altContent = toggle.getAttribute('data-toggle-alt-content');\n                        toggle.innerHTML = currentContent !== altContent ? altContent : originalContent;\n                    });\n                }\n            }\n        };\n    })();\n\n    Sfjs.addEventListener(window, 'load', function() {\n        Sfjs.createTabs();\n        Sfjs.createToggles();\n    });\n\n/*]]>*/</script>\n";
     $__internal_b3a06b7d0e322b7e3a01f7ab3182288c77c6940258883e2ae9f5f2edc60fec34->leave($__internal_b3a06b7d0e322b7e3a01f7ab3182288c77c6940258883e2ae9f5f2edc60fec34_prof);
 }
开发者ID:MikeVeerman,项目名称:symf2tut,代码行数:32,代码来源:71f94766af0a085ccc998d9b85197568ad46ccf991b5dce1dadb34a6295af029.php


示例12: doDisplay


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP twig_last函数代码示例发布时间:2022-05-23
下一篇:
PHP twig_join_filter函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap