• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP global_terms_enabled函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: wp_install_defaults

function wp_install_defaults($user_id)
{
    global $wpdb, $wp_rewrite, $current_site, $table_prefix;
    // Default category
    $cat_name = __('Uncategorized');
    /* translators: Default category slug */
    $cat_slug = sanitize_title(_x('Uncategorized', 'Default category slug'));
    if (global_terms_enabled()) {
        $cat_id = $wpdb->get_var($wpdb->prepare("SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug));
        if ($cat_id == null) {
            $wpdb->insert($wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql', true)));
            $cat_id = $wpdb->insert_id;
        }
        update_option('default_category', $cat_id);
    } else {
        $cat_id = 1;
    }
    $wpdb->insert($wpdb->terms, array('term_id' => $cat_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0));
    $wpdb->insert($wpdb->term_taxonomy, array('term_id' => $cat_id, 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1));
    $cat_tt_id = $wpdb->insert_id;
    if (!is_multisite()) {
        update_user_meta($user_id, 'show_welcome_panel', 1);
    } elseif (!is_super_admin($user_id) && !metadata_exists('user', $user_id, 'show_welcome_panel')) {
        update_user_meta($user_id, 'show_welcome_panel', 2);
    }
    if (is_multisite()) {
        // Flush rules to pick up the new page.
        $wp_rewrite->init();
        $wp_rewrite->flush_rules();
        $user = new WP_User($user_id);
        $wpdb->update($wpdb->options, array('option_value' => $user->user_email), array('option_name' => 'admin_email'));
        // Remove all perms except for the login user.
        $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->usermeta} WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix . 'user_level'));
        $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->usermeta} WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix . 'capabilities'));
        // Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.) TODO: Get previous_blog_id.
        if (!is_super_admin($user_id) && $user_id != 1) {
            $wpdb->delete($wpdb->usermeta, array('user_id' => $user_id, 'meta_key' => $wpdb->base_prefix . '1_capabilities'));
        }
    }
    $wpdb->query("UPDATE {$wpdb->options} SET option_value = '' WHERE option_id = 3");
    $wpdb->query("UPDATE {$wpdb->options} SET option_value = '/%postname%/' WHERE option_id = 30");
}
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:42,代码来源:install.php


示例2: foreach

     foreach ((array) $users as $user) {
         if (array_pop(array_keys(unserialize($user->meta_value))) == 'subscriber') {
             $move_users[] = $user->user_id;
         }
     }
     if (false == empty($move_users)) {
         foreach ((array) $move_users as $user_id) {
             remove_user_from_blog($user_id, get_site_option('dashboard_blog'));
             add_user_to_blog($dashboard_blog_id, $user_id, get_site_option('default_user_role', 'subscriber'));
             update_user_meta($user_id, 'primary_blog', $dashboard_blog_id);
         }
     }
 }
 update_site_option('dashboard_blog', $dashboard_blog_id);
 // global terms
 if (!global_terms_enabled() && !empty($_POST['global_terms_enabled'])) {
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     // create global terms table
     install_global_terms();
 }
 $options = array('registrationnotification', 'registration', 'add_new_users', 'menu_items', 'mu_media_buttons', 'upload_space_check_disabled', 'blog_upload_space', 'upload_filetypes', 'site_name', 'first_post', 'first_page', 'first_comment', 'first_comment_url', 'first_comment_author', 'welcome_email', 'welcome_user_email', 'fileupload_maxk', 'admin_notice_feed', 'global_terms_enabled');
 $checked_options = array('mu_media_buttons' => array(), 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1);
 foreach ($checked_options as $option_name => $option_unchecked_value) {
     if (!isset($_POST[$option_name])) {
         $_POST[$option_name] = $option_unchecked_value;
     }
 }
 foreach ($options as $option_name) {
     if (!isset($_POST[$option_name])) {
         continue;
     }
开发者ID:beaucollins,项目名称:wp,代码行数:31,代码来源:ms-edit.php


示例3: inline_edit

    /**
     * Outputs the hidden row displayed when inline editing
     *
     * @since 3.1.0
     */
    public function inline_edit()
    {
        $tax = get_taxonomy($this->screen->taxonomy);
        if (!current_user_can($tax->cap->edit_terms)) {
            return;
        }
        ?>

	<form method="get"><table style="display: none"><tbody id="inlineedit">
		<tr id="inline-edit" class="inline-edit-row" style="display: none"><td colspan="<?php 
        echo $this->get_column_count();
        ?>
" class="colspanchange">

			<fieldset><div class="inline-edit-col">
				<h4><?php 
        _e('Quick Edit');
        ?>
</h4>

				<label>
					<span class="title"><?php 
        _ex('Name', 'term name');
        ?>
</span>
					<span class="input-text-wrap"><input type="text" name="name" class="ptitle" value="" /></span>
				</label>
	<?php 
        if (!global_terms_enabled()) {
            ?>
				<label>
					<span class="title"><?php 
            _e('Slug');
            ?>
</span>
					<span class="input-text-wrap"><input type="text" name="slug" class="ptitle" value="" /></span>
				</label>
	<?php 
        }
        ?>
			</div></fieldset>
	<?php 
        $core_columns = array('cb' => true, 'description' => true, 'name' => true, 'slug' => true, 'posts' => true);
        list($columns) = $this->get_column_info();
        foreach ($columns as $column_name => $column_display_name) {
            if (isset($core_columns[$column_name])) {
                continue;
            }
            /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
            do_action('quick_edit_custom_box', $column_name, 'edit-tags', $this->screen->taxonomy);
        }
        ?>

		<p class="inline-edit-save submit">
			<a href="#inline-edit" class="cancel button-secondary alignleft"><?php 
        _e('Cancel');
        ?>
</a>
			<a href="#inline-edit" class="save button-primary alignright"><?php 
        echo $tax->labels->update_item;
        ?>
</a>
			<span class="spinner"></span>
			<span class="error" style="display:none;"></span>
			<?php 
        wp_nonce_field('taxinlineeditnonce', '_inline_edit', false);
        ?>
			<input type="hidden" name="taxonomy" value="<?php 
        echo esc_attr($this->screen->taxonomy);
        ?>
" />
			<input type="hidden" name="post_type" value="<?php 
        echo esc_attr($this->screen->post_type);
        ?>
" />
			<br class="clear" />
		</p>
		</td></tr>
		</tbody></table></form>
	<?php 
    }
开发者ID:Plego,项目名称:toyoa,代码行数:86,代码来源:class-wp-terms-list-table.php


示例4: capability_is_global_terms_disabled

 /**
  * Control hidden if global terms is enabled
  *
  * @param WP_Fields_API_Control $control
  *
  * @return bool
  */
 public function capability_is_global_terms_disabled($control)
 {
     return !global_terms_enabled();
 }
开发者ID:machouinard,项目名称:wordpress-fields-api,代码行数:11,代码来源:class-wp-fields-api-form-term.php


示例5: inline_edit

    /**
     * Outputs the hidden row displayed when inline editing
     *
     * @since 3.1.0
     */
    function inline_edit()
    {
        global $tax;
        if (!current_user_can($tax->cap->edit_terms)) {
            return;
        }
        ?>

	<form method="get" action=""><table style="display: none"><tbody id="inlineedit">
		<tr id="inline-edit" class="inline-edit-row" style="display: none"><td colspan="<?php 
        echo $this->get_column_count();
        ?>
" class="colspanchange">

			<fieldset><div class="inline-edit-col">
				<h4><?php 
        _e('Quick Edit');
        ?>
</h4>

				<label>
					<span class="title"><?php 
        _e('Name');
        ?>
</span>
					<span class="input-text-wrap"><input type="text" name="name" class="ptitle" value="" /></span>
				</label>
	<?php 
        if (!global_terms_enabled()) {
            ?>
				<label>
					<span class="title"><?php 
            _e('Slug');
            ?>
</span>
					<span class="input-text-wrap"><input type="text" name="slug" class="ptitle" value="" /></span>
				</label>
	<?php 
        }
        ?>
			</div></fieldset>
	<?php 
        $core_columns = array('cb' => true, 'description' => true, 'name' => true, 'slug' => true, 'posts' => true);
        list($columns) = $this->get_column_info();
        foreach ($columns as $column_name => $column_display_name) {
            if (isset($core_columns[$column_name])) {
                continue;
            }
            do_action('quick_edit_custom_box', $column_name, 'edit-tags', $tax->name);
        }
        ?>

		<p class="inline-edit-save submit">
			<a accesskey="c" href="#inline-edit" title="<?php 
        _e('Cancel');
        ?>
" class="cancel button-secondary alignleft"><?php 
        _e('Cancel');
        ?>
</a>
			<?php 
        $update_text = $tax->labels->update_item;
        ?>
			<a accesskey="s" href="#inline-edit" title="<?php 
        echo esc_attr($update_text);
        ?>
" class="save button-primary alignright"><?php 
        echo $update_text;
        ?>
</a>
			<img class="waiting" style="display:none;" src="<?php 
        echo esc_url(admin_url('images/wpspin_light.gif'));
        ?>
" alt="" />
			<span class="error" style="display:none;"></span>
			<?php 
        wp_nonce_field('taxinlineeditnonce', '_inline_edit', false);
        ?>
			<input type="hidden" name="taxonomy" value="<?php 
        echo esc_attr($tax->name);
        ?>
" />
			<br class="clear" />
		</p>
		</td></tr>
		</tbody></table></form>
	<?php 
    }
开发者ID:Esleelkartea,项目名称:herramienta_para_autodiagnostico_ADEADA,代码行数:93,代码来源:class-wp-terms-list-table.php


示例6: wp_install_defaults

 /**
  * {@internal Missing Short Description}}
  *
  * {@internal Missing Long Description}}
  *
  * @since 2.1.0
  *
  * @param int $user_id User ID.
  */
 function wp_install_defaults($user_id)
 {
     global $wpdb, $wp_rewrite, $current_site, $table_prefix;
     // Default category
     $cat_name = __('Uncategorized');
     /* translators: Default category slug */
     $cat_slug = sanitize_title(_x('Uncategorized', 'Default category slug'));
     if (global_terms_enabled()) {
         $cat_id = $wpdb->get_var($wpdb->prepare("SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug));
         if ($cat_id == null) {
             $wpdb->insert($wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql', true)));
             $cat_id = $wpdb->insert_id;
         }
         update_option('default_category', $cat_id);
     } else {
         $cat_id = 1;
     }
     $wpdb->insert($wpdb->terms, array('term_id' => $cat_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0));
     $wpdb->insert($wpdb->term_taxonomy, array('term_id' => $cat_id, 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1));
     $cat_tt_id = $wpdb->insert_id;
     // Default link category
     $cat_name = __('Blogroll');
     /* translators: Default link category slug */
     $cat_slug = sanitize_title(_x('Blogroll', 'Default link category slug'));
     if (global_terms_enabled()) {
         $blogroll_id = $wpdb->get_var($wpdb->prepare("SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug));
         if ($blogroll_id == null) {
             $wpdb->insert($wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql', true)));
             $blogroll_id = $wpdb->insert_id;
         }
         update_option('default_link_category', $blogroll_id);
     } else {
         $blogroll_id = 2;
     }
     $wpdb->insert($wpdb->terms, array('term_id' => $blogroll_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0));
     $wpdb->insert($wpdb->term_taxonomy, array('term_id' => $blogroll_id, 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 7));
     $blogroll_tt_id = $wpdb->insert_id;
     //jalg 02022013
     // Default link category
     $cat_name = __('Library');
     /* translators: Default link category slug */
     $cat_slug = sanitize_title(_x('Library', 'Default link category slug'));
     $wpdb->insert($wpdb->terms, array('name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0));
     $wpdb->insert($wpdb->term_taxonomy, array('term_id' => '3', 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 8));
     // Now drop in some default links
     $default_links = array();
     $default_links[] = array('link_url' => get_option('home') . '/../opac', 'link_name' => 'OPAC', 'link_rss' => '', 'link_notes' => '');
     $default_links[] = array('link_url' => get_option('home') . '/../admin', 'link_name' => 'Administración de la Biblioteca', 'link_rss' => '', 'link_notes' => '');
     //jalg 02022013
     $default_links[] = array('link_url' => __('http://codex.wordpress.org/'), 'link_name' => __('Documentation'), 'link_rss' => '', 'link_notes' => '');
     $default_links[] = array('link_url' => __('http://wordpress.org/news/'), 'link_name' => __('WordPress Blog'), 'link_rss' => __('http://wordpress.org/news/feed/'), 'link_notes' => '');
     $default_links[] = array('link_url' => __('http://wordpress.org/support/'), 'link_name' => _x('Support Forums', 'default link'), 'link_rss' => '', 'link_notes' => '');
     $default_links[] = array('link_url' => 'http://wordpress.org/extend/plugins/', 'link_name' => _x('Plugins', 'Default link to wordpress.org/extend/plugins/'), 'link_rss' => '', 'link_notes' => '');
     $default_links[] = array('link_url' => 'http://wordpress.org/extend/themes/', 'link_name' => _x('Themes', 'Default link to wordpress.org/extend/themes/'), 'link_rss' => '', 'link_notes' => '');
     $default_links[] = array('link_url' => __('http://wordpress.org/support/forum/requests-and-feedback'), 'link_name' => __('Feedback'), 'link_rss' => '', 'link_notes' => '');
     $default_links[] = array('link_url' => __('http://planet.wordpress.org/'), 'link_name' => __('WordPress Planet'), 'link_rss' => '', 'link_notes' => '');
     foreach ($default_links as $link) {
         $wpdb->insert($wpdb->links, $link);
         $wpdb->insert($wpdb->term_relationships, array('term_taxonomy_id' => $blogroll_tt_id, 'object_id' => $wpdb->insert_id));
     }
     // First post
     $now = date('Y-m-d H:i:s');
     $now_gmt = gmdate('Y-m-d H:i:s');
     $first_post_guid = get_option('home') . '/?p=1';
     if (is_multisite()) {
         $first_post = get_site_option('first_post');
         if (empty($first_post)) {
             $first_post = stripslashes(__('Welcome to <a href="SITE_URL">SITE_NAME</a>. This is your first post. Edit or delete it, then start blogging!'));
         }
         $first_post = str_replace("SITE_URL", esc_url(network_home_url()), $first_post);
         $first_post = str_replace("SITE_NAME", $current_site->site_name, $first_post);
     } else {
         $first_post = __('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!');
     }
     $wpdb->insert($wpdb->posts, array('post_author' => $user_id, 'post_date' => $now, 'post_date_gmt' => $now_gmt, 'post_content' => $first_post, 'post_excerpt' => '', 'post_title' => __('Hello world!'), 'post_name' => sanitize_title(_x('hello-world', 'Default post slug')), 'post_modified' => $now, 'post_modified_gmt' => $now_gmt, 'guid' => $first_post_guid, 'comment_count' => 1, 'to_ping' => '', 'pinged' => '', 'post_content_filtered' => ''));
     $wpdb->insert($wpdb->term_relationships, array('term_taxonomy_id' => $cat_tt_id, 'object_id' => 1));
     // Default comment
     $first_comment_author = __('Mr WordPress');
     $first_comment_url = 'http://wordpress.org/';
     $first_comment = __('Hi, this is a comment.<br />To delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.');
     if (is_multisite()) {
         $first_comment_author = get_site_option('first_comment_author', $first_comment_author);
         $first_comment_url = get_site_option('first_comment_url', network_home_url());
         $first_comment = get_site_option('first_comment', $first_comment);
     }
     $wpdb->insert($wpdb->comments, array('comment_post_ID' => 1, 'comment_author' => $first_comment_author, 'comment_author_email' => '', 'comment_author_url' => $first_comment_url, 'comment_date' => $now, 'comment_date_gmt' => $now_gmt, 'comment_content' => $first_comment));
     // First Page
     $first_page = sprintf(__("This is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:\n\n<blockquote>Hi there! I'm a bike messenger by day, aspiring actor by night, and this is my blog. I live in Los Angeles, have a great dog named Jack, and I like pi&#241;a coladas. (And gettin' caught in the rain.)</blockquote>\n\n...or something like this:\n\n<blockquote>The XYZ Doohickey Company was founded in 1971, and has been providing quality doohickies to the public ever since. Located in Gotham City, XYZ employs over 2,000 people and does all kinds of awesome things for the Gotham community.</blockquote>\n\nAs a new WordPress user, you should go to <a href=\"%s\">your dashboard</a> to delete this page and create new pages for your content. Have fun!"), admin_url());
     if (is_multisite()) {
         $first_page = get_site_option('first_page', $first_page);
     }
//.........这里部分代码省略.........
开发者ID:Giordano-Bruno,项目名称:GiordanoBruno,代码行数:101,代码来源:upgrade.php


示例7: populate_network

/**
 * Populate network settings.
 *
 * @since 3.0.0
 *
 * @global wpdb       $wpdb
 * @global object     $current_site
 * @global int        $wp_db_version
 * @global WP_Rewrite $wp_rewrite
 *
 * @param int $network_id ID of network to populate.
 * @return bool|WP_Error True on success, or WP_Error on warning (with the install otherwise successful,
 *                       so the error code must be checked) or failure.
 */
function populate_network($network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false)
{
    global $wpdb, $current_site, $wp_db_version, $wp_rewrite;
    $errors = new WP_Error();
    if ('' == $domain) {
        $errors->add('empty_domain', __('You must provide a domain name.'));
    }
    if ('' == $site_name) {
        $errors->add('empty_sitename', __('You must provide a name for your network of sites.'));
    }
    // Check for network collision.
    if ($network_id == $wpdb->get_var($wpdb->prepare("SELECT id FROM {$wpdb->site} WHERE id = %d", $network_id))) {
        $errors->add('siteid_exists', __('The network already exists.'));
    }
    if (!is_email($email)) {
        $errors->add('invalid_email', __('You must provide a valid email address.'));
    }
    if ($errors->get_error_code()) {
        return $errors;
    }
    // If a user with the provided email does not exist, default to the current user as the new network admin.
    $site_user = get_user_by('email', $email);
    if (false === $site_user) {
        $site_user = wp_get_current_user();
    }
    // Set up site tables.
    $template = get_option('template');
    $stylesheet = get_option('stylesheet');
    $allowed_themes = array($stylesheet => true);
    if ($template != $stylesheet) {
        $allowed_themes[$template] = true;
    }
    if (WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template) {
        $allowed_themes[WP_DEFAULT_THEME] = true;
    }
    // If WP_DEFAULT_THEME doesn't exist, also whitelist the latest core default theme.
    if (!wp_get_theme(WP_DEFAULT_THEME)->exists()) {
        if ($core_default = WP_Theme::get_core_default_theme()) {
            $allowed_themes[$core_default->get_stylesheet()] = true;
        }
    }
    if (1 == $network_id) {
        $wpdb->insert($wpdb->site, array('domain' => $domain, 'path' => $path));
        $network_id = $wpdb->insert_id;
    } else {
        $wpdb->insert($wpdb->site, array('domain' => $domain, 'path' => $path, 'id' => $network_id));
    }
    wp_cache_delete('networks_have_paths', 'site-options');
    if (!is_multisite()) {
        $site_admins = array($site_user->user_login);
        $users = get_users(array('fields' => array('ID', 'user_login')));
        if ($users) {
            foreach ($users as $user) {
                if (is_super_admin($user->ID) && !in_array($user->user_login, $site_admins)) {
                    $site_admins[] = $user->user_login;
                }
            }
        }
    } else {
        $site_admins = get_site_option('site_admins');
    }
    /* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */
    $welcome_email = __('Howdy USERNAME,

Your new SITE_NAME site has been successfully set up at:
BLOG_URL

You can log in to the administrator account with the following information:

Username: USERNAME
Password: PASSWORD
Log in here: BLOG_URLwp-login.php

We hope you enjoy your new site. Thanks!

--The Team @ SITE_NAME');
    $misc_exts = array('jpg', 'jpeg', 'png', 'gif', 'mov', 'avi', 'mpg', '3gp', '3g2', 'midi', 'mid', 'pdf', 'doc', 'ppt', 'odt', 'pptx', 'docx', 'pps', 'ppsx', 'xls', 'xlsx', 'key');
    $audio_exts = wp_get_audio_extensions();
    $video_exts = wp_get_video_extensions();
    $upload_filetypes = array_unique(array_merge($misc_exts, $audio_exts, $video_exts));
    $sitemeta = array('site_name' => $site_name, 'admin_email' => $email, 'admin_user_id' => $site_user->ID, 'registration' => 'none', 'upload_filetypes' => implode(' ', $upload_filetypes), 'blog_upload_space' => 100, 'fileupload_maxk' => 1500, 'site_admins' => $site_admins, 'allowedthemes' => $allowed_themes, 'illegal_names' => array('www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files'), 'wpmu_upgrade_site' => $wp_db_version, 'welcome_email' => $welcome_email, 'first_post' => __('Welcome to %s. This is your first post. Edit or delete it, then start blogging!'), 'siteurl' => get_option('siteurl') . '/', 'add_new_users' => '0', 'upload_space_check_disabled' => is_multisite() ? get_site_option('upload_space_check_disabled') : '1', 'subdomain_install' => intval($subdomain_install), 'global_terms_enabled' => global_terms_enabled() ? '1' : '0', 'ms_files_rewriting' => is_multisite() ? get_site_option('ms_files_rewriting') : '0', 'initial_db_version' => get_option('initial_db_version'), 'active_sitewide_plugins' => array(), 'WPLANG' => get_locale());
    if (!$subdomain_install) {
        $sitemeta['illegal_names'][] = 'blog';
    }
    /**
     * Filter meta for a network on creation.
//.........这里部分代码省略.........
开发者ID:x3mgroup,项目名称:wordpress-mod,代码行数:101,代码来源:schema.php


示例8: wp_install_defaults

 /**
  * {@internal Missing Short Description}}
  *
  * {@internal Missing Long Description}}
  *
  * @since unknown
  *
  * @param int $user_id User ID.
  */
 function wp_install_defaults($user_id)
 {
     global $wpdb, $wp_rewrite, $current_site, $table_prefix;
     // Default category
     $cat_name = __('Uncategorized');
     /* translators: Default category slug */
     $cat_slug = sanitize_title(_x('Uncategorized', 'Default category slug'));
     if (global_terms_enabled()) {
         $cat_id = $wpdb->get_var($wpdb->prepare("SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug));
         if ($cat_id == null) {
             $wpdb->insert($wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql', true)));
             $cat_id = $wpdb->insert_id;
         }
         update_option('default_category', $cat_id);
     } else {
         $cat_id = 1;
     }
     $wpdb->insert($wpdb->terms, array('term_id' => $cat_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0));
     $wpdb->insert($wpdb->term_taxonomy, array('term_id' => $cat_id, 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1));
     $cat_tt_id = $wpdb->insert_id;
     // Default link category
     $cat_name = __('Blogroll');
     /* translators: Default link category slug */
     $cat_slug = sanitize_title(_x('Blogroll', 'Default link category slug'));
     if (global_terms_enabled()) {
         $blogroll_id = $wpdb->get_var($wpdb->prepare("SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug));
         if ($blogroll_id == null) {
             $wpdb->insert($wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql', true)));
             $blogroll_id = $wpdb->insert_id;
         }
         update_option('default_link_category', $blogroll_id);
     } else {
         $blogroll_id = 2;
     }
     $wpdb->insert($wpdb->terms, array('term_id' => $blogroll_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0));
     $wpdb->insert($wpdb->term_taxonomy, array('term_id' => $blogroll_id, 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 7));
     $blogroll_tt_id = $wpdb->insert_id;
     // Now drop in some default links
     $default_links = array();
     $default_links[] = array('link_url' => 'http://codex.wordpress.org/', 'link_name' => 'Documentation', 'link_rss' => '', 'link_notes' => '');
     $default_links[] = array('link_url' => 'http://wordpress.org/development/', 'link_name' => 'Development Blog', 'link_rss' => 'http://wordpress.org/development/feed/', 'link_notes' => '');
     $default_links[] = array('link_url' => 'http://wordpress.org/extend/ideas/', 'link_name' => 'Suggest Ideas', 'link_rss' => '', 'link_notes' => '');
     $default_links[] = array('link_url' => 'http://wordpress.org/support/', 'link_name' => 'Support Forum', 'link_rss' => '', 'link_notes' => '');
     $default_links[] = array('link_url' => 'http://wordpress.org/extend/plugins/', 'link_name' => 'Plugins', 'link_rss' => '', 'link_notes' => '');
     $default_links[] = array('link_url' => 'http://wordpress.org/extend/themes/', 'link_name' => 'Themes', 'link_rss' => '', 'link_notes' => '');
     $default_links[] = array('link_url' => 'http://planet.wordpress.org/', 'link_name' => 'WordPress Planet', 'link_rss' => '', 'link_notes' => '');
     foreach ($default_links as $link) {
         $wpdb->insert($wpdb->links, $link);
         $wpdb->insert($wpdb->term_relationships, array('term_taxonomy_id' => $blogroll_tt_id, 'object_id' => $wpdb->insert_id));
     }
     // First post
     $now = date('Y-m-d H:i:s');
     $now_gmt = gmdate('Y-m-d H:i:s');
     $first_post_guid = get_option('home') . '/?p=1';
     if (is_multisite()) {
         $first_post = get_site_option('first_post');
         if (empty($first_post)) {
             $first_post = stripslashes(__('Welcome to <a href="SITE_URL">SITE_NAME</a>. This is your first post. Edit or delete it, then start blogging!'));
         }
         $first_post = str_replace("SITE_URL", esc_url("http://" . $current_site->domain . $current_site->path), $first_post);
         $first_post = str_replace("SITE_NAME", $current_site->site_name, $first_post);
     } else {
         $first_post = __('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!');
     }
     $wpdb->insert($wpdb->posts, array('post_author' => $user_id, 'post_date' => $now, 'post_date_gmt' => $now_gmt, 'post_content' => $first_post, 'post_excerpt' => '', 'post_title' => __('Hello world!'), 'post_name' => sanitize_title(_x('hello-world', 'Default post slug')), 'post_modified' => $now, 'post_modified_gmt' => $now_gmt, 'guid' => $first_post_guid, 'comment_count' => 1, 'to_ping' => '', 'pinged' => '', 'post_content_filtered' => ''));
     $wpdb->insert($wpdb->term_relationships, array('term_taxonomy_id' => $cat_tt_id, 'object_id' => 1));
     // Default comment
     $first_comment_author = __('Mr WordPress');
     $first_comment_url = 'http://wordpress.org/';
     $first_comment = __('Hi, this is a comment.<br />To delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.');
     if (is_multisite()) {
         $first_comment_author = get_site_option('first_comment_author', $first_comment_author);
         $first_comment_url = get_site_option('first_comment_url', 'http://' . $current_site->domain . $current_site->path);
         $first_comment = get_site_option('first_comment', $first_comment);
     }
     $wpdb->insert($wpdb->comments, array('comment_post_ID' => 1, 'comment_author' => $first_comment_author, 'comment_author_email' => '', 'comment_author_url' => $first_comment_url, 'comment_date' => $now, 'comment_date_gmt' => $now_gmt, 'comment_content' => $first_comment));
     // First Page
     $first_page = __('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.');
     if (is_multisite()) {
         $first_page = get_site_option('first_page', $first_page);
     }
     $first_post_guid = get_option('home') . '/?page_id=2';
     $wpdb->insert($wpdb->posts, array('post_author' => $user_id, 'post_date' => $now, 'post_date_gmt' => $now_gmt, 'post_content' => $first_page, 'post_excerpt' => '', 'post_title' => __('About'), 'post_name' => _x('about', 'Default page slug'), 'post_modified' => $now, 'post_modified_gmt' => $now_gmt, 'guid' => $first_post_guid, 'post_type' => 'page', 'to_ping' => '', 'pinged' => '', 'post_content_filtered' => ''));
     $wpdb->insert($wpdb->postmeta, array('post_id' => 2, 'meta_key' => '_wp_page_template', 'meta_value' => 'default'));
     // Setup default widgets for default theme.
     update_option('widget_search', array(2 => array('title' => ''), '_multiwidget' => 1));
     update_option('widget_recent-posts', array(2 => array('title' => '', 'number' => 5), '_multiwidget' => 1));
     update_option('widget_recent-comments', array(2 => array('title' => '', 'number' => 5), '_multiwidget' => 1));
     update_option('widget_archives', array(2 => array('title' => '', 'count' => 0, 'dropdown' => 0), '_multiwidget' => 1));
     update_option('widget_categories', array(2 => array('title' => '', 'count' => 0, 'hierarchical' => 0, 'dropdown' => 0), '_multiwidget' => 1));
     update_option('widget_meta', array(2 => array('title' => ''), '_multiwidget' => 1));
//.........这里部分代码省略.........
开发者ID:beaucollins,项目名称:wp,代码行数:101,代码来源:upgrade.php


示例9: wp_install_defaults

    /**
     * {@internal Missing Short Description}}
     *
     * {@internal Missing Long Description}}
     *
     * @since 2.1.0
     *
     * @param int $user_id User ID.
     */
    function wp_install_defaults($user_id)
    {
        global $wpdb, $wp_rewrite, $current_site, $table_prefix;
        // Default category
        $cat_name = __('Uncategorized');
        /* translators: Default category slug */
        $cat_slug = sanitize_title(_x('Uncategorized', 'Default category slug'));
        if (global_terms_enabled()) {
            $cat_id = $wpdb->get_var($wpdb->prepare("SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug));
            if ($cat_id == null) {
                $wpdb->insert($wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql', true)));
                $cat_id = $wpdb->insert_id;
            }
            update_option('default_category', $cat_id);
        } else {
            $cat_id = 1;
        }
        $wpdb->insert($wpdb->terms, array('term_id' => $cat_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0));
        $wpdb->insert($wpdb->term_taxonomy, array('term_id' => $cat_id, 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1));
        $cat_tt_id = $wpdb->insert_id;
        // First post
        $now = date('Y-m-d H:i:s');
        $now_gmt = gmdate('Y-m-d H:i:s');
        $first_post_guid = get_option('home') . '/?p=1';
        if (is_multisite()) {
            $first_post = get_site_option('first_post');
            if (empty($first_post)) {
                $first_post = stripslashes(__('Welcome to <a href="SITE_URL">SITE_NAME</a>. This is your first post. Edit or delete it, then start blogging!'));
            }
            $first_post = str_replace("SITE_URL", esc_url(network_home_url()), $first_post);
            $first_post = str_replace("SITE_NAME", $current_site->site_name, $first_post);
        } else {
            $first_post = __('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!');
        }
        $wpdb->insert($wpdb->posts, array('post_author' => $user_id, 'post_date' => $now, 'post_date_gmt' => $now_gmt, 'post_content' => $first_post, 'post_excerpt' => '', 'post_title' => __('Hello world!'), 'post_name' => sanitize_title(_x('hello-world', 'Default post slug')), 'post_modified' => $now, 'post_modified_gmt' => $now_gmt, 'guid' => $first_post_guid, 'comment_count' => 1, 'to_ping' => '', 'pinged' => '', 'post_content_filtered' => ''));
        $wpdb->insert($wpdb->term_relationships, array('term_taxonomy_id' => $cat_tt_id, 'object_id' => 1));
        // Default comment
        $first_comment_author = __('Mr WordPress');
        $first_comment_url = 'http://wordpress.org/';
        $first_comment = __('Hi, this is a comment.
To delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.');
        if (is_multisite()) {
            $first_comment_author = get_site_option('first_comment_author', $first_comment_author);
            $first_comment_url = get_site_option('first_comment_url', network_home_url());
            $first_comment = get_site_option('first_comment', $first_comment);
        }
        $wpdb->insert($wpdb->comments, array('comment_post_ID' => 1, 'comment_author' => $first_comment_author, 'comment_author_email' => '', 'comment_author_url' => $first_comment_url, 'comment_date' => $now, 'comment_date_gmt' => $now_gmt, 'comment_content' => $first_comment));
        /**
         * =============== News and Promotion Page =================
         * Show news and promotions page
         * Page Title : ข่าวและโปรโมชั่น
         * ======================================================
         */
        $first_page = '[srp widget_title=""]';
        $first_post_guid = get_option('home') . '/?page_id=2';
        $wpdb->insert($wpdb->posts, array('post_author' => $user_id, 'post_date' => $now, 'post_date_gmt' => $now_gmt, 'post_content' => $first_page, 'post_excerpt' => '', 'post_title' => __('ข่าวและโปรโมชั่น'), 'post_name' => sanitize_title(_x('ข่าวและโปรโมชั่น', 'Default post slug')), 'post_modified' => $now, 'post_modified_gmt' => $now_gmt, 'guid' => $first_post_guid, 'post_type' => 'page', 'to_ping' => '', 'pinged' => '', 'post_content_filtered' => '', 'comment_status' => 'closed'));
        $wpdb->insert($wpdb->postmeta, array('post_id' => 2, 'meta_key' => '_wp_page_template', 'meta_value' => 'page_r.php'));
        // ----------- End create news/promotions page.
        /**
         * =============== About Srikrung Page =================
         * Statis page created when create new multisite.
         * Page Title : เกี่ยวกับศรีกรุงโปรคเกอร์
         * ======================================================
         */
        $first_page = '<img class="aligncenter size-full wp-image-412" alt="SK Bio For Web-01" src="http://localhost/srikrung/wp-content/uploads/2013/06/SK-Bio-For-Web-011.jpg" width="800" height="600" />';
        $first_post_guid = get_option('home') . '/?page_id=3';
        $wpdb->insert($wpdb->posts, array('post_author' => $user_id, 'post_date' => $now, 'post_date_gmt' => $now_gmt, 'post_content' => $first_page, 'post_excerpt' => '', 'post_title' => __('รู้จักศรีกรุงโปรคเกอร์'), 'post_name' => sanitize_title(_x('รู้จักศรีกรุงโปรคเกอร์', 'Default post slug')), 'post_modified' => $now, 'post_modified_gmt' => $now_gmt, 'guid' => $first_post_guid, 'post_type' => 'page', 'to_ping' => '', 'pinged' => '', 'post_content_filtered' => '', 'comment_status' => 'closed'));
        $wpdb->insert($wpdb->postmeta, array('post_id' => 3, 'meta_key' => '_wp_page_template', 'meta_value' => 'default'));
        // ----------- End create about Srikrung page.
        /**
         * =============== Contact us Page =================
         * Show news and promotions page
         * Page Title : ติดต่อเรา
         * ======================================================
         */
        $first_page = '';
        $first_post_guid = get_option('home') . '/?page_id=4';
        $wpdb->insert($wpdb->posts, array('post_author' => $user_id, 'post_date' => $now, 'post_date_gmt' => $now_gmt, 'post_content' => $first_page, 'post_excerpt' => '', 'post_title' => __('ติดต่อเรา'), 'post_name' => sanitize_title(_x('ติดต่อเรา', 'Default post slug')), 'post_modified' => $now, 'post_modified_gmt' => $now_gmt, 'guid' => $first_post_guid, 'post_type' => 'page', 'to_ping' => '', 'pinged' => '', 'post_content_filtered' => '', 'comment_status' => 'closed'));
        $wpdb->insert($wpdb->postmeta, array('post_id' => 4, 'meta_key' => '_wp_page_template', 'meta_value' => 'contact.php'));
        // ----------- End create Contact us page.
        // Set up default widgets for default theme.
        update_option('widget_search', array(2 => array('title' => ''), '_multiwidget' => 1));
        update_option('widget_recent-posts', array(2 => array('title' => '', 'number' => 5), '_multiwidget' => 1));
        update_option('widget_recent-comments', array(2 => array('title' => '', 'number' => 5), '_multiwidget' => 1));
        update_option('widget_archives', array(2 => array('title' => '', 'count' => 0, 'dropdown' => 0), '_multiwidget' => 1));
        update_option('widget_categories', array(2 => array('title' => '', 'count' => 0, 'hierarchical' => 0, 'dropdown' => 0), '_multiwidget' => 1));
        update_option('widget_meta', array(2 => array('title' => ''), '_multiwidget' => 1));
        update_option('sidebars_widgets', array('wp_inactive_widgets' => array(), 'sidebar-1' => array(0 => 'search-2', 1 => 'recent-posts-2', 2 => 'recent-comments-2', 3 => 'archives-2', 4 => 'categories-2', 5 => 'meta-2'), 'sidebar-2' => array(), 'sidebar-3' => array(), 'array_version' => 3));
        if (!is_multisite()) {
            update_user_meta($user_id, 'show_welcome_panel', 1);
        } elseif (!is_super_admin($user_id) && !metadata_exists('user', $user_id, 'show_welcome_panel')) {
//.........这里部分代码省略.........
开发者ID:googlecode-mirror,项目名称:wpmu-demo,代码行数:101,代码来源:upgrade.php


示例10: wp_install_defaults

function wp_install_defaults($user_id)
{
    global $wpdb, $wp_rewrite, $current_site, $table_prefix;
    // Let's customize our default WordPress options
    // @link http://codex.wordpress.org/Option_Reference
    // My preferred permalink structure
    update_option('permalink_structure', '/%category%/%postname%');
    // Changed from 'posts' to 'page'
    update_option('show_on_front', 'page');
    // Make our home page be the front page
    update_option('page_on_front', 1);
    // Turned this on so you can create content from apps
    update_option('enable_app', 1);
    update_option('enable_xmlrpc', 1);
    // Disable comments by default
    update_option('default_comment_status', 'closed');
    // Hide the Toolbar on the front-end
    show_admin_bar(false);
    // Make our theme the default one
    switch_theme('orbit', 'orbit');
    // Remove Hello Dolly and Akismet plugins
    require_once ABSPATH . 'wp-admin/includes/plugin.php';
    require_once ABSPATH . 'wp-admin/includes/file.php';
    if (file_exists(WP_PLUGIN_DIR . '/hello.php') || file_exists(WP_PLUGIN_DIR . 'akismet/akismet.php')) {
        delete_plugins(array('hello.php', 'akismet/akismet.php'));
    }
    // Default category (we rename it from 'Uncategorized' to 'General')
    $cat_name = __('General');
    // translators: Default category slug
    $cat_slug = sanitize_title(_x('General', 'Default category slug'));
    if (global_terms_enabled()) {
        $cat_id = $wpdb->get_var($wpdb->prepare("SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug));
        if ($cat_id == null) {
            $wpdb->insert($wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql', true)));
            $cat_id = $wpdb->insert_id;
        }
        update_option('default_category', $cat_id);
    } else {
        $cat_id = 1;
    }
    $wpdb->insert($wpdb->terms, array('term_id' => $cat_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0));
    $wpdb->insert($wpdb->term_taxonomy, array('term_id' => $cat_id, 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1));
    $cat_tt_id = $wpdb->insert_id;
    // Default link category (commented out)
    /*
    $cat_name = __('Blogroll');
    // translators: Default link category slug
    $cat_slug = sanitize_title(_x('Blogroll', 'Default link category slug'));
    
    if ( global_terms_enabled() ) {
    	$blogroll_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) );
    	if ( $blogroll_id == null ) {
    		$wpdb->insert( $wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql', true)) );
    		$blogroll_id = $wpdb->insert_id;
    	}
    	update_option('default_link_category', $blogroll_id);
    } else {
    	$blogroll_id = 2;
    }
    
    $wpdb->insert( $wpdb->terms, array('term_id' => $blogroll_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) );
    $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => $blogroll_id, 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 7));
    $blogroll_tt_id = $wpdb->insert_id;
    
    // Now drop in some default links
    $default_links = array();
    $default_links[] = array(	'link_url' => 'http://codex.wordpress.org/',
    							'link_name' => 'Documentation',
    							'link_rss' => '',
    							'link_notes' => '');
    
    $default_links[] = array(	'link_url' => 'http://wordpress.org/news/',
    							'link_name' => 'WordPress Blog',
    							'link_rss' => 'http://wordpress.org/news/feed/',
    							'link_notes' => '');
    
    $default_links[] = array(	'link_url' => 'http://wordpress.org/extend/ideas/',
    							'link_name' => 'Suggest Ideas',
    							'link_rss' => '',
    							'link_notes' =>'');
    
    $default_links[] = array(	'link_url' => 'http://wordpress.org/support/',
    							'link_name' => 'Support Forum',
    							'link_rss' => '',
    							'link_notes' =>'');
    
    $default_links[] = array(	'link_url' => 'http://wordpress.org/extend/plugins/',
    							'link_name' => 'Plugins',
    							'link_rss' => '',
    							'link_notes' =>'');
    
    $default_links[] = array(	'link_url' => 'http://wordpress.org/extend/themes/',
    							'link_name' => 'Themes',
    							'link_rss' => '',
    							'link_notes' =>'');
    
    $default_links[] = array(	'link_url' => 'http://planet.wordpress.org/',
    							'link_name' => 'WordPress Planet',
    							'link_rss' => '',
    							'link_notes' =>'');
//.........这里部分代码省略.........
开发者ID:ryanurban,项目名称:Orbit,代码行数:101,代码来源:install.php


示例11: wp_install_defaults

/**
 * Creates the initial content for a newly-installed site.
 *
 * Adds the default "Uncategorized" category, the first post (with comment),
 * first page, and default widgets for default theme for the current version.
 *
 * @since 2.1.0
 *
 * @param int $user_id User ID.
 */
function wp_install_defaults($user_id)
{
    global $wpdb, $wp_rewrite, $current_site, $table_prefix;
    /** @see wp-admin/options-general.php */
    /** Time zone: "Helsinki" */
    update_option('timezone_string', 'Europe/Helsinki');
    /** @see wp-admin/options-discussion.php */
    /** Before a comment appears a comment must be manually approved: true */
    update_option('comment_moderation', 1);
    /** Before a comment appears the comment author must have a previously approved comment: false */
    update_option('comment_whitelist', 0);
    /** Allow people to post comments on new articles (this setting may be overridden for individual articles): false */
    update_option('default_comment_status', 0);
    /** Allow link notifications from other blogs: false */
    update_ 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP globalconf函数代码示例发布时间:2022-05-15
下一篇:
PHP global_run函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap