本文整理汇总了PHP中vB_Template_Runtime::escapeJS方法的典型用法代码示例。如果您正苦于以下问题:PHP vB_Template_Runtime::escapeJS方法的具体用法?PHP vB_Template_Runtime::escapeJS怎么用?PHP vB_Template_Runtime::escapeJS使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vB_Template_Runtime
的用法示例。
在下文中一共展示了vB_Template_Runtime::escapeJS方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAlbums
public static function getAlbums($userinfo)
{
if (!$userinfo) {
return false;
}
//execute the query
$albums = vB_dB_Assertor::instance()->assertQuery('CustomProfileAlbums', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_STORED, 'userid' => $userinfo['userid']), 'title ASC');
//if we have no results, there's nothing we can do.
if (!$albums or !$albums->valid()) {
return false;
}
//the format of the returned array is
//{albums => {album records}, {content => string(rendered template for content}}
//first let's get the albums
$response = '{"albums":{' . "\n";
while ($albums->valid()) {
$album = $albums->current();
$fieldvals = array();
foreach ($album as $field => $value) {
$fieldvals[] = "\"{$field}\":\"" . vB_Template_Runtime::escapeJS($value) . '"';
}
$response .= '"' . $album['albumid'] . '":{' . implode(",\n", $fieldvals) . "}";
}
$response = "}\n";
//Now let's get the page contents.
}
示例2: getInlineEditBodyView
//.........这里部分代码省略.........
'pub_date' => (intval($content_node->getPublishDate()) ? vbdate(vB::$vbulletin->options['dateformat'], $content_node->getPublishDate()) : '') ,
'viewcount' => $content_node->getViewCount(),
'view_url' => vBCms_Route_Content::getURL(array('node' => $content_node->getUrlSegment())),
'replycount' => $content_node->getReplyCount());
}
}
if (vB::$vbulletin->GPC_exists['item_count'])
{
$item_count = vB::$vbulletin->GPC['item_count'];
}
else
{
$aggregate->filterNoSections(1);
$item_count = $aggregate->getCount();
}
$segments = array('node' => $this->content->getUrlSegment(),
'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'View'));
$view->view_url = vBCms_Route_Content::getURL($segments);
$segments = array('node' => $this->content->getUrlSegment(),
'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'EditPage'));
$view->submit_url = vBCms_Route_Content::getURL($segments);
$base_url = $view->submit_url;
$base_url .= strpos($base_url, '?') ? '&' : '?';
$view->record_count = count($aggregate);
$view->item_count = $item_count;
$pagination = construct_page_nav($current_page, $perpage, $item_count, $view->submit_url);
$view->pagination = $pagination;
$perpage_select .= '<select name="perpage" onchange="checkShouldSave(\'' .
$view->formid . '\', \'perpage\', \'' . vB_Template_Runtime::escapeJS(new vB_Phrase('cpcms', 'confirm_save_section')) .
'\', \'' . vB_Template_Runtime::escapeJS($view->submit_url) . '\');">' . "\n";
foreach (array(5,10,15,20,25,50,75,100,200, 250, 500) as $this_perpage)
{
$perpage_select .= "<option value=\"$this_perpage\""
. (intval($this_perpage) == intval($perpage) ? ' selected="selected" ' : '')
. ">$this_perpage</option>\n" ;
}
$perpage_select .= "</select>";
$view->perpage_select = $perpage_select;
$record = vB::$vbulletin->db->query_first("SELECT SUM(childinfo.viewcount) AS viewcount,
SUM(CASE when child.contenttypeid <> " . vb_Types::instance()->getContentTypeID("vBCms_Section") ." THEN 1 ELSE 0 END) AS content,
SUM(CASE when (child.parentnode = node.nodeid AND child.contenttypeid <> " . vb_Types::instance()->getContentTypeID("vBCms_Section") .") THEN 1 ELSE 0 END) AS children,
SUM(CASE when child.contenttypeid =" . vb_Types::instance()->getContentTypeID("vBCms_Section") ." AND child.parentnode = node.nodeid THEN 1 ELSE 0 END) AS subsections
FROM " . TABLE_PREFIX . "cms_node AS node
LEFT JOIN " . TABLE_PREFIX . "cms_node AS child ON (child.nodeleft >= node.nodeleft AND child.nodeleft <= node.noderight AND child.nodeid <> node.nodeid AND child.new != 1)
LEFT JOIN " . TABLE_PREFIX . "cms_nodeinfo AS childinfo ON childinfo.nodeid = child.nodeid AND child.contenttypeid <> " . vb_Types::instance()->getContentTypeID("vBCms_Section") ."
WHERE node.nodeid = " . $this->content->getNodeId());
$view->viewcount = $record['viewcount'];
$view->content = $record['content'];
$view->children = $record['children'];
$view->subsections = $record['subsections'];
$view->nodes = $nodes;
$view->metadata = $this->content->getMetadataEditor();
//Here we create some url's. This should allow to sort in reverse direction
$view->sorttitle_url = $base_url . 'sortby=title&dir=' .
((vB::$vbulletin->GPC_exists['sortby'] AND vB::$vbulletin->GPC['sortby'] == 'title'
AND vB::$vbulletin->GPC['dir'] == 'asc') ? 'desc' : 'asc');
示例3:
$template->register('content_text_color', $usertheme['content_text_color']);
$template->register('content_link_color', $usertheme['content_link_color']);
$template->register('content_border', $usertheme['content_border']);
$template->register('button_text_color', $usertheme['button_text_color']);
$template->register('button_border', $usertheme['button_border']);
$template->register('moduleinactive_text_color', $usertheme['moduleinactive_text_color']);
$template->register('moduleinactive_link_color', $usertheme['moduleinactive_link_color']);
$template->register('moduleinactive_border', $usertheme['moduleinactive_border']);
$template->register('headers_text_color', $usertheme['headers_text_color']);
$template->register('headers_link_color', $usertheme['headers_link_color']);
$template->register('headers_border', $usertheme['headers_border']);
$template->register('page_link_color', $usertheme['page_link_color']);
$template->register('page_background', (empty($usertheme['page_background_image']) or $usertheme['page_background_image'] == 'none') ? $usertheme['page_background_color'] : $usertheme['page_background_image']);
$template->register('module_background', (empty($usertheme['module_background_image']) or $usertheme['module_background_image'] == 'none') ? $usertheme['module_background_color'] : $usertheme['module_background_image']);
$template->register('content_background', (empty($usertheme['content_background_image']) or $usertheme['content_background_image'] == 'none') ? $usertheme['content_background_color'] : $usertheme['content_background_image']);
$template->register('button_background', (empty($usertheme['button_background_image']) or $usertheme['button_background_image'] == 'none') ? $usertheme['button_background_color'] : $usertheme['button_background_image']);
$template->register('moduleinactive_background', (empty($usertheme['moduleinactive_background_image']) or $usertheme['moduleinactive_background_image'] == 'none') ? $usertheme['moduleinactive_background_color'] : $usertheme['moduleinactive_background_image']);
$template->register('headers_background', (empty($usertheme['headers_background_image']) or $usertheme['headers_background_image'] == 'none') ? $usertheme['headers_background_color'] : $usertheme['headers_background_image']);
$memberinfo_customize = $template->render();
$page_templater->register('themes_js', $jsblock);
$page_templater->register('memberinfo_customize', $memberinfo_customize);
$page_templater->register('timenow', TIMENOW);
$page_templater->register('posthash', vB_Template_Runtime::escapeJS(md5(TIMENOW . $vbulletin->userinfo['userid'] . $vbulletin->userinfo['salt'])));
}
print_output($page_templater->render(false));
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 03:13, Sat Sep 7th 2013
|| # CVS: $RCSfile$ - $Revision: 76891 $
|| ####################################################################
\*======================================================================*/
示例4: fetch_stylevar_input
protected function fetch_stylevar_input($stylevarid, $input_type, $stylevar_value)
{
global $vbphrase;
$vb5_config =& vB::getConfig();
if (!$vb5_config['Misc']['debug']) {
return '';
}
$autocomplete_js = '';
if (self::$need_stylevar_autocomplete_js == true) {
// This relies on GPC['dostyleid']. We're assuming this won't change in a way where you can edit multiple styles at the same time.
$style = fetch_stylevars_array();
$global_groups = array('Global');
$global_stylevars = array();
foreach ($global_groups as $group) {
if (!isset($style[$group])) {
continue;
}
foreach ($style[$group] as $global_stylevarid => $global_stylevar) {
$global_stylevar = unserialize($global_stylevar['value']);
if (empty($global_stylevar)) {
continue;
}
foreach (array_keys($global_stylevar) as $type) {
if (strpos($type, 'stylevar_') === 0) {
continue;
}
$global_stylevars[] = "'" . vB_Template_Runtime::escapeJS($global_stylevarid) . '.' . $type . "'";
}
}
}
$autocomplete_js .= "\n<script type=\"text/javascript\" src=\"" . vB::getDatastore()->getOption('bburl') . "/../js/jquery/jquery-ui-1.8.14.custom.min.js?v=" . SIMPLE_VERSION . "\"></script>\n\r" . '<script type="text/javascript">
//<!--
(function($) {
$(document).ready(function(){
var stylevars = [' . implode(', ', $global_stylevars) . '];
$(".stylevar-autocomplete")
.autocomplete({
source: stylevars,
appendTo: ".stylevar-autocomplete-menu",
minLength: 0
})
.focus(function(){
$(this).autocomplete("search", "");
})
});
})(jQuery);
//-->
</script>
<div class="stylevar-autocomplete-menu"></div>';
self::$need_stylevar_autocomplete_js = false;
}
$stylevar_name = 'stylevar[' . $stylevarid . '][stylevar_' . $input_type . ']';
$stylevar_title_attr = "title=\"name="{$stylevar_name}"\"";
$uniqueid = fetch_uniqueid_counter();
return ' ' . $vbphrase['or_stylevar_part'] . ' ' . "<input name=\"{$stylevar_name}\" id=\"inp_{$stylevar_name}_{$uniqueid}\" class=\"stylevar-autocomplete\" value=\"" . htmlspecialchars_uni($stylevar_value) . "\" " . "tabindex=\"1\" size=\"35\" {$stylevar_title_attr} data-options-id=\"sel_{$stylevar_name}_{$uniqueid}\" />\n" . $autocomplete_js;
}
示例5: listSections
//.........这里部分代码省略.........
<table class=\"tborder\" cellpadding=\"4\" border=\"0\" width=\"100%\" align=\"center\">\n";
$bgclass = fetch_row_bgclass();
$result .= "<tr align=\"center\" class=\"thead\">\n";
$result .= "<td class=\"thead\" width=\"20\">#</td>
<td class=\"thead\" align=\"" . vB_Template_Runtime::fetchStyleVar('left') . "\" width=\"400\"><a href=\"cms_content_admin.php?do=sort&sentfrom=section&sortby=config4.value\" target=\"_self\">" . $vbphrase['title'] . "</a></td>
<td class=\"thead\"><a href=\"cms_content_admin.php?do=sort&sentfrom=section&sortby=setpublish\">" . $vbphrase['published'] . "</a></td>
<td class=\"thead\">" . $vbphrase['content_layout'] . "</td>
<td class=\"thead\"><a href=\"cms_content_admin.php?do=sort&sentfrom=section&sortby=auto_displayorder\" target=\"_self\">" . $vbphrase['display_order'] . "</a></td>
<td class=\"thead\" width=\"50\">" . $vbphrase['records_per_page'] . "</td>
<td class=\"thead\">" . $vbphrase['subsections'] . "</td>
<td class=\"thead\">" . $vbphrase['content'] . "</td>
<td class=\"thead\">" . $vbphrase['viewcount'] . "</td>".
/* <td class=\"thead\">" . $vbphrase['layout'] . "</td>
<td class=\"thead\">" . $vbphrase['style'] . "</td> */
" </tr>";
$sequence = 0;
foreach($sections as $key => $section)
{
$sequence++;
$first_selected_parent_row_class = "";
$change_display_order_buttons = "";
$section_name_prefix = ((vB_Template_Runtime::fetchStyleVar('textdirection') == 'ltr') ?
'>' : '>');
if ($sequence == 1 AND $page == 1)
{
$first_selected_parent_row_class = " class=\"selected_parent_row\"";
$section_name_prefix = "";
}
// for sub-sections, display up or down arrows to change the display order
else
{
$change_display_order_buttons = "<div style=\"float:" . vB_Template_Runtime::fetchStyleVar('left') . "; width:32px;\">";
// dont display up arrow if its already first section in list
if ($sequence > 2 AND isset($sections[$key-1]))
{
$change_display_order_buttons .= "<a style=\"float:" . vB_Template_Runtime::fetchStyleVar('left') . ";\" href=\"javascript:swapSections(".$section['nodeid'].", ".$sections[$key-1]['nodeid'].")\"><img src=\"" . self::getImagePath('imgdir_cms') . "/arrow_up.png\" style=\"border-style:none\" /></a>";
}
// dont display down arrow is its already last section in list
if ($sequence < count($sections) AND isset($sections[$key+1]))
{
$change_display_order_buttons .= "<a style=\"float:right;\" href=\"javascript:swapSections(".$section['nodeid'].", ".$sections[$key+1]['nodeid'].")\"><img src=\"" . self::getImagePath('imgdir_cms') . "/arrow_down.png\" style=\"border-style:none\" /></a>";
}
$change_display_order_buttons .= "</div>";
}
$bgclass = fetch_row_bgclass();
$result .= "<tr" . $first_selected_parent_row_class . " align=\"center\">\n <input type=\"hidden\" name=\"ids[]\" value=\"" .
$section['nodeid'] . "\" />\n";
$result .= " <td class=\"$bgclass\" style=\"font-size:80%;\">$sequence</td>\n";
$result .= " <td align=\"" . vB_Template_Runtime::fetchStyleVar('left') . "\" class=\"$bgclass\" style=\"font-size:80%;width:400px;\"><div class=\"sectionTitleWrapper\" style=\"width:400px;\">
" . $change_display_order_buttons . $section_name_prefix . "<a href=\"./cms_content_admin.php?do=filter§ionid=" . $section['nodeid'] . "&contenttypeid=" .
vb_Types::instance()->getContentTypeID("vBCms_Section") .
"\" target=\"_self\" >" . htmlspecialchars_uni($section['title']) . "</a>
<div style=\"float:" . vB_Template_Runtime::fetchStyleVar('right') . "\">
<a href=\"javascript:showSectionEdit('new_section'," . (intval($section['parentnode']) ? $section['parentnode'] : '0') .
", " . $section['nodeid'] . ",'')\"><img src=\"" . self::getImagePath('imgdir_cms') . "/add_small.png\" style=\"border-style:none\"></a>
<a href=\"javascript:showSectionEdit('save_section',". (intval($section['parentnode']) ? $section['parentnode'] : '0') . ', ' .
$section['nodeid'] . ", '"
. vB_Template_Runtime::escapeJS(htmlspecialchars_uni($section['title'])) . "')\")\"><img src=\"" . self::getImagePath('imgdir_cms') . "/edit_small.png\" style=\"border-style:none\"></a>"
. ((intval($section['nodeid']) != 1 AND intval($section['section_count']) == 0 AND intval($section['item_count']) == 0) ?
"<a href=\"javascript:confirmSectionDelete(" . $section['nodeid'] . ', \'' . vB_Template_Runtime::escapeJS($vbphrase['confirm_deletion']). "');\">
<img src=\"" . self::getImagePath('imgdir_cms') . "/delete_small.png\" style=\"border-style:none\"></a>" : '')
. "
</div>
</div></td>\n";
$result .= " <td class=\"$bgclass\" style=\"font-size:80%;\"><select name=\"state_" .
$section['nodeid']. "\" id=\"state_" . $section['nodeid']. "\"
onchange=\"setFormValue('do', 'saveonesectionstate');
setFormValue('nodeid', " . $section['nodeid']. ");document.getElementById('cms_data').submit();\">" . self::getPublishedSelect(
intval($section['setpublish']), $section['publishdate']) . "</select></td>\n";
$result .= " <td class=\"$bgclass\" style=\"font-size:80%;\"><select id=\"cl_" . $section['nodeid'] . "\" name=\"cl_" . $section['nodeid'] .
"\" onchange=\"setFormValue('do','saveonecl'); setFormValue('nodeid'," . $section['nodeid'] . ");
document.getElementById('cms_data').submit();\">" . self::getContentLayoutSelect($section['content_layoutid']) ;
$result .= " <td class=\"$bgclass\" style=\"font-size:80%;\"><select name=\"sect_pr_" . $section['nodeid'] .
"\" onchange=\"setFormValue('nodeid', " . $section['nodeid']. ");
setFormValue('do', 'sectionpriority');document.getElementById('cms_data').submit();\">\n" .
self::getSectionPrioritySelect($section['priority'], $section['nodeid']) . "</select></td>\n";
$result .= " <td class=\"$bgclass\" style=\"font-size:80%;\">" . self::getSectionPPEdit($section['per_page'], $section['nodeid']) . "</td>\n";
$result .= " <td class=\"$bgclass\" style=\"font-size:80%;\">" . $section['section_count'] . "</td>\n";
$result .= " <td class=\"$bgclass\" style=\"font-size:80%;\">" . $section['item_count'] . "</td>\n";
$result .= " <td class=\"$bgclass\" style=\"font-size:80%;\">" . $section['viewcount'] . "</td>\n";
$result .= "</tr>\n";
}
print_hidden_fields();
$result .= "</table>";
$result .= "</div></td></tr>";
$result .= "</table>\n";
$result .= self::getNav($per_page, $record_count, $page, 'section', 100, 'page', true,
('cms_content_admin.php' . ($sectionid ? "?sectionid=$sectionid" : '')));
global $echoform;
$echoform = false;
$result .= "</form>";
$result .= self::getSectionEditPanel();
return $result;
}
}