PHP StringUtils::jsEscape方法代码示例(phpstringutils:jsescape方法的典型用法代码示例)

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


PHP StringUtils::jsEscape方法代码示例(phpstringutils:jsescape方法的典型用法代码示例)

在下文中一共展示了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

本文标签属性:

示例:示例英语

代码:代码零九

PHP:php是什么

StringUtils:stringutils中的isempty和isblank

jsEscape:jsEscape

上一篇:中国人去缅甸需要注意的禁忌(去缅甸旅游要注意什么)
下一篇:领养猫被拒后把猫摔死了要怎么办(男子收养猫后向原主人勒索,遭拒后虐杀猫,他将承担哪些责任?)

为您推荐