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
b2fd9882
Commit
b2fd9882
authored
12 years ago
by
Andreas Gohr
Browse files
Options
Downloads
Plain Diff
Merge pull request #134 from splitbrain/local-style-ini
added support for local style.ini files
parents
9f88c3ad
f809ae7b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
lib/exe/css.php
+32
-6
32 additions, 6 deletions
lib/exe/css.php
lib/tpl/default/style.ini
+5
-0
5 additions, 0 deletions
lib/tpl/default/style.ini
lib/tpl/dokuwiki/style.ini
+5
-0
5 additions, 0 deletions
lib/tpl/dokuwiki/style.ini
lib/tpl/index.php
+6
-2
6 additions, 2 deletions
lib/tpl/index.php
with
48 additions
and
8 deletions
lib/exe/css.php
+
32
−
6
View file @
b2fd9882
...
...
@@ -49,14 +49,16 @@ function css_out(){
$tpldir
=
tpl_basedir
();
}
// used style.ini file
$styleini
=
css_styleini
(
$tplinc
);
// The generated script depends on some dynamic options
$cache
=
new
cache
(
'styles'
.
$_SERVER
[
'HTTP_HOST'
]
.
$_SERVER
[
'SERVER_PORT'
]
.
DOKU_BASE
.
$tplinc
.
$type
,
'.css'
);
// load template styles
$tplstyles
=
array
();
if
(
@
file_exists
(
$tplinc
.
'style.ini'
)){
$ini
=
parse_ini_file
(
$tplinc
.
'style.ini'
,
true
);
foreach
(
$ini
[
'stylesheets'
]
as
$file
=>
$mode
){
if
(
$styleini
)
{
foreach
(
$styleini
[
'stylesheets'
]
as
$file
=>
$mode
)
{
$tplstyles
[
$mode
][
$tplinc
.
$file
]
=
$tpldir
;
}
}
...
...
@@ -72,6 +74,7 @@ function css_out(){
$cache_files
=
getConfigFiles
(
'main'
);
$cache_files
[]
=
$tplinc
.
'style.ini'
;
$cache_files
[]
=
$tplinc
.
'style.local.ini'
;
$cache_files
[]
=
__FILE__
;
foreach
(
$mediatypes
as
$mediatype
)
{
...
...
@@ -173,13 +176,36 @@ function css_out(){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function
css_applystyle
(
$css
,
$tplinc
){
if
(
@
file_exists
(
$tplinc
.
'style.ini'
)){
$ini
=
parse_ini_file
(
$tplinc
.
'style.ini'
,
true
);
$css
=
strtr
(
$css
,
$ini
[
'replacements'
]);
$styleini
=
css_styleini
(
$tplinc
);
if
(
$styleini
){
$css
=
strtr
(
$css
,
$styleini
[
'replacements'
]);
}
return
$css
;
}
/**
* Get contents of merged style.ini and style.local.ini as an array.
*
* @author Anika Henke <anika@selfthinker.org>
*/
function
css_styleini
(
$tplinc
)
{
$styleini
=
array
();
foreach
(
array
(
$tplinc
.
'style.ini'
,
$tplinc
.
'style.local.ini'
)
as
$ini
)
{
$tmp
=
(
@
file_exists
(
$ini
))
?
parse_ini_file
(
$ini
,
true
)
:
array
();
foreach
(
$tmp
as
$key
=>
$value
)
{
if
(
array_key_exists
(
$key
,
$styleini
)
&&
is_array
(
$value
))
{
$styleini
[
$key
]
=
array_merge
(
$styleini
[
$key
],
$tmp
[
$key
]);
}
else
{
$styleini
[
$key
]
=
$value
;
}
}
}
return
$styleini
;
}
/**
* Prints classes for interwikilinks
*
...
...
This diff is collapsed.
Click to expand it.
lib/tpl/default/style.ini
+
5
−
0
View file @
b2fd9882
; Please see http://www.php.net/manual/en/function.parse-ini-file.php
; for limitations of the ini format used here
; To extend this file or make changes to it, it is recommended to create
; a style.local.ini file to prevent losing any changes after an upgrade.
; Please don't forgot to copy the section your changes should be under
; (i.e. [stylesheets] or [replacements]) into that file as well.
; Define the stylesheets your template uses here. The second value
; defines for which output media the style should be loaded. Currently
; print, screen and rtl are supported. rtl styles are loaded additionally
...
...
This diff is collapsed.
Click to expand it.
lib/tpl/dokuwiki/style.ini
+
5
−
0
View file @
b2fd9882
; Please see http://www.php.net/manual/en/function.parse-ini-file.php
; for limitations of the ini format used here
; To extend this file or make changes to it, it is recommended to create
; a style.local.ini file to prevent losing any changes after an upgrade.
; Please don't forgot to copy the section your changes should be under
; (i.e. [stylesheets] or [replacements]) into that file as well.
; Define the stylesheets your template uses here. The second value
; defines for which output media the style should be loaded. Currently
; print, screen and all are supported.
...
...
This diff is collapsed.
Click to expand it.
lib/tpl/index.php
+
6
−
2
View file @
b2fd9882
...
...
@@ -43,7 +43,11 @@ require_once(DOKU_INC.'inc/init.php');
</head>
<body>
<?php
$ini
=
@
parse_ini_file
(
$conf
[
'template'
]
.
'/style.ini'
,
true
);
// get merged style.ini
define
(
'SIMPLE_TEST'
,
true
);
// hack to prevent css output and headers
require_once
(
DOKU_INC
.
'lib/exe/css.php'
);
$ini
=
css_styleini
(
tpl_incdir
());
if
(
$ini
)
{
echo
'<table>'
;
echo
"<caption>"
.
htmlspecialchars
(
$conf
[
'template'
])
.
"'s style.ini</caption>"
;
...
...
@@ -60,7 +64,7 @@ if ($ini) {
}
echo
'</table>'
;
}
else
{
echo
"<p>Non-existent
template
: <strong>"
.
htmlspecialchars
(
$conf
[
'template'
])
.
"</strong></p>"
;
echo
"<p>Non-existent
or invalid template or style.ini
: <strong>"
.
htmlspecialchars
(
$conf
[
'template'
])
.
"</strong></p>"
;
}
?>
</body>
...
...
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