GC_Embed::maybe_make_link()

最后更新于:2021-11-27 14:40:46

GC_Embed::maybe_make_link( string$url)

Conditionally makes a hyperlink based on an internal class variable.

参数

$url

(string) (Required) URL to potentially be linked.

响应

(string|false) Linked URL or the original URL. False if ‘return_false_on_fail’ is true.

源文件

文件: gc-includes/class-gc-embed.php

	public function maybe_make_link( $url ) {
		if ( $this->return_false_on_fail ) {
			return false;
		}

		$output = ( $this->linkifunknown ) ? '<a href="' . esc_url( $url ) . '">' . esc_html( $url ) . '</a>' : $url;

		/**
		 * Filters the returned, maybe-linked embed URL.
		 *
		 * @since 2.9.0
		 *
		 * @param string $output The linked or original URL.
		 * @param string $url    The original URL.
		 */
		return apply_filters( 'embed_maybe_make_link', $output, $url );
	}