function cfgp_install()
{
    /* Make domain a subdomain to example.com so there's
     * 	no possible way to navigate to it from admin or
     * 	front-end */
    $domain = CFGP_SITE_DOMAIN;
    $path = '/';
    if (!domain_exists($domain, $path, $site)) {
        $new_blog_id = create_empty_blog($domain, $path, 'CF Global Posts Blog', CFGP_SITE_ID);
        /* Make the blog private */
        update_blog_status($new_blog_id, 'public', 0);
    } else {
        error_log('Domain Already Exists');
    }
}
Exemplo n.º 2
0
 private function generate_new_blogid()
 {
     $blog_title = __('Migrated site (from UpdraftPlus)', 'updraftplus');
     if (empty($_POST['updraftplus_migrate_blogname'])) {
         $this->getinfo_form();
         return false;
     }
     // Verify value given
     $result = wpmu_validate_blog_signup($_POST['updraftplus_migrate_blogname'], $blog_title);
     if (count($result['errors']) > 0 && $result['errors']->get_error_code()) {
         if (is_wp_error($result['errors'])) {
             $err_msg = '<ul style="list-style: disc inside;">';
             foreach ($result['errors']->get_error_messages() as $key => $msg) {
                 $err_msg .= '<li><strong>' . __('Error:', 'updraftplus') . '</strong> ' . htmlspecialchars($msg) . '</li>';
             }
             $err_msg .= '</ul>';
         }
         if (isset($err_msg)) {
             $this->getinfo_form($err_msg, $_POST['updraftplus_migrate_blogname']);
             return false;
         }
     }
     $blogname = $_POST['updraftplus_migrate_blogname'];
     global $wpdb;
     if (domain_exists($result['domain'], $result['path'], $wpdb->siteid)) {
         // A WordPress-native string
         $this->getinfo_form(__('<strong>ERROR</strong>: Site URL already taken.'), $_POST['updraftplus_migrate_blogname']);
         return false;
     }
     $create = create_empty_blog($result['domain'], $result['path'], $blog_title, $wpdb->siteid);
     if (is_integer($create)) {
         $url = untrailingslashit($result['domain'] . $result['path']);
         echo '<strong>' . __('New site:', 'updraftplus') . '</strong> ' . $url . '<br>';
         // Update record of what we want to rewrite the URLs to in the search/replace operation
         // TODO: How to detect whether http or https???
         $this->siteurl = 'http://' . $url;
         // ???
         $this->home = 'http://' . $url;
         return $create;
     } else {
         $this->getinfo_form(print_r($create, true), $_POST['updraftplus_migrate_blogname']);
         return false;
     }
 }
Exemplo n.º 3
0
<?php

create_empty_blog('someteacher.schoolpress.me', '/', 'Mr. Some Teacher');