mirror of
https://github.com/e107inc/e107.git
synced 2025-08-21 21:57:34 +02:00
Fix for media-browser carousel issue. Fix for bbcode Youtube insert. Added [video] bbcode.
This commit is contained in:
41
e107_core/bbcodes/bb_video.php
Normal file
41
e107_core/bbcodes/bb_video.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* DIV block bbcode
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
// This is a generic and 'responsive' video bbcode. Handles Youtube and eventually html5 video tags.
|
||||
|
||||
class bb_video extends e_bb_base
|
||||
{
|
||||
/**
|
||||
* Called prior to save
|
||||
* Re-assemble the bbcode
|
||||
*/
|
||||
function toDB($code_text, $parm)
|
||||
{
|
||||
return '[video]'.$code_text.'[/video]';
|
||||
}
|
||||
|
||||
/**
|
||||
* Video tag.
|
||||
* @param $code_text : xxxxxxx.youtube or xxxxxxx.mp4
|
||||
*/
|
||||
function toHTML($code_text, $parm='')
|
||||
{
|
||||
return e107::getParser()->toVideo($code_text);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
@@ -124,11 +124,22 @@ class bbcode_shortcodes extends e_shortcode
|
||||
|
||||
function bb_youtube($id)
|
||||
{
|
||||
if($this->var['tagid'] == 'data_') // BC work-around for duplicate IDs.
|
||||
{
|
||||
$tag = "data";
|
||||
}
|
||||
else
|
||||
{
|
||||
list($tag,$tmp) = explode("--",$this->var['tagid']); // works with $frm->bbarea to detect textarea from first half of tag.
|
||||
}
|
||||
|
||||
|
||||
|
||||
$data = "[youtube]*[/youtube]";
|
||||
$event = $this->getEvent('addinput',$data,LANHELP_48);
|
||||
$text = "<a {$event} class='btn ' id='{$id}' data-function='input' href='#{$this->var['tagid']}' title='".$this->br2nl(LANHELP_48)."' data-bbcode='{$data}'>";
|
||||
// $text = "<a {$event} class='btn ' id='{$id}' data-function='input' href='#{$this->var['tagid']}' title='".$this->br2nl(LANHELP_48)."' data-bbcode='{$data}'>";
|
||||
// $text .="<img class='btn btn-small bbcode bbcode_buttons e-pointer' src='".e_IMAGE_ABS."bbcode/youtube.png' alt='' title='".nl2br(LANHELP_48)."' />";
|
||||
|
||||
$text = "<a class='e-modal btn' data-modal-caption='Media Manager' data-target='#uiModal' title='Media Manager : ".$this->var['template']."' id='{$id}' href='".e_ADMIN."image.php?mode=main&action=dialog&for=".$this->var['template']."&tagid=".$tag."&iframe=1&bbcode=video' >";
|
||||
$text .= $this->button(e_IMAGE_ABS."bbcode/youtube.png", 'youtube', LANHELP_48);
|
||||
|
||||
$text .= "</a>";
|
||||
|
@@ -29,10 +29,17 @@ class news_shortcodes extends e_shortcode
|
||||
protected $e107;
|
||||
//protected $param; - shouldn't be set - see __set/__get methods of e_shortcode & news::render_newsitem()
|
||||
|
||||
protected $commentsDisabled;
|
||||
|
||||
|
||||
function __construct($eVars = null)
|
||||
{
|
||||
parent::__construct($eVars);
|
||||
$this->e107 = e107::getInstance();
|
||||
|
||||
$pref = e107::getPref();
|
||||
|
||||
$this->commentsDisabled = vartrue($pref['comments_disabled']);
|
||||
}
|
||||
|
||||
function sc_newstitle()
|
||||
@@ -88,11 +95,11 @@ class news_shortcodes extends e_shortcode
|
||||
$pref = e107::getPref();
|
||||
$sql = e107::getDb();
|
||||
|
||||
if($pref['comments_disabled'] == 1)
|
||||
if($this->commentsDisabled)
|
||||
{
|
||||
return "Disabled";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$news_item = $this->news_item;
|
||||
$param = $this->param;
|
||||
|
||||
@@ -192,6 +199,10 @@ class news_shortcodes extends e_shortcode
|
||||
*/
|
||||
function sc_newscommentlink($parm)
|
||||
{
|
||||
if($this->commentsDisabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$class = varset($parm['class']) ? " ".$parm['class'] : "";
|
||||
$text = ($this->news_item['news_allow_comments'] ? $this->param['commentoffstring'] : "<a title='".$this->sc_newscommentcount()." comments' class='e-tip".$class."' href='".e107::getUrl()->create('news/view/item', $this->news_item)."'>".$this->param['commentlink'].'</a>');
|
||||
@@ -203,6 +214,11 @@ class news_shortcodes extends e_shortcode
|
||||
*/
|
||||
function sc_newscommentcount($parm)
|
||||
{
|
||||
if($this->commentsDisabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$text = varset($parm['glyph']) ? e107::getParser()->toGlyph($parm['glyph']) : "";
|
||||
$text .= $this->news_item['news_comment_total'];
|
||||
return $text;
|
||||
|
Reference in New Issue
Block a user