本文整理汇总了PHP中icl_js_escape函数的典型用法代码示例。如果您正苦于以下问题:PHP icl_js_escape函数的具体用法?PHP icl_js_escape怎么用?PHP icl_js_escape使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了icl_js_escape函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: js_scripts_setup
function js_scripts_setup()
{
//TODO: move javascript to external resource (use wp_localize_script() to pass arguments)
global $pagenow, $wpdb;
$default_language = $this->get_default_language();
$current_language = $this->get_current_language();
if (isset($_GET['page'])) {
$page = basename($_GET['page']);
$page_basename = str_replace('.php', '', $page);
} else {
$page_basename = false;
}
$icl_ajax_url_root = rtrim(get_site_url(), '/');
if (defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN) {
$icl_ajax_url_root = str_replace('http://', 'https://', $icl_ajax_url_root);
}
$icl_ajax_url = $icl_ajax_url_root . '/wp-admin/admin.php?page=' . ICL_PLUGIN_FOLDER . '/menu/languages.php';
?>
<script type="text/javascript">
// <![CDATA[
var icl_ajx_url;
icl_ajx_url = '<?php
echo $icl_ajax_url;
?>
';
var icl_ajx_saved = '<?php
echo icl_js_escape(__('Data saved', 'sitepress'));
?>
';
var icl_ajx_error = '<?php
echo icl_js_escape(__('Error: data not saved', 'sitepress'));
?>
';
var icl_default_mark = '<?php
echo icl_js_escape(__('default', 'sitepress'));
?>
';
var icl_this_lang = '<?php
echo $this->this_lang;
?>
';
var icl_ajxloaderimg_src = '<?php
echo ICL_PLUGIN_URL;
?>
/res/img/ajax-loader.gif';
var icl_cat_adder_msg = '<?php
echo icl_js_escape(sprintf(__('To add categories that already exist in other languages go to the <a%s>category management page</a>', 'sitepress'), ' href="' . admin_url('edit-tags.php?taxonomy=category') . '"'));
?>
';
// ]]>
<?php
if (!$this->get_setting('ajx_health_checked')) {
?>
addLoadEvent(function () {
jQuery.ajax({type: "POST", url: icl_ajx_url, data: "icl_ajx_action=health_check", error: function (msg) {
var icl_initial_language = jQuery('#icl_initial_language');
if (icl_initial_language.length) {
icl_initial_language.find('input').attr('disabled', 'disabled');
}
jQuery('.wrap').prepend('<div class="error"><p><?php
echo icl_js_escape(sprintf(__("WPML can't run normally. There is an installation or server configuration problem. %sShow details%s", 'sitepress'), '<a href="#" onclick="jQuery(this).parent().next().slideToggle()">', '</a>'));
?>
</p><p style="display:none"><?php
echo icl_js_escape(__('AJAX Error:', 'sitepress'));
?>
' + msg.statusText + ' [' + msg.status + ']<br />URL:' + icl_ajx_url + '</p></div>');
}});
});
<?php
}
?>
</script>
<?php
if ('options-reading.php' == $pagenow) {
list($warn_home, $warn_posts) = $this->verify_home_and_blog_pages_translations();
if ($warn_home || $warn_posts) {
?>
<script type="text/javascript">
addLoadEvent(function () {
jQuery('input[name="show_on_front"]').parent().parent().parent().parent().append('<?php
echo str_replace("'", "\\'", $warn_home . $warn_posts);
?>
');
});
</script>
<?php
}
}
// display correct links on the posts by status break down
// also fix links to category and tag pages
if (('edit.php' == $pagenow || 'edit-pages.php' == $pagenow || 'categories.php' == $pagenow || 'edit-tags.php' == $pagenow) && $current_language != $default_language) {
?>
<script type="text/javascript">
addLoadEvent(function () {
jQuery('.subsubsub li a').each(function () {
var h = jQuery(this).attr('href');
var urlg;
if (-1 == h.indexOf('?')) urlg = '?'; else urlg = '&';
jQuery(this).attr('href', h + urlg + 'lang=<?php
//.........这里部分代码省略.........
示例2: js_scripts
function js_scripts()
{
?>
<script type="text/javascript">
addLoadEvent(function(){
jQuery('#alp_re_scan_but').click(alp_toogle_scan);
jQuery('#alp_re_scan_but_all').click(alp_reset_scan_flags);
jQuery('.alp_use_sug').click(alp_use_suggestion);
jQuery('#alp_revert_urls').click(alp_do_revert_urls);
});
var alp_scan_started = false;
var req_timer = 0;
function alp_toogle_scan(){
if(!alp_scan_started){
alp_send_request(0);
jQuery('#alp_ajx_ldr_1').fadeIn();
jQuery('#alp_re_scan_but').attr('value','<?php
echo icl_js_escape(__('Running', 'sitepress'));
?>
');
}else{
jQuery('#alp_re_scan_but').attr('value','<?php
echo icl_js_escape(__('Scan', 'sitepress'));
?>
');
window.clearTimeout(req_timer);
jQuery('#alp_ajx_ldr_1').fadeOut();
location.reload();
}
alp_scan_started = !alp_scan_started;
return false;
}
function alp_send_request(offset){
jQuery.ajax({
type: "POST",
url: "<?php
echo htmlentities($_SERVER['REQUEST_URI']);
?>
",
data: "alp_ajx_action=rescan&offset="+offset,
success: function(msg){
if(-1==msg || msg==0){
left = '0';
alp_toogle_scan();
}else{
left=msg;
}
if(left=='0'){
jQuery('#alp_re_scan_but').attr('disabled','disabled');
}
jQuery('#alp_re_scan_toscan').html(left);
if(alp_scan_started){
req_timer = window.setTimeout(alp_send_request,3000,offset);
}
}
});
}
function alp_reset_scan_flags(){
if(alp_scan_started) return;
alp_scan_started = false;
jQuery('#alp_re_scan_but').removeAttr('disabled');
jQuery.ajax({
type: "POST",
url: "<?php
echo htmlentities($_SERVER['REQUEST_URI']);
?>
",
data: "alp_ajx_action=rescan_reset",
success: function(msg){
if(msg){
alp_toogle_scan()
}
}
});
}
function alp_use_suggestion(){
jqthis = jQuery(this);
jqthis.parent().parent().css('background-color','#eee');
spl = jqthis.attr('id').split('_');
sug_id = spl[3];
post_id = spl[4];
orig_url = jQuery('#alp_bl_'+spl[5]).html();
jQuery.ajax({
type: "POST",
url: "<?php
echo htmlentities($_SERVER['REQUEST_URI']);
?>
",
data: "alp_ajx_action=use_suggestion&sug_id="+sug_id+"&post_id="+post_id+"&orig_url="+orig_url,
success: function(msg){
spl = msg.split('|');
jqthis.parent().html('<?php
echo icl_js_escape(__('fixed', 'sitepress'));
?>
- ' + spl[1]);
//.........这里部分代码省略.........
示例3: js_scripts
function js_scripts()
{
global $pagenow;
if ($pagenow == 'media.php') {
?>
<script type="text/javascript">
addLoadEvent(function(){
jQuery('#icl_lang_options').insertBefore(jQuery('#post_id'));
jQuery('#icl_lang_options').fadeIn();
});
</script>
<?php
}
if (isset($_GET['page']) && $_GET['page'] == 'wpml-media') {
?>
<script type="text/javascript">
addLoadEvent(function(){
jQuery('#wpml_media_re_scan_but').click(wpml_media_re_scan);
jQuery('#wpml_media_re_scan_all_but').click(wpml_media_re_scan_all);
jQuery('#wpml_media_feature_image_but').click(wpml_media_feature_image_scan)
});
var wpml_media_scan_started = false;
var req_timer = 0;
function wpml_media_toogle_scan(action){
action = typeof(action) != 'undefined' ? action : 'rescan';
if(!wpml_media_scan_started){
wpml_media_send_request(action);
jQuery('#wpml_media_ajx_ldr_1').fadeIn();
jQuery('#wpml_media_re_scan_but').attr('value','<?php
echo icl_js_escape(__('Running', 'wpml-media'));
?>
');
jQuery('#wpml_media_re_scan_all_but').attr('value','<?php
echo icl_js_escape(__('Running', 'wpml-media'));
?>
');
}else{
jQuery('#wpml_media_re_scan_but').attr('value','<?php
echo icl_js_escape(__('Scan and duplicate attachments', 'wpml-media'));
?>
');
jQuery('#wpml_media_re_scan_all_but').attr('value','<?php
echo icl_js_escape(__('Scan All', 'wpml-media'));
?>
');
window.clearTimeout(req_timer);
jQuery('#wpml_media_ajx_ldr_1').fadeOut();
location.reload();
}
wpml_media_scan_started = !wpml_media_scan_started;
return false;
}
function wpml_media_send_request(action){
jQuery.ajax({
type: "POST",
url: "<?php
echo htmlentities($_SERVER['REQUEST_URI']);
?>
",
data: "wpml_media_ajx_action=" + action,
success: function(msg){
if(-1==msg || msg==0){
left = '0';
wpml_media_toogle_scan();
}else{
left=msg;
}
jQuery('#wpml_media_re_scan_toscan').html(left);
if(wpml_media_scan_started){
req_timer = window.setTimeout('wpml_media_send_request("rescan")', 1000);
}
}
});
}
function wpml_media_re_scan(){
wpml_media_toogle_scan("rescan");
}
function wpml_media_re_scan_all(){
wpml_media_toogle_scan("rescan_all");
}
function wpml_media_feature_image_scan(){
jQuery('#wpml_media_result').fadeOut();
jQuery('#wpml_media_ajx_ldr_2').fadeIn();
jQuery('#wpml_media_feature_image_but').attr('value','<?php
echo icl_js_escape(__('Running', 'wpml-media'));
?>
');
jQuery.ajax({
type: "POST",
url: "<?php
echo htmlentities($_SERVER['REQUEST_URI']);
?>
//.........这里部分代码省略.........
示例4: icl_js_escape
<?php
require_once ICL_PLUGIN_PATH . '/sitepress.php';
$sitepress_settings = $sitepress->get_settings();
$cms_navigation_settings = $sitepress_settings['modules']['cms-navigation'];
$sitepress->noscript_notice();
?>
<script type="text/javascript">
var icl_ajx_cache_cleared = '<?php
echo icl_js_escape(__('The cache has been cleared.', 'sitepress'));
?>
';
</script>
<div class="wrap">
<div id="icon-options-general" class="icon32 icon32_adv"><br /></div>
<h2><?php
echo __('Setup WPML', 'sitepress');
?>
</h2>
<h3><?php
echo __('Navigation', 'sitepress');
?>
</h3>
<p><?php
echo __('Out-of-the-box support for full CMS navigation in your WordPress site including drop down menus, breadcrumbs trail and sidebar navigation.', 'sitepress');
?>
</p>
示例5: wpml_js_scripts_setup
public function wpml_js_scripts_setup()
{
//TODO: [WPML 3.3] move javascript to external resource (use wp_localize_script() to pass arguments)
global $pagenow, $sitepress;
$default_language = $this->sitepress->get_default_language();
$current_language = $this->sitepress->get_current_language();
$page_basename = $this->page;
$this->print_js_globals();
$wpml_script_setup_args['default_language'] = $default_language;
$wpml_script_setup_args['current_language'] = $current_language;
do_action('wpml_scripts_setup', $wpml_script_setup_args);
if ('options-reading.php' === $pagenow) {
$this->print_reading_options_js();
} elseif (in_array($pagenow, array('categories.php', 'edit-tags.php'), true) && $current_language !== $default_language) {
$this->correct_status_links_js($current_language);
}
if ('edit-tags.php' === $pagenow) {
?>
<script type="text/javascript">
addLoadEvent(function () {
var edit_tag = jQuery('#edittag');
if (edit_tag.find('[name="_wp_original_http_referer"]').length && edit_tag.find('[name="_wp_http_referer"]').length) {
edit_tag.find('[name="_wp_original_http_referer"]').val('<?php
$post_type = isset($_GET['post_type']) ? '&post_type=' . esc_html($_GET['post_type']) : '';
echo admin_url('edit-tags.php?taxonomy=' . esc_js($_GET['taxonomy']) . '&lang=' . $current_language . '&message=3' . $post_type);
?>
');
}
});
</script>
<?php
}
$trid = filter_input(INPUT_GET, 'trid', FILTER_SANITIZE_NUMBER_INT);
$source_lang = $trid !== null ? filter_input(INPUT_GET, 'source_lang', FILTER_SANITIZE_FULL_SPECIAL_CHARS) : null;
if ('post-new.php' === $pagenow) {
if ($trid) {
$translations = $this->post_translations->get_element_translations(false, $trid);
remove_filter('pre_option_sticky_posts', array($sitepress, 'option_sticky_posts'));
// remove filter used to get language relevant stickies. get them all
$sticky_posts = get_option('sticky_posts');
add_filter('pre_option_sticky_posts', array($sitepress, 'option_sticky_posts'), 10, 2);
// add filter back
$is_sticky = false;
foreach ($translations as $t) {
if (in_array($t, $sticky_posts)) {
$is_sticky = true;
break;
}
}
if ($this->sitepress->get_setting('sync_ping_status') || $this->sitepress->get_setting('sync_comment_status')) {
$this->print_ping_and_comment_sync_js($trid, $source_lang);
}
if ('private' === $this->post_translations->get_original_post_status($trid, $source_lang)) {
?>
<script type="text/javascript">addLoadEvent(function () {
jQuery('#visibility-radio-private').attr('checked', 'checked');
jQuery('#post-visibility-display').html('<?php
echo icl_js_escape(__('Private', 'sitepress'));
?>
');
});
</script><?php
}
if ($this->sitepress->get_setting('sync_post_taxonomies')) {
$this->print_tax_sync_js();
}
$custom_field_note = new WPML_Sync_Custom_Field_Note($this->sitepress);
$custom_field_note->print_sync_copy_custom_field_note($source_lang, $translations);
}
?>
<?php
if (!empty($is_sticky) && $this->sitepress->get_setting('sync_sticky_flag')) {
?>
<script type="text/javascript">
addLoadEvent(
function () {
jQuery('#sticky').attr('checked', 'checked');
var post_visibility_display = jQuery('#post-visibility-display');
post_visibility_display.html(post_visibility_display.html() + ', <?php
echo icl_js_escape(__('Sticky', 'sitepress'));
?>
');
});
</script>
<?php
}
?>
<?php
}
if (('page-new.php' === $pagenow || 'post-new.php' === $pagenow && isset($_GET['post_type'])) && ($trid && ($this->sitepress->get_setting('sync_page_template') || $this->sitepress->get_setting('sync_page_ordering')))) {
$this->print_mo_sync_js($trid, $source_lang);
}
if ($this->sitepress->is_post_edit_screen() && $this->sitepress->get_setting('sync_post_date')) {
$this->print_sync_date_js();
}
if ('post-new.php' === $pagenow && isset($_GET['trid']) && $sitepress->get_setting('sync_post_format') && function_exists('get_post_format')) {
$format = $this->post_translations->get_original_post_format($trid, $source_lang);
?>
<script type="text/javascript">
addLoadEvent(function () {
//.........这里部分代码省略.........
示例6: js_scripts_setup
function js_scripts_setup()
{
global $pagenow, $wpdb;
if (isset($_GET['page'])) {
$page = basename($_GET['page']);
$page_basename = str_replace('.php', '', $page);
}
?>
<script type="text/javascript">
// <![CDATA[
<?php
if (defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN) {
?>
var icl_ajx_url = '<?php
echo str_replace('http://', 'https://', rtrim(get_option('siteurl'), '/')) . '/wp-admin/';
?>
admin.php?page=<?php
echo ICL_PLUGIN_FOLDER;
?>
/menu/languages.php';
<?php
} else {
?>
var icl_ajx_url = '<?php
echo rtrim(get_option('siteurl'), '/') . '/wp-admin/';
?>
admin.php?page=<?php
echo ICL_PLUGIN_FOLDER;
?>
/menu/languages.php';
<?php
}
?>
var icl_ajx_saved = '<?php
echo icl_js_escape(__('Data saved', 'sitepress'));
?>
';
var icl_ajx_error = '<?php
echo icl_js_escape(__('Error: data not saved', 'sitepress'));
?>
';
var icl_default_mark = '<?php
echo icl_js_escape(__('default', 'sitepress'));
?>
';
var icl_this_lang = '<?php
echo $this->this_lang;
?>
';
var icl_ajxloaderimg_src = '<?php
echo ICL_PLUGIN_URL;
?>
/res/img/ajax-loader.gif';
var icl_cat_adder_msg = '<?php
echo icl_js_escape(__('To add categories that already exist in other languages go to the <a href="edit-tags.php?taxonomy=category">category management page<\\/a>', 'sitepress'));
?>
';
// ]]>
<?php
if (!$this->settings['ajx_health_checked']) {
?>
addLoadEvent(function(){
jQuery.ajax({type: "POST",url: icl_ajx_url,data: "icl_ajx_action=health_check", error: function(msg){
if(jQuery('#icl_initial_language').length){
jQuery('#icl_initial_language input').attr('disabled', 'disabled');
}
jQuery('.wrap').prepend('<div class="error"><p><?php
echo icl_js_escape(sprintf(__("WPML can't run normally. There is an installation or server configuration problem. %sShow details%s", 'sitepress'), '<a href="#" onclick="jQuery(this).parent().next().slideToggle()">', '</a>'));
?>
</p><p style="display:none"><?php
echo icl_js_escape(__('AJAX Error:', 'sitepress'));
?>
' + msg.statusText + ' ['+msg.status+']<br />URL:'+ icl_ajx_url +'</p></div>');
}});
});
<?php
}
?>
</script>
<?php
wp_enqueue_script('sitepress-scripts', ICL_PLUGIN_URL . '/res/js/scripts.js', array(), ICL_SITEPRESS_VERSION);
if (isset($page_basename) && file_exists(ICL_PLUGIN_PATH . '/res/js/' . $page_basename . '.js')) {
wp_enqueue_script('sitepress-' . $page_basename, ICL_PLUGIN_URL . '/res/js/' . $page_basename . '.js', array(), ICL_SITEPRESS_VERSION);
}
if ('options-reading.php' == $pagenow) {
list($warn_home, $warn_posts) = $this->verify_home_and_blog_pages_translations();
if ($warn_home || $warn_posts) {
?>
<script type="text/javascript">
addLoadEvent(function(){
jQuery('input[name="show_on_front"]').parent().parent().parent().parent().append('<?php
echo str_replace("'", "\\'", $warn_home . $warn_posts);
?>
');
});
</script>
<?php
}
//.........这里部分代码省略.........
示例7: cms_navigation_js
function cms_navigation_js()
{
?>
<script type="text/javascript">
addLoadEvent(function(){
jQuery('#cms_nav_add_section').click(cms_nav_switch_adding_section);
});
function cms_nav_switch_adding_section(){
if('none'==jQuery("select[name='cms_nav_section']").css('display')){
jQuery("select[name='cms_nav_section']").show();
jQuery("input[name='cms_nav_section_new']").hide();
jQuery("input[name='cms_nav_section_new']").attr('value','');
jQuery(this).html('<?php
echo icl_js_escape(__('enter new', 'sitepress'));
?>
');
}else{
jQuery("select[name='cms_nav_section']").hide();
jQuery("input[name='cms_nav_section_new']").show();
jQuery(this).html('<?php
echo icl_js_escape(__('cancel', 'sitepress'));
?>
');
}
}
</script>
<?php
}
示例8: wpml_js_scripts_setup
//.........这里部分代码省略.........
} else {
?>
comment_status.removeAttr('checked');
<?php
}
?>
<?php
}
?>
<?php
if ($sitepress->get_setting('sync_ping_status')) {
?>
<?php
if ($wpml_post_translations->get_original_ping_status($trid, $source_lang) === 'open') {
?>
ping_status.attr('checked', 'checked');
<?php
} else {
?>
ping_status.removeAttr('checked');
<?php
}
?>
<?php
}
?>
});</script><?php
}
if ('private' === $wpml_post_translations->get_original_post_status($trid, $source_lang)) {
?>
<script type="text/javascript">addLoadEvent(function () {
jQuery('#visibility-radio-private').attr('checked', 'checked');
jQuery('#post-visibility-display').html('<?php
echo icl_js_escape(__('Private', 'sitepress'));
?>
');
});
</script><?php
}
if ($sitepress->get_setting('sync_post_taxonomies')) {
$post_type = isset($_GET['post_type']) ? $_GET['post_type'] : 'post';
$source_lang = isset($_GET['source_lang']) ? filter_input(INPUT_GET, 'source_lang', FILTER_SANITIZE_FULL_SPECIAL_CHARS) : $default_language;
$translatable_taxs = $sitepress->get_translatable_taxonomies(true, $post_type);
$all_taxs = get_object_taxonomies($post_type);
$translations = $sitepress->get_element_translations($_GET['trid'], 'post_' . $post_type);
$js = array();
if (!empty($all_taxs)) {
foreach ($all_taxs as $tax) {
$tax_detail = get_taxonomy($tax);
$terms = get_the_terms($translations[$source_lang]->element_id, $tax);
$term_names = array();
if ($terms) {
foreach ($terms as $term) {
if ($tax_detail->hierarchical) {
$term_id = in_array($tax, $translatable_taxs) ? icl_object_id($term->term_id, $tax, false) : $term->term_id;
$js[] = "jQuery('#in-" . $tax . "-" . $term_id . "').attr('checked', 'checked');";
} else {
if (in_array($tax, $translatable_taxs)) {
$term_id = icl_object_id($term->term_id, $tax, false);
if ($term_id) {
$term = get_term($term_id, $tax);
$term_names[] = esc_js($term->name);
}
} else {
$term_names[] = esc_js($term->name);
}