當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Posts::count_by_author方法代碼示例

本文整理匯總了PHP中Posts::count_by_author方法的典型用法代碼示例。如果您正苦於以下問題:PHP Posts::count_by_author方法的具體用法?PHP Posts::count_by_author怎麽用?PHP Posts::count_by_author使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Posts的用法示例。


在下文中一共展示了Posts::count_by_author方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _t

			<span class="nothing">&nbsp;</span>
			<span class="aka">

			<?php 
    if (!$user->info->authenticate_time) {
        $last_login_message = _t('has not logged in yet');
    } else {
        $last_login_message = _t('was last seen %1$s at %2$s');
        $last_login_message = sprintf($last_login_message, '<strong>' . date(DateTime::get_default_date_format(), strtotime($user->info->authenticate_time)) . '</strong>', '<strong>' . date(DateTime::get_default_time_format(), strtotime($user->info->authenticate_time)) . '</strong>');
    }
    $message_bits = array();
    $post_statuses = Post::list_post_statuses();
    unset($post_statuses[array_search('any', $post_statuses)]);
    foreach ($post_statuses as $status_name => $status_id) {
        $status_name = Plugins::filter('post_status_display', $status_name);
        $count = Posts::count_by_author($user->id, $status_id);
        if ($count > 0) {
            $message = '<strong><a href="' . Utils::htmlspecialchars(URL::get('admin', array('page' => 'posts', 'user_id' => $user->id, 'type' => Post::type('any'), 'status' => $status_id))) . '">';
            $message .= _n(_t('%1$d %2$s post', array($count, $status_name)), _t('%1$d %2$s posts', array($count, $status_name)), $count);
            $message .= '</a></strong>';
            $message_bits[] = $message;
        }
    }
    if (!empty($message_bits)) {
        $string = _t('%1$s and currently has %2$s', array($last_login_message, Format::and_list($message_bits)));
    } else {
        $string = $last_login_message;
    }
    echo $string;
    ?>
開發者ID:habari,項目名稱:system,代碼行數:30,代碼來源:users_items.php

示例2: count_posts

 /**
  * Returns the number of posts written by this user
  * @param mixed A status on which to filter posts (published, draft, etc).  If FALSE, no filtering will be performed.  Default: no filtering
  * @return int The number of posts written by this user
  **/
 public function count_posts($status = FALSE)
 {
     return Posts::count_by_author($this->id, $status);
 }
開發者ID:anupom,項目名稱:my-blog,代碼行數:9,代碼來源:user.php


注:本文中的Posts::count_by_author方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。