/** * Renders the post site dropdown. * * @since 1.7 */ public function render_post_site_dropdown( $post, $field_id, $field, $meta ) { $id = self::META_PREFIX . $field_id; $desc = isset( $field['desc'] )? $field['desc'] : ''; $multisite_and_main_site = WPRSS_FTP_Utils::is_multisite_and_main_site(); $input = ''; // If the return value of WPRSS_FTP_Utils::is_multisite_and_main_site() // is a string, then it is an error message. Set the description to it. if ( is_string( $multisite_and_main_site ) ) { $desc = $multisite_and_main_site; } // Otherwise, if it is boolean TRUE elseif ( $multisite_and_main_site === TRUE) { // Get the sites and generate a dropdown $sites = WPRSS_FTP_Utils::get_sites(); $input = WPRSS_FTP_Utils::array_to_select( $sites, array( 'id' => $id, 'name' => $id, 'selected' => $meta, ) ); } // If using multisite but not the main site, simply show the site name. elseif ( $multisite_and_main_site === FALSE && is_multisite() ) { $current_site = get_bloginfo('name'); $meta = get_current_blog_id(); $input = "<input type='hidden' name='$id' id='$id' value='$meta' /><b>{$current_site}</b>"; $desc = ''; } // If neither multisite nor main site, do not show the row else return ''; // Show the field row ob_start(); ?> <tr> <th><label for="<?php echo $id; ?>"><?php echo $field['label']; ?></label></th> <td> <?php echo $input; ?> <?php if ( class_exists( 'WPRSS_Help' ) ) { echo WPRSS_Help::get_instance()->do_tooltip( WPRSS_FTP_HELP_PREFIX.$field_id ); } ?> <br/><label class="description" for="<?php echo $id; ?>"><?php echo $desc; ?></label> </td> </tr> <?php return ob_get_clean(); }