PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.3
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.3
4.9.3 4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 3.5.0 All 201 releases
betterdocs / views / template-parts / category-counter.php

category-counter.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 4.9.3, at views/template-parts/category-counter.php

44 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- view template receives variables via extract(); prefixing is impractical.
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7 if ( ! $show_count ) {
8 return;
9 }
10
11 $prefix = $suffix = $suffix_singular = '';
12
13 if ( is_array( $counts ) ) {
14 $prefix = $counts['prefix'];
15 $_count = $counts['counts'];
16 $suffix = $counts['suffix'];
17 $suffix_singular = $counts['suffix_singular'];
18 $counts = $_count;
19 }
20
21 $prefix = apply_filters( 'betterdocs_category_items_counts_prefix', $prefix, get_defined_vars() );
22 $suffix = apply_filters( 'betterdocs_category_items_counts_suffix', $suffix, get_defined_vars() );
23 $suffix_singular = apply_filters( 'betterdocs_category_items_counts_suffix_singular', $suffix_singular, get_defined_vars() );
24 ?>
25
26 <div data-count="<?php echo esc_attr( $counts ); ?>" class="betterdocs-category-items-counts">
27 <span>
28 <?php
29 // Layout-only format string — not wrapped in _n() because it contains
30 // nothing but positional placeholders, and translator typos in the
31 // placeholder numbers (e.g. %4$s instead of %3$s) crash sprintf() on
32 // PHP 8.x with ArgumentCountError.
33 echo esc_html(
34 sprintf(
35 '%1$s %2$s %3$s',
36 esc_html( $prefix ),
37 esc_html( $counts ),
38 esc_html( $counts === 1 ? $suffix_singular : $suffix )
39 )
40 );
41 ?>
42 </span>
43 </div>
44