| [ XREF Home ] [ Index ] |
PHP Cross Reference of WordPress TrunkProvided by Yoast |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Edit Site Themes Administration Screen 4 * 5 * @package WordPress 6 * @subpackage Multisite 7 * @since 3.1.0 8 */ 9 10 /** Load WordPress Administration Bootstrap */ 11 require_once ( './admin.php' ); 12 13 if ( ! is_multisite() ) 14 wp_die( __( 'Multisite support is not enabled.' ) ); 15 16 $menu_perms = get_site_option( 'menu_items', array() ); 17 18 if ( empty( $menu_perms['themes'] ) && ! is_super_admin() ) 19 wp_die( __( 'Cheatin’ uh?' ) ); 20 21 if ( ! current_user_can( 'manage_sites' ) ) 22 wp_die( __( 'You do not have sufficient permissions to manage themes for this site.' ) ); 23 24 add_contextual_help($current_screen, 25 '<p>' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '</p>' . 26 '<p>' . __('<strong>Info</strong> - The domain and path are rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.') . '</p>' . 27 '<p>' . __('<strong>Users</strong> - This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.') . '</p>' . 28 '<p>' . sprintf( __('<strong>Themes</strong> - This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.' ), network_admin_url( 'themes.php' ) ) . '</p>' . 29 '<p>' . __('<strong>Settings</strong> - This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.') . '</p>' . 30 '<p><strong>' . __('For more information:') . '</strong></p>' . 31 '<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Sites_Screens" target="_blank">Documentation on Site Management</a>') . '</p>' . 32 '<p>' . __('<a href="http://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>' 33 ); 34 35 $wp_list_table = _get_list_table('WP_MS_Themes_List_Table'); 36 37 $action = $wp_list_table->current_action(); 38 39 $s = isset($_REQUEST['s']) ? $_REQUEST['s'] : ''; 40 41 // Clean up request URI from temporary args for screen options/paging uri's to work as expected. 42 $temp_args = array( 'enabled', 'disabled', 'error' ); 43 $_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] ); 44 $referer = remove_query_arg( $temp_args, wp_get_referer() ); 45 46 $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; 47 48 if ( ! $id ) 49 wp_die( __('Invalid site ID.') ); 50 51 $wp_list_table->prepare_items(); 52 53 $details = get_blog_details( $id ); 54 if ( !can_edit_network( $details->site_id ) ) 55 wp_die( __( 'You do not have permission to access this page.' ) ); 56 57 $is_main_site = is_main_site( $id ); 58 59 if ( $action ) { 60 switch_to_blog( $id ); 61 $allowed_themes = get_option( 'allowedthemes' ); 62 63 switch ( $action ) { 64 case 'enable': 65 check_admin_referer( 'enable-theme_' . $_GET['theme'] ); 66 $theme = $_GET['theme']; 67 $action = 'enabled'; 68 $n = 1; 69 if ( !$allowed_themes ) 70 $allowed_themes = array( $theme => true ); 71 else 72 $allowed_themes[$theme] = true; 73 break; 74 case 'disable': 75 check_admin_referer( 'disable-theme_' . $_GET['theme'] ); 76 $theme = $_GET['theme']; 77 $action = 'disabled'; 78 $n = 1; 79 if ( !$allowed_themes ) 80 $allowed_themes = array(); 81 else 82 unset( $allowed_themes[$theme] ); 83 break; 84 case 'enable-selected': 85 check_admin_referer( 'bulk-themes' ); 86 if ( isset( $_POST['checked'] ) ) { 87 $themes = (array) $_POST['checked']; 88 $action = 'enabled'; 89 $n = count( $themes ); 90 foreach( (array) $themes as $theme ) 91 $allowed_themes[ $theme ] = true; 92 } else { 93 $action = 'error'; 94 $n = 'none'; 95 } 96 break; 97 case 'disable-selected': 98 check_admin_referer( 'bulk-themes' ); 99 if ( isset( $_POST['checked'] ) ) { 100 $themes = (array) $_POST['checked']; 101 $action = 'disabled'; 102 $n = count( $themes ); 103 foreach( (array) $themes as $theme ) 104 unset( $allowed_themes[ $theme ] ); 105 } else { 106 $action = 'error'; 107 $n = 'none'; 108 } 109 break; 110 } 111 112 update_option( 'allowedthemes', $allowed_themes ); 113 restore_current_blog(); 114 115 wp_redirect( add_query_arg( $action, $n, $referer ) ); 116 exit; 117 } 118 119 if ( isset( $_GET['action'] ) && 'update-site' == $_GET['action'] ) { 120 wp_redirect( $referer ); 121 exit(); 122 } 123 124 add_thickbox(); 125 add_screen_option( 'per_page', array( 'label' => _x( 'Themes', 'themes per page (screen options)' ) ) ); 126 127 $title = sprintf( __('Edit Site: %s'), get_blogaddress_by_id($id)); 128 $parent_file = 'sites.php'; 129 $submenu_file = 'sites.php'; 130 131 require ('../admin-header.php'); ?> 132 133 <div class="wrap"> 134 <?php screen_icon('ms-admin'); ?> 135 <h2 id="edit-site"><?php echo $title ?></h2> 136 <h3 class="nav-tab-wrapper"> 137 <?php 138 $tabs = array( 139 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ), 140 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ), 141 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ), 142 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ), 143 ); 144 foreach ( $tabs as $tab_id => $tab ) { 145 $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : ''; 146 echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>'; 147 } 148 ?> 149 </h3><?php 150 151 if ( isset( $_GET['enabled'] ) ) { 152 $_GET['enabled'] = absint( $_GET['enabled'] ); 153 echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme enabled.', '%s themes enabled.', $_GET['enabled'] ), number_format_i18n( $_GET['enabled'] ) ) . '</p></div>'; 154 } elseif ( isset( $_GET['disabled'] ) ) { 155 $_GET['disabled'] = absint( $_GET['disabled'] ); 156 echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme disabled.', '%s themes disabled.', $_GET['disabled'] ), number_format_i18n( $_GET['disabled'] ) ) . '</p></div>'; 157 } elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) { 158 echo '<div id="message" class="error"><p>' . __( 'No theme selected.' ) . '</p></div>'; 159 } ?> 160 161 <p><?php _e( 'Network enabled themes are not shown on this screen.' ) ?></p> 162 163 <form method="get" action=""> 164 <?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?> 165 <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> 166 </form> 167 168 <?php $wp_list_table->views(); ?> 169 170 <form method="post" action="site-themes.php?action=update-site"> 171 <?php wp_nonce_field( 'edit-site' ); ?> 172 <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> 173 174 <?php $wp_list_table->display(); ?> 175 176 </form> 177 178 </div> 179 <?php include (ABSPATH . 'wp-admin/admin-footer.php'); ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Jun 1 08:30:02 2011 |
Cross-referenced by PHPXref 0.7 Provided by Yoast and awesome WordPress Hosting |