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


PHP get_author_rss_link函数代码示例

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


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

示例1: wp_list_authors_art

function wp_list_authors_art($args = '')
{
    global $wpdb;
    $defaults = array('optioncount' => false, 'exclude_admin' => true, 'show_fullname' => false, 'hide_empty' => true, 'feed' => '', 'feed_image' => '', 'echo' => true, 'orderby' => 'articles', 'days' => 30, 'show' => 5);
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    $return = '';
    // TODO:  Move select to get_authors().
    switch ($orderby) {
        case 'views':
            $authors = $wpdb->get_results("SELECT COUNT(b.ID) AS postsperuser, a.ID AS post_id, display_name, user_nicename, b.ID AS ID, sum(m.meta_value+0) AS visitas FROM wp_posts AS a, wp_users AS b, wp_postmeta AS m WHERE a.ID = m.post_id AND meta_key='views' AND a.post_author = b.ID AND post_type = 'post' AND post_status = 'publish' AND post_date > '" . date('Y-m-d', strtotime('-' . $days . ' days')) . "' GROUP BY b.ID ORDER BY visitas DESC LIMIT {$show}");
            $select = (array) $wpdb->get_results("SELECT DISTINCT p.post_author, COUNT(DISTINCT p.ID) AS posts, sum(m.meta_value+0) AS count FROM wp_posts AS p, wp_postmeta AS m WHERE p.ID = m.post_id AND meta_key='views' AND p.post_type = 'post' AND p.post_status = 'publish' AND " . get_private_posts_cap_sql('post') . " AND p.post_date > '" . date('Y-m-d', strtotime('-' . $days . ' days')) . "' GROUP BY p.post_author ORDER BY count DESC LIMIT {$show}");
            break;
        case 'votes':
            $authors = $wpdb->get_results("SELECT COUNT(b.ID) AS postsperuser, a.ID AS post_id, display_name, user_nicename, b.ID AS ID, sum(m.meta_value+0) AS visitas FROM wp_posts AS a, wp_users AS b, wp_postmeta AS m WHERE a.ID = m.post_id AND meta_key='_liked' AND a.post_author = b.ID AND post_type = 'post' AND post_status = 'publish' AND post_date > '" . date('Y-m-d', strtotime('-' . $days . ' days')) . "' GROUP BY b.ID ORDER BY visitas DESC LIMIT {$show}");
            $select = (array) $wpdb->get_results("SELECT DISTINCT p.post_author, COUNT(DISTINCT p.ID) AS posts, sum(m.meta_value+0) AS count FROM wp_posts AS p, wp_postmeta AS m WHERE p.ID = m.post_id AND meta_key='_liked' AND p.post_type = 'post' AND p.post_status = 'publish' AND " . get_private_posts_cap_sql('post') . " AND p.post_date > '" . date('Y-m-d', strtotime('-' . $days . ' days')) . "' GROUP BY p.post_author ORDER BY count DESC LIMIT {$show}");
            break;
        case 'all':
            $authors = $wpdb->get_results("SELECT a.ID AS post_id, display_name, user_nicename, b.ID AS ID, sum(views.meta_value+0) AS viewsc, sum(votos.meta_value+0) AS votosc, COUNT(b.ID) AS postsperuser FROM wp_posts AS a, wp_users AS b, wp_postmeta AS votos, wp_postmeta AS views WHERE a.ID = votos.post_id AND a.ID = views.post_id AND votos.meta_key='_liked' AND views.meta_key='views' AND a.post_author = b.ID AND post_type = 'post' AND post_status = 'publish' AND post_date > '" . date('Y-m-d', strtotime('-' . $days . ' days')) . "' GROUP BY b.ID ORDER BY viewsc DESC, votosc DESC, postsperuser DESC LIMIT {$show}");
            $select = (array) $wpdb->get_results("SELECT DISTINCT p.post_author, sum(views.meta_value+0) AS viewsc, sum(votos.meta_value+0) AS votosc, COUNT(DISTINCT p.ID) AS posts, ((sum(views.meta_value+0))+(sum(votos.meta_value+0))+(COUNT(DISTINCT p.ID))) AS count FROM wp_posts AS p, wp_postmeta AS votos, wp_postmeta AS views WHERE p.ID = votos.post_id AND p.ID = views.post_id AND votos.meta_key='_liked' AND views.meta_key='views' AND p.post_type = 'post' AND p.post_status = 'publish' AND " . get_private_posts_cap_sql('post') . " AND p.post_date > '" . date('Y-m-d', strtotime('-' . $days . ' days')) . "' GROUP BY p.post_author ORDER BY viewsc DESC, votosc DESC, posts DESC LIMIT {$show}");
            break;
        case 'follows':
            $authors = $wpdb->get_results("SELECT COUNT(b.ID) AS postsperuser, a.ID AS post_id, display_name, user_nicename, b.ID AS ID, COUNT(DISTINCT c.item_id) AS follows FROM wp_posts AS a, wp_users AS b, wp_follows AS c WHERE a.post_author = b.ID AND c.item_id = b.ID AND c.item_id = a.post_author AND c.item_type = 'author' AND post_type = 'post' AND post_status = 'publish' AND post_date > '" . date('Y-m-d', strtotime('-' . $days . ' days')) . "' GROUP BY b.ID ORDER BY follows DESC LIMIT {$show}");
            $select = (array) $wpdb->get_results("SELECT DISTINCT a.post_author, COUNT(DISTINCT b.item_id) AS count FROM wp_posts AS a, wp_follows AS b WHERE a.post_type = 'post' AND a.post_status = 'publish' AND b.item_id = a.post_author AND b.item_type = 'author' AND " . get_private_posts_cap_sql('post') . " AND a.post_date > '" . date('Y-m-d', strtotime('-' . $days . ' days')) . "' GROUP BY a.post_author ORDER BY count DESC LIMIT {$show}");
            break;
        default:
            $authors = $wpdb->get_results("SELECT COUNT(b.ID) AS postsperuser, a.ID AS post_id, display_name, user_nicename, b.ID AS ID FROM wp_posts AS a, wp_users AS b WHERE a.post_author = b.ID AND post_type = 'post' AND post_status = 'publish' AND post_date > '" . date('Y-m-d', strtotime('-' . $days . ' days')) . "' GROUP BY b.ID ORDER BY postsperuser DESC LIMIT {$show}");
            $select = (array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(DISTINCT ID) AS count FROM {$wpdb->posts} WHERE post_type = 'post' AND post_status = 'publish' AND " . get_private_posts_cap_sql('post') . " AND post_date > '" . date('Y-m-d', strtotime('-' . $days . ' days')) . "' GROUP BY post_author ORDER BY count DESC LIMIT {$show}");
            break;
    }
    $author_count = array();
    foreach ($select as $row) {
        $author_count[$row->post_author] = $row->count;
    }
    foreach ((array) $authors as $author) {
        $author = get_userdata($author->ID);
        $posts = isset($author_count[$author->ID]) ? $author_count[$author->ID] : 0;
        $name = $author->display_name;
        if ($show_fullname && ($author->first_name != '' && $author->last_name != '')) {
            $name = "{$author->first_name} {$author->last_name}";
        }
        if (!($posts == 0 && $hide_empty)) {
            $return .= '<li>';
        }
        if ($posts == 0) {
            if (!$hide_empty) {
                $link = $name;
            }
        } else {
            $link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), attribute_escape($author->display_name)) . '">' . $name . '</a>';
            if (!empty($feed_image) || !empty($feed)) {
                $link .= ' ';
                if (empty($feed_image)) {
                    $link .= '(';
                }
                $link .= '<a href="' . get_author_rss_link(0, $author->ID, $author->user_nicename) . '"';
                if (!empty($feed)) {
                    $title = ' title="' . $feed . '"';
                    $alt = ' alt="' . $feed . '"';
                    $name = $feed;
                    $link .= $title;
                }
                $link .= '>';
                if (!empty($feed_image)) {
                    $link .= "<img src=\"{$feed_image}\" border=\"0\"{$alt}{$title}" . ' />';
                } else {
                    $link .= $name;
                }
                $link .= '</a>';
                if (empty($feed_image)) {
                    $link .= ')';
                }
            }
            if ($optioncount) {
                switch ($orderby) {
                    case 'views':
                        $link .= ' (' . $posts . ' lecturas)';
                        break;
                    case 'votes':
                        $link .= ' (' . $posts . ' votos)';
                        break;
                    case 'follows':
                        $link .= ' (' . $posts . ' seguidores)';
                        break;
                    case 'all':
                        $link .= ' (' . $posts . ' puntos)';
                        break;
                    default:
                        $link .= ' (' . $posts . ' artículos)';
                        break;
                }
            }
        }
        if (!($posts == 0 && $hide_empty)) {
            $return .= $link . '</li>';
        }
    }
    if (!$echo) {
        return $return;
    }
//.........这里部分代码省略.........
开发者ID:Gestiopolis,项目名称:GestiopolisExp1,代码行数:101,代码来源:extras.php

示例2: list_authors

function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') {
	global $wpdb;
	$query = "SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name";
	$authors = $wpdb->get_results($query);

	foreach ( $authors as $author ) {
		$author = get_userdata( $author->ID );
		$posts = get_usernumposts($author->ID);
		$name = $author->nickname;

		if ( $show_fullname && ($author->first_name != '' && $author->last_name != '') )
			$name = "$author->first_name $author->last_name";

		if ( !($posts == 0 && $hide_empty) )
			echo "<li>";
		if ( $posts == 0 ) {
			if ( !$hide_empty )
				$link = $name;
		} else {
			$link = '<a href="' . get_author_link(0, $author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars($author->display_name)) . '">' . $name . '</a>';

			if ( (! empty($feed_image)) || (! empty($feed)) ) {
				$link .= ' ';
				if (empty($feed_image))
					$link .= '(';
				$link .= '<a href="' . get_author_rss_link(0, $author->ID, $author->user_nicename) . '"';

				if ( !empty($feed) ) {
					$title = ' title="' . $feed . '"';
					$alt = ' alt="' . $feed . '"';
					$name = $feed;
					$link .= $title;
				}

				$link .= '>';

				if ( !empty($feed_image) )
					$link .= "<img src=\"$feed_image\" border=\"0\"$alt$title" . ' />';
				else
					$link .= $name;

				$link .= '</a>';

				if ( empty($feed_image) )
					$link .= ')';
			}

			if ( $optioncount )
				$link .= ' ('. $posts . ')';

		}

		if ( !($posts == 0 && $hide_empty) )
			echo "$link</li>";
	}
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:56,代码来源:template-functions-author.php

示例3: _e

</p>
				<ul>
					<?php 
    if ($objAuthor->user_url != 'http://') {
        ?>
<li class="icon author"><a href="<?php 
        echo $objAuthor->user_url;
        ?>
"><?php 
        _e("Visit Author's Website", 'gluedideas_subtle');
        ?>
</a></li><?php 
    }
    ?>
					<li class="icon feed"><a href="<?php 
    get_author_rss_link(true, $objAuthor->ID, $objAuthor->user_login);
    ?>
"><?php 
    _e("Author's Feed", 'gluedideas_subtle');
    ?>
</a></li>
				</ul>
			</div></div>
<?php 
} else {
    ?>
			<div id="search" class="prominent reduced"><div class="inner">
				<h2><?php 
    _e("Find It Quickly", 'gluedideas_subtle');
    ?>
</h2>
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:31,代码来源:search.php

示例4: wp_list_authors

function wp_list_authors($args = '')
{
    if (is_array($args)) {
        $r =& $args;
    } else {
        parse_str($args, $r);
    }
    $defaults = array('optioncount' => false, 'exclude_admin' => true, 'show_fullname' => false, 'hide_empty' => true, 'feed' => '', 'feed_image' => '');
    $r = array_merge($defaults, $r);
    extract($r);
    global $wpdb;
    // TODO:  Move select to get_authors().
    $query = "SELECT ID, user_nicename from {$wpdb->users} " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name";
    $authors = $wpdb->get_results($query);
    foreach ((array) $authors as $author) {
        $author = get_userdata($author->ID);
        $posts = get_usernumposts($author->ID);
        $name = $author->nickname;
        if ($show_fullname && ($author->first_name != '' && $author->last_name != '')) {
            $name = "{$author->first_name} {$author->last_name}";
        }
        if (!($posts == 0 && $hide_empty)) {
            echo "<li>";
        }
        if ($posts == 0) {
            if (!$hide_empty) {
                $link = $name;
            }
        } else {
            $link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), attribute_escape($author->display_name)) . '">' . $name . '</a>';
            if (!empty($feed_image) || !empty($feed)) {
                $link .= ' ';
                if (empty($feed_image)) {
                    $link .= '(';
                }
                $link .= '<a href="' . get_author_rss_link(0, $author->ID, $author->user_nicename) . '"';
                if (!empty($feed)) {
                    $title = ' title="' . $feed . '"';
                    $alt = ' alt="' . $feed . '"';
                    $name = $feed;
                    $link .= $title;
                }
                $link .= '>';
                if (!empty($feed_image)) {
                    $link .= "<img src=\"{$feed_image}\" border=\"0\"{$alt}{$title}" . ' />';
                } else {
                    $link .= $name;
                }
                $link .= '</a>';
                if (empty($feed_image)) {
                    $link .= ')';
                }
            }
            if ($optioncount) {
                $link .= ' (' . $posts . ')';
            }
        }
        if (!($posts == 0 && $hide_empty)) {
            echo "{$link}</li>";
        }
    }
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:62,代码来源:author-template.php

示例5: get_header

get_header();
?>

<div id="userpage">
<div id="main">

<?php 
if (have_posts()) {
    $first_post = true;
    while (have_posts()) {
        the_post();
        $author_feed_url = '';
        if (function_exists('get_author_feed_link')) {
            $author_feed_url = get_author_feed_link(get_the_author_ID());
        } else {
            $author_feed_url = get_author_rss_link(false, get_the_author_ID(), get_the_author_nickname());
        }
        ?>

<?php 
        if ($first_post === true) {
            ?>
	<h2>
		<?php 
            echo get_avatar(get_the_author_email(), 48);
            ?>
		Updates from <?php 
            the_author_posts_link();
            ?>
		<a class="rss" href="<?php 
            echo $author_feed_url;
开发者ID:alx,项目名称:pressmark,代码行数:31,代码来源:author.php

示例6: get_author_rss_link

)" href="<?php 
        get_author_rss_link(true, $author, $author_name);
        ?>
" />
<?php 
    } else {
        if (!empty($GLOBALS['p'])) {
            $_user = get_userdata($GLOBALS['post']->post_author);
            $author = $_user->ID;
            $author_name = $_user->user_login;
            ?>
    <link rel="alternate" type="application/rss+xml" title="RSS 2.0(by <?php 
            echo $author_name;
            ?>
)" href="<?php 
            get_author_rss_link(true, $author, $author_name);
            ?>
" />
<?php 
        }
    }
}
if (get_settings('use_pingback')) {
    ?>
	<link rel="pingback" href="<?php 
    bloginfo('pingback_url');
    ?>
" />
<?php 
}
if (get_settings('xmlrpc_autodetect')) {
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:header.php

示例7: the_author_meta

            ?>
 <?php 
            the_author_meta('display_name');
            ?>
</h2>

				<p><?php 
            _e('You can follow entries authored by');
            ?>
 <?php 
            the_author_meta('user_nicename');
            ?>
 <?php 
            _e('via an');
            ?>
 <a href="<? echo get_author_rss_link(0, $author, $author_nicename); ?>" title="<?php 
            _e('RSS 2.0');
            ?>
"><?php 
            _e('author-only XML feed');
            ?>
</a>.</p>
				<p><?php 
            the_author_meta('user_nicename');
            ?>
 <?php 
            _e('has authored');
            ?>
 <?php 
            the_author_posts();
            ?>
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:31,代码来源:author.php

示例8: list_authors2

function list_authors2($optioncount = false, $exclude_admin = true, $idmode = '', $hide_empty = true, $feed = '', $feed_image = '')
{
    global $wp_id, $wpdb, $blogfilename;
    $query = "SELECT ID, user_idmode, user_nickname, user_firstname, user_lastname, user_login from {$wpdb->users[$wp_id]} " . ($exclude_admin ? "WHERE ID <> 1 " : '') . "ORDER BY user_nickname";
    $authors = $wpdb->get_results($query);
    foreach ($authors as $author) {
        $posts = get_usernumposts($author->ID, true);
        $name = $author->user_nickname;
        if (empty($idmode)) {
            $idmode = $author->user_idmode;
        }
        if ($idmode == 'nickname') {
            $name = $author->user_nickname;
        }
        if ($idmode == 'login') {
            $name = $author->user_login;
        }
        if ($idmode == 'firstname') {
            $name = $author->user_firstname;
        }
        if ($idmode == 'lastname') {
            $name = $author->user_lastname;
        }
        if ($idmode == 'namefl') {
            $name = $author->user_firstname . ' ' . $author->user_lastname;
        }
        if ($idmode == 'namelf') {
            $name = $author->user_lastname . ' ' . $author->user_firstname;
        }
        if (!$idmode) {
            $name = $author->user_nickname;
        }
        if (!($posts == 0 && $hide_empty)) {
            echo "<li>";
        }
        if ($posts == 0) {
            if (!$hide_empty) {
                echo $name;
            }
        } else {
            $link = '<a href="' . get_author_link(0, $author->ID, $author->user_login) . '" title="' . sprintf("Posts by %s", htmlspecialchars($author->user_nickname)) . '">' . stripslashes($name) . '</a>';
            if (!empty($feed_image) || !empty($feed)) {
                $link .= ' ';
                if (empty($feed_image)) {
                    $link .= '(';
                }
                $link .= '<a href="' . get_author_rss_link(0, $author->ID, $author->user_login) . '"';
                if (!empty($feed)) {
                    $title = ' title="' . stripslashes($feed) . '"';
                    $alt = ' alt="' . stripslashes($feed) . '"';
                    $name = stripslashes($feed);
                    $link .= $title;
                }
                $link .= '>';
                if (!empty($feed_image)) {
                    $link .= "<img src=\"{$feed_image}\" border=\"0\" align=\"absbottom\"{$alt}{$title}" . ' />';
                } else {
                    $link .= $name;
                }
                $link .= '</a>';
                if (empty($feed_image)) {
                    $link .= ')';
                }
            }
            if ($optioncount) {
                $link .= ' (' . $posts . ')';
            }
        }
        if (!($posts == 0 && $hide_empty)) {
            echo "{$link}</li>";
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:73,代码来源:template-functions-author.php

示例9: list_authors2

 function list_authors2($optioncount = false, $exclude_admin = true, $idmode = '', $hide_empty = true, $feed = '', $feed_image = '', $echo = true)
 {
     $list_authors2 = '';
     if ($exclude_admin) {
         $criteria = new Criteria('ID', 1, '<>');
     } else {
         $criteria = new CriteriaCompo();
     }
     $criteria->setSort('user_nickname');
     $userHandler =& wp_handler('User');
     $userObjects =& $userHandler->getObjects($criteria);
     foreach ($userObjects as $userObject) {
         $author =& $userObject->exportWpObject($idmode);
         $name = htmlspecialchars(get_author_name($author->ID, $idmode), ENT_QUOTES);
         $posts = get_usernumposts($author->ID);
         if (!($posts == 0 && $hide_empty)) {
             $list_authors2 .= "<li>";
         }
         if ($posts == 0) {
             if (!$hide_empty) {
                 $list_authors2 .= $name;
             }
         } else {
             $link = '<a href="' . get_author_link(0, $author->ID, $author->user_login) . '" title="' . sprintf("Posts by %s", $name) . '">' . $name . '</a>';
             if (!empty($feed_image) || !empty($feed)) {
                 $link .= ' ';
                 if (empty($feed_image)) {
                     $link .= '(';
                 }
                 $link .= '<a href="' . get_author_rss_link(0, $author->ID, $author->user_login) . '"';
                 if (!empty($feed)) {
                     $title = ' title="' . $feed . '"';
                     $alt = ' alt="' . $feed . '"';
                     $name = $feed;
                     $link .= $title;
                 }
                 $link .= '>';
                 if (!empty($feed_image)) {
                     $link .= "<img src=\"{$feed_image}\" border=\"0\" align=\"bottom\"{$alt}{$title}" . ' />';
                 } else {
                     $link .= $name;
                 }
                 $link .= '</a>';
                 if (empty($feed_image)) {
                     $link .= ')';
                 }
             }
             if ($optioncount) {
                 $link .= ' (' . $posts . ')';
             }
         }
         if (!($posts == 0 && $hide_empty)) {
             $list_authors2 .= "{$link}</li>";
         }
     }
     return _echo($list_authors2, $echo);
 }
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:57,代码来源:template-functions-author.php

示例10: wp_list_authors

/**
 * List all the authors of the blog, with several options available.
 *
 * optioncount (boolean) (false): Show the count in parenthesis next to the
 *		author's name.
 * exclude_admin (boolean) (true): Exclude the 'admin' user that is installed by
 *		default.
 * show_fullname (boolean) (false): Show their full names.
 * hide_empty (boolean) (true): Don't show authors without any posts.
 * feed (string) (''): If isn't empty, show links to author's feeds.
 * feed_image (string) (''): If isn't empty, use this image to link to feeds.
 * echo (boolean) (true): Set to false to return the output, instead of echoing.
 *
 * @link http://codex.wordpress.org/Template_Tags/wp_list_authors
 * @since 1.2
 * @param array $args The argument array.
 * @return null|string The output, if echo is set to false.
 */
function wp_list_authors($args = '')
{
    global $wpdb;
    $defaults = array('optioncount' => false, 'exclude_admin' => true, 'show_fullname' => false, 'hide_empty' => true, 'feed' => '', 'feed_image' => '', 'feed_type' => '', 'echo' => true);
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    $return = '';
    /** @todo Move select to get_authors(). */
    $users = get_users_of_blog();
    $author_ids = array();
    foreach ((array) $users as $user) {
        $author_ids[] = $user->user_id;
    }
    if (count($author_ids) > 0) {
        $author_ids = implode(',', $author_ids);
        $authors = $wpdb->get_results("SELECT ID, user_nicename from {$wpdb->users} WHERE ID IN({$author_ids}) " . ($exclude_admin ? "AND user_login <> 'admin' " : '') . "ORDER BY display_name");
    } else {
        $authors = array();
    }
    $author_count = array();
    foreach ((array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM {$wpdb->posts} WHERE post_type = 'post' AND " . get_private_posts_cap_sql('post') . " GROUP BY post_author") as $row) {
        $author_count[$row->post_author] = $row->count;
    }
    foreach ((array) $authors as $author) {
        $author = get_userdata($author->ID);
        $posts = isset($author_count[$author->ID]) ? $author_count[$author->ID] : 0;
        $name = $author->display_name;
        if ($show_fullname && ($author->first_name != '' && $author->last_name != '')) {
            $name = "{$author->first_name} {$author->last_name}";
        }
        if (!($posts == 0 && $hide_empty)) {
            $return .= '<li>';
        }
        if ($posts == 0) {
            if (!$hide_empty) {
                $link = $name;
            }
        } else {
            $link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), attribute_escape($author->display_name)) . '">' . $name . '</a>';
            if (!empty($feed_image) || !empty($feed)) {
                $link .= ' ';
                if (empty($feed_image)) {
                    $link .= '(';
                }
                $link .= '<a href="' . get_author_rss_link(0, $author->ID, $author->user_nicename) . '"';
                if (!empty($feed)) {
                    $title = ' title="' . $feed . '"';
                    $alt = ' alt="' . $feed . '"';
                    $name = $feed;
                    $link .= $title;
                }
                $link .= '>';
                if (!empty($feed_image)) {
                    $link .= "<img src=\"{$feed_image}\" style=\"border: none;\"{$alt}{$title}" . ' />';
                } else {
                    $link .= $name;
                }
                $link .= '</a>';
                if (empty($feed_image)) {
                    $link .= ')';
                }
            }
            if ($optioncount) {
                $link .= ' (' . $posts . ')';
            }
        }
        if (!($posts == 0 && $hide_empty)) {
            $return .= $link . '</li>';
        }
    }
    if (!$echo) {
        return $return;
    }
    echo $return;
}
开发者ID:alx,项目名称:blogsfera,代码行数:93,代码来源:author-template.php

示例11: wp_list_authors

function wp_list_authors($args = '') {
	global $wpdb;
	
	if ( is_array($args) )
		$r = &$args;
	else
		parse_str($args, $r);

	$defaults = array('optioncount' => false, 'exclude_admin' => true, 'show_fullname' => false, 'hide_empty' => true,
		'feed' => '', 'feed_image' => '');
	$r = array_merge($defaults, $r);
	extract($r, EXTR_SKIP);
	
	// TODO:  Move select to get_authors().
	$authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name");
	
	$author_count = array();
	foreach ((array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_status = 'publish' GROUP BY post_author") as $row) {
		$author_count[$row->post_author] = $row->count;
	}

	foreach ( (array) $authors as $author ) {
		$author = get_userdata( $author->ID );
		$posts = (isset($author_count[$author->ID])) ? $author_count[$author->ID] : 0;
		$name = $author->nickname;

		if ( $show_fullname && ($author->first_name != '' && $author->last_name != '') )
			$name = "$author->first_name $author->last_name";

		if ( !($posts == 0 && $hide_empty) )
			echo "<li>";
		if ( $posts == 0 ) {
			if ( !$hide_empty )
				$link = $name;
		} else {
			$link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), attribute_escape($author->display_name)) . '">' . $name . '</a>';

			if ( (! empty($feed_image)) || (! empty($feed)) ) {
				$link .= ' ';
				if (empty($feed_image))
					$link .= '(';
				$link .= '<a href="' . get_author_rss_link(0, $author->ID, $author->user_nicename) . '"';

				if ( !empty($feed) ) {
					$title = ' title="' . $feed . '"';
					$alt = ' alt="' . $feed . '"';
					$name = $feed;
					$link .= $title;
				}

				$link .= '>';

				if ( !empty($feed_image) )
					$link .= "<img src=\"$feed_image\" border=\"0\"$alt$title" . ' />';
				else
					$link .= $name;

				$link .= '</a>';

				if ( empty($feed_image) )
					$link .= ')';
			}

			if ( $optioncount )
				$link .= ' ('. $posts . ')';

		}

		if ( !($posts == 0 && $hide_empty) )
			echo "$link</li>";
	}
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:72,代码来源:author-template.php

示例12: wpyou_authorlist

function wpyou_authorlist($args = '')
{
    global $wpdb;
    $defaults = array('optioncount' => false, 'exclude_admin' => true, 'show_fullname' => false, 'hide_empty' => true, 'feed' => '', 'feed_image' => '', 'feed_type' => '', 'echo' => true, 'num' => '5');
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    $return = '';
    $num = (int) $num;
    if ($num < 1) {
        $num = 5;
    }
    $authors = $wpdb->get_results("SELECT DISTINCT u.ID, u.user_nicename, COUNT( p.ID ) AS count from {$wpdb->users} AS u, {$wpdb->posts} AS p " . ($exclude_admin ? "WHERE u.user_login <> 'admin' " : 'WHERE ') . "AND p.post_author = u.ID AND p.post_type = 'post' AND ( p.post_status = 'publish' OR p.post_status = 'private') GROUP BY p.post_author ORDER BY count DESC, display_name ASC LIMIT {$num}");
    $author_count = array();
    foreach ((array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM {$wpdb->posts} WHERE post_type = 'post' AND " . get_private_posts_cap_sql('post') . " GROUP BY post_author") as $row) {
        $author_count[$row->post_author] = $row->count;
    }
    foreach ((array) $authors as $author) {
        $author = get_userdata($author->ID);
        $posts = isset($author_count[$author->ID]) ? $author_count[$author->ID] : 0;
        $name = $author->display_name;
        if ($show_fullname && ($author->first_name != '' && $author->last_name != '')) {
            $name = "{$author->first_name} {$author->last_name}";
        }
        if (!($posts == 0 && $hide_empty)) {
            $return .= '<li>';
        }
        if ($posts == 0) {
            if (!$hide_empty) {
                $link = $name;
            }
        } else {
            $link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), attribute_escape($author->display_name)) . '">' . $name . '</a>';
            if (!empty($feed_image) || !empty($feed)) {
                $link .= ' ';
                if (empty($feed_image)) {
                    $link .= '(';
                }
                $link .= '<a href="' . get_author_rss_link(0, $author->ID, $author->user_nicename) . '"';
                if (!empty($feed)) {
                    $title = ' title="' . $feed . '"';
                    $alt = ' alt="' . $feed . '"';
                    $name = $feed;
                    $link .= $title;
                }
                $link .= '>';
                if (!empty($feed_image)) {
                    $link .= "<img src=\"{$feed_image}\" style=\"border: none;\"{$alt}{$title}" . ' />';
                } else {
                    $link .= $name;
                }
                $link .= '</a>';
                if (empty($feed_image)) {
                    $link .= ')';
                }
            }
            if ($optioncount) {
                $link .= ' (' . $posts . ')';
            }
        }
        if (!($posts == 0 && $hide_empty)) {
            $return .= $link . '</li>';
        }
    }
    if (!$echo) {
        return $return;
    }
    echo $return;
}
开发者ID:ufoe,项目名称:Wordpress_Theme_Portal,代码行数:68,代码来源:functions.php

示例13: wpu_feed_link

function wpu_feed_link($link)
{
    global $wpSettings;
    if (!empty($wpSettings['usersOwnBlogs'])) {
        //only works if not in admin.
        $authorID = wpu_get_author();
        if (!strstr($link, 'comment')) {
            $link = get_author_rss_link(FALSE, $authorID, '');
        } else {
            //	get author RSS link for comments
        }
    }
    return $link;
}
开发者ID:Oddsor,项目名称:lpt-forum,代码行数:14,代码来源:wpu-plugin.php

示例14: get_wpu_bloglist

function get_wpu_bloglist($showAvatars = TRUE, $maxEntries = 5)
{
    global $wpdb, $authordata, $scriptPath, $wpuAbs, $wpSettings, $wp_version, $phpEx;
    $start = 0;
    $start = (int) trim($_GET['start']);
    $start = $start < 0 ? 0 : $start;
    //get total count
    $sql = "SELECT count(DISTINCT {$wpdb->users}.ID) AS total\n\t\t\tFROM {$wpdb->users} \n\t\t\tINNER JOIN {$wpdb->posts}\n\t\t\tON {$wpdb->users}.ID={$wpdb->posts}.post_author\n\t\t\tWHERE {$wpdb->users}.user_login <> 'admin'";
    $count = $wpdb->get_results($sql);
    $numAuthors = $count[0]->total;
    $maxEntries = $maxEntries < 1 ? 5 : $maxEntries;
    //pull the data we want to display -- this doesn't appear to be very efficient, but it is the same method as  the built-in WP function
    // wp_list_authors uses. Let's hope the data gets cached!
    $sql = "SELECT DISTINCT {$wpdb->users}.ID, {$wpdb->users}.user_login, {$wpdb->users}.user_nicename \n\t\t\tFROM {$wpdb->users}\n\t\t\tINNER JOIN {$wpdb->posts} \n\t\t\tON {$wpdb->users}.ID={$wpdb->posts}.post_author \n\t\t\tWHERE {$wpdb->users}.user_login<>'admin' \n\t\t\tORDER BY {$wpdb->users}.display_name LIMIT {$start}, {$maxEntries}";
    $authors = $wpdb->get_results($sql);
    if (count($authors) > 0) {
        $d = get_settings('time_format');
        $time = mysql2date($d, $time);
        $itern = 1;
        $blogList = '';
        foreach ((array) $authors as $author) {
            $posts = 0;
            $_oldQuery = '';
            $avatar = '';
            $blogTitle = '';
            $blogDesc = '';
            $blogPath = '';
            $path_to_profile = '';
            $lastPostID = 0;
            $post = '';
            $lastPostTitle = '';
            $lastPostURL = '';
            $time = '';
            $lastPostTime = '';
            $posts = get_usernumposts($author->ID);
            if ($posts) {
                $author = get_userdata($author->ID);
                $pID = (int) $author->phpbb_userid;
                $name = $author->nickname;
                if ($show_fullname && ($author->first_name != '' && $author->last_name != '')) {
                    $name = "{$author->first_name} {$author->last_name}";
                }
                $avatar = avatar_create_image($author);
                $blogTitle = empty($author->blog_title) ? $wpuAbs->lang('default_blogname') : $author->blog_title;
                $blogDesc = empty($author->blog_tagline) ? $wpuAbs->lang('default_blogdesc') : $author->blog_tagline;
                if ((double) $wp_version >= 2.1) {
                    //WP >= 2.1 branch
                    $blogPath = get_author_posts_url($author->ID, $author->user_nicename);
                } else {
                    //deprecated branch
                    $blogPath = get_author_link(false, $author->ID, $author->user_nicename);
                }
                $wUsrName = sanitize_user($author->user_login, true);
                if ($wUsrName == $author->user_login) {
                    $pUsrName = $author->user_login;
                } else {
                    $pUsrName == $author->phpbb_userLogin;
                }
                $profile_path = $wpuAbs->ver == 'PHPBB2' ? "profile.{$phpEx}" : "memberlist.{$phpEx}";
                $path_to_profile = empty($pID) ? append_sid($blogPath) : append_sid(add_trailing_slash($scriptPath) . $profile_path . '?mode=viewprofile&amp;u=' . $pID);
                $rssLink = get_author_rss_link(0, $author->ID, $author->user_nicename);
                $lastPostID = $author->wpu_last_post;
                if (empty($lastPostID)) {
                    $_oldQuery = $GLOBALS['wp_query'];
                    query_posts('author=' . $author->ID . '&showposts=1');
                    if (have_posts()) {
                        the_post();
                        if ((double) $wp_version >= 2.1) {
                            //WP >= 2.1 branch
                            $lastPostID = get_the_ID();
                        } else {
                            //deprecated branch
                            global $id;
                            $lastPostID = $id;
                        }
                        update_usermeta($author->ID, 'wpu_last_post', $lastPostID);
                    }
                    $GLOBALS['wp_query'] = $_oldQuery;
                }
                $post = get_post($lastPostID);
                $lastPostTitle = wpu_censor($post->post_title);
                $blogTitle = wpu_censor($blogTitle);
                $blogDesc = wpu_censor($blogDesc);
                $lastPostURL = get_permalink($lastPostID);
                $time = $post->post_date;
                $lastPostTime = apply_filters('get_the_time', $time, $d, FALSE);
                $itern = $itern == 0 ? 1 : 0;
                $blogList .= "<div class=\"wpubl{$itern}\">\n\n";
                if (!empty($avatar)) {
                    $blogList .= "<img src=\"{$avatar}\" alt=\"avatar\"/>\n";
                }
                $blogList .= "<h2 class=\"wpublsubject\" ><a href=\"{$blogPath}\">{$blogTitle}</a>, " . __('by') . ' <a href="' . $path_to_profile . '">' . $name . "</a></h2>\n\n";
                $blogList .= '<p class="wpubldesc">' . $blogDesc . "</p>\n\n";
                $blogList .= '<small class="wpublnumposts">' . __('Total Entries:') . ' ' . $posts . "</small><br />\n\n";
                $blogList .= '<small class="wpublastpost">' . __('Last Entry:') . ' <a href="' . $lastPostURL . '">' . $lastPostTitle . '</a>, ' . __('posted on') . " {$time}</small><br />\n\n";
                if (!empty($rssLink)) {
                    $blogList .= '<small class="wpublrss">' . __('RSS Feed:') . ' <a href="' . $rssLink . '">' . __('Subscribe') . "</a></small><br />\n\n";
                }
                $blogList .= "<p class=\"wpublclr\">&nbsp;</p></div>\n\n";
            }
//.........这里部分代码省略.........
开发者ID:Oddsor,项目名称:lpt-forum,代码行数:101,代码来源:wpu-template-funcs.php

示例15: coauthors_wp_list_authors

/**
 * List all the *co-authors* of the blog, with several options available.
 * optioncount (boolean) (false): Show the count in parenthesis next to the author's name.
 * exclude_admin (boolean) (true): Exclude the 'admin' user that is installed by default.
 * show_fullname (boolean) (false): Show their full names.
 * hide_empty (boolean) (true): Don't show authors without any posts.
 * feed (string) (''): If isn't empty, show links to author's feeds.
 * feed_image (string) (''): If isn't empty, use this image to link to feeds.
 * echo (boolean) (true): Set to false to return the output, instead of echoing.
 * @param array $args The argument array.
 * @return null|string The output, if echo is set to false.
 */
function coauthors_wp_list_authors($args = ''){
	global $wpdb;

	$defaults = array(
		'optioncount' => false, 'exclude_admin' => true,
		'show_fullname' => false, 'hide_empty' => true,
		'feed' => '', 'feed_image' => '', 'echo' => true
	);

	$r = wp_parse_args( $args, $defaults );
	extract($r, EXTR_SKIP);

	$return = '';

	// TODO:  Move select to get_authors().
	$authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name");

	$author_count = array();
	$sql = "SELECT DISTINCT
					p1.post_author,
					(COUNT(ID)+(SELECT COUNT(*)
								FROM $wpdb->posts p2, $wpdb->postmeta pm
								WHERE p2.ID = pm.post_id
									AND pm.meta_key = '_coauthor'
									AND pm.meta_value = p1.post_author)
								) AS count
			FROM $wpdb->posts p1
			WHERE post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . "
			GROUP BY post_author";
	
	foreach ((array)  $wpdb->get_results($sql) as $row) {
		$author_count[$row->post_author] = $row->count;
	}

	foreach ( (array) $authors as $author ) {
		$author = get_userdata( $author->ID );
		$posts = (isset($author_count[$author->ID])) ? $author_count[$author->ID] : 0;
		$name = $author->display_name;

		if ( $show_fullname && ($author->first_name != '' && $author->last_name != '') )
			$name = "$author->first_name $author->last_name";

		if ( !($posts == 0 && $hide_empty) )
			$return .= '<li>';
		if ( $posts == 0 ) {
			if ( !$hide_empty )
				$link = $name;
		} else {
			$link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), attribute_escape($author->display_name)) . '">' . $name . '</a>';

			if ( (! empty($feed_image)) || (! empty($feed)) ) {
				$link .= ' ';
				if (empty($feed_image))
					$link .= '(';
				$link .= '<a href="' . get_author_rss_link(0, $author->ID, $author->user_nicename) . '"';

				if ( !empty($feed) ) {
					$title = ' title="' . $feed . '"';
					$alt = ' alt="' . $feed . '"';
					$name = $feed;
					$link .= $title;
				}

				$link .= '>';

				if ( !empty($feed_image) )
					$link .= "<img src=\"$feed_image\" border=\"0\"$alt$title" . ' />';
				else
					$link .= $name;

				$link .= '</a>';

				if ( empty($feed_image) )
					$link .= ')';
			}

			if ( $optioncount )
				$link .= ' ('. $posts . ')';

		}

		if ( !($posts == 0 && $hide_empty) )
			$return .= $link . '</li>';
	}
	if ( !$echo )
		return $return;
	echo $return;
}
开发者ID:realfluid,项目名称:umbaugh,代码行数:100,代码来源:co-authors.php


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