video_container_id = 'v-' . $guid . '-' . self::$shown[ $guid ];
$this->video_id = $this->video_container_id . '-video';
if ( is_array( $options ) ) {
$this->options = $options;
} else {
$this->options = array();
}
// set up the video
$cache_key = null;
// disable cache in debug mode
if ( defined( 'WP_DEBUG' ) && WP_DEBUG === true ) {
$cached_video = null;
} else {
$cache_key_pieces = array( 'video' );
if ( is_multisite() && is_subdomain_install() ) {
$cache_key_pieces[] = get_current_blog_id();
}
$cache_key_pieces[] = $guid;
if ( $maxwidth > 0 ) {
$cache_key_pieces[] = $maxwidth;
}
if ( is_ssl() ) {
$cache_key_pieces[] = 'ssl';
}
$cache_key = implode( '-', $cache_key_pieces );
unset( $cache_key_pieces );
$cached_video = wp_cache_get( $cache_key, 'video' );
}
if ( empty( $cached_video ) ) {
$video = new VideoPress_Video( $guid, $maxwidth );
if ( isset( $video->error ) ) {
$this->video = $video->error;
return;
} elseif ( is_wp_error( $video ) ) {
$this->video = $video;
return;
}
$this->video = $video;
unset( $video );
if ( ! defined( 'WP_DEBUG' ) || WP_DEBUG !== true ) {
$expire = 3600;
if ( isset( $this->video->expires ) && is_int( $this->video->expires ) ) {
$expires_diff = time() - $this->video->expires;
if ( $expires_diff > 0 && $expires_diff < 86400 ) { // allowed range: 1 second to 1 day
$expire = $expires_diff;
}
unset( $expires_diff );
}
wp_cache_set( $cache_key, serialize( $this->video ), 'video', $expire ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
unset( $expire );
}
} else {
$this->video = unserialize( $cached_video ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_unserialize -- Make sure to unserialize as VideoPress_Video class.
}
unset( $cache_key );
unset( $cached_video );
}
/**
* Wrap output in a VideoPress player container.
*
* @since 1.3
* @param string $content HTML string.
* @return string HTML string or blank string if nothing to wrap.
*/
private function html_wrapper( $content ) {
if ( empty( $content ) ) {
return '';
} else {
return '
' . $content . '
';
}
}
/**
* Output content suitable for a feed reader displaying RSS or Atom feeds
* We do not display error messages in the feed view due to caching concerns.
* Flash content presented using