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();
 }
 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;
 }
 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;
 }
 function get_views()
 {
     global $wp_roles, $role;
     if ($this->is_site_users) {
         $url = 'site-users.php?id=' . $this->site_id;
         switch_to_blog($this->site_id);
         $users_of_blog = count_users();
         restore_current_blog();
     } else {
         $url = 'users.php';
         $users_of_blog = count_users();
     }
     $total_users = $users_of_blog['total_users'];
     $avail_roles =& $users_of_blog['avail_roles'];
     unset($users_of_blog);
     $current_role = false;
     $class = empty($role) ? ' class="current"' : '';
     $role_links = array();
     $role_links['all'] = "<a href='{$url}'{$class}>" . sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users'), number_format_i18n($total_users)) . '</a>';
     foreach ($wp_roles->get_names() as $this_role => $name) {
         if (!isset($avail_roles[$this_role])) {
             continue;
         }
         $class = '';
         if ($this_role == $role) {
             $current_role = $role;
             $class = ' class="current"';
         }
         $name = translate_user_role($name);
         /* translators: User role name with count */
         $name = sprintf(__('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n($avail_roles[$this_role]));
         $role_links[$this_role] = "<a href='" . esc_url(add_query_arg('role', $this_role, $url)) . "'{$class}>{$name}</a>";
     }
     return $role_links;
 }
 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;
 }
Example #6
0
 public static function _nx($single, $plural, $number, $domain = null)
 {
     if (!$domain) {
         $domain = Core::ID;
     }
     return \_nx($single, $plural, $number, $domain);
 }
 function mh_cicero_lite_post_meta()
 {
     echo '<p class="entry-meta">' . "\n";
     echo '<i class="fa fa-clock-o"></i><span class="updated">' . get_the_date() . '</span>' . "\n";
     echo '<i class="fa fa-folder-open-o"></i><span class="entry-category">' . get_the_category_list(', ', '') . '</span>' . "\n";
     echo '<i class="fa fa-comment-o"></i><span>' . sprintf(_nx('1 Comment', '%1$s Comments', get_comments_number(), 'comments number', 'mh-cicero-lite'), number_format_i18n(get_comments_number())) . '</span>' . "\n";
     echo '</p>' . "\n";
 }
 function mh_elegance_lite_post_meta()
 {
     echo '<p class="entry-meta">' . "\n";
     echo sprintf(_x('Date: %s', 'post date', 'mh-elegance-lite'), '<span class="updated">' . get_the_date() . '</span><br>') . "\n";
     echo sprintf(_x('Author: %s', 'post author', 'mh-elegance-lite'), '<span class="vcard author"><a class="fn" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span><br>') . "\n";
     echo __('Comments:', 'mh-elegance-lite') . ' <span>' . sprintf(_nx('1 Comment', '%1$s Comments', get_comments_number(), 'comments number', 'mh-elegance-lite'), number_format_i18n(get_comments_number())) . '</span><br>' . "\n";
     echo sprintf(__('Categories: %s', 'mh-elegance-lite'), '<span>' . get_the_category_list(', ', '') . '</span>') . "\n";
     echo '</p>' . "\n";
 }
 /**
  * Prints HTML with meta information for the current post-date/time and author.
  */
 function the_minimal_posted_on()
 {
     $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
     $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date('F jS, Y')));
     $posted_on = sprintf(esc_html_x('%s', 'post date', 'the-minimal'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
     $byline = sprintf(esc_html_x('%s', 'post author', 'the-minimal'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
     $comment_count = sprintf(_nx('1 Comment', '%1$s Comments', get_comments_number(), 'comments title', 'the-minimal'), number_format_i18n(get_comments_number()));
     $comment = sprintf(esc_html_x('%s', 'post comment', 'the-minimal'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $comment_count . '</a>');
     echo '<span class="date">' . $posted_on . '</span><span class="name">' . $byline . '</span><span class="comments">' . $comment . '</span>';
     // WPCS: XSS OK.
 }
 protected function get_views()
 {
     global $role;
     $total_users = get_user_count();
     $super_admins = get_super_admins();
     $total_admins = count($super_admins);
     $class = $role != 'super' ? ' class="current"' : '';
     $role_links = array();
     $role_links['all'] = "<a href='" . network_admin_url('users.php') . "'{$class}>" . sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users'), number_format_i18n($total_users)) . '</a>';
     $class = $role == 'super' ? ' class="current"' : '';
     $role_links['super'] = "<a href='" . network_admin_url('users.php?role=super') . "'{$class}>" . sprintf(_n('Super Admin <span class="count">(%s)</span>', 'Super Admins <span class="count">(%s)</span>', $total_admins), number_format_i18n($total_admins)) . '</a>';
     return $role_links;
 }
Example #11
0
 /**
  * Translation functions
  *
  * @param Twig $twig
  */
 public function addTranslationFunctions($twig)
 {
     $twig->addFunction('_x', new Twig_SimpleFunction('_x', function ($text, $context, $domain = 'default') {
         return _x($text, $context, $domain);
     }));
     $twig->addFunction('_n', new Twig_SimpleFunction('_n', function ($single, $plural, $number, $domain = 'default') {
         return _n($single, $plural, $number, $domain);
     }));
     $twig->addFunction('_nx', new Twig_SimpleFunction('_nx', function ($single, $plural, $number, $context, $domain = 'default') {
         return _nx($single, $plural, $number, $context, $domain);
     }));
     return $twig;
 }
 public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null)
 {
     $domain = $domain !== null ? $domain : 'default';
     $hasSingle = array_key_exists('single', $parameters) && $parameters['single'] !== null;
     $hasPlural = array_key_exists('plural', $parameters) && $parameters['plural'] !== null;
     $hasContext = array_key_exists('context', $parameters) && $parameters['context'] !== null;
     $single = $hasSingle ? $parameters['single'] : $id;
     $plural = $hasPlural ? $parameters['plural'] : $id;
     $context = $hasContext ? $parameters['context'] : null;
     if ($context !== null) {
         return _nx($single, $plural, $number, $context, $domain);
     }
     return _n($single, $plural, $number, $domain);
 }
 /**
  * Generates a view link widget
  *
  * @param string 	$type 		The type of filtering (all, scheduled, pending)
  * @param int 		$value 		Number of results
  * @param string 	$current 	The current type selected (null for all)
  */
 public function generate_view($type, $value, $current)
 {
     $all_inner_html = sprintf(_nx(ucfirst($type) . ' <span class="count">(%s)</span>', ucfirst($type) . ' <span class="count">(%s)</span>', $value, 'posts'), number_format_i18n($value));
     $q_string = $type == 'all' ? '' : '&type=' . $type;
     $class = '';
     if ($type == 'all' && !$current) {
         $class = ' class="current"';
     } else {
         if ($type == $current) {
             $class = ' class="current"';
         }
     }
     return "<a href='admin.php?page=smmp-list{$q_string}'{$class}>" . $all_inner_html . '</a>';
 }
 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;
 }
 function widget($args, $instance)
 {
     global $post;
     /* PRINT THE WIDGET */
     extract($args, EXTR_SKIP);
     $instance = wp_parse_args((array) $instance, array('title' => ''));
     $title = $instance['title'];
     if (!is_single()) {
         return;
     }
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title;
         echo apply_filters('widget_title', esc_attr($title), $instance, $this->id_base);
         echo $after_title;
     }
     $y = esc_attr(get_post_time('Y', false, $post->ID));
     $m = esc_attr(get_post_time('m', false, $post->ID));
     $d = esc_attr(get_post_time('d', false, $post->ID));
     $name = get_the_author_meta('display_name', $post->post_author);
     $dtime = get_post_time('Y-m-d', false, $post->ID);
     $ptime = get_post_time(esc_attr(get_option('date_format')), false, $post->ID, true);
     echo '<div class="large-icons">';
     echo '<ul>';
     edit_post_link('<i class="icon-pencil"></i>' . __('Edit', 'treeson'), '<li>', '</li>');
     echo '<li><a href="' . esc_url(get_day_link($y, $m, $d)) . '">';
     echo '<time datetime="' . esc_attr($dtime) . '"><i class="icon-calendar"></i>' . esc_html($ptime) . '</time></a></li>';
     echo '<li><a href="' . esc_url(get_author_posts_url($post->post_author)) . '" title="' . sprintf(__('Writed by %s', 'treeson'), esc_attr($name)) . '"><i class="icon-user-5"></i>' . esc_html($name) . '</a></li>';
     if ($post->comment_status == 'open') {
         $nr = get_comments_number($post->ID);
         echo '<li>';
         echo '<a href="' . esc_url(get_comments_link($post->ID)) . '">';
         echo '<i class="icon-comment"></i>';
         echo sprintf(_nx('%s Comment', '%s Comments', absint($nr), 'Number of comment(s) from widget "myThemes: Meta Details"', 'treeson'), number_format_i18n(absint($nr)));
         echo '</a></li>';
     }
     if (function_exists('stats_get_csv')) {
         $args = array('days' => -1, 'post_id' => $post->ID);
         $result = stats_get_csv('postviews', $args);
         $views = $result[0]['views'];
         echo '<li><i class="icon-eye-2"></i> ' . sprintf(_n('%s view', '%s views', absint($views), 'treeson'), number_format_i18n(absint($views))) . '</li>';
     }
     echo '</ul>';
     echo '</div>';
     echo $after_widget;
 }
Example #16
0
 public static function get_duration_interval_label($interval, $amount = 2)
 {
     switch ($interval) {
         case self::INTERVAL_DAY:
             $label = _nx('Day', 'Days', $amount, 'payment terms', 'AWPCP');
             break;
         case self::INTERVAL_WEEK:
             $label = _nx('Week', 'Weeks', $amount, 'payment terms', 'AWPCP');
             break;
         case self::INTERVAL_MONTH:
             $label = _nx('Month', 'Months', $amount, 'payment terms', 'AWPCP');
             break;
         case self::INTERVAL_YEAR:
             $label = _nx('Year', 'Years', $amount, 'payment terms', 'AWPCP');
             break;
     }
     return $label;
 }
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');
}
 function get_views()
 {
     $status_links = array();
     $post_status = empty($_REQUEST['post_status']) ? '' : $_REQUEST['post_status'];
     // Inbox
     Flamingo_Outbound_Message::find(array('post_status' => 'any'));
     $posts_in_inbox = Flamingo_Outbound_Message::$found_items;
     $inbox = sprintf(_nx('Inbox <span class="count">(%s)</span>', 'Inbox <span class="count">(%s)</span>', $posts_in_inbox, 'posts', 'flamingo'), number_format_i18n($posts_in_inbox));
     $status_links['inbox'] = sprintf('<a href="%1$s"%2$s>%3$s</a>', admin_url('admin.php?page=flamingo_outbound'), $this->is_trash ? '' : ' class="current"', $inbox);
     // Trash
     Flamingo_Outbound_Message::find(array('post_status' => 'trash'));
     $posts_in_trash = Flamingo_Outbound_Message::$found_items;
     if (empty($posts_in_trash)) {
         return $status_links;
     }
     $trash = sprintf(_nx('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>', $posts_in_trash, 'posts', 'flamingo'), number_format_i18n($posts_in_trash));
     $status_links['trash'] = sprintf('<a href="%1$s"%2$s>%3$s</a>', admin_url('admin.php?page=flamingo_outbound&post_status=trash'), 'trash' == $post_status ? ' class="current"' : '', $trash);
     return $status_links;
 }
Example #19
0
/**
 * MH Elegance Post Meta 
 */
function mh_elegance_post_meta()
{
    $mh_elegance_options = mh_elegance_theme_options();
    $post_date = !$mh_elegance_options['post_meta_date'];
    $post_author = !$mh_elegance_options['post_meta_author'];
    $post_comments = !$mh_elegance_options['post_meta_comments'];
    if ($post_date || $post_author || $post_comments) {
        echo '<p class="entry-meta">';
        if ($post_date) {
            echo sprintf(_x('Veröffentlicht am %s', 'post date', 'mh-elegance'), '<span class="updated">' . get_the_date() . '</span>');
        }
        if ($post_author) {
            echo sprintf(_x('von %s', 'post author', 'mh-elegance'), '<span class="vcard author"><a class="fn" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
        }
        if ($post_comments) {
            echo __('Comments:', 'mh-elegance') . ' <span>' . sprintf(_nx('1 Comment', '%1$s Comments', get_comments_number(), 'comments number', 'mh-elegance'), number_format_i18n(get_comments_number())) . '</span>';
        }
        echo '</p>';
    }
}
 /**
  * Get the list of views available on this table (e.g. "all", "administrator", "subscriber").
  * 
  * Most of this method lifted directly from WP_Users_List_Table.
  *
  * @global unknown $roles
  * @global unknown $wp_roles
  * @since Achievements (3.0)
  */
 public function get_views()
 {
     global $wp_roles, $role;
     // Get the number of users
     if ($this->is_site_users) {
         switch_to_blog($this->site_id);
         $users_of_blog = count_users();
         restore_current_blog();
     } else {
         $users_of_blog = count_users();
     }
     // Build the URL back to this page, stripping of any parameters used on other links
     $url = remove_query_arg(array('action', 'error', 'role', 'updated'), $_SERVER['REQUEST_URI']);
     $total_users = $users_of_blog['total_users'];
     $avail_roles =& $users_of_blog['avail_roles'];
     $class = empty($role) ? ' class="current"' : '';
     unset($users_of_blog);
     $role_links = array();
     $role_links['all'] = "<a href='" . esc_url($url) . "'{$class}>" . sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'admin screen, types of users', 'achievements'), number_format_i18n($total_users)) . '</a>';
     // Iterate through all WP user roles, and get count of users in each.
     foreach ($wp_roles->get_names() as $this_role => $name) {
         if (!isset($avail_roles[$this_role])) {
             continue;
         }
         $class = '';
         // Highlight the currently selected user role
         if ($this_role === $role) {
             $class = ' class="current"';
         }
         $name = translate_user_role($name);
         // translators: User role name with count
         $name = sprintf(__('%1$s <span class="count">(%2$s)</span>', 'achievements'), $name, number_format_i18n($avail_roles[$this_role]));
         // Build the links
         $role_links[$this_role] = "<a href='" . esc_url(add_query_arg('role', $this_role, $url)) . "'{$class}>{$name}</a>";
     }
     return $role_links;
 }
 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);
 }
 /**
  * Get an associative array ( id => link ) of the views available on this table.
  *
  * @since 2.5.0
  *
  * @return array
  */
 public function get_views()
 {
     $status_links = array();
     foreach ($this->view_totals as $type => $count) {
         if ($count < 1) {
             continue;
         }
         switch ($type) {
             case 'all':
                 $text = _nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins', 'tgmpa');
                 break;
             case 'install':
                 $text = _n('To Install <span class="count">(%s)</span>', 'To Install <span class="count">(%s)</span>', $count, 'tgmpa');
                 break;
             case 'update':
                 $text = _n('Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count, 'tgmpa');
                 break;
             case 'activate':
                 $text = _n('To Activate <span class="count">(%s)</span>', 'To Activate <span class="count">(%s)</span>', $count, 'tgmpa');
                 break;
             default:
                 $text = '';
                 break;
         }
         if (!empty($text)) {
             $status_links[$type] = sprintf('<a href="%s"%s>%s</a>', esc_url($this->tgmpa->get_tgmpa_status_url($type)), $type === $this->view_context ? ' class="current"' : '', sprintf($text, number_format_i18n($count)));
         }
     }
     return $status_links;
 }
Example #23
0
}
?>
<hr />
<div class="row">
	<div id="comments" class="comments-area">

		<?php 
// You can start editing here -- including this comment!
?>

		<?php 
if (have_comments()) {
    ?>
			<h2 class="comments-title columns large-12">
				<?php 
    printf(_nx('One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'sennzaversion3'), number_format_i18n(get_comments_number()), '<span>' . get_the_title() . '</span>');
    ?>
			</h2>

			<?php 
    if (get_comment_pages_count() > 1 && get_option('page_comments')) {
        // are there comments to navigate through
        ?>
			<nav id="comment-nav-above" class="comment-navigation" role="navigation">
				<h1 class="screen-reader-text"><?php 
        _e('Comment navigation', 'sennzaversion3');
        ?>
</h1>
				<div class="nav-previous"><?php 
        previous_comments_link(__('&larr; Older Comments', 'sennzaversion3'));
        ?>
Example #24
0
<p class="nocomments"><?php 
    _e('This post is password protected. Enter the password to view any comments.', 'responsive-mobile');
    ?>
</p><?php 
    return;
}
?>

<div id="comments" class="comments-area">

	<?php 
if (have_comments()) {
    ?>
		<h2 class="comments-title">
			<?php 
    printf(_nx('One comment on &ldquo;%2$s&rdquo;', '%1$s comments on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'responsive-mobile'), number_format_i18n(get_comments_number()), '<span>' . get_the_title() . '</span>');
    ?>
		</h2>

		<?php 
    if (get_comment_pages_count() > 1 && get_option('page_comments')) {
        ?>
		<nav id="comment-nav-above" class="comment-navigation navigation" role="navigation">
			<h1 class="screen-reader-text"><?php 
        _e('Comment navigation', 'responsive-mobile');
        ?>
</h1>
			<div class="nav-previous previous"><?php 
        previous_comments_link(__('&larr; Older Comments', 'responsive-mobile'));
        ?>
</div>
Example #25
0
/**
 * Ajax handler for replying to a comment.
 *
 * @since 3.1.0
 *
 * @global WP_List_Table $wp_list_table
 *
 * @param string $action Action to perform.
 */
function wp_ajax_replyto_comment($action)
{
    global $wp_list_table;
    if (empty($action)) {
        $action = 'replyto-comment';
    }
    check_ajax_referer($action, '_ajax_nonce-replyto-comment');
    $comment_post_ID = (int) $_POST['comment_post_ID'];
    $post = get_post($comment_post_ID);
    if (!$post) {
        wp_die(-1);
    }
    if (!current_user_can('edit_post', $comment_post_ID)) {
        wp_die(-1);
    }
    if (empty($post->post_status)) {
        wp_die(1);
    } elseif (in_array($post->post_status, array('draft', 'pending', 'trash'))) {
        wp_die(__('ERROR: you are replying to a comment on a draft post.'));
    }
    $user = wp_get_current_user();
    if ($user->exists()) {
        $user_ID = $user->ID;
        $comment_author = wp_slash($user->display_name);
        $comment_author_email = wp_slash($user->user_email);
        $comment_author_url = wp_slash($user->user_url);
        $comment_content = trim($_POST['content']);
        $comment_type = isset($_POST['comment_type']) ? trim($_POST['comment_type']) : '';
        if (current_user_can('unfiltered_html')) {
            if (!isset($_POST['_wp_unfiltered_html_comment'])) {
                $_POST['_wp_unfiltered_html_comment'] = '';
            }
            if (wp_create_nonce('unfiltered-html-comment') != $_POST['_wp_unfiltered_html_comment']) {
                kses_remove_filters();
                // start with a clean slate
                kses_init_filters();
                // set up the filters
            }
        }
    } else {
        wp_die(__('Sorry, you must be logged in to reply to a comment.'));
    }
    if ('' == $comment_content) {
        wp_die(__('ERROR: please type a comment.'));
    }
    $comment_parent = 0;
    if (isset($_POST['comment_ID'])) {
        $comment_parent = absint($_POST['comment_ID']);
    }
    $comment_auto_approved = false;
    $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID');
    // Automatically approve parent comment.
    if (!empty($_POST['approve_parent'])) {
        $parent = get_comment($comment_parent);
        if ($parent && $parent->comment_approved === '0' && $parent->comment_post_ID == $comment_post_ID) {
            if (!current_user_can('edit_comment', $parent->comment_ID)) {
                wp_die(-1);
            }
            if (wp_set_comment_status($parent, 'approve')) {
                $comment_auto_approved = true;
            }
        }
    }
    $comment_id = wp_new_comment($commentdata);
    $comment = get_comment($comment_id);
    if (!$comment) {
        wp_die(1);
    }
    $position = isset($_POST['position']) && (int) $_POST['position'] ? (int) $_POST['position'] : '-1';
    ob_start();
    if (isset($_REQUEST['mode']) && 'dashboard' == $_REQUEST['mode']) {
        require_once ABSPATH . 'wp-admin/includes/dashboard.php';
        _wp_dashboard_recent_comments_row($comment);
    } else {
        if (isset($_REQUEST['mode']) && 'single' == $_REQUEST['mode']) {
            $wp_list_table = _get_list_table('WP_Post_Comments_List_Table', array('screen' => 'edit-comments'));
        } else {
            $wp_list_table = _get_list_table('WP_Comments_List_Table', array('screen' => 'edit-comments'));
        }
        $wp_list_table->single_row($comment);
    }
    $comment_list_item = ob_get_clean();
    $response = array('what' => 'comment', 'id' => $comment->comment_ID, 'data' => $comment_list_item, 'position' => $position);
    $counts = wp_count_comments();
    $response['supplemental'] = array('in_moderation' => $counts->moderated, 'i18n_comments_text' => sprintf(_n('%s Comment', '%s Comments', $counts->approved), number_format_i18n($counts->approved)), 'i18n_moderation_text' => sprintf(_nx('%s in moderation', '%s in moderation', $counts->moderated, 'comments'), number_format_i18n($counts->moderated)));
    if ($comment_auto_approved) {
        $response['supplemental']['parent_approved'] = $parent->comment_ID;
        $response['supplemental']['parent_post_id'] = $parent->comment_post_ID;
    }
    $x = new WP_Ajax_Response();
    $x->add($response);
    $x->send();
}
Example #26
0
<?php

if (post_password_required()) {
    return;
}
?>

<div id="comments" class="comments-area">

	<?php 
// You can start editing here -- including this comment!
if (have_comments()) {
    ?>
		<h2 class="comments-title">
			<?php 
    printf(esc_html(_nx('One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'bftp')), number_format_i18n(get_comments_number()), '<span>' . get_the_title() . '</span>');
    ?>
		</h2>

		<?php 
    if (get_comment_pages_count() > 1 && get_option('page_comments')) {
        // Are there comments to navigate through?
        ?>
		<nav id="comment-nav-above" class="navigation comment-navigation" role="navigation">
			<h2 class="screen-reader-text"><?php 
        esc_html_e('Comment navigation', 'bftp');
        ?>
</h2>
			<div class="nav-links">

				<div class="nav-previous"><?php 
Example #27
0
    ?>

		<?php 
    if (!isset($maskitto_light['blog-layout']) || $maskitto_light['blog-layout'] == 1) {
        ?>
			<div class="blog-layout-2-comments">
				<div class="page-blog" style="height: 15px; margin: 0 -56px; padding: 0!important; margin-top: 30px;"></div>
		<?php 
    }
    ?>


			<h2 class="comments-title">
				<i class="fa fa-comments-o" style="padding-right: 5px;"></i>
				<?php 
    printf(_nx('1 comment', '%1$s comments', get_comments_number(), 'comments title', 'maskitto-light'), number_format_i18n(get_comments_number()), '<span>' . get_the_title() . '</span>');
    ?>
			</h2>

			<ol class="comment-list">
				<?php 
    function maskitto_light_comment($comment, $args, $depth)
    {
        $GLOBALS['comment'] = $comment;
        extract($args, EXTR_SKIP);
        if ('div' == $args['style']) {
            $tag = 'div';
            $add_below = 'comment';
        } else {
            $tag = 'li';
            $add_below = 'div-comment';
Example #28
0
    function admin_notices()
    {
        if ($this->error) {
            ?>
<div id="message" class="jetpack-message jetpack-err">
	<div class="squeezer">
		<h4><?php 
            echo wp_kses($this->error, array('code' => true, 'strong' => true, 'br' => true, 'b' => true));
            ?>
</h4>
<?php 
            if ($desc = Jetpack::state('error_description')) {
                ?>
		<p><?php 
                echo esc_html(stripslashes($desc));
                ?>
</p>
<?php 
            }
            ?>
	</div>
</div>
<?php 
        }
        if ($this->message) {
            ?>
<div id="message" class="jetpack-message">
	<div class="squeezer">
		<h4><?php 
            echo wp_kses($this->message, array('strong' => array(), 'a' => array('href' => true), 'br' => true));
            ?>
</h4>
	</div>
</div>
<?php 
        }
        if ($this->privacy_checks) {
            $module_names = $module_slugs = array();
            $privacy_checks = explode(',', $this->privacy_checks);
            foreach ($privacy_checks as $module_slug) {
                $module = Jetpack::get_module($module_slug);
                if (!$module) {
                    continue;
                }
                $module_slugs[] = $module_slug;
                $module_names[] = "<strong>{$module['name']}</strong>";
            }
            $module_slugs = join(',', $module_slugs);
            ?>
<div id="message" class="jetpack-message jetpack-err">
	<div class="squeezer">
		<h4><strong><?php 
            esc_html_e('Is this site private?', 'jetpack');
            ?>
</strong></h4><br />
		<p><?php 
            echo wp_kses(wptexturize(wp_sprintf(_nx("Like your site's RSS feeds, %l allows access to your posts and other content to third parties.", "Like your site's RSS feeds, %l allow access to your posts and other content to third parties.", count($privacy_checks), '%l = list of Jetpack module/feature names', 'jetpack'), $module_names)), array('strong' => true));
            echo "\n<br />\n";
            echo wp_kses(sprintf(_nx('If your site is not publicly accessible, consider <a href="%1$s" title="%2$s">deactivating this feature</a>.', 'If your site is not publicly accessible, consider <a href="%1$s" title="%2$s">deactivating these features</a>.', count($privacy_checks), '%1$s = deactivation URL, %2$s = "Deactivate {list of Jetpack module/feature names}', 'jetpack'), wp_nonce_url(Jetpack::admin_url(array('page' => 'jetpack', 'action' => 'deactivate', 'module' => urlencode($module_slugs))), "jetpack_deactivate-{$module_slugs}"), esc_attr(wp_kses(wp_sprintf(_x('Deactivate %l', '%l = list of Jetpack module/feature names', 'jetpack'), $module_names), array()))), array('a' => array('href' => true, 'title' => true)));
            ?>
</p>
	</div>
</div>
<?php 
        }
    }
 /**
  * Get admin notice when viewing the sign-up page.
  *
  * @since 2.1.0
  *
  * @return array
  */
 private function get_signup_notice()
 {
     // Setup empty notice for return value.
     $notice = array();
     // Updates.
     if (!empty($_REQUEST['updated'])) {
         switch ($_REQUEST['updated']) {
             case 'resent':
                 $notice = array('class' => 'updated', 'message' => '');
                 if (!empty($_REQUEST['resent'])) {
                     $notice['message'] .= sprintf(_nx('%s activation email successfully sent! ', '%s activation emails successfully sent! ', absint($_REQUEST['resent']), 'signup resent', 'buddypress'), number_format_i18n(absint($_REQUEST['resent'])));
                 }
                 if (!empty($_REQUEST['notsent'])) {
                     $notice['message'] .= sprintf(_nx('%s activation email was not sent.', '%s activation emails were not sent.', absint($_REQUEST['notsent']), 'signup notsent', 'buddypress'), number_format_i18n(absint($_REQUEST['notsent'])));
                     if (empty($_REQUEST['resent'])) {
                         $notice['class'] = 'error';
                     }
                 }
                 break;
             case 'activated':
                 $notice = array('class' => 'updated', 'message' => '');
                 if (!empty($_REQUEST['activated'])) {
                     $notice['message'] .= sprintf(_nx('%s account successfully activated! ', '%s accounts successfully activated! ', absint($_REQUEST['activated']), 'signup resent', 'buddypress'), number_format_i18n(absint($_REQUEST['activated'])));
                 }
                 if (!empty($_REQUEST['notactivated'])) {
                     $notice['message'] .= sprintf(_nx('%s account was not activated.', '%s accounts were not activated.', absint($_REQUEST['notactivated']), 'signup notsent', 'buddypress'), number_format_i18n(absint($_REQUEST['notactivated'])));
                     if (empty($_REQUEST['activated'])) {
                         $notice['class'] = 'error';
                     }
                 }
                 break;
             case 'deleted':
                 $notice = array('class' => 'updated', 'message' => '');
                 if (!empty($_REQUEST['deleted'])) {
                     $notice['message'] .= sprintf(_nx('%s sign-up successfully deleted!', '%s sign-ups successfully deleted!', absint($_REQUEST['deleted']), 'signup deleted', 'buddypress'), number_format_i18n(absint($_REQUEST['deleted'])));
                 }
                 if (!empty($_REQUEST['notdeleted'])) {
                     $notice['message'] .= sprintf(_nx('%s sign-up was not deleted.', '%s sign-ups were not deleted.', absint($_REQUEST['notdeleted']), 'signup notdeleted', 'buddypress'), number_format_i18n(absint($_REQUEST['notdeleted'])));
                     if (empty($_REQUEST['deleted'])) {
                         $notice['class'] = 'error';
                     }
                 }
                 break;
         }
     }
     // Errors.
     if (!empty($_REQUEST['error'])) {
         switch ($_REQUEST['error']) {
             case 'do_resend':
                 $notice = array('class' => 'error', 'message' => esc_html__('There was a problem sending the activation emails. Please try again.', 'buddypress'));
                 break;
             case 'do_activate':
                 $notice = array('class' => 'error', 'message' => esc_html__('There was a problem activating accounts. Please try again.', 'buddypress'));
                 break;
             case 'do_delete':
                 $notice = array('class' => 'error', 'message' => esc_html__('There was a problem deleting sign-ups. Please try again.', 'buddypress'));
                 break;
         }
     }
     return $notice;
 }
Example #30
0
<?php

if (post_password_required()) {
    return;
}
?>

<section id="comments" class="comments">
    <?php 
if (have_comments()) {
    ?>
        <h2><?php 
    printf(_nx('One response to &ldquo;%2$s&rdquo;', '%1$s responses to &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'sage'), number_format_i18n(get_comments_number()), '<span>' . get_the_title() . '</span>');
    ?>
</h2>

        <ol class="comment-list">
            <?php 
    wp_list_comments(['style' => 'ol', 'short_ping' => true]);
    ?>
        </ol>

        <?php 
    if (get_comment_pages_count() > 1 && get_option('page_comments')) {
        ?>
            <nav>
                <ul class="pager">
                    <?php 
        if (get_previous_comments_link()) {
            ?>
                        <li class="previous"><?php