本文整理汇总了PHP中bb_get_option函数的典型用法代码示例。如果您正苦于以下问题:PHP bb_get_option函数的具体用法?PHP bb_get_option怎么用?PHP bb_get_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bb_get_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bb_language_switcher
function bb_language_switcher($ignore = '')
{
// builds and displays the language dropdown UI
global $bb_language_switcher;
$output = "";
$current = bb_language_switcher_filter();
if (empty($bb_language_switcher)) {
$bb_language_switcher = bb_get_option('bb_language_switcher');
}
if (empty($current) && defined('BB_LANG')) {
$bblang = BB_LANG;
if (!empty($bblang)) {
$current = $bblang;
}
}
$output .= '<form id="bb_language_switcher" style="display:inline-block;"><select style="width:150px;" name="bb_language_switcher" onchange="location.href=\'' . add_query_arg('bblang', '', remove_query_arg('bblang')) . '=\' + this.options[this.selectedIndex].value;">' . "\n" . "<option value=''>Select...</option>";
foreach ($bb_language_switcher as $value => $description) {
if ($value == $current) {
$selected = '" selected="selected" ';
} else {
$selected = '';
}
if (empty($value) || $value == " ") {
$bk = "style='background:#ECE9D8;color:#000;font-weight:bold;' ";
} else {
$bk = "";
}
// highlight english
$output .= ' <option ' . $bk . 'value="' . $value . '"' . $selected . '> ' . $description . '</option>' . "\n";
// padding mess for cross-browser
}
$output .= "</select></form>\n";
echo $output;
}
示例2: get
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;
}
}
示例3: bb_default_scripts
function bb_default_scripts(&$scripts)
{
$scripts->base_url = bb_get_uri(BB_INC, null, BB_URI_CONTEXT_SCRIPT_SRC);
$scripts->base_url_admin = bb_get_uri('bb-admin/', null, BB_URI_CONTEXT_SCRIPT_SRC + BB_URI_CONTEXT_BB_ADMIN);
$scripts->content_url = '';
// May not work - might need to specify plugin and theme urls
$scripts->default_version = bb_get_option('version');
$scripts->default_dirs = array('/bb-admin/js/', '/bb-includes/js/');
// These are our enqueued scripts
$scripts->add('topic', $scripts->base_url . 'js/topic.js', array('wp-lists'), '20090602');
$scripts->add('profile-edit', $scripts->base_url . 'js/profile-edit.js', array('password-strength-meter'), '20080721');
$scripts->add('admin-forums', $scripts->base_url_admin . 'js/admin-forums.js', array('wp-lists', 'interface'), '20090320');
$scripts->add('utils', $scripts->base_url_admin . 'js/utils.js', false, '20090102');
$scripts->add('common', $scripts->base_url_admin . 'js/common.js', array('jquery', 'hoverIntent', 'utils'), '20090517');
$scripts->add_data('common', 'group', 1);
$scripts->localize('common', 'commonL10n', array('warnDelete' => __("You are about to delete the selected items.\n 'Cancel' to stop, 'OK' to delete."), 'l10n_print_after' => 'try{convertEntities(commonL10n);}catch(e){};'));
$scripts->localize('admin-forums', 'bbSortForumsL10n', array('handleText' => __('drag'), 'saveText' => __('Save Forum Order'), 'editText' => __('Edit Forum Order')));
// These are non-3rd-party libraries
$scripts->add('wp-lists', $scripts->base_url . 'js/wp-lists.js', array('wp-ajax-response', 'jquery-color'), '20080826');
$scripts->localize('wp-lists', 'wpListL10n', array('url' => $scripts->base_url_admin . 'admin-ajax.php'));
$scripts->add('wp-ajax-response', $scripts->base_url . 'js/wp-ajax-response.js', array('jquery'), '20080316');
$scripts->localize('wp-ajax-response', 'wpAjax', array('noPerm' => __('You do not have permission to do that.'), 'broken' => __('An unidentified error has occurred.')));
// jQuery and friends
$scripts->add('jquery', $scripts->base_url . 'js/jquery/jquery.js', false, '1.4.2');
$scripts->add('jquery-color', $scripts->base_url . 'js/jquery/jquery.color.js', array('jquery'), '2.0-4561');
$scripts->add('interface', $scripts->base_url . 'js/jquery/interface.js', array('jquery'), '1.2.3');
$scripts->add('password-strength-meter', $scripts->base_url . 'js/jquery/password-strength-meter.js', array('jquery'), '20070405');
$scripts->localize('password-strength-meter', 'pwsL10n', array('short' => __('Too short'), 'bad' => __('Bad'), 'good' => __('Good'), 'strong' => __('Strong')));
$scripts->add('hoverIntent', $scripts->base_url . 'js/jquery/hoverIntent.js', array('jquery'), '20090102');
$scripts->add_data('hoverIntent', 'group', 1);
}
示例4: get_active_status_renderer_name
function get_active_status_renderer_name()
{
global $status_renderers;
$active = bb_get_option('topic-icons-active-status-renderer');
if (isset($active) && isset($status_renderers[$active])) {
return $active;
}
return 'default';
}
示例5: thanks_get_voting_phrase
function thanks_get_voting_phrase($phrase)
{
global $DEFAULTS;
$msg = bb_get_option($phrase);
if (!isset($msg)) {
$msg = $DEFAULTS[$phrase];
}
return $msg;
}
示例6: bb_get_bozos
function bb_get_bozos($page = 1)
{
global $bbdb, $bb_last_countable_query;
$page = (int) $page;
$limit = (int) bb_get_option('page_topics');
if (1 < $page) {
$limit = $limit * ($page - 1) . ", {$limit}";
}
$bb_last_countable_query = "SELECT user_id FROM {$bbdb->usermeta} WHERE meta_key='is_bozo' AND meta_value='1' ORDER BY umeta_id DESC LIMIT {$limit}";
if ($ids = (array) $bbdb->get_col($bb_last_countable_query)) {
bb_cache_users($ids);
}
return $ids;
}
示例7: notification_new_post
/**
* Plugin Name: Post Notification
* Plugin Description: Sends an Notification email if there's a new post to an favorite topic. (Modified Version 1.4 with Post Content included in E-Mail)
* Author: Thomas Klaiber
* Author URI: http://thomasklaiber.com/
* Plugin URI: http://thomasklaiber.com/bbpress/post-notification/
* Version: 1.4
*/
function notification_new_post($post_id = 0)
{
global $bbdb, $bb_table_prefix, $topic_id, $bb_current_user;
$all_users = notification_select_all_users();
foreach ($all_users as $userdata) {
if (notification_is_activated($userdata->ID)) {
if (is_user_favorite($userdata->ID, $topic_id)) {
//$topic = get_topic($topic_id);
$message = __("Hello,\n\nA new post on \"%1\$s\" has been added by %2\$s at DHAnswers. \n\nMessage:\n\n%3\$s \n\n%4\$s ");
mail($userdata->user_email, '[DHAnswers] New Post for Favorite Question', sprintf($message, get_topic_title($topic_id), get_user_name($bb_current_user->ID), strip_tags(get_post_text($post_id)), get_topic_link($topic_id)), 'From: ' . bb_get_option('name') . ' <' . bb_get_option('from_email') . '>');
}
}
}
}
示例8: mod_notification_new_post
function mod_notification_new_post()
{
global $bbdb, $topic_id, $bb_current_user;
$all_moderators = notification_select_all_mods();
$topic = get_topic($topic_id);
$header = 'From: ' . bb_get_option('name') . ' <' . bb_get_option('from_email') . '>';
$header .= 'MIME-Version: 1.0' . "\n";
$header .= 'Content-Type: text/plain; charset="' . BBDB_CHARSET . '"' . "\n";
$header .= 'Content-Transfer-Encoding: 7bit' . "\n";
$subject = '[DHAnswers] New Post';
foreach ($all_moderators as $userdata) {
if (mod_notification_is_activated($userdata->ID)) {
$msg = "Hello,\n\nA new post has been added to \"" . $topic->topic_title . "\" at DHAnswers. \n\n" . get_topic_link($topic_id);
mail($userdata->user_email, $subject, $msg, $header);
}
}
}
示例9: getStatus
public function getStatus($location, $topic)
{
global $support_forum;
if (isset($topic->topic_resolved) && isset($support_forum)) {
return $this->resolve_support_status($topic->topic_resolved);
}
if ($this->is_closed_topic($topic)) {
return "closed";
}
if ($this->is_sticky_topic($location, $topic)) {
return "sticky";
}
$enabled = bb_get_option('support_forum_enabled');
if (in_array($topic->forum_id, $enabled) && isset($support_forum)) {
return $this->resolve_support_status(bb_get_option('support_forum_default_status'));
}
return "normal";
}
示例10: bb_language_switcher_debug
function bb_language_switcher_debug()
{
if (!bb_current_user_can('administrate')) {
return;
}
bb_language_switcher_update();
$bb_language_switcher = bb_get_option('bb_language_switcher');
$url = bb_get_option('uri') . trim(str_replace(array(trim(BBPATH, "/\\"), "\\"), array("", "/"), BB_LANG_DIR), ' /\\') . '/';
$count = 0;
echo "<html><table border='0' cellpadding='1' cellspacing='1' style='font-family:monospace;'>";
foreach ($bb_language_switcher as $value => $description) {
if ($value) {
$count++;
echo "<tr><td>{$description}</td><td><a href='{$url}{$value}.mo'>{$value}.mo</a></td></tr>";
}
}
echo "</table>\n<br />{$count} language files total";
exit;
}
示例11: thanks_admin_page_process
function thanks_admin_page_process()
{
global $_POST;
if (isset($_POST['thanks_option_submit'])) {
bb_update_option('thanks_voting', $_POST['thanks_voting']);
bb_update_option('thanks_output_none', $_POST['thanks_output_none']);
bb_update_option('thanks_output_one', $_POST['thanks_output_one']);
bb_update_option('thanks_output_many', $_POST['thanks_output_many']);
bb_update_option('thanks_position', $_POST['thanks_position']);
bb_update_option('thanks_voters', $_POST['thanks_voters']);
bb_update_option('thanks_voters_prefix', $_POST['thanks_voters_prefix']);
bb_update_option('thanks_voters_suffix', $_POST['thanks_voters_suffix']);
}
if (isset($_POST['thanks_option_reset'])) {
bb_delete_option('thanks_voting');
bb_delete_option('thanks_output_none');
bb_delete_option('thanks_output_one');
bb_delete_option('thanks_output_many');
bb_delete_option('thanks_success');
bb_delete_option('thanks_position');
bb_delete_option('thanks_voters');
bb_delete_option('thanks_voters_prefix');
bb_delete_option('thanks_voters_suffix');
}
if (isset($_POST['thanks_remove_all'])) {
$opt = bb_get_option("thanks_posts");
for ($i = 0; $i < count($opt); $i++) {
$post_id = $opt[$i];
bb_delete_postmeta($post_id, "thanks");
}
bb_delete_option("thanks_posts");
bb_delete_option('thanks_voting');
bb_delete_option('thanks_output_none');
bb_delete_option('thanks_output_one');
bb_delete_option('thanks_output_many');
bb_delete_option('thanks_success');
bb_delete_option('thanks_position');
bb_delete_option('thanks_voters');
bb_delete_option('thanks_voters_prefix');
bb_delete_option('thanks_voters_suffix');
}
}
示例12: bb_get_avatar
/**
* Retrieve the avatar for a user provided a user ID or email address
*
* @since 0.9
* @param int|string $id_or_email A user ID or email address
* @param int $size Size of the avatar image
* @param string $default URL to a default image to use if no avatar is available
* @param string $alt Alternate text to use in image tag. Defaults to blank
* @return string <img> tag for the user's avatar
*/
function bb_get_avatar($id_or_email, $size = 80, $default = '', $alt = false)
{
if (!bb_get_option('avatars_show')) {
return false;
}
if (false === $alt) {
$safe_alt = '';
} else {
$safe_alt = esc_attr($alt);
}
if (!is_numeric($size)) {
$size = 80;
}
if ($email = bb_get_user_email($id_or_email)) {
$class = 'photo ';
} else {
$class = '';
$email = $id_or_email;
}
if (!$email) {
$email = '';
}
if (empty($default)) {
$default = bb_get_option('avatars_default');
}
if (is_ssl()) {
$host = 'https://secure.gravatar.com';
} else {
$host = 'http://www.gravatar.com';
}
switch ($default) {
case 'logo':
$default = '';
break;
case 'blank':
$default = bb_get_uri('bb-admin/images/blank.gif', null, BB_URI_CONTEXT_IMG_SRC);
break;
case 'monsterid':
case 'wavatar':
case 'identicon':
break;
case 'default':
default:
$default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size;
// ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')
break;
}
$src = $host . '/avatar/';
$class .= 'avatar avatar-' . $size;
if (!empty($email)) {
$src .= md5(strtolower($email));
} else {
$src .= 'd41d8cd98f00b204e9800998ecf8427e';
// d41d8cd98f00b204e9800998ecf8427e == md5('')
$class .= ' avatar-noemail';
}
$src .= '?s=' . $size;
$src .= '&d=' . urlencode($default);
$rating = bb_get_option('avatars_rating');
if (!empty($rating)) {
$src .= '&r=' . $rating;
}
$avatar = '<img alt="' . $safe_alt . '" src="' . $src . '" class="' . $class . '" style="height:' . $size . 'px; width:' . $size . 'px;" />';
return apply_filters('bb_get_avatar', $avatar, $id_or_email, $size, $default, $alt);
}
示例13: bb_tag_search
function bb_tag_search($args = '')
{
global $page, $nxt_taxonomy_object;
if ($args && is_string($args) && false === strpos($args, '=')) {
$args = array('search' => $args);
}
$defaults = array('search' => '', 'number' => false);
$args = nxt_parse_args($args);
if (isset($args['query'])) {
$args['search'] = $args['query'];
}
if (isset($args['tags_per_page'])) {
$args['number'] = $args['tags_per_page'];
}
unset($args['query'], $args['tags_per_page']);
$args = nxt_parse_args($args, $defaults);
extract($args, EXTR_SKIP);
$number = (int) $number;
$search = trim($search);
if (strlen($search) < 3) {
return new nxt_Error('invalid-query', __('Your search term was too short'));
}
$number = 0 < $number ? $number : bb_get_option('page_topics');
if (1 < $page) {
$offset = (intval($page) - 1) * $number;
}
$args = array_merge($args, compact('number', 'offset', 'search'));
$terms = $nxt_taxonomy_object->get_terms('bb_topic_tag', $args);
if (is_nxt_error($terms)) {
return false;
}
for ($i = 0; isset($terms[$i]); $i++) {
_bb_make_tag_compat($terms[$i]);
}
return $terms;
}
示例14: bb_ksd_stats_page
function bb_ksd_stats_page()
{
if (!bb_get_option('akismet_stats')) {
return;
}
if (function_exists('bb_admin_add_submenu')) {
bb_admin_add_submenu(__('Akismet Stats'), 'use_keys', 'bb_ksd_stats_display', 'index.php');
}
}
示例15: socialit_public
function socialit_public()
{
if (bb_get_topicmeta(get_topic_id(), 'hide_socialit') == true) {
echo "\n\n" . '<!-- Social It has been disabled on this page -->' . "\n\n";
} else {
global $socialit_plugopts;
$link = $socialit_plugopts['custom-mods'] == 'yes' ? bb_get_option('uri') . 'socialit-mods/' : SOCIALIT_PLUGPATH;
echo "\n\n" . '<!-- Start Of Code Generated By Social It Plugin By www.gaut.am -->' . "\n";
wp_register_style('social-it', $link . 'css/style.css', false, SOCIALIT_VER, 'all');
wp_print_styles('social-it');
if ($socialit_plugopts['expand'] || $socialit_plugopts['autocenter'] || $socialit_plugopts['targetopt'] == '_blank') {
wp_register_script('social-it-public-js', $link . "js/social-it-public.js", array('jquery'), SOCIALIT_VER);
wp_print_scripts('social-it-public-js');
}
echo '<!-- End Of Code Generated By Social It Plugin By www.gaut.am -->' . "\n\n";
}
}