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


PHP twig_jsonencode_filter函数代码示例

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


在下文中一共展示了twig_jsonencode_filter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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_173ad3a50b98e16ee263d504c2c0bfcb6fd12a5e908c76729d1c86f3cc1ec549 = $this->env->getExtension("native_profiler");
     $__internal_173ad3a50b98e16ee263d504c2c0bfcb6fd12a5e908c76729d1c86f3cc1ec549->enter($__internal_173ad3a50b98e16ee263d504c2c0bfcb6fd12a5e908c76729d1c86f3cc1ec549_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "@WebProfiler/Profiler/base_js.html.twig"));
     // line 1
     echo "<script>/*<![CDATA[*/\n    Sfjs = (function() {\n        \"use strict\";\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            hasClass = function(el, klass) {\n                return el.className && el.className.match(new RegExp('\\\\b' + klass + '\\\\b'));\n            },\n\n            removeClass = function(el, klass) {\n                if (el.className) {\n                    el.className = el.className.replace(new RegExp('\\\\b' + klass + '\\\\b'), ' ');\n                }\n            },\n\n            addClass = function(el, klass) {\n                if (!hasClass(el, klass)) {\n                    el.className += \" \" + klass;\n                }\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 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 + ' call' + (requestStack.length > 1 ? 's' : '');\n                            infoSpan.textContent = text;\n                        }\n                    } else {\n                        var cell = document.createElement('td');\n                        cell.setAttribute('colspan', '4');\n                        cell.textContent = \"No AJAX requests yet.\";\n                        var row = document.createElement('tr');\n                        row.appendChild(cell);\n                        tbody.appendChild(row);\n                    }\n                }\n\n                requestCounter[0].textContent = requestStack.length;\n\n                var className = 'sf-toolbar-ajax-requests sf-toolbar-status';\n                if (state == 'ok') {\n                    className += ' sf-toolbar-status-green';\n                } else if (state == 'error') {\n                    className += ' sf-toolbar-status-red';\n                } else {\n                    className += ' sf-ajax-request-loading';\n                }\n\n                requestCounter[0].className = className;\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 208
     if (array_key_exists("excluded_ajax_paths", $context)) {
         // line 209
         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 218
         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 219
         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 222
         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 223
         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 226
         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 256
     echo "\n        return {\n            hasClass: hasClass,\n\n            removeClass: removeClass,\n\n            addClass: addClass,\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    })();\n/*]]>*/</script>\n";
     $__internal_173ad3a50b98e16ee263d504c2c0bfcb6fd12a5e908c76729d1c86f3cc1ec549->leave($__internal_173ad3a50b98e16ee263d504c2c0bfcb6fd12a5e908c76729d1c86f3cc1ec549_prof);
 }
开发者ID:bamper,项目名称:clothing_store_symfony,代码行数:30,代码来源:fdfb0551ecc8fadd42a9c87a3d59763cc04f01a364106c1d6abb9ef51f56a0b5.php

示例12: doDisplay

 protected function doDisplay(array $context, array $blocks = array())
 {
     $context = array_merge($this->env->getGlobals(), $context);
     // line 1
     echo twig_jsonencode_filter($this->getAttribute($this->getContext($context, 'exception'), "toarray", array(), "any", false));
     echo "\n";
 }
开发者ID:roninvn,项目名称:MeetingApp,代码行数:7,代码来源:89292142ff22e34bb8bc0e280bff.php

示例13: block_input

 public function block_input($context, array $blocks = array())
 {
     // line 7
     echo "    ";
     if ($this->getAttribute(isset($context["field"]) ? $context["field"] : null, "array", array())) {
         // line 8
         echo "        ";
         $context["name"] = (isset($context["name"]) ? $context["name"] : null) . "._json";
         // line 9
         echo "        ";
         $context["value"] = twig_jsonencode_filter(array_key_exists("value", $context) ? _twig_default_filter(isset($context["value"]) ? $context["value"] : null, array()) : array());
         // line 10
         echo "        ";
     } else {
         // line 11
         echo "        ";
         $context["value"] = twig_join_filter(isset($context["value"]) ? $context["value"] : null, ", ");
         // line 12
         echo "    ";
     }
     // line 13
     echo "\n    <input\n        ";
     // line 16
     echo "        type=\"hidden\"\n        name=\"";
     // line 17
     echo twig_escape_filter($this->env, $this->env->getExtension('GantryTwig')->fieldNameFilter((isset($context["scope"]) ? $context["scope"] : null) . (isset($context["name"]) ? $context["name"] : null)), "html", null, true);
     echo "\"\n        value=\"";
     // line 18
     echo twig_escape_filter($this->env, isset($context["value"]) ? $context["value"] : null, "html", null, true);
     echo "\"\n        ";
     // line 20
     echo "        ";
     $this->displayBlock("global_attributes", $context, $blocks);
     echo "\n    />\n";
 }
开发者ID:ericssonm,项目名称:JusCuzCustoms,代码行数:35,代码来源:04027b82562cce43c2fb49bc3451ec1f858bf4c6902014bd46beb4f9d57d3f85.php

示例14: doDisplay

    protected function doDisplay(array $context, array $blocks = array())
    {
        // line 1
        echo twig_jsonencode_filter($this->getAttribute((isset($context["exception"]) ? $context["exception"] : $this->getContext($context, "exception")), "toarray", array()));
        echo "
";
    }
开发者ID:ataxel,项目名称:tp,代码行数:7,代码来源:b7042d1fb309c817945a5232d4df59fd32b8488a11aedb4ab193a1e033ab.php

示例15: doDisplay

 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     echo "<ul class=\"g-bookmark-folders fa-ul\">\n    ";
     // line 2
     $context['_parent'] = $context;
     $context['_seq'] = twig_ensure_traversable(isset($context["folder"]) ? $context["folder"] : null);
     foreach ($context['_seq'] as $context["_key"] => $context["bookmarkFolder"]) {
         // line 3
         echo "        <li data-folder=\"";
         echo twig_escape_filter($this->env, twig_jsonencode_filter($context["bookmarkFolder"]), "html_attr");
         echo "\"";
         echo twig_in_filter($this->getAttribute($context["bookmarkFolder"], "pathname", array()), isset($context["active"]) ? $context["active"] : null) ? " class=\"active\"" : "";
         echo "><i class=\"fa-li fa fa-folder-o\"></i> <span class=\"path\" title=\"";
         echo twig_escape_filter($this->env, $this->getAttribute($context["bookmarkFolder"], "filename", array()), "html", null, true);
         echo "\">";
         echo twig_escape_filter($this->env, $this->getAttribute($context["bookmarkFolder"], "filename", array()), "html", null, true);
         echo "</span></li>\n    ";
     }
     $_parent = $context['_parent'];
     unset($context['_seq'], $context['_iterated'], $context['_key'], $context['bookmarkFolder'], $context['_parent'], $context['loop']);
     $context = array_intersect_key($context, $_parent) + $_parent;
     // line 5
     echo "</ul>\n";
 }
开发者ID:JozefAB,项目名称:neoacu,代码行数:25,代码来源:b22348bc3a4d4e41dcb968e00179f7407844952276977abcef6324360607d3a1.php


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