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


PHP _nx_noop函数代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: recurrences

 /**
  * Sets the current subscription payment plan status
  *
  * @author Jonathan Davis
  * @since 1.2
  *
  * @return void
  **/
 public function recurrences()
 {
     if (empty($this->option->recurring)) {
         return;
     }
     // if free subscription, don't process as subscription
     if (0 == $this->option->promoprice) {
         return;
     }
     extract($this->option->recurring);
     $term_labels = array('trial' => array('d' => _nx_noop("%s for the first day.", "%s for the first %s days.", "Trial term label: '\$10 for the first day.' or '\$5 for the first 10 days.'"), 'w' => _nx_noop("%s for the first week.", "%s for the first %s weeks.", "Trial term label: '\$10 for the first week.' or '\$5 for the first 10 weeks.'"), 'm' => _nx_noop("%s for the first month.", "%s for the first %s months.", "Trial term label: '\$10 for the first month.' or '\$5 for the first 10 months.'"), 'y' => _nx_noop("%s for the first year.", "%s for the first %s years.", "Trial term label: '\$10 for the first year.' or '\$5 for the first 10 years.'")), 'freetrial' => array('d' => _nx_noop("Free for the first day.", "Free for the first %s days.", "Free trial label."), 'w' => _nx_noop("Free for the first week.", "Free for the first %s weeks.", "Free trial label."), 'm' => _nx_noop("Free for the first month.", "Free for the first %s months.", "Free trial label."), 'y' => _nx_noop("Free for the first year.", "Free for the first %s years.", "Free trial label.")), 'aftertrial' => array('d' => _nx_noop("%s per day after the trial period.", "%s every %s days after the trial period.", "Subscription term label: '\$10 per day after the trial period.' or '\$5 every 10 days after the trial period.'"), 'w' => _nx_noop("%s per week after the trial period.", "%s every %s weeks after the trial period.", "Subscription term label: '\$10 per week after the trial period.' or '\$5 every 10 weeks after the trial period.'"), 'm' => _nx_noop("%s per month after the trial period.", "%s every %s months after the trial period.", "Subscription term label: '\$10 per month after the trial period.' or '\$5 every 10 months after the trial period.'"), 'y' => _nx_noop("%s per year after the trial period.", "%s every %s years after the trial period.", "Subscription term label: '\$10 per year after the trial period.' or '\$5 every 10 years after the trial period.'")), 'period' => array('d' => _nx_noop("%s per day.", "%s every %s days.", "Subscription term label: '\$10 per day.' or '\$5 every 10 days.'"), 'w' => _nx_noop("%s per week.", "%s every %s weeks.", "Subscription term label: '\$10 per week.' or '\$5 every 10 weeks.'"), 'm' => _nx_noop("%s per month.", "%s every %s months.", "Subscription term label: '\$10 per month.' or '\$5 every 10 months.'"), 'y' => _nx_noop("%s per year.", "%s every %s years.", "Subscription term label: '\$10 per year.' or '\$5 every 10 years.'")));
     $rebill_labels = array(0 => __('Subscription rebilled unlimited times.', 'Shopp'), 1 => _n_noop('Subscription rebilled once.', 'Subscription rebilled %s times.'));
     // Build Trial Label
     if (Shopp::str_true($trial)) {
         // pick untranlated label
         $trial_label = $trialprice > 0 ? $term_labels['trial'][$trialperiod] : $term_labels['freetrial'][$trialperiod];
         // pick singular or plural translation
         $trial_label = translate_nooped_plural($trial_label, $trialint, 'Shopp');
         // string replacements
         if ($trialprice > 0) {
             $trial_label = sprintf($trial_label, money($trialprice), $trialint);
         } else {
             $trial_label = sprintf($trial_label, $trialint);
         }
         $this->data[_x('Trial Period', 'Item trial period label', 'Shopp')] = $trial_label;
     }
     // pick untranslated label
     $normal = Shopp::str_true($trial) ? 'aftertrial' : 'period';
     $subscription_label = $term_labels[$normal][$period];
     // pick singular or plural translation
     $subscription_label = translate_nooped_plural($subscription_label, $interval);
     $subscription_label = sprintf($subscription_label, money($this->subprice), $interval);
     // pick rebilling label and translate if plurals
     $rebill_label = sprintf(translate_nooped_plural($rebill_labels[1], $cycles, 'Shopp'), $cycles);
     if (!$cycles) {
         $rebill_label = $rebill_labels[0];
     }
     $this->data[_x('Subscription', 'Subscription terms label', 'Shopp')] = array($subscription_label, $rebill_label);
     $this->recurring = true;
 }
开发者ID:borkweb,项目名称:shopp,代码行数:48,代码来源:Item.php

示例6: implode

		}

		echo '<div id="moderated" class="updated"><p>' . implode( "<br/>\n", $messages ) . '</p></div>';
	}
}
?>

<form id="comments-form" action="" method="get">
<ul class="subsubsub">
<?php
$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'), // singular not used
		'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', 'Approved'), // singular not used
		'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"' : '';
开发者ID:realfluid,项目名称:umbaugh,代码行数:31,代码来源:edit-comments.php

示例7: register_post_statuses

 /**
  * Register the post statuses used by bbPress
  *
  * We do some manipulation of the 'trash' status so trashed topics and
  * replies can be viewed from within the theme.
  *
  * @since bbPress (r2727)
  * @uses register_post_status() To register post statuses
  * @uses $wp_post_statuses To modify trash and private statuses
  * @uses current_user_can() To check if the current user is capable &
  *                           modify $wp_post_statuses accordingly
  */
 public static function register_post_statuses()
 {
     // Closed
     register_post_status(bbp_get_closed_status_id(), apply_filters('bbp_register_closed_post_status', array('label' => _x('Closed', 'post', 'bbpress'), 'label_count' => _nx_noop('Closed <span class="count">(%s)</span>', 'Closed <span class="count">(%s)</span>', 'post', 'bbpress'), 'public' => true, 'show_in_admin_all' => true)));
     // Spam
     register_post_status(bbp_get_spam_status_id(), apply_filters('bbp_register_spam_post_status', array('label' => _x('Spam', 'post', 'bbpress'), 'label_count' => _nx_noop('Spam <span class="count">(%s)</span>', 'Spam <span class="count">(%s)</span>', 'post', 'bbpress'), 'protected' => true, 'exclude_from_search' => true, 'show_in_admin_status_list' => true, 'show_in_admin_all_list' => false)));
     // Orphan
     register_post_status(bbp_get_orphan_status_id(), apply_filters('bbp_register_orphan_post_status', array('label' => _x('Orphan', 'post', 'bbpress'), 'label_count' => _nx_noop('Orphan <span class="count">(%s)</span>', 'Orphans <span class="count">(%s)</span>', 'post', 'bbpress'), 'protected' => true, 'exclude_from_search' => true, 'show_in_admin_status_list' => true, 'show_in_admin_all_list' => false)));
     // Hidden
     register_post_status(bbp_get_hidden_status_id(), apply_filters('bbp_register_hidden_post_status', array('label' => _x('Hidden', 'post', 'bbpress'), 'label_count' => _nx_noop('Hidden <span class="count">(%s)</span>', 'Hidden <span class="count">(%s)</span>', 'post', 'bbpress'), 'private' => true, 'exclude_from_search' => true, 'show_in_admin_status_list' => true, 'show_in_admin_all_list' => true)));
     /**
      * Trash fix
      *
      * We need to remove the internal arg and change that to
      * protected so that the users with 'view_trash' cap can view
      * single trashed topics/replies in the front-end as wp_query
      * doesn't allow any hack for the trashed topics to be viewed.
      */
     global $wp_post_statuses;
     if (!empty($wp_post_statuses['trash'])) {
         // User can view trash so set internal to false
         if (current_user_can('view_trash')) {
             $wp_post_statuses['trash']->internal = false;
             $wp_post_statuses['trash']->protected = true;
             // User cannot view trash so set internal to true
         } else {
             $wp_post_statuses['trash']->internal = true;
         }
     }
 }
开发者ID:jenia-buianov,项目名称:all_my_sites,代码行数:42,代码来源:bbpress.php

示例8: get_views

 public function get_views()
 {
     global $wpdb;
     $view_labels = array(1 => _nx_noop('Incomplete <span class="count">(%s)</span>', 'Incomplete <span class="count">(%s)</span>', 'purchase logs'), 2 => _nx_noop('Received <span class="count">(%s)</span>', 'Received <span class="count">(%s)</span>', 'purchase logs'), 3 => _nx_noop('Accepted <span class="count">(%s)</span>', 'Accepted <span class="count">(%s)</span>', 'purchase logs'), 4 => _nx_noop('Dispatched <span class="count">(%s)</span>', 'Dispatched <span class="count">(%s)</span>', 'purchase logs'), 5 => _nx_noop('Closed <span class="count">(%s)</span>', 'Closed <span class="count">(%s)</span>', 'purchase logs'), 6 => _nx_noop('Declined <span class="count">(%s)</span>', 'Declined <span class="count">(%s)</span>', 'purchase logs'));
     $sql = "SELECT DISTINCT processed, COUNT(*) AS count FROM " . WPSC_TABLE_PURCHASE_LOGS . " GROUP BY processed ORDER BY processed";
     $results = $wpdb->get_results($sql);
     $statuses = array();
     $total_count = 0;
     if (!empty($results)) {
         foreach ($results as $status) {
             $statuses[$status->processed] = $status->count;
         }
         $total_count = array_sum($statuses);
     }
     $all_text = sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_count, 'purchase logs', 'wpsc'), number_format_i18n($total_count));
     $all_href = remove_query_arg(array('status', 'paged', 'action', 'action2', 'm', 'deleted', 'updated', 'paged', 's'));
     $all_class = $this->status == 'all' && empty($_REQUEST['m']) && empty($_REQUEST['s']) ? 'class="current"' : '';
     $views = array('all' => sprintf('<a href="%s" %s>%s</a>', esc_url($all_href), $all_class, $all_text));
     foreach ($statuses as $status => $count) {
         if (!isset($view_labels[$status])) {
             continue;
         }
         $text = sprintf(translate_nooped_plural($view_labels[$status], $count, 'wpsc'), number_format_i18n($count));
         $href = add_query_arg('status', $status);
         $href = remove_query_arg(array('deleted', 'updated', 'action', 'action2', 'm', 'paged', 's'), $href);
         $class = $this->status == $status ? 'class="current"' : '';
         $views[$status] = sprintf('<a href="%s" %s>%s</a>', esc_url($href), $class, $text);
     }
     return $views;
 }
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:30,代码来源:purchase-log-list-table-class.php

示例9: get_views

 /**
  * Returns an associative array listing all the views that can be used with this table.
  *
  * @return array
  */
 function get_views()
 {
     global $post_id, $comment_status, $comment_type, $wpdb;
     $status_links = array();
     // Get commment (review) counts for eahc status
     $num_comments = $post_id ? wc_count_reviews($post_id) : wc_count_reviews();
     // Available status links, aka 'stati'
     $stati = array('all' => _nx_noop('All', 'All', 'comments', WC_Product_Reviews_Pro::TEXT_DOMAIN), '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>', WC_Product_Reviews_Pro::TEXT_DOMAIN), 'approved' => _n_noop('Approved', 'Approved', WC_Product_Reviews_Pro::TEXT_DOMAIN), '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>', WC_Product_Reviews_Pro::TEXT_DOMAIN), '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>', WC_Product_Reviews_Pro::TEXT_DOMAIN));
     if (!EMPTY_TRASH_DAYS) {
         unset($stati['trash']);
     }
     // Prepare the base link
     $link = add_query_arg('page', 'reviews', 'admin.php');
     // Add comment type to the base link
     if (!empty($comment_type) && 'all' !== $comment_type) {
         $link = add_query_arg('comment_type', $comment_type, $link);
     }
     // Prepare status links and counts
     foreach ($stati as $status => $label) {
         $link = add_query_arg('comment_status', $status, $link);
         $class = $status == $comment_status ? ' class="current"' : '';
         if (!isset($num_comments->{$status})) {
             $num_comments->{$status} = 10;
         }
         // If viewing reviews for a specific product, add that to the link as well
         if ($post_id) {
             $link = add_query_arg('p', absint($post_id), $link);
         }
         // Translate and format link
         $status_links[$status] = "<a href='" . esc_url($link) . "'{$class}>" . sprintf(translate_nooped_plural($label, $num_comments->{$status}), number_format_i18n($num_comments->{$status})) . '</a>';
     }
     /**
      * Filter the review status links.
      *
      * @param array $status_links An array of fully-formed status links. Default 'All'.
      *                            Accepts 'All', 'Pending', 'Approved', 'Spam', and 'Trash'.
      */
     return apply_filters('review_status_links', $status_links);
 }
开发者ID:brian3t,项目名称:orchidmate,代码行数:44,代码来源:class-wc-reviews-list-table.php

示例10: remove_query_arg

    }
    if (isset($_GET['action'])) {
        $sendback = remove_query_arg(array('action', 'action2', 'post_parent', 'page_template', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view', 'post_type'), $sendback);
    }
    wp_redirect($sendback);
    exit;
} elseif (isset($_GET['_wp_http_referer']) && !empty($_GET['_wp_http_referer'])) {
    wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
    exit;
}
if (empty($title)) {
    $title = __('Edit Pages');
}
$parent_file = 'edit-pages.php';
wp_enqueue_script('inline-edit-post');
$post_stati = array('publish' => array(_x('Published', 'page'), __('Published pages'), _nx_noop('Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>', 'page')), 'future' => array(_x('Scheduled', 'page'), __('Scheduled pages'), _nx_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>', 'page')), 'pending' => array(_x('Pending Review', 'page'), __('Pending pages'), _nx_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>', 'page')), 'draft' => array(_x('Draft', 'page'), _x('Drafts', 'manage posts header'), _nx_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>', 'page')), 'private' => array(_x('Private', 'page'), __('Private pages'), _nx_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>', 'page')), 'trash' => array(_x('Trash', 'page'), __('Trash pages'), _nx_noop('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>', 'page')));
if (!EMPTY_TRASH_DAYS) {
    unset($post_stati['trash']);
}
$post_stati = apply_filters('page_stati', $post_stati);
$query = array('post_type' => 'page', 'orderby' => 'menu_order title', 'posts_per_page' => -1, 'posts_per_archive_page' => -1, 'order' => 'asc');
$post_status_label = __('Pages');
if (isset($_GET['post_status']) && in_array($_GET['post_status'], array_keys($post_stati))) {
    $post_status_label = $post_stati[$_GET['post_status']][1];
    $query['post_status'] = $_GET['post_status'];
    $query['perm'] = 'readable';
}
$query = apply_filters('manage_pages_query', $query);
wp($query);
if (is_singular()) {
    wp_enqueue_script('admin-comments');
开发者ID:nagyist,项目名称:laura-wordpress,代码行数:31,代码来源:edit-pages.php

示例11: __

<?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');
开发者ID:jdgrimes,项目名称:wp-l10n-validator,代码行数:26,代码来源:l10n-functions.php

示例12: register_post_status

 /**
  * Register our custom post statuses, used for order/subscription status
  */
 public static function register_post_status()
 {
     $subscription_statuses = wcs_get_subscription_statuses();
     $registered_statuses = apply_filters('woocommerce_subscriptions_registered_statuses', array('wc-active' => _nx_noop('Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', 'post status label including post count', 'woocommerce-subscriptions'), 'wc-switched' => _nx_noop('Switched <span class="count">(%s)</span>', 'Switched <span class="count">(%s)</span>', 'post status label including post count', 'woocommerce-subscriptions'), 'wc-expired' => _nx_noop('Expired <span class="count">(%s)</span>', 'Expired <span class="count">(%s)</span>', 'post status label including post count', 'woocommerce-subscriptions'), 'wc-pending-cancel' => _nx_noop('Pending Cancellation <span class="count">(%s)</span>', 'Pending Cancellation <span class="count">(%s)</span>', 'post status label including post count', 'woocommerce-subscriptions')));
     if (is_array($subscription_statuses) && is_array($registered_statuses)) {
         foreach ($registered_statuses as $status => $label_count) {
             register_post_status($status, array('label' => $subscription_statuses[$status], 'public' => false, 'exclude_from_search' => false, 'show_in_admin_all_list' => true, 'show_in_admin_status_list' => true, 'label_count' => $label_count));
         }
     }
 }
开发者ID:slavic18,项目名称:cats,代码行数:13,代码来源:woocommerce-subscriptions.php

示例13: wp_event_calendar_register_post_statuses

/**
 * Register the Event post statuses
 *
 * @since 0.1.9
 */
function wp_event_calendar_register_post_statuses()
{
    // Register the event type
    register_post_status('passed', array('label' => esc_html_x('Past', 'events', 'wp-event-calendar'), 'label_count' => _nx_noop('Past <span class="count">(%s)</span>', 'Past <span class="count">(%s)</span>', 'events', 'wp-event-calendar'), 'exclude_from_search' => get_post_type_object('event')->exclude_from_search, 'public' => get_post_type_object('event')->public, 'publicly_queryable' => get_post_type_object('event')->publicly_queryable, 'show_in_admin_status_list' => true, 'show_in_admin_all_list' => true));
}
开发者ID:stuttter,项目名称:wp-event-calendar,代码行数:10,代码来源:post-statuses.php

示例14: getFunctions

 /**
  * Register a list of functions available into Twig templates.
  * 
  * @return array|\Twig_SimpleFunction[]
  */
 public function getFunctions()
 {
     return [new Twig_SimpleFunction('wp_head', 'wp_head'), new Twig_SimpleFunction('wp_footer', 'wp_footer'), new Twig_SimpleFunction('body_class', function ($class = '') {
         return body_class($class);
     }), new Twig_SimpleFunction('post_class', function ($class = '', $id = null) {
         return post_class($class, $id);
     }), new Twig_SimpleFunction('wpautop', function ($text, $br = true) {
         return wpautop($text, $br);
     }), new Twig_SimpleFunction('wp_trim_words', function ($text, $num_words = 55, $more = null) {
         return wp_trim_words($text, $num_words, $more);
     }), new Twig_SimpleFunction('fn', function ($functionName) {
         $args = func_get_args();
         // By default, the function name should always be the first argument.
         // This remove it from the arguments list.
         array_shift($args);
         if (is_string($functionName)) {
             $functionName = trim($functionName);
         }
         return call_user_func_array($functionName, $args);
     }), new Twig_SimpleFunction('meta', function ($key, $id = null, $context = 'post', $single = true) {
         return meta($key, $id, $context, $single);
     }), new Twig_SimpleFunction('translate', function ($text, $domain = 'default') {
         return translate($text, $domain);
     }), new Twig_SimpleFunction('__', function ($text, $domain = 'default') {
         return __($text, $domain);
     }), new Twig_SimpleFunction('_e', function ($text, $domain = 'default') {
         return _e($text, $domain);
     }), new Twig_SimpleFunction('_n', function ($single, $plural, $number, $domain = 'default') {
         return _n($single, $plural, $number, $domain);
     }), new Twig_SimpleFunction('_x', function ($text, $context, $domain = 'default') {
         return _x($text, $context, $domain);
     }), new Twig_SimpleFunction('_ex', function ($text, $context, $domain = 'default') {
         return _ex($text, $context, $domain);
     }), new Twig_SimpleFunction('_nx', function ($single, $plural, $number, $context, $domain = 'default') {
         return _nx($single, $plural, $number, $context, $domain);
     }), new Twig_SimpleFunction('_n_noop', function ($singular, $plural, $domain = 'default') {
         return _n_noop($singular, $plural, $domain);
     }), new Twig_SimpleFunction('_nx_noop', function ($singular, $plural, $context, $domain = 'default') {
         return _nx_noop($singular, $plural, $context, $domain);
     }), new Twig_SimpleFunction('translate_nooped_plural', function ($nooped_plural, $count, $domain = 'default') {
         return translate_nooped_plural($nooped_plural, $count, $domain);
     })];
 }
开发者ID:themosis,项目名称:framework,代码行数:48,代码来源:ThemosisTwigExtension.php

示例15: __

<?php

__('Hello World', 'my-domain');
_x('Post', 'verb', 'my-domain');
_e('Hello World', 'my-domain');
_ex('Post', 'verb', 'my-domain');
esc_html__('Hello World', 'my-domain');
esc_html_e('Hello World', 'my-domain');
esc_html_x('Post', 'verb', 'my-domain');
esc_attr__('Hello World', 'my-domain');
esc_attr_e('Hello World', 'my-domain');
esc_attr_x('Post', 'verb', 'my-domain');
$apples = 4;
_n('%d apple', '%d apples', $apples, 'my-domain');
_nx('%d post', '%d posts', $apples, 'noun, job positions', 'my-domain');
_n_noop('%d apple', '%d apples', 'my-domain');
_nx_noop('%d post', '%d posts', 'noun, job positions', 'my-domain');
开发者ID:pippinsplugins,项目名称:test2,代码行数:17,代码来源:incorrect-domain-autocorrect.php


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