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


PHP JavaScriptHelper::escapeString方法代码示例

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


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

示例1: remoteFunction

 /**
  * Creates JavaScript function for remote AJAX call
  *
  * This function creates the javascript needed to make a remote call
  * it is primarily used as a helper for AjaxHelper::link.
  *
  * @param array $options options for javascript
  * @return string html code for link to remote action
  * @see AjaxHelper::link() for docs on options parameter.
  */
 function remoteFunction($options)
 {
     if (isset($options['update'])) {
         if (!is_array($options['update'])) {
             $func = "new Ajax.Updater('{$options['update']}',";
         } else {
             $func = "new Ajax.Updater(document.createElement('div'),";
         }
         if (!isset($options['requestHeaders'])) {
             $options['requestHeaders'] = array();
         }
         if (is_array($options['update'])) {
             $options['update'] = join(' ', $options['update']);
         }
         $options['requestHeaders']['X-Update'] = $options['update'];
     } else {
         $func = "new Ajax.Request(";
     }
     $func .= "'" . $this->url(isset($options['url']) ? $options['url'] : "") . "'";
     $func .= ", " . $this->__optionsForAjax($options) . ")";
     if (isset($options['before'])) {
         $func = "{$options['before']}; {$func}";
     }
     if (isset($options['after'])) {
         $func = "{$func}; {$options['after']};";
     }
     if (isset($options['condition'])) {
         $func = "if ({$options['condition']}) { {$func}; }";
     }
     if (isset($options['confirm'])) {
         $func = "if (confirm('" . $this->Javascript->escapeString($options['confirm']) . "')) { {$func}; } else { event.returnValue = false; return false; }";
     }
     return $func;
 }
开发者ID:BGCX067,项目名称:fake-as3-svn-to-git,代码行数:44,代码来源:ajax.php

示例2: remoteFunction

/**
 * Creates JavaScript function for remote AJAX call
 *
 * This function creates the javascript needed to make a remote call
 * it is primarily used as a helper for AjaxHelper::link.
 *
 * @param array $options options for javascript
 * @return string html code for link to remote action
 * @see AjaxHelper::link() for docs on options parameter.
 */
	function remoteFunction($options) {
		if (isset($options['update'])) {
		    if (isset($options['position'])){
		        $position = $options['position'];
		        unset($options['position']);
		    }
		    else{
		        $position = 'html';
		    }
			if (!is_array($options['update'])) {
			    $func = "$.ajax("; 
			    if (!isset($options['complete'])){
			        $options['complete'] = '';
		        }
		        $options['complete'] = "$('#" . $options['update'] . "').$position(request.responseText); " . $options['complete'];
			} else {
				$func = "$.ajax(";
				if (!isset($options['complete'])){
			        $options['complete'] = '';
		        }
		        $selectors = '';
		        foreach($options['update'] as $selector){
		            $selectors .= '#' . $selector . ', ';
		        }
		        $options['complete'] = "$('" . $selectors . "').$position(request.responseText); " . $options['complete'];
			    }
			if (is_array($options['update'])) {
				$options['update'] = join(' ', $options['update']);
			}
		} else {
			$func = "$.ajax(";
		}
        $options['url'] = $this->url(isset($options['url']) ? $options['url'] : "");
		$func .= $this->__optionsForAjax($options) . ")";

		if (isset($options['before'])) {
			$func = "{$options['before']}; $func";
		}
		if (isset($options['after'])) {
			$func = "$func; {$options['after']};";
		}
		if (isset($options['condition'])) {
			$func = "if ({$options['condition']}) { $func; }";
		}

		if (isset($options['confirm'])) {
			$func = "if (confirm('" . $this->Javascript->escapeString($options['confirm'])
				. "')) { $func; } else { return false; }";
		}
		return $func;
	}
开发者ID:robksawyer,项目名称:FIND---GET---MAKE,代码行数:61,代码来源:ajax.php


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