WordPress.org

Make WordPress Core

Changeset 11043


Ignore:
Timestamp:
04/22/09 01:30:15 (6 years ago)
Author:
ryan
Message:

When on manage page, default favorite actions to the correspoding create page.

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-header.php

    r10869 r11043  
    111111</div> 
    112112 
    113 <?php favorite_actions(); ?> 
     113<?php favorite_actions($hook_suffix); ?> 
    114114</div> 
    115115</div> 
  • trunk/wp-admin/includes/template.php

    r11027 r11043  
    31883188 * @since unknown 
    31893189 */ 
    3190 function favorite_actions() { 
     3190function favorite_actions( $screen = null ) { 
     3191    switch ( $screen ) { 
     3192        case 'edit-pages.php': 
     3193            $default_action = array('page-new.php' => array(__('New Page'), 'edit_pages')); 
     3194            break; 
     3195        case 'upload.php': 
     3196            $default_action = array('media-new.php' => array(__('New Media'), 'upload_files')); 
     3197            break; 
     3198        case 'link-manager.php': 
     3199            $default_action = array('link-add.php' => array(__('New Link'), 'manage_links')); 
     3200            break; 
     3201        case 'users.php': 
     3202            $default_action = array('user-new.php' => array(__('New User'), 'create_users')); 
     3203            break; 
     3204        case 'plugins.php': 
     3205            $default_action = array('plugin-install.php' => array(__('Install Plugins'), 'install_plugins')); 
     3206            break; 
     3207        case 'themes.php': 
     3208            $default_action = array('theme-install.php' => array(__('Install Themes'), 'install_themes')); 
     3209            break; 
     3210        default: 
     3211            $default_action = array('post-new.php' => array(__('New Post'), 'edit_posts')); 
     3212            break; 
     3213    } 
     3214 
    31913215    $actions = array( 
    31923216        'post-new.php' => array(__('New Post'), 'edit_posts'), 
     
    31973221        ); 
    31983222 
     3223    $default_key = array_keys($default_action); 
     3224    $default_key = $default_key[0]; 
     3225    if ( isset($actions[$default_key]) ) 
     3226        unset($actions[$default_key]); 
     3227    $actions = array_merge($default_action, $actions); 
    31993228    $actions = apply_filters('favorite_actions', $actions); 
    32003229 
Note: See TracChangeset for help on using the changeset viewer.