Ticket #31365: 31365.diff
File 31365.diff, 4.0 KB (added by , 10 years ago) |
---|
-
src/wp-admin/themes.php
158 158 // Pretend you didn't see this. 159 159 $current_theme_actions = array(); 160 160 if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) { 161 foreach ( (array) $submenu['themes.php'] as $item ) {161 foreach ( (array) $submenu['themes.php'] as $item ) { 162 162 $class = ''; 163 if ( 'themes.php' == $item[2] || 'theme-editor.php' == $item[2] || 0 === strpos( $item[2], 'customize.php' ) ) 163 if ( 'themes.php' == $item[2] || 'theme-editor.php' == $item[2] || 0 === strpos( $item[2], 'customize.php' ) ) { 164 164 continue; 165 } 165 166 // 0 = name, 1 = capability, 2 = file 166 if ( ( strcmp( $self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file)) )167 if ( ( strcmp( $self, $item[2] ) == 0 && empty( $parent_file ) ) || ( $parent_file && ( $item[2] == $parent_file ) ) ) { 167 168 $class = ' current'; 168 if ( !empty($submenu[$item[2]]) ) { 169 $submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index. 170 $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]); 171 if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook)) 172 $current_theme_actions[] = "<a class='button button-secondary$class' href='admin.php?page={$submenu[$item[2]][0][2]}'>{$item[0]}</a>"; 173 else 174 $current_theme_actions[] = "<a class='button button-secondary$class' href='{$submenu[$item[2]][0][2]}'>{$item[0]}</a>"; 169 } 170 if ( ! empty( $submenu[ $item[2] ] ) ) { 171 $submenu[ $item[2] ] = array_values( $submenu[ $item[2] ] ); // Re-index. 172 $menu_hook = get_plugin_page_hook( $submenu[ $item[2] ][0][2], $item[2] ); 173 if ( file_exists( WP_PLUGIN_DIR . "/" . $submenu[ $item[2] ][0][2] ) || ! empty( $menu_hook ) ) { 174 $current_theme_actions[] = "<a class='button button-secondary" . $class . "' href='" . esc_url( add_query_arg( array( 'page' => $submenu[ $item[2] ][0][2] ), 'admin.php' ) ) . "'>" . $item[0] . "</a>"; 175 } else { 176 $current_theme_actions[] = "<a class='button button-secondary" . $class . "' href='" . esc_url( $submenu[ $item[2] ][0][2] ) . "'>" . $item[0] ."</a>"; 177 } 175 178 } elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) { 176 179 $menu_file = $item[2]; 177 180 178 181 if ( current_user_can( 'customize' ) ) { 179 182 if ( 'custom-header' === $menu_file ) { 180 $current_theme_actions[] = "<a class='button button-secondary hide-if-no-customize $class' href='customize.php?autofocus[control]=header_image'>{$item[0]}</a>";183 $current_theme_actions[] = "<a class='button button-secondary hide-if-no-customize" . $class . "' href='customize.php?autofocus[control]=header_image'>" . $item[0] . "</a>"; 181 184 } elseif ( 'custom-background' === $menu_file ) { 182 $current_theme_actions[] = "<a class='button button-secondary hide-if-no-customize $class' href='customize.php?autofocus[control]=background_image'>{$item[0]}</a>";185 $current_theme_actions[] = "<a class='button button-secondary hide-if-no-customize" . $class . "' href='customize.php?autofocus[control]=background_image'>" . $item[0] . "</a>"; 183 186 } 184 187 } 185 188 … … 187 190 $menu_file = substr( $menu_file, 0, $pos ); 188 191 } 189 192 190 if ( file_exists( ABSPATH . "wp-admin/ $menu_file") ) {191 $current_theme_actions[] = "<a class='button button-secondary $class' href='{$item[2]}'>{$item[0]}</a>";193 if ( file_exists( ABSPATH . "wp-admin/" . $menu_file ) ) { 194 $current_theme_actions[] = "<a class='button button-secondary" . $class . "' href='" . esc_url( $item[2] ) . "'>" . $item[0] . "</a>"; 192 195 } else { 193 $current_theme_actions[] = "<a class='button button-secondary $class' href='themes.php?page={$item[2]}'>{$item[0]}</a>";196 $current_theme_actions[] = "<a class='button button-secondary" . $class . "' href='" . esc_url( add_query_arg( array( 'page' => $item[2] ), 'themes.php' ) ) . "'>" . $item[0] . "</a>"; 194 197 } 195 198 } 196 199 }