本文整理汇总了PHP中EB::media方法的典型用法代码示例。如果您正苦于以下问题:PHP EB::media方法的具体用法?PHP EB::media怎么用?PHP EB::media使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EB
的用法示例。
在下文中一共展示了EB::media方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHtml
/**
* 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;
}
示例2: defined
<?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>
示例3: process
/**
* 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;
}
示例4: getHtml
/**
* 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;
}
示例5: defined
<?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>
示例6: processUploadedVideos
/**
* 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;
}