-
+ 16023917F295E698F79C150EE79D54AC67115F2974BB25427927914748FF5873C5072DC3F7C7F30F7E78228D10A9751B0C2A600FB40F8A701ACEB1A1B88396A8
mp-wp/wp-admin/themes.php
(0 . 0)(1 . 255)
57634 <?php
57635 /**
57636 * Themes administration panel.
57637 *
57638 * @package WordPress
57639 * @subpackage Administration
57640 */
57641
57642 /** WordPress Administration Bootstrap */
57643 require_once('admin.php');
57644
57645 if ( isset($_GET['action']) ) {
57646 check_admin_referer('switch-theme_' . $_GET['template']);
57647
57648 if ('activate' == $_GET['action']) {
57649 switch_theme($_GET['template'], $_GET['stylesheet']);
57650 wp_redirect('themes.php?activated=true');
57651 exit;
57652 }
57653 }
57654
57655 $title = __('Manage Themes');
57656 $parent_file = 'themes.php';
57657
57658 add_thickbox();
57659 wp_enqueue_script( 'theme-preview' );
57660
57661 require_once('admin-header.php');
57662 ?>
57663
57664 <?php if ( ! validate_current_theme() ) : ?>
57665 <div id="message1" class="updated fade"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div>
57666 <?php elseif ( isset($_GET['activated']) ) : ?>
57667 <div id="message2" class="updated fade"><p><?php printf(__('New theme activated. <a href="%s">Visit site</a>'), get_bloginfo('url') . '/'); ?></p></div>
57668 <?php endif; ?>
57669
57670 <?php
57671 $themes = get_themes();
57672 $ct = current_theme_info();
57673
57674 ksort( $themes );
57675 $theme_total = count( $themes );
57676 $per_page = 15;
57677
57678 if ( isset( $_GET['pagenum'] ) )
57679 $page = absint( $_GET['pagenum'] );
57680
57681 if ( empty($page) )
57682 $page = 1;
57683
57684 $start = $offset = ( $page - 1 ) * $per_page;
57685
57686 $page_links = paginate_links( array(
57687 'base' => add_query_arg( 'pagenum', '%#%' ) . '#themenav',
57688 'format' => '',
57689 'prev_text' => __('«'),
57690 'next_text' => __('»'),
57691 'total' => ceil($theme_total / $per_page),
57692 'current' => $page
57693 ));
57694
57695 $themes = array_slice( $themes, $start, $per_page );
57696
57697 /**
57698 * Check if there is an update for a theme available.
57699 *
57700 * Will display link, if there is an update available.
57701 *
57702 * @since 2.7.0
57703 *
57704 * @param object $theme Theme data object.
57705 * @return bool False if no valid info was passed.
57706 */
57707 function theme_update_available( $theme ) {
57708 static $themes_update;
57709 if ( !isset($themes_update) )
57710 $themes_update = get_option('update_themes');
57711
57712 if ( is_object($theme) && isset($theme->stylesheet) )
57713 $stylesheet = $theme->stylesheet;
57714 elseif ( is_array($theme) && isset($theme['Stylesheet']) )
57715 $stylesheet = $theme['Stylesheet'];
57716 else
57717 return false; //No valid info passed.
57718
57719 if ( isset($themes_update->response[ $stylesheet ]) ) {
57720 $update = $themes_update->response[ $stylesheet ];
57721 $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']); //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list.
57722 $update_url = wp_nonce_url('update.php?action=upgrade-theme&theme=' . urlencode($stylesheet), 'upgrade-theme_' . $stylesheet);
57723
57724 if ( ! current_user_can('update_themes') )
57725 printf( __('<p>There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a>.</p>'), $ct->name, $details_url, $update['new_version']);
57726 else if ( empty($update->package) )
57727 printf( __('<p>There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> <em>automatic upgrade unavailable for this theme</em>.</p>'), $ct->name, $details_url, $update['new_version']);
57728 else
57729 printf( __('<p>There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> or <a href="%4$s">upgrade automatically</a>.</p>'), $ct->name, $details_url, $update['new_version'], $update_url );
57730 }
57731 }
57732
57733 ?>
57734
57735 <div class="wrap">
57736 <?php screen_icon(); ?>
57737 <h2><?php echo wp_specialchars( $title ); ?></h2>
57738
57739 <h3><?php _e('Current Theme'); ?></h3>
57740 <div id="current-theme">
57741 <?php if ( $ct->screenshot ) : ?>
57742 <img src="<?php echo WP_CONTENT_URL . $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" />
57743 <?php endif; ?>
57744 <h4><?php printf(_c('%1$s %2$s by %3$s|1: theme title, 2: theme version, 3: theme author'), $ct->title, $ct->version, $ct->author) ; ?></h4>
57745 <p class="description"><?php echo $ct->description; ?></p>
57746 <?php if ($ct->parent_theme) { ?>
57747 <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, $ct->template_dir, $ct->stylesheet_dir, $ct->title, $ct->parent_theme); ?></p>
57748 <?php } else { ?>
57749 <p><?php printf(__('All of this theme’s files are located in <code>%2$s</code>.'), $ct->title, $ct->template_dir, $ct->stylesheet_dir); ?></p>
57750 <?php } ?>
57751 <?php if ( $ct->tags ) : ?>
57752 <p><?php _e('Tags:'); ?> <?php echo join(', ', $ct->tags); ?></p>
57753 <?php endif; ?>
57754 <?php theme_update_available($ct); ?>
57755
57756 </div>
57757 <div class="clear"></div>
57758 <h3><?php _e('Available Themes'); ?></h3>
57759 <div class="clear"></div>
57760
57761 <?php if ( $page_links ) : ?>
57762 <div class="tablenav">
57763 <div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s–%s of %s' ) . '</span>%s',
57764 number_format_i18n( $start + 1 ),
57765 number_format_i18n( min( $page * $per_page, $theme_total ) ),
57766 number_format_i18n( $theme_total ),
57767 $page_links
57768 ); echo $page_links_text; ?></div>
57769 </div>
57770 <?php endif; ?>
57771
57772 <?php if ( 1 < $theme_total ) { ?>
57773 <table id="availablethemes" cellspacing="0" cellpadding="0">
57774 <?php
57775 $style = '';
57776
57777 $theme_names = array_keys($themes);
57778 natcasesort($theme_names);
57779
57780 $rows = ceil(count($theme_names) / 3);
57781 for ( $row = 1; $row <= $rows; $row++ )
57782 for ( $col = 1; $col <= 3; $col++ )
57783 $table[$row][$col] = array_shift($theme_names);
57784
57785 foreach ( $table as $row => $cols ) {
57786 ?>
57787 <tr>
57788 <?php
57789 foreach ( $cols as $col => $theme_name ) {
57790 $class = array('available-theme');
57791 if ( $row == 1 ) $class[] = 'top';
57792 if ( $col == 1 ) $class[] = 'left';
57793 if ( $row == $rows ) $class[] = 'bottom';
57794 if ( $col == 3 ) $class[] = 'right';
57795 ?>
57796 <td class="<?php echo join(' ', $class); ?>">
57797 <?php if ( !empty($theme_name) ) :
57798 $template = $themes[$theme_name]['Template'];
57799 $stylesheet = $themes[$theme_name]['Stylesheet'];
57800 $title = $themes[$theme_name]['Title'];
57801 $version = $themes[$theme_name]['Version'];
57802 $description = $themes[$theme_name]['Description'];
57803 $author = $themes[$theme_name]['Author'];
57804 $screenshot = $themes[$theme_name]['Screenshot'];
57805 $stylesheet_dir = $themes[$theme_name]['Stylesheet Dir'];
57806 $preview_link = clean_url( get_option('home') . '/');
57807 $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true', 'width' => 600, 'height' => 400 ), $preview_link ) );
57808 $preview_text = attribute_escape( sprintf( __('Preview of "%s"'), $title ) );
57809 $tags = $themes[$theme_name]['Tags'];
57810 $thickbox_class = 'thickbox';
57811 $activate_link = wp_nonce_url("themes.php?action=activate&template=".urlencode($template)."&stylesheet=".urlencode($stylesheet), 'switch-theme_' . $template);
57812 $activate_text = attribute_escape( sprintf( __('Activate "%s"'), $title ) );
57813 ?>
57814 <a href="<?php echo $activate_link; ?>" class="<?php echo $thickbox_class; ?> screenshot">
57815 <?php if ( $screenshot ) : ?>
57816 <img src="<?php echo WP_CONTENT_URL . $stylesheet_dir . '/' . $screenshot; ?>" alt="" />
57817 <?php endif; ?>
57818 </a>
57819 <h3><a class="<?php echo $thickbox_class; ?>" href="<?php echo $activate_link; ?>"><?php echo $title; ?></a></h3>
57820 <p><?php echo $description; ?></p>
57821 <?php if ( $tags ) : ?>
57822 <p><?php _e('Tags:'); ?> <?php echo join(', ', $tags); ?></p>
57823 <?php endif; ?>
57824 <?php theme_update_available( $themes[$theme_name] ); ?>
57825 <noscript><p class="themeactions"><a href="<?php echo $preview_link; ?>" title="<?php echo $preview_text; ?>"><?php _e('Preview'); ?></a> <a href="<?php echo $activate_link; ?>" title="<?php echo $activate_text; ?>"><?php _e('Activate'); ?></a></p></noscript>
57826 <div style="display:none;"><a class="previewlink" href="<?php echo $preview_link; ?>"><?php echo $preview_text; ?></a> <a class="activatelink" href="<?php echo $activate_link; ?>"><?php echo $activate_text; ?></a></div>
57827 <?php endif; // end if not empty theme_name ?>
57828 </td>
57829 <?php } // end foreach $cols ?>
57830 </tr>
57831 <?php } // end foreach $table ?>
57832 </table>
57833 <?php } ?>
57834
57835 <br class="clear" />
57836
57837 <?php if ( $page_links ) : ?>
57838 <div class="tablenav">
57839 <?php echo "<div class='tablenav-pages'>$page_links_text</div>"; ?>
57840 <br class="clear" />
57841 </div>
57842 <?php endif; ?>
57843
57844 <br class="clear" />
57845
57846 <?php
57847 // List broken themes, if any.
57848 $broken_themes = get_broken_themes();
57849 if ( count($broken_themes) ) {
57850 ?>
57851
57852 <h2><?php _e('Broken Themes'); ?></h2>
57853 <p><?php _e('The following themes are installed but incomplete. Themes must have a stylesheet and a template.'); ?></p>
57854
57855 <table width="100%" cellpadding="3" cellspacing="3">
57856 <tr>
57857 <th><?php _e('Name'); ?></th>
57858 <th><?php _e('Description'); ?></th>
57859 </tr>
57860 <?php
57861 $theme = '';
57862
57863 $theme_names = array_keys($broken_themes);
57864 natcasesort($theme_names);
57865
57866 foreach ($theme_names as $theme_name) {
57867 $title = $broken_themes[$theme_name]['Title'];
57868 $description = $broken_themes[$theme_name]['Description'];
57869
57870 $theme = ('class="alternate"' == $theme) ? '' : 'class="alternate"';
57871 echo "
57872 <tr $theme>
57873 <td>$title</td>
57874 <td>$description</td>
57875 </tr>";
57876 }
57877 ?>
57878 </table>
57879 <?php
57880 }
57881 ?>
57882
57883 <h2><?php _e('Get More Themes'); ?></h2>
57884 <p><?php _e('You can find additional themes for your site in the <a href="http://wordpress.org/extend/themes/">WordPress theme directory</a>. To install a theme you generally just need to upload the theme folder into your <code>wp-content/themes</code> directory. Once a theme is uploaded, you should see it on this page.'); ?></p>
57885
57886 </div>
57887
57888 <?php require('admin-footer.php'); ?>