Ejemplo n.º 1
0
 public static function get_count($key, $user_id)
 {
     $cache_id = 'user-count-' . $user_id;
     $caches = (array) wp_cache_get($cache_id);
     switch ($key) {
         case 'works':
             if (!isset($caches['works'])) {
                 $caches['works'] = (int) count_user_posts($user_id);
                 wp_cache_set($cache_id, $caches, null, self::$cache_expire);
             }
             return $caches['works'];
         case 'comments':
             if (!isset($caches['comments'])) {
                 $caches['comments'] = (int) theme_features::get_user_comments_count($user_id);
                 wp_cache_set($cache_id, $caches, null, self::$cache_expire);
             }
             return $caches['comments'];
         case 'followers_count':
             return (int) get_user_meta($user_id, self::$user_meta_key['followers_count'], true);
         case 'following_count':
             return (int) get_user_meta($user_id, self::$user_meta_key['following_count'], true);
     }
 }
Ejemplo n.º 2
0
echo (int) $author_posts_count !== 0 ? $author_posts_count : '-';
?>
					</a></td>
				</tr>
				<tr>
					<th><?php 
echo ___('Comments');
?>
</th>
					<td>
						<a href="<?php 
echo theme_custom_author_profile::get_tabs('comments', $author)['url'];
?>
">
						<?php 
$count_comments = theme_features::get_user_comments_count($author);
echo (int) $count_comments != 0 ? $count_comments : '-';
?>
						</a>
					</td>
				</tr>
				<?php 
if (class_exists('theme_custom_point')) {
    ?>
					<tr>
						<th><?php 
    echo theme_custom_point::get_point_name();
    ?>
</th>
						<td>
							<?php