瀏覽代碼

new contentelement 'video' (and 'audio')

master
Dominik Schmidt-Philipp 4 天之前
父節點
當前提交
f513aab8fb
共有 1 個文件被更改,包括 76 次插入5 次删除
  1. +76
    -5
      app/modules/elementdispatcher.php

+ 76
- 5
app/modules/elementdispatcher.php 查看文件

@@ -363,16 +363,16 @@ class ElementDispatcher {

case 'header':
array_shift($request);
$conf = array('path', $this->folder);
$v = $this->read_config();
$conf = array('path' => $this->folder);
//$v = $this->read_config();
switch (array_shift($request)) {
case 'event':
$el = new CEvent($v,$conf);
$el = new CEvent($this->config,$conf);
$el->set_layout('archive');
$new = $el;
break;
case 'concert':
$el = new CConcert($v,$conf);
$el = new CConcert($this->config,$conf);
$el->set_layout('header');
$new = $el;
break;
@@ -534,7 +534,78 @@ class ElementDispatcher {
implode("\n",$fff->content['default']));
break;

case 'audio':
case 'video':
$video = $request[1];
$style = $request[2];

$a = explode("/", $video);
$full_name = array_pop($a);
$b = explode('.',$full_name);
$ext = array_pop($b);
$name = implode('.', $b);

foreach($this->structs as $domain=>$destination) {
if(array_key_exists($name, $this->structs[$domain]['pic'])) {
$image = $this->structs[$domain]['pic'][$name];
unset($this->structs[$domain]['pic'][$name]);
unset($this->content[$this->domains[$domain]][$name."10image"]);

break;
}
}
$image2 = "/".$image;
foreach(['png','PNG','jpg','JPG','jpeg','JPEG'] as $picext) {
$candidate=$this->folder.implode("/",$a)."/".$name.".".$picext;
if (is_file($candidate)) {
$image2 = $candidate;
break;
}
}

$cached = new CachedImage($image);
$cached2 = new CachedImage($image2);

foreach ($body as $k=>$line) {
if (strpos($line,"©") !== FALSE
|| strpos($line,"©") !== FALSE) {
$body[$k] = sprintf("<span class=\"copyright\">%s</span>",$line);
}
}

$ratio=false;
if ($request[0] == 'audio') {
$asd = new \Image($image2);
if ($asd) {
$ratio=sprintf("%s:%s",$asd->width(),$asd->height());
unset($asd);
}
}

$vid = new \Modules\CVideo([
'TARGET'=>$video,
'STILL'=>$cached,
'STILL2' => $cached2->get_src(1400),
'NAME' =>$name,
'CAPTION' => $md->text(implode("\n",$body)),
'STYLE' => $style,
'RATIO' => $ratio
],['path'=>"/".$this->folder]);

if ($request[0] == 'audio') {
$vid->set_layout('audio');
} else {
$vid->set_layout('lightbox');
}



$new = sprintf("%s",
$vid
);
break;

case 'youtube':
array_shift($request);
$vid=array_shift($request);

Loading…
取消
儲存