function delete_entity() { $media_work = new entity($this->get_value('id')); $shim = MediaWorkFactory::shim($media_work); if ($shim) { $shim->delete_media_work($this); } parent::delete_entity(); }
/** * run the rewrite rules */ function run() { $user = new entity($this->vars['user_id']); $media_work = new entity($this->vars['id']); $shim = MediaWorkFactory::shim($media_work); if ($shim) { $shim->finish_actions($media_work, $user); } }
function init($args = array()) { if ($this->params['integration_library'] && in_array($this->params['integration_library'], $GLOBALS['UPLOADABLE_MEDIA_WORK_INTEGRATION_LIBRARIES'])) { $this->_integration_library = $this->params['integration_library']; $this->get_head_items()->add_javascript(REASON_HTTP_BASE_PATH . 'modules/media_import/media_import.js'); $this->get_head_items()->add_stylesheet(REASON_HTTP_BASE_PATH . 'modules/media_import/media_import.css'); $this->shim = MediaWorkFactory::shim($this->_integration_library); } force_secure_if_available(); parent::init($args); }
function init() { $this->admin_page->title = 'Batch Import Media'; if (array_key_exists('integration_library', $this->admin_page->request) && $this->admin_page->request['integration_library']) { if (in_array($this->admin_page->request['integration_library'], $GLOBALS['NEW_MEDIA_WORK_INTEGRATION_LIBRARIES'])) { $this->integration_library = $this->admin_page->request['integration_library']; $this->shim = MediaWorkFactory::shim($this->integration_library); } else { $this->integration_library = 'invalid_library'; } } elseif (count($GLOBALS['NEW_MEDIA_WORK_INTEGRATION_LIBRARIES']) == 1) { $this->integration_library = current($GLOBALS['NEW_MEDIA_WORK_INTEGRATION_LIBRARIES']); $this->shim = MediaWorkFactory::shim($this->integration_library); } }
function init() { parent::init(); $this->admin_page->title = 'Select Thumbnail for Media Work'; $this->media_work = new entity($this->admin_page->id); $this->user = new entity($this->admin_page->user_id); // Grab the initial associated image, if it exists $es = new entity_selector(); $es->add_type(id_of('image')); $es->add_right_relationship($this->media_work->id(), relationship_id_of('av_to_primary_image')); $this->cur_image = current($es->run_one()); $this->admin_page->head_items->add_javascript(JQUERY_URL, true); $this->admin_page->head_items->add_javascript(WEB_JAVASCRIPT_PATH . 'media_image_picker_zencoder.js'); // fd-slider is a polyfill for the range plasmature type $this->admin_page->head_items->add_javascript(REASON_PACKAGE_HTTP_BASE_PATH . 'fd-slider/js/fd-slider.js'); $this->admin_page->head_items->add_stylesheet(REASON_PACKAGE_HTTP_BASE_PATH . 'fd-slider/css/fd-slider.css'); $this->shim = MediaWorkFactory::shim($this->media_work); }
# Grab the media_work's associated group if it has one $es = new entity_selector(); $es->add_type(id_of('group_type')); $es->add_right_relationship($media_work->id(), relationship_id_of('av_restricted_to_group')); $group = current($es->run_one()); $extension = $media_file->get_value('av_type') == 'Video' ? 'mp4' : 'mp3'; # If the user doesn't have access to the media work, header to the "No Access" url $mwh = new media_work_helper($media_work); if (!$mwh->user_has_access_to_media()) { $username = reason_require_http_authentication(); if (!$mwh->user_has_access_to_media($username)) { // header to the access denied media header('Location: http://' . HTTP_HOST_NAME . REASON_HTTP_BASE_PATH . 'modules/av/no_access_message.' . $extension); die; } } # If we make it here, the podcast is safe to provide $file_url = $media_file->get_value('url'); // ask the shim if we need to do a url hack to allow iTunes to import the file $shim = MediaWorkFactory::shim($media_work); if ($shim) { if ($shim->requires_extension_for_podcast()) { $extra_extension = '/a.' . $extension; } else { $extra_extension = ''; } } else { http_response_code(404); die; } header('Location: ' . $file_url . $extra_extension . '?novar=0');
function get_media_file_url($item) { $media_work = new entity($item->get_value('work_id')); $shim = MediaWorkFactory::shim($media_work->get_value('integration_library')); if ($shim) { return $shim->get_media_file_url($item, $media_work); } return false; }