Changeset 27849 for trunk/src/wp-admin/custom-header.php
- Timestamp:
- 03/29/2014 10:52:17 AM (12 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/custom-header.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/custom-header.php
r27497 r27849 41 41 * @access private 42 42 */ 43 var $default_headers = array();43 var $default_headers; 44 44 45 45 /** … … 255 255 return; 256 256 257 if ( is_array( $this->default_headers ) ) { 258 return; 259 } 260 257 261 $this->default_headers = $_wp_default_headers; 258 262 $template_directory_uri = get_template_directory_uri(); … … 262 266 $this->default_headers[$header]['thumbnail_url'] = sprintf( $this->default_headers[$header]['thumbnail_url'], $template_directory_uri, $stylesheet_directory_uri ); 263 267 } 264 265 268 } 266 269 … … 1229 1232 update_post_meta( $attachment_id, $key, time() ); 1230 1233 } 1234 1235 public function get_default_header_images() { 1236 $this->process_default_headers(); 1237 1238 // Get the default image if there is one. 1239 $default = get_theme_support( 'custom-header', 'default-image' ); 1240 1241 if ( ! $default ) { // If not, 1242 return $this->default_headers; // easy peasy. 1243 } 1244 1245 $default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() ); 1246 $already_has_default = false; 1247 1248 foreach ( $this->default_headers as $k => $h ) { 1249 if ( $h['url'] === $default ) { 1250 $already_has_default = true; 1251 break; 1252 } 1253 } 1254 1255 if ( $already_has_default ) { 1256 return $this->default_headers; 1257 } 1258 1259 // If the one true image isn't included in the default set, prepend it. 1260 $header_images = array(); 1261 $header_images['default'] = array( 1262 'url' => $default, 1263 'thumbnail_url' => $default, 1264 'description' => 'Default' 1265 ); 1266 1267 // The rest of the set comes after. 1268 $header_images = array_merge( $header_images, $this->default_headers ); 1269 return $header_images; 1270 } 1271 1272 public function get_uploaded_header_images() { 1273 $header_images = get_uploaded_header_images(); 1274 $timestamp_key = '_wp_attachment_custom_header_last_used_' . get_stylesheet(); 1275 1276 foreach ( $header_images as &$header_image ) { 1277 $header_image['timestamp'] = get_post_meta( $header_image['attachment_id'], $timestamp_key, true ); 1278 } 1279 1280 return $header_images; 1281 } 1231 1282 }
Note: See TracChangeset
for help on using the changeset viewer.