Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
22e2f0c1
Commit
22e2f0c1
authored
Nov 14, 2006
by
Richard Mansfield
Browse files
get_languages,get_themes added
parent
27a3550b
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/mahara.php
View file @
22e2f0c1
...
...
@@ -252,6 +252,50 @@ function get_string_location($identifier, $section, $variables, $replacefunc='fo
}
/**
* Return a list of available languages
*
*/
function
get_languages
()
{
$langs
=
array
();
$langbase
=
get_config
(
'docroot'
)
.
'lang/'
;
if
(
!
$langdir
=
opendir
(
$langbase
))
{
throw
new
Exception
(
'Unable to read language directory '
.
$langbase
);
}
while
(
false
!==
(
$subdir
=
readdir
(
$langdir
)))
{
$langfile
=
$langbase
.
$subdir
.
'/langconfig.php'
;
if
(
$subdir
!=
"."
&&
$subdir
!=
".."
&&
is_readable
(
$langfile
))
{
if
(
$langname
=
get_string_from_file
(
'thislanguage'
,
$langfile
))
{
$langs
[
$subdir
]
=
$langname
;
}
}
}
closedir
(
$langdir
);
return
$langs
;
}
/**
* Return a list of available themes
* Need to add the theme names sometime; for now use get_string().
*
*/
function
get_themes
()
{
$themes
=
array
();
$themebase
=
get_config
(
'docroot'
)
.
'theme/'
;
if
(
!
$themedir
=
opendir
(
$themebase
))
{
throw
new
Exception
(
'Unable to read theme directory '
.
$themebase
);
}
while
(
false
!==
(
$subdir
=
readdir
(
$themedir
)))
{
// Where do we get theme names from?
if
(
$subdir
!=
"."
&&
$subdir
!=
".."
)
{
$themes
[
$subdir
]
=
get_string
(
$subdir
);
}
}
closedir
(
$themedir
);
return
$themes
;
}
/**
* This function is only used from {@link get_string()}.
*
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment