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


PHP js_escape函数代码示例

本文整理汇总了PHP中js_escape函数的典型用法代码示例。如果您正苦于以下问题:PHP js_escape函数的具体用法?PHP js_escape怎么用?PHP js_escape使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: googleMap

 public function googleMap($divId = 'map', $options = array(), $attrs = array(), $center = array())
 {
     if (!$center) {
         $center = array('latitude' => (double) get_option('geolocation_default_latitude'), 'longitude' => (double) get_option('geolocation_default_longitude'), 'zoomLevel' => (double) get_option('geolocation_default_zoom_level'));
     }
     if (!array_key_exists('params', $options)) {
         $options['params'] = array();
     }
     if (!array_key_exists('uri', $options)) {
         // This should not be a link to the public side b/c then all the URLs that
         // are generated inside the KML will also link to the public side.
         $options['uri'] = url('geolocation/map.kml');
     }
     if (!array_key_exists('mapType', $options)) {
         $options['mapType'] = get_option('geolocation_map_type');
     }
     if (!array_key_exists('fitMarkers', $options)) {
         $options['fitMarkers'] = (bool) get_option('geolocation_auto_fit_browse');
     }
     $class = 'map geolocation-map';
     if (isset($attrs['class'])) {
         $class .= ' ' . $attrs['class'];
     }
     $options = js_escape($options);
     $center = js_escape($center);
     $varDivId = Inflector::variablize($divId);
     $divAttrs = array_merge($attrs, array('id' => $divId, 'class' => $class));
     $html = '<div ' . tag_attributes($divAttrs) . '></div>';
     $js = "var {$varDivId}" . "OmekaMapBrowse = new OmekaMapBrowse(" . js_escape($divId) . ", {$center}, {$options}); ";
     $html .= "<script type='text/javascript'>{$js}</script>";
     return $html;
 }
开发者ID:regan008,项目名称:WearingGayHistory-Plugins,代码行数:32,代码来源:GoogleMap.php

示例2: dismissed_updates

function dismissed_updates() {
	$dismissed = get_core_updates( array( 'dismissed' => true, 'available' => false ) );
	if ( $dismissed ) {

		$show_text = js_escape(__('Show hidden updates'));
		$hide_text = js_escape(__('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>';
	}
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:26,代码来源:update-core.php

示例3: podpress_print_localized_frontend_js_vars

function podpress_print_localized_frontend_js_vars()
{
    ?>
<script type="text/javascript">
//<![CDATA[
var podpressL10 = {
	openblogagain : '<?php 
    echo js_escape(__('back to:', 'podpress'));
    ?>
',
	theblog : '<?php 
    echo js_escape(__('the blog', 'podpress'));
    ?>
',
	close : '<?php 
    echo js_escape(__('close', 'podpress'));
    ?>
',
	playbutton : '<?php 
    echo js_escape(__('Play &gt;', 'podpress'));
    ?>
'
}
//]]>
</script>
<?php 
}
开发者ID:cracknel,项目名称:ubuntudanmark.dk,代码行数:27,代码来源:podpress_js_i18n.php

示例4: 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}: \"" . js_escape($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;
     }
 }
开发者ID:schr,项目名称:wordpress,代码行数:29,代码来源:class.wp-scripts.php

示例5: itemGoogleMap

 public function itemGoogleMap($item = null, $width = '200px', $height = '200px', $hasBalloonForMarker = false, $markerHtmlClassName = 'geolocation_balloon')
 {
     $divId = "item-map-{$item->id}";
     $location = get_db()->getTable('Location')->findLocationByItem($item, true);
     // Only set the center of the map if this item actually has a location
     // associated with it
     if ($location) {
         $center['latitude'] = $location->latitude;
         $center['longitude'] = $location->longitude;
         $center['zoomLevel'] = $location->zoom_level;
         $center['show'] = true;
         if ($hasBalloonForMarker) {
             $titleLink = link_to_item(metadata($item, array('Dublin Core', 'Title'), array(), $item), array(), 'show', $item);
             $thumbnailLink = !item_image('thumbnail') ? '' : link_to_item(item_image('thumbnail', array(), 0, $item), array(), 'show', $item);
             $description = metadata($item, array('Dublin Core', 'Description'), array('snippet' => 150), $item);
             $center['markerHtml'] = '<div class="' . $markerHtmlClassName . '">' . '<div class="geolocation_balloon_title">' . $titleLink . '</div>' . '<div class="geolocation_balloon_thumbnail">' . $thumbnailLink . '</div>' . '<p class="geolocation_balloon_description">' . $description . '</p></div>';
         }
         $options = array();
         $options['mapType'] = get_option('geolocation_map_type');
         $center = js_escape($center);
         $options = js_escape($options);
         $style = "width: {$width}; height: {$height}";
         $html = '<div id="' . $divId . '" class="map geolocation-map" style="' . $style . '"></div>';
         $js = "var " . Inflector::variablize($divId) . ";";
         $js .= "OmekaMapSingle = new OmekaMapSingle(" . js_escape($divId) . ", {$center}, {$options}); ";
         $html .= "<script type='text/javascript'>{$js}</script>";
     } else {
         $html = '<p class="map-notification">' . __('This item has no location info associated with it.') . '</p>';
     }
     return $html;
 }
开发者ID:regan008,项目名称:WearingGayHistory-Plugins,代码行数:31,代码来源:ItemGoogleMap.php

示例6: tagInput

    public static function tagInput($id = null) {
        global $langTags, $head_content, $course_code;
        
        // initialize the tags
        $answer = '';
        if (isset($id)) {
            require_once 'modules/tags/moduleElement.class.php';
            $moduleTag = new ModuleElement($id);

            $tags_init = $moduleTag->getTags();
            foreach ($tags_init as $key => $tag) {
                $arrayTemp = "{id:\"" . js_escape($tag) . "\" , text:\"" . js_escape($tag) . "\"},";
                $answer = $answer . $arrayTemp;
            }
        }        
        $head_content .= "
            <script>
                $(function () {
                    $('#tags').select2({
                            minimumInputLength: 2,
                            tags: true,
                            tokenSeparators: [', '],
                            createSearchChoice: function(term, data) {
                              if ($(data).filter(function() {
                                return this.text.localeCompare(term) === 0;
                              }).length === 0) {
                                return {
                                  id: term,
                                  text: term
                                };
                              }
                            },
                            ajax: {
                                url: '../tags/feed.php',
                                dataType: 'json',
                                data: function(term, page) {
                                    return {
                                        course: '" . js_escape($course_code) . "',
                                        q: term
                                    };
                                },
                                results: function(data, page) {
                                    return {results: data};
                                }
                            }
                    });
                    $('#tags').select2('data', [".$answer."]);
                });                
            </script>";
        $input_field = "
                <div class='form-group'>
                    <label for='tags' class='col-sm-2 control-label'>$langTags:</label>
                    <div class='col-sm-10'>
                        <input type='hidden' id='tags' class='form-control' name='tags' value=''>
                    </div>
                </div>             
        ";
        return $input_field;
    }  
开发者ID:nikosv,项目名称:openeclass,代码行数:59,代码来源:tag.class.php

示例7: editInput

 function editInput($table, $field, $attrs, $value)
 {
     if (preg_match("~date|time~", $field["type"])) {
         $dateFormat = "changeYear: true, dateFormat: 'yy-mm-dd'";
         //! yy-mm-dd regional
         $timeFormat = "showSecond: true, timeFormat: 'hh:mm:ss'";
         return "<input id='fields-" . h($field["field"]) . "' value='" . h($value) . "'" . (+$field["length"] ? " maxlength='" . +$field["length"] . "'" : "") . "{$attrs}><script type='text/javascript'>jQuery('#fields-" . js_escape($field["field"]) . "')." . ($field["type"] == "time" ? "timepicker({ {$timeFormat} })" : (preg_match("~time~", $field["type"]) ? "datetimepicker({ {$dateFormat}, {$timeFormat} })" : "datepicker({ {$dateFormat} })")) . ";</script>";
     }
 }
开发者ID:nafex,项目名称:adminer,代码行数:9,代码来源:edit-calendar.php

示例8: mce_escape

function mce_escape($text)
{
    global $language;
    if ('en' == $language) {
        return $text;
    } else {
        return js_escape($text);
    }
}
开发者ID:nurpax,项目名称:saastafi,代码行数:9,代码来源:wp-langs.php

示例9: hookPublicFooter

 public function hookPublicFooter()
 {
     $accountId = get_option(GOOGLE_ANALYTICS_ACCOUNT_OPTION);
     if (empty($accountId)) {
         return;
     }
     $js = file_get_contents(GOOGLE_ANALYTICS_PLUGIN_DIR . '/snippet.js');
     $html = '<script type="text/javascript">' . 'var accountId =' . js_escape($accountId) . ';' . $js . '</script>';
     echo $html;
 }
开发者ID:kyfr59,项目名称:cg35,代码行数:10,代码来源:GoogleAnalyticsPlugin.php

示例10: ui_get_action_links

 function ui_get_action_links($container_field)
 {
     //Inline action links for bookmarks
     $bookmark =& $this->get_wrapped_object();
     $delete_url = admin_url(wp_nonce_url("link.php?action=delete&link_id={$this->container_id}", 'delete-bookmark_' . $this->container_id));
     $actions = array();
     if (current_user_can('manage_links')) {
         $actions['edit'] = '<span class="edit"><a href="' . $this->get_edit_url() . '" title="' . esc_attr(__('Edit this bookmark', 'broken-link-checker')) . '">' . __('Edit') . '</a>';
         $actions['delete'] = "<span class='delete'><a class='submitdelete' href='" . esc_url($delete_url) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete."), $bookmark->link_name)) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
     }
     return $actions;
 }
开发者ID:Weissenberger13,项目名称:web.portugalrentalcottages,代码行数:12,代码来源:blogroll.php

示例11: wp_ajax_meta_row

function wp_ajax_meta_row( $pid, $mid, $key, $value ) {
	$value = attribute_escape($value);
	$key_js = addslashes(wp_specialchars($key, 'double'));
	$key = attribute_escape($key);
	$r .= "<tr id='meta-$mid'><td valign='top'>";
	$r .= "<input name='meta[$mid][key]' tabindex='6' onkeypress='return killSubmit(\"theList.ajaxUpdater(&#039;meta&#039;,&#039;meta-$mid&#039;);\",event);' type='text' size='20' value='$key' />";
	$r .= "</td><td><textarea name='meta[$mid][value]' tabindex='6' rows='2' cols='30'>$value</textarea></td><td align='center'>";
	$r .= "<input name='updatemeta' type='button' class='updatemeta' tabindex='6' value='".attribute_escape(__('Update'))."' onclick='return theList.ajaxUpdater(&#039;meta&#039;,&#039;meta-$mid&#039;);' /><br />";
	$r .= "<input name='deletemeta[$mid]' type='submit' onclick=\"return deleteSomething( 'meta', $mid, '";
	$r .= js_escape(sprintf(__("You are about to delete the '%s' custom field on this post.\n'OK' to delete, 'Cancel' to stop."), $key_js));
	$r .= "' );\" class='deletemeta' tabindex='6' value='".attribute_escape(__('Delete'))."' /></td></tr>";
	return $r;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:13,代码来源:admin-ajax.php

示例12: handle_event

 function handle_event($ev)
 {
     switch ($ev->rem_name) {
         case 'test':
             if ($_POST['val'] == 'error') {
                 $ev->failure = '!';
                 break;
             }
             print "var a=\$i('" . js_escape($ev->context[$ev->long_name]['ret']) . "');" . "a.innerHTML='" . js_escape(htmlspecialchars($_POST['val'], ENT_QUOTES)) . "';" . "";
         default:
     }
     editor_generic::handle_event($ev);
 }
开发者ID:vladisslav2011,项目名称:nb,代码行数:13,代码来源:test_controls.php

示例13: editInput

 function editInput($table, $field, $attrs, $value)
 {
     static $lang = "";
     if (!$lang && preg_match("~text~", $field["type"]) && preg_match("~_html~", $field["field"])) {
         $lang = "en";
         if (function_exists('get_lang')) {
             // since Adminer 3.2.0
             $lang = get_lang();
             $lang = $lang == "zh" || $lang == "zh-tw" ? "zh_cn" : $lang;
         }
         return "<textarea{$attrs} id='fields-" . h($field["field"]) . "' rows='12' cols='50'>" . h($value) . "</textarea><script type='text/javascript'>\njQuery('#fields-" . js_escape($field["field"]) . "').wymeditor({ updateSelector: '#form [type=\"submit\"]', lang: '{$lang}'" . ($this->options ? ", {$this->options}" : "") . " });\n</script>";
     }
 }
开发者ID:nciftci,项目名称:plugins,代码行数:13,代码来源:wymeditor.php

示例14: connect_error

function connect_error()
{
    global $adminer, $connection, $token, $error, $drivers;
    if (DB != "") {
        header("HTTP/1.1 404 Not Found");
        page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), true);
    } else {
        if ($_POST["db"] && !$error) {
            queries_redirect(substr(ME, 0, -1), lang('Databases have been dropped.'), drop_databases($_POST["db"]));
        }
        //Encabezado y botones de la parte superior en la seleccion de bases de datos
        page_header(lang('Select database'), $error, false);
        echo "<p>\n";
        foreach (array('database' => lang('Create new database'), 'privileges' => lang('Privileges'), 'processlist' => lang('Process list'), 'variables' => lang('Variables'), 'status' => lang('Status')) as $key => $val) {
            if (support($key)) {
                echo "<a class='btn btn-xs btn-primary' href='" . h(ME) . "{$key}='>{$val}</a>\n";
            }
        }
        //Presenta informacion de la conexion
        echo "<p><i class='fa fa-exchange fa-fw'></i> " . lang('%s version: %s through PHP extension %s', $drivers[DRIVER], "<b>" . h($connection->server_info) . "</b>", "<b>{$connection->extension}</b>") . "\n";
        echo "<p><i class='fa fa-user fa-fw'></i> " . lang('Logged as: %s', "<b>" . h(logged_user()) . "</b>") . "\n";
        //Presenta la lista de bases de datos existentes y los encabezados
        $databases = $adminer->databases();
        if ($databases) {
            $scheme = support("scheme");
            $collations = collations();
            echo "<form action='' method='post'>\n";
            echo "<table cellspacing='0' class='checkable table table-condensed table-responsive table-hover' onclick='tableClick(event);' ondblclick='tableClick(event, true);'>\n";
            echo "<thead><tr>" . (support("database") ? "<th>&nbsp;" : "") . "<th>" . lang('Database') . " - <a class='btn btn-default btn-xs' href='" . h(ME) . "refresh=1'><i class='fa fa-refresh fa-fw'></i> " . lang('Refresh') . "</a>" . "<th>" . lang('Collation') . "<th>" . lang('Tables') . "<th>" . lang('Size') . " - <a  class='btn btn-default btn-xs' href='" . h(ME) . "dbsize=1' onclick=\"return !ajaxSetHtml('" . js_escape(ME) . "script=connect');\">" . lang('Compute') . "</a>" . "</thead>\n";
            //Presenta la lista de bases de datos
            $databases = $_GET["dbsize"] ? count_tables($databases) : array_flip($databases);
            foreach ($databases as $db => $tables) {
                $root = h(ME) . "db=" . urlencode($db);
                echo "<tr" . odd() . ">" . (support("database") ? "\n\t\t\t\t\t<td align=center>" . checkbox("db[]", $db, in_array($db, (array) $_POST["db"])) : "");
                echo "<th><a  href='{$root}'>" . h($db) . "</a>";
                $collation = nbsp(db_collation($db, $collations));
                echo "<td>" . (support("database") ? "<a href='{$root}" . ($scheme ? "&amp;ns=" : "") . "&amp;database=' title='" . lang('Alter database') . "'>{$collation}</a>" : $collation);
                echo "<td align='right'><a href='{$root}&amp;schema=' id='tables-" . h($db) . "' title='" . lang('Database schema') . "'>" . ($_GET["dbsize"] ? $tables : "?") . "</a>";
                echo "<td align='right' id='size-" . h($db) . "'>" . ($_GET["dbsize"] ? db_size($db) : "?");
                echo "\n";
            }
            echo "</table>\n";
            //Agrega boton de eliminar
            echo support("database") ? "<fieldset><legend>" . lang('Selected') . " <span id='selected'></span></legend><div>\n" . "<input type='hidden' name='all' value='' onclick=\"selectCount('selected', formChecked(this, /^db/));\">\n" . "<input class='btn btn-xs btn-danger' type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">\n" . "</div></fieldset>\n" : "";
            echo "<script type='text/javascript'>tableCheck();</script>\n";
            echo "<input type='hidden' name='token' value='{$token}'>\n";
            echo "</form>\n";
        }
    }
    page_footer("db");
}
开发者ID:unix4you2,项目名称:pmydb,代码行数:51,代码来源:connect.inc.php

示例15: connect_error

function connect_error()
{
    global $adminer, $connection, $token, $error, $drivers;
    $databases = array();
    if (DB != "") {
        page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), true);
    } else {
        if ($_POST["db"] && !$error) {
            queries_redirect(substr(ME, 0, -1), lang('Databases have been dropped.'), drop_databases($_POST["db"]));
        }
        page_header(lang('Select database'), $error, false);
        echo "<p><a href='" . h(ME) . "database='>" . lang('Create new database') . "</a>\n";
        foreach (array('privileges' => lang('Privileges'), 'processlist' => lang('Process list'), 'variables' => lang('Variables'), 'status' => lang('Status')) as $key => $val) {
            if (support($key)) {
                echo "<a href='" . h(ME) . "{$key}='>{$val}</a>\n";
            }
        }
        echo "<p>" . lang('%s version: %s through PHP extension %s', $drivers[DRIVER], "<b>{$connection->server_info}</b>", "<b>{$connection->extension}</b>") . "\n";
        echo "<p>" . lang('Logged as: %s', "<b>" . h(logged_user()) . "</b>") . "\n";
        $refresh = "<a href='" . h(ME) . "refresh=1'>" . lang('Refresh') . "</a>\n";
        $databases = $adminer->databases();
        if ($databases) {
            $scheme = support("scheme");
            $collations = collations();
            echo "<form action='' method='post'>\n";
            echo "<table cellspacing='0' class='checkable' onclick='tableClick(event);'>\n";
            echo "<thead><tr><td>&nbsp;<th>" . lang('Database') . "<td>" . lang('Collation') . "<td>" . lang('Tables') . "</thead>\n";
            foreach ($databases as $db) {
                $root = h(ME) . "db=" . urlencode($db);
                echo "<tr" . odd() . "><td>" . checkbox("db[]", $db, in_array($db, (array) $_POST["db"]));
                echo "<th><a href='{$root}'>" . h($db) . "</a>";
                echo "<td><a href='{$root}" . ($scheme ? "&amp;ns=" : "") . "&amp;database=' title='" . lang('Alter database') . "'>" . nbsp(db_collation($db, $collations)) . "</a>";
                echo "<td align='right'><a href='{$root}&amp;schema=' id='tables-" . h($db) . "' title='" . lang('Database schema') . "'>?</a>";
                echo "\n";
            }
            echo "</table>\n";
            echo "<script type='text/javascript'>tableCheck();</script>\n";
            echo "<p><input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /db/)") . ">\n";
            echo "<input type='hidden' name='token' value='{$token}'>\n";
            echo $refresh;
            echo "</form>\n";
        } else {
            echo "<p>{$refresh}";
        }
    }
    page_footer("db");
    if ($databases) {
        echo "<script type='text/javascript'>ajaxSetHtml('" . js_escape(ME) . "script=connect');</script>\n";
    }
}
开发者ID:olien,项目名称:mysql_tools,代码行数:50,代码来源:connect.inc.php


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