Make WordPress Core

Changeset 14127


Ignore:
Timestamp:
04/18/2010 03:38:47 AM (13 years ago)
Author:
dd32
Message:

Escape/texturize Admin menu titles. Fixes page titles such as "Foo & Bar" not being entity encoded. Also includes some basic whitespace/standards cleanup to a related function. Fixes #12039

Location:
trunk/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/plugin.php

    r14126 r14127  
    819819    $hookname = get_plugin_page_hookname( $menu_slug, '' );
    820820
    821     if (!empty ( $function ) && !empty ( $hookname ) && current_user_can( $capability ) )
     821    if ( !empty( $function ) && !empty( $hookname ) && current_user_can( $capability ) )
    822822        add_action( $hookname, $function );
    823823
    824     if ( empty($icon_url) ) {
     824    if ( empty($icon_url) )
    825825        $icon_url = esc_url( admin_url( 'images/generic.png' ) );
    826     } elseif ( is_ssl() && 0 === strpos($icon_url, 'http://') ) {
     826    elseif ( is_ssl() && 0 === strpos($icon_url, 'http://') )
    827827        $icon_url = 'https://' . substr($icon_url, 7);
    828     }
    829 
    830     $new_menu = array ( $menu_title, $capability, $menu_slug, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url );
    831 
    832     if ( NULL === $position  ) {
     828
     829    $new_menu = array( $menu_title, $capability, $menu_slug, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url );
     830
     831    if ( null === $position  )
    833832        $menu[] = $new_menu;
    834     } else {
     833    else
    835834        $menu[$position] = $new_menu;
    836     }
    837835
    838836    $_registered_pages[$hookname] = true;
  • trunk/wp-admin/menu-header.php

    r13851 r14127  
    7070        $toggle = '<div class="wp-menu-toggle"><br /></div>';
    7171
     72        $title = wptexturize($item[0]);
     73
    7274        echo "\n\t<li$class$id>";
    7375
     
    8284            if ( ( ('index.php' != $submenu[$item[2]][0][2]) && file_exists(WP_PLUGIN_DIR . "/$menu_file") ) || !empty($menu_hook)) {
    8385                $admin_is_parent = true;
    84                 echo "<div class='wp-menu-image'><a href='admin.php?page={$submenu[$item[2]][0][2]}'>$img</a></div>$toggle<a href='admin.php?page={$submenu[$item[2]][0][2]}'$class$tabindex>{$item[0]}</a>";
     86                echo "<div class='wp-menu-image'><a href='admin.php?page={$submenu[$item[2]][0][2]}'>$img</a></div>$toggle<a href='admin.php?page={$submenu[$item[2]][0][2]}'$class$tabindex>$title</a>";
    8587            } else {
    86                 echo "\n\t<div class='wp-menu-image'><a href='{$submenu[$item[2]][0][2]}'>$img</a></div>$toggle<a href='{$submenu[$item[2]][0][2]}'$class$tabindex>{$item[0]}</a>";
     88                echo "\n\t<div class='wp-menu-image'><a href='{$submenu[$item[2]][0][2]}'>$img</a></div>$toggle<a href='{$submenu[$item[2]][0][2]}'$class$tabindex>$title</a>";
    8789            }
    8890        } else if ( current_user_can($item[1]) ) {
     
    139141                    $sub_file = substr($sub_file, 0, $pos);
    140142
     143                $title = wptexturize($sub_item[0]);
     144
    141145                if ( ( ('index.php' != $sub_item[2]) && file_exists(WP_PLUGIN_DIR . "/$sub_file") ) || ! empty($menu_hook) ) {
    142146                    // If admin.php is the current page or if the parent exists as a file in the plugins or admin dir
     
    146150                        $sub_item_url = add_query_arg( array('page' => $sub_item[2]), 'admin.php' );
    147151                    $sub_item_url = esc_url($sub_item_url);
    148                     echo "<li$class><a href='$sub_item_url'$class$tabindex>{$sub_item[0]}</a></li>";
     152                    echo "<li$class><a href='$sub_item_url'$class$tabindex>$title</a></li>";
    149153                } else {
    150                     echo "<li$class><a href='{$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
     154                    echo "<li$class><a href='{$sub_item[2]}'$class$tabindex>$title</a></li>";
    151155                }
    152156            }
  • trunk/wp-admin/menu.php

    r14110 r14127  
    180180if ( current_user_can('edit_users') ) {
    181181    $_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php.
    182     $submenu['users.php'][5] = array(__('Authors &amp; Users'), 'edit_users', 'users.php');
     182    $submenu['users.php'][5] = array(__('Authors & Users'), 'edit_users', 'users.php');
    183183    $submenu['users.php'][10] = array(_x('Add New', 'user'), 'create_users', 'user-new.php');
    184184
Note: See TracChangeset for help on using the changeset viewer.