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


PHP StringUtils::jsEscape方法代码示例

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


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

示例1: _buildWidgetOptions

 protected function _buildWidgetOptions($schemafield, $attributes)
 {
     $partial = $schemafield->Partial;
     $filter = $schemafield->Filter;
     $is_multiple = $schemafield->isMultiple();
     $is_quickadd = $schemafield->isQuickadd();
     $is_sortable = $schemafield->isSortable();
     $tag_direction = $schemafield->Direction;
     if (empty($tag_direction)) {
         $tag_direction = 'out';
     }
     if (!empty($attributes['title'])) {
         $title = $attributes['title'];
     } else {
         $title = $schemafield->Title;
     }
     $value_opts = $schemafield->ValueOptions;
     $value_is_multiple = false;
     $pre_values = array();
     $values_name = 'role';
     if (!empty($value_opts)) {
         $value_mode = $value_opts->Mode;
         $values_name = $value_opts->Name;
         $value_is_multiple = $value_opts->isMultiple();
         if ($value_mode != 'none') {
             $pre_values = $value_opts->Values;
         }
     } else {
         $value_mode = 'none';
     }
     $title = StringUtils::jsEscape($title);
     $title_plural = $title;
     //StringUtils::pluralize($title);
     $opt[] = "\t\t\tLabel: '{$title}'";
     $opt[] = "\t\t\tLabelPlural: '{$title_plural}'";
     $opt[] = "\t\t\tActivateButtonLabel: '{$title}'";
     $element = $partial->getTagElement();
     if (empty($element)) {
         $element = '@' . $partial->getTagAspect();
     }
     $quickaddelement = $element;
     if (!empty($attributes['quick-add-element'])) {
         $quickaddelement = $attributes['quick-add-element'];
     }
     $quickaddaction = 'node-quick-add';
     if (!empty($attributes['quick-add-action'])) {
         $quickaddaction = $attributes['quick-add-action'];
     }
     if (!empty($attributes['search-parameters'])) {
         $str = array();
         $params = explode('&', urldecode($attributes['search-parameters']));
         foreach ($params as $param) {
             list($k, $v) = explode('=', $param, 2);
             $str[] = "'" . $k . "' : '" . $v . "'";
         }
         $opt[] = "\t\t\tSearchParameters: {" . implode(',', $str) . "}";
     } else {
         $opt[] = "\t\t\tSearchParameters: {'Elements.in' : '{$element}'}";
         //Title keyword is auto-added by widget
     }
     if (!empty($attributes['search-url'])) {
         $opt[] = "\t\t\tSearchURL: '{$attributes['search-url']}'";
     }
     if (!empty($attributes['show-element'])) {
         $opt[] = "\t\t\tShowElementInChosenList: true";
         $opt[] = "\t\t\tShowElementInSearchResults: true";
     }
     if ($tag_direction != 'out') {
         $opt[] = "\t\tTagDirection: '{$tag_direction}'";
     }
     if (!empty($filter)) {
         $opt[] = "\t\tTagFilter: '" . $filter . "'";
     }
     if ($is_quickadd) {
         $opt[] = "\t\t\tAllowQuickAdd: true";
         $opt[] = "\t\t\tQuickAddNonce: '{% filter nonce?action={$quickaddaction} %}'";
         $opt[] = "\t\t\tAddTagNonce: '{% filter nonce?action=node-add-tag %}'";
         $opt[] = "\t\t\tReplaceNonce: '{% filter nonce?action=node-replace %}'";
         $opt[] = "\t\t\tQuickAddElement : '{$quickaddelement}'";
         $opt[] = "\t\t\tEditNonce: '{% filter nonce?action=node-edit %}'";
     }
     if ($is_multiple) {
         $opt[] = "\t\t\tAllowMultiple: " . ($is_multiple ? 'true' : 'false') . "";
     }
     if ($is_sortable) {
         $opt[] = "\t\t\tAllowReorderChosenList: " . ($is_sortable ? 'true' : 'false') . "";
     }
     if ($value_mode != 'none') {
         $opt[] = "\t\tValueMode: '{$value_mode}'";
         $opt[] = "\t\tAllowMultipleValues: " . ($value_is_multiple ? 'true' : 'false') . "";
         if (!empty($pre_values)) {
             foreach ((array) $pre_values as $dname => $dvalue) {
                 $array[] = array('value' => $dname, 'display' => $dvalue);
             }
             $opt[] = "\t\tValues: " . json_encode($array) . "";
         }
         if (count($pre_values) == 1) {
             $opt[] = "\t\tShowExistingValues: false";
         } else {
             if ($value_mode == 'typein') {
//.........这里部分代码省略.........
开发者ID:wb-crowdfusion,项目名称:crowdfusion,代码行数:101,代码来源:AbstractCmsBuilder.php

示例2: jsEscape

 /**
  * Escapes the specified parameter in 'value' for use in javascript
  *
  * Expected Param:
  *  value string
  *
  * @return string
  */
 public function jsEscape()
 {
     if ($this->getParameter('value') == null) {
         return;
     }
     return StringUtils::jsEscape($this->getParameter('value'));
 }
开发者ID:wb-crowdfusion,项目名称:crowdfusion,代码行数:15,代码来源:DisplayFilterer.php


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