[ Index ] |
WordPress Cross Reference |
[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( dirname( __FILE__ ) . '/admin.php' ); 12 13 if ( ! is_multisite() ) 14 wp_die( __( 'Multisite support is not enabled.' ) ); 15 16 if ( ! current_user_can( 'manage_sites' ) ) 17 wp_die( __( 'You do not have sufficient permissions to manage themes for this site.' ) ); 18 19 get_current_screen()->add_help_tab( array( 20 'id' => 'overview', 21 'title' => __('Overview'), 22 'content' => 23 '<p>' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '</p>' . 24 '<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>' . 25 '<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>' . 26 '<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>' . 27 '<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>' 28 ) ); 29 30 get_current_screen()->set_help_sidebar( 31 '<p><strong>' . __('For more information:') . '</strong></p>' . 32 '<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' . 33 '<p>' . __('<a href="http://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>' 34 ); 35 36 $wp_list_table = _get_list_table('WP_MS_Themes_List_Table'); 37 38 $action = $wp_list_table->current_action(); 39 40 $s = isset($_REQUEST['s']) ? $_REQUEST['s'] : ''; 41 42 // Clean up request URI from temporary args for screen options/paging uri's to work as expected. 43 $temp_args = array( 'enabled', 'disabled', 'error' ); 44 $_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] ); 45 $referer = remove_query_arg( $temp_args, wp_get_referer() ); 46 47 $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; 48 49 if ( ! $id ) 50 wp_die( __('Invalid site ID.') ); 51 52 $wp_list_table->prepare_items(); 53 54 $details = get_blog_details( $id ); 55 if ( !can_edit_network( $details->site_id ) ) 56 wp_die( __( 'You do not have permission to access this page.' ) ); 57 58 $is_main_site = is_main_site( $id ); 59 60 if ( $action ) { 61 switch_to_blog( $id ); 62 $allowed_themes = get_option( 'allowedthemes' ); 63 64 switch ( $action ) { 65 case 'enable': 66 check_admin_referer( 'enable-theme_' . $_GET['theme'] ); 67 $theme = $_GET['theme']; 68 $action = 'enabled'; 69 $n = 1; 70 if ( !$allowed_themes ) 71 $allowed_themes = array( $theme => true ); 72 else 73 $allowed_themes[$theme] = true; 74 break; 75 case 'disable': 76 check_admin_referer( 'disable-theme_' . $_GET['theme'] ); 77 $theme = $_GET['theme']; 78 $action = 'disabled'; 79 $n = 1; 80 if ( !$allowed_themes ) 81 $allowed_themes = array(); 82 else 83 unset( $allowed_themes[$theme] ); 84 break; 85 case 'enable-selected': 86 check_admin_referer( 'bulk-themes' ); 87 if ( isset( $_POST['checked'] ) ) { 88 $themes = (array) $_POST['checked']; 89 $action = 'enabled'; 90 $n = count( $themes ); 91 foreach( (array) $themes as $theme ) 92 $allowed_themes[ $theme ] = true; 93 } else { 94 $action = 'error'; 95 $n = 'none'; 96 } 97 break; 98 case 'disable-selected': 99 check_admin_referer( 'bulk-themes' ); 100 if ( isset( $_POST['checked'] ) ) { 101 $themes = (array) $_POST['checked']; 102 $action = 'disabled'; 103 $n = count( $themes ); 104 foreach( (array) $themes as $theme ) 105 unset( $allowed_themes[ $theme ] ); 106 } else { 107 $action = 'error'; 108 $n = 'none'; 109 } 110 break; 111 } 112 113 update_option( 'allowedthemes', $allowed_themes ); 114 restore_current_blog(); 115 116 wp_safe_redirect( add_query_arg( array( 'id' => $id, $action => $n ), $referer ) ); 117 exit; 118 } 119 120 if ( isset( $_GET['action'] ) && 'update-site' == $_GET['action'] ) { 121 wp_safe_redirect( $referer ); 122 exit(); 123 } 124 125 add_thickbox(); 126 add_screen_option( 'per_page', array( 'label' => _x( 'Themes', 'themes per page (screen options)' ) ) ); 127 128 $site_url_no_http = preg_replace( '#^http(s)?://#', '', get_blogaddress_by_id( $id ) ); 129 $title_site_url_linked = sprintf( __('Edit Site: <a href="%1$s">%2$s</a>'), get_blogaddress_by_id( $id ), $site_url_no_http ); 130 $title = sprintf( __('Edit Site: %s'), $site_url_no_http ); 131 132 $parent_file = 'sites.php'; 133 $submenu_file = 'sites.php'; 134 135 require ( ABSPATH . 'wp-admin/admin-header.php' ); ?> 136 137 <div class="wrap"> 138 <h2 id="edit-site"><?php echo $title_site_url_linked ?></h2> 139 <h3 class="nav-tab-wrapper"> 140 <?php 141 $tabs = array( 142 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ), 143 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ), 144 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ), 145 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ), 146 ); 147 foreach ( $tabs as $tab_id => $tab ) { 148 $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : ''; 149 echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>'; 150 } 151 ?> 152 </h3><?php 153 154 if ( isset( $_GET['enabled'] ) ) { 155 $_GET['enabled'] = absint( $_GET['enabled'] ); 156 echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme enabled.', '%s themes enabled.', $_GET['enabled'] ), number_format_i18n( $_GET['enabled'] ) ) . '</p></div>'; 157 } elseif ( isset( $_GET['disabled'] ) ) { 158 $_GET['disabled'] = absint( $_GET['disabled'] ); 159 echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme disabled.', '%s themes disabled.', $_GET['disabled'] ), number_format_i18n( $_GET['disabled'] ) ) . '</p></div>'; 160 } elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) { 161 echo '<div id="message" class="error"><p>' . __( 'No theme selected.' ) . '</p></div>'; 162 } ?> 163 164 <p><?php _e( 'Network enabled themes are not shown on this screen.' ) ?></p> 165 166 <form method="get" action=""> 167 <?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?> 168 <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> 169 </form> 170 171 <?php $wp_list_table->views(); ?> 172 173 <form method="post" action="site-themes.php?action=update-site"> 174 <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> 175 176 <?php $wp_list_table->display(); ?> 177 178 </form> 179 180 </div> 181 <?php include (ABSPATH . 'wp-admin/admin-footer.php'); ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Mar 25 01:41:18 2014 | WordPress honlapkészítés: online1.hu |