Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-conte.../plugins/embedpre.../EmbedPre.../Includes/Classes
File: Feature_Enhancer.php
}
[500] Fix | Delete
}
[501] Fix | Delete
}
[502] Fix | Delete
[503] Fix | Delete
$options['license'] = [
[504] Fix | Delete
'key' => true,
[505] Fix | Delete
'status' => "missing",
[506] Fix | Delete
];
[507] Fix | Delete
return apply_filters('emebedpress_get_options', $options);
[508] Fix | Delete
}
[509] Fix | Delete
[510] Fix | Delete
public function get_youtube_params($options)
[511] Fix | Delete
{
[512] Fix | Delete
$params = [];
[513] Fix | Delete
[514] Fix | Delete
// Handle `autoplay` option.
[515] Fix | Delete
if (isset($options['autoplay']) && (bool) $options['autoplay'] === true) {
[516] Fix | Delete
$params['autoplay'] = 1;
[517] Fix | Delete
} else {
[518] Fix | Delete
unset($params['autoplay']);
[519] Fix | Delete
}
[520] Fix | Delete
[521] Fix | Delete
// Handle `controls` option.
[522] Fix | Delete
if (isset($options['controls']) && in_array((int) $options['controls'], [0, 1, 2])) {
[523] Fix | Delete
$params['controls'] = (int) $options['controls'];
[524] Fix | Delete
} else {
[525] Fix | Delete
unset($params['controls']);
[526] Fix | Delete
}
[527] Fix | Delete
[528] Fix | Delete
// Handle `fs` option.
[529] Fix | Delete
if (isset($options['fs']) && in_array((int) $options['fs'], [0, 1])) {
[530] Fix | Delete
$params['fs'] = (int) $options['fs'];
[531] Fix | Delete
} else {
[532] Fix | Delete
unset($params['fs']);
[533] Fix | Delete
}
[534] Fix | Delete
[535] Fix | Delete
// Handle `iv_load_policy` option.
[536] Fix | Delete
if (isset($options['iv_load_policy']) && in_array((int) $options['iv_load_policy'], [1, 3])) {
[537] Fix | Delete
$params['iv_load_policy'] = (int) $options['iv_load_policy'];
[538] Fix | Delete
} else {
[539] Fix | Delete
unset($params['iv_load_policy']);
[540] Fix | Delete
}
[541] Fix | Delete
[542] Fix | Delete
return apply_filters('embedpress_youtube_params', $params);
[543] Fix | Delete
}
[544] Fix | Delete
[545] Fix | Delete
public function get_vimeo_params($options)
[546] Fix | Delete
{
[547] Fix | Delete
$params = [];
[548] Fix | Delete
[549] Fix | Delete
// Handle `display_title` option.
[550] Fix | Delete
if (isset($options['display_title']) && (bool) $options['display_title'] === true) {
[551] Fix | Delete
$params['title'] = 1;
[552] Fix | Delete
} else {
[553] Fix | Delete
$params['title'] = 0;
[554] Fix | Delete
}
[555] Fix | Delete
[556] Fix | Delete
// Handle `autoplay` option.
[557] Fix | Delete
if (!empty($options['autoplay'])) {
[558] Fix | Delete
$params['autoplay'] = 1;
[559] Fix | Delete
} else {
[560] Fix | Delete
unset($params['autoplay']);
[561] Fix | Delete
}
[562] Fix | Delete
[563] Fix | Delete
// Handle `color` option.
[564] Fix | Delete
if (!empty($options['color'])) {
[565] Fix | Delete
$params['color'] = str_replace('#', '', $options['color']);
[566] Fix | Delete
} else {
[567] Fix | Delete
unset($params['color']);
[568] Fix | Delete
}
[569] Fix | Delete
return apply_filters('embedpress_vimeo_params', $params);
[570] Fix | Delete
}
[571] Fix | Delete
[572] Fix | Delete
//--- For CLASSIC AND BLOCK EDITOR
[573] Fix | Delete
public function enhance_youtube($embed)
[574] Fix | Delete
{
[575] Fix | Delete
[576] Fix | Delete
[577] Fix | Delete
$isYoutube = (isset($embed->provider_name) && strtoupper($embed->provider_name) === 'YOUTUBE') || (isset($embed->url) && isset($embed->{$embed->url}) && isset($embed->{$embed->url}['provider_name']) && strtoupper($embed->{$embed->url}['provider_name']) === 'YOUTUBE');
[578] Fix | Delete
[579] Fix | Delete
if (
[580] Fix | Delete
$isYoutube && isset($embed->embed)
[581] Fix | Delete
&& preg_match('/src=\"(.+?)\"/', $embed->embed, $match)
[582] Fix | Delete
) {
[583] Fix | Delete
[584] Fix | Delete
// for compatibility only, @TODO; remove later after deep testing.
[585] Fix | Delete
$options = $this->getOptions('youtube', $this->get_youtube_settings_schema());
[586] Fix | Delete
[587] Fix | Delete
// Parse the url to retrieve all its info like variables etc.
[588] Fix | Delete
$url_full = $match[1];
[589] Fix | Delete
$query = parse_url($url_full, PHP_URL_QUERY);
[590] Fix | Delete
parse_str($query, $params);
[591] Fix | Delete
// Handle `color` option.
[592] Fix | Delete
if (!empty($options['color'])) {
[593] Fix | Delete
$params['color'] = $options['color'];
[594] Fix | Delete
} else {
[595] Fix | Delete
unset($params['color']);
[596] Fix | Delete
}
[597] Fix | Delete
// Handle `rel` option.
[598] Fix | Delete
if (isset($options['rel']) && in_array((int) $options['rel'], [0, 1])) {
[599] Fix | Delete
$params['rel'] = (int) $options['rel'];
[600] Fix | Delete
} else {
[601] Fix | Delete
unset($params['rel']);
[602] Fix | Delete
}
[603] Fix | Delete
[604] Fix | Delete
// Handle `autoplay` option.
[605] Fix | Delete
if (isset($options['autoplay']) && (bool) $options['autoplay'] === true) {
[606] Fix | Delete
$params['autoplay'] = 1;
[607] Fix | Delete
} else {
[608] Fix | Delete
unset($params['autoplay']);
[609] Fix | Delete
}
[610] Fix | Delete
[611] Fix | Delete
// Handle `controls` option.
[612] Fix | Delete
if (isset($options['controls']) && in_array((int) $options['controls'], [0, 1, 2])) {
[613] Fix | Delete
$params['controls'] = (int) $options['controls'];
[614] Fix | Delete
} else {
[615] Fix | Delete
unset($params['controls']);
[616] Fix | Delete
}
[617] Fix | Delete
if (isset($options['start_time'])) {
[618] Fix | Delete
$params['start'] = $options['start_time'];
[619] Fix | Delete
} else {
[620] Fix | Delete
unset($params['start']);
[621] Fix | Delete
}
[622] Fix | Delete
if (isset($options['end_time'])) {
[623] Fix | Delete
$params['end'] = $options['end_time'];
[624] Fix | Delete
} else {
[625] Fix | Delete
unset($params['end']);
[626] Fix | Delete
}
[627] Fix | Delete
[628] Fix | Delete
// Handle `fs` option.
[629] Fix | Delete
if (isset($options['fs']) && in_array((int) $options['fs'], [0, 1])) {
[630] Fix | Delete
$params['fs'] = (int) $options['fs'];
[631] Fix | Delete
} else {
[632] Fix | Delete
unset($params['fs']);
[633] Fix | Delete
}
[634] Fix | Delete
[635] Fix | Delete
// Handle `iv_load_policy` option.
[636] Fix | Delete
if (isset($options['iv_load_policy']) && in_array((int) $options['iv_load_policy'], [1, 3])) {
[637] Fix | Delete
$params['iv_load_policy'] = (int) $options['iv_load_policy'];
[638] Fix | Delete
} else {
[639] Fix | Delete
unset($params['iv_load_policy']);
[640] Fix | Delete
}
[641] Fix | Delete
[642] Fix | Delete
// pro controls will be handled by the pro so remove it from the free.
[643] Fix | Delete
$pro_controls = ['cc_load_policy', 'modestbranding'];
[644] Fix | Delete
foreach ($pro_controls as $pro_control) {
[645] Fix | Delete
if (isset($params[$pro_control])) {
[646] Fix | Delete
unset($params[$pro_control]);
[647] Fix | Delete
}
[648] Fix | Delete
}
[649] Fix | Delete
[650] Fix | Delete
preg_match('/(.+)?\?/', $url_full, $url);
[651] Fix | Delete
$url = $url[1];
[652] Fix | Delete
[653] Fix | Delete
if (is_object($embed->attributes) && !empty($embed->attributes)) {
[654] Fix | Delete
$attributes = (array) $embed->attributes;
[655] Fix | Delete
[656] Fix | Delete
$params['controls'] = isset($attributes['data-controls']) ? $attributes['data-controls'] : '1';
[657] Fix | Delete
$params['iv_load_policy'] = !empty($attributes['data-videoannotations']) && ($attributes['data-videoannotations'] == 'true') ? 1 : 0;
[658] Fix | Delete
$params['fs'] = !empty($attributes['data-fullscreen']) && ($attributes['data-fullscreen'] == 'true') ? 1 : 0;
[659] Fix | Delete
$params['rel'] = !empty($attributes['data-relatedvideos']) && ($attributes['data-relatedvideos'] == 'true') ? 1 : 0;
[660] Fix | Delete
$params['end'] = !empty($attributes['data-endtime']) ? $attributes['data-endtime'] : '';
[661] Fix | Delete
$params['autoplay'] = !empty($attributes['data-autoplay']) && ($attributes['data-autoplay'] == 'true') ? 1 : 0;
[662] Fix | Delete
$params['start'] = !empty($attributes['data-starttime']) ? $attributes['data-starttime'] : '';
[663] Fix | Delete
$params['color'] = !empty($attributes['data-progressbarcolor']) ? $attributes['data-progressbarcolor'] : 'red';
[664] Fix | Delete
$params['modestbranding'] = empty($attributes['data-modestbranding']) ? 0 : 1; // Reverse the condition value for modestbranding. 0 = display, 1 = do not display
[665] Fix | Delete
$params['cc_load_policy'] = !empty($attributes['data-closedcaptions']) && ($attributes['data-closedcaptions'] == 'true') ? 0 : 1;
[666] Fix | Delete
}
[667] Fix | Delete
[668] Fix | Delete
// Reassemble the url with the new variables.
[669] Fix | Delete
$url_modified = $url . '?';
[670] Fix | Delete
foreach ($params as $paramName => $paramValue) {
[671] Fix | Delete
$url_modified .= $paramName . '=' . $paramValue . '&';
[672] Fix | Delete
}
[673] Fix | Delete
[674] Fix | Delete
// Replaces the old url with the new one.
[675] Fix | Delete
$embed->embed = str_replace($url_full, rtrim($url_modified, '&'), $embed->embed);
[676] Fix | Delete
}
[677] Fix | Delete
[678] Fix | Delete
return $embed;
[679] Fix | Delete
}
[680] Fix | Delete
[681] Fix | Delete
public function enhance_vimeo($embed)
[682] Fix | Delete
{
[683] Fix | Delete
[684] Fix | Delete
[685] Fix | Delete
if (
[686] Fix | Delete
isset($embed->provider_name)
[687] Fix | Delete
&& strtoupper($embed->provider_name) === 'VIMEO'
[688] Fix | Delete
&& isset($embed->embed)
[689] Fix | Delete
&& preg_match('/src=\"(.+?)\"/', $embed->embed, $match)
[690] Fix | Delete
) {
[691] Fix | Delete
// old schema is for backward compatibility only @todo; remove it in the next version after deep test
[692] Fix | Delete
$options = $this->getOptions('vimeo', $this->get_vimeo_settings_schema());
[693] Fix | Delete
[694] Fix | Delete
$url_full = $match[1];
[695] Fix | Delete
$params = [];
[696] Fix | Delete
[697] Fix | Delete
// Handle `display_title` option.
[698] Fix | Delete
if (isset($options['display_title']) && (bool) $options['display_title'] === true) {
[699] Fix | Delete
$params['title'] = 1;
[700] Fix | Delete
} else {
[701] Fix | Delete
$params['title'] = 0;
[702] Fix | Delete
}
[703] Fix | Delete
[704] Fix | Delete
// Handle `autoplay` option.
[705] Fix | Delete
if (isset($options['autoplay']) && (bool) $options['autoplay'] === true) {
[706] Fix | Delete
$params['autoplay'] = 1;
[707] Fix | Delete
} else {
[708] Fix | Delete
unset($params['autoplay']);
[709] Fix | Delete
}
[710] Fix | Delete
[711] Fix | Delete
// Handle `color` option.
[712] Fix | Delete
if (!empty($options['color'])) {
[713] Fix | Delete
$params['color'] = str_replace('#', '', $options['color']);
[714] Fix | Delete
} else {
[715] Fix | Delete
unset($params['color']);
[716] Fix | Delete
}
[717] Fix | Delete
// Handle `display_author` option.
[718] Fix | Delete
if (isset($options['display_author']) && (bool) $options['display_author'] === true) {
[719] Fix | Delete
$params['byline'] = 1;
[720] Fix | Delete
} else {
[721] Fix | Delete
$params['byline'] = 0;
[722] Fix | Delete
}
[723] Fix | Delete
[724] Fix | Delete
// Handle `display_avatar` option.
[725] Fix | Delete
if (isset($options['display_avatar']) && (bool) $options['display_avatar'] === true) {
[726] Fix | Delete
$params['portrait'] = 1;
[727] Fix | Delete
} else {
[728] Fix | Delete
$params['portrait'] = 0;
[729] Fix | Delete
}
[730] Fix | Delete
[731] Fix | Delete
// NOTE: 'vimeo_dnt' is actually only 'dnt' in the params, so unset 'dnt' only
[732] Fix | Delete
//@todo; maybe extract unsetting pro vars to a function later
[733] Fix | Delete
$pro_controls = ['loop', 'autopause', 'dnt',];
[734] Fix | Delete
foreach ($pro_controls as $pro_control) {
[735] Fix | Delete
if (isset($params[$pro_control])) {
[736] Fix | Delete
unset($params[$pro_control]);
[737] Fix | Delete
}
[738] Fix | Delete
}
[739] Fix | Delete
[740] Fix | Delete
if (!empty($params['autopause'])) {
[741] Fix | Delete
unset($params['dnt']);
[742] Fix | Delete
unset($params['amp;dnt']);
[743] Fix | Delete
}
[744] Fix | Delete
[745] Fix | Delete
// Reassemble the url with the new variables.
[746] Fix | Delete
$url_modified = str_replace("&dnt=1", "", $url_full);
[747] Fix | Delete
[748] Fix | Delete
if (is_object($embed->attributes) && !empty($embed->attributes)) {
[749] Fix | Delete
$attributes = (array) $embed->attributes;
[750] Fix | Delete
$attributes = stringToBoolean($attributes);
[751] Fix | Delete
[752] Fix | Delete
$params['title'] = !empty($attributes['data-vtitle']) ? 1 : 0;
[753] Fix | Delete
$params['byline'] = !empty($attributes['data-vauthor']) ? 1 : 0;
[754] Fix | Delete
$params['portrait'] = !empty($attributes['data-vavatar']) ? 1 : 0;
[755] Fix | Delete
$params['autoplay'] = !empty($attributes['data-vautoplay']) ? 1 : 0;
[756] Fix | Delete
$params['loop'] = !empty($attributes['data-vloop']) ? 1 : 0;
[757] Fix | Delete
$params['autopause'] = !empty($attributes['data-vautopause']) ? 1 : 0;
[758] Fix | Delete
if (empty($attributes['data-vautopause'])) :
[759] Fix | Delete
$params['dnt'] = !empty($attributes['data-vdnt']) ? 1 : 0;
[760] Fix | Delete
endif;
[761] Fix | Delete
$params['color'] = !empty($attributes['data-vscheme']) ? str_replace("#", "", $attributes['data-vscheme']) : '00ADEF';
[762] Fix | Delete
[763] Fix | Delete
if (!empty($attributes['data-vstarttime'])) :
[764] Fix | Delete
$params['t'] = !empty($attributes['data-vstarttime']) ? $attributes['data-vstarttime'] : '';
[765] Fix | Delete
endif;
[766] Fix | Delete
[767] Fix | Delete
foreach ($params as $param => $value) {
[768] Fix | Delete
$url_modified = add_query_arg($param, $value, $url_modified);
[769] Fix | Delete
}
[770] Fix | Delete
[771] Fix | Delete
$url_modified = str_replace("&t=", "#t=", $url_modified);
[772] Fix | Delete
} else {
[773] Fix | Delete
foreach ($params as $param => $value) {
[774] Fix | Delete
$url_modified = add_query_arg($param, $value, $url_modified);
[775] Fix | Delete
}
[776] Fix | Delete
[777] Fix | Delete
if (empty($attributes['data-vstarttime']) && isset($options['start_time'])) {
[778] Fix | Delete
$url_modified .= '#t=' . $options['start_time'];
[779] Fix | Delete
}
[780] Fix | Delete
}
[781] Fix | Delete
[782] Fix | Delete
do_action('embedpress_after_modified_url', $url_modified, $url_full, $params);
[783] Fix | Delete
[784] Fix | Delete
// Replaces the old url with the new one.
[785] Fix | Delete
$embed->embed = str_replace($url_full, $url_modified, $embed->embed);
[786] Fix | Delete
}
[787] Fix | Delete
[788] Fix | Delete
return $embed;
[789] Fix | Delete
}
[790] Fix | Delete
[791] Fix | Delete
public function enhance_wistia($embed)
[792] Fix | Delete
{
[793] Fix | Delete
[794] Fix | Delete
if (
[795] Fix | Delete
isset($embed->provider_name)
[796] Fix | Delete
&& strtoupper($embed->provider_name) === 'WISTIA, INC.'
[797] Fix | Delete
&& isset($embed->embed)
[798] Fix | Delete
&& preg_match('/src=\"(.+?)\"/', $embed->embed, $match)
[799] Fix | Delete
) {
[800] Fix | Delete
$options = $this->getOptions('wistia', $this->get_wistia_settings_schema());
[801] Fix | Delete
[802] Fix | Delete
$url_full = $match[1];
[803] Fix | Delete
[804] Fix | Delete
// Parse the url to retrieve all its info like variables etc.
[805] Fix | Delete
$query = parse_url($embed->url, PHP_URL_QUERY);
[806] Fix | Delete
$url = str_replace('?' . $query, '', $url_full);
[807] Fix | Delete
[808] Fix | Delete
if ($query !== null) {
[809] Fix | Delete
parse_str($query, $params);
[810] Fix | Delete
}
[811] Fix | Delete
[812] Fix | Delete
// Set the class in the attributes
[813] Fix | Delete
$embed->attributes->class = str_replace('{provider_alias}', 'wistia', $embed->attributes->class);
[814] Fix | Delete
$embed->embed = str_replace('ose-wistia, inc.', 'ose-wistia', $embed->embed);
[815] Fix | Delete
[816] Fix | Delete
[817] Fix | Delete
// Embed Options
[818] Fix | Delete
$embedOptions = new \stdClass;
[819] Fix | Delete
$embedOptions->videoFoam = false;
[820] Fix | Delete
$embedOptions->fullscreenButton = (isset($options['display_fullscreen_button']) && (bool) $options['display_fullscreen_button'] === true);
[821] Fix | Delete
$embedOptions->playbar = (isset($options['display_playbar']) && (bool) $options['display_playbar'] === true);
[822] Fix | Delete
[823] Fix | Delete
$embedOptions->smallPlayButton = (isset($options['small_play_button']) && (bool) $options['small_play_button'] === true);
[824] Fix | Delete
[825] Fix | Delete
$embedOptions->autoPlay = (isset($options['autoplay']) && (bool) $options['autoplay'] === true);
[826] Fix | Delete
[827] Fix | Delete
if (!empty($options['start_time'])) {
[828] Fix | Delete
$embedOptions->time = isset($options['start_time']) ? $options['start_time'] : 0;
[829] Fix | Delete
}
[830] Fix | Delete
[831] Fix | Delete
if (isset($options['player_color'])) {
[832] Fix | Delete
$color = $options['player_color'];
[833] Fix | Delete
if (null !== $color) {
[834] Fix | Delete
$embedOptions->playerColor = $color;
[835] Fix | Delete
}
[836] Fix | Delete
}
[837] Fix | Delete
[838] Fix | Delete
// Plugins
[839] Fix | Delete
$pluginsBaseURL = plugins_url('assets/js/wistia/min', dirname(__DIR__) . '/embedpress-Wistia.php');
[840] Fix | Delete
[841] Fix | Delete
$pluginList = array();
[842] Fix | Delete
[843] Fix | Delete
// Resumable
[844] Fix | Delete
if (isset($options['plugin_resumable'])) {
[845] Fix | Delete
$isResumableEnabled = $options['plugin_resumable'];
[846] Fix | Delete
if ($isResumableEnabled) {
[847] Fix | Delete
// Add the resumable plugin
[848] Fix | Delete
$pluginList['resumable'] = array(
[849] Fix | Delete
'src' => $pluginsBaseURL . '/resumable.min.js',
[850] Fix | Delete
'async' => false
[851] Fix | Delete
);
[852] Fix | Delete
}
[853] Fix | Delete
}
[854] Fix | Delete
[855] Fix | Delete
// Add a fix for the autoplay and resumable work better together
[856] Fix | Delete
if (isset($options->autoPlay)) {
[857] Fix | Delete
if ($isResumableEnabled) {
[858] Fix | Delete
$pluginList['fixautoplayresumable'] = array(
[859] Fix | Delete
'src' => $pluginsBaseURL . '/fixautoplayresumable.min.js'
[860] Fix | Delete
);
[861] Fix | Delete
}
[862] Fix | Delete
}
[863] Fix | Delete
[864] Fix | Delete
// Focus plugin
[865] Fix | Delete
if (isset($options['plugin_focus'])) {
[866] Fix | Delete
$isFocusEnabled = $options['plugin_focus'];
[867] Fix | Delete
$pluginList['dimthelights'] = array(
[868] Fix | Delete
'src' => $pluginsBaseURL . '/dimthelights.min.js',
[869] Fix | Delete
'autoDim' => $isFocusEnabled
[870] Fix | Delete
);
[871] Fix | Delete
$embedOptions->focus = $isFocusEnabled;
[872] Fix | Delete
}
[873] Fix | Delete
[874] Fix | Delete
// Rewind plugin
[875] Fix | Delete
if (isset($options['plugin_rewind'])) {
[876] Fix | Delete
if ($options['plugin_rewind']) {
[877] Fix | Delete
$embedOptions->rewindTime = isset($options['plugin_rewind_time']) ? (int) $options['plugin_rewind_time'] : 10;
[878] Fix | Delete
[879] Fix | Delete
$pluginList['rewind'] = array(
[880] Fix | Delete
'src' => $pluginsBaseURL . '/rewind.min.js'
[881] Fix | Delete
);
[882] Fix | Delete
}
[883] Fix | Delete
}
[884] Fix | Delete
$embedOptions->plugin = $pluginList;
[885] Fix | Delete
[886] Fix | Delete
$embedOptions = json_encode($embedOptions);
[887] Fix | Delete
[888] Fix | Delete
// Get the video ID
[889] Fix | Delete
$videoId = $this->getVideoIDFromURL($embed->url);
[890] Fix | Delete
$shortVideoId = substr($videoId, 0, 3);
[891] Fix | Delete
[892] Fix | Delete
// Responsive?
[893] Fix | Delete
[894] Fix | Delete
$class = array(
[895] Fix | Delete
'wistia_embed',
[896] Fix | Delete
'wistia_async_' . $videoId
[897] Fix | Delete
);
[898] Fix | Delete
[899] Fix | Delete
$attribs = array(
[900] Fix | Delete
sprintf('id="wistia_%s"', $videoId),
[901] Fix | Delete
sprintf('class="%s"', join(' ', $class)),
[902] Fix | Delete
sprintf('style="width:%spx; height:%spx;"', $embed->width, $embed->height)
[903] Fix | Delete
);
[904] Fix | Delete
[905] Fix | Delete
$labels = array(
[906] Fix | Delete
'watch_from_beginning' => __('Watch from the beginning', 'embedpress'),
[907] Fix | Delete
'skip_to_where_you_left_off' => __('Skip to where you left off', 'embedpress'),
[908] Fix | Delete
'you_have_watched_it_before' => __(
[909] Fix | Delete
'It looks like you\'ve watched<br />part of this video before!',
[910] Fix | Delete
'embedpress'
[911] Fix | Delete
),
[912] Fix | Delete
);
[913] Fix | Delete
$labels = json_encode($labels);
[914] Fix | Delete
[915] Fix | Delete
preg_match('/ose-uid-([a-z0-9]*)/', $embed->embed, $matches);
[916] Fix | Delete
$uid = $matches[1];
[917] Fix | Delete
[918] Fix | Delete
$html = "<div class=\"embedpress-wrapper ose-wistia ose-uid-{$uid} responsive\">";
[919] Fix | Delete
$html .= '<script src="https://fast.wistia.com/assets/external/E-v1.js" async></script>';
[920] Fix | Delete
$html .= "<script>window.pp_embed_wistia_labels = {$labels};</script>\n";
[921] Fix | Delete
$html .= "<script>window._wq = window._wq || []; _wq.push({\"{$shortVideoId}\": {$embedOptions}});</script>\n";
[922] Fix | Delete
$html .= '<div ' . join(' ', $attribs) . "></div>\n";
[923] Fix | Delete
$html .= '</div>';
[924] Fix | Delete
$embed->embed = $html;
[925] Fix | Delete
}
[926] Fix | Delete
[927] Fix | Delete
return $embed;
[928] Fix | Delete
}
[929] Fix | Delete
[930] Fix | Delete
public function enhance_twitch($embed_content)
[931] Fix | Delete
{
[932] Fix | Delete
$e = isset($embed_content->url) && isset($embed_content->{$embed_content->url}) ? $embed_content->{$embed_content->url} : [];
[933] Fix | Delete
if (isset($e['provider_name']) && strtoupper($e['provider_name']) === 'TWITCH' && isset($embed_content->embed)) {
[934] Fix | Delete
$settings = $this->getOptions('twitch', $this->get_twitch_settings_schema());
[935] Fix | Delete
[936] Fix | Delete
$atts = isset($embed_content->attributes) ? $embed_content->attributes : [];
[937] Fix | Delete
$time = '0h0m0s';
[938] Fix | Delete
$type = $e['type'];
[939] Fix | Delete
$content_id = $e['content_id'];
[940] Fix | Delete
$channel = 'channel' === $type ? $content_id : '';
[941] Fix | Delete
$video = 'video' === $type ? $content_id : '';
[942] Fix | Delete
$muted = isset($settings['embedpress_pro_twitch_mute']) && ('yes' === $settings['embedpress_pro_twitch_mute']) ? 'true' : 'false';
[943] Fix | Delete
$full_screen = isset($settings['embedpress_pro_fs']) && ('yes' === $settings['embedpress_pro_fs']) ? 'true' : 'false';
[944] Fix | Delete
$autoplay = isset($settings['embedpress_pro_twitch_autoplay']) && ('yes' === $settings['embedpress_pro_twitch_autoplay']) ? 'true' : 'false';
[945] Fix | Delete
$theme = !empty($settings['embedpress_pro_twitch_theme']) ? esc_attr($settings['embedpress_pro_twitch_theme']) : 'dark';
[946] Fix | Delete
[947] Fix | Delete
$layout = 'video';
[948] Fix | Delete
$width = !empty($atts->{'data-width'}) ? (int) $atts->{'data-width'} : 800;
[949] Fix | Delete
$height = !empty($atts->{'data-height'}) ? (int) $atts->{'data-height'} : 450;
[950] Fix | Delete
if (!empty($settings['start_time'])) {
[951] Fix | Delete
$ta = explode(':', gmdate("G:i:s", $settings['start_time']));
[952] Fix | Delete
$h = $ta[0] . 'h';
[953] Fix | Delete
$m = ($ta[1] * 1) . 'm';
[954] Fix | Delete
$s = ($ta[2] * 1) . 's';
[955] Fix | Delete
$time = $h . $m . $s;
[956] Fix | Delete
}
[957] Fix | Delete
$url = "https://embed.twitch.tv?autoplay={$autoplay}&channel={$channel}&height={$height}&layout={$layout}&migration=true&muted={$muted}&theme={$theme}&time={$time}&video={$video}&width={$width}&allowfullscreen={$full_screen}";
[958] Fix | Delete
$pars_url = wp_parse_url(get_site_url());
[959] Fix | Delete
$url = !empty($pars_url['host']) ? $url . '&parent=' . $pars_url['host'] : $url;
[960] Fix | Delete
ob_start();
[961] Fix | Delete
?>
[962] Fix | Delete
<div class="embedpress_wrapper" data-url="<?php echo esc_url($embed_content->url); ?>">
[963] Fix | Delete
<iframe src="<?php echo esc_url($url); ?>" allowfullscreen="" scrolling="no" frameborder="0" allow="autoplay; fullscreen" title="Twitch" sandbox="allow-modals allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox" width="<?php echo esc_attr($width); ?>" height="<?php echo esc_attr($height); ?>" style="max-width: <?php echo esc_attr($width); ?>px; max-height:<?php echo esc_attr($height); ?>px;"></iframe>
[964] Fix | Delete
</div>
[965] Fix | Delete
<?php
[966] Fix | Delete
$c = ob_get_clean();
[967] Fix | Delete
$embed_content->embed = $c;
[968] Fix | Delete
}
[969] Fix | Delete
[970] Fix | Delete
return $embed_content;
[971] Fix | Delete
}
[972] Fix | Delete
public function enhance_dailymotion($embed)
[973] Fix | Delete
{
[974] Fix | Delete
$options = $this->getOptions('dailymotion', $this->get_dailymotion_settings_schema());
[975] Fix | Delete
$isDailymotion = (isset($embed->provider_name) && strtoupper($embed->provider_name) === 'DAILYMOTION') || (isset($embed->url) && isset($embed->{$embed->url}) && isset($embed->{$embed->url}['provider_name']) && strtoupper($embed->{$embed->url}['provider_name']) === 'DAILYMOTION');
[976] Fix | Delete
[977] Fix | Delete
if (
[978] Fix | Delete
$isDailymotion && isset($embed->embed)
[979] Fix | Delete
&& preg_match('/src=\"(.+?)\"/', $embed->embed, $match)
[980] Fix | Delete
) {
[981] Fix | Delete
// Parse the url to retrieve all its info like variables etc.
[982] Fix | Delete
$url_full = $match[1];
[983] Fix | Delete
$params = [
[984] Fix | Delete
'ui-highlight' => str_replace('#', '', isset($options['color']) ? $options['color'] : null),
[985] Fix | Delete
'mute' => (int) isset($options['mute']) ? $options['mute'] : null,
[986] Fix | Delete
'autoplay' => (int) isset($options['autoplay']) ? $options['autoplay'] : null,
[987] Fix | Delete
'controls' => (int) isset($options['controls']) ? $options['controls'] : null,
[988] Fix | Delete
'ui-start-screen-info' => (int) isset($options['video_info']) ? $options['video_info'] : null,
[989] Fix | Delete
'endscreen-enable' => 0,
[990] Fix | Delete
];
[991] Fix | Delete
[992] Fix | Delete
if (isset($options['play_on_mobile']) && $options['play_on_mobile'] == '1') {
[993] Fix | Delete
$params['playsinline'] = 1;
[994] Fix | Delete
}
[995] Fix | Delete
$params['start'] = (int) isset($options['start_time']) ? $options['start_time'] : null;
[996] Fix | Delete
if (is_embedpress_pro_active()) {
[997] Fix | Delete
$params['ui-logo'] = (int) isset($options['show_logo']) ? $options['show_logo'] : null;
[998] Fix | Delete
}
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function