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