コード例 #1
0
function jquery_install_remaining_sites($user)
{
    $domains = jquery_domains();
    $default_options = jquery_default_site_options();
    $default_options['admin_email'] = $user->user_email;
    foreach ($domains as $domain => $details) {
        if (1 !== $details['blog_id']) {
            $blog_id = insert_blog(JQUERY_STAGING_PREFIX . $domain, '/', 1);
            if ($blog_id != $details['blog_id']) {
                wp_die("Something went very wrong when trying to install {$domain} as site {$blog_id}-{$details['blog_id']}. Find nacin.");
            }
            switch_to_blog($blog_id);
            install_blog($blog_id, $details['options']['blogname']);
            add_user_to_blog($blog_id, $user->ID, 'administrator');
        }
        $options = array_merge($default_options, $details['options']);
        foreach ($options as $option => $value) {
            update_option($option, $value);
        }
        // Work around a superficial bug in install_blog(), fixed in WP r21172.
        $home = untrailingslashit(get_option('home'));
        $siteurl = untrailingslashit(get_option('siteurl'));
        update_option('home', 'http://example.com');
        // Please just don't ask.
        update_option('siteurl', 'http://example.com');
        update_option('home', $home);
        update_option('siteurl', $siteurl);
        flush_rewrite_rules();
        restore_current_blog();
    }
}
コード例 #2
0
ファイル: config.php プロジェクト: ravasthi/web-base-template
function jquery_com_staging_urls($content)
{
    foreach (array_keys(jquery_domains()) as $domain) {
        $content = str_replace('http://' . $domain, 'http://' . JQUERY_STAGING_PREFIX . $domain, $content);
    }
    return $content;
}
コード例 #3
0
<?php

/* Plugin Name: jQuery Filters
 * Description: Default filters, option values, and other tweaks.
 */
$live_domain = $_SERVER['HTTP_HOST'];
if (JQUERY_STAGING) {
    $live_domain = str_replace(JQUERY_STAGING_PREFIX, '', $live_domain);
}
$options = jquery_default_site_options();
$domains = jquery_domains();
$live_domain = str_replace(JQUERY_STAGING_PREFIX, '', $_SERVER['HTTP_HOST']);
$options = array_merge($options, $domains[$live_domain]['options']);
foreach ($options as $option => $value) {
    if ('stylesheet' === $option || 'template' === $option) {
        continue;
    }
    // Don't mess with themes for now.
    add_filter('pre_option_' . $option, function ($null) use($value) {
        return $value;
    });
}
unset($domains, $live_domain, $options, $option, $value);
// Disable WordPress auto-paragraphing for posts.
remove_filter('the_content', 'wpautop');
// Disable WordPress text transformations (smart quotes, etc.) for posts.
remove_filter('the_content', 'wptexturize');
// Disable more restrictive multisite upload settings.
remove_filter('upload_mimes', 'check_upload_mimes');
// Give unfiltered upload ability to super admins.
define('ALLOW_UNFILTERED_UPLOADS', true);