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


PHP translate_nooped_plural函数代码示例

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


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

示例1: ev_get_post_views

/**
 * Template tag for getting a specific post's view count.  It will default to the current post in The 
 * Loop.  To use the 'text' argument, either pass a nooped plural using _n_noop() or a single text string.
 *
 * @since  1.0.0
 * @access public
 * @param  array  $args
 * @return string
 */
function ev_get_post_views($args = array())
{
    $defaults = array('post_id' => get_the_ID(), 'before' => '', 'after' => '', 'text' => _n_noop('%s View', '%s Views', 'entry-views'), 'wrap' => '<span %s>%s</span>');
    $args = wp_parse_args($args, $defaults);
    $views = ev_get_post_view_count($args['post_id']);
    $text = is_array($args['text']) ? translate_nooped_plural($args['text'], $views) : $args['text'];
    $html = sprintf($args['wrap'], 'class="entry-views" itemprop="interactionCount" itemscope="itemscope" itemtype="http://schema.org/UserPageVisits"', sprintf($text, $views));
    return $args['before'] . $html . $args['after'];
}
开发者ID:turtlepod,项目名称:entry-views,代码行数:18,代码来源:template.php

示例2: get_views

 function get_views()
 {
     global $wpdb;
     $status_links = array();
     $post_types = get_post_types(array('public' => true, 'exclude_from_search' => false));
     $post_types = "'" . implode("', '", $post_types) . "'";
     $states = get_post_stati(array('show_in_admin_all_list' => true));
     $states['trash'] = 'trash';
     $all_states = "'" . implode("', '", $states) . "'";
     $total_posts = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_status IN ({$all_states}) AND post_type IN ({$post_types})");
     $class = empty($_REQUEST['post_status']) ? ' class="current"' : '';
     $status_links['all'] = "<a href='admin.php?page=seo_extended_titles'{$class}>" . sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts'), number_format_i18n($total_posts)) . '</a>';
     foreach (get_post_stati(array('show_in_admin_all_list' => true), 'objects') as $status) {
         $status_name = $status->name;
         $total = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_status IN ('{$status_name}') AND post_type IN ({$post_types})");
         if ($total == 0) {
             continue;
         }
         if (isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status']) {
             $class = ' class="current"';
         } else {
             $class = '';
         }
         $status_links[$status_name] = "<a href='admin.php?page=seo_extended_titles&amp;post_status={$status_name}'{$class}>" . sprintf(translate_nooped_plural($status->label_count, $total), number_format_i18n($total)) . '</a>';
     }
     $trashed_posts = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_status IN ('trash') AND post_type IN ({$post_types})");
     $class = isset($_REQUEST['post_status']) && 'trash' == $_REQUEST['post_status'] ? 'class="current"' : '';
     $status_links['trash'] = "<a href='admin.php?page=seo_extended_titles&amp;post_status=trash'{$class}>" . sprintf(_nx('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>', $trashed_posts, 'posts'), number_format_i18n($trashed_posts)) . '</a>';
     return $status_links;
 }
开发者ID:shieldsdesignstudio,项目名称:trilogic,代码行数:30,代码来源:class-seo-extended-bulk-title-list-table.php

示例3: get_views

 protected function get_views()
 {
     global $wpdb, $post_mime_types, $avail_post_mime_types;
     $type_links = array();
     $_num_posts = (array) wp_count_attachments();
     $_total_posts = array_sum($_num_posts) - $_num_posts['trash'];
     $total_orphans = $wpdb->get_var("SELECT COUNT( * ) FROM {$wpdb->posts} WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1");
     $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
     foreach ($matches as $type => $reals) {
         foreach ($reals as $real) {
             $num_posts[$type] = isset($num_posts[$type]) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real];
         }
     }
     $selected = empty($_GET['attachment-filter']) ? ' selected="selected"' : '';
     $type_links['all'] = "<option value=''{$selected}>" . sprintf(_nx('All (%s)', 'All (%s)', $_total_posts, 'uploaded files'), number_format_i18n($_total_posts)) . '</option>';
     foreach ($post_mime_types as $mime_type => $label) {
         if (!wp_match_mime_types($mime_type, $avail_post_mime_types)) {
             continue;
         }
         $selected = '';
         if (!empty($_GET['attachment-filter']) && strpos($_GET['attachment-filter'], 'post_mime_type:') === 0 && wp_match_mime_types($mime_type, str_replace('post_mime_type:', '', $_GET['attachment-filter']))) {
             $selected = ' selected="selected"';
         }
         if (!empty($num_posts[$mime_type])) {
             $type_links[$mime_type] = '<option value="post_mime_type:' . esc_attr($mime_type) . '"' . $selected . '>' . sprintf(translate_nooped_plural($label[2], $num_posts[$mime_type]), number_format_i18n($num_posts[$mime_type])) . '</option>';
         }
     }
     $type_links['detached'] = '<option value="detached"' . ($this->detached ? ' selected="selected"' : '') . '>' . sprintf(_nx('Unattached (%s)', 'Unattached (%s)', $total_orphans, 'detached files'), number_format_i18n($total_orphans)) . '</option>';
     $type_links['uncategorized'] = '<option value="uncategorized"' . ($this->uncategorized ? ' selected="selected"' : '') . '>' . __('All Uncategorized', 'eml') . '</option>';
     if (!empty($_num_posts['trash'])) {
         $type_links['trash'] = '<option value="trash"' . (isset($_GET['attachment-filter']) && $_GET['attachment-filter'] == 'trash' ? ' selected="selected"' : '') . '>' . sprintf(_nx('Trash (%s)', 'Trash (%s)', $_num_posts['trash'], 'uploaded files'), number_format_i18n($_num_posts['trash'])) . '</option>';
     }
     return $type_links;
 }
开发者ID:vanlong200880,项目名称:uni,代码行数:34,代码来源:class-eml-media-list-table.php

示例4: dbz_human_time_diff

/**
 * Calculate the time difference - a replacement for `human_time_diff()` until it is improved.
 *
 * Based on BuddyPress function `bp_core_time_since()`, which in turn is based on functions created by
 * Dunstan Orchard - http://1976design.com
 *
 * This function will return an text representation of the time elapsed since a
 * given date, giving the two largest units e.g.:
 *
 *  - 2 hours and 50 minutes
 *  - 4 days
 *  - 4 weeks and 6 days
 *
 * @since 1.7.0
 *
 * @param $older_date int Unix timestamp of date you want to calculate the time since for`
 * @param $newer_date int Optional. Unix timestamp of date to compare older date to. Default false (current time)`
 *
 * @return str The time difference
 */
function dbz_human_time_diff($older_date, $newer_date = false, $timeunits = 1)
{
    //* If no newer date is given, assume now
    $newer_date = $newer_date ? $newer_date : time();
    $timeunits = $timeunits >= 2 ? 2 : 1;
    //* Difference in seconds
    $since = absint($newer_date - $older_date);
    if (!$since) {
        return '0 ' . _x('seconds', 'time difference', 'genesis');
    }
    //* Hold units of time in seconds, and their pluralised strings (not translated yet)
    $units = array(array(31536000, _nx_noop('%s year', '%s years', 'time difference', 'genesis')), array(2592000, _nx_noop('%s month', '%s months', 'time difference', 'genesis')), array(604800, _nx_noop('%s week', '%s weeks', 'time difference', 'genesis')), array(86400, _nx_noop('%s day', '%s days', 'time difference', 'genesis')), array(3600, _nx_noop('%s hour', '%s hours', 'time difference', 'genesis')), array(60, _nx_noop('%s minute', '%s minutes', 'time difference', 'genesis')), array(1, _nx_noop('%s second', '%s seconds', 'time difference', 'genesis')));
    //* Step one: the first unit
    for ($i = 0, $j = count($units); $i < $j; $i++) {
        $seconds = $units[$i][0];
        //* Finding the biggest chunk (if the chunk fits, break)
        if (($count = floor($since / $seconds)) != 0) {
            break;
        }
    }
    //* Translate unit string, and add to the output
    $output = sprintf(translate_nooped_plural($units[$i][1], $count, 'genesis'), $count);
    //* Note the next unit
    $ii = $i + 1;
    //* Step two: the second unit
    if ($ii < $j && $timeunits > 1) {
        $seconds2 = $units[$ii][0];
        //* Check if this second unit has a value > 0
        if (($count2 = floor(($since - $seconds * $count) / $seconds2)) !== 0) {
            //* Add translated separator string, and translated unit string
            $output .= sprintf(' %s ' . translate_nooped_plural($units[$ii][1], $count2, 'genesis'), _x('and', 'separator in time difference', 'genesis'), $count2);
        }
    }
    return $output;
}
开发者ID:MarioGiancini,项目名称:thedbz-theme,代码行数:55,代码来源:theme-helpers.php

示例5: get_views

 function get_views()
 {
     global $wpdb, $post_mime_types, $avail_post_mime_types;
     $type_links = array();
     $_num_posts = (array) wp_count_attachments();
     $_total_posts = array_sum($_num_posts) - $_num_posts['trash'];
     if (!isset($total_orphans)) {
         $total_orphans = $wpdb->get_var("SELECT COUNT( * ) FROM {$wpdb->posts} WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1");
     }
     $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
     foreach ($matches as $type => $reals) {
         foreach ($reals as $real) {
             $num_posts[$type] = isset($num_posts[$type]) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real];
         }
     }
     $class = empty($_GET['post_mime_type']) && !isset($_GET['status']) ? ' class="current"' : '';
     $type_links['all'] = "<a href='upload.php'{$class}>" . sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $_total_posts, 'uploaded files'), number_format_i18n($_total_posts)) . '</a>';
     foreach ($post_mime_types as $mime_type => $label) {
         $class = '';
         if (!wp_match_mime_types($mime_type, $avail_post_mime_types)) {
             continue;
         }
         if (!empty($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type'])) {
             $class = ' class="current"';
         }
         if (!empty($num_posts[$mime_type])) {
             $type_links[$mime_type] = "<a href='upload.php?post_mime_type={$mime_type}'{$class}>" . sprintf(translate_nooped_plural($label[2], $num_posts[$mime_type]), number_format_i18n($num_posts[$mime_type])) . '</a>';
         }
     }
     if (!empty($_num_posts['trash'])) {
         $type_links['trash'] = '<a href="upload.php?status=trash"' . (isset($_GET['status']) && $_GET['status'] == 'trash' ? ' class="current"' : '') . '>' . sprintf(_nx('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>', $_num_posts['trash'], 'uploaded files'), number_format_i18n($_num_posts['trash'])) . '</a>';
     }
     return array();
 }
开发者ID:sangikumar,项目名称:IP,代码行数:34,代码来源:class-frontend-uploader-wp-posts-list-table.php

示例6: get_views

 function get_views()
 {
     $status_links = array();
     $num_posts = wp_count_posts(self::$post_type, 'readable');
     $allposts = '';
     $total_posts = array_sum((array) $num_posts);
     // Subtract post types that are not included in the admin all list.
     foreach (get_post_stati(array('show_in_admin_all_list' => false)) as $state) {
         $total_posts -= $num_posts->{$state};
     }
     $class = empty($_REQUEST['post_status']) ? ' class="current"' : '';
     $status_links['all'] = "<a href='edit.php?post_type=sa_invoice&page=sprout-apps/invoice_payments{$allposts}'{$class}>" . sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts'), number_format_i18n($total_posts)) . '</a>';
     foreach (get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status) {
         $class = '';
         $status_name = $status->name;
         if (empty($num_posts->{$status_name})) {
             continue;
         }
         if (isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status']) {
             $class = ' class="current"';
         }
         // replace "Published" with "Complete".
         $label = str_replace('Published', 'Complete', translate_nooped_plural($status->label_count, $num_posts->{$status_name}));
         $status_links[$status_name] = "<a href='edit.php?post_type=sa_invoice&page=sprout-apps/invoice_payments&post_status={$status_name}'{$class}>" . sprintf($label, number_format_i18n($num_posts->{$status_name})) . '</a>';
     }
     return $status_links;
 }
开发者ID:danielbachhuber,项目名称:marcgratch.com,代码行数:27,代码来源:Payments_Admin_Table.php

示例7: mb_natural_time

/**
 * @link https://core.trac.wordpress.org/ticket/29849
 */
function mb_natural_time($from, $to = '', $limit = 1)
{
    if (empty($to)) {
        $to = current_time('timestamp');
    }
    $diff = absint($to - $from);
    if ($diff < 1) {
        return apply_filters('mb_natural_time', _x('now', 'time ago', 'message-board'), $from, $to, $limit, $diff);
    }
    $result = array();
    $l10n = array(array(YEAR_IN_SECONDS, _nx_noop('%s year', '%s years', 'time ago', 'message-board')), array(30 * DAY_IN_SECONDS, _nx_noop('%s month', '%s months', 'time ago', 'message-board')), array(WEEK_IN_SECONDS, _nx_noop('%s week', '%s weeks', 'time ago', 'message-board')), array(DAY_IN_SECONDS, _nx_noop('%s day', '%s days', 'time ago', 'message-board')), array(HOUR_IN_SECONDS, _nx_noop('%s hour', '%s hours', 'time ago', 'message-board')), array(MINUTE_IN_SECONDS, _nx_noop('%s minute', '%s minutes', 'time ago', 'message-board')), array(1, _nx_noop('%s second', '%s seconds', 'time ago', 'message-board')));
    foreach ($l10n as $key => $pair) {
        $count = (int) ($diff / $pair[0]);
        if ($count > 0) {
            $result[] = sprintf(translate_nooped_plural($l10n[$key][1], $count), $count);
            $diff -= $count * $pair[0];
        }
        if ($limit && count($result) >= $limit) {
            break;
        }
    }
    $label = $to > $from ? _x('%s ago', 'time ago', 'message-board') : _x('%s from now', 'time from now', 'message-board');
    $result = implode(_x(', ', 'natural time separator', 'message-board'), $result);
    $result = sprintf($label, $result);
    return apply_filters('mb_natural_time', $result, $from, $to, $limit, $diff);
}
开发者ID:justintadlock,项目名称:message-board,代码行数:29,代码来源:formatting.php

示例8: get_views

 function get_views()
 {
     $status_links = array();
     $num_posts = wp_count_posts(self::$storage_post_type, 'readable');
     $entries_stati = get_post_stati(array('show_in_admin_status_list' => true), 'objects');
     $view_link = add_query_arg(array('page' => 'cf7_storage'), admin_url('admin.php'));
     $status_links['all'] = sprintf('<a href="%s">%s <span class="count">(%d)</span></a>', $view_link, esc_html__('All', 'cf7-storage'), $num_posts->publish);
     $status_links['trash'] = sprintf('<a href="%s" %s>%s</a>', add_query_arg('post_status', 'trash', $view_link), $this->is_trash ? 'class="current"' : null, sprintf(translate_nooped_plural($entries_stati['trash']->label_count, $num_posts->trash), number_format_i18n($num_posts->trash)));
     return $status_links;
 }
开发者ID:misfist,项目名称:missdrepants-network,代码行数:10,代码来源:admin-list-view.php

示例9: test_nx_noop

 /**
  * @ticket 35961
  */
 function test_nx_noop()
 {
     $text_domain = 'text-domain';
     $nooped_plural = _nx_noop('%s post', '%s posts', 'my-context', $text_domain);
     $this->assertNotEmpty($nooped_plural['domain']);
     $this->assertNotEmpty($nooped_plural['context']);
     $this->assertEquals('%s posts', translate_nooped_plural($nooped_plural, 0, $text_domain));
     $this->assertEquals('%s post', translate_nooped_plural($nooped_plural, 1, $text_domain));
     $this->assertEquals('%s posts', translate_nooped_plural($nooped_plural, 2, $text_domain));
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:13,代码来源:l10n.php

示例10: _convert_values

 /**
  * Convert values to bo used in rendering
  */
 protected function _convert_values()
 {
     foreach ($this->_args['value'] as &$view) {
         $view['enabled'] = $view['enabled'] ? 'checked="checked"' : '';
         $view['default'] = $view['default'] ? 'checked="checked"' : '';
         // Use mobile settings if available, else fall back to desktop settings.
         $view['enabled_mobile'] = isset($view['enabled_mobile']) ? $view['enabled_mobile'] ? 'checked="checked"' : '' : $view['enabled'];
         $view['default_mobile'] = isset($view['default_mobile']) ? $view['default_mobile'] ? 'checked="checked"' : '' : $view['default'];
         $view['longname'] = translate_nooped_plural($view['longname'], 1);
     }
 }
开发者ID:sedici,项目名称:wpmu-istec,代码行数:14,代码来源:enabled-views.php

示例11: get_views

 function get_views()
 {
     global $post_type_object, $locked_post_status, $avail_post_stati;
     $post_type = $post_type_object->name;
     if (!empty($locked_post_status)) {
         return array();
     }
     $status_links = array();
     $num_posts = wp_count_posts($post_type, 'readable');
     $class = '';
     $allposts = '';
     $current_user_id = get_current_user_id();
     if ($this->user_posts_count) {
         if (isset($_GET['author']) && $_GET['author'] == $current_user_id) {
             $class = ' class="current"';
         }
         $status_links['mine'] = "<a href='edit.php?post_type={$post_type}&author={$current_user_id}'{$class}>" . sprintf(_nx('Mine <span class="count">(%s)</span>', 'Mine <span class="count">(%s)</span>', $this->user_posts_count, 'posts'), number_format_i18n($this->user_posts_count)) . '</a>';
         $allposts = '&all_posts=1';
     }
     $total_posts = array_sum((array) $num_posts);
     // Subtract post types that are not included in the admin all list.
     foreach (get_post_stati(array('show_in_admin_all_list' => false)) as $state) {
         $total_posts -= $num_posts->{$state};
     }
     $class = empty($class) && empty($_REQUEST['post_status']) && empty($_REQUEST['show_sticky']) ? ' class="current"' : '';
     $status_links['all'] = "<a href='edit.php?post_type={$post_type}{$allposts}'{$class}>" . sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts'), number_format_i18n($total_posts)) . '</a>';
     foreach (get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status) {
         $class = '';
         $status_name = $status->name;
         if (!in_array($status_name, $avail_post_stati)) {
             continue;
         }
         if (empty($num_posts->{$status_name})) {
             continue;
         }
         if (isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status']) {
             $class = ' class="current"';
         }
         $status_links[$status_name] = "<a href='edit.php?post_status={$status_name}&amp;post_type={$post_type}'{$class}>" . sprintf(translate_nooped_plural($status->label_count, $num_posts->{$status_name}), number_format_i18n($num_posts->{$status_name})) . '</a>';
     }
     if (!empty($this->sticky_posts_count)) {
         $class = !empty($_REQUEST['show_sticky']) ? ' class="current"' : '';
         $sticky_link = array('sticky' => "<a href='edit.php?post_type={$post_type}&amp;show_sticky=1'{$class}>" . sprintf(_nx('Sticky <span class="count">(%s)</span>', 'Sticky <span class="count">(%s)</span>', $this->sticky_posts_count, 'posts'), number_format_i18n($this->sticky_posts_count)) . '</a>');
         // Sticky comes after Publish, or if not listed, after All.
         $split = 1 + array_search(isset($status_links['publish']) ? 'publish' : 'all', array_keys($status_links));
         $status_links = array_merge(array_slice($status_links, 0, $split), $sticky_link, array_slice($status_links, $split));
     }
     return $status_links;
 }
开发者ID:danielbachhuber,项目名称:marcgratch.com,代码行数:49,代码来源:Records_Admin_Table.php

示例12: call_some_i18n_methods

function call_some_i18n_methods()
{
    __('Hello World', 'test-domain');
    _e('Hello World', 'test-domain');
    _n('Single', 'Plural', 1, 'test-domain');
    _n_noop('Single Noop', 'Plural Noop', 1, 'test-domain');
    _x('Hello World', 'Testing', 'test-domain');
    _ex('Hello World', 'Testing', 'test-domain');
    _nx('Hello World', 'Testing', 'test-domain');
    _nx_noop('Hello World Noop', 'Testing', 'test-domain');
    esc_attr__('Attribute', 'test-domain');
    esc_html__('HTML', 'test-domain');
    esc_attr_e('Attribute', 'test-domain');
    esc_html_e('HTML', 'test-domain');
    esc_attr_x('Attribute', 'Testing', 'test-domain');
    esc_html_x('HTML', 'Testing', 'test-domain');
    translate_nooped_plural('Plural Noop', 2, 'test-domain');
}
开发者ID:dd32,项目名称:wordpress.develop,代码行数:18,代码来源:add-textdomain-0-result.php

示例13: wp_custom_recount_attachments

 public static function wp_custom_recount_attachments($views)
 {
     $_total_posts = array();
     $_num_posts = array();
     global $wpdb, $current_user, $post_mime_types, $avail_post_mime_types;
     $views = array();
     $count = $wpdb->get_results("\r\n\t\t\t\t\tSELECT post_mime_type, COUNT( * ) AS num_posts \r\n\t\t\t\t\tFROM {$wpdb->posts} \r\n\t\t\t\t\tWHERE post_type = 'attachment' \r\n\t\t\t\t\tAND post_author = {$current_user->ID} \r\n\t\t\t\t\tAND post_status != 'trash' \r\n\t\t\t\t\tGROUP BY post_mime_type\r\n\t\t\t\t", ARRAY_A);
     foreach ($count as $row) {
         $_num_posts[$row['post_mime_type']] = $row['num_posts'];
     }
     $_total_posts = array_sum($_num_posts);
     $detached = isset($_REQUEST['detached']) || isset($_REQUEST['find_detached']);
     if (!isset($total_orphans)) {
         $total_orphans = $wpdb->get_var("\r\n\t\t\t\t\t\tSELECT COUNT( * ) \r\n\t\t\t\t\t\tFROM {$wpdb->posts} \r\n\t\t\t\t\t\tWHERE post_type = 'attachment' \r\n\t\t\t\t\t\tAND post_author = {$current_user->ID} \r\n\t\t\t\t\t\tAND post_status != 'trash' \r\n\t\t\t\t\t\tAND post_parent < 1\r\n\t\t\t\t\t");
     }
     $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
     foreach ($matches as $type => $reals) {
         foreach ($reals as $real) {
             $num_posts[$type] = isset($num_posts[$type]) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real];
         }
     }
     $class = empty($_GET['post_mime_type']) && !$detached && !isset($_GET['status']) ? ' class="current"' : '';
     $views['all'] = "<a href='upload.php'{$class}>" . sprintf(__('All <span class="count">(%s)</span>', 'uploaded files'), number_format_i18n($_total_posts)) . '</a>';
     foreach ($post_mime_types as $mime_type => $label) {
         $class = '';
         if (!wp_match_mime_types($mime_type, $avail_post_mime_types)) {
             continue;
         }
         if (!empty($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type'])) {
             $class = ' class="current"';
         }
         if (!empty($num_posts[$mime_type])) {
             $views[$mime_type] = "<a href='upload.php?post_mime_type={$mime_type}'{$class}>" . sprintf(translate_nooped_plural($label[2], $num_posts[$mime_type]), $num_posts[$mime_type]) . '</a>';
         }
     }
     $views['detached'] = '<a href="upload.php?detached=1"' . ($detached ? ' class="current"' : '') . '>' . sprintf(__('Unattached <span class="count">(%s)</span>', 'detached files'), $total_orphans) . '</a>';
     return $views;
 }
开发者ID:zruiz,项目名称:NG,代码行数:38,代码来源:wp_media_custom.php

示例14: get_views

 function get_views()
 {
     global $post_type_object, $locked_post_status, $avail_post_stati;
     $post_type = $this->post_type;
     if (!empty($locked_post_status)) {
         return array();
     }
     $status_links = array();
     $num_posts = $this->count_posts($post_type, 'readable');
     $class = '';
     $allposts = '';
     $total_posts = array_sum((array) $num_posts);
     // Subtract post types that are not included in the admin all list.
     foreach (get_post_stati(array('show_in_admin_all_list' => false)) as $state) {
         $total_posts -= $num_posts->{$state};
     }
     $class = empty($class) && empty($_REQUEST['post_status']) && empty($_REQUEST['show_sticky']) ? ' class="current"' : '';
     $status_links['all'] = "<a href='edit.php?post_type={$post_type}{$allposts}'{$class}>" . sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts'), number_format_i18n($total_posts)) . '</a>';
     $statuses = get_post_stati(array('show_in_admin_status_list' => true), 'objects');
     foreach ($statuses as $status) {
         $class = '';
         $status_name = $status->name;
         if (!in_array($status_name, $avail_post_stati)) {
             continue;
         }
         if (empty($num_posts->{$status_name})) {
             continue;
         }
         if (isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status']) {
             $class = ' class="current"';
         }
         $status_links[$status_name] = "<a href='edit.php?post_status={$status_name}&amp;post_type={$post_type}'{$class}>" . sprintf(translate_nooped_plural($status->label_count, $num_posts->{$status_name}), number_format_i18n($num_posts->{$status_name})) . '</a>';
     }
     $num_posts->total = $total_posts;
     return apply_filters("cpm_{$this->post_type}_table_views", $status_links, $num_posts, $statuses, $this->post_parent);
 }
开发者ID:nizamuddin,项目名称:wp-project-manager,代码行数:36,代码来源:list-table.php

示例15: get_views

 /**
  *
  * @global int $post_id
  * @global string $comment_status
  * @global string $comment_type
  */
 protected function get_views()
 {
     global $post_id, $comment_status, $comment_type;
     $status_links = array();
     $num_comments = $post_id ? wp_count_comments($post_id) : wp_count_comments();
     //, number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"),
     //, number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>")
     $stati = array('all' => _nx_noop('All', 'All', 'comments'), 'moderated' => _n_noop('Pending <span class="count">(<span class="pending-count">%s</span>)</span>', 'Pending <span class="count">(<span class="pending-count">%s</span>)</span>'), 'approved' => _n_noop('Approved <span class="count">(<span class="approved-count">%s</span>)</span>', 'Approved <span class="count">(<span class="approved-count">%s</span>)</span>'), 'spam' => _n_noop('Spam <span class="count">(<span class="spam-count">%s</span>)</span>', 'Spam <span class="count">(<span class="spam-count">%s</span>)</span>'), 'trash' => _n_noop('Trash <span class="count">(<span class="trash-count">%s</span>)</span>', 'Trash <span class="count">(<span class="trash-count">%s</span>)</span>'));
     if (!EMPTY_TRASH_DAYS) {
         unset($stati['trash']);
     }
     $link = 'edit-comments.php';
     if (!empty($comment_type) && 'all' != $comment_type) {
         $link = add_query_arg('comment_type', $comment_type, $link);
     }
     foreach ($stati as $status => $label) {
         $class = $status == $comment_status ? ' class="current"' : '';
         if (!isset($num_comments->{$status})) {
             $num_comments->{$status} = 10;
         }
         $link = add_query_arg('comment_status', $status, $link);
         if ($post_id) {
             $link = add_query_arg('p', absint($post_id), $link);
         }
         /*
         // I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark
         if ( !empty( $_REQUEST['s'] ) )
         	$link = add_query_arg( 's', esc_attr( wp_unslash( $_REQUEST['s'] ) ), $link );
         */
         $status_links[$status] = "<a href='{$link}'{$class}>" . sprintf(translate_nooped_plural($label, $num_comments->{$status}), number_format_i18n($num_comments->{$status})) . '</a>';
     }
     /**
      * Filter the comment status links.
      *
      * @since 2.5.0
      *
      * @param array $status_links An array of fully-formed status links. Default 'All'.
      *                            Accepts 'All', 'Pending', 'Approved', 'Spam', and 'Trash'.
      */
     return apply_filters('comment_status_links', $status_links);
 }
开发者ID:hpilevar,项目名称:WordPress,代码行数:47,代码来源:class-wp-comments-list-table.php


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