/** * Standard method to format the output for displaying purposes * * @since 4.0 * @access public * @param string * @return */ public function getHtml($block, $textOnly = false) { // We don't want to display anything here. if ($textOnly) { return; } $uid = uniqid(); if (!isset($block->data->url) || !$block->data->url) { return; } $options = (array) $block->data; $output = EB::media()->renderAudioPlayer($block->data->url, $options); return $output; }
<?php /** * @package EasyBlog * @copyright Copyright (C) 2010 - 2015 Stack Ideas Sdn Bhd. All rights reserved. * @license GNU/GPL, see LICENSE.php * EasyBlog is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ defined('_JEXEC') or die('Unauthorized Access'); ?> <div class="ebd-block is-standalone is-nested" data-type="video"> <div class="ebd-block-viewport" data-ebd-block-viewport> <div class="ebd-block-content" data-ebd-block-content> <?php echo EB::media()->renderVideoPlayer($file->uri); ?> </div> </div> </div>
/** * Processes the audio tags on the content for legacy posts * * @since 5.0 * @access public * @param string * @return */ public function process($contents) { $pattern = '/\\[embed=audio\\](.*)\\[\\/embed\\]/uiU'; preg_match_all($pattern, $contents, $matches, PREG_SET_ORDER); if (empty($matches)) { return $contents; } // Get the config library $config = EB::config(); foreach ($matches as $match) { list($text, $json) = $match; // Convert the json string into an object $audio = json_decode($json); if (!$audio) { $contents = JString::str_ireplace($text, '', $contents); continue; } // New EasyBlog 5 format if (isset($audio->uri)) { $uri = $audio->uri; } else { // Generate a new uri for the new audio player $uri = $audio->place . $audio->file; } $autostart = isset($audio->autostart) && $audio->autostart ? true : false; $options = array('autoplay' => $autostart); $player = EB::media()->renderAudioPlayer($uri, $options); // Alter the contents of the file $contents = JString::str_ireplace($text, $player, $contents); } return $contents; }
/** * Displays the html output for a video block * * @since 5.0 * @access public * @param string * @return */ public function getHtml($block, $textOnly = false) { if ($textOnly) { return; } // Ensure that we have the url of the video otherwise we wouldn't know how to display the video if (!isset($block->data->url) || !$block->data->url) { return; } $options = (array) $block->data; $output = EB::media()->renderVideoPlayer($block->data->url, $options); return $output; }
<?php /** * @package EasyBlog * @copyright Copyright (C) 2010 - 2015 Stack Ideas Sdn Bhd. All rights reserved. * @license GNU/GPL, see LICENSE.php * EasyBlog is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ defined('_JEXEC') or die('Unauthorized Access'); ?> <div class="ebd-block is-standalone" data-type="audio"> <div class="ebd-block-viewport" data-ebd-block-viewport> <div class="ebd-block-content" data-ebd-block-content> <?php echo EB::media()->renderAudioPlayer($file->uri); ?> </div> </div> </div>
/** * Search and replace videos that are uploaded to the site. * * @since 5.0 * @access public * @param string * @return */ public function processUploadedVideos($content, $isPlain = false, $findText = '', $result = '') { $cfg = EB::config(); // Since 3.0 uses a different video format, we need to do some tests here. if ($result) { $data = json_decode($result); // New EasyBlog 5 legacy codes if (isset($data->uri)) { $mm = EB::mediamanager(); $file = $mm->getFile($data->uri); $url = $file->url; } else { // This is the video codes used on EB3.9 or older $file = trim($data->file, '/\\'); $place = $data->place; if ($place == 'shared') { $url = rtrim(JURI::root(), '/') . '/' . trim(str_ireplace('\\', '/', $cfg->get('main_shared_path')), '/\\') . '/' . $file; } else { $place = explode(':', $place); $url = rtrim(JURI::root(), '/') . '/' . trim($cfg->get('main_image_path'), '/\\') . '/' . $place[1] . '/' . $file; } } $options = array(); $options['width'] = $data->width; $options['height'] = $data->height; $options['autostart'] = isset($data->autostart) ? $data->autostart : false; $player = EB::media()->renderVideoPlayer($url, $options); $content = str_ireplace($findText, $player, $content); return $content; } return $content; }