Changeset 35309 for trunk/tests/phpunit/tests/image/site_icon.php
- Timestamp:
- 10/21/2015 01:58:52 AM (10 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/image/site_icon.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/image/site_icon.php
r35299 r35309 159 159 160 160 $upload = wp_upload_bits( basename( $filename ), null, $contents ); 161 $type = '';162 if ( ! empty( $upload['type'] ) ) {163 $type = $upload['type'];164 } else {165 $mime = wp_check_filetype( $upload['file'] );166 if ( $mime ) {167 $type = $mime['type'];168 }169 }170 161 171 $attachment = array( 172 'post_title' => basename( $upload['file'] ), 173 'post_content' => $upload['url'], 174 'post_type' => 'attachment', 175 'post_mime_type' => $type, 176 'guid' => $upload['url'], 177 ); 178 179 // Save the data 180 $this->attachment_id = wp_insert_attachment( $attachment, $upload['file'] ); 181 wp_update_attachment_metadata( $this->attachment_id, wp_generate_attachment_metadata( $this->attachment_id, $upload['file'] ) ); 182 162 $this->attachment_id = $this->_make_attachment( $upload ); 183 163 return $this->attachment_id; 184 164 }
Note: See TracChangeset
for help on using the changeset viewer.