Recent

Helpers class

Helpers

Admin Columns Class.

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

Methods

__construct()

Constructor class.

Since: 3.5.0
Line: 28

public function __construct(  );

is_sqlite() static

Check if the current database driver is SQLite.

Used to disable MySQL-specific features (FULLTEXT search, SHOW INDEX, etc.) when running on SQLite, e.g. in WordPress Playground.

Since: 4.3.0
Line: 41

static public function is_sqlite(  ): bool;

Returns: bool — True if SQLite is the active database driver.

str_putcsv() static

Convert a string to CSV.

Since: 3.5.0
Line: 56

static public function str_putcsv( $input, $delimiter = ..., $enclosure = ..., $terminator = ... ): string;
TypeNameDescription
array$inputInput array.
string$delimiterDelimiter.
string$enclosureEnclosure.
string$terminatorTerminating string.

Returns: string — CSV string.

trim_char() static

Truncate a string to a certain length.

Since: 3.5.0
Line: 111

static public function trim_char( $input, $count = ..., $more = ..., $break_words = ... ): string;
TypeNameDescription
string$inputString to truncate.
int$countMaximum number of characters to take.
string$moreWhat to append if $input needs to be trimmed.
bool$break_wordsOptionally choose to break words.

Returns: string — Truncated string.

get_primary_term() static

Get the primary term for a given post.

Since: 3.5.0
Line: 158

static public function get_primary_term( $post, $term = ..., $return_all = ..., $return_first = ... ): array;
TypeNameDescription
int|\WP_Post$postPost ID or WP_Post object.
string$termTerm name.
bool$return_allWhether to return all terms.
bool$return_firstWhether to return the first term.

Returns: array — Primary term object at primary and array of term

get_all_terms() static

Get all terms of a post.

Since: 3.5.0
Line: 238

static public function get_all_terms( $post ): array;
TypeNameDescription
int|\WP_Post$postPost ID or WP_Post object.

Returns: array — Array of taxonomies.

strip_stopwords() static

Strip stopwords from text.

Since: 3.1.0
Line: 273

static public function strip_stopwords( $subject = ..., $search = ..., $replace = ... ): string;
TypeNameDescription
string|array$subjectThe string or an array with strings to search and replace.
string|array$searchOptional. The pattern to search for. It can be either a string or an array with strings.
string|array$replaceOptional. The string to replace with. Default empty string.

Returns: string — Processed text with stopwords removed.

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.

Since: 4.0.0
Line: 309

static public function parse_wp_query_arguments( $query_vars ): array;
TypeNameDescription
array$query_varsDefined query variables.

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

sanitize_args() static

Sanitize args.

Since: 4.0.3
Line: 346

static public function sanitize_args( $args ): array;
TypeNameDescription
array$argsArray of arguments.

Returns: array — Sanitized array of arguments.

get_database_compatibility_message() static

Get a message about MySQL/MariaDB compatibility issues.

Since: 4.0.0
Line: 373

static public function get_database_compatibility_message(  ): string;

Returns: string — Message about compatibility or empty string if compatible.