当前位置: 首页>>代码示例>>PHP>>正文


PHP refresh_blog_details函数代码示例

本文整理汇总了PHP中refresh_blog_details函数的典型用法代码示例。如果您正苦于以下问题:PHP refresh_blog_details函数的具体用法?PHP refresh_blog_details怎么用?PHP refresh_blog_details使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了refresh_blog_details函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: upgrade_280

/**
 * Execute changes made in WordPress 2.8.
 *
 * @since 2.8.0
 */
function upgrade_280()
{
    global $wp_current_db_version, $wpdb;
    if ($wp_current_db_version < 10360) {
        populate_roles_280();
    }
    if (is_multisite()) {
        $start = 0;
        while ($rows = $wpdb->get_results("SELECT option_name, option_value FROM {$wpdb->options} ORDER BY option_id LIMIT {$start}, 20")) {
            foreach ($rows as $row) {
                $value = $row->option_value;
                if (!@unserialize($value)) {
                    $value = stripslashes($value);
                }
                if ($value !== $row->option_value) {
                    update_option($row->option_name, $value);
                }
            }
            $start += 20;
        }
        refresh_blog_details($wpdb->blogid);
    }
}
开发者ID:beaucollins,项目名称:wp,代码行数:28,代码来源:upgrade.php

示例2: insert_blog

/**
 * Store basic site info in the blogs table.
 *
 * This function creates a row in the wp_blogs table and returns
 * the new blog's ID. It is the first step in creating a new blog.
 *
 * @since MU
 *
 * @param string $domain The domain of the new site.
 * @param string $path The path of the new site.
 * @param int $site_id Unless you're running a multi-network install, be sure to set this value to 1.
 * @return int The ID of the new row
 */
function insert_blog($domain, $path, $site_id)
{
    global $wpdb;
    $path = trailingslashit($path);
    $site_id = (int) $site_id;
    $result = $wpdb->insert($wpdb->blogs, array('site_id' => $site_id, 'domain' => $domain, 'path' => $path, 'registered' => current_time('mysql')));
    if (!$result) {
        return false;
    }
    refresh_blog_details($wpdb->insert_id);
    return $wpdb->insert_id;
}
开发者ID:nhemsley,项目名称:wordpress,代码行数:25,代码来源:ms-functions.php

示例3: update_blog_status

/**
 * Update a blog details field.
 *
 * @since 3.0.0
 *
 * @param int $blog_id BLog ID
 * @param string $pref A field name
 * @param string $value Value for $pref
 * @param bool $refresh Whether to refresh the blog details cache. Default is true.
 */
function update_blog_status($blog_id, $pref, $value, $refresh = true)
{
    global $wpdb;
    if (!in_array($pref, array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id'))) {
        return $value;
    }
    $wpdb->update($wpdb->blogs, array($pref => $value, 'last_updated' => current_time('mysql', true)), array('blog_id' => $blog_id));
    if ($refresh) {
        refresh_blog_details($blog_id);
    }
    if ($pref == 'spam') {
        if ($value == 1) {
            do_action("make_spam_blog", $blog_id);
        } else {
            do_action("make_ham_blog", $blog_id);
        }
    }
    return $value;
}
开发者ID:junxuan,项目名称:wordpress,代码行数:29,代码来源:ms-blogs.php

示例4: update_blog_status

/**
 * Update a blog details field.
 *
 * @since MU
 *
 * @param int $blog_id BLog ID
 * @param string $pref A field name
 * @param string $value Value for $pref
 * @return string $value
 */
function update_blog_status($blog_id, $pref, $value, $deprecated = null)
{
    global $wpdb;
    if (null !== $deprecated) {
        _deprecated_argument(__FUNCTION__, '3.1');
    }
    if (!in_array($pref, array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id'))) {
        return $value;
    }
    $result = $wpdb->update($wpdb->blogs, array($pref => $value, 'last_updated' => current_time('mysql', true)), array('blog_id' => $blog_id));
    if (false === $result) {
        return false;
    }
    refresh_blog_details($blog_id);
    if ('spam' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_spam_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_ham_blog', $blog_id);
        }
    } elseif ('mature' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('mature_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('unmature_blog', $blog_id);
        }
    } elseif ('archived' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('archive_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('unarchive_blog', $blog_id);
        }
    } elseif ('deleted' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_delete_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_undelete_blog', $blog_id);
        }
    } elseif ('public' == $pref) {
        /**
         * Fires after the current blog's 'public' setting is updated.
         *
         * @since MU
         *
         * @param int    $blog_id Blog ID.
         * @param string $value   The value of blog status.
         */
        do_action('update_blog_public', $blog_id, $value);
        // Moved here from update_blog_public().
    }
    return $value;
}
开发者ID:trinoamez,项目名称:WordpressPlatzi,代码行数:70,代码来源:ms-blogs.php

示例5: xtec_delblogs_page

function xtec_delblogs_page()
{
    if (isset($_POST['inactivity_days'])) {
        $inactivity_days = $_POST['inactivity_days'];
    } else {
        $inactivity_days = get_site_option('xtec_maintenance_inactivity_days', 90);
    }
    if (isset($_POST['posts_pages'])) {
        $posts_pages = $_POST['posts_pages'];
    } else {
        $posts_pages = get_site_option('xtec_maintenance_posts_pages', 2);
    }
    if (get_site_option('xtec_maintenance_never_upload_file', 1) == 1) {
        $never_upload_file = true;
    } else {
        $never_upload_file = false;
    }
    if (isset($_POST['never_upload_file'])) {
        $never_upload_file = true;
    } else {
        if (isset($_POST['submit']) || isset($_POST['set_as_default']) || isset($_POST['touch'])) {
            $never_upload_file = false;
        }
    }
    ?>
	
	<div class="wrap">
	
	<h2>Eliminació de blocs</h2>
	
	<?php 
    global $wpdb;
    if (isset($_POST['delete'])) {
        if (!isset($_POST['idblogs'])) {
            ?>
<div class="error below-h2"><p>No has seleccionat cap bloc.</p></div><?php 
        } else {
            $idblogs = $_POST['idblogs'];
            foreach ($idblogs as $idblog) {
                $blogname = get_blog_option($idblog, 'blogname');
                $path = $wpdb->get_var("SELECT `path` FROM `{$wpdb->blogs}` WHERE `blog_id`='{$idblog}'");
                $del_date = date("Y-m-d H:i:s");
                $sql = "INSERT INTO `wp_delblocs` SET `site_id` = '{$idblog}', `site_path` = '" . $path . "', `blogname` = '" . $blogname . "', `del_date` = '{$del_date}', `status` = '2';";
                $wpdb->get_results($sql);
                $users = get_users_of_blog($idblog);
                foreach ($users as $user) {
                    $sql = "INSERT INTO `wp_delblocs_users` SET `blog_id` = '{$idblog}', `user_id` = '" . $user->user_id . "', `user_login` = '" . $user->user_login . "', `display_name` = '" . $user->display_name . "', `user_email` = '" . $user->user_email . "', `meta_value` = '" . $user->meta_value . "';";
                    $wpdb->get_results($sql);
                }
                // drops data of the blog when deleted
                wpmu_delete_blog($idblog, true);
                echo "El bloc {$blogname} amb ID {$idblog} s'ha eliminat correctament.<br />";
            }
        }
        echo "<p><a href=\"?page=xtec-delblogs\">Torna al formulari d'eliminació de blocs</a></p>";
    } else {
        if (isset($_POST['touch'])) {
            if (!isset($_POST['idblogs'])) {
                ?>
<div class="error below-h2"><p>No has seleccionat cap bloc.</p></div><?php 
            } else {
                $idblogs = $_POST['idblogs'];
                foreach ($idblogs as $idblog) {
                    $blogname = get_blog_option($idblog, 'blogname');
                    $wpdb->update($wpdb->blogs, array('last_updated' => current_time('mysql', true)), array('blog_id' => $idblog));
                    refresh_blog_details($wpdb->blogid);
                    echo "La data de la darrera actualització del bloc <strong>{$blogname}</strong> amb ID <strong>{$idblog}</strong> ha estat actualitzada a la data actual.<br>";
                }
            }
            echo "<p><a href=\"?page=xtec-delblogs\">Torna al formulari d'eliminació de blocs</a></p>";
        } else {
            if (isset($_POST['set_as_default'])) {
                update_site_option('xtec_maintenance_inactivity_days', $_POST['inactivity_days']);
                update_site_option('xtec_maintenance_posts_pages', $_POST['posts_pages']);
                $value = isset($_POST['never_upload_file']) ? 1 : 0;
                update_site_option('xtec_maintenance_never_upload_file', $value);
            }
            ?>
		
		<form action="?page=xtec-delblogs" method="post">
			<table class="form-table">
				<tbody>
					<tr valign="top">
						<th scope="row">
							<label for="inactivity_days">Dies d'inactivitat</label>
						</th>
						<td>
							<input id="inactivity_days" class="small-text" type="text" value="<?php 
            echo $inactivity_days;
            ?>
" name="inactivity_days"/>
						</td>
					</tr>
					<tr valign="top">
						<th scope="row">
							<label for="posts_pages">Articles i pàgines</label>
						</th>
						<td>
							<input id="posts_pages" class="small-text" type="text" value="<?php 
            echo $posts_pages;
//.........这里部分代码省略.........
开发者ID:ignacioabejaro,项目名称:xtecblocs,代码行数:101,代码来源:xtec-maintenance.php

示例6: update_blog_status

/**
 * Update a blog details field.
 *
 * @since MU
 *
 * @param int $blog_id BLog ID
 * @param string $pref A field name
 * @param string $value Value for $pref
 * @return string $value
 */
function update_blog_status($blog_id, $pref, $value, $deprecated = null)
{
    global $wpdb;
    if (null !== $deprecated) {
        _deprecated_argument(__FUNCTION__, '3.1');
    }
    if (!in_array($pref, array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id'))) {
        return $value;
    }
    $wpdb->update($wpdb->blogs, array($pref => $value, 'last_updated' => current_time('mysql', true)), array('blog_id' => $blog_id));
    refresh_blog_details($blog_id);
    if ('spam' == $pref) {
        $value == 1 ? do_action('make_spam_blog', $blog_id) : do_action('make_ham_blog', $blog_id);
    } elseif ('mature' == $pref) {
        $value == 1 ? do_action('mature_blog', $blog_id) : do_action('unmature_blog', $blog_id);
    } elseif ('archived' == $pref) {
        $value == 1 ? do_action('archive_blog', $blog_id) : do_action('unarchive_blog', $blog_id);
    } elseif ('archived' == $pref) {
        $value == 1 ? do_action('archive_blog', $blog_id) : do_action('unarchive_blog', $blog_id);
    }
    return $value;
}
开发者ID:fka2004,项目名称:webkit,代码行数:32,代码来源:ms-blogs.php

示例7: insert_blog

function insert_blog($domain, $path, $site_id)
{
    global $wpdb;
    $path = trailingslashit($path);
    $site_id = (int) $site_id;
    $result = $wpdb->query("INSERT INTO {$wpdb->blogs} ( blog_id, site_id, domain, path, registered ) VALUES ( NULL, '{$site_id}', '{$domain}', '{$path}', NOW( ))");
    if (!$result) {
        return false;
    }
    refresh_blog_details($wpdb->insert_id);
    return $wpdb->insert_id;
}
开发者ID:alx,项目名称:blogsfera,代码行数:12,代码来源:wpmu-functions.php

示例8: update_site

 /**
  * Modify the domain and path of an existing site - and update all of its blogs
  * @param integer id ID of site to modify
  * @param string $domain new domain for site
  * @param string $path new path for site
  * @param array $meta meta keys and values to be updated
  */
 function update_site($id, $domain, $path = '', $meta = null)
 {
     global $wpdb, $url_dependent_blog_options, $wp_version;
     if (!site_exists((int) $id)) {
         return new WP_Error('site_not_exist', __('Network does not exist.', 'njsl-networks'));
     }
     $query = "SELECT * FROM {$wpdb->site} WHERE id=" . (int) $id;
     $site = $wpdb->get_row($query);
     if (!$site) {
         return new WP_Error('site_not_exist', __('Network does not exist.', 'njsl-networks'));
     }
     $domain = untrailingslashit($domain);
     $update = array('domain' => $domain);
     if ($path != '') {
         $path = trim($path, '/');
         $path = trailingslashit('/' . $path);
         $update['path'] = $path;
     }
     $where = array('id' => (int) $id);
     $update_result = $wpdb->update($wpdb->site, $update, $where);
     if (false === $update_result) {
         return new WP_Error('site_not_updatable', __('Network could not be updated.', 'njsl-networks'));
     }
     if (!empty($meta) && is_array($meta)) {
         switch_to_site($id);
         foreach ($meta as $option => $value) {
             if (false === update_site_option($option, $value)) {
                 $wpdb->insert($wpdb->sitemeta, array('site_id' => $wpdb->siteid, 'meta_key' => $option, 'meta_value' => $value));
             }
         }
         restore_current_site();
     }
     // No URL values updated -- quit before needlessly
     //   processing a bunch of URL-specific values and triggering hooks
     if (!$update_result) {
         return;
     }
     $path = $path != '' ? $path : $site->path;
     $fullPath = untrailingslashit($domain . $path);
     $oldPath = untrailingslashit($site->domain . $site->path);
     /** also updated any associated blogs */
     $query = "SELECT * FROM {$wpdb->blogs} WHERE site_id=" . (int) $id;
     $blogs = $wpdb->get_results($query);
     if ($blogs) {
         foreach ($blogs as $blog) {
             $update = array();
             if ($site->domain !== $domain) {
                 $update['domain'] = str_replace($site->domain, $domain, $blog->domain);
             }
             if ($site->path !== $path) {
                 $search = sprintf('|^%s|', preg_quote($site->path, '|'));
                 $update['path'] = preg_replace($search, $path, $blog->path, 1);
             }
             if (empty($update)) {
                 continue;
             }
             $blog_id = (int) $blog->blog_id;
             switch_to_blog($blog_id);
             $wpdb->update($wpdb->blogs, $update, array('blog_id' => $blog_id));
             foreach ($url_dependent_blog_options as $option_name) {
                 // TODO: pop upload_url_path off list if ms_files_rewriting is disabled
                 $option_value = get_option($option_name);
                 if ($option_value) {
                     $newValue = str_replace($oldPath, $fullPath, $option_value->option_value);
                     update_option($option_name, $newValue);
                 }
             }
             restore_current_blog();
             refresh_blog_details($blog_id);
         }
     }
     do_action('wpmu_update_site', $id, array('domain' => $site->domain, 'path' => $site->path));
     do_action('wpms_update_network', $id, array('domain' => $site->domain, 'path' => $site->path));
 }
开发者ID:vunh1989,项目名称:evacorp2,代码行数:81,代码来源:networks-functions.php

示例9: setup_blog

 /**
  * Sets up a blog - called from install() and new_blog()
  *
  * @param int $blog (Optional) If multisite blog_id will be passed, otherwise will be NULL.
  */
 function setup_blog($blog_id = NULL)
 {
     if (!is_null($blog_id)) {
         switch_to_blog($blog_id);
     }
     // Set admin permissions
     $role = get_role('administrator');
     $role->add_cap('edit_wiki_privileges');
     // Set default settings
     $default_settings = array('slug' => 'wiki', 'breadcrumbs_in_title' => 0, 'wiki_name' => __('Wikis', 'wiki'), 'sub_wiki_name' => __('Sub Wikis', 'wiki'), 'sub_wiki_order_by' => 'menu_order', 'sub_wiki_order' => 'ASC');
     // Migrate and delete old settings option name which isn't very intuitive
     if ($settings = get_option('wiki_default')) {
         delete_option('wiki_default');
     } else {
         $settings = get_option('wiki_settings');
     }
     // Merge settings
     if (is_array($settings)) {
         $settings = wp_parse_args($settings, $default_settings);
     } else {
         $settings = $default_settings;
     }
     // Update settings
     $this->settings = $settings;
     update_option('wiki_settings', $settings);
     update_option('wiki_flush_rewrites', 1);
     if (!is_null($blog_id)) {
         restore_current_blog();
         refresh_blog_details($blog_id);
     }
 }
开发者ID:cabelotaina,项目名称:redelivre,代码行数:36,代码来源:wiki.php

示例10: update_blog_option

/**
 * Update an option for a particular blog.
 *
 * @since MU
 * @deprecated 3.5.0
 *
 * @param int $id The blog id
 * @param string $option The option key
 * @param mixed $value The option value
 * @return bool True on success, false on failrue.
 */
function update_blog_option($id, $option, $value, $deprecated = null)
{
    _deprecated_function(__FUNCTION__, '3.5');
    $id = (int) $id;
    if (null !== $deprecated) {
        _deprecated_argument(__FUNCTION__, '3.1');
    }
    if (get_current_blog_id() == $id) {
        return update_option($option, $value);
    }
    switch_to_blog($id);
    $return = update_option($option, $value);
    restore_current_blog();
    refresh_blog_details($id);
    return $return;
}
开发者ID:rpetre,项目名称:wordpress,代码行数:27,代码来源:ms-deprecated.php

示例11: stripslashes_from_options

function stripslashes_from_options($blog_id)
{
    global $wpdb;
    if ($blog_id == 1) {
        // check site_options too
        $start = 0;
        while ($rows = $wpdb->get_results("SELECT meta_key, meta_value FROM {$wpdb->sitemeta} ORDER BY meta_id LIMIT {$start}, 20")) {
            foreach ($rows as $row) {
                $value = $row->meta_value;
                if (!@unserialize($value)) {
                    $value = stripslashes($value);
                }
                if ($value !== $row->meta_value) {
                    update_site_option($row->meta_key, $value);
                }
            }
            $start += 20;
        }
    }
    $start = 0;
    $options_table = $wpdb->get_blog_prefix($blog_id) . "options";
    while ($rows = $wpdb->get_results("SELECT option_name, option_value FROM {$options_table} ORDER BY option_id LIMIT {$start}, 20")) {
        foreach ($rows as $row) {
            $value = $row->option_value;
            if (!@unserialize($value)) {
                $value = stripslashes($value);
            }
            if ($value !== $row->option_value) {
                update_blog_option($blog_id, $row->option_name, $value);
            }
        }
        $start += 20;
    }
    refresh_blog_details($blog_id);
}
开发者ID:ericandrewlewis,项目名称:wordpress-mu,代码行数:35,代码来源:mu.php

示例12: wpmuActivate

 /**
  * Set up default terms for Front Matter and Back Matter
  * Insert default part, chapter, front matter, and back matter
  * Insert default pages (Authors, Cover, TOC, About, Buy, and Access Denied)
  * Remove content generated by wp_install_defaults
  * Anything which needs to run on blog activation must go in this function
  */
 private function wpmuActivate()
 {
     /** @var $wpdb \wpdb */
     global $wpdb;
     \Pressbooks\Taxonomy::insertTerms();
     $posts = array(array('post_title' => __('Main Body', 'pressbooks'), 'post_name' => 'main-body', 'post_type' => 'part', 'menu_order' => 1), array('post_title' => __('Introduction', 'pressbooks'), 'post_name' => 'introduction', 'post_content' => __('This is where you can write your introduction.', 'pressbooks'), 'post_type' => 'front-matter', 'menu_order' => 1), array('post_title' => __('Chapter 1', 'pressbooks'), 'post_name' => 'chapter-1', 'post_content' => __('This is the first chapter in the main body of the text. You can change the text, rename the chapter, add new chapters, and add new parts.', 'pressbooks'), 'post_type' => 'chapter', 'menu_order' => 1), array('post_title' => __('Appendix', 'pressbooks'), 'post_name' => 'appendix', 'post_content' => __('This is where you can add appendices or other back matter.', 'pressbooks'), 'post_type' => 'back-matter', 'menu_order' => 1), array('post_title' => __('Authors', 'pressbooks'), 'post_name' => 'authors', 'post_type' => 'page'), array('post_title' => __('Cover', 'pressbooks'), 'post_name' => 'cover', 'post_type' => 'page'), array('post_title' => __('Table of Contents', 'pressbooks'), 'post_name' => 'table-of-contents', 'post_type' => 'page'), array('post_title' => __('About', 'pressbooks'), 'post_name' => 'about', 'post_type' => 'page'), array('post_title' => __('Buy', 'pressbooks'), 'post_name' => 'buy', 'post_type' => 'page'), array('post_title' => __('Access Denied', 'pressbooks'), 'post_name' => 'access-denied', 'post_content' => __('This book is private, and accessible only to registered users. If you have an account you can login <a href="/wp-login.php">here</a>. You can also set up your own Pressbooks book at: <a href="http://pressbooks.com">Pressbooks.com</a>.', 'pressbooks'), 'post_type' => 'page'), array('post_title' => __('Custom CSS for Ebook', 'pressbooks'), 'post_name' => 'epub', 'post_type' => 'custom-css'), array('post_title' => __('Custom CSS for PDF', 'pressbooks'), 'post_name' => 'prince', 'post_type' => 'custom-css'), array('post_title' => __('Custom CSS for Web', 'pressbooks'), 'post_name' => 'web', 'post_type' => 'custom-css'), array('post_title' => __('Book Information', 'pressbooks'), 'post_name' => 'book-information', 'post_type' => 'metadata'));
     $post = array('post_status' => 'publish', 'comment_status' => 'open', 'post_author' => $this->user_id);
     $page = array('post_status' => 'publish', 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_content' => '<!-- Here be dragons.-->', 'post_author' => $this->user_id, 'tags_input' => __('Default Data', 'pressbooks'));
     update_option('blogdescription', __('Simple Book Production', 'pressbooks'));
     $parent_part = 0;
     $intro = 0;
     $appendix = 0;
     $chapter1 = 0;
     foreach ($posts as $item) {
         $exists = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_title = %s AND post_type = %s AND post_name = %s AND post_status = 'publish' ", array($item['post_title'], $item['post_type'], $item['post_name'])));
         if (empty($exists)) {
             if ('page' == $item['post_type']) {
                 $data = array_merge($item, $page);
             } else {
                 $data = array_merge($item, $post);
             }
             $newpost = wp_insert_post($data, true);
             if (!is_wp_error($newpost)) {
                 switch ($item['post_name']) {
                     case 'cover':
                         $this->opts['page_on_front'] = (int) $newpost;
                         break;
                     case 'table-of-contents':
                         $this->opts['page_for_posts'] = (int) $newpost;
                         break;
                 }
                 if ('part' == $item['post_type']) {
                     $parent_part = $newpost;
                 } elseif ('chapter' == $item['post_type']) {
                     $my_post = array();
                     $my_post['ID'] = $newpost;
                     $my_post['post_parent'] = $parent_part;
                     wp_update_post($my_post);
                     $chapter1 = $newpost;
                 } elseif ('front-matter' == $item['post_type']) {
                     $intro = $newpost;
                 } elseif ('back-matter' == $item['post_type']) {
                     $appendix = $newpost;
                 } elseif ('metadata' == $item['post_type']) {
                     $metadata_id = $newpost;
                     if (0 !== get_current_user_id()) {
                         $user_info = get_userdata(get_current_user_id());
                         $name = $user_info->display_name;
                         update_post_meta($metadata_id, 'pb_author', $name);
                     }
                     $locale = get_site_option('WPLANG');
                     if (!$locale) {
                         $locale = 'en';
                     } else {
                         $locale = array_search($locale, \Pressbooks\L10n\wplang_codes());
                     }
                     update_post_meta($metadata_id, 'pb_title', get_option('blogname'));
                     update_post_meta($metadata_id, 'pb_language', $locale);
                     update_post_meta($metadata_id, 'pb_cover_image', \Pressbooks\Image\default_cover_url());
                 }
             } else {
                 trigger_error($newpost->get_error_message(), E_USER_ERROR);
             }
         }
     }
     // Apply 'introduction' front matter type to 'introduction' post
     wp_set_object_terms($intro, 'introduction', 'front-matter-type');
     // Apply 'appendix' front matter type to 'appendix' post
     wp_set_object_terms($appendix, 'appendix', 'back-matter-type');
     // Apply 'standard' chapter type to 'chapter 1' post
     wp_set_object_terms($chapter1, 'standard', 'chapter-type');
     // Remove content generated by wp_install_defaults
     if (!wp_delete_post(1, true)) {
         return;
     }
     if (!wp_delete_post(2, true)) {
         return;
     }
     if (!wp_delete_comment(1, true)) {
         return;
     }
     $this->opts['pb_activated'] = time();
     refresh_blog_details($this->blog_id);
 }
开发者ID:pressbooks,项目名称:pressbooks,代码行数:91,代码来源:class-pb-activation.php

示例13: move_site

 /**
  * Move a site to a new network
  *
  * @since 1.3
  *
  * @param  integer  $site_id         ID of site to move
  * @param  integer  $new_network_id  ID of destination network
  */
 function move_site($site_id = 0, $new_network_id = 0)
 {
     global $wpdb;
     // Get the site
     $site = get_blog_details($site_id);
     // Bail if site does not exist
     if (empty($site)) {
         return new WP_Error('blog_not_exist', __('Site does not exist.', 'wp-multi-network'));
     }
     // Main sites cannot be moved, to prevent breakage
     if (is_main_site_for_network($site->blog_id)) {
         return true;
     }
     // Cast new network ID
     $new_network_id = (int) $new_network_id;
     // Return early if site does not need to be moved
     if ($new_network_id === (int) $site->site_id) {
         return true;
     }
     // Move the site is the blogs table
     $where = array('blog_id' => $site->blog_id);
     $update = array('site_id' => $new_network_id);
     $result = $wpdb->update($wpdb->blogs, $update, $where);
     // Bail if site could not be moved
     if (empty($result)) {
         return new WP_Error('blog_not_moved', __('Site could not be moved.', 'wp-multi-network'));
     }
     // Update old network count
     if (0 !== $site->site_id) {
         switch_to_network($site->site_id);
         wp_update_network_site_counts();
         restore_current_network();
     }
     // Update new network count
     if (0 !== $new_network_id) {
         switch_to_network($new_network_id);
         wp_update_network_site_counts();
         restore_current_network();
     }
     // Refresh blog details
     refresh_blog_details($site_id);
     // Clean network caches
     clean_network_cache(array_filter(array($site->site_id, $new_network_id)));
     // Site moved
     do_action('move_site', $site_id, $site->site_id, $new_network_id);
     // Return the new network ID as confirmation
     return $new_network_id;
 }
开发者ID:stuttter,项目名称:wp-multi-network,代码行数:56,代码来源:functions.php


注:本文中的refresh_blog_details函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。