Skip to content

Instantly share code, notes, and snippets.

@ryandemmer
Created July 1, 2020 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryandemmer/a9a54ec12f613f035ba408487ed9b973 to your computer and use it in GitHub Desktop.
Save ryandemmer/a9a54ec12f613f035ba408487ed9b973 to your computer and use it in GitHub Desktop.
onWfGetCustomEmbedData example
public function onWfGetCustomEmbedData($url = '')
{
$expression = 'http(s)://(www\.)myembed\.com/(.*)id=(.*)';
$data = array(
'width' => '560',
'height'=> '315',
'src' => '',
'allow' => 'accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture allowfullscreen',
);
if (empty($url)) {
$data['expression'] = $expression;
return array(
'myembed' => $data
);
}
preg_match('#' . $expression . '#i', $url, $matches);
if ($matches) {
$data['src'] = 'https://www.myembed.com/embed/?id=' . $matches[5];
return array(
'myembed' => $data
);
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment