23 $this->
init(
'oxmediaurls');
33 $sUrl = $this->oxmediaurls__oxurl->value;
35 if (strpos($sUrl,
'youtube.com') || strpos($sUrl,
'youtu.be')) {
52 $sForceBlank = $blNewPage ?
' target="_blank"' :
'';
53 $sDesc = $this->oxmediaurls__oxdesc->value;
56 $sHtmlLink =
"<a href=\"$sUrl\"{$sForceBlank}>$sDesc</a>";
68 if ($this->oxmediaurls__oxisuploaded->value) {
70 $sUrl .=
'out/media/';
71 $sUrl .= basename($this->oxmediaurls__oxurl->value);
73 $sUrl = $this->oxmediaurls__oxurl->value;
86 return $this->oxmediaurls__oxobjectid->value;
96 public function delete($sOXID = null)
98 $sFilePath = $this->
getConfig()->getConfigParam(
'sShopDir') .
"/out/media/" .
99 basename($this->oxmediaurls__oxurl->value);
101 if ($this->oxmediaurls__oxisuploaded->value) {
102 if (file_exists($sFilePath)) {
117 $sUrl = $this->oxmediaurls__oxurl->value;
118 $sDesc = $this->oxmediaurls__oxdesc->value;
120 if (strpos($sUrl,
'youtube.com')) {
121 $sYoutubeUrl = str_replace(
"www.youtube.com/watch?v=",
"www.youtube.com/embed/", $sUrl);
122 $sYoutubeUrl = preg_replace(
'/&/',
'?', $sYoutubeUrl, 1);
124 if (strpos($sUrl,
'youtu.be')) {
125 $sYoutubeUrl = str_replace(
"youtu.be/",
"www.youtube.com/embed/", $sUrl);
128 $sYoutubeTemplate =
'%s<br><iframe width="425" height="344" src="%s" frameborder="0" allowfullscreen></iframe>';
129 $sYoutubeHtml = sprintf($sYoutubeTemplate, $sDesc, $sYoutubeUrl, $sYoutubeUrl);
131 return $sYoutubeHtml;