function get($option) { switch ($option) { case 'application_id': return bb_get_option('site_id'); break; case 'application_uri': return bb_get_uri(null, null, BB_URI_CONTEXT_NONE); break; case 'cron_uri': return bb_get_uri('bb-cron.php', array('check' => BP_Options::get('cron_check')), BB_URI_CONTEXT_nxt_HTTP_REQUEST); break; case 'nxt_http_version': return 'bbPress/' . bb_get_option('version'); break; case 'hash_function_name': return 'bb_hash'; break; case 'language_locale': return bb_get_locale(); break; case 'language_directory': return BB_LANG_DIR; break; case 'charset': case 'gmt_offset': case 'timezone_string': return bb_get_option($option); break; default: return bb_get_option(BP_Options::prefix() . $option); break; } }
/** * Returns the requested bbPress option from the meta table or the $bb object * * @param string The option to be echoed * @return mixed The value of the option */ function bb_get_option($option) { // Allow plugins to short-circuit options. if (false !== ($r = apply_filters('bb_pre_get_option_' . $option, false, $option))) { return $r; } global $bb; switch ($option) { case 'site_id': if (isset($bb->site_id) && is_numeric($bb->site_id)) { $r = (int) $bb->site_id; } else { $r = 1; } break; case 'language': $r = str_replace('_', '-', bb_get_locale()); break; case 'text_direction': global $bb_locale; $r = $bb_locale->text_direction; break; case 'version': return '1.1'; // Don't filter break; case 'bb_db_version': return '2471'; // Don't filter break; case 'html_type': $r = 'text/html'; break; case 'charset': $r = 'UTF-8'; break; case 'bb_table_prefix': case 'table_prefix': global $bbdb; return $bbdb->prefix; // Don't filter; break; case 'url': $option = 'uri'; default: if (isset($bb->{$option})) { $r = $bb->{$option}; if ($option === 'mod_rewrite') { if (is_bool($r)) { $r = (int) $r; } } break; } $r = bb_get_option_from_db($option); if (!$r) { switch ($option) { case 'name': $r = __('Please give me a name!'); break; case 'nxt_table_prefix': global $nxt_table_prefix; // This global is deprecated return $nxt_table_prefix; // Don't filter; break; case 'mod_rewrite': $r = 0; break; case 'page_topics': $r = 30; break; case 'edit_lock': $r = 60; break; case 'gmt_offset': $r = 0; break; case 'uri_ssl': $r = preg_replace('|^http://|i', 'https://', bb_get_option('uri')); break; case 'throttle_time': $r = 30; break; case 'email_login': $r = false; break; } } break; } return apply_filters('bb_get_option_' . $option, $r, $option); }
/** * Imports global locale vars set during inclusion of $locale.php. * * @access private */ function _load_locale_data() { $locale = bb_get_locale(); $locale_file = BB_LANG_DIR . $locale . '.php'; if (!is_file($locale_file)) { return; } include $locale_file; foreach ($this->locale_vars as $var) { $this->{$var} = ${$var}; } }
/** * Loads the theme's translated strings. * * If the current locale exists as a .mo file in the theme's root directory, it * will be included in the translated strings by the $domain. * * The .mo files must be named based on the locale exactly. * * @since 0.7.2 * * @param string $domain Unique identifier for retrieving translated strings */ function bb_load_theme_textdomain($domain, $path = false) { $locale = bb_get_locale(); $mofile = empty($path) ? bb_get_template($locale . '.mo') : "{$path}/{$locale}.mo"; load_textdomain($domain, $mofile); }