what-did-they-say/classes/WDTSLanguageOptions.php

45 lines
1.2 KiB
PHP
Raw Normal View History

2009-08-09 16:39:52 +00:00
<?php
2009-09-06 15:04:38 +00:00
class WDTSLanguageOptions {
2009-08-19 23:58:24 +00:00
/**
* Get the default transcript language for this blog.
* @return string The language code representing the default language.
*/
2009-08-16 18:14:07 +00:00
function get_default_language() {
$language = false;
$options = get_option('what-did-they-say-options');
foreach ($options['languages'] as $code => $info) {
if (is_null($language)) { $language = $code; }
if ($info['default']) { $language = $code; break; }
}
return $language;
}
2009-08-19 23:58:24 +00:00
/**
* Get the name of a language from the language code.
* @param string $language The language code to search for.
* @return string|false The name of the language as defined in the options, or false if the language was not found.
*/
2009-08-16 18:14:07 +00:00
function get_language_name($language) {
$options = get_option('what-did-they-say-options');
if (isset($options['languages'][$language])) {
return $options['languages'][$language]['name'];
} else {
return false;
}
}
2009-08-19 23:58:24 +00:00
/**
* Get all available languages.
* @return array An array of languages.
*/
2009-08-16 20:54:11 +00:00
function get_languages() {
$options = get_option('what-did-they-say-options');
return $options['languages'];
}
2009-08-09 16:39:52 +00:00
}
?>