BP_Activity_oEmbed_Extension::modify_iframe( string $retval )

Modify various IFRAME-related items if embeds are allowed.


Description Description

HTML modified:

  • Add sandbox="allow-top-navigation" attribute. This allows links to work within the iframe sandbox attribute.

JS modified:

  • Remove IFRAME height restriction of 1000px. Fixes long embed items being truncated.

Parameters Parameters

$retval

(Required) Current embed HTML.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: bp-activity/classes/class-bp-activity-oembed-extension.php

	public function modify_iframe( $retval ) {
		// Add 'allow-top-navigation' to allow links to be clicked.
		$retval = str_replace( 'sandbox="', 'sandbox="allow-top-navigation ', $retval );

		// See /wp-includes/js/wp-embed.js.
		if ( SCRIPT_DEBUG ) {
			// Removes WP's hardcoded IFRAME height restriction.
			$retval = str_replace( 'height = 1000;', 'height = height;', $retval );

		// This is for the WP build minified version.
		} else {
			$retval = str_replace( 'g=1e3', 'g=g', $retval );
		}

		return $retval;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.