'', 'link' => '', 'text' => '' ] );
}
/**
* Insert a referral property so that we can populate the referral across all urls.
*
* @param $key
* @param $val
*/
public static function register_ref( $key, $val ) {
self::$ref[ $key ] = $val;
}
/**
* Render HTML for all the registered nodes
*/
public static function render() {
if ( empty( self::$nodes ) ) {
return '';
}
$last_item = end( self::$nodes );
?>
';
if ( $count !== $h && isset( $menu['link'] ) && ! empty( $menu['link'] ) ) {
echo '' . $menu['text'] . ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
echo $menu['text']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
echo '';
}
return self::$nodes;
}
/**
* Add the registered referral to the url passed
* ref should contain the query param as key and value as value
*
* @param $url URL to add refs to
*
* @return string modified url
*/
public static function maybe_add_refs( $url ) {
if ( empty( self::$ref ) ) {
return $url;
}
return add_query_arg( self::$ref, $url );
}
public static function render_sticky_bar() {
?>