WordPressを読む 10-5 /blog/wp-includes/functions.php 5
2014/11/30
目次
/blog/wp-includes/functions.php 5
読込元 : /blog/wp-settings.php
読込元 : /blog/wp-load.php
関数
remove_query_arg()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /** * Removes an item or list from the query string. * * @since 1.5.0 * * @param string|array $key Query key or keys to remove. * @param bool $query Optional. When false uses the $_SERVER value. Default false. * @return string New URL query string. */ function remove_query_arg( $key, $query = false ) { if ( is_array( $key ) ) { // removing multiple keys foreach ( $key as $k ) $query = add_query_arg( $k, false, $query ); return $query; } return add_query_arg( $key, false, $query ); } |
関数
add_magic_quotes()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /** * Walks the array while sanitizing the contents. * * @since 0.71 * * @param array $array Array to walk while sanitizing contents. * @return array Sanitized $array. */ function add_magic_quotes( $array ) { foreach ( (array) $array as $k => $v ) { if ( is_array( $v ) ) { $array[$k] = add_magic_quotes( $v ); } else { $array[$k] = addslashes( $v ); } } return $array; } |
関数
wp_remote_fopen()
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 | /** * HTTP request for URI to retrieve content. * * @since 1.5.1 * * @see wp_safe_remote_get() * * @param string $uri URI/URL of web page to retrieve. * @return bool|string HTTP content. False on failure. */ function wp_remote_fopen( $uri ) { $parsed_url = @parse_url( $uri ); if ( !$parsed_url || !is_array( $parsed_url ) ) return false; $options = array(); $options['timeout'] = 10; $response = wp_safe_remote_get( $uri, $options ); if ( is_wp_error( $response ) ) return false; return wp_remote_retrieve_body( $response ); } |
関数
wp()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /** * Set up the WordPress query. * * @since 2.0.0 * * @param string $query_vars Default WP_Query arguments. */ function wp( $query_vars = '' ) { global $wp, $wp_query, $wp_the_query; $wp->main( $query_vars ); if ( !isset($wp_the_query) ) $wp_the_query = $wp_query; } |
関数
get_status_header_desc()
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 80 81 82 83 | /** * Retrieve the description for the HTTP status. * * @since 2.3.0 * * @param int $code HTTP status code. * @return string Empty string if not found, or description if found. */ function get_status_header_desc( $code ) { global $wp_header_to_desc; $code = absint( $code ); if ( !isset( $wp_header_to_desc ) ) { $wp_header_to_desc = array( 100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-Status', 226 => 'IM Used', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'Reserved', 307 => 'Temporary Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long', 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', 418 => 'I\'m a teapot', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', 426 => 'Upgrade Required', 428 => 'Precondition Required', 429 => 'Too Many Requests', 431 => 'Request Header Fields Too Large', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', 510 => 'Not Extended', 511 => 'Network Authentication Required', ); } if ( isset( $wp_header_to_desc[$code] ) ) return $wp_header_to_desc[$code]; else return ''; } |
関数
status_header()
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 | /** * Set HTTP status header. * * @since 2.0.0 * * @see get_status_header_desc() * * @param int $code HTTP status code. */ function status_header( $code ) { $description = get_status_header_desc( $code ); if ( empty( $description ) ) return; $protocol = $_SERVER['SERVER_PROTOCOL']; if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol ) $protocol = 'HTTP/1.0'; $status_header = "$protocol $code $description"; if ( function_exists( 'apply_filters' ) ) /** * Filter an HTTP status header. * * @since 2.2.0 * * @param string $status_header HTTP status header. * @param int $code HTTP status code. * @param string $description Description for the status code. * @param string $protocol Server protocol. */ $status_header = apply_filters( 'status_header', $status_header, $code, $description, $protocol ); @header( $status_header, true, $code ); } |