Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
marcus-lodspeakr
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
uib-ub
Spesialsamlingene
marcus-lodspeakr
Commits
0797ab48
Commit
0797ab48
authored
12 years ago
by
alvaro
Browse files
Options
Downloads
Patches
Plain Diff
Fixing rdfs:Resource template
Adding better content-type based on file extension for static module.
parent
393e0ab0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
classes/modules/staticModule.php
+30
-2
30 additions, 2 deletions
classes/modules/staticModule.php
doc/examples/originalComponents/types/rdfs:Resource/html.template
+0
-2
0 additions, 2 deletions
...ples/originalComponents/types/rdfs:Resource/html.template
with
30 additions
and
4 deletions
classes/modules/staticModule.php
+
30
−
2
View file @
0797ab48
...
@@ -25,8 +25,9 @@ class StaticModule extends abstractModule{
...
@@ -25,8 +25,9 @@ class StaticModule extends abstractModule{
global
$acceptContentType
;
global
$acceptContentType
;
global
$endpoints
;
global
$endpoints
;
global
$lodspk
;
global
$lodspk
;
$extension
=
array_pop
(
explode
(
"."
,
$file
));
header
(
"Content-type: "
);
$ct
=
$this
->
getContentType
(
$extension
);
header
(
"Content-type: "
.
$ct
);
$uri
=
$localUri
;
$uri
=
$localUri
;
if
(
$conf
[
'debug'
]){
if
(
$conf
[
'debug'
]){
echo
"
\n
-------------------------------------------------
\n
In "
.
$conf
[
'static'
][
'directory'
]
.
"
\n
"
;
echo
"
\n
-------------------------------------------------
\n
In "
.
$conf
[
'static'
][
'directory'
]
.
"
\n
"
;
...
@@ -55,6 +56,33 @@ class StaticModule extends abstractModule{
...
@@ -55,6 +56,33 @@ class StaticModule extends abstractModule{
}
}
}
}
private
function
getContentType
(
$e
){
$contentTypes
=
array
(
'html'
=>
'text/html'
,
'css'
=>
'text/css'
,
'js'
=>
'application/javascript'
,
'json'
=>
'application/json'
,
'nt'
=>
'text/plain'
,
'ttl'
=>
'text/turtle'
,
'png'
=>
'image/png'
,
'jpg'
=>
'image/jpeg'
,
'gif'
=>
'image/gif'
,
'bmp'
=>
'image/bmp'
,
'pdf'
=>
'application/pdf'
,
'zip'
=>
'application/zip'
,
'gz'
=>
'application/gzip'
);
//Add new/override existing mime types defined by user
foreach
(
$conf
[
'static'
][
'mimetypes'
]
as
$k
=>
$v
){
$contentTypes
[
$k
]
=
$v
;
}
if
(
isset
(
$contentTypes
[
$e
])){
return
$contentTypes
[
$e
];
}
return
""
;
//empty string seems to work fine with browsers
}
}
}
...
...
This diff is collapsed.
Click to expand it.
doc/examples/originalComponents/types/rdfs:Resource/html.template
+
0
−
2
View file @
0797ab48
...
@@ -83,8 +83,6 @@
...
@@ -83,8 +83,6 @@
<td>
<td>
{%if row.o.uri == 1%}
{%if row.o.uri == 1%}
<a
rel=
'{{row.p.value}}'
href=
'{{row.o.value}}'
>
{{row.o.curie}}
</a>
<a
rel=
'{{row.p.value}}'
href=
'{{row.o.value}}'
>
{{row.o.curie}}
</a>
{%elif row.o.blank == 1%}
<a
rel=
'{{row.p.value}}'
href=
'{{row.o.value}}'
>
{{row.o.curie}}
</a>
{%else%}
{%else%}
<span
property=
'{{row.p.value}}'
>
{{row.o.value}}
</span>
<span
property=
'{{row.p.value}}'
>
{{row.o.value}}
</span>
{%endif%}
{%endif%}
...
...
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