Changeset 45590 for trunk/src/wp-includes/functions.php
- Timestamp:
- 07/02/2019 11:41:16 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r45580 r45590 745 745 if ( $url != '' && ! $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post_ID, $wpdb->esc_like( $url ) . '%' ) ) ) { 746 746 747 if ( $headers = wp_get_http_headers( $url ) ) { 747 $headers = wp_get_http_headers( $url ); 748 if ( $headers ) { 748 749 $len = isset( $headers['content-length'] ) ? (int) $headers['content-length'] : 0; 749 750 $type = isset( $headers['content-type'] ) ? $headers['content-type'] : ''; … … 944 945 } 945 946 946 if ( $frag = strstr( $uri, '#' ) ) { 947 $frag = strstr( $uri, '#' ); 948 if ( $frag ) { 947 949 $uri = substr( $uri, 0, -strlen( $frag ) ); 948 950 } else { … … 1699 1701 */ 1700 1702 function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) { 1701 if ( ! $ref = wp_get_original_referer() ) { 1703 $ref = wp_get_original_referer(); 1704 if ( ! $ref ) { 1702 1705 $ref = 'previous' == $jump_back_to ? wp_get_referer() : wp_unslash( $_SERVER['REQUEST_URI'] ); 1703 1706 } … … 1811 1814 1812 1815 // Get the permission bits. 1813 if ( $stat = @stat( $target_parent ) ) { 1816 $stat = @stat( $target_parent ); 1817 if ( $stat ) { 1814 1818 $dir_perms = $stat['mode'] & 0007777; 1815 1819 } else { … … 2160 2164 } 2161 2165 2162 if ( ! $url = get_option( 'upload_url_path' ) ) { 2166 $url = get_option( 'upload_url_path' ); 2167 if ( ! $url ) { 2163 2168 if ( empty( $upload_path ) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) ) { 2164 2169 $url = WP_CONTENT_URL . '/uploads'; … … 2600 2605 // File is a non-specific binary type. That's ok if it's a type that generally tends to be binary. 2601 2606 if ( ! in_array( substr( $type, 0, strcspn( $type, '/' ) ), array( 'application', 'video', 'audio' ) ) ) { 2602 $type = $ext = false; 2607 $type = false; 2608 $ext = false; 2603 2609 } 2604 2610 } elseif ( 0 === strpos( $real_mime, 'video/' ) || 0 === strpos( $real_mime, 'audio/' ) ) { … … 2609 2615 */ 2610 2616 if ( substr( $real_mime, 0, strcspn( $real_mime, '/' ) ) !== substr( $type, 0, strcspn( $type, '/' ) ) ) { 2611 $type = $ext = false; 2617 $type = false; 2618 $ext = false; 2612 2619 } 2613 2620 } elseif ( 'text/plain' === $real_mime ) { … … 2624 2631 ) 2625 2632 ) { 2626 $type = $ext = false; 2633 $type = false; 2634 $ext = false; 2627 2635 } 2628 2636 } elseif ( 'text/rtf' === $real_mime ) { … … 2637 2645 ) 2638 2646 ) { 2639 $type = $ext = false; 2647 $type = false; 2648 $ext = false; 2640 2649 } 2641 2650 } else { … … 2645 2654 * If the real content type doesn't match the file extension, assume it's dangerous. 2646 2655 */ 2647 $type = $ext = false; 2656 $type = false; 2657 $ext = false; 2648 2658 } 2649 2659 } … … 2655 2665 2656 2666 if ( ! in_array( $type, $allowed ) ) { 2657 $type = $ext = false; 2667 $type = false; 2668 $ext = false; 2658 2669 } 2659 2670 } … … 5238 5249 */ 5239 5250 function wp_timezone_override_offset() { 5240 if ( ! $timezone_string = get_option( 'timezone_string' ) ) { 5251 $timezone_string = get_option( 'timezone_string' ); 5252 if ( ! $timezone_string ) { 5241 5253 return false; 5242 5254 } … … 5603 5615 * @param array $extra_context_headers Empty array by default. 5604 5616 */ 5605 if ( $context && $extra_headers = apply_filters( "extra_{$context}_headers", array() ) ) { 5617 $extra_headers = $context ? apply_filters( "extra_{$context}_headers", array() ) : array(); 5618 if ( $extra_headers ) { 5606 5619 $extra_headers = array_combine( $extra_headers, $extra_headers ); // keys equal values 5607 5620 $all_headers = array_merge( $extra_headers, (array) $default_headers ); … … 5727 5740 */ 5728 5741 function _wp_mysql_week( $column ) { 5729 switch ( $start_of_week = (int) get_option( 'start_of_week' ) ) { 5742 $start_of_week = (int) get_option( 'start_of_week' ); 5743 switch ( $start_of_week ) { 5730 5744 case 1: 5731 5745 return "WEEK( $column, 1 )"; … … 5758 5772 $override = is_null( $start_parent ) ? array() : array( $start => $start_parent ); 5759 5773 5760 if ( ! $arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override, $callback_args ) ) { 5774 $arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override, $callback_args ); 5775 if ( ! $arbitrary_loop_member ) { 5761 5776 return array(); 5762 5777 } … … 5786 5801 */ 5787 5802 function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = array(), $callback_args = array(), $_return_loop = false ) { 5788 $tortoise = $hare = $evanescent_hare = $start; 5789 $return = array(); 5803 $tortoise = $start; 5804 $hare = $start; 5805 $evanescent_hare = $start; 5806 $return = array(); 5790 5807 5791 5808 // Set evanescent_hare to one past hare … … 5799 5816 ) { 5800 5817 if ( $_return_loop ) { 5801 $return[ $tortoise ] = $return[ $evanescent_hare ] = $return[ $hare ] = true; 5818 $return[ $tortoise ] = true; 5819 $return[ $evanescent_hare ] = true; 5820 $return[ $hare ] = true; 5802 5821 } 5803 5822 … … 7134 7153 } 7135 7154 7136 if ( $handle = opendir( $directory ) ) { 7155 $handle = opendir( $directory ); 7156 if ( $handle ) { 7137 7157 while ( ( $file = readdir( $handle ) ) !== false ) { 7138 7158 $path = $directory . '/' . $file;
Note: See TracChangeset
for help on using the changeset viewer.