本文整理汇总了PHP中get_blog_details函数的典型用法代码示例。如果您正苦于以下问题:PHP get_blog_details函数的具体用法?PHP get_blog_details怎么用?PHP get_blog_details使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_blog_details函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
function widget($args, $instance)
{
global $wpdb;
$blog_id = isset($instance['blog_id']) ? $instance['blog_id'] : 1;
$show_banner = isset($instance['show_banner']) ? $instance['show_banner'] : 1;
$title = isset($instance['title']) ? $instance['title'] : '';
$blog = get_blog_details($blog_id);
$img = get_blog_option($blog_id, 'header_img');
if ($show_banner == 0 || empty($img)) {
$img = $blog->blogname;
} else {
$img = '<img src="' . $img . '" alt="' . str_replace('"', '', $blog->blogname) . '"/>';
}
echo $args['before_widget'];
if ($title != '') {
echo $args['before_title'] . $title . $args['after_title'];
}
echo $args['before_content'];
?>
<a href="<?php
echo $blog->siteurl;
?>
"><?php
echo $img;
?>
</a>
<?php
echo $args['after_content'] . $args['after_widget'];
}
示例2: sitesettings_get_blog_subdomain
function sitesettings_get_blog_subdomain()
{
$blog_details = get_blog_details(get_current_blog_id());
$domain = $blog_details->domain;
$domain = explode('.', $domain);
return $domain[0];
}
示例3: is_ip_site
/**
*
* @param string $name Name of the IP site being checked.
*
* @return bool
*/
public function is_ip_site($name)
{
$site = get_blog_details();
$home_domain = apply_filters('ip_home_domain', 'ip.wsu.edu');
$home_path = apply_filters('ip_home_path', '/');
$future_students_domain = apply_filters('ip_future_students_domain', 'ip.wsu.edu');
$future_students_path = apply_filters('ip_future_students_path', '/future-students/');
$study_english_domain = apply_filters('ip_study_english_domain', 'ip.wsu.edu');
$study_english_path = apply_filters('ip_study_english_path', '/learn-english/');
$study_abroad_domain = apply_filters('ip_study_abroad_domain', 'ip.wsu.edu');
$study_abroad_path = apply_filters('ip_study_abroad_path', '/study-abroad/');
$scholars_abroad_domain = apply_filters('ip_scholars_abroad_domain', 'ip.wsu.edu');
$scholars_abroad_path = apply_filters('ip_scholars_abroad_path', '/scholars-abroad/');
$on_campus_domain = apply_filters('ip_on_campus_domain', 'ip.wsu.edu');
$on_campus_path = apply_filters('ip_on_campus_path', '/on-campus/');
if ('ip-home' === $name && $home_domain === $site->domain && $home_path === $site->path) {
return true;
}
if ('future-students' === $name && $future_students_domain === $site->domain && $future_students_path === $site->path) {
return true;
}
if ('study-english' === $name && $study_english_domain === $site->domain && $study_english_path === $site->path) {
return true;
}
if ('study-abroad' === $name && $study_abroad_domain === $site->domain && $study_abroad_path === $site->path) {
return true;
}
if ('scholars-abroad' === $name && $scholars_abroad_domain === $site->domain && $scholars_abroad_path === $site->path) {
return true;
}
if ('on-campus' === $name && $on_campus_domain === $site->domain && $on_campus_path === $site->path) {
return true;
}
return false;
}
示例4: metabox
public function metabox()
{
// Inform user no CPTs available to be shown.
if (empty($this->sites)) {
echo '<p>' . __('No items.') . '</p>';
return;
}
global $nav_menu_selected_id;
$html = '<ul id="multisite-nav-list">';
foreach ($this->sites as $site) {
$blog = get_blog_details($site['blog_id']);
$html .= '<h4>' . $blog->blogname . ' Pages</h4>';
foreach ($site['pages'] as $pt) {
$html .= sprintf('<li>
<label>
<input type="hidden" name="blogId" value="' . $blog->blog_id . '">
<input type="checkbox" value="%s" /> %s</label></li>', $pt->ID, $pt->post_title);
}
}
$html .= '</ul>';
// 'Add to Menu' button
$html .= '<p class="button-controls"><span class="add-to-menu">';
$html .= '<input type="submit"' . disabled($nav_menu_selected_id, 0, false) . ' class="button-secondary
submit-add-to-menu right" value="' . esc_attr__('Add to Menu', 'hptal-textdomain') . '"
name="add-post-type-menu-item" id="submit-post-type-archives" />';
$html .= '<span class="spinner"></span>';
$html .= '</span></p>';
print $html;
}
示例5: init_with_multisite
/**
* @internal
* @param string|int $site_name_or_id
*/
protected function init_with_multisite($site_name_or_id)
{
if ($site_name_or_id === null) {
//this is necessary for some reason, otherwise returns 1 all the time
if (is_multisite()) {
restore_current_blog();
$site_name_or_id = get_current_blog_id();
}
}
$info = get_blog_details($site_name_or_id);
$this->import($info);
$this->ID = $info->blog_id;
$this->id = $this->ID;
$this->name = $this->blogname;
$this->title = $this->blogname;
$this->url = $this->siteurl;
$theme_slug = get_blog_option($info->blog_id, 'stylesheet');
$this->theme = new TimberTheme($theme_slug);
$this->language = get_bloginfo('language');
$this->charset = get_bloginfo('charset');
$this->pingback_url = get_bloginfo('pingback_url');
$this->language_attributes = TimberHelper::function_wrapper('language_attributes');
$this->description = get_blog_option($info->blog_id, 'blogdescription');
$this->multisite = true;
$this->admin_email = get_blog_option($info->blog_id, 'admin_email');
}
示例6: wp_check_bind_user
function wp_check_bind_user($username, $password)
{
if (empty($password)) {
return __('<strong>ERROR</strong>: The password field is empty.');
}
$userdata = get_userdatabylogin($username);
if (!$userdata) {
return sprintf(__('<strong>ERROR</strong>: Invalid username. <a href="%s" title="Password Lost and Found">Lost your password</a>?'), site_url('wp-login.php?action=lostpassword', 'login'));
}
if (is_multisite()) {
// Is user marked as spam?
if (1 == $userdata->spam) {
return __('<strong>ERROR</strong>: Your account has been marked as a spammer.');
}
// Is a user's blog marked as spam?
if (!is_super_admin($userdata->ID) && isset($userdata->primary_blog)) {
$details = get_blog_details($userdata->primary_blog);
if (is_object($details) && $details->spam == 1) {
return __('Site Suspended.');
}
}
}
$userdata = apply_filters('wp_authenticate_user', $userdata, $password);
if (is_wp_error($userdata)) {
return;
}
if (!wp_check_password($password, $userdata->user_pass, $userdata->ID)) {
return sprintf(__('<strong>ERROR</strong>: The password you entered for the username <strong>%1$s</strong> is incorrect. <a href="%2$s" title="Password Lost and Found">Lost your password</a>?'), $username, site_url('wp-login.php?action=lostpassword', 'login'));
}
}
示例7: run
/**
* Start importer background process on production environment.
*/
public function run()
{
// Get current deploy status (if any).
$deploy_status = $this->api->get_deploy_status($this->batch->get_id());
// Make sure background import for this job is not already running.
if ($deploy_status > 0) {
return;
}
// Inicate that background import is about to start.
$this->api->set_deploy_status($this->batch->get_id(), 1);
// Default site path.
$site_path = '/';
// Site path in multi-site setup.
if (is_multisite()) {
$site = get_blog_details();
$site_path = $site->path;
}
// Trigger import script.
$import_script = dirname(dirname(dirname(__FILE__))) . '/scripts/import-batch.php';
$background_process = new Background_Process('php ' . $import_script . ' ' . ABSPATH . ' ' . get_site_url() . ' ' . $this->batch->get_id() . ' ' . $site_path . ' ' . $this->api->generate_import_key($this->batch));
if (file_exists($import_script)) {
$background_process->run();
}
if (!$background_process->get_pid()) {
// Failed to start background import.
$this->api->add_deploy_message($this->batch->get_id(), 'Batch import failed to start.', 'info');
$this->api->set_deploy_status($this->batch->get_id(), 2);
}
}
示例8: get_blog_details
public function get_blog_details()
{
if (is_null($this->blog_details)) {
$this->blog_details = get_blog_details();
}
return $this->blog_details;
}
示例9: framemarket_listall_shops
function framemarket_listall_shops()
{
global $wpdb;
$query = "SELECT blog_id FROM " . $wpdb->base_prefix . "blogs WHERE spam != '1' AND archived != '1' AND deleted != '1' AND public = '1' ORDER BY path";
$blogs = $wpdb->get_results($query);
$blogs = apply_filters('framemarket_list_shops', $blogs);
?>
<select name="shoplist" onchange="document.location.href=this.options[this.selectedIndex].value;">
<option value=""><?php
echo apply_filters('shop_drop_default_label', 'Visit a shop');
?>
</option>
<?php
foreach ($blogs as $blog) {
$blog_details = get_blog_details($blog->blog_id);
?>
<option value="<?php
echo $blog_details->siteurl;
?>
"> <?php
echo $blog_details->blogname;
?>
</option>
<?php
}
?>
</select>
<?php
}
示例10: prepare_items
public function prepare_items()
{
$current_page = $this->get_pagenum();
$per_page = 10;
global $blog_id;
global $wpdb;
global $pagenow;
if (is_plugin_active_for_network('wp-piwik/wp-piwik.php')) {
$total_items = $wpdb->get_var('SELECT COUNT(*) FROM ' . $wpdb->blogs);
$blogs = \WP_Piwik\Settings::getBlogList($per_page, $current_page);
foreach ($blogs as $blog) {
$blogDetails = get_blog_details($blog['blog_id'], true);
$this->data[] = array('name' => $blogDetails->blogname, 'id' => $blogDetails->blog_id, 'siteurl' => $blogDetails->siteurl, 'piwikid' => $this->wpPiwik->getPiwikSiteId($blogDetails->blog_id));
}
} else {
$blogDetails = get_bloginfo();
$this->data[] = array('name' => get_bloginfo('name'), 'id' => '-', 'siteurl' => get_bloginfo('url'), 'piwikid' => $this->wpPiwik->getPiwikSiteId());
$total_items = 1;
}
$columns = $this->get_columns();
$hidden = array();
$sortable = array();
$this->_column_headers = array($columns, $hidden, $sortable);
$this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page));
foreach ($this->data as $key => $dataset) {
if (empty($dataset['piwikid']) || $dataset['piwikid'] == 'n/a') {
$this->data[$key]['piwikid'] = __('Site not created yet.', 'wp-piwik');
}
if ($this->wpPiwik->isNetworkMode()) {
$this->data[$key]['name'] = '<a href="index.php?page=wp-piwik_stats&wpmu_show_stats=' . $dataset['id'] . '">' . $dataset['name'] . '</a>';
}
}
$this->items = $this->data;
return count($this->items);
}
示例11: list_network_sites
function list_network_sites($atts)
{
// Start by getting an array of information of all sites in the network.
$info = array('network_id' => null, 'public' => null, 'archived' => null, 'mature' => null, 'spam' => null, 'deleted' => null, 'limit' => 100, 'offset' => 0);
$siteInfos = wp_get_sites($info);
// Use shortcode atts to determine list type, then begin the output variable $list with the right <li> tag.
$listType = shortcode_atts(array('list' => "unordered"), $atts);
if ($listType['list'] == "unordered") {
$list = "<ul>";
} else {
if ($listType['list'] == "ordered") {
$list = "<ol>";
} else {
$list = "Error: Incorrect shortcode was used. Please contact admin.";
return $list;
}
}
// Add the list content.
foreach ($siteInfos as $siteInfo) {
$blog_details = get_blog_details($siteInfo['blog_id']);
$list .= "<li><a href='{$blog_details->siteurl}'>{$blog_details->blogname}</a></li>";
}
// Close the list tag.
if ($listType['list'] == "unordered") {
$list .= "</ul>";
} else {
$list .= "</ol>";
}
return $list;
}
示例12: uw_register_widgets
function uw_register_widgets()
{
if (!is_blog_installed()) {
return;
}
unregister_widget('Widget_Akismet');
unregister_widget('WP_Widget_Meta');
unregister_widget('WP_Widget_Recent_Posts');
unregister_widget('WP_Widget_RSS');
//register_widget('UW_Widget_Single_Image');
//register_widget('UW_RSS_Widget');
//register_widget('UW_Widget_Recent_Posts');
//register_widget('UW_Widget_CommunityPhotos');
register_widget('UW_Widget_Categories');
//register_widget('UW_Widget_Twitter');
//register_widget('UW_KEXP_KUOW_Widget');
//register_widget('UW_Showcase_Widget');
//register_widget('UW_Subpage_Menu');
register_widget('UW_Nav_Menu_Widget');
//register_widget('UW_Calendar');
//register_widget('UW_Campus_Map');
// Specific to Page Builder only
register_widget('UW_Headline_Separator_Widget');
register_widget('UW_Headline_Widget');
register_widget('UW_Intro_Widget');
//register_widget('UW_YouTube_Playlist_Widget');
if (is_multisite() && get_blog_details('marketing')) {
register_widget('UW_Pride_Points');
}
}
示例13: get_dashboard_blog
/**
* Get the "dashboard blog", the blog where users without a blog edit their profile data.
* Dashboard blog functionality was removed in WordPress 3.1, replaced by the user admin.
*
* @since MU
* @deprecated 3.1.0
* @see get_blog_details()
* @return int
*/
function get_dashboard_blog()
{
_deprecated_function(__FUNCTION__, '3.1');
if ($blog = get_site_option('dashboard_blog')) {
return get_blog_details($blog);
}
return get_blog_details($GLOBALS['current_site']->blog_id);
}
示例14: redirectTo
/**
* Run redirection
*
* @param string $lang Current language
* @param string $req Current path
* @param array $sites List of others sites
*/
function redirectTo($lang, $req, &$sites)
{
if ($req == get_blog_details()->path) {
header('Location: ' . $sites[$lang]);
} else {
header('Location: ' . $sites[$lang] . '404error');
}
}
示例15: login_site_redirect
function login_site_redirect($redirect_to)
{
global $user;
$primary_blog_id = get_usermeta($user->ID, 'primary_blog');
$blog_details = get_blog_details($primary_blog_id);
$redirect_url = $blog_details->siteurl;
return $redirect_url;
}