WordPressを読む 10-7 /blog/wp-includes/functions.php 7
2014/11/29
目次
/blog/wp-includes/functions.php 7
読込元 : /blog/wp-settings.php
読込元 : /blog/wp-load.php
関数
do_feed_atom()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /** * Load either Atom comment feed or Atom posts feed. * * @since 2.1.0 * * @see load_template() * * @param bool $for_comments True for the comment feed, false for normal feed. */ function do_feed_atom( $for_comments ) { if ($for_comments) load_template( ABSPATH . WPINC . '/feed-atom-comments.php'); else load_template( ABSPATH . WPINC . '/feed-atom.php' ); } |
関数
do_robots()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | /** * Display the robots.txt file content. * * The echo content should be with usage of the permalinks or for creating the * robots.txt file. * * @since 2.1.0 */ function do_robots() { header( 'Content-Type: text/plain; charset=utf-8' ); /** * Fires when displaying the robots.txt file. * * @since 2.1.0 */ do_action( 'do_robotstxt' ); $output = "User-agent: *\n"; $public = get_option( 'blog_public' ); if ( '0' == $public ) { $output .= "Disallow: /\n"; } else { $site_url = parse_url( site_url() ); $path = ( !empty( $site_url['path'] ) ) ? $site_url['path'] : ''; $output .= "Disallow: $path/wp-admin/\n"; } /** * Filter the robots.txt output. * * @since 3.0.0 * * @param string $output Robots.txt output. * @param bool $public Whether the site is considered "public". */ echo apply_filters( 'robots_txt', $output, $public ); } |
関数
is_blog_installed()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | /** * Test whether blog is already installed. * * The cache will be checked first. If you have a cache plugin, which saves * the cache values, then this will work. If you use the default WordPress * cache, and the database goes away, then you might have problems. * * Checks for the 'siteurl' option for whether WordPress is installed. * * @since 2.1.0 * * @global wpdb $wpdb WordPress database access abstraction object. * * @return bool Whether the blog is already installed. */ function is_blog_installed() { global $wpdb; /* * Check cache first. If options table goes away and we have true * cached, oh well. */ if ( wp_cache_get( 'is_blog_installed' ) ) return true; $suppress = $wpdb->suppress_errors(); if ( ! defined( 'WP_INSTALLING' ) ) { $alloptions = wp_load_alloptions(); } // If siteurl is not set to autoload, check it specifically if ( !isset( $alloptions['siteurl'] ) ) $installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" ); else $installed = $alloptions['siteurl']; $wpdb->suppress_errors( $suppress ); $installed = !empty( $installed ); wp_cache_set( 'is_blog_installed', $installed ); if ( $installed ) return true; // If visiting repair.php, return true and let it take over. if ( defined( 'WP_REPAIRING' ) ) return true; $suppress = $wpdb->suppress_errors(); /* * Loop over the WP tables. If none exist, then scratch install is allowed. * If one or more exist, suggest table repair since we got here because the * options table could not be accessed. */ $wp_tables = $wpdb->tables(); foreach ( $wp_tables as $table ) { // The existence of custom user tables shouldn't suggest an insane state or prevent a clean install. if ( defined( 'CUSTOM_USER_TABLE' ) && CUSTOM_USER_TABLE == $table ) continue; if ( defined( 'CUSTOM_USER_META_TABLE' ) && CUSTOM_USER_META_TABLE == $table ) continue; if ( ! $wpdb->get_results( "DESCRIBE $table;" ) ) continue; // One or more tables exist. We are insane. wp_load_translations_early(); // Die with a DB error. $wpdb->error = sprintf( __( 'One or more database tables are unavailable. The database may need to be <a href="%s">repaired</a>.' ), 'maint/repair.php?referrer=is_blog_installed' ); dead_db(); } $wpdb->suppress_errors( $suppress ); wp_cache_set( 'is_blog_installed', false ); return false; } |