| | 299 | /** |
| | 300 | * Install the default post modes |
| | 301 | * |
| | 302 | * @param boolean $scratch_install Whether this is being called during a scratch install. Default is false. |
| | 303 | */ |
| | 304 | function wp_install_post_modes( $scratch_install = false ) { |
| | 305 | // These are purposefully not translated. |
| | 306 | $modes = array( 'aside' => 'Aside', |
| | 307 | 'chat' => 'Chat', |
| | 308 | 'gallery' => 'Gallery', |
| | 309 | 'image' => 'Image', |
| | 310 | 'link' => 'Link', |
| | 311 | 'quote' => 'Quote', |
| | 312 | 'video' => 'Video' |
| | 313 | ); |
| | 314 | |
| | 315 | // Dummy gettext calls to get the strings in the default catalog. |
| | 316 | // @todo context and hints |
| | 317 | __('Aside'); |
| | 318 | __('Chat'); |
| | 319 | __('Gallery'); |
| | 320 | __('Image'); |
| | 321 | __('Link'); |
| | 322 | __('Quote'); |
| | 323 | __('Video'); |
| | 324 | |
| | 325 | $term_id = 3; // Bump this if the sequence in wp_install_defaults() changes. |
| | 326 | foreach ( $modes as $slug => $name ) { |
| | 327 | if ( $scratch_install ) { |
| | 328 | if ( global_terms_enabled() ) { |
| | 329 | $term_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) ); |
| | 330 | if ( $term_id == null ) { |
| | 331 | $wpdb->insert( $wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $name, 'category_nicename' => $slug, 'last_updated' => current_time('mysql', true)) ); |
| | 332 | $term_id = $wpdb->insert_id; |
| | 333 | } |
| | 334 | } |
| | 335 | |
| | 336 | $wpdb->insert( $wpdb->terms, array('term_id' => $term_id, 'name' => $name, 'slug' => $slug, 'term_group' => 0) ); |
| | 337 | $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => $term_id, 'taxonomy' => 'post_mode', 'description' => '', 'parent' => 0)); |
| | 338 | $term_id++; |
| | 339 | } elseif ( !term_exists($name, 'post_mode') ) { |
| | 340 | wp_insert_term($name, 'post_mode', array('slug' => $slug)); |
| | 341 | } |
| | 342 | } |
| | 343 | } |
| | 344 | |