<?php

/**
 * Test that all l10n functions are properly recognized.
 *
 * @package WP_L10n_Validator\Tests
 * @since 0.1.0
 */
__('test', 'wp-l10n-validator-tests');
_e('test', 'wp-l10n-validator-tests');
_c('test|context', 'wp-l10n-validator-tests');
_nc('test|context', 'single', 'plural', 'wp-l10n-validator-tests');
__ngettext('single', 'plural', 1, 'wp-l10n-validator-tests');
_n('single', 'plural', 1, 'wp-l10n-validator-tests');
__ngettext_noop('single', 'plural', 'wp-l10n-validator-tests');
_n_noop('single', 'plural', 'wp-l10n-validator-tests');
_x('test', 'context', 'wp-l10n-validator-tests');
_ex('test', 'context', 'wp-l10n-validator-tests');
_nx('singular', 'plural', 1, 'context', 'wp-l10n-validator-tests');
_nx_noop('single', 'plural', 'context', 'wp-l10n-validator-tests');
esc_attr__('test', 'wp-l10n-validator-tests');
esc_html__('test', 'wp-l10n-validator-tests');
esc_html_e('test', 'wp-l10n-validator-tests');
esc_attr_e('test', 'wp-l10n-validator-tests');
esc_attr_x('test', 'context', 'wp-l10n-validator-tests');
esc_html_x('test', 'context', 'wp-l10n-validator-tests');
$avail_post_stati = get_available_post_statuses('page');
if (empty($locked_post_status)) {
    $status_links = array();
    $num_posts = wp_count_posts('page', 'readable');
    $total_posts = array_sum((array) $num_posts);
    $class = empty($_GET['post_status']) ? ' class="current"' : '';
    $status_links[] = "<li><a href='edit-pages.php'{$class}>" . sprintf(__ngettext('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts), number_format_i18n($total_posts)) . '</a>';
    foreach ($post_stati as $status => $label) {
        $class = '';
        if (!in_array($status, $avail_post_stati)) {
            continue;
        }
        if (isset($_GET['post_status']) && $status == $_GET['post_status']) {
            $class = ' class="current"';
        }
        $status_links[] = "<li><a href='edit-pages.php?post_status={$status}'{$class}>" . sprintf(_nc($label[2][0], $label[2][1], $num_posts->{$status}), number_format_i18n($num_posts->{$status})) . '</a>';
    }
    echo implode(" |</li>\n", $status_links) . '</li>';
    unset($status_links);
}
?>
</ul>

<p class="search-box">
	<label class="hidden" for="page-search-input"><?php 
_e('Search Pages');
?>
:</label>
	<input type="text" class="search-input" id="page-search-input" name="s" value="<?php 
_admin_search_query();
?>
Example #3
0
function wp_dashboard_right_now()
{
    global $wp_registered_sidebars;
    $num_posts = wp_count_posts('post');
    $num_pages = wp_count_posts('page');
    $num_cats = wp_count_terms('category');
    $num_tags = wp_count_terms('post_tag');
    $num_comm = wp_count_comments();
    echo "\n\t" . '<p class="sub">' . __('At a Glance') . '</p>';
    echo "\n\t" . '<div class="table">' . "\n\t" . '<table>';
    echo "\n\t" . '<tr class="first">';
    // Posts
    $num = number_format_i18n($num_posts->publish);
    $text = _n('Post', 'Posts', intval($num_posts->publish));
    if (current_user_can('edit_posts')) {
        $num = "<a href='edit.php'>{$num}</a>";
        $text = "<a href='edit.php'>{$text}</a>";
    }
    echo '<td class="first b b-posts">' . $num . '</td>';
    echo '<td class="t posts">' . $text . '</td>';
    /* TODO: Show status breakdown on hover
    	if ( $can_edit_pages && !empty($num_pages->publish) ) { // how many pages is not exposed in feeds.  Don't show if !current_user_can
    		$post_type_texts[] = '<a href="edit-pages.php">'.sprintf( _n( '%s page', '%s pages', $num_pages->publish ), number_format_i18n( $num_pages->publish ) ).'</a>';
    	}
    	if ( $can_edit_posts && !empty($num_posts->draft) ) {
    		$post_type_texts[] = '<a href="edit.php?post_status=draft">'.sprintf( _n( '%s draft', '%s drafts', $num_posts->draft ), number_format_i18n( $num_posts->draft ) ).'</a>';
    	}
    	if ( $can_edit_posts && !empty($num_posts->future) ) {
    		$post_type_texts[] = '<a href="edit.php?post_status=future">'.sprintf( _n( '%s scheduled post', '%s scheduled posts', $num_posts->future ), number_format_i18n( $num_posts->future ) ).'</a>';
    	}
    	if ( current_user_can('publish_posts') && !empty($num_posts->pending) ) {
    		$pending_text = sprintf( _n( 'There is <a href="%1$s">%2$s post</a> pending your review.', 'There are <a href="%1$s">%2$s posts</a> pending your review.', $num_posts->pending ), 'edit.php?post_status=pending', number_format_i18n( $num_posts->pending ) );
    	} else {
    		$pending_text = '';
    	}
    	*/
    // Total Comments
    $num = '<span class="total-count">' . number_format_i18n($num_comm->total_comments) . '</span>';
    $text = _n('Comment', 'Comments', $num_comm->total_comments);
    if (current_user_can('moderate_comments')) {
        $num = "<a href='edit-comments.php'>{$num}</a>";
        $text = "<a href='edit-comments.php'>{$text}</a>";
    }
    echo '<td class="b b-comments">' . $num . '</td>';
    echo '<td class="last t comments">' . $text . '</td>';
    echo '</tr><tr>';
    // Pages
    $num = number_format_i18n($num_pages->publish);
    $text = _n('Page', 'Pages', $num_pages->publish);
    if (current_user_can('edit_pages')) {
        $num = "<a href='edit-pages.php'>{$num}</a>";
        $text = "<a href='edit-pages.php'>{$text}</a>";
    }
    echo '<td class="first b b_pages">' . $num . '</td>';
    echo '<td class="t pages">' . $text . '</td>';
    // Approved Comments
    $num = '<span class="approved-count">' . number_format_i18n($num_comm->approved) . '</span>';
    $text = _nc('Approved|Right Now', 'Approved', $num_comm->approved);
    if (current_user_can('moderate_comments')) {
        $num = "<a href='edit-comments.php?comment_status=approved'>{$num}</a>";
        $text = "<a class='approved' href='edit-comments.php?comment_status=approved'>{$text}</a>";
    }
    echo '<td class="b b_approved">' . $num . '</td>';
    echo '<td class="last t">' . $text . '</td>';
    echo "</tr>\n\t<tr>";
    // Categories
    $num = number_format_i18n($num_cats);
    $text = _n('Category', 'Categories', $num_cats);
    if (current_user_can('manage_categories')) {
        $num = "<a href='categories.php'>{$num}</a>";
        $text = "<a href='categories.php'>{$text}</a>";
    }
    echo '<td class="first b b-cats">' . $num . '</td>';
    echo '<td class="t cats">' . $text . '</td>';
    // Pending Comments
    $num = '<span class="pending-count">' . number_format_i18n($num_comm->moderated) . '</span>';
    $text = _n('Pending', 'Pending', $num_comm->moderated);
    if (current_user_can('moderate_comments')) {
        $num = "<a href='edit-comments.php?comment_status=moderated'>{$num}</a>";
        $text = "<a class='waiting' href='edit-comments.php?comment_status=moderated'>{$text}</a>";
    }
    echo '<td class="b b-waiting">' . $num . '</td>';
    echo '<td class="last t">' . $text . '</td>';
    echo "</tr>\n\t<tr>";
    // Tags
    $num = number_format_i18n($num_tags);
    $text = _n('Tag', 'Tags', $num_tags);
    if (current_user_can('manage_categories')) {
        $num = "<a href='edit-tags.php'>{$num}</a>";
        $text = "<a href='edit-tags.php'>{$text}</a>";
    }
    echo '<td class="first b b-tags">' . $num . '</td>';
    echo '<td class="t tags">' . $text . '</td>';
    // Spam Comments
    $num = number_format_i18n($num_comm->spam);
    $text = _n('Spam', 'Spam', $num_comm->spam);
    if (current_user_can('moderate_comments')) {
        $num = "<a href='edit-comments.php?comment_status=spam'><span class='spam-count'>{$num}</span></a>";
        $text = "<a class='spam' href='edit-comments.php?comment_status=spam'>{$text}</a>";
    }
    echo '<td class="b b-spam">' . $num . '</td>';
    echo '<td class="last t">' . $text . '</td>';
    echo "</tr>";
    do_action('right_now_table_end');
    echo "\n\t</table>\n\t</div>";
    echo "\n\t" . '<div class="versions">';
    $ct = current_theme_info();
    echo "\n\t<p>";
    if (!empty($wp_registered_sidebars)) {
        $sidebars_widgets = wp_get_sidebars_widgets();
        $num_widgets = 0;
        foreach ((array) $sidebars_widgets as $k => $v) {
            if ('wp_inactive_widgets' == $k) {
                continue;
            }
            if (is_array($v)) {
                $num_widgets = $num_widgets + count($v);
            }
        }
        $num = number_format_i18n($num_widgets);
        if (current_user_can('switch_themes')) {
            echo '<a href="themes.php" class="button rbutton">' . __('Change Theme') . '</a>';
            printf(_n('Theme <span class="b"><a href="themes.php">%1$s</a></span> with <span class="b"><a href="widgets.php">%2$s Widget</a></span>', 'Theme <span class="b"><a href="themes.php">%1$s</a></span> with <span class="b"><a href="widgets.php">%2$s Widgets</a></span>', $num_widgets), $ct->title, $num);
        } else {
            printf(_n('Theme <span class="b">%1$s</span> with <span class="b">%2$s Widget</span>', 'Theme <span class="b">%1$s</span> with <span class="b">%2$s Widgets</span>', $num_widgets), $ct->title, $num);
        }
    } else {
        if (current_user_can('switch_themes')) {
            echo '<a href="themes.php" class="button rbutton">' . __('Change Theme') . '</a>';
            printf(__('Theme <span class="b"><a href="themes.php">%1$s</a></span>'), $ct->title);
        } else {
            printf(__('Theme <span class="b">%1$s</span>'), $ct->title);
        }
    }
    echo '</p>';
    update_right_now_message();
    echo "\n\t" . '<br class="clear" /></div>';
    do_action('rightnow_end');
    do_action('activity_box_end');
}