本文整理汇总了PHP中get_blogaddress_by_id函数的典型用法代码示例。如果您正苦于以下问题:PHP get_blogaddress_by_id函数的具体用法?PHP get_blogaddress_by_id怎么用?PHP get_blogaddress_by_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_blogaddress_by_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
/**
* Change redirect upon login to user's My Catalog page
*
* @param string $redirect_to
* @param string $request_redirect_to
* @param \WP_User $user
*
* @return string
*/
function login($redirect_to, $request_redirect_to, $user)
{
if (false === is_a($user, 'WP_User')) {
// Unknown user, bail with default
return $redirect_to;
}
if (is_super_admin($user->ID)) {
// This is an admin, don't mess
return $redirect_to;
}
$blogs = get_blogs_of_user($user->ID);
if (array_key_exists(get_current_blog_id(), $blogs)) {
// Yes, user has access to this blog
return $redirect_to;
}
if ($user->primary_blog) {
// Force redirect the user to their blog or, if they have more than one, to their catalog, bypass wp_safe_redirect()
if (count($blogs) > 1) {
$redirect = get_blogaddress_by_id($user->primary_blog) . 'wp-admin/index.php?page=pb_catalog';
} else {
$redirect = get_blogaddress_by_id($user->primary_blog) . 'wp-admin/';
}
location($redirect);
}
// User has no primary_blog? Make them sign-up for one
return network_site_url('/wp-signup.php');
}
示例2: add_columns
/**
* Add colums to blog view
*
* @since 0.1
* @param $column_name string
* @param $blog_id integer
* @uses switch_to_blog, mlp_get_available_languages_titles, _e, network_admin_url
* mlp_get_language_flag, restore_current_blog, apply_filters
* @return $column_name string
*/
public function add_columns($column_name, $blog_id)
{
//render column value
if ('mlp_interlinked' === $column_name) {
switch_to_blog($blog_id);
$interlinked = mlp_get_available_languages_titles();
if (count($interlinked) < 2 || !is_array($interlinked)) {
_e('nothing', 'multilingualpress');
return;
}
$linked_blogs = array();
echo '<div class="mlp_interlinked_blogs">';
foreach ($interlinked as $interlinked_blog_id => $interlinked_blog_title) {
if ($interlinked_blog_id == $blog_id) {
continue;
}
$linked_blogs[] = sprintf('<a href="%1$s">%2$s</a>', get_blogaddress_by_id($interlinked_blog_id), esc_html($interlinked_blog_title));
}
empty($linked_blogs) || (print join(' | ', $linked_blogs));
echo '</div>';
restore_current_blog();
}
$column_name = apply_filters('mlp_add_custom_columns', $column_name, $blog_id);
return $column_name;
}
示例3: get_blogaddress_by_id
/**
* Gets the URL for the blog with the given ID.
*
* This gets the URL for the requested blog when in multisite mode, or
* for the root blog when running a standard installation.
*
* @param int $blog_id the ID of a blog
* @return string the URL for the blog
*
* @since 0.4
*/
public static function get_blogaddress_by_id($blog_id)
{
if (function_exists('get_blogaddress_by_id')) {
return get_blogaddress_by_id($blog_id);
} else {
return home_url();
}
}
示例4: bw_display_blog
/**
* Display information about a blog in a particular format
*
*
*/
function bw_display_blog($id, $atts, $content)
{
$bloginfo = bw_get_bloginfo($id);
if ($bloginfo) {
if (is_numeric($id)) {
$url = get_blogaddress_by_id($id);
} else {
$url = get_blogaddress_by_name($id);
}
$blog = $bloginfo->blog_id;
switch_to_blog($blog);
if ($content) {
e(bw_do_shortcode($content));
} else {
alink(null, $url, $bloginfo->blogname);
}
restore_current_blog();
}
}
示例5: printf
} else {
printf(__('Your site at <a href="%1$s">%2$s</a> is active. You may now log in to your site using your chosen username of “%3$s”. Please check your email inbox at %4$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%5$s">reset your password</a>.'), 'http://' . $signup->domain, $signup->domain, $signup->user_login, $signup->user_email, wp_lostpassword_url());
}
echo '</p>';
} else {
?>
<h2><?php
_e('An error occurred during the activation');
?>
</h2>
<?php
echo '<p>' . $result->get_error_message() . '</p>';
}
} else {
extract($result);
$url = get_blogaddress_by_id((int) $blog_id);
$user = get_userdata((int) $user_id);
?>
<h2><?php
_e('Your account is now active!');
?>
</h2>
<div id="signup-welcome">
<p><span class="h3"><?php
_e('Username:');
?>
</span> <?php
echo $user->user_login;
?>
</p>
示例6: wpmu_welcome_notification
/**
* Notify a user that her blog activation has been successful.
*
* Filter 'wpmu_welcome_notification' to disable or bypass.
*
* Filter 'update_welcome_email' and 'update_welcome_subject' to
* modify the content and subject line of the notification email.
*
* @since MU
*
* @param int $blog_id
* @param int $user_id
* @param string $password
* @param string $title The new blog's title
* @param array $meta Optional. Not used in the default function, but is passed along to hooks for customization.
* @return bool
*/
function wpmu_welcome_notification($blog_id, $user_id, $password, $title, $meta = '')
{
global $current_site;
if (!apply_filters('wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta)) {
return false;
}
$welcome_email = stripslashes(get_site_option('welcome_email'));
if ($welcome_email == false) {
$welcome_email = stripslashes(__('Dear User,
Your new SITE_NAME site has been successfully set up at:
BLOG_URL
You can log in to the administrator account with the following information:
Username: USERNAME
Password: PASSWORD
Log in here: BLOG_URLwp-login.php
We hope you enjoy your new site. Thanks!
--The Team @ SITE_NAME'));
}
$url = get_blogaddress_by_id($blog_id);
$user = new WP_User($user_id);
$welcome_email = str_replace('SITE_NAME', $current_site->site_name, $welcome_email);
$welcome_email = str_replace('BLOG_TITLE', $title, $welcome_email);
$welcome_email = str_replace('BLOG_URL', $url, $welcome_email);
$welcome_email = str_replace('USERNAME', $user->user_login, $welcome_email);
$welcome_email = str_replace('PASSWORD', $password, $welcome_email);
$welcome_email = apply_filters('update_welcome_email', $welcome_email, $blog_id, $user_id, $password, $title, $meta);
$admin_email = get_site_option('admin_email');
if ($admin_email == '') {
$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
}
$from_name = get_site_option('site_name') == '' ? 'WordPress' : esc_html(get_site_option('site_name'));
$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
$message = $welcome_email;
if (empty($current_site->site_name)) {
$current_site->site_name = 'WordPress';
}
$subject = apply_filters('update_welcome_subject', sprintf(__('New %1$s Site: %2$s'), $current_site->site_name, stripslashes($title)));
wp_mail($user->user_email, $subject, $message, $message_headers);
return true;
}
示例7: subsites_list
/**
* Get array of subsite simple urls keyed by their ID.
*
* @return array
*/
public function subsites_list()
{
$subsites = array();
if (!is_multisite()) {
return $subsites;
}
$sites = wp_get_sites(array('limit' => 0));
if (!empty($sites)) {
foreach ($sites as $subsite) {
$subsites[$subsite['blog_id']] = $this->simple_site_url(get_blogaddress_by_id($subsite['blog_id']));
}
}
return $subsites;
}
示例8: wpmu_welcome_notification
/**
* Notify a user that their blog activation has been successful.
*
* Filter 'wpmu_welcome_notification' to disable or bypass.
*
* Filter 'update_welcome_email' and 'update_welcome_subject' to
* modify the content and subject line of the notification email.
*
* @since MU
*
* @param int $blog_id
* @param int $user_id
* @param string $password
* @param string $title The new blog's title
* @param array $meta Optional. Not used in the default function, but is passed along to hooks for customization.
* @return bool
*/
function wpmu_welcome_notification($blog_id, $user_id, $password, $title, $meta = array())
{
$current_site = get_current_site();
/**
* Filter whether to bypass the welcome email after site activation.
*
* Returning false disables the welcome email.
*
* @since MU
*
* @param int|bool $blog_id Blog ID.
* @param int $user_id User ID.
* @param string $password User password.
* @param string $title Site title.
* @param array $meta Signup meta data.
*/
if (!apply_filters('wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta)) {
return false;
}
$welcome_email = get_site_option('welcome_email');
if ($welcome_email == false) {
/* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */
$welcome_email = __('Howdy USERNAME,
Your new SITE_NAME site has been successfully set up at:
BLOG_URL
You can log in to the administrator account with the following information:
Username: USERNAME
Password: PASSWORD
Log in here: BLOG_URLwp-login.php
We hope you enjoy your new site. Thanks!
--The Team @ SITE_NAME');
}
$url = get_blogaddress_by_id($blog_id);
$user = get_userdata($user_id);
$welcome_email = str_replace('SITE_NAME', $current_site->site_name, $welcome_email);
$welcome_email = str_replace('BLOG_TITLE', $title, $welcome_email);
$welcome_email = str_replace('BLOG_URL', $url, $welcome_email);
$welcome_email = str_replace('USERNAME', $user->user_login, $welcome_email);
$welcome_email = str_replace('PASSWORD', $password, $welcome_email);
/**
* Filter the content of the welcome email after site activation.
*
* Content should be formatted for transmission via wp_mail().
*
* @since MU
*
* @param string $welcome_email Message body of the email.
* @param int $blog_id Blog ID.
* @param int $user_id User ID.
* @param string $password User password.
* @param string $title Site title.
* @param array $meta Signup meta data.
*/
$welcome_email = apply_filters('update_welcome_email', $welcome_email, $blog_id, $user_id, $password, $title, $meta);
$admin_email = get_site_option('admin_email');
if ($admin_email == '') {
$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
}
$from_name = get_site_option('site_name') == '' ? 'WordPress' : esc_html(get_site_option('site_name'));
$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
$message = $welcome_email;
if (empty($current_site->site_name)) {
$current_site->site_name = 'WordPress';
}
/**
* Filter the subject of the welcome email after site activation.
*
* @since MU
*
* @param string $subject Subject of the email.
*/
$subject = apply_filters('update_welcome_subject', sprintf(__('New %1$s Site: %2$s'), $current_site->site_name, wp_unslash($title)));
wp_mail($user->user_email, wp_specialchars_decode($subject), $message, $message_headers);
return true;
}
示例9: update_option
}
break;
}
update_option('allowedthemes', $allowed_themes);
restore_current_blog();
wp_safe_redirect(add_query_arg(array('id' => $id, $action => $n), $referer));
exit;
}
if (isset($_GET['action']) && 'update-site' == $_GET['action']) {
wp_safe_redirect($referer);
exit;
}
add_thickbox();
add_screen_option('per_page', array('label' => _x('Themes', 'themes per page (screen options)')));
$site_url_no_http = preg_replace('#^http(s)?://#', '', get_blogaddress_by_id($id));
$title_site_url_linked = sprintf(__('Edit Site: <a href="%1$s">%2$s</a>'), get_blogaddress_by_id($id), $site_url_no_http);
$title = sprintf(__('Edit Site: %s'), $site_url_no_http);
$parent_file = 'sites.php';
$submenu_file = 'sites.php';
require ABSPATH . 'wp-admin/admin-header.php';
?>
<div class="wrap">
<?php
screen_icon('ms-admin');
?>
<h2 id="edit-site"><?php
echo $title_site_url_linked;
?>
</h2>
<h3 class="nav-tab-wrapper">
示例10: printf
printf(__('Your account has been activated. You may now <a href="%1$s">log in</a> to the site using your chosen username of “%2$s”. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.'), network_site_url('wp-login.php', 'login'), $signup->user_login, $signup->user_email, wp_lostpassword_url());
} else {
printf(__('Your site at <a href="%1$s">%2$s</a> is active. You may now log in to your site using your chosen username of “%3$s”. Please check your email inbox at %4$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%5$s">reset your password</a>.'), 'http://' . $signup->domain, $signup->domain, $signup->user_login, $signup->user_email, wp_lostpassword_url());
}
echo '</p>';
} else {
?>
<h2><?php
_e('An error occurred during the activation');
?>
</h2>
<?php
echo '<p>' . $result->get_error_message() . '</p>';
}
} else {
$url = isset($result['blog_id']) ? get_blogaddress_by_id((int) $result['blog_id']) : '';
$user = get_userdata((int) $result['user_id']);
?>
<h2><?php
_e('Your account is now active!');
?>
</h2>
<div id="signup-welcome">
<p><span class="h3"><?php
_e('Username:');
?>
</span> <?php
echo $user->user_login;
?>
</p>
示例11: rpr_preprocess_signup_form
//.........这里部分代码省略.........
} else {
_e('Site registration has been disabled.');
?>
</div>
</div>
<?php
do_action('after_signup_form');
get_footer();
exit;
}
break;
default:
return;
}
/* begin wp-activate page */
$key = (string) $_REQUEST['key'];
// wpmu_create_user, wpmu_welcome_user_notification, add_new_user_to_blog, do wpmu_activate_user action
$result = wpmu_activate_signup($key);
if (is_wp_error($result)) {
if ('already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code()) {
$signup = $result->get_error_data();
?>
<h2><?php
_e('Your account is now active!');
?>
</h2>
<?php
echo '<p class="lead-in">';
if ($signup->domain . $signup->path == '') {
printf(__('Your account has been activated. You may now <a href="%1$s">log in</a> to the site using your chosen username of “%2$s”. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.'), network_site_url('wp-login.php', 'login'), $signup->user_login, $signup->user_email, wp_lostpassword_url());
} else {
printf(__('Your site at <a href="%1$s">%2$s</a> is active. You may now log in to your site using your chosen username of “%3$s”. Please check your email inbox at %4$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%5$s">reset your password</a>.'), 'http://' . $signup->domain, $signup->domain, $signup->user_login, $signup->user_email, wp_lostpassword_url());
}
echo '</p>';
} else {
?>
<h2><?php
_e('An error occurred during the activation');
?>
</h2>
<?php
echo '<p>' . $result->get_error_message() . '</p>';
}
} else {
//TODO: Why not reference $result->blog_id?
extract($result);
if (isset($blog_id)) {
$url = get_blogaddress_by_id((int) $blog_id);
}
$user = get_userdata((int) $user_id);
?>
<h2><?php
_e('Your account is now active!');
?>
</h2>
<div id="signup-welcome">
<p><span class="h3"><?php
_e('Username:');
?>
</span> <?php
echo $user->user_login;
?>
</p>
<p><span class="h3"><?php
_e('Password:');
?>
</span> <?php
echo $password;
?>
</p>
</div>
<?php
if (isset($blog_id) && $url != network_home_url('', 'http')) {
?>
<p class="view"><?php
printf(__('Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>'), $url, $url . 'wp-login.php');
?>
</p>
<?php
} else {
?>
<p class="view"><?php
printf(__('Your account is now activated. <a href="%1$s">Log in</a> or go back to the <a href="%2$s">homepage</a>.'), network_site_url('wp-login.php', 'login'), network_home_url());
?>
</p>
<?php
}
}
?>
</div>
<script type="text/javascript">
var key_input = document.getElementById('key');
key_input && key_input.focus();
</script>
<?php
get_footer();
?>
<?php
exit;
}
示例12: tml_display_activate
/**
* Outputs the activation page
*
* @since 6.1
* @access public
*
* @param object $template Theme_My_Login_Template object
*/
public function tml_display_activate(&$template)
{
global $blog_id;
echo '<div class="login" id="theme-my-login' . esc_attr($template->get_option('instance')) . '">';
if (empty($_GET['key']) && empty($_POST['key'])) {
?>
<h2><?php
_e('Activation Key Required', 'theme-my-login');
?>
</h2>
<form name="activateform" id="activateform" method="post" action="<?php
$template->the_action_url('activate');
?>
">
<p>
<label for="key<?php
$template->the_instance();
?>
"><?php
_e('Activation Key:', 'theme-my-login');
?>
</label>
<br /><input type="text" name="key<?php
$template->the_instance();
?>
" id="key" value="" size="50" />
</p>
<p class="submit">
<input id="submit<?php
$template->the_instance();
?>
" type="submit" name="Submit" class="submit" value="<?php
esc_attr_e('Activate', 'theme-my-login');
?>
" />
</p>
</form>
<?php
} else {
$key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key'];
$result = wpmu_activate_signup($key);
if (is_wp_error($result)) {
if ('already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code()) {
$signup = $result->get_error_data();
?>
<h2><?php
_e('Your account is now active!', 'theme-my-login');
?>
</h2>
<?php
echo '<p class="lead-in">';
if ($signup->domain . $signup->path == '') {
printf(__('Your account has been activated. You may now <a href="%1$s">login</a> to the site using your chosen username of “%2$s”. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.', 'theme-my-login'), network_site_url('wp-login.php', 'login'), $signup->user_login, $signup->user_email, network_site_url('wp-login.php?action=lostpassword', 'login'));
} else {
printf(__('Your site at <a href="%1$s">%2$s</a> is active. You may now log in to your site using your chosen username of “%3$s”. Please check your email inbox at %4$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%5$s">reset your password</a>.', 'theme-my-login'), 'http://' . $signup->domain, $signup->domain, $signup->user_login, $signup->user_email, network_site_url('wp-login.php?action=lostpassword'));
}
echo '</p>';
} else {
?>
<h2><?php
_e('An error occurred during the activation', 'theme-my-login');
?>
</h2>
<?php
echo '<p>' . $result->get_error_message() . '</p>';
}
} else {
extract($result);
$url = get_blogaddress_by_id((int) $blog_id);
$user = new WP_User((int) $user_id);
?>
<h2><?php
_e('Your account is now active!', 'theme-my-login');
?>
</h2>
<div id="signup-welcome">
<p><span class="h3"><?php
_e('Username:', 'theme-my-login');
?>
</span> <?php
echo $user->user_login;
?>
</p>
<p><span class="h3"><?php
_e('Password:', 'theme-my-login');
?>
</span> <?php
echo $password;
?>
//.........这里部分代码省略.........
示例13: test_get_blogaddress_by_id_with_invalid_id
/**
* Tests returning the appropriate response for a invalid id given.
*/
function test_get_blogaddress_by_id_with_invalid_id()
{
$blogaddress = get_blogaddress_by_id(42);
$this->assertEquals('', $blogaddress);
}
示例14: edit_site_Network_Admin_GForms_TMP
/**
* Display Edit Site Section of Settings Page
*/
function edit_site_Network_Admin_GForms_TMP()
{
$unauthorized = false;
if (!is_multisite()) {
$unauthorized = __('Multisite support is not enabled.');
}
if (!current_user_can('manage_sites')) {
$unauthorized = __('You do not have sufficient permissions to edit this site.');
}
$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
if (!$id) {
$unauthorized = __('Invalid site ID.');
}
$details = get_blog_details($id);
if (!can_edit_network($details->site_id)) {
$unauthorized = __('You do not have permission to access this page.');
}
if ($unauthorized) {
echo "<p>{$unauthorized}</p>\n";
return;
}
$site_url_no_http = preg_replace('#^http(s)?://#', '', get_blogaddress_by_id($id));
$title_site_url_linked = sprintf(__('API Enabled: <a href="%1$s">%2$s</a>'), get_blogaddress_by_id($id), $site_url_no_http);
$gforms_tmp_admin_client_id = \get_blog_option($id, 'gforms_tmp_admin_client_id', false);
$gforms_tmp_admin_client_name = \get_blog_option($id, 'gforms_tmp_admin_client_name', false);
$gforms_tmp_active = \get_blog_option($id, 'gforms_tmp_active', false);
$gforms_tmp_last_update = \get_blog_option($id, 'gforms_tmp_last_update', false);
$date = 'Y/m/d g:i:s a';
$is_main_site = \is_main_site($id);
if (isset($_GET['update'])) {
$messages = array();
if ('updated' == $_GET['update']) {
$messages[1] = __('Site updated.');
} else {
$messages[0] = __('Site could not be updated.');
}
}
if (!empty($messages)) {
foreach ($messages as $status => $msg) {
echo '<div id="message" class="' . ($status ? 'updated' : 'error') . '"><p>' . $msg . '</p></div>';
}
}
?>
<div class="wrap">
<div id="icon-options-general" class="icon32">
<br>
</div>
<h2 id="edit-site"><?php
echo $title_site_url_linked;
?>
</h2>
<br />
<form method="post"
action="<?php
echo network_admin_url('admin.php?page=' . $this::slug . '&action=edit');
?>
">
<?php
wp_nonce_field('gforms-tmp-edit-site');
?>
<input type="hidden" name="id"
value="<?php
echo esc_attr($id);
?>
" /> <input type="hidden"
name="action" value="site_update_network_admin_gforms_tmp" />
<table class="form-table">
<tr class="form-field form-required">
<th scope="row"><?php
_e('Domain');
?>
</th>
<?php
$protocol = is_ssl() ? 'https://' : 'http://';
if ($is_main_site) {
?>
<td><code><?php
echo $protocol;
echo esc_attr($details->domain);
?>
</code></td>
<?php
} else {
?>
//.........这里部分代码省略.........
示例15: author_gravatar_tag
function author_gravatar_tag($authorID, $tags = '', $width = '')
{
global $gravatar_width, $profile_picture_options;
if ($authorID != 0) {
$path = author_image_path($authorID, false, 'absolute');
$width = $width != '' ? $width : $gravatar_width;
//$height = author_image_dimensions($path, 'height') * ($gravatar_width / author_image_dimensions($path, 'width'));// not needed
$tag = '<img src="' . author_image_path($authorID, false, 'url') . '" width=' . $width . ' ' . $tags . ' hspace=10 />';
if ($profile_picture_options['link_profile'] == 'yes') {
$primary_blog = get_usermeta($authorID, 'primary_blog');
if ($primary_blog != '') {
$url = get_blogaddress_by_id($primary_blog);
} else {
$url = get_blogaddress_by_id(1);
}
$tag = '<a href="' . $url . '?author=' . $authorID . '">' . $tag . '</a>';
}
return $tag;
} else {
return false;
}
}