WordPress.org

Make WordPress Core

Changeset 15646


Ignore:
Timestamp:
09/22/2010 05:23:38 PM (10 years ago)
Author:
ryan
Message:

Options list for current theme. see #14936

File:
1 edited

Legend:

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

    r15644 r15646  
    8282    printf(__('%1$s %2$s by %3$s'), $ct->title, $ct->version, $ct->author) ; ?></h4>
    8383<p class="theme-description"><?php echo $ct->description; ?></p>
    84 <?php if ( current_user_can('edit_themes') && $ct->parent_theme ) { ?>
    85     <p><?php printf(__('The template files are located in <code>%2$s</code>. The stylesheet files are located in <code>%3$s</code>. <strong>%4$s</strong> uses templates from <strong>%5$s</strong>. Changes made to the templates will affect both themes.'), $ct->title, str_replace( WP_CONTENT_DIR, '', $ct->template_dir ), str_replace( WP_CONTENT_DIR, '', $ct->stylesheet_dir ), $ct->title, $ct->parent_theme); ?></p>
    86 <?php } else { ?>
    87     <p><?php printf(__('All of this theme&#8217;s files are located in <code>%2$s</code>.'), $ct->title, str_replace( WP_CONTENT_DIR, '', $ct->template_dir ), str_replace( WP_CONTENT_DIR, '', $ct->stylesheet_dir ) ); ?></p>
    88 <?php } ?>
    89 <?php if ( $ct->tags ) : ?>
    90 <p><?php _e('Tags:'); ?> <?php echo join(', ', $ct->tags); ?></p>
    91 <?php endif; ?>
     84<div class="theme-options">
     85    <span><?php _e( 'Options:' )?></span>
     86    <?php
     87    // Pretend you didn't see this.
     88    $options = array();
     89    if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) {
     90        foreach ( (array) $submenu['themes.php'] as $item) {
     91            $class = '';
     92            if ( 'themes.php' == $item[2] || 'theme-editor.php' == $item[2] )
     93                continue;
     94            // 0 = name, 1 = capability, 2 = file
     95            if ( ( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file)) ) $class = ' class="current"';
     96
     97            if ( !empty($submenu[$item[2]]) ) {
     98                $submenu[$item[2]] = array_values($submenu[$item[2]]);  // Re-index.
     99                $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
     100                if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
     101                    $options[] = "<a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
     102                else
     103                    $options[] = "<a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
     104            } else if ( current_user_can($item[1]) ) {
     105                if ( file_exists(ABSPATH . 'wp-admin/' . $item[2]) ) {
     106                    $options[] = "<a href='{$item[2]}'$class>{$item[0]}</a>";
     107                } else {
     108                    $options[] = "<a href='themes.php?page={$item[2]}'$class>{$item[0]}</a>";
     109                }
     110            }
     111        }
     112    }
     113    echo implode ( ' | ', $options );
     114   
     115    if ( $ct->tags ) : ?>
     116    <p><?php _e('Tags:'); ?> <?php echo join(', ', $ct->tags); ?></p>
     117    <?php endif; ?>
     118</div>
    92119<?php theme_update_available($ct); ?>
    93120
Note: See TracChangeset for help on using the changeset viewer.