Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
17954bb5
Commit
17954bb5
authored
11 years ago
by
Anika Henke
Browse files
Options
Downloads
Patches
Plain Diff
added title to video/audio tags, use title for fallback links, refactored duplicate code
parent
221cb665
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
inc/parser/xhtml.php
+16
-35
16 additions, 35 deletions
inc/parser/xhtml.php
with
16 additions
and
35 deletions
inc/parser/xhtml.php
+
16
−
35
View file @
17954bb5
...
...
@@ -1096,48 +1096,30 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
$ret
.
=
' />'
;
}
elseif
(
media_supportedav
(
$mime
,
'video'
)){
}
elseif
(
media_supportedav
(
$mime
,
'video'
)
||
media_supportedav
(
$mime
,
'audio'
)
){
// first get the $title
if
(
!
is_null
(
$title
))
{
$title
=
$this
->
_xmlEntities
(
$title
);
}
if
(
!
$title
)
{
// just show the sourcename
$title
=
$this
->
_xmlEntities
(
utf8_basename
(
noNS
(
$src
)));
}
$title
=
!
is_null
(
$title
)
?
$this
->
_xmlEntities
(
$title
)
:
false
;
if
(
!
$render
)
{
// if the
video
is not supposed to be rendered
// return the title of the
video
return
$title
;
// if the
file
is not supposed to be rendered
// return the title of the
file (just the sourcename if there is no title)
return
$title
?
$title
:
$this
->
_xmlEntities
(
utf8_basename
(
noNS
(
$src
)))
;
}
$att
=
array
();
$att
[
'class'
]
=
"media
$align
"
;
//add video(s)
$ret
.
=
$this
->
_video
(
$src
,
$width
,
$height
,
$att
);
}
elseif
(
media_supportedav
(
$mime
,
'audio'
)){
// first get the $title
if
(
!
is_null
(
$title
))
{
$title
=
$this
->
_xmlEntities
(
$title
);
if
(
$title
)
{
$att
[
'title'
]
=
$title
;
}
if
(
!
$title
)
{
// just show the sourcename
$title
=
$this
->
_xmlEntities
(
utf8_basename
(
noNS
(
$src
)));
if
(
media_supportedav
(
$mime
,
'video'
))
{
//add video
$ret
.
=
$this
->
_video
(
$src
,
$width
,
$height
,
$att
);
}
if
(
!
$render
)
{
// if the video is not supposed to be rendered
// return the title of the video
return
$title
;
if
(
media_supportedav
(
$mime
,
'audio'
))
{
//add audio
$ret
.
=
$this
->
_audio
(
$src
,
$att
);
}
$att
=
array
();
$att
[
'class'
]
=
"media
$align
"
;
//add audio
$ret
.
=
$this
->
_audio
(
$src
,
$att
);
}
elseif
(
$mime
==
'application/x-shockwave-flash'
){
if
(
!
$render
)
{
// if the flash is not supposed to be rendered
...
...
@@ -1282,7 +1264,6 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @return string
*/
function
_video
(
$src
,
$width
,
$height
,
$atts
=
null
){
// prepare width and height
if
(
is_null
(
$atts
))
$atts
=
array
();
$atts
[
'width'
]
=
(
int
)
$width
;
...
...
@@ -1309,7 +1290,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
// output source for each alternative video format
foreach
(
$alternatives
as
$mime
=>
$file
)
{
$url
=
ml
(
$file
,
array
(
'cache'
=>
$cache
),
true
,
'&'
);
$title
=
$this
->
_xmlEntities
(
utf8_basename
(
noNS
(
$file
)));
$title
=
$atts
[
'title'
]
?
$atts
[
'title'
]
:
$this
->
_xmlEntities
(
utf8_basename
(
noNS
(
$file
)));
$out
.
=
'<source src="'
.
hsc
(
$url
)
.
'" type="'
.
$mime
.
'" />'
.
NL
;
// alternative content (just a link to the file)
...
...
@@ -1345,7 +1326,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
// output source for each alternative audio format
foreach
(
$alternatives
as
$mime
=>
$file
)
{
$url
=
ml
(
$file
,
array
(
'cache'
=>
$cache
),
true
,
'&'
);
$title
=
$this
->
_xmlEntities
(
utf8_basename
(
noNS
(
$file
)));
$title
=
$atts
[
'title'
]
?
$atts
[
'title'
]
:
$this
->
_xmlEntities
(
utf8_basename
(
noNS
(
$file
)));
$out
.
=
'<source src="'
.
hsc
(
$url
)
.
'" type="'
.
$mime
.
'" />'
.
NL
;
// alternative content (just a link to the file)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment