Example #1
0
/**
 * Get the number of posts within an audit that have a certain status
 *
 * @access public
 * @param mixed $posts  An array of audited posts.
 * @param mixed $status The status to count.
 * @return void $count  The number of posts with a certain status.
 */
function msa_get_post_count_by_status($posts, $status)
{
    $score_statuses = msa_get_score_statuses();
    $score_status = $score_statuses[$status];
    $count = 0;
    foreach ($posts as $key => $item) {
        $score = $item['data']['score'];
        if ($score['score'] >= $score_status['low'] && $score['score'] <= $score_status['high']) {
            $count++;
        }
    }
    return $count;
}
Example #2
0
        esc_attr_e(get_admin_url() . 'admin.php?page=msa-all-audits&audit=' . $audit_id);
        ?>
" class="current"><?php 
        esc_attr_e('All', 'msa');
        ?>
 <span class="count">(<?php 
        esc_attr_e(count($posts));
        ?>
)</span></a> |
		</li>

		<?php 
        $i = 0;
        foreach (msa_get_score_statuses() as $key => $score_status) {
            $separator = ' |';
            if (count(msa_get_score_statuses()) - 1 === $i) {
                $separator = '';
            }
            $i++;
            ?>

			<li class="<?php 
            esc_attr_e($key);
            ?>
">
				<a class="msa-post-status-filter" href="<?php 
            esc_attr_e(get_admin_url() . 'admin.php?page=msa-all-audits&audit=' . $audit_id);
            ?>
&score-low=<?php 
            esc_attr_e($score_status['low']);
            ?>