22 $this->
init(
'oxmediaurls' );
32 $sUrl = $this->oxmediaurls__oxurl->value;
34 if ( strpos( $sUrl,
'youtube.com' ) || strpos( $sUrl,
'youtu.be' ) ) {
51 $sForceBlank = $blNewPage ?
' target="_blank"' :
'';
52 $sDesc = $this->oxmediaurls__oxdesc->value;
55 $sHtmlLink =
"<a href=\"$sUrl\"{$sForceBlank}>$sDesc</a>";
67 if ( $this->oxmediaurls__oxisuploaded->value ) {
69 $sUrl .=
'out/media/';
70 $sUrl .= basename($this->oxmediaurls__oxurl->value);
72 $sUrl = $this->oxmediaurls__oxurl->value;
85 return $this->oxmediaurls__oxobjectid->value;
95 public function delete( $sOXID = null )
97 $sFilePath = $this->
getConfig()->getConfigParam(
'sShopDir') .
"/out/media/" .
98 basename($this->oxmediaurls__oxurl->value);
100 if ($this->oxmediaurls__oxisuploaded->value) {
101 if (file_exists($sFilePath)) {
116 $sUrl = $this->oxmediaurls__oxurl->value;
117 $sDesc = $this->oxmediaurls__oxdesc->value;
119 if ( strpos( $sUrl,
'youtube.com' ) ) {
120 $sYoutubeUrl = str_replace(
"www.youtube.com/watch?v=",
"www.youtube.com/embed/", $sUrl );
121 $sYoutubeUrl = preg_replace(
'/&/',
'?', $sYoutubeUrl, 1 );
123 if ( strpos( $sUrl,
'youtu.be' ) ) {
124 $sYoutubeUrl = str_replace(
"youtu.be/",
"www.youtube.com/embed/", $sUrl );
127 $sYoutubeTemplate =
'%s<br><iframe width="425" height="344" src="%s" frameborder="0" allowfullscreen></iframe>';
128 $sYoutubeHtml = sprintf( $sYoutubeTemplate, $sDesc, $sYoutubeUrl, $sYoutubeUrl );
130 return $sYoutubeHtml;