本文整理汇总了PHP中escape_javascript函数的典型用法代码示例。如果您正苦于以下问题:PHP escape_javascript函数的具体用法?PHP escape_javascript怎么用?PHP escape_javascript使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了escape_javascript函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: link_to_function
/**
* Returns a link that will trigger a javascript function using the
* onclick handler and return false after the fact.
*
* Examples:
* <?php echo link_to_function('Greeting', "alert('Hello world!')") ?>
* <?php echo link_to_function(image_tag('delete'), "do_delete()", array('confirm' => 'Really?')) ?>
*/
function link_to_function($name, $function, $html_options = array())
{
$html_options = _parse_attributes($html_options);
$html_options['href'] = isset($html_options['href']) ? $html_options['href'] : '#';
if (isset($html_options['confirm'])) {
$confirm = escape_javascript($html_options['confirm']);
unset($html_options['confirm']);
$function = "if(window.confirm('{$confirm}')){ {$function};}";
}
$html_options['onclick'] = $function . '; return false;';
return content_tag('a', $name, $html_options);
}
示例2: update_key
public function update_key()
{
$this->header('Content-Type: application/javascript', 200);
$this->layout = false;
$this->key = Pki::update($_GET['id'], $_POST['pki']);
if ($this->key->save()) {
echo "facebox.close();window.location.href=window.location.href;";
} else {
$this->key->id = $_GET['id'];
$return = escape_javascript($this->render_partial('user/edit_key.php'));
echo "\$('pki').replace('{$return}');";
}
$this->has_rendered = true;
}
示例3: ls_remote_function
/**
* Returns the javascript needed for a remote function.
* Takes the same arguments as 'link_to_remote()'.
*
* Example:
* <select id="options" onchange="<?php echo remote_function(array('update' => 'options', 'url' => '@update_options')) ?>">
* <option value="0">Hello</option>
* <option value="1">World</option>
* </select>
*/
function ls_remote_function($options)
{
sfContext::getInstance()->getResponse()->addJavascript(sfConfig::get('sf_prototype_web_dir') . '/js/prototype');
$javascript_options = _options_for_ajax($options);
$update = '';
if (isset($options['update']) && is_array($options['update'])) {
$update = array();
if (isset($options['update']['success'])) {
$update[] = "success:'" . $options['update']['success'] . "'";
}
if (isset($options['update']['failure'])) {
$update[] = "failure:'" . $options['update']['failure'] . "'";
}
$update = '{' . join(',', $update) . '}';
} else {
if (isset($options['update'])) {
$update .= "'" . $options['update'] . "'";
}
}
$function = !$update ? "new Ajax.Request(" : "new Ajax.Updater({$update}, ";
$function .= '\'' . url_for($options['url']) . '\'';
//ADDED TO ALLOW FOR APPENDING HASHES TO URLS FOR AJAX
if (isset($options['posturl'])) {
$function .= ' + ' . $options['posturl'];
}
$function .= ', ' . $javascript_options . ')';
if (isset($options['before'])) {
$function = $options['before'] . '; ' . $function;
}
if (isset($options['after'])) {
$function = $function . '; ' . $options['after'];
}
if (isset($options['condition'])) {
$function = 'if (' . $options['condition'] . ') { ' . $function . '; }';
}
if (isset($options['confirm'])) {
$function = "if (confirm('" . escape_javascript($options['confirm']) . "')) { {$function}; }";
if (isset($options['cancel'])) {
$function = $function . ' else { ' . $options['cancel'] . ' }';
}
}
return $function . ';';
}
示例4: sql
$cache_attribs_string = '';
$rsAttrGroup = sql("SELECT `attribute_groups`.`id`, IFNULL(`sys_trans_text`.`text`, `attribute_groups`.`name`) AS `name`, `attribute_categories`.`color` \n\t\t\t FROM `attribute_groups` \n\t\t\t INNER JOIN `attribute_categories` ON `attribute_groups`.`category_id`=`attribute_categories`.`id` \n\t\t\t LEFT JOIN `sys_trans` ON `attribute_groups`.`trans_id`=`sys_trans`.`id`\n\t\t\t LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND `sys_trans_text`.`lang`='&1'\n\t\t\t ORDER BY `attribute_groups`.`category_id` ASC, `attribute_groups`.`id` ASC", $locale);
while ($rAttrGroup = sql_fetch_assoc($rsAttrGroup)) {
$group_line = '';
$rs = sql("SELECT `cache_attrib`.`id`, IFNULL(`ttname`.`text`, `cache_attrib`.`name`) AS `name`, `cache_attrib`.`icon_undef`, `cache_attrib`.`icon_large`, IFNULL(`ttdesc`.`text`, `cache_attrib`.`html_desc`) AS `html_desc` \n\t\t\t\t FROM `cache_attrib` \n\t\t LEFT JOIN `sys_trans` AS `tname` ON `cache_attrib`.`trans_id`=`tname`.`id` AND `cache_attrib`.`name`=`tname`.`text`\n\t\t LEFT JOIN `sys_trans_text` AS `ttname` ON `tname`.`id`=`ttname`.`trans_id` AND `ttname`.`lang`='&1'\n\t\t LEFT JOIN `sys_trans` AS `tdesc` ON `cache_attrib`.`html_desc_trans_id`=`tdesc`.`id` AND `cache_attrib`.`html_desc`=`tdesc`.`text`\n\t\t LEFT JOIN `sys_trans_text` AS `ttdesc` ON `tdesc`.`id`=`ttdesc`.`trans_id` AND `ttdesc`.`lang`='&1'\n\t\t\t\t WHERE `cache_attrib`.`group_id`=" . ($rAttrGroup['id'] + 0) . " AND\n\t\t\t\t\t\t\tNOT IFNULL(`cache_attrib`.`hidden`, 0)=1 AND \n\t\t\t\t\t\t\t `cache_attrib`.`selectable`!=0 ORDER BY `cache_attrib`.`group_id`, `cache_attrib`.`id`", $locale);
while ($record = sql_fetch_array($rs)) {
$line = $cache_attrib_pic;
$line = mb_ereg_replace('{attrib_id}', $record['id'], $line);
$line = mb_ereg_replace('{attrib_text}', escape_javascript($record['name']), $line);
if (in_array($record['id'], $cache_attribs)) {
$line = mb_ereg_replace('{attrib_pic}', $record['icon_large'], $line);
} else {
$line = mb_ereg_replace('{attrib_pic}', $record['icon_undef'], $line);
}
$line = mb_ereg_replace('{html_desc}', escape_javascript($record['html_desc']), $line);
$line = mb_ereg_replace('{name}', escape_javascript($record['name']), $line);
$line = mb_ereg_replace('{color}', $rAttrGroup['color'], $line);
$group_line .= $line;
$nLineAttrCount++;
$line = $cache_attrib_js;
$line = mb_ereg_replace('{id}', $record['id'], $line);
if (in_array($record['id'], $cache_attribs)) {
$line = mb_ereg_replace('{selected}', 1, $line);
} else {
$line = mb_ereg_replace('{selected}', 0, $line);
}
$line = mb_ereg_replace('{img_undef}', $record['icon_undef'], $line);
$line = mb_ereg_replace('{img_large}', $record['icon_large'], $line);
if ($cache_attrib_array != '') {
$cache_attrib_array .= ',';
}
示例5: _lwButtonJs
function _lwButtonJs($options = array())
{
$js_options = array();
foreach ($options as $k => $v) {
$js_options[] = "{$k}: '" . escape_javascript($v) . "'";
}
$js = 'myLightWindow.activateWindow({' . implode(', ', $js_options) . '}); return false;';
return $js;
}
示例6: jq_remote_function
//.........这里部分代码省略.........
// Defining elements to update
if (isset($options['update']) && is_array($options['update'])) {
// On success, update the element with returned data
if (isset($options['update']['success'])) {
$update_success = "#" . $options['update']['success'];
}
// On failure, execute a client-side function
if (isset($options['update']['failure'])) {
$update_failure = $options['update']['failure'];
}
} else {
if (isset($options['update'])) {
$update_success = "#" . $options['update'];
}
}
// Update method
$updateMethod = _update_method(isset($options['position']) ? $options['position'] : '');
// Callbacks
if (isset($options['loading'])) {
$callback_loading = $options['loading'];
}
if (isset($options['complete'])) {
$callback_complete = $options['complete'];
}
if (isset($options['success'])) {
$callback_success = $options['success'];
}
$execute = 'false';
if (isset($options['script']) && $options['script'] == '1') {
$execute = 'true';
}
// Data Type
if (isset($options['dataType'])) {
$dataType = $options['dataType'];
} elseif ($execute) {
$dataType = 'html';
} else {
$dataType = 'text';
}
// POST or GET ?
$method = 'POST';
if (isset($options['method']) && strtoupper($options['method']) == 'GET') {
$method = $options['method'];
}
// async or sync, async is default
if (isset($options['type']) && $options['type'] == 'synchronous') {
$type = 'false';
}
// Is it a form submitting
if (isset($options['form'])) {
$formData = 'jQuery(this).serialize()';
} elseif (isset($options['submit'])) {
$formData = '{\'#' . $options['submit'] . '\'}.serialize()';
} elseif (isset($options['with'])) {
$formData = $options['with'];
}
// build the function
$function = "jQuery.ajax({";
$function .= 'type:\'' . $method . '\'';
$function .= ',dataType:\'' . $dataType . '\'';
if (isset($type)) {
$function .= ',async:' . $type;
}
if (isset($formData)) {
$function .= ',data:' . $formData;
}
if (isset($update_success) and !isset($callback_success)) {
$function .= ',success:function(i){jQuery(\'' . $update_success . '\').' . $updateMethod . '(i);}';
}
if (isset($update_failure)) {
$function .= ',error:function(){' . $update_failure . '}';
}
if (isset($callback_loading)) {
$function .= ',beforeSend:function(){' . $callback_loading . '}';
}
if (isset($callback_complete)) {
$function .= ',complete:function(request){' . $callback_complete . '}';
}
if (isset($callback_success)) {
$function .= ',success:function(request){' . $callback_success . '}';
}
$function .= ',url:\'' . url_for($options['url']) . '\'';
$function .= '})';
if (isset($options['before'])) {
$function = $options['before'] . '; ' . $function;
}
if (isset($options['after'])) {
$function = $function . '; ' . $options['after'];
}
if (isset($options['condition'])) {
$function = 'if (' . $options['condition'] . ') { ' . $function . '; }';
}
if (isset($options['confirm'])) {
$function = "if (confirm('" . escape_javascript($options['confirm']) . "')) { {$function}; }";
if (isset($options['cancel'])) {
$function = $function . ' else { ' . $options['cancel'] . ' }';
}
}
return $function;
}
示例7: _confirm_javascript_function
function _confirm_javascript_function($confirm)
{
return "confirm('" . escape_javascript($confirm) . "')";
}
示例8: array
$t->is(tag('br', 'class=foo', false), '<br class="foo" />', 'tag() takes a string of options as its second parameters');
$t->is(tag('p', array('class' => 'foo', 'id' => 'bar'), true), '<p class="foo" id="bar">', 'tag() takes a boolean parameter as its third parameter');
//$t->is(tag('br', array('class' => '"foo"')), '<br class=""foo"" />');
// content_tag()
$t->diag('content_tag()');
$t->is(content_tag(''), '', 'content_tag() returns an empty string with empty input');
$t->is(content_tag('', ''), '', 'content_tag() returns an empty string with empty input');
$t->is(content_tag('p', 'Toto'), '<p>Toto</p>', 'content_tag() takes a content as its second parameter');
$t->is(content_tag('p', ''), '<p></p>', 'content_tag() takes a tag as its first parameter');
// cdata_section()
$t->diag('cdata_section()');
$t->is(cdata_section(''), '<![CDATA[]]>', 'cdata_section() returns a string wrapped into a CDATA section');
$t->is(cdata_section('foobar'), '<![CDATA[foobar]]>', 'cdata_section() returns a string wrapped into a CDATA section');
// escape_javascript()
$t->diag('escape_javascript()');
$t->is(escape_javascript("alert('foo');\nalert(\"bar\");"), 'alert(\\\'foo\\\');\\nalert(\\"bar\\");', 'escape_javascript() escapes JavaScript scripts');
// _get_option()
$t->diag('_get_option()');
$options = array('foo' => 'bar', 'bar' => 'foo');
$t->is(_get_option($options, 'foo'), 'bar', '_get_option() returns the value for the given key');
$t->ok(!isset($options['foo']), '_get_option() removes the key from the original array');
$t->is(_get_option($options, 'nofoo', 'nobar'), 'nobar', '_get_option() returns the default value if the key does not exist');
// escape_once()
$t->diag('escape_once()');
$t->is(escape_once('This a > text to "escape"'), 'This a > text to "escape"', 'escape_once() escapes an HTML strings');
$t->is(escape_once(escape_once('This a > text to "escape"')), 'This a > text to "escape"', 'escape_once() does not escape an already escaped string');
$t->is(escape_once('This a > text to "escape"'), 'This a > text to "escape"', 'escape_once() does not escape an already escaped string');
$t->is(escape_once("This a > \"text\" to 'escape'"), "This a > "text" to 'escape'", 'escape_once() does not escape simple quotes but escape double quotes');
// fix_double_escape()
$t->diag('fix_double_escape()');
$t->is(fix_double_escape(htmlspecialchars(htmlspecialchars('This a > text to "escape"'), ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8'), 'This a > text to "escape"', 'fix_double_escape() fixes double escaped strings');
示例9: outputSearchForm
//.........这里部分代码省略.........
$logtypes = array();
}
$rs = sql("\n\t\tSELECT `id`,\n\t\tIFNULL(`sys_trans_text`.`text`, `log_types`.`name`) AS `name`,\n\t\t`id`='&2' as `selected`\n\t\tFROM (\n\t\t\tSELECT `id`,`name`,`trans_id` FROM `log_types`\n\t\t\tUNION\n\t\t\tSELECT 0,'all',(SELECT id FROM sys_trans WHERE `text`='all')\n\t\t) `log_types`\n\t\tLEFT JOIN `sys_trans_text` ON `sys_trans_text`.`trans_id`=`log_types`.`trans_id` AND `sys_trans_text`.`lang`='&1'\n\t ORDER BY `log_types`.`id` ASC", $opt['template']['locale'], $logtypes ? $logtypes[0] : 0);
$tpl->assign_rs('logtype_options', $rs);
sql_free_result($rs);
// cache-attributes
$attributes_jsarray = '';
$bBeginLine2 = true;
$nPrevLineAttrCount2 = 0;
$nLineAttrCount2 = 0;
$attributes_img2 = '';
/* perpare 'all attributes' */
$rsAttrGroup = sql("SELECT `attribute_groups`.`id`, IFNULL(`sys_trans_text`.`text`, `attribute_groups`.`name`) AS `name`, `attribute_categories`.`color` FROM `attribute_groups` INNER JOIN `attribute_categories` ON `attribute_groups`.`category_id`=`attribute_categories`.`id` LEFT JOIN `sys_trans` ON `attribute_groups`.`trans_id`=`sys_trans`.`id` AND `sys_trans`.`text`=`attribute_groups`.`name` LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND `sys_trans_text`.`lang`='&1' ORDER BY `attribute_groups`.`category_id` ASC, `attribute_groups`.`id` ASC", $opt['template']['locale']);
while ($rAttrGroup = sql_fetch_assoc($rsAttrGroup)) {
$group_line = '';
$rs = sql("SELECT `cache_attrib`.`id`, IFNULL(`ttname`.`text`, `cache_attrib`.`name`) AS `name`, `cache_attrib`.`icon_large`, `cache_attrib`.`icon_no`, `cache_attrib`.`icon_undef`, `cache_attrib`.`search_default`, IFNULL(`ttdesc`.`text`, `cache_attrib`.`html_desc`) AS `html_desc`\n\t\t FROM `cache_attrib`\n\t\t LEFT JOIN `sys_trans` AS `tname` ON `cache_attrib`.`trans_id`=`tname`.`id` AND `cache_attrib`.`name`=`tname`.`text`\n\t\t LEFT JOIN `sys_trans_text` AS `ttname` ON `tname`.`id`=`ttname`.`trans_id` AND `ttname`.`lang`='&1'\n\t\t LEFT JOIN `sys_trans` AS `tdesc` ON `cache_attrib`.`html_desc_trans_id`=`tdesc`.`id` AND `cache_attrib`.`html_desc`=`tdesc`.`text`\n\t\t LEFT JOIN `sys_trans_text` AS `ttdesc` ON `tdesc`.`id`=`ttdesc`.`trans_id` AND `ttdesc`.`lang`='&1'\n\t\t WHERE `cache_attrib`.`group_id`='&2' AND `selectable`\n\t\t\t\t\t AND NOT IFNULL(`cache_attrib`.`hidden`, 0)=1\n\t\t ORDER BY `cache_attrib`.`id`", $opt['template']['locale'], $rAttrGroup['id']);
while ($record = sql_fetch_array($rs)) {
// icon specified
$line = $cache_attrib_jsarray_line;
$line = mb_ereg_replace('{id}', $record['id'], $line);
if (!isset($options['cache_attribs'])) {
$line = mb_ereg_replace('{state}', 0, $line);
} else {
if (array_search($record['id'], $options['cache_attribs']) === false) {
if (array_search($record['id'], $options['cache_attribs_not']) === false) {
$line = mb_ereg_replace('{state}', 0, $line);
} else {
$line = mb_ereg_replace('{state}', 2, $line);
}
} else {
$line = mb_ereg_replace('{state}', 1, $line);
}
}
$line = mb_ereg_replace('{text_long}', escape_javascript($record['name']), $line);
$line = mb_ereg_replace('{icon}', $record['icon_large'], $line);
$line = mb_ereg_replace('{icon_no}', $record['icon_no'], $line);
$line = mb_ereg_replace('{icon_undef}', $record['icon_undef'], $line);
$line = mb_ereg_replace('{search_default}', $record['search_default'], $line);
if ($attributes_jsarray != '') {
$attributes_jsarray .= ",\n";
}
$attributes_jsarray .= $line;
$line = $cache_attrib_img_line1;
$line = mb_ereg_replace('{id}', $record['id'], $line);
$line = mb_ereg_replace('{text_long}', escape_javascript($record['name']), $line);
if (!isset($options['cache_attribs'])) {
$line = mb_ereg_replace('{icon}', $record['icon_undef'], $line);
} else {
if (array_search($record['id'], $options['cache_attribs']) === false) {
if (array_search($record['id'], $options['cache_attribs_not']) === false) {
$line = mb_ereg_replace('{icon}', $record['icon_undef'], $line);
} else {
$line = mb_ereg_replace('{icon}', $record['icon_no'], $line);
}
} else {
$line = mb_ereg_replace('{icon}', $record['icon_large'], $line);
}
}
$line = mb_ereg_replace('{html_desc}', escape_javascript($record['html_desc']), $line);
$line = mb_ereg_replace('{name}', escape_javascript($record['name']), $line);
$line = mb_ereg_replace('{color}', $rAttrGroup['color'], $line);
$group_line .= $line;
$nLineAttrCount2++;
}
sql_free_result($rs);
if ($group_line != '') {
示例10: foreach
<tbody>
<?php
foreach ($permission_list as $permission) {
?>
<tr>
<td><?php
echo $permission->getTitle();
?>
</td>
<td><?php
echo $permission->getCode();
?>
</td>
<td>
<?php
echo jq_link_to_function('edit', "fillForm(" . $permission->getId() . ", '" . escape_javascript($permission->getTitle()) . "', '" . $permission->getCode() . "')", array('class' => 'link-edit'));
?>
<?php
echo link_to('remove', 'permission/delete?id=' . $permission->getId(), array('class' => 'link-de-activate', 'method' => 'delete', 'confirm' => 'Are you sure to delete \'' . $permission->choiceText() . '\'?'));
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
Items per page:
示例11: javascript_tag
echo javascript_tag("\nfunction insertGadget(type, id, caption)\n{\n var parentIframe = parent.document.getElementsByTagName('iframe')[0];\n\n var typeId = 'plot' + type.charAt(0).toUpperCase() + type.substr(1, type.length - 1);\n var target = parentIframe.contentWindow.document.getElementById(typeId).getElementsByClassName('emptyGadget')[0];\n var contents = parentIframe.contentWindow.document.createElement('div');\n contents.setAttribute('class', 'gadget');\n contents.innerHTML = caption+'(<a href=\\'#\\' onclick=\\'dropNewGadget(\"'+type+'\", \"'+id+'\", this.parentNode); return false;\\'>" . __('削除') . "</a>)';\n new Insertion.Before(target, contents);\n\n var form = parent.document.getElementById('gadgetForm');\n var hidden = parent.document.createElement('input');\n hidden.setAttribute('class', type + 'New');\n hidden.setAttribute('type', 'hidden');\n hidden.setAttribute('name', 'new[' + type + '][]');\n hidden.setAttribute('value', id);\n new Insertion.Bottom(form, hidden);\n\n parentIframe.contentWindow.parent.adjustByIframeContens(parentIframe);\n}\n");
?>
<dl>
<?php
if ($config) {
foreach ($config as $key => $value) {
?>
<dt>
<?php
echo __($value['caption']['ja_JP']);
?>
<br />
<?php
echo link_to_function(__('このガジェットを追加する'), 'insertGadget(\'' . $type . '\', \'' . escape_javascript($key) . '\', \'' . escape_javascript(__($value['caption']['ja_JP'])) . '\')');
?>
</dt>
<dd><?php
echo __($value['description']['ja_JP']);
?>
</dd>
<?php
}
} else {
?>
<dt><?php
echo __('ガジェットがありません');
?>
</dt>
<dd><?php
示例12: outputSearchForm
//.........这里部分代码省略.........
$logtype_options .= '<option value="' . htmlspecialchars($record['id'], ENT_COMPAT, 'UTF-8') . '">' . htmlspecialchars($record['name'], ENT_COMPAT, 'UTF-8') . '</option>';
}
$logtype_options .= "\n";
}
tpl_set_var('logtype_options', $logtype_options);
// cache-attributes
$attributes_jsarray = '';
$bBeginLine2 = true;
$nPrevLineAttrCount2 = 0;
$nLineAttrCount2 = 0;
$attributes_img2 = '';
/* perpare 'all attributes' */
$rsAttrGroup = sql("SELECT `attribute_groups`.`id`, IFNULL(`sys_trans_text`.`text`, `attribute_groups`.`name`) AS `name`, `attribute_categories`.`color` FROM `attribute_groups` INNER JOIN `attribute_categories` ON `attribute_groups`.`category_id`=`attribute_categories`.`id` LEFT JOIN `sys_trans` ON `attribute_groups`.`trans_id`=`sys_trans`.`id` AND `sys_trans`.`text`=`attribute_groups`.`name` LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND `sys_trans_text`.`lang`='&1' ORDER BY `attribute_groups`.`category_id` ASC, `attribute_groups`.`id` ASC", $locale);
while ($rAttrGroup = sql_fetch_assoc($rsAttrGroup)) {
$group_line = '';
$rs = sql("SELECT `cache_attrib`.`id`, IFNULL(`ttname`.`text`, `cache_attrib`.`name`) AS `name`, `cache_attrib`.`icon_large`, `cache_attrib`.`icon_no`, `cache_attrib`.`icon_undef`, `cache_attrib`.`search_default`, IFNULL(`ttdesc`.`text`, `cache_attrib`.`html_desc`) AS `html_desc`\n\t\t FROM `cache_attrib` \n\t\t LEFT JOIN `sys_trans` AS `tname` ON `cache_attrib`.`trans_id`=`tname`.`id` AND `cache_attrib`.`name`=`tname`.`text`\n\t\t LEFT JOIN `sys_trans_text` AS `ttname` ON `tname`.`id`=`ttname`.`trans_id` AND `ttname`.`lang`='&1'\n\t\t LEFT JOIN `sys_trans` AS `tdesc` ON `cache_attrib`.`html_desc_trans_id`=`tdesc`.`id` AND `cache_attrib`.`html_desc`=`tdesc`.`text`\n\t\t LEFT JOIN `sys_trans_text` AS `ttdesc` ON `tdesc`.`id`=`ttdesc`.`trans_id` AND `ttdesc`.`lang`='&1'\n\t\t WHERE `cache_attrib`.`group_id`='&2'\n\t\t\t\t\t AND NOT IFNULL(`cache_attrib`.`hidden`, 0)=1\n\t\t ORDER BY `cache_attrib`.`id`", $locale, $rAttrGroup['id']);
while ($record = sql_fetch_array($rs)) {
// icon specified
$line = $cache_attrib_jsarray_line;
$line = mb_ereg_replace('{id}', $record['id'], $line);
if (!isset($options['cache_attribs'])) {
$line = mb_ereg_replace('{state}', 0, $line);
} else {
if (array_search($record['id'], $options['cache_attribs']) === false) {
if (array_search($record['id'], $options['cache_attribs_not']) === false) {
$line = mb_ereg_replace('{state}', 0, $line);
} else {
$line = mb_ereg_replace('{state}', 2, $line);
}
} else {
$line = mb_ereg_replace('{state}', 1, $line);
}
}
$line = mb_ereg_replace('{text_long}', escape_javascript($record['name']), $line);
$line = mb_ereg_replace('{icon}', $record['icon_large'], $line);
$line = mb_ereg_replace('{icon_no}', $record['icon_no'], $line);
$line = mb_ereg_replace('{icon_undef}', $record['icon_undef'], $line);
$line = mb_ereg_replace('{search_default}', $record['search_default'], $line);
if ($attributes_jsarray != '') {
$attributes_jsarray .= ",\n";
}
$attributes_jsarray .= $line;
$line = $cache_attrib_img_line1;
$line = mb_ereg_replace('{id}', $record['id'], $line);
$line = mb_ereg_replace('{text_long}', escape_javascript($record['name']), $line);
if (!isset($options['cache_attribs'])) {
$line = mb_ereg_replace('{icon}', $record['icon_undef'], $line);
} else {
if (array_search($record['id'], $options['cache_attribs']) === false) {
if (array_search($record['id'], $options['cache_attribs_not']) === false) {
$line = mb_ereg_replace('{icon}', $record['icon_undef'], $line);
} else {
$line = mb_ereg_replace('{icon}', $record['icon_no'], $line);
}
} else {
$line = mb_ereg_replace('{icon}', $record['icon_large'], $line);
}
}
$line = mb_ereg_replace('{html_desc}', escape_javascript($record['html_desc']), $line);
$line = mb_ereg_replace('{name}', escape_javascript($record['name']), $line);
$line = mb_ereg_replace('{color}', $rAttrGroup['color'], $line);
$group_line .= $line;
$nLineAttrCount2++;
}
sql_free_result($rs);
if ($group_line != '') {
示例13: pagination_limit_select
/**
* Paging html functions
* @todo Document this API
*/
function pagination_limit_select($object_name_or_object, $options = array())
{
$html = "";
if (is_object($object_name_or_object)) {
$object = $object_name_or_object;
} else {
$object = $this->object($object_name_or_object);
}
if (!is_object($object)) {
return null;
}
if ($object->pages > 0) {
$base_url = isset($options['base_url']) ? $options['base_url'] : '';
$update = isset($options['update']) ? $options['update'] : '';
$extra_params = isset($options['extra_params']) ? "&" . $options['extra_params'] : ($object->paging_extra_params ? "&" . $object->paging_extra_params : '');
$default_text = isset($options['default_text']) ? $options['default_text'] : "per page:";
if ($update && $base_url) {
$on_change = remote_function(array("update" => $update, "url" => "{$base_url}?per_page=' + this.options[this.selectedIndex].value + '" . escape_javascript($extra_params) . "'"));
} else {
$on_change = "document.location = '{$base_url}?per_page=' + this.options[this.selectedIndex].value + '" . escape_javascript($extra_params) . "'";
}
$html .= "\n <select name=\"per_page\" onChange=\"{$on_change}\">\n <option value=\"{$object->rows_per_page}\" selected>{$default_text}</option>\n <option value=10>10</option>\n <option value=20>20</option>\n <option value=50>50</option>\n <option value=100>100</option>\n <option value=200>200</option>\n <option value=999999999>ALL</option>\n </select>\n ";
}
return $html;
}
示例14: _escape_body
function _escape_body()
{
$result = ob_get_contents();
ob_end_clean();
$htmlEscape = _tag_get_attribute('escape_body', 'htmlEscape');
$jsEscape = _tag_get_attribute('escape_body', 'jsEscape');
if (is_null($jsEscape) || !is_bool($jsEscape)) {
$jsEscape = false;
}
if ($jsEscape == true) {
$result = escape_javascript($result);
}
if ($htmlEscape == true) {
$result = specialchars($result);
}
return $result;
}
示例15: remote_function
function remote_function($options)
{
$obj =& get_instance();
$obj->response->enqueue_js('prototype');
$javascript_options = _options_for_ajax($options);
$update = '';
if (isset($options['update']) && is_array($options['update'])) {
$update = array();
if (isset($options['update']['success'])) {
$update[] = "success:'" . $options['update']['success'] . "'";
}
if (isset($options['update']['failure'])) {
$update[] = "failure:'" . $options['update']['failure'] . "'";
}
$update = '{' . join(',', $update) . '}';
} else {
if (isset($options['update'])) {
$update .= "'" . $options['update'] . "'";
}
}
$function = !$update ? "new Ajax.Request(" : "new Ajax.Updater({$update}, ";
$function .= '\'' . system_url($options['url']) . '\'';
$function .= ', ' . $javascript_options . ')';
if (isset($options['before'])) {
$function = $options['before'] . '; ' . $function;
}
if (isset($options['after'])) {
$function = $function . '; ' . $options['after'];
}
if (isset($options['condition'])) {
$function = 'if (' . $options['condition'] . ') { ' . $function . '; }';
}
if (isset($options['confirm'])) {
$function = "if (confirm('" . escape_javascript($options['confirm']) . "')) { {$function}; }";
if (isset($options['cancel'])) {
$function = $function . ' else { ' . $options['cancel'] . ' }';
}
}
return $function;
}