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


PHP Horde::escapeJson方法代码示例

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


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

示例1: _attach

 /**
  */
 protected function _attach($init)
 {
     global $page_output;
     if ($init) {
         $page_output->addScriptPackage('Horde_Core_Script_Package_Dialog');
         $page_output->addScriptFile('passphrase.js', 'imp');
     }
     $params = isset($this->_params['params']) ? $this->_params['params'] : array();
     if (isset($params['reload'])) {
         $params['reload'] = strval($params['reload']);
     }
     switch ($this->_params['type']) {
         case 'pgpPersonal':
             $text = _("Enter your personal PGP passphrase.");
             break;
         case 'pgpSymmetric':
             $text = _("Enter the passphrase used to encrypt this message.");
             break;
         case 'smimePersonal':
             $text = _("Enter your personal S/MIME passphrase.");
             break;
     }
     $js_params = array('hidden' => array_merge($params, array('type' => $this->_params['type'])), 'text' => $text);
     $js = 'ImpPassphraseDialog.display(' . Horde::escapeJson($js_params, array('nodelimit' => true)) . ')';
     if (!empty($this->_params['onload'])) {
         $page_output->addInlineScript(array($js), true);
         return false;
     }
     return $js;
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:32,代码来源:PassphraseDialog.php

示例2: send

 /**
  */
 public function send()
 {
     $json = str_replace("", '', Horde::escapeJson($this->_jsonData()));
     if ($this->jsonhtml) {
         header('Content-Type: text/html; charset=UTF-8');
         echo htmlspecialchars($json, null, 'UTF-8');
     } else {
         header('Content-Type: application/json');
         echo $json;
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:13,代码来源:HordeCore.php

示例3: sendHTTPResponse

 /**
  * Send response data to browser.
  *
  * @deprecated
  *
  * @param mixed $data  The data to serialize and send to the browser.
  * @param string $ct   The content-type to send the data with.  Either
  *                     'json', 'js-json', 'html', 'plain', and 'xml'.
  */
 public static function sendHTTPResponse($data, $ct)
 {
     // Output headers and encoded response.
     switch ($ct) {
         case 'json':
         case 'js-json':
             /* JSON responses are a structured object which always
              * includes the response in a member named 'response', and an
              * additional array of messages in 'msgs' which may be updates
              * for the server or notification messages.
              *
              * Make sure no null bytes sneak into the JSON output stream.
              * Null bytes cause IE to stop reading from the input stream,
              * causing malformed JSON data and a failed request.  These
              * bytes don't seem to break any other browser, but might as
              * well remove them anyway.
              *
              * Finally, add prototypejs security delimiters to returned
              * JSON. */
             $s_data = str_replace("", '', Horde::escapeJson($data));
             if ($ct == 'json') {
                 header('Content-Type: application/json');
                 echo $s_data;
             } else {
                 header('Content-Type: text/html; charset=UTF-8');
                 echo htmlspecialchars($s_data);
             }
             break;
         case 'html':
         case 'plain':
         case 'xml':
             $s_data = is_string($data) ? $data : $data->response;
             header('Content-Type: text/' . $ct . '; charset=UTF-8');
             echo $s_data;
             break;
         default:
             echo $data;
     }
     exit;
 }
开发者ID:horde,项目名称:horde,代码行数:49,代码来源:Deprecated.php

示例4: send

 /**
  */
 public function send()
 {
     header('Content-Type: application/json');
     echo str_replace("", '', Horde::escapeJson($this->data));
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:7,代码来源:Prototypejs.php


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