\Publicize_Util

Helper functions for shared use in the services files

Summary

Methods
Properties
Constants
crop_str()
get_comment_nodes()
crop_html()
remove_innermost_last_child()
bump_stats_extras_publicize_url()
build_sprintf()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

crop_str()

crop_str(string $string, int $length) : string

Truncates a string to be shorter than or equal to the length specified Attempts to truncate on word boundaries

Parameters

string $string
int $length

Returns

string

get_comment_nodes()

get_comment_nodes(\DOMNode $node) : array

Returns an array of DOMNodes that are comments (including recursing child nodes)

Parameters

\DOMNode $node

Returns

array

crop_html()

crop_html(string $string, int $length, array $allowed_tags) : string

Truncates HTML so that its textContent (text without markup) is shorter than or equal to the length specified.

The length of the returned string may be larger than the specified length due to the markup. Attempts to truncate on word boundaries.

Parameters

string $string
int $length
array $allowed_tags

KSES input

Returns

string

remove_innermost_last_child()

remove_innermost_last_child( $node,  $node_removed_from)

Parameters

$node
$node_removed_from

bump_stats_extras_publicize_url()

bump_stats_extras_publicize_url( $bin,  $post_id)

Parameters

$bin
$post_id

build_sprintf()

build_sprintf( $args)

Parameters

$args