Recent

Helpersclass

Helpers

Helpers class.

Namespace: WebberZone\Top_Ten\Util
Since: 3.3.0
Source: includes/util/class-helpers.php line 21

Methods

__construct()

Constructor class.

Since: 3.3.0
Line: 28

public function __construct(  );

get_from_date() static

Retrieve the from date for the query

Since: 2.6.0
Line: 41

static public function get_from_date( $time = ..., $daily_range = ..., $hour_range = ... ): string;
Type Name Description
string $time A date/time string.
int $daily_range Daily range.
int $hour_range Hour range.

Returns: string — From date

get_daily_range_label() static

Get a human-readable label for a custom period range.

Since: 4.3.2
Line: 76

static public function get_daily_range_label( $daily_range = ... ): string;
Type Name Description
int|null $daily_range Number of days. Defaults to the ‘daily_range’ option.

Returns: string — ‘Daily’ when the range is 1 day, else ‘Custom (N days)’.

number_format_i18n() static

Convert float number to format based on the locale if number_format_count is true.

Since: 2.6.0
Line: 103

static public function number_format_i18n( $number, $decimals = ..., $style = ... ): string;
Type Name Description
float $number The number to convert based on locale.
int $decimals Optional. Precision of the number of decimal places. Default 0.
string|null $style Optional. ‘full’ or ‘abbreviated’. Default null, which uses the

Returns: string — Converted number in string format.

abbreviate_number() static

Abbreviate a number, e.g. 1200 becomes 1.2k and 3400000 becomes 3.4M.

The decimal separator is locale-aware via number_format_i18n().

Since: 4.4.0
Line: 138

static public function abbreviate_number( $number, $decimals = ... ): string;
Type Name Description
float|int $number The number to abbreviate.
int $decimals Optional. Maximum number of decimal places. Default 1.

Returns: string — Abbreviated number, e.g. 1.2k, 3.4M. Numbers below the lowest

str_putcsv() static

Convert a string to CSV.

Since: 2.9.0
Line: 204

static public function str_putcsv( $input, $delimiter = ..., $enclosure = ..., $terminator = ... ): string;
Type Name Description
array $input Input string.
string $delimiter Delimiter.
string $enclosure Enclosure.
string $terminator Terminating string.

Returns: string — CSV string.

trim_char() static

Truncate a string to a certain length.

Since: 2.5.4
Line: 258

static public function trim_char( $input, $count = ..., $more = ..., $break_words = ... ): string;
Type Name Description
string $input String to truncate.
int $count Maximum number of characters to take.
string $more What to append if $input needs to be trimmed.
bool $break_words Optionally choose to break words.

Returns: string — Truncated string.

get_wp_query_arguments() static

Get the WP_Query arguments.

Line: 288

static public function get_wp_query_arguments(  ): array;

Returns: array — WP_Query arguments.

parse_wp_query_arguments() static

Parse WP_Query variables to parse comma separated list of IDs and convert them to arrays as needed by WP_Query.

Line: 373

static public function parse_wp_query_arguments( $query_vars ): array;
Type Name Description
array $query_vars Defined query variables.

Returns: array — Complete query variables with undefined ones filled in empty.

is_bot() static

Check if the user agent matches known bots.

Uses the jaybizzle/crawler-detect library for the primary check, and falls back to a filterable list of patterns for bots that library doesn’t recognise (or if the library isn’t available at all).

Since: 3.3.0
Line: 415

static public function is_bot(  ): bool;

Returns: bool — True if the user agent matches a known bot pattern, false otherwise.

get_all_terms() static

Get all terms of a post.

Since: 4.0.0
Line: 649

static public function get_all_terms( $post ): array;
Type Name Description
int|\WP_Post $post Post ID or WP_Post object.

Returns: array — Array of taxonomies.

sanitize_args() static

Sanitize args.

Since: 4.1.1
Line: 681

static public function sanitize_args( $args ): array;
Type Name Description
array $args Array of arguments.

Returns: array — Sanitized array of arguments.