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


PHP allow_subdomain_install函数代码示例

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


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

示例1: network_step2

/**
 * Prints step 2 for Network installation process.
 *
 * @since 3.0.0
 */
function network_step2($errors = false)
{
    global $wpdb;
    $hostname = get_clean_basedomain();
    $slashed_home = trailingslashit(get_option('home'));
    $base = parse_url($slashed_home, PHP_URL_PATH);
    $document_root_fix = str_replace('\\', '/', realpath($_SERVER['DOCUMENT_ROOT']));
    $abspath_fix = str_replace('\\', '/', ABSPATH);
    $home_path = 0 === strpos($abspath_fix, $document_root_fix) ? $document_root_fix . $base : get_home_path();
    $wp_siteurl_subdir = preg_replace('#^' . preg_quote($home_path, '#') . '#', '', $abspath_fix);
    $rewrite_base = !empty($wp_siteurl_subdir) ? ltrim(trailingslashit($wp_siteurl_subdir), '/') : '';
    $location_of_wp_config = ABSPATH;
    if (!file_exists(ABSPATH . 'wp-config.php') && file_exists(dirname(ABSPATH) . '/wp-config.php')) {
        $location_of_wp_config = trailingslashit(dirname(ABSPATH));
    }
    // Wildcard DNS message.
    if (is_wp_error($errors)) {
        echo '<div class="error">' . $errors->get_error_message() . '</div>';
    }
    if ($_POST) {
        if (allow_subdomain_install()) {
            $subdomain_install = allow_subdirectory_install() ? !empty($_POST['subdomain_install']) : true;
        } else {
            $subdomain_install = false;
        }
    } else {
        if (is_multisite()) {
            $subdomain_install = is_subdomain_install();
            ?>
	<p><?php 
            _e('The original configuration steps are shown here for reference.');
            ?>
</p>
<?php 
        } else {
            $subdomain_install = (bool) $wpdb->get_var("SELECT meta_value FROM {$wpdb->sitemeta} WHERE site_id = 1 AND meta_key = 'subdomain_install'");
            ?>
	<div class="error"><p><strong><?php 
            _e('Warning:');
            ?>
</strong> <?php 
            _e('An existing WordPress network was detected.');
            ?>
</p></div>
	<p><?php 
            _e('Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.');
            ?>
</p>
<?php 
        }
    }
    $subdir_match = $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?';
    $subdir_replacement_01 = $subdomain_install ? '' : '$1';
    $subdir_replacement_12 = $subdomain_install ? '$1' : '$2';
    if ($_POST || !is_multisite()) {
        ?>
		<h3><?php 
        esc_html_e('Enabling the Network');
        ?>
</h3>
		<p><?php 
        _e('Complete the following steps to enable the features for creating a network of sites.');
        ?>
</p>
		<div class="updated inline"><p><?php 
        if (file_exists($home_path . '.htaccess')) {
            printf(__('<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.'), '.htaccess');
        } elseif (file_exists($home_path . 'web.config')) {
            printf(__('<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.'), 'web.config');
        } else {
            _e('<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> file.');
        }
        ?>
</p></div>
<?php 
    }
    ?>
		<ol>
			<li><p><?php 
    printf(__('Add the following to your <code>wp-config.php</code> file in <code>%s</code> <strong>above</strong> the line reading <code>/* That&#8217;s all, stop editing! Happy blogging. */</code>:'), $location_of_wp_config);
    ?>
</p>
				<textarea class="code" readonly="readonly" cols="100" rows="6">
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', <?php 
    echo $subdomain_install ? 'true' : 'false';
    ?>
);
define('DOMAIN_CURRENT_SITE', '<?php 
    echo $hostname;
    ?>
');
define('PATH_CURRENT_SITE', '<?php 
    echo $base;
    ?>
//.........这里部分代码省略.........
开发者ID:Nancers,项目名称:Snancy-Website-Files,代码行数:101,代码来源:network.php

示例2: esc_html

include ABSPATH . 'wp-admin/admin-header.php';
?>
<div class="wrap">
<h1><?php 
echo esc_html($title);
?>
</h1>

<?php 
if ($_POST) {
    check_admin_referer('install-network-1');
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    // Create network tables.
    install_network();
    $base = parse_url(trailingslashit(get_option('home')), PHP_URL_PATH);
    $subdomain_install = allow_subdomain_install() ? !empty($_POST['subdomain_install']) : false;
    if (!network_domain_check()) {
        $result = populate_network(1, get_clean_basedomain(), sanitize_email($_POST['email']), wp_unslash($_POST['sitename']), $base, $subdomain_install);
        if (is_wp_error($result)) {
            if (1 == count($result->get_error_codes()) && 'no_wildcard_dns' == $result->get_error_code()) {
                network_step2($result);
            } else {
                network_step1($result);
            }
        } else {
            network_step2();
        }
    } else {
        network_step2();
    }
} elseif (is_multisite() || network_domain_check()) {
开发者ID:NeftaliYagua,项目名称:WordPress,代码行数:31,代码来源:network.php

示例3: network_step2

/**
 * Prints step 2 for Network installation process.
 *
 * @since 3.0.0
 */
function network_step2($errors = false)
{
    global $base, $wpdb;
    $hostname = get_clean_basedomain();
    if (!isset($base)) {
        $base = trailingslashit(stripslashes(dirname(dirname($_SERVER['SCRIPT_NAME']))));
    }
    // Wildcard DNS message.
    if (is_wp_error($errors)) {
        echo '<div class="error">' . $errors->get_error_message() . '</div>';
    }
    if ($_POST) {
        if (allow_subdomain_install()) {
            $subdomain_install = allow_subdirectory_install() ? !empty($_POST['subdomain_install']) : true;
        } else {
            $subdomain_install = false;
        }
    } else {
        if (is_multisite()) {
            $subdomain_install = is_subdomain_install();
            ?>
	<p><?php 
            _e('The original configuration steps are shown here for reference.');
            ?>
</p>
<?php 
        } else {
            $subdomain_install = (bool) $wpdb->get_var("SELECT meta_value FROM {$wpdb->sitemeta} WHERE site_id = 1 AND meta_key = 'subdomain_install'");
            ?>
	<div class="error"><p><strong><?php 
            _e('Warning:');
            ?>
</strong> <?php 
            _e('An existing WordPress network was detected.');
            ?>
</p></div>
	<p><?php 
            _e('Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.');
            ?>
</p>
<?php 
        }
    }
    if ($_POST || !is_multisite()) {
        ?>
		<h3><?php 
        esc_html_e('Enabling the Network');
        ?>
</h3>
		<p><?php 
        _e('Complete the following steps to enable the features for creating a network of sites.');
        ?>
</p>
		<div class="updated inline"><p><?php 
        if (file_exists(ABSPATH . '.htaccess')) {
            printf(__('<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.'), '.htaccess');
        } elseif (file_exists(ABSPATH . 'web.config')) {
            printf(__('<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.'), 'web.config');
        } else {
            _e('<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> file.');
        }
        ?>
</p></div>
<?php 
    }
    ?>
		<ol>
			<li><p><?php 
    printf(__('Create a <code>blogs.dir</code> directory at <code>%s/blogs.dir</code>. This directory is used to store uploaded media for your additional sites and must be writeable by the web server.'), WP_CONTENT_DIR);
    if (WP_CONTENT_DIR != ABSPATH . 'wp-content') {
        echo ' <strong>' . __('Warning:') . ' ' . __('Networks may not be fully compatible with custom wp-content directories.') . '</strong>';
    }
    ?>
</p></li>
			<li><p><?php 
    printf(__('Add the following to your <code>wp-config.php</code> file in <code>%s</code> <strong>above</strong> the line reading <code>/* That&#8217;s all, stop editing! Happy blogging. */</code>:'), ABSPATH);
    ?>
</p>
				<textarea class="code" readonly="readonly" cols="100" rows="7">
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', <?php 
    echo $subdomain_install ? 'true' : 'false';
    ?>
);
$base = '<?php 
    echo $base;
    ?>
';
define('DOMAIN_CURRENT_SITE', '<?php 
    echo $hostname;
    ?>
');
define('PATH_CURRENT_SITE', '<?php 
    echo $base;
    ?>
//.........这里部分代码省略.........
开发者ID:batruji,项目名称:metareading,代码行数:101,代码来源:network.php

示例4: network_step2

/**
 * Prints step 2 for Network installation process.
 *
 * @since 3.0.0
 */
function network_step2($errors = false)
{
    global $base, $wpdb;
    $hostname = get_clean_basedomain();
    // Wildcard DNS message.
    if (is_wp_error($errors)) {
        echo '<div class="error">' . $errors->get_error_message() . '</div>';
    }
    if ($_POST) {
        $vhost = !allow_subdomain_install() ? false : (bool) $_POST['subdomain_install'];
    } else {
        if (is_multisite()) {
            $vhost = is_subdomain_install();
            ?>
	<div class="updated"><p><strong><?php 
            _e('Notice: The Network feature is already enabled.');
            ?>
</strong> <?php 
            _e('The original configuration steps are shown here for reference.');
            ?>
</p></div>
<?php 
        } else {
            $vhost = (bool) $wpdb->get_var("SELECT meta_value FROM {$wpdb->sitemeta} WHERE site_id = 1 AND meta_key = 'subdomain_install'");
            ?>
	<div class="error"><p><strong><?php 
            _e('Warning:');
            ?>
</strong> <?php 
            _e('An existing WordPress network was detected.');
            ?>
</p></div>
	<p><?php 
            _e('Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.');
            ?>
</p>
<?php 
        }
    }
    if ($_POST || !is_multisite()) {
        ?>
		<h3><?php 
        esc_html_e('Enabling the Network');
        ?>
</h3>
		<p><?php 
        _e('Complete the following steps to enable the features for creating a network of sites.');
        ?>
</p>
		<div class="updated inline"><p><?php 
        _e('<strong>Caution:</strong> We recommend you backup your existing <code>wp-config.php</code> and <code>.htaccess</code> files.');
        ?>
</p></div>
<?php 
    }
    ?>
		<ol>
			<li><p><?php 
    printf(__('Create a <code>blogs.dir</code> directory in <code>%s</code>. This directory is used to stored uploaded media for your additional sites and must be writeable by the web server.'), WP_CONTENT_DIR);
    ?>
</p></li>
			<li><p><?php 
    printf(__('Add the following to your <code>wp-config.php</code> file in <code>%s</code> <strong>above</strong> the line reading <code>/* That&#8217;s all, stop editing! Happy blogging. */</code>:'), ABSPATH);
    ?>
</p>
				<textarea class="code" readonly="readonly" cols="100" rows="7">
define( 'MULTISITE', true );
define( 'VHOST', '<?php 
    echo $vhost ? 'yes' : 'no';
    ?>
' );
$base = '<?php 
    echo $base;
    ?>
';
define( 'DOMAIN_CURRENT_SITE', '<?php 
    echo $hostname;
    ?>
' );
define( 'PATH_CURRENT_SITE', '<?php 
    echo $base;
    ?>
' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );</textarea>
<?php 
    $keys_salts = array('AUTH_KEY' => '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '');
    foreach ($keys_salts as $c => $v) {
        if (defined($c)) {
            unset($keys_salts[$c]);
        }
    }
    if (!empty($keys_salts)) {
        $from_api = wp_remote_get('https://api.wordpress.org/secret-key/1.1/salt/');
        if (is_wp_error($from_api)) {
//.........这里部分代码省略.........
开发者ID:beaucollins,项目名称:wp,代码行数:101,代码来源:network.php


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