Changeset 58130
- Timestamp:
- 05/10/2024 06:57:53 PM (6 months ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/file.php
r57984 r58130 1090 1090 * to override default variables. Default false. 1091 1091 * See _wp_handle_upload() for accepted values. 1092 * @param string 1092 * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null. 1093 1093 * @return array See _wp_handle_upload() for return value. 1094 1094 */ … … 1121 1121 * to override default variables. Default false. 1122 1122 * See _wp_handle_upload() for accepted values. 1123 * @param string 1123 * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null. 1124 1124 * @return array See _wp_handle_upload() for return value. 1125 1125 */ -
trunk/src/wp-includes/functions.php
r57987 r58130 2345 2345 * @uses _wp_upload_dir() 2346 2346 * 2347 * @param string $timeOptional. Time formatted in 'yyyy/mm'. Default null.2348 * @param bool $create_dirOptional. Whether to check and create the uploads directory.2349 * Default true for backward compatibility.2350 * @param bool $refresh_cache Optional. Whether to refresh the cache. Default false.2347 * @param string Optional. Time formatted in 'yyyy/mm'. Default null. 2348 * @param bool Optional. Whether to check and create the uploads directory. 2349 * Default true for backward compatibility. 2350 * @param bool $refresh_cache Optional. Whether to refresh the cache. Default false. 2351 2351 * @return array { 2352 2352 * Array of information about the upload directory. … … 2420 2420 * @access private 2421 2421 * 2422 * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.2422 * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null. 2423 2423 * @return array See wp_upload_dir() 2424 2424 */ … … 2872 2872 * @param null|string $deprecated Never used. Set to null. 2873 2873 * @param string $bits File content 2874 * @param string 2874 * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null. 2875 2875 * @return array { 2876 2876 * Information about the newly-uploaded file. -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
r57603 r58130 255 255 $headers = $request->get_headers(); 256 256 257 258 259 260 261 262 263 264 265 266 267 257 268 if ( ! empty( $files ) ) { 258 $file = $this->upload_from_file( $files, $headers );269 $file = $this->upload_from_file( $files, $headers ); 259 270 } else { 260 $file = $this->upload_from_data( $request->get_body(), $headers );271 $file = $this->upload_from_data( $request->get_body(), $headers ); 261 272 } 262 273 … … 1036 1047 * 1037 1048 * @since 4.7.0 1038 * 1039 * @param string $data Supplied file data. 1040 * @param array $headers HTTP headers from the request. 1049 * @since 6.6.0 Added the `$time` parameter. 1050 * 1051 * @param string $data Supplied file data. 1052 * @param array $headers HTTP headers from the request. 1053 * @param string|null $time Optional. Time formatted in 'yyyy/mm'. Default null. 1041 1054 * @return array|WP_Error Data from wp_handle_sideload(). 1042 1055 */ 1043 protected function upload_from_data( $data, $headers ) {1056 protected function upload_from_data( $data, $headers ) { 1044 1057 if ( empty( $data ) ) { 1045 1058 return new WP_Error( … … 1129 1142 ); 1130 1143 1131 $sideloaded = wp_handle_sideload( $file_data, $overrides );1144 $sideloaded = wp_handle_sideload( $file_data, $overrides ); 1132 1145 1133 1146 if ( isset( $sideloaded['error'] ) ) { … … 1247 1260 * 1248 1261 * @since 4.7.0 1249 * 1250 * @param array $files Data from the `$_FILES` superglobal. 1251 * @param array $headers HTTP headers from the request. 1262 * @since 6.6.0 Added the `$time` parameter. 1263 * 1264 * @param array $files Data from the `$_FILES` superglobal. 1265 * @param array $headers HTTP headers from the request. 1266 * @param string|null $time Optional. Time formatted in 'yyyy/mm'. Default null. 1252 1267 * @return array|WP_Error Data from wp_handle_upload(). 1253 1268 */ 1254 protected function upload_from_file( $files, $headers ) {1269 protected function upload_from_file( $files, $headers ) { 1255 1270 if ( empty( $files ) ) { 1256 1271 return new WP_Error( … … 1294 1309 require_once ABSPATH . 'wp-admin/includes/file.php'; 1295 1310 1296 $file = wp_handle_upload( $files['file'], $overrides );1311 $file = wp_handle_upload( $files['file'], $overrides ); 1297 1312 1298 1313 if ( isset( $file['error'] ) ) { -
trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php
r58065 r58130 2076 2076 } 2077 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2078 2170 public function filter_rest_insert_attachment( $attachment ) { 2079 2171 ++self::$rest_insert_attachment_count;
Note: See TracChangeset
for help on using the changeset viewer.