WordPressを読む 10-6 /blog/wp-includes/functions.php 6
2014/11/29
目次
/blog/wp-includes/functions.php 6
読込元 : /blog/wp-settings.php
読込元 : /blog/wp-load.php
関数
wp_get_nocache_headers()
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 | /** * Get the header information to prevent caching. * * The several different headers cover the different ways cache prevention * is handled by different browsers * * @since 2.8.0 * * @return array The associative array of header names and field values. */ function wp_get_nocache_headers() { $headers = array( 'Expires' => 'Wed, 11 Jan 1984 05:00:00 GMT', 'Cache-Control' => 'no-cache, must-revalidate, max-age=0', 'Pragma' => 'no-cache', ); if ( function_exists('apply_filters') ) { /** * Filter the cache-controlling headers. * * @since 2.8.0 * * @see wp_get_nocache_headers() * * @param array $headers { * Header names and field values. * * @type string $Expires Expires header. * @type string $Cache-Control Cache-Control header. * @type string $Pragma Pragma header. * } */ $headers = (array) apply_filters( 'nocache_headers', $headers ); } $headers['Last-Modified'] = false; return $headers; } |
関数
nocache_headers()
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 | /** * Set the headers to prevent caching for the different browsers. * * Different browsers support different nocache headers, so several * headers must be sent so that all of them get the point that no * caching should occur. * * @since 2.0.0 * * @see wp_get_nocache_headers() */ function nocache_headers() { $headers = wp_get_nocache_headers(); unset( $headers['Last-Modified'] ); // In PHP 5.3+, make sure we are not sending a Last-Modified header. if ( function_exists( 'header_remove' ) ) { @header_remove( 'Last-Modified' ); } else { // In PHP 5.2, send an empty Last-Modified header, but only as a // last resort to override a header already sent. #WP23021 foreach ( headers_list() as $header ) { if ( 0 === stripos( $header, 'Last-Modified' ) ) { $headers['Last-Modified'] = ''; break; } } } foreach( $headers as $name => $field_value ) @header("{$name}: {$field_value}"); } |
関数
cache_javascript_headers()
1 2 3 4 5 6 7 8 9 10 11 12 | /** * Set the headers for caching for 10 days with JavaScript content type. * * @since 2.1.0 */ function cache_javascript_headers() { $expiresOffset = 10 * DAY_IN_SECONDS; header( "Content-Type: text/javascript; charset=" . get_bloginfo( 'charset' ) ); header( "Vary: Accept-Encoding" ); // Handle proxies header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $expiresOffset ) . " GMT" ); } |
関数
get_num_queries()
1 2 3 4 5 6 7 8 9 10 11 12 13 | /** * Retrieve the number of database queries during the WordPress execution. * * @since 2.0.0 * * @global wpdb $wpdb WordPress database access abstraction object. * * @return int Number of database queries. */ function get_num_queries() { global $wpdb; return $wpdb->num_queries; } |
関数
bool_from_yn()
1 2 3 4 5 6 7 8 9 10 11 12 13 | /** * Whether input is yes or no. * * Must be 'y' to be true. * * @since 1.0.0 * * @param string $yn Character string containing either 'y' (yes) or 'n' (no). * @return bool True if yes, false on anything else. */ function bool_from_yn( $yn ) { return ( strtolower( $yn ) == 'y' ); } |
関数
do_feed()
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 | /** * Load the feed template from the use of an action hook. * * If the feed action does not have a hook, then the function will die with a * message telling the visitor that the feed is not valid. * * It is better to only have one hook for each feed. * * @since 2.1.0 * * @uses $wp_query Used to tell if the use a comment feed. */ function do_feed() { global $wp_query; $feed = get_query_var( 'feed' ); // Remove the pad, if present. $feed = preg_replace( '/^_+/', '', $feed ); if ( $feed == '' || $feed == 'feed' ) $feed = get_default_feed(); $hook = 'do_feed_' . $feed; if ( ! has_action( $hook ) ) wp_die( __( 'ERROR: This is not a valid feed template.' ), '', array( 'response' => 404 ) ); /** * Fires once the given feed is loaded. * * The dynamic hook name, $hook, refers to the feed name. * * @since 2.1.0 * * @param bool $is_comment_feed Whether the feed is a comment feed. */ do_action( $hook, $wp_query->is_comment_feed ); } |
関数
do_feed_rdf()
1 2 3 4 5 6 7 8 9 10 | /** * Load the RDF RSS 0.91 Feed template. * * @since 2.1.0 * * @see load_template() */ function do_feed_rdf() { load_template( ABSPATH . WPINC . '/feed-rdf.php' ); } |
関数
do_feed_rss()
1 2 3 4 5 6 7 8 9 10 | /** * Load the RSS 1.0 Feed Template. * * @since 2.1.0 * * @see load_template() */ function do_feed_rss() { load_template( ABSPATH . WPINC . '/feed-rss.php' ); } |
関数
do_feed_rss2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /** * Load either the RSS2 comment feed or the RSS2 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_rss2( $for_comments ) { if ( $for_comments ) load_template( ABSPATH . WPINC . '/feed-rss2-comments.php' ); else load_template( ABSPATH . WPINC . '/feed-rss2.php' ); } |