本文整理汇总了PHP中pings_open函数的典型用法代码示例。如果您正苦于以下问题:PHP pings_open函数的具体用法?PHP pings_open怎么用?PHP pings_open使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pings_open函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: comments_link
function comments_link($zero = false, $one = false, $more = false, $class = '', $none = false)
{
// Default values lifted from WordPress core
if (false === $zero) {
$zero = esc_html__('No Comments', 'ubik');
}
if (false === $one) {
$one = esc_html__('1 Comment', 'ubik');
}
if (false === $more) {
$more = esc_html__('% Comments', 'ubik');
}
if (false === $none) {
$none = esc_html__('Comments Off', 'ubik');
}
// Setup everything we need using WordPress core functions where appropriate
$id = get_the_ID();
$number = get_comments_number($id);
$href = get_comments_link($id);
$text = get_comments_number_text($zero, $one, $more);
// Custom class handling; automatically add a `comments-link` class but allow for themes to override this
$class = apply_filters('ubik_comments_link_class', trim('comments-link ' . $class));
// Password-protected content
if (post_password_required()) {
if (option('comments_link_protected')) {
$href = '';
// The link will be displayed with all relevant information but no interaction will be possible
$class .= ' disabled';
} else {
return;
// No link will be displayed
}
}
// No comments found
if ($number == 0) {
// Comments and pingbacks are closed AND there aren't any comments
if (!comments_open() && !pings_open()) {
if (option('comments_link_show_none')) {
$text = $none;
// Switch the text to show "Comments Off"
$href = '';
// Disable the link (otherwise we'd be linking to content that doesn't exist)
$class .= ' disabled';
} else {
return;
// No button will be displayed
}
} else {
$href = get_permalink() . '#respond';
// Link to the response form, not the comments area as a whole
}
}
// Assemble the comments link markup
return sprintf('<a%s%s>%s</a>', $href ? sprintf(' href="%s"', esc_url($href)) : '', $class ? sprintf(' class="%s"', esc_attr($class)) : '', apply_filters('ubik_comments_link_text', $text));
}
开发者ID:synapticism,项目名称:ubik,代码行数:55,代码来源:main.php
示例2: ut_get_comments_popup_link
function ut_get_comments_popup_link($zero = false, $one = false, $more = false, $css_class = '', $none = false)
{
global $wpcommentspopupfile, $wpcommentsjavascript;
$id = get_the_ID();
if (false === $zero) {
$zero = __('No Comments', 'ut_shortcodes');
}
if (false === $one) {
$one = __('1 Comment', 'ut_shortcodes');
}
if (false === $more) {
$more = __('% Comments', 'ut_shortcodes');
}
if (false === $none) {
$none = __('Comments Off', 'ut_shortcodes');
}
$number = get_comments_number($id);
$str = '';
if (0 == $number && !comments_open() && !pings_open()) {
$str = '<span' . (!empty($css_class) ? ' class="' . esc_attr($css_class) . '"' : '') . '>' . $none . '</span>';
return $str;
}
if (post_password_required()) {
$str = __('Enter your password to view comments.', 'ut_shortcodes');
return $str;
}
$str = '<a href="';
if ($wpcommentsjavascript) {
if (empty($wpcommentspopupfile)) {
$home = home_url();
} else {
$home = get_option('siteurl');
}
$str .= $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id;
$str .= '" onclick="wpopen(this.href); return false"';
} else {
// if comments_popup_script() is not in the template, display simple comment link
if (0 == $number) {
$str .= get_permalink() . '#respond';
} else {
$str .= get_comments_link();
}
$str .= '"';
}
if (!empty($css_class)) {
$str .= ' class="' . $css_class . '" ';
}
$title = the_title_attribute(array('echo' => 0));
$str .= apply_filters('comments_popup_link_attributes', '');
$str .= ' title="' . esc_attr(sprintf(__('Comment on %s'), $title)) . '">';
$str .= ut_get_comments_number_str($zero, $one, $more);
$str .= '</a>';
return $str;
}
开发者ID:waqasraza123,项目名称:wpgeeks,代码行数:54,代码来源:ut.shortcode.functions.php
示例3: trackbacks
function trackbacks()
{
if ($this->linkbacks) {
thesis_comments_intro(count($this->linkbacks), pings_open(), 'trackbacks');
#wp
echo "\t\t\t\t<ul id=\"trackback_list\">\n";
foreach ($this->linkbacks as $comment) {
echo "\t\t\t\t\t<li>" . thesis_trackback_link($comment) . thesis_trackback_date($comment) . "</li>\n";
}
#filter
echo "\t\t\t\t</ul>\n";
}
}
开发者ID:JGrubb,项目名称:Almond-Tree,代码行数:13,代码来源:comments.php
示例4: trackbacks
function trackbacks($user_data, $depth = 4)
{
if ($this->linkbacks) {
$tab = str_repeat("\t", $depth);
thesis_comments_intro(count($this->linkbacks), pings_open(), 'trackbacks');
#wp
echo "{$tab}<ul id=\"trackback_list\">\n";
foreach ($this->linkbacks as $comment) {
echo "{$tab}\t<li>" . thesis_trackback_link($comment) . thesis_trackback_date($comment) . "</li>\n";
}
#filter
echo "{$tab}</ul>\n";
}
}
开发者ID:CherylMuniz,项目名称:fashion,代码行数:14,代码来源:comments.php
示例5: onemozilla_post_classes
function onemozilla_post_classes($classes)
{
$options = onemozilla_get_theme_options();
$comment_count = get_comments_number($post->ID);
if ($options['hide_author'] != 1) {
$classes[] = 'show-author';
} elseif ($options['hide_author'] == 1) {
$classes[] = 'no-author';
}
if (comments_open($post->ID) || pings_open($post->ID) || $comment_count > 0) {
$classes[] = 'show-comments';
} elseif (!comments_open($post->ID) && !pings_open($post->ID) && $comment_count == 0) {
$classes[] = 'no-comments';
}
return $classes;
}
开发者ID:stejmurphy,项目名称:torch,代码行数:16,代码来源:functions.php
示例6: tamatebako_get_comments_error
/**
* Get Comments Error.
* used in "comments.php"
* @since 3.1.0
*/
function tamatebako_get_comments_error()
{
$out = '';
if (pings_open() && !comments_open()) {
$out .= '<p class="comments-closed pings-open">';
$out .= tamatebako_string('comments_closed_pings_open');
$out .= '</p><!-- .comments-closed.pings-open -->';
} elseif (!comments_open()) {
$out .= '<p class="comments-closed">';
$out .= tamatebako_string('comments_closed');
$out .= '</p><!-- .comments-closed -->';
}
/* do not add comments error on page post type. */
if (is_page()) {
$out = '';
}
return apply_filters('tamatebako_get_comments_error', $out);
}
开发者ID:WPDevHQ,项目名称:nevertheless,代码行数:23,代码来源:comment.php
示例7: tamatebako_comments_link
/**
* Comments Link
* Link to #comments or #respond with number of comments info.
* this is just wrapper function for comments_popup_link().
* TODO: make it more accessible.
* @param $args array formatted comments popup link arguments.
*/
function tamatebako_comments_link($args = array())
{
/* Vars */
$title = get_the_title();
$number = get_comments_number(get_the_ID());
/* Args */
$defaults = array('zero' => number_format_i18n(0), 'one' => number_format_i18n(1), 'more' => '%', 'none' => '', 'css_class' => 'comments-link');
$args = wp_parse_args($args, $defaults);
/* If no comment added, and comments is closed do not display link to comment. */
if (0 == $number && !comments_open() && !pings_open()) {
return;
}
/* In Password Protected Post, add span wrapper. */
if (post_password_required()) {
echo '<span class="comments-link"><span class="screen-reader-text">';
comments_popup_link(number_format_i18n(0), number_format_i18n(1), '%', 'comments-link', '');
echo '</span></span>';
return;
}
/* Display comments link as default. */
comments_popup_link($args['zero'], $args['one'], $args['more'], $args['css_class'], $args['none']);
}
开发者ID:WPDevHQ,项目名称:nevertheless,代码行数:29,代码来源:entry.php
示例8: rc_comments_link
function rc_comments_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post;
if ( false === $zero ) $zero = __( 'No Comments' );
if ( false === $one ) $one = __( '1 Comment' );
if ( false === $more ) $more = __( '% Comments' );
if ( false === $none ) $none = __( 'Comments Off' );
$number = get_comments_number( $id );
if ( 0 == $number && !comments_open() && !pings_open() ) {
echo '<span' . ((!empty($css_class)) ? ' class="' . $css_class . '"' : '') . '>' . $none . '</span>';
return;
}
if ( post_password_required() ) {
echo __('Enter your password to view comments');
return;
}
echo apply_filters( 'comments_popup_link_attributes', '' );
comments_number( $zero, $one, $more, $number );
}
开发者ID:robotconscience,项目名称:Robotconscience.com,代码行数:23,代码来源:index+copy.php
示例9: wp_link_pages
wp_link_pages(array('before' => '<div class="page-links">' . __('Pages:', 'gridster'), 'after' => '</div>'));
?>
</div>
<!-- .entry-content -->
<footer class="entry-meta">
<?php
if (comments_open() && pings_open()) {
// Comments and trackbacks open
printf(__('<a class="comment-link" href="#respond" title="Post a comment">Post a comment</a> or leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'gridster'), get_trackback_url());
} elseif (!comments_open() && pings_open()) {
// Only trackbacks open
printf(__('Comments are closed, but you can leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'gridster'), get_trackback_url());
} elseif (comments_open() && !pings_open()) {
// Only comments open
_e('Trackbacks are closed, but you can <a class="comment-link" href="#respond" title="Post a comment">post a comment</a>.', 'gridster');
} elseif (!comments_open() && !pings_open()) {
// Comments and trackbacks closed
_e('Both comments and trackbacks are currently closed.', 'gridster');
}
edit_post_link(__('Edit', 'gridster'), ' <span class="edit-link">', '</span>');
?>
</footer>
<!-- .entry-meta -->
</article>
<!-- #post-## -->
<?php
// If comments are open or we have at least one comment, load up the comment template
if (comments_open() || '0' != get_comments_number()) {
comments_template();
}
}
开发者ID:Trideon,项目名称:gigolo,代码行数:31,代码来源:image.php
示例10: pingback_ping
/**
* Retrieves a pingback and registers it.
*
* @since 1.5.0
*
* @param array $args Method parameters.
* @return string|IXR_Error
*/
public function pingback_ping($args)
{
global $wpdb;
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
do_action('xmlrpc_call', 'pingback.ping');
$this->escape($args);
$pagelinkedfrom = $args[0];
$pagelinkedto = $args[1];
$title = '';
$pagelinkedfrom = str_replace('&', '&', $pagelinkedfrom);
$pagelinkedto = str_replace('&', '&', $pagelinkedto);
$pagelinkedto = str_replace('&', '&', $pagelinkedto);
/**
* Filter the pingback source URI.
*
* @since 3.6.0
*
* @param string $pagelinkedfrom URI of the page linked from.
* @param string $pagelinkedto URI of the page linked to.
*/
$pagelinkedfrom = apply_filters('pingback_ping_source_uri', $pagelinkedfrom, $pagelinkedto);
if (!$pagelinkedfrom) {
return $this->pingback_error(0, __('A valid URL was not provided.'));
}
// Check if the page linked to is in our site
$pos1 = strpos($pagelinkedto, str_replace(array('http://www.', 'http://', 'https://www.', 'https://'), '', get_option('home')));
if (!$pos1) {
return $this->pingback_error(0, __('Is there no link to us?'));
}
// let's find which post is linked to
// FIXME: does url_to_postid() cover all these cases already?
// if so, then let's use it and drop the old code.
$urltest = parse_url($pagelinkedto);
if ($post_ID = url_to_postid($pagelinkedto)) {
// $way
} elseif (isset($urltest['path']) && preg_match('#p/[0-9]{1,}#', $urltest['path'], $match)) {
// the path defines the post_ID (archives/p/XXXX)
$blah = explode('/', $match[0]);
$post_ID = (int) $blah[1];
} elseif (isset($urltest['query']) && preg_match('#p=[0-9]{1,}#', $urltest['query'], $match)) {
// the querystring defines the post_ID (?p=XXXX)
$blah = explode('=', $match[0]);
$post_ID = (int) $blah[1];
} elseif (isset($urltest['fragment'])) {
// an #anchor is there, it's either...
if (intval($urltest['fragment'])) {
// ...an integer #XXXX (simplest case)
$post_ID = (int) $urltest['fragment'];
} elseif (preg_match('/post-[0-9]+/', $urltest['fragment'])) {
// ...a post id in the form 'post-###'
$post_ID = preg_replace('/[^0-9]+/', '', $urltest['fragment']);
} elseif (is_string($urltest['fragment'])) {
// ...or a string #title, a little more complicated
$title = preg_replace('/[^a-z0-9]/i', '.', $urltest['fragment']);
$sql = $wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_title RLIKE %s", $title);
if (!($post_ID = $wpdb->get_var($sql))) {
// returning unknown error '0' is better than die()ing
return $this->pingback_error(0, '');
}
}
} else {
// TODO: Attempt to extract a post ID from the given URL
return $this->pingback_error(33, __('The specified target URL cannot be used as a target. It either doesn’t exist, or it is not a pingback-enabled resource.'));
}
$post_ID = (int) $post_ID;
$post = get_post($post_ID);
if (!$post) {
// Post_ID not found
return $this->pingback_error(33, __('The specified target URL cannot be used as a target. It either doesn’t exist, or it is not a pingback-enabled resource.'));
}
if ($post_ID == url_to_postid($pagelinkedfrom)) {
return $this->pingback_error(0, __('The source URL and the target URL cannot both point to the same resource.'));
}
// Check if pings are on
if (!pings_open($post)) {
return $this->pingback_error(33, __('The specified target URL cannot be used as a target. It either doesn’t exist, or it is not a pingback-enabled resource.'));
}
// Let's check that the remote site didn't already pingback this entry
if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->comments} WHERE comment_post_ID = %d AND comment_author_url = %s", $post_ID, $pagelinkedfrom))) {
return $this->pingback_error(48, __('The pingback has already been registered.'));
}
// very stupid, but gives time to the 'from' server to publish !
sleep(1);
$remote_ip = preg_replace('/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR']);
/** This filter is documented in wp-includes/class-http.php */
$user_agent = apply_filters('http_headers_useragent', 'WordPress/' . $GLOBALS['wp_version'] . '; ' . get_bloginfo('url'));
// Let's check the remote site
$http_api_args = array('timeout' => 10, 'redirection' => 0, 'limit_response_size' => 153600, 'user-agent' => "{$user_agent}; verifying pingback from {$remote_ip}", 'headers' => array('X-Pingback-Forwarded-For' => $remote_ip));
$request = wp_safe_remote_get($pagelinkedfrom, $http_api_args);
$linea = wp_remote_retrieve_body($request);
if (!$linea) {
return $this->pingback_error(16, __('The source URL does not exist.'));
//.........这里部分代码省略.........
开发者ID:sb-xs,项目名称:que-pour-elle,代码行数:101,代码来源:class-wp-xmlrpc-server.php
示例11: thematic_post_class
function thematic_post_class($print = true)
{
global $post, $thematic_post_alt, $thematic_content_length, $taxonomy;
// hentry for hAtom compliace, gets 'alt' for every other post DIV, describes the post type and p[n]
$c = array('hentry', "p{$thematic_post_alt}", str_replace('_', '-', $post->post_type), $post->post_status);
// Author for the post queried
$c[] = 'author-' . sanitize_title_with_dashes(strtolower(get_the_author_meta('user_login')));
// Category for the post queried
foreach ((array) get_the_category() as $cat) {
$c[] = 'category-' . $cat->slug;
}
// Tags for the post queried; if not tagged, use .untagged
if (get_the_tags() == null) {
$c[] = 'untagged';
} else {
foreach ((array) get_the_tags() as $tag) {
$c[] = 'tag-' . $tag->slug;
}
}
if (function_exists('get_post_type_object')) {
// Taxonomies and terms for the post queried
$single_post_type = get_post_type_object(get_post_type($post->ID));
// Check for post types without taxonomy inclusion
if (isset($single_post_type->taxonomy)) {
foreach ((array) get_the_terms($post->ID, get_post_taxonomies()) as $term) {
// Remove tags and categories from results
if ($term->taxonomy != 'category') {
if ($term->taxonomy != 'post_tag') {
$c[] = 'p-tax-' . $term->taxonomy;
$c[] = 'p-' . $term->taxonomy . '-' . $term->slug;
}
}
}
}
}
// For posts displayed as full content
if ($thematic_content_length == 'full') {
$c[] = 'is-full';
}
// For posts displayed as excerpts
if ($thematic_content_length == 'excerpt') {
$c[] = 'is-excerpt';
if (has_excerpt() && !preg_match('/<!--more(.*?)?-->/', $post->post_content)) {
// For wp-admin Write Page generated excerpts
$c[] = 'custom-excerpt';
} else {
// For automatically generated excerpts
$c[] = 'auto-excerpt';
}
}
// For single posts that had a wp-admin Write Page generated excerpt
if (has_excerpt() && is_single()) {
$c[] = 'has-excerpt';
}
// For posts using more tag
if (preg_match('/<!--more(.*?)?-->/', $post->post_content)) {
if (!is_single()) {
$c[] = 'wp-teaser';
} elseif (is_single()) {
$c[] = 'has-teaser';
}
}
// For posts with comments open or closed
if (comments_open()) {
$c[] = 'comments-open';
} else {
$c[] = 'comments-closed';
}
// For posts with pings open or closed
if (pings_open()) {
$c[] = 'pings-open';
} else {
$c[] = 'pings-closed';
}
// For password-protected posts
if ($post->post_password) {
$c[] = 'protected';
}
// For sticky posts
if (is_sticky()) {
$c[] = 'sticky';
}
// Applies the time- and date-based classes (below) to post DIV
thematic_date_classes(mysql2date('U', $post->post_date), $c);
// If it's the other to the every, then add 'alt' class
if (++$thematic_post_alt % 2) {
$c[] = 'alt';
}
// Adds post slug class, prefixed by 'slug-'
$c[] = 'slug-' . $post->post_name;
// Separates classes with a single space, collates classes for post DIV
$c = join(' ', apply_filters('post_class', $c));
// Available filter: post_class
// And tada!
return $print ? print $c : $c;
}
开发者ID:sams,项目名称:Thematic-html5boilerplate,代码行数:96,代码来源:dynamic-classes.php
示例12: language_attributes
*/
?>
<!DOCTYPE html>
<html <?php
language_attributes();
?>
class="no-js">
<head>
<meta charset="<?php
bloginfo('charset');
?>
">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<?php
if (is_singular() && pings_open(get_queried_object())) {
?>
<link rel="pingback" href="<?php
bloginfo('pingback_url');
?>
">
<?php
}
?>
<?php
wp_head();
?>
</head>
<body <?php
body_class();
开发者ID:arkane0906,项目名称:locsundev.ru,代码行数:31,代码来源:header.php
示例13: the_content
</div><!-- .entry-attachment -->
<div class="entry-description">
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'duster' ), 'after' => '</div>' ) ); ?>
</div><!-- .entry-description -->
</div><!-- .entry-content -->
<footer class="entry-meta">
<?php if ( comments_open() && pings_open() ) : // Comments and trackbacks open ?>
<?php printf( __( '<a class="comment-link" href="#respond" title="Post a comment">Post a comment</a> or leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'duster' ), get_trackback_url() ); ?>
<?php elseif ( ! comments_open() && pings_open() ) : // Only trackbacks open ?>
<?php printf( __( 'Comments are closed, but you can leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'duster' ), get_trackback_url() ); ?>
<?php elseif ( comments_open() && ! pings_open() ) : // Only comments open ?>
<?php _e( 'Trackbacks are closed, but you can <a class="comment-link" href="#respond" title="Post a comment">post a comment</a>.', 'duster' ); ?>
<?php elseif ( ! comments_open() && ! pings_open() ) : // Comments and trackbacks closed ?>
<?php _e( 'Both comments and trackbacks are currently closed.', 'duster' ); ?>
<?php endif; ?>
<?php edit_post_link( __( 'Edit', 'duster' ), ' <span class="edit-link">', '</span>' ); ?>
</footer><!-- .entry-meta -->
</article><!-- #post-<?php the_ID(); ?> -->
<?php comments_template(); ?>
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_footer(); ?>
开发者ID:kevinreilly,项目名称:mendelements.com,代码行数:31,代码来源:image.php
示例14: feed_links_extra
/**
* Display the links to the extra feeds such as category feeds.
*
* @since 2.8.0
*
* @param array $args Optional arguments.
*/
function feed_links_extra($args = array())
{
$defaults = array('separator' => _x('»', 'feed link'), 'singletitle' => __('%1$s %2$s %3$s Comments Feed'), 'cattitle' => __('%1$s %2$s %3$s Category Feed'), 'tagtitle' => __('%1$s %2$s %3$s Tag Feed'), 'authortitle' => __('%1$s %2$s Posts by %3$s Feed'), 'searchtitle' => __('%1$s %2$s Search Results for “%3$s” Feed'), 'posttypetitle' => __('%1$s %2$s %3$s Feed'));
$args = wp_parse_args($args, $defaults);
if (is_singular()) {
$id = 0;
$post = get_post($id);
if (comments_open() || pings_open() || $post->comment_count > 0) {
$title = sprintf($args['singletitle'], get_bloginfo('name'), $args['separator'], the_title_attribute(array('echo' => false)));
$href = get_post_comments_feed_link($post->ID);
}
} elseif (is_post_type_archive()) {
$post_type = get_query_var('post_type');
if (is_array($post_type)) {
$post_type = reset($post_type);
}
$post_type_obj = get_post_type_object($post_type);
$title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], $post_type_obj->labels->name);
$href = get_post_type_archive_feed_link($post_type_obj->name);
} elseif (is_category()) {
$term = get_queried_object();
if ($term) {
$title = sprintf($args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name);
$href = get_category_feed_link($term->term_id);
}
} elseif (is_tag()) {
$term = get_queried_object();
if ($term) {
$title = sprintf($args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name);
$href = get_tag_feed_link($term->term_id);
}
} elseif (is_author()) {
$author_id = intval(get_query_var('author'));
$title = sprintf($args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta('display_name', $author_id));
$href = get_author_feed_link($author_id);
} elseif (is_search()) {
$title = sprintf($args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query(false));
$href = get_search_feed_link();
} elseif (is_post_type_archive()) {
$title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title('', false));
$post_type_obj = get_queried_object();
if ($post_type_obj) {
$href = get_post_type_archive_feed_link($post_type_obj->name);
}
}
if (isset($title) && isset($href)) {
echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr($title) . '" href="' . esc_url($href) . '" />' . "\n";
}
}
开发者ID:jenoya,项目名称:final,代码行数:56,代码来源:general-template.php
示例15: comments_popup_link
/**
* Displays the link to the comments popup window for the current post ID.
*
* Is not meant to be displayed on single posts and pages. Should be used on the
* lists of posts
*
* @since 0.71
* @uses $id
* @uses $wpcommentspopupfile
* @uses $wpcommentsjavascript
* @uses $post
*
* @param string $zero The string to display when no comments
* @param string $one The string to display when only one comment is available
* @param string $more The string to display when there are more than one comment
* @param string $css_class The CSS class to use for comments
* @param string $none The string to display when comments have been turned off
* @return null Returns null on single posts and pages.
*/
function comments_popup_link($zero = false, $one = false, $more = false, $css_class = '', $none = false)
{
global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post;
if (false === $zero) {
$zero = __('No Comments');
}
if (false === $one) {
$one = __('1 Comment');
}
if (false === $more) {
$more = __('% Comments');
}
if (false === $none) {
$none = __('Comments Off');
}
$number = get_comments_number($id);
if (0 == $number && !comments_open() && !pings_open()) {
echo '<span' . (!empty($css_class) ? ' class="' . esc_attr($css_class) . '"' : '') . '>' . $none . '</span>';
return;
}
if (post_password_required()) {
echo __('Enter your password to view comments');
return;
}
echo '<a href="';
if ($wpcommentsjavascript) {
if (empty($wpcommentspopupfile)) {
$home = get_option('home');
} else {
$home = get_option('siteurl');
}
echo $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id;
echo '" onclick="wpopen(this.href); return false"';
} else {
// if comments_popup_script() is not in the template, display simple comment link
if (0 == $number) {
echo get_permalink() . '#respond';
} else {
comments_link();
}
echo '"';
}
if (!empty($css_class)) {
echo ' class="' . $css_class . '" ';
}
$title = esc_attr(get_the_title());
echo apply_filters('comments_popup_link_attributes', '');
echo ' title="' . esc_attr(sprintf(__('Comment on %s'), $title)) . '">';
comments_number($zero, $one, $more, $number);
echo '</a>';
}
开发者ID:klr2003,项目名称:sourceread,代码行数:70,代码来源:comment-template.php
示例16: _e
<?php
} else {
// If there are no comments yet
?>
<p><?php
_e('No comments yet.');
?>
</p>
<?php
}
?>
<p><?php
comments_rss_link(__('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.'));
if (pings_open()) {
?>
<a href="<?php
trackback_url();
?>
" rel="trackback"><?php
_e('TrackBack <abbr title="Universal Resource Locator">URL</abbr>');
?>
</a>
<?php
}
?>
</p>
<?php
if (comments_open()) {
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:30,代码来源:comments.php
示例17: paginate_comments_links
<div class="comment-navigation paged-navigation">
<?php
paginate_comments_links();
?>
</div>
<?php
}
?>
</div><!-- #comments -->
<?php
} else {
?>
<?php
if (pings_open() && !comments_open() && (is_single() || is_page())) {
?>
<p class="comments-closed pings-open">
<?php
printf(__('Comments are closed, but <a href="%1$s" title="Trackback URL for this post">trackbacks</a> and pingbacks are open.', 'framemarket'), trackback_url('0'));
?>
</p>
<?php
} elseif (!comments_open() && (is_single() || is_page())) {
?>
<p class="comments-closed">
<?php
_e('Comments are closed.', 'framemarket');
?>
</p>
<?php
开发者ID:JeffreyBue,项目名称:jb,代码行数:31,代码来源:comments.php
示例18: do_action
*/
do_action('dbx_post_advanced', $post);
// Allow the Discussion meta box to show up if the post type supports comments,
// or if comments or pings are open.
if (comments_open($post) || pings_open($post) || post_type_supports($post_type, 'comments')) {
add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', null, 'normal', 'core');
}
$stati = get_post_stati(array('public' => true));
if (empty($stati)) {
$stati = array('publish');
}
$stati[] = 'private';
if (in_array(get_post_status($post), $stati)) {
// If the post type support comments, or the post has comments, allow the
// Comments meta box.
if (comments_open($post) || pings_open($post) || $post->comment_count > 0 || post_type_supports($post_type, 'comments')) {
add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', null, 'normal', 'core');
}
}
if (!('pending' == get_post_status($post) && !current_user_can($post_type_object->cap->publish_posts))) {
add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core');
}
if (post_type_supports($post_type, 'author')) {
if (is_super_admin() || current_user_can($post_type_object->cap->edit_others_posts)) {
add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core');
}
}
/**
* Fires after all built-in meta boxes have been added.
*
* @since 3.0.0
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:31,代码来源:edit-form-advanced.php
示例19: printf
printf(esc_attr__('See all %1$s posts by %2$s', 'onemozilla'), the_author_posts(), the_author());
?>
"><?php
the_author();
?>
<?php
echo get_avatar(get_the_author_meta('user_email'), 24);
?>
</a></cite></address>
<?php
}
?>
<?php
$comment_count = get_comments_number($post->ID);
if (comments_open() || pings_open() || $comment_count > 0) {
?>
<p class="entry-comments"><a href="<?php
comments_link();
?>
" title="<?php
comments_number('No responses yet', '1 response', '% responses');
?>
"><?php
if ($comment_count > 999) {
comments_number('0', '1', '1k+');
} else {
comments_number('0', '1', '%');
}
?>
</a></p>
开发者ID:stejmurphy,项目名称:torch,代码行数:31,代码来源:content-summary.php
示例20: sync_with_translations
public function sync_with_translations($post_id, $post_vars = false)
{
global $wpdb;
$term_count_update = new WPML_Update_Term_Count();
$post = get_post($post_id);
$translated_ids = $this->post_translation->get_element_translations($post_id, false, true);
$post_format = $this->sync_post_format ? get_post_format($post_id) : null;
$ping_status = $this->sync_ping_status ? pings_open($post_id) ? 'open' : 'closed' : null;
$comment_status = $this->sync_comment_status ? comments_open($post_id) ? 'open' : 'closed' : null;
$post_password = $this->sync_password ? $post->post_password : null;
$post_status = $this->sync_private_flag && get_post_status($post_id) === 'private' ? 'private' : null;
$menu_order = $this->sync_menu_order && !empty($post->menu_order) ? $post->menu_order : null;
$page_template = $this->sync_page_template && get_post_type($post_id) === 'page' ? get_page_template_slug($post_id) : null;
$post_date = $this->sync_post_date ? $wpdb->get_var($wpdb->prepare("SELECT post_date FROM {$wpdb->posts} WHERE ID=%d LIMIT 1", $post_id)) : null;
if ((bool) $post_vars === true) {
$this->sync_sticky_flag($this->post_translation->get_element_trid($post_id), $post_vars);
}
foreach ($translated_ids as $lang_code => $translated_pid) {
$this->sync_custom_fields($post_id, $translated_pid);
if ($post_format !== null) {
set_post_format($translated_pid, $post_format);
}
if ($post_date !== null) {
$post_date_gmt = get_gmt_from_date($post_date);
$data = array('post_date' => $post_date, 'post_date_gmt' => $post_date_gmt);
$now = gmdate('Y-m-d H:i:59');
if (mysql2date('U', $post_date_gmt, false) > mysql2date('U', $now, false)) {
$post_status = 'future';
} else {
$post_status = 'publish';
}
$data['post_status'] = $post_status;
$wpdb->update($wpdb->posts, $data, array('ID' => $translated_pid));
}
if ($post_password !== null) {
$wpdb->update($wpdb->posts, array('post_password' => $post_password), array('ID' => $translated_pid));
}
if ($post_status !== null && !in_array(get_post_status($translated_pid), array('auto-draft', 'draft', 'inherit', 'trash'))) {
$wpdb->update($wpdb->posts, array('post_status' => $post_status), array('ID' => $translated_pid));
$term_count_update->update_for_post($translated_pid);
}
if ($post_status == null && $this->sync_private_flag && get_post_status($translated_pid) == 'private') {
$wpdb->update($wpdb->posts, array('post_status' => get_post_status($post_id)), array('ID' => $translated_pid));
$term_count_update->update_for_post($translated_pid);
}
if ($ping_status !== null) {
$wpdb->update($wpdb->posts, array('ping_status' => $ping_status), array('ID' => $translated_pid));
}
if ($comment_status !== null) {
$wpdb->update($wpdb->posts, array('comment_status' => $comment_status), array('ID' => $translated_pid));
}
if ($page_template !== null) {
update_post_meta($translated_pid, '_wp_page_template', $page_template);
}
$this->sync_with_translations($translated_pid);
}
if ($this->sync_parent) {
$this->maybe_fix_translated_parent(get_post_type($post_id));
}
if ($menu_order !== null && (bool) $translated_ids !== false) {
$wpdb->query("UPDATE {$wpdb->posts}\n\t\t\t\t SET menu_order={$menu_order}\n\t\t\t\t WHERE ID IN (" . wpml_prepare_in($translated_ids, '%d') . ")");
}
}
开发者ID:aarongillett,项目名称:B22-151217,代码行数:63,代码来源:wpml-post-synchro |
请发表评论