function _render_html() { if ($this->_content['mediaId'] > 0) { $linkTitle = $this->getAttribute('linkTitle'); $linkTitle = str_replace('#title#', $this->_content['title'], $linkTitle); $linkTitle = str_replace('#size#', org_glizy_helpers_String::formatFileSize($this->media->size), $linkTitle); $originalFileName = $this->media->originalFileName; $part = explode('.', $originalFileName); $type = ''; if (count($part) > 1) { $type = strtoupper($part[count($part) - 1]); } $linkTitle = str_replace('#format#', $type, $linkTitle); $this->_content['linkTitle'] = $linkTitle; $this->_content['__url__'] = org_glizy_helpers_Media::getFileUrlById($this->media->id, $this->getAttribute('directUrl')); $this->_content['__html__'] = org_glizy_helpers_Link::makeSimpleLink($this->_content['title'], $this->_content['__url__'], $linkTitle, $this->getAttribute('cssClass'), $this->getAttribute('rel')); } }
private function addMediaById($mediaId) { $media = org_glizycms_mediaArchive_MediaManager::getMediaById($mediaId); if ($media == null) { return null; } if ($media->type == 'VIDEO') { return GLZ_HOST . '/' . org_glizy_helpers_Media::getFileUrlById($media->id); } else { $this->medias[$media->id] = $media->fileName; return 'media/' . $media->fileName; } }
function mediaAbsoluteUrl($item, $field) { $json = $item->{$field}; if (preg_match('/{"id":(\\d+)/', $json, $m)) { $media = json_decode($json); $item->{$field . 'Title'} = $media->title; $m = org_glizycms_mediaArchive_MediaManager::getMediaById($media->id); if ($m->type == 'VIDEO') { $item->{$field . 'Url'} = GLZ_HOST . '/' . org_glizy_helpers_Media::getFileUrlById($media->id, true); } else { $item->{$field . 'Url'} = GLZ_HOST . '/' . org_glizy_helpers_Media::getFileUrlById($media->id); } } else { $item->{$field . 'Title'} = ''; $item->{$field . 'Url'} = ''; } unset($item->{$field}); }
function addMedia($key, $media) { if ($media != '') { $result = new StdClass(); $media = json_decode($media); $m = org_glizycms_mediaArchive_MediaManager::getMediaById($media->id); if ($m == null) { return null; } $result->type = $m->type; $result->title = $media->title; $media->type = $m->type; if ($result->type == 'VIDEO') { $result->url = GLZ_HOST . '/' . org_glizy_helpers_Media::getFileUrlById($media->id, true); } else { $result->fileName = $media->fileName; $this->medias[$media->id] = $media->fileName; } if ($key) { $this->json[$key][$media->id] = $result; } } return $result; }