get_site_url() ) );
}
static function is_embedding_in_iframe() {
return (
self::has_iframe_get_param() && (
self::has_preview_get_param() ||
self::has_preview_theme_preview_param()
)
);
}
private static function has_iframe_get_param() {
return isset( $_GET['iframe'] ) && $_GET['iframe'] === 'true';
}
private static function has_preview_get_param() {
return isset( $_GET['preview'] ) && $_GET['preview'] === 'true';
}
private static function has_preview_theme_preview_param() {
return isset( $_GET['theme_preview'] ) && $_GET['theme_preview'] === 'true';
}
/**
* Disable `autoplay` shortcode attribute in context of an iframe
* Added via `shortcode_atts_video` & `shortcode_atts_audio` in `init`
*
* @param array $atts The output array of shortcode attributes.
*
* @return array The output array of shortcode attributes.
*/
static function disable_autoplay( $atts ) {
return array_merge( $atts, array( 'autoplay' => false ) );
}
/**
* We don't want search engines to index iframe previews
* Added via `wp_head` action in `init`
*/
static function noindex() {
echo '';
}
/**
* Make sure all links and forms open in a new window by default
* (unless overridden on client-side by JS)
* Added via `wp_head` action in `init`
*/
static function base_target_blank() {
echo '';
}
}