本文整理汇总了PHP中attribute_escape函数的典型用法代码示例。如果您正苦于以下问题:PHP attribute_escape函数的具体用法?PHP attribute_escape怎么用?PHP attribute_escape使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了attribute_escape函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit_screen
function edit_screen()
{
global $bp;
if (!bp_is_group_admin_screen($this->slug)) {
return false;
}
?>
<p class="desc"><?php
_e("Enter RSS feed URL's for blogs you would like to attach to this group. Any future posts on these blogs will show on the group activity stream. Seperate URL's with commas.", 'bp-groups-externalblogs');
?>
</span>
<p>
<label for="blogfeeds"><?php
_e("Feed URL's:", 'bp-groups-externalblogs');
?>
</label>
<textarea name="blogfeeds" id="blogfeeds"><?php
echo attribute_escape(implode(', ', (array) groups_get_groupmeta($bp->groups->current_group->id, 'blogfeeds')));
?>
</textarea>
</p>
<input type="submit" name="save" value="<?php
_e("Update Feed URL's", 'bp-groups-externalblogs');
?>
" />
<?php
wp_nonce_field('groups_edit_save_' . $this->slug);
}
示例2: default_scripts
function default_scripts()
{
$this->add('dbx', '/wp-includes/js/dbx.js', false, '2.05');
$this->add('fat', '/wp-includes/js/fat.js', false, '1.0-RC1_3660');
$this->add('sack', '/wp-includes/js/tw-sack.js', false, '1.6.1');
$this->add('quicktags', '/wp-includes/js/quicktags.js', false, '3958');
$this->localize('quicktags', 'quicktagsL10n', array('quickLinks' => __('(Quick Links)'), 'wordLookup' => __('Enter a word to look up:'), 'dictionaryLookup' => attribute_escape(__('Dictionary lookup')), 'lookup' => attribute_escape(__('lookup')), 'closeAllOpenTags' => attribute_escape(__('Close all open tags')), 'closeTags' => attribute_escape(__('close tags')), 'enterURL' => __('Enter the URL'), 'enterImageURL' => __('Enter the URL of the image'), 'enterImageDescription' => __('Enter a description of the image')));
$this->add('colorpicker', '/wp-includes/js/colorpicker.js', false, '3517');
$this->add('tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '20070326');
$mce_config = apply_filters('tiny_mce_config_url', '/wp-includes/js/tinymce/tiny_mce_config.php');
$this->add('wp_tiny_mce', $mce_config, array('tiny_mce'), '20070225');
$this->add('prototype', '/wp-includes/js/prototype.js', false, '1.5.0-0');
$this->add('autosave', '/wp-includes/js/autosave.js', array('prototype', 'sack'), '20070306');
$this->localize('autosave', 'autosaveL10n', array('autosaveInterval' => apply_filters('autosave_interval', '120'), 'errorText' => __('Error: %response%'), 'saveText' => __('Saved at %time%.'), 'requestFile' => get_option('siteurl') . '/wp-admin/admin-ajax.php', 'savingText' => __('Saving Draft...')));
$this->add('wp-ajax', '/wp-includes/js/wp-ajax.js', array('prototype'), '20070306');
$this->localize('wp-ajax', 'WPAjaxL10n', array('defaultUrl' => get_option('siteurl') . '/wp-admin/admin-ajax.php', 'permText' => __("You don't have permission to do that."), 'strangeText' => __("Something strange happened. Try refreshing the page."), 'whoaText' => __("Slow down, I'm still sending your data!")));
$this->add('listman', '/wp-includes/js/list-manipulation.js', array('wp-ajax', 'fat'), '20070306');
$this->localize('listman', 'listManL10n', array('jumpText' => __('Jump to new item'), 'delText' => __('Are you sure you want to delete this %thing%?')));
$this->add('scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.7.0');
$this->add('scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.7.0');
$this->add('scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.7.0');
$this->add('scriptaculous-effects', '/wp-includes/js/scriptaculous/effects.js', array('scriptaculous-root'), '1.7.0');
$this->add('scriptaculous-slider', '/wp-includes/js/scriptaculous/slider.js', array('scriptaculous-effects'), '1.7.0');
$this->add('scriptaculous-controls', '/wp-includes/js/scriptaculous/controls.js', array('scriptaculous-root'), '1.7.0');
$this->add('scriptaculous', '', array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls'), '1.7.0');
$this->add('cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118');
$this->add('jquery', '/wp-includes/js/jquery/jquery.js', false, '1.1.2');
$this->add('interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2');
if (is_admin()) {
global $pagenow;
$man = false;
switch ($pagenow) {
case 'post.php':
case 'post-new.php':
$man = 'postmeta';
break;
case 'page.php':
case 'page-new.php':
$man = 'pagemeta';
break;
case 'link-add.php':
case 'link.php':
$man = 'linkmeta';
break;
}
if ($man) {
$this->add('dbx-admin-key', '/wp-admin/dbx-admin-key.js', array('dbx'), '20070417');
$this->localize('dbx-admin-key', 'dbxL10n', array('manager' => $man, 'open' => __('open'), 'close' => __('close'), 'moveMouse' => __('click-down and drag to move this box'), 'toggleMouse' => __('click to %toggle% this box'), 'moveKey' => __('use the arrow keys to move this box'), 'toggleKey' => __(', or press the enter key to %toggle% it')));
}
$this->add('ajaxcat', '/wp-admin/cat.js', array('listman'), '20070417');
$this->localize('ajaxcat', 'catL10n', array('add' => attribute_escape(__('Add')), 'how' => __('Separate multiple categories with commas.')));
$this->add('admin-categories', '/wp-admin/categories.js', array('listman'), '3684');
$this->add('admin-custom-fields', '/wp-admin/custom-fields.js', array('listman'), '3733');
$this->add('admin-comments', '/wp-admin/edit-comments.js', array('listman'), '20070327');
$this->add('admin-users', '/wp-admin/users.js', array('listman'), '4583');
$this->add('xfn', '/wp-admin/xfn.js', false, '3517');
$this->add('upload', '/wp-admin/upload.js', array('prototype'), '20070306');
$this->localize('upload', 'uploadL10n', array('browseTitle' => attribute_escape(__('Browse your files')), 'back' => __('« Back'), 'directTitle' => attribute_escape(__('Direct link to file')), 'edit' => __('Edit'), 'thumb' => __('Thumbnail'), 'full' => __('Full size'), 'icon' => __('Icon'), 'title' => __('Title'), 'show' => __('Show:'), 'link' => __('Link to:'), 'file' => __('File'), 'page' => __('Page'), 'none' => __('None'), 'editorText' => attribute_escape(__('Send to editor »')), 'insert' => __('Insert'), 'urlText' => __('URL'), 'desc' => __('Description'), 'deleteText' => attribute_escape(__('Delete File')), 'saveText' => attribute_escape(__('Save »')), 'confirmText' => __("Are you sure you want to delete the file '%title%'?\nClick ok to delete or cancel to go back.")));
}
}
示例3: txfx_plt_meta_box
function txfx_plt_meta_box()
{
global $post;
echo '<p>';
wp_nonce_field('txfx_plt', '_txfx_pl2_nonce', false, true);
echo '</p>';
?>
<p>Point to this URL: <input name="txfx_links_to" type="text" style="width:75%" id="txfx_links_to" value="<?php
echo attribute_escape(get_post_meta($post->ID, '_links_to', true));
?>
" /></p>
<p><label for="txfx_links_to_new_window"><input type="checkbox" name="txfx_links_to_new_window" id="txfx_links_to_new_window" value="_blank"<?php
if ("_blank" == get_post_meta($post->ID, '_links_to_target', true)) {
echo ' checked="checked"';
}
?>
> Open this link in a new window</label></p>
<p><label for="txfx_links_to_302"><input type="checkbox" name="txfx_links_to_302" id="txfx_links_to_302" value="302"<?php
if ('302' == get_post_meta($post->ID, '_links_to_type', true)) {
echo ' checked="checked"';
}
?>
> Use a temporary <code>302</code> redirect (default is a permanent <code>301</code> redirect)</label></p>
<?php
}
示例4: __construct
function __construct()
{
global $email, $opt, $tml;
$this->post_author = __("Thank Me Later", "thankmelater");
$this->post_date = date("Y-m-d H:i:s");
$this->guid = get_bloginfo('url') . "?tmloptout";
$this->post_title = __("E-mail Preferences", "thankmelater");
$this->post_content = '<form method="get" action="' . htmlspecialchars(get_bloginfo('url')) . '">';
$this->post_content .= '<input type="hidden" name="tmloptout" value="" />';
$this->post_content .= '<p>' . sprintf(__("This page allows you to opt-out or subscribe to 'Thank Me Later' e-mails. These are e-mails sent when you leave a comment at %s.", "thankmelater"), wp_specialchars(get_bloginfo("name"))) . '</p>';
if ($email) {
$this->post_content .= '<input type="hidden" name="email" value="' . attribute_escape($email) . '" />';
$this->post_content .= '<p>' . sprintf(__("Your e-mail address: <strong>%s</strong>", "thankmelater"), wp_specialchars($email)) . '</p>';
if ($opt) {
$this->post_content .= '<p>' . __("You are currently <strong>subscribed</strong> to receive e-mails. Click 'Opt Out' if you wish to opt-out of these e-mails:", "thankmelater") . '</p>';
$this->post_content .= '<input type="hidden" name="opt" value="0" />';
$this->post_content .= '<p><input type="submit" value="' . __("Opt Out", "thankmelater") . '" name="submit" style="font-weight: bold;" /></p>';
} else {
$this->post_content .= '<p>' . __("You are <strong>not subscribed</strong> to receive e-mails. Click 'Opt In' if you wish to receive e-mails again:", "thankmelater") . '</p>';
$this->post_content .= '<input type="hidden" name="opt" value="1" />';
$this->post_content .= '<p><input type="submit" value="' . __("Opt In", "thankmelater") . '" name="submit" style="font-weight: bold;" /></p>';
}
} else {
$this->post_content .= '<p>' . sprintf(__("Your e-mail address: <strong>%s</strong>", "thankmelater"), '<input type="text" name="email" value="" />') . '</p>';
$this->post_content .= '<p><input type="submit" value="' . __("Get Preferences »", "thankmelater") . '" name="submit" style="font-weight: bold;" /></p>';
}
// don't allow opt outs
if (!$tml->get_option("allow_opt_out")) {
$this->post_content = "<p>" . __("Sorry, this feature is disabled.", "thankmelater") . "</p>";
}
}
示例5: control
function control()
{
$data = get_option('widget_tree_nav');
global $wpdb, $table_prefix;
$nav_menu_term_id = $wpdb->get_col("SELECT term_id FROM {$table_prefix}term_taxonomy WHERE taxonomy = 'nav_menu'");
echo '<select name="widget_nav_option">';
foreach ($nav_menu_term_id as $n_m_term_id) {
$nav_menu_name = $wpdb->get_col("SELECT name FROM {$table_prefix}terms WHERE term_id = {$n_m_term_id}");
foreach ($nav_menu_name as $n_m_name) {
if ($data['treev_option'] == $n_m_term_id) {
$selected = ' selected="selected"';
} else {
$selected = '';
}
$nav_dlist = "<option value=" . $n_m_term_id . "" . $selected . ">" . $n_m_name . "</option>";
echo $nav_dlist;
}
//foreach child
}
//foreach
echo '</select>';
?>
<?php
if (isset($_POST['widget_nav_option'])) {
$data['treev_option'] = attribute_escape($_POST['widget_nav_option']);
update_option('widget_tree_nav', $data);
}
}
示例6: title
function title()
{
global $thesis_site, $thesis_pages;
$site_name = get_bloginfo('name');
#wp
$separator = $thesis_site->head['title']['separator'] ? urldecode($thesis_site->head['title']['separator']) : '—';
if (is_home() || is_front_page()) {
#wp
$tagline = get_bloginfo('description');
#wp
$home_title = $thesis_pages->home['head']['title'] ? trim(wptexturize(urldecode($thesis_pages->home['head']['title']))) : "{$site_name} {$separator} {$tagline}";
#wp
if (get_option('show_on_front') == 'page' && is_front_page()) {
#wp
$page_title = get_post_meta(get_option('page_on_front'), 'thesis_title', true);
} elseif (get_option('show_on_front') == 'page' && is_home()) {
#wp
$page_title = get_post_meta(get_option('page_for_posts'), 'thesis_title', true);
}
#wp
$output = $page_title ? trim(wptexturize(strip_tags(stripslashes($page_title)))) : $home_title;
#wp
} elseif (is_category()) {
#wp
global $wp_query;
#wp
$category_title = $thesis_pages->categories[$wp_query->query_vars['cat']]['head']['title'] ? trim(wptexturize(urldecode($thesis_pages->categories[$wp_query->query_vars['cat']]['head']['title']))) : single_cat_title('', false);
#wp
$output = $thesis_site->head['title']['branded'] ? "{$category_title} {$separator} {$site_name}" : $category_title;
} elseif (is_tag()) {
global $wp_query;
#wp
$tag_title = $thesis_pages->tags[$wp_query->query_vars['tag_id']]['head']['title'] ? trim(wptexturize(urldecode($thesis_pages->tags[$wp_query->query_vars['tag_id']]['head']['title']))) : single_tag_title('', false);
#wp
$output = $thesis_site->head['title']['branded'] ? "{$tag_title} {$separator} {$site_name}" : $tag_title;
} elseif (is_search()) {
#wp
$search_title = __('You searched for', 'thesis') . ' “' . attribute_escape(get_search_query()) . '”';
#wp
$output = $thesis_site->head['title']['branded'] ? "{$search_title} {$separator} {$site_name}" : $search_title;
} else {
global $post;
#wp
$custom_title = is_single() || is_page() ? trim(wptexturize(strip_tags(stripslashes(get_post_meta($post->ID, 'thesis_title', true))))) : false;
#wp
$page_title = $custom_title ? $custom_title : trim(wp_title('', false));
#wp
$output = $thesis_site->head['title']['branded'] ? "{$page_title} {$separator} {$site_name}" : $page_title;
}
if (is_home() || is_archive() || is_search()) {
#wp
$current_page = get_query_var('paged');
#wp
if ($current_page > 1) {
$output .= " {$separator} " . __('Page', 'thesis') . " {$current_page}";
}
}
$this->title['title'] = '<title>' . apply_filters('thesis_title', $output, $separator) . '</title>';
#wp #filter
}
示例7: formCreate
function formCreate($instance,$headline_instance, $cat_instance, $dropdown_instance,$num_post_instance){
//Generates widget options form which you see in the widgets section in the admin
$headline = esc_attr($instance[$headline_instance]);
$include_cats = esc_attr($instance[$cat_instance]);
$num_post_selected = esc_attr($instance[$num_post_instance]);
?>
<p><label for="<? echo $this->get_field_id($headline_instance); ?>">Headline:
<input class="widefat"
id="<? echo $this->get_field_id($headline_instance); ?>"
name="<? echo $this->get_field_name($headline_instance); ?>"
type="text"
value="<? echo attribute_escape($headline); ?>" />
</label>
</p>
<p>
Categories Dropdown / How Many Posts<br />
<? wp_dropdown_categories('orderby=name&hide_empty=0&show_option_none=Select Categories to include&id='.$dropdown_instance.'&name='.$dropdown_instance.'&taxonomy=category'); echo " "; echo $this->dw_createNumSelect($this->get_field_id($num_post_instance),$this->get_field_name($num_post_instance),10,$num_post_selected);?> <br /><br />
<label for="<? echo $this->get_field_id($cat_instance); ?>">Included Categories:
<textarea class="widefat"
id="<? echo $this->get_field_id($cat_instance); ?>"
name="<? echo $this->get_field_name($cat_instance); ?>"
rows="2"
cols="1" style="text-align:left;"><? echo attribute_escape($include_cats); ?></textarea>
</label>
</p>
<?
}
示例8: form
function form($instance)
{
//this function handles the widget form in the WordPress backend
$instance = wp_parse_args((array) $instance, array('title' => ''));
$title = $instance['title'];
$form_id = $instance['form_id'];
?>
<p><label for="<?php
echo $this->get_field_id('title');
?>
">Title: <input class="widefat" id="<?php
echo $this->get_field_id('title');
?>
" name="<?php
echo $this->get_field_name('title');
?>
" type="text" value="<?php
echo attribute_escape($title);
?>
" /></label></p>
<p><label for="<?php
echo $this->get_field_id('form_id');
?>
">Form ID: <input class="widefat" id="<?php
echo $this->get_field_id('form_id');
?>
" name="<?php
echo $this->get_field_name('form_id');
?>
" type="text" value="<?php
echo attribute_escape($form_id);
?>
" /></label></p>
<?php
}
示例9: tarski_doctitle
/**
* tarski_doctitle() - Returns the document title.
*
* The order (site name first or last) can be set on the Tarski Options page.
* While the function ultimately returns a string, please note that filters
* are applied to an array! This allows plugins to easily alter any aspect
* of the title. For example, one might write a plugin to change the separator.
* @since 1.5
* @param string $sep
* @return string $doctitle
* @hook filter tarski_doctitle
* Filter document titles.
*/
function tarski_doctitle($sep = '·')
{
$site_name = get_bloginfo('name');
if (is_404()) {
$content = __(sprintf('Error %s', '404'), 'tarski');
} elseif (get_option('show_on_front') == 'posts' && is_home()) {
if (get_bloginfo('description')) {
$content = get_bloginfo('description');
}
} elseif (is_search()) {
$content = sprintf(__('Search results for %s', 'tarski'), attribute_escape(get_search_query()));
} elseif (is_month()) {
$content = single_month_title(' ', false);
} elseif (is_tag()) {
$content = multiple_tag_titles();
} else {
$content = trim(wp_title('', false));
}
if ($content) {
$elements = array('site_name' => $site_name, 'separator' => $sep, 'content' => $content);
} else {
$elements = array('site_name' => $site_name);
}
if (get_tarski_option('swap_title_order')) {
$elements = array_reverse($elements, true);
}
// Filters should return an array
$elements = apply_filters('tarski_doctitle', $elements);
// But if they don't, it won't try to implode
if (check_input($elements, 'array')) {
$doctitle = implode(' ', $elements);
}
echo $doctitle;
}
示例10: countdown_to_settings_page
function countdown_to_settings_page()
{
$options = array('countdown_date' => get_option('countdown_date'), 'close_comments' => get_option('countdown_close_comments', 0), 'countdown_message' => get_option('countdown_message', 'Ends in'), 'countdown_ended_message' => get_option('countdown_ended_message', 'Countdown ended'));
$changed = FALSE;
if (isset($_POST['countdown_date'])) {
$new_date = strtotime($_POST['countdown_date']);
if ($new_date === FALSE) {
echo '<div class="error"><p>' . __('Please enter a valid date') . '</p></div>';
} else {
$options = array('countdown_date' => $new_date);
update_option('countdown_date', $options['countdown_date']);
$changed = TRUE;
}
}
foreach (array('countdown_message', 'countdown_ended_message') as $key) {
if (!empty($_POST[$key])) {
$options[$key] = attribute_escape(strip_tags($_POST[$key]));
update_option($key, $options[$key]);
$changed = TRUE;
}
}
if (isset($_POST['countdown_close_comments']) && $_POST['countdown_close_comments' == 1]) {
update_option('countdown_close_comments', 1);
$changed = TRUE;
} else {
update_option('countdown_close_comments', 0);
}
if ($changed) {
echo '<div class="updated"><p>' . __('Options saved') . '</p></div>';
}
require dirname(__FILE__) . '/admin_page.tpl.php';
}
示例11: add_head
function add_head()
{
$query = attribute_escape(get_search_query());
if (strlen($query) > 0) {
echo '<script type="text/javascript">var hls_query = "' . $query . '";</script>';
}
}
示例12: wp_generate_product_tag_cloud
function wp_generate_product_tag_cloud($tags, $args = '')
{
global $wp_rewrite;
$defaults = array('smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45, 'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC');
$args = wp_parse_args($args, $defaults);
extract($args);
if (!$tags) {
return;
}
$counts = $tag_links = array();
foreach ((array) $tags as $tag) {
$counts[$tag->name] = $tag->count;
$tag_links[$tag->name] = get_product_tag_link($tag->term_id);
if (is_wp_error($tag_links[$tag->name])) {
return $tag_links[$tag->name];
}
$tag_ids[$tag->name] = $tag->term_id;
}
$min_count = min($counts);
$spread = max($counts) - $min_count;
if ($spread <= 0) {
$spread = 1;
}
$font_spread = $largest - $smallest;
if ($font_spread <= 0) {
$font_spread = 1;
}
$font_step = $font_spread / $spread;
// SQL cannot save you; this is a second (potentially different) sort on a subset of data.
if ('name' == $orderby) {
uksort($counts, 'strnatcasecmp');
} else {
asort($counts);
}
if ('DESC' == $order) {
$counts = array_reverse($counts, true);
}
$a = array();
$rel = is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ? ' rel="tag"' : '';
foreach ($counts as $tag => $count) {
$tag_id = $tag_ids[$tag];
$tag_link = clean_url($tag_links[$tag]);
$tag = str_replace(' ', ' ', wp_specialchars($tag));
$a[] = "<a href='{$tag_link}' class='tag-link-{$tag_id}' title='" . attribute_escape(sprintf(__('%d topics'), $count)) . "'{$rel} style='font-size: " . ($smallest + ($count - $min_count) * $font_step) . "{$unit};'>{$tag}</a>";
}
switch ($format) {
case 'array':
$return =& $a;
break;
case 'list':
$return = "<ul class='product_tag_cloud'>\n\t<li>";
$return .= join("</li>\n\t<li>", $a);
$return .= "</li>\n</ul>\n";
break;
default:
$return = join("\n", $a);
break;
}
return apply_filters('wp_generate_product_tag_cloud', $return, $tags, $args);
}
示例13: control
function control()
{
// Get our options and see if we're handling a form submission.
$options = get_option('ace_widget_calendar');
if (!is_array($options)) {
$options = array('title' => '');
}
if (!empty($_POST['ace-calendar-submit'])) {
$options['title'] = trim(strip_tags(stripslashes($_POST['ace-calendar-title'])));
update_option('ace_widget_calendar', $options);
}
$title = attribute_escape($options['title']);
?>
<p>
<label for="calendar-title">
<?php
_e('Title:');
?>
<input class="widefat" id="calendar-title" name="ace-calendar-title" type="text" value="<?php
echo $title;
?>
" />
</label>
</p>
<input type="hidden" name="ace-calendar-submit" value="1" />
<?php
}
示例14: form
/**
* Outputs the options form on admin
*
* @param array $instance The widget options
*/
public function form($instance)
{
// PART 1: Extract the data from the instance variable
$instance = wp_parse_args((array) $instance, array('title' => ''));
$fb_link = $instance['fb_link'];
// PART 2-3: Display the fields
?>
<!-- PART 2: Facebook Link field START -->
<p>
<label for="<?php
echo $this->get_field_id('fb_link');
?>
">Facebook Link:
<input class="widefat" id="<?php
echo $this->get_field_id('fb_link');
?>
" name="<?php
echo $this->get_field_name('fb_link');
?>
" type="text" value="<?php
echo attribute_escape($fb_link);
?>
" />
</label>
</p>
<!-- Widget Facebook Link field END -->
<?php
}
示例15: form
function form($instance)
{
$title = esc_attr($instance['title']);
?>
<p>
<label for="<?php
echo $this->get_field_id('title');
?>
">Title:
<input class="widefat"
id="<?php
echo $this->get_field_id('title');
?>
"
name="<?php
echo $this->get_field_name('title');
?>
"
type="text"
value="<?php
echo attribute_escape($title);
?>
" />
</label>
</p>
<?php
}