WordPressを読む 10-20 /blog/wp-includes/functions.php 20
2014/11/29
目次
/blog/wp-includes/functions.php 20
読込元 : /blog/wp-settings.php
読込元 : /blog/wp-load.php
関数
get_file_data()
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 | /** * Retrieve metadata from a file. * * Searches for metadata in the first 8kiB of a file, such as a plugin or theme. * Each piece of metadata must be on its own line. Fields can not span multiple * lines, the value will get cut at the end of the first line. * * If the file data is not within that first 8kiB, then the author should correct * their plugin file and move the data headers to the top. * * @see http://codex.wordpress.org/File_Header * * @since 2.9.0 * @param string $file Path to the file. * @param array $default_headers List of headers, in the format array('HeaderKey' => 'Header Name'). * @param string $context Optional. If specified adds filter hook "extra_{$context}_headers". * Default empty. */ function get_file_data( $file, $default_headers, $context = '' ) { // We don't need to write to the file, so just open for reading. $fp = fopen( $file, 'r' ); // Pull only the first 8kiB of the file in. $file_data = fread( $fp, 8192 ); // PHP will close file handle, but we are good citizens. fclose( $fp ); // Make sure we catch CR-only line endings. $file_data = str_replace( "\r", "\n", $file_data ); /** * Filter extra file headers by context. * * The dynamic portion of the hook name, $context, refers to the context * where extra headers might be loaded. * * @since 2.9.0 * * @param array $extra_context_headers Empty array by default. */ if ( $context && $extra_headers = apply_filters( "extra_{$context}_headers", array() ) ) { $extra_headers = array_combine( $extra_headers, $extra_headers ); // keys equal values $all_headers = array_merge( $extra_headers, (array) $default_headers ); } else { $all_headers = $default_headers; } foreach ( $all_headers as $field => $regex ) { if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] ) $all_headers[ $field ] = _cleanup_header_comment( $match[1] ); else $all_headers[ $field ] = ''; } return $all_headers; } |
関数
__return_true()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /** * Returns true. * * Useful for returning true to filters easily. * * @since 3.0.0 * * @see __return_false() * * @return bool True. */ function __return_true() { return true; } |
関数
__return_false()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /** * Returns false. * * Useful for returning false to filters easily. * * @since 3.0.0 * * @see __return_true() * * @return bool False. */ function __return_false() { return false; } |
関数
__return_zero()
1 2 3 4 5 6 7 8 9 10 11 12 | /** * Returns 0. * * Useful for returning 0 to filters easily. * * @since 3.0.0 * * @return int 0. */ function __return_zero() { return 0; } |
関数
__return_empty_array()
1 2 3 4 5 6 7 8 9 10 11 12 | /** * Returns an empty array. * * Useful for returning an empty array to filters easily. * * @since 3.0.0 * * @return array Empty array. */ function __return_empty_array() { return array(); } |
関数
__return_null()
1 2 3 4 5 6 7 8 9 10 11 12 | /** * Returns null. * * Useful for returning null to filters easily. * * @since 3.4.0 * * @return null Null value. */ function __return_null() { return null; } |
関数
__return_empty_string()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /** * Returns an empty string. * * Useful for returning an empty string to filters easily. * * @since 3.7.0 * * @see __return_null() * * @return string Empty string. */ function __return_empty_string() { return ''; } |
関数
send_nosniff_header()
1 2 3 4 5 6 7 8 9 10 11 | /** * Send a HTTP header to disable content type sniffing in browsers which support it. * * @since 3.0.0 * * @see http://blogs.msdn.com/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx * @see http://src.chromium.org/viewvc/chrome?view=rev&revision=6985 */ function send_nosniff_header() { @header( 'X-Content-Type-Options: nosniff' ); } |