本文整理汇总了PHP中su_esc_attr函数的典型用法代码示例。如果您正苦于以下问题:PHP su_esc_attr函数的具体用法?PHP su_esc_attr怎么用?PHP su_esc_attr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了su_esc_attr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: http_link_rel_canonical
function http_link_rel_canonical()
{
if (headers_sent()) {
return;
}
if ($url = $this->get_canonical_url()) {
$url = su_esc_attr($url);
header("Link: <{$url}>; rel=\"canonical\"", false);
}
}
示例2: add_tags
function add_tags($content, $tags, $template, $escape = true)
{
if ($escape) {
$content = su_esc_attr($content);
}
$tags = array_reverse((array) $tags);
foreach ($tags as $tag) {
if (sustr::startswith($tag, '<')) {
$content = sprintf($tag, $content);
} else {
$content = sprintf($template, $tag, $content);
}
}
return $content;
}
示例3: head_tag_output
function head_tag_output()
{
$verify = $this->get_supported_search_engines();
foreach ($verify as $site => $site_data) {
$name = $site_data['meta_name'];
//Do we have verification tags? If so, output them.
if ($value = $this->get_setting($site . '_verify')) {
if (current_user_can('unfiltered_html') && sustr::startswith(trim($value), '<meta ') && sustr::endswith(trim($value), '/>')) {
echo "\t" . trim($value) . "\n";
} else {
$value = su_esc_attr($value);
echo "\t<meta name=\"{$name}\" content=\"{$value}\" />\n";
}
}
}
}
示例4: linkbox_filter
function linkbox_filter($content, $id = false)
{
//If no ID is provided, get the ID of the current post
if (!$id) {
$id = suwp::get_post_id();
}
if ($id) {
//Don't add a linkbox if a "more" link is present (since a linkbox should go at the very bottom of a post)
$morelink = '<a href="' . get_permalink($id) . '#more-' . $id . '" class="more-link">';
if (strpos($content, $morelink) !== false) {
return $content;
}
//Load the HTML and replace the variables with the proper values
$linkbox = $this->get_setting('html');
$linkbox = str_replace(array('{id}', '{url}', '{title}'), array(intval($id), su_esc_attr(get_permalink($id)), su_esc_attr(get_the_title($id))), $linkbox);
//Return the content with the linkbox added to the bottom
return $content . $linkbox;
}
return $content;
}
示例5: _autolink_content
function _autolink_content($id, $content, $links, $limit, &$count, &$link_count, $round = 1, $linked_urls = array(), $context = 'the_content')
{
$links = array_values($links);
$count = 0;
if (!is_array($link_count)) {
$link_count = array();
}
$i = 0;
foreach ($links as $data) {
if (!isset($link_count[$i])) {
$link_count[$i] = 0;
}
$i++;
}
if (!$this->get_setting('autolink_posttype_' . get_post_type($id))) {
return $content;
}
if ($this->get_postmeta('disable_autolinks', $id)) {
return $content;
}
$limit_enabled = $this->get_setting('limit_lpp', false);
if ($limit_enabled && $limit < 1) {
return $content;
}
$oldlimit = $limit;
$lpa_limit_enabled = $this->get_setting('limit_lpa', false);
$lpa_limit = $lpa_limit_enabled ? $this->get_setting('limit_lpa_value', 5) : -1;
$lpu_limit_enabled = $this->get_setting('limit_lpu', false);
$lpu_limit = $lpu_limit_enabled ? $this->get_setting('limit_lpu_value', 1) : -1;
$from_post_type = get_post_type();
$dest_limit = $from_post_type ? (bool) $this->get_setting('dest_limit_' . $from_post_type, false) : false;
$dest_limit_taxonomies = array();
if ($dest_limit) {
$from_post_type_taxonomies = suwp::get_object_taxonomy_names($from_post_type);
foreach ($from_post_type_taxonomies as $from_post_type_taxonomy) {
if ($this->get_setting('dest_limit_' . $from_post_type . '_within_' . $from_post_type_taxonomy, false)) {
$dest_limit_taxonomies[] = $from_post_type_taxonomy;
}
}
}
$autolink_class = $this->get_setting('autolink_class', '');
$post = get_post($id);
$i = 0;
foreach ($links as $data) {
$anchor = $data['anchor'];
$to_id = su_esc_attr($data['to_id']);
if (strlen(trim($anchor)) && $to_id !== 0 && $to_id != 'http://') {
//*** Begin sitewide links-per-anchor dampening effect ***
//Get the dampening percentage for this link, but only if per-link values are enabled
if ($this->get_setting('enable_perlink_dampen_sitewide_lpa', false)) {
$link_dswlpa = $data['dampen_sitewide_lpa'];
} else {
$link_dswlpa = false;
}
if (false === $link_dswlpa) {
//We need the === operator here so we don't match a zero
//There's no per-link value, so get the default, if a default value is specified and enabled
if ($this->get_setting('dampen_sitewide_lpa', false)) {
$link_dswlpa = $this->get_setting('dampen_sitewide_lpa_value', 0);
} else {
$link_dswlpa = false;
}
//Indicates there's neither a per-link value or a default value available
}
if (false !== $link_dswlpa) {
$link_dswlpa = absint($link_dswlpa);
if ($link_dswlpa == 0) {
break;
}
if ($link_dswlpa > 100) {
$link_dswlpa = 100;
}
//Rather than generating a random number, we use the MD5s of the anchor and the post's ID.
//This gives us a quasi-random dampening effect that will turn out the same way for any given post each time the dampener is applied.
//We don't want a post's autolinks changing every time the post is viewed.
$md5starts = array_slice(array_unique(str_split(md5($anchor))), 0, intval(round(16 * (1 - $link_dswlpa / 100))));
//Only apply this autolink if the MD5 of the post's ID starts with one of the allowed characters
if (!in_array(substr(md5($id), 0, 1), $md5starts)) {
continue;
}
//Don't apply autolink; continue to next item in the $links foreach loop
}
//*** End sitewide LPA dampener ***
$type = $data['to_type'];
if (sustr::startswith($type, 'posttype_')) {
$to_id = intval($to_id);
$to_post = get_post($to_id);
if (get_post_status($to_id) != 'publish') {
continue;
}
if (count($dest_limit_taxonomies)) {
$shares_term = false;
foreach ($dest_limit_taxonomies as $dest_limit_taxonomy) {
$from_terms = suarr::flatten_values(get_the_terms(null, $dest_limit_taxonomy), 'term_id');
if (is_object_in_taxonomy($to_post, $dest_limit_taxonomy)) {
$to_terms = suarr::flatten_values(get_the_terms($to_id, $dest_limit_taxonomy), 'term_id');
} else {
$to_terms = array();
}
if (count(array_intersect($from_terms, $to_terms))) {
//.........这里部分代码省略.........
示例6: admin_page_contents
function admin_page_contents()
{
$the404s = $this->get_setting('log');
if (!$this->get_setting('log_enabled', true)) {
$this->queue_message('warning', __('New 404 errors will not be recorded because 404 logging is disabled on the Settings tab.', 'seo-ultimate'));
}
//Are we deleting a 404 entry?
if ($this->is_action('delete')) {
if (isset($the404s[$_GET['object']])) {
unset($the404s[$_GET['object']]);
$this->queue_message('success', __('The log entry was successfully deleted.', 'seo-ultimate'));
} else {
$this->queue_message('error', __('This log entry has already been deleted.', 'seo-ultimate'));
}
$this->update_setting('log', $the404s);
//Are we clearing the whole 404 log?
} elseif ($this->is_action('clear')) {
$the404s = array();
$this->update_setting('log', array());
$this->queue_message('success', __('The log was successfully cleared.', 'seo-ultimate'));
}
if (!count($the404s)) {
$this->queue_message('success', __('No 404 errors in the log.', 'seo-ultimate'));
}
$this->print_messages();
if (count($the404s)) {
$this->clear_log_button();
echo "<div id='su-404s-log-table'>\n";
$headers = $this->get_admin_table_columns();
$this->admin_wftable_start();
uasort($the404s, array(&$this, 'sort_log_callback'));
foreach ($the404s as $url => $data) {
$new = $data['is_new'] ? ' su-404s-new-hit' : '';
$a_url = su_esc_attr($url);
$ae_url = su_esc_attr(urlencode($url));
$md5url = md5($url);
echo "\t<tr id='su-404s-hit-{$md5url}-data' class='su-404s-hit-data{$new}'>\n";
$this->table_cells(array('actions' => "<span class='su-404s-hit-open'><a href='{$a_url}' target='_blank'><img src='{$this->module_dir_url}hit-open.png' title='" . __('Open URL in new window (will not be logged)', 'seo-ultimate') . "' /></a></span>" . "<span class='su-404s-hit-cache'><a href='http://www.google.com/search?q=cache%3A{$ae_url}' target='_blank'><img src='{$this->module_dir_url}hit-cache.png' title='" . __('Query Google for cached version of URL (opens in new window)', 'seo-ultimate') . "' /></a></span>" . "<span class='su-404s-hit-delete'><a href='" . $this->get_nonce_url('delete', $url) . "'><img src='{$this->module_dir_url}hit-delete.png' title='" . __('Remove this URL from the log', 'seo-ultimate') . "' /></a></span>", 'hit-count' => $data['hit_count'], 'url' => "<attr title='{$a_url}'>" . esc_html(sustr::truncate($url, 100)) . '</attr>', 'last-hit-time' => sprintf(__('%s at %s', 'seo-ultimate'), date_i18n(get_option('date_format'), $data['last_hit_time']), date_i18n(get_option('time_format'), $data['last_hit_time'])), 'referers' => number_format_i18n(count($data['referers'])) . (count($data['referers']) ? " <a href='#' class='su_toggle_hide' data-toggle='su-404s-hit-{$md5url}-referers'><img src='{$this->module_dir_url}hit-details.png' title='" . __('View list of referring URLs', 'seo-ultimate') . "' /></a>" : ''), 'user-agents' => number_format_i18n(count($data['user_agents'])) . (count($data['user_agents']) ? " <a href='#' class='su_toggle_hide' data-toggle='su-404s-hit-{$md5url}-user-agents'><img src='{$this->module_dir_url}hit-details.png' title='" . __('View list of user agents', 'seo-ultimate') . "' /></a>" : '')));
echo "\t</tr>\n";
echo "\t<tr class='su-404s-hit-referers{$new}'>\n\t\t<td colspan='" . count($headers) . "'>";
if (count($data['referers'])) {
echo "<div id='su-404s-hit-{$md5url}-referers' class='su-404s-hit-referers-list' style='display:none;'>\n";
echo "\t\t\t<div><strong>" . __('Referring URLs', 'seo-ultimate') . "</strong> — ";
echo "<a href='#' class='su_toggle_up' data-toggle='su-404s-hit-{$md5url}-referers'>" . __('Hide list', 'seo-ultimate') . "</a>";
echo "</div>\n";
echo "\t\t\t<ul>\n";
foreach ($data['referers'] as $referer) {
$referer = su_esc_attr($referer);
//Don't let attacks pass through the referer URLs!
echo "\t\t\t\t<li><a href='{$referer}' target='_blank'>{$referer}</a></li>\n";
}
echo "\t\t\t</ul>\n";
echo "\t\t</div>";
}
echo "</td>\n\t</tr>\n";
echo "\t<tr class='su-404s-hit-user-agents{$new}'>\n\t\t<td colspan='" . count($headers) . "'>";
if (count($data['user_agents'])) {
echo "<div id='su-404s-hit-{$md5url}-user-agents' class='su-404s-hit-user-agents-list' style='display:none;'>\n";
echo "\t\t\t<div><strong>" . __('User Agents', 'seo-ultimate') . "</strong> — ";
echo "<a href='#' class='su_toggle_up' data-toggle='su-404s-hit-{$md5url}-user-agents'>" . __('Hide list', 'seo-ultimate') . "</a>";
echo "</div>\n";
echo "\t\t\t<ul>\n";
foreach ($data['user_agents'] as $useragent) {
$useragent = su_esc_html($useragent);
//Don't let attacks pass through the user agent strings!
echo "\t\t\t\t<li>{$useragent}</li>\n";
}
echo "\t\t\t</ul>\n";
echo "</td>\n\t</tr>\n";
}
echo "\t\t</div>";
$the404s[$url]['is_new'] = false;
}
$this->update_setting('log', $the404s);
$this->admin_wftable_end();
echo "</div>\n";
$this->clear_log_button();
}
}
示例7: head_tag_output
function head_tag_output()
{
global $post;
$kw = false;
//If we're viewing the homepage, look for homepage meta data.
if (is_home()) {
$kw = $this->get_setting('home_keywords');
//If we're viewing a post or page...
} elseif (is_singular()) {
//...look for its meta data
$kw = $this->get_postmeta('keywords');
//...and add default values
if ($posttypename = get_post_type()) {
$taxnames = get_object_taxonomies($posttypename);
foreach ($taxnames as $taxname) {
if ($this->get_setting("auto_keywords_posttype_{$posttypename}_tax_{$taxname}", false)) {
$terms = get_the_terms(0, $taxname);
$terms = suarr::flatten_values($terms, 'name');
$terms = implode(',', $terms);
$kw .= ',' . $terms;
}
}
if ($this->get_setting("auto_keywords_posttype_{$posttypename}_words", false)) {
$words = preg_split("/[\\s+]/", strip_tags($post->post_content), null, PREG_SPLIT_NO_EMPTY);
$words = array_count_values($words);
arsort($words);
$words = array_filter($words, array(&$this, 'filter_word_counts'));
$words = array_keys($words);
$stopwords = suarr::explode_lines($this->get_setting('words_to_remove', array(), 'slugs'));
$stopwords = array_map(array('sustr', 'tolower'), $stopwords);
$words = array_map(array('sustr', 'tolower'), $words);
$words = array_diff($words, $stopwords);
$words = array_slice($words, 0, $this->get_setting("auto_keywords_posttype_{$posttypename}_words_value"));
$words = implode(',', $words);
$kw .= ',' . $words;
}
}
//If we're viewing a term, look for its meta data.
} elseif (suwp::is_tax()) {
global $wp_query;
$tax_keywords = $this->get_setting('taxonomy_keywords');
$term_id = $wp_query->get_queried_object_id();
if (isset($tax_keywords[$term_id])) {
$kw = $tax_keywords[$term_id];
} else {
$kw = '';
}
}
if ($globals = $this->get_setting('global_keywords')) {
if (strlen($kw)) {
$kw .= ',';
}
$kw .= $globals;
}
$kw = str_replace(array("\r\n", "\n"), ',', $kw);
$kw = explode(',', $kw);
$kw = array_map('trim', $kw);
//Remove extra spaces from beginning/end of keywords
$kw = array_filter($kw);
//Remove blank keywords
$kw = suarr::array_unique_i($kw);
//Remove duplicate keywords
$kw = implode(',', $kw);
//Do we have keywords? If so, output them.
if ($kw) {
$kw = su_esc_attr($kw);
echo "\t<meta name=\"keywords\" content=\"{$kw}\" />\n";
}
}
示例8: postmeta_fields
function postmeta_fields($fields, $screen)
{
$id = "_su_title";
$value = su_esc_attr($this->get_postmeta('title'));
$fields['serp'][10]['title'] = "<div class='form-group su textbox'>\n<label class='col-sm-4 col-md-4 control-label' for='{$id}'>" . __('Title Tag:', 'seo-ultimate') . "</label>\n<div class='col-sm-4 col-md-4'><input name='{$id}' id='{$id}' type='text' value='{$value}' class='form-control input-sm regular-text' tabindex='2'" . " onkeyup=\"javascript:document.getElementById('su_title_charcount').innerHTML = document.getElementById('_su_title').value.length\" />" . "</div>\n<div class='col-sm-4 col-md-4 help-text'>" . sprintf(__('You’ve entered %s characters. Most search engines use up to 70.', 'seo-ultimate'), "<strong id='su_title_charcount'>" . strlen($value) . "</strong>") . "</div>\n</div>\n";
return $fields;
}
示例9: get_jlsuggest_box
/**
* Returns the HTML code for a JLSuggest textbox
*
* @since 6.0
*
* @param string $name The value of the textbox's name/ID attributes
* @param string $value The current database string associated with this textbox
*/
function get_jlsuggest_box($name, $value, $params = '', $placeholder = '')
{
list($to_genus, $to_type, $to_id) = $this->jlsuggest_value_explode($value);
$text_dest = '';
$disabled = false;
switch ($to_genus) {
case 'posttype':
$selected_post = get_post($to_id);
if ($selected_post) {
$selected_post_type = get_post_type_object($selected_post->post_type);
$text_dest = $selected_post->post_title . '<span class="type"> — ' . $selected_post_type->labels->singular_name . '</span>';
} else {
$selected_post_type = get_post_type_object($to_type);
if ($selected_post_type) {
$text_dest = sprintf(__('A Deleted %s', 'seo-ultimate'), $selected_post_type->labels->singular_name);
} else {
$text_dest = __('A Deleted Post', 'seo-ultimate');
}
$text_dest = '<span class="type">' . $text_dest . '</span>';
$disabled = true;
}
break;
case 'taxonomy':
if ($selected_taxonomy = get_taxonomy($to_type)) {
if ($selected_term = get_term($to_id, $selected_taxonomy->name)) {
$text_dest = $selected_term->name . '<span class="type"> — ' . $selected_taxonomy->labels->singular_name . '</span>';
} else {
$text_dest = sprintf(__('A Deleted %s', 'seo-ultimate'), $selected_taxonomy->labels->singular_name);
$text_dest = '<span class="type">' . $text_dest . '</span>';
$disabled = true;
}
} else {
$text_dest = __('A Deleted Term', 'seo-ultimate');
$text_dest = '<span class="type">' . $text_dest . '</span>';
$disabled = true;
}
break;
case 'home':
$text_dest = __('Blog Homepage', 'seo-ultimate');
break;
case 'author':
if (is_user_member_of_blog($to_id)) {
$selected_author = get_userdata($to_id);
$text_dest = $selected_author->user_login . '<span class="type"> — ' . __('Author', 'seo-ultimate') . '</span>';
} else {
$text_dest = __('A Deleted User', 'seo-ultimate');
$text_dest = '<span class="type">' . $text_dest . '</span>';
$disabled = true;
}
break;
case 'internal-link-alias':
$alias_dir = $this->get_setting('alias_dir', 'go', 'internal-link-aliases');
$aliases = $this->get_setting('aliases', array(), 'internal-link-aliases');
if (isset($aliases[$to_id]['to'])) {
$h_alias_to = su_esc_html($aliases[$to_id]['to']);
$text_dest = "/{$alias_dir}/{$h_alias_to}/" . '<span class="type"> — ';
if ($this->plugin->module_exists('internal-link-aliases')) {
$text_dest .= __('Link Mask', 'seo-ultimate');
} else {
$text_dest .= __('Link Mask (Disabled)', 'seo-ultimate');
$disabled = true;
}
$text_dest .= '</span>';
} else {
$text_dest = __('A Deleted Link Mask', 'seo-ultimate');
$text_dest = '<span class="type">' . $text_dest . '</span>';
$disabled = true;
}
break;
}
$is_url = 'url' == $to_genus && !$text_dest;
$to_genus_type = implode('_', array_filter(array($to_genus, $to_type)));
$obj = 'obj_' . implode('/', array_filter(array($to_genus_type, $to_id)));
//URL textbox
//(hide if object is selected)
$html = "<input name='{$name}' id='{$name}' value='";
$html .= su_esc_editable_html($is_url ? $to_id : $obj);
$html .= "'";
if ($params) {
$e_params = su_esc_attr($params);
$html .= " su:params='{$e_params}'";
}
if ($placeholder) {
$e_placeholder = su_esc_attr($placeholder);
$html .= " placeholder='{$e_placeholder}'";
}
$html .= " type='text' class='form-control input-sm textbox regular-text jlsuggest'";
$html .= ' title="' . __('Type a URL or start typing the name of an item on your site', 'seo-ultimate') . '"';
$html .= $is_url ? '' : ' style="display:none;" ';
$html .= ' />';
//Object box
//(hide if URL is entered)
//.........这里部分代码省略.........
示例10: reinstall_tab
function reinstall_tab()
{
if (!$this->current_user_can_reinstall()) {
$this->print_message('error', __('You do not have sufficient permissions to reinstall plugins on this site.', 'seo-ultimate'));
return;
}
echo "\n<p>";
_e('To download and install a fresh copy of the SEO Ultimate version you are currently using, click the “Reinstall” button below.', 'seo-ultimate');
echo "</p>\n";
$this->admin_form_start(false, false);
echo "<input type='hidden' name='version' id='version' value='" . su_esc_attr(SU_VERSION) . "' />\n";
$this->admin_form_end(__('Reinstall', 'seo-ultimate'), false);
}
示例11: autolink_footer
function autolink_footer($args = array())
{
if ($this->already_outputted) {
return;
}
extract(wp_parse_args($args, array('footer_link_section_format' => $this->get_setting('footer_link_section_format', '{links}'), 'footer_link_format' => $this->get_setting('footer_link_format', '{link}'), 'footer_link_sep' => $this->get_setting('footer_link_sep', ' | '))), EXTR_SKIP);
$links = $this->get_setting('footer_links', array());
suarr::vksort($links, 'anchor');
$link_html = array();
foreach ($links as $link_data) {
if (isset($link_data['from']) && count($link_data['from'])) {
$from = $link_data['from'][0];
} else {
$from = array('');
}
$from_match_children = isset($link_data['from_match_children']) && $link_data['from_match_children'];
$from_match_negative = isset($link_data['from_match_negative']) && $link_data['from_match_negative'];
if (!isset($link_data['to'])) {
$link_data['to'] = '';
}
list($from_genus, $from_type, $from_id) = $this->jlsuggest_value_explode($from);
$is_from = $from_match_negative;
switch ($from_genus) {
case 'posttype':
$post_ids = array($from_id);
if ($from_match_children) {
$post_ids[] = wp_get_post_parent_id($from_id);
}
//Requires WordPress 3.1
foreach ($post_ids as $post_id) {
if (is_single($post_id) || is_page($post_id)) {
$is_from = !$from_match_negative;
break;
}
}
break;
case 'taxonomy':
if (suwp::is_tax($from_type, $from_id) || $from_match_children && is_singular() && has_term($from_id, $from_type)) {
$is_from = !$from_match_negative;
}
break;
case 'home':
if (is_home()) {
$is_from = !$from_match_negative;
}
break;
case 'author':
if (is_author($from_id) || $from_match_children && is_singular() && get_the_author_meta('id') == $from_id) {
$is_from = !$from_match_negative;
}
break;
case 'url':
if ($from_id) {
if (suurl::equal(suurl::current(), $from_id) || $from_match_children && sustr::startswith(suurl::current(), $from_id)) {
$is_from = !$from_match_negative;
}
} else {
$is_from = true;
}
//No "from" restriction
break;
}
if (!$is_from) {
continue;
}
$h_anchor = esc_html($link_data['anchor']);
$rel = $link_data['nofollow'] ? ' rel="nofollow"' : '';
$target = $link_data['target'] == 'blank' ? ' target="_blank"' : '';
$title = strlen($a_titletext = su_esc_attr($link_data['title'])) ? " title=\"{$a_titletext}\"" : '';
$a_url = su_esc_attr($this->jlsuggest_value_to_url($link_data['to']));
if (strlen(trim($h_anchor)) && strlen(trim((string) $a_url)) && $a_url != 'http://') {
$link_html[] = str_replace('{link}', "<a href=\"{$a_url}\"{$title}{$rel}{$target}>{$h_anchor}</a>", $footer_link_format);
}
}
echo str_replace('{links}', implode($footer_link_sep, $link_html), $footer_link_section_format);
}
示例12: postmeta_fields
function postmeta_fields($fields, $screen)
{
if (!current_user_can('manage_options')) {
return $fields;
}
$post_id = suwp::get_post_id();
$post = get_post($post_id);
if (!$post) {
return $fields;
}
$content = $post->post_content;
$alias_dir = $this->get_setting('alias_dir', 'go');
if ($content && preg_match_all('@ href=["\']([^#][^"\']+)["\']@', $content, $matches)) {
$urls = array_unique($matches[1]);
$html = "<tr valign='top'>\n<th scope='row' class='su'>" . __('Link Masks:', 'seo-ultimate') . "</th>\n<td>\n";
$html .= "<table class='widefat'><thead>\n";
$headers = array(__('URL', 'seo-ultimate'), '', __('Mask URL', 'seo-ultimate'));
foreach ($headers as $header) {
$html .= "<th>{$header}</th>\n";
}
$html .= "</thead>\n<tbody>";
$aliases = $this->get_setting('aliases', array());
$post_aliases = array();
foreach ($aliases as $id => $alias) {
if (empty($alias['posts']) || in_array($post->ID, $alias['posts'])) {
$post_aliases[$alias['from']] = array('id' => $id, 'to' => $alias['to']);
}
}
foreach ($urls as $url) {
$a_url = su_esc_attr($url);
$un_h_url = htmlspecialchars_decode($url);
$ht_url = esc_html(sustr::truncate($url, 30));
if (isset($post_aliases[$url])) {
$url_key = $url;
} elseif (isset($post_aliases[$un_h_url])) {
$url_key = $un_h_url;
} else {
$url_key = false;
}
$alias_to = '';
$alias_id = uniqid('', true);
if ($url_key) {
if (isset($post_aliases[$url_key]['to'])) {
$alias_to = $post_aliases[$url_key]['to'];
}
if (isset($post_aliases[$url_key]['id'])) {
$alias_id = $post_aliases[$url_key]['id'];
}
}
$a_alias_to = esc_attr($alias_to);
$html .= "<tr><td><a href='{$a_url}' title='{$a_url}' target='_blank'>{$ht_url}</a><input type='hidden' name='_su_aliases[{$alias_id}][from]' value='{$a_url}' /></td>\n<td>⇒</td><td>/{$alias_dir}/<input type='text' name='_su_aliases[{$alias_id}][to]' value='{$a_alias_to}' /></td></tr>\n";
}
$html .= "</tbody>\n</table>\n";
$html .= '<p><small>' . __('You can stop search engines from following a link by typing in a mask for its URL.', 'seo-ultimate') . "</small></p>\n";
$html .= "</td>\n</tr>\n";
$fields['links'][100]['aliases'] = $html;
}
return $fields;
}
示例13: postmeta_fields
function postmeta_fields($fields)
{
$id = "_su_title";
$value = su_esc_attr($this->get_postmeta('title'));
$fields['serp'][10]['title'] = "<tr class='su textbox' valign='top'>\n<th scope='row' class='su'><label for='{$id}'>" . __('Title Tag:', 'seo-ultimate') . "</label></th>\n" . "<td class='su'><input name='{$id}' id='{$id}' type='text' value='{$value}' class='regular-text' tabindex='2'" . " onkeyup=\"javascript:document.getElementById('su_title_charcount').innerHTML = document.getElementById('_su_title').value.length\" />" . "<br />" . sprintf(__('You’ve entered %s characters. Most search engines use up to 70.', 'seo-ultimate'), "<strong id='su_title_charcount'>" . strlen($value) . "</strong>") . "</td>\n</tr>\n";
return $fields;
}
示例14: output_author_link_tags
function output_author_link_tags()
{
if (is_404()) {
return;
}
$user_id = false;
$mode = $this->get_mode();
switch ($mode) {
case SU_AUTHORLINKS_MODE_OFF:
return;
break;
case SU_AUTHORLINKS_MODE_SINGLEAUTHOR:
$users_with_gp = (array) $this->get_users_with_gp();
$user = reset($users_with_gp);
$user_id = $user->ID;
break;
case SU_AUTHORLINKS_MODE_MULTIAUTHOR:
if (is_home()) {
$home_author = $this->get_setting('home_author', 'none');
if (is_numeric($home_author)) {
$user_id = $home_author;
}
} elseif (is_singular()) {
global $post;
if (is_object($post)) {
$user_id = $post->post_author;
}
} elseif (is_author()) {
global $wp_query;
$user_id = $wp_query->get_queried_object_id();
} elseif (is_archive()) {
$archives_author = $this->get_setting('archives_author', 'none');
if (is_numeric($archives_author)) {
$user_id = $archives_author;
}
}
break;
}
if ($user_id !== false) {
$url = get_user_meta($user_id, 'googleplus', true);
$url = su_esc_attr($url);
if ($url) {
echo "\t<link rel=\"author\" href=\"{$url}\" />\n";
}
}
}
示例15: postmeta_fields
function postmeta_fields($fields, $screen)
{
$id = '_su_description';
$value = su_esc_attr($this->get_postmeta('description'));
$fields['serp'][20]['description'] = "<div class='form-group su textarea'>\n<label class='col-sm-4 col-md-4 control-label' for='{$id}'>" . __('Meta Description:', 'seo-ultimate') . "</label>\n<div class='col-sm-4 col-md-4'>" . "<textarea name='{$id}' id='{$id}' class='form-control regular-text' cols='60' rows='3' tabindex='2'" . " onkeyup=\"javascript:document.getElementById('su_meta_description_charcount').innerHTML = document.getElementById('_su_description').value.length\">{$value}</textarea>" . "</div>\n<div class='col-sm-4 col-md-4 help-text'>" . sprintf(__('You’ve entered %s characters. Most search engines use up to 140.', 'seo-ultimate'), "<strong id='su_meta_description_charcount'>" . strlen($value) . "</strong>") . "</div>\n</div>\n";
return $fields;
}