Advertisements

screen_meta

Definition:
function screen_meta($screen) {}

Parameters

  • $screen

Defined filters

  • screen_settings
    apply_filters('screen_settings', '', $screen)
  • screen_options_show_screen
    apply_filters('screen_options_show_screen', $show_screen, $screen)
  • contextual_help_list
    apply_filters('contextual_help_list', $_wp_contextual_help, $screen)
  • default_contextual_help
    apply_filters('default_contextual_help', $default_help)
  • contextual_help
    apply_filters('contextual_help', $contextual_help, $screen->id, $screen)

Source code

function screen_meta($screen) {

	global $wp_meta_boxes, $_wp_contextual_help, $wp_list_table, $wp_current_screen_options;



	if ( is_string($screen) )

		$screen = convert_to_screen($screen);



	$columns = get_column_headers( $screen );

	$hidden = get_hidden_columns( $screen );



	$meta_screens = array('index' => 'dashboard');



	if ( isset($meta_screens[$screen->id]) ) {

		$screen->id = $meta_screens[$screen->id];

		$screen->base = $screen->id;

	}



	$show_screen = false;

	if ( !empty($wp_meta_boxes[$screen->id]) || !empty($columns) )

		$show_screen = true;



	$screen_options = screen_options($screen);

	if ( $screen_options )

		$show_screen = true;



	if ( !isset($_wp_contextual_help) )

		$_wp_contextual_help = array();



	$settings = apply_filters('screen_settings', '', $screen);



	switch ( $screen->id ) {

		case 'widgets':

			$settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n";

			$show_screen = true;

			break;

	}

	if ( ! empty( $settings ) )

		$show_screen = true;



	if ( !empty($wp_current_screen_options) )

		$show_screen = true;



	$show_screen = apply_filters('screen_options_show_screen', $show_screen, $screen);



?>

<div id="screen-meta">

<?php if ( $show_screen ) : ?>

<div id="screen-options-wrap" class="hidden">

	<form id="adv-settings" action="" method="post">

	<?php if ( isset($wp_meta_boxes[$screen->id]) ) : ?>

		<h5><?php _ex('Show on screen', 'Metaboxes') ?></h5>

		<div class="metabox-prefs">

			<?php meta_box_prefs($screen); ?>

			<br class="clear" />

		</div>

		<?php endif;

		if ( ! empty($columns) ) : ?>

		<h5><?php echo ( isset( $columns['_title'] ) ?  $columns['_title'] :  _x('Show on screen', 'Columns') ) ?></h5>

		<div class="metabox-prefs">

<?php

	$special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname');



	foreach ( $columns as $column => $title ) {

		// Can't hide these for they are special

		if ( in_array( $column, $special ) )

			continue;

		if ( empty( $title ) )

			continue;



		if ( 'comments' == $column )

			$title = __( 'Comments' );

		$id = "$column-hide";

		echo '<label for="' . $id . '">';

		echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( !in_array($column, $hidden), true, false ) . ' />';

		echo "$title</label>\n";

	}

?>

			<br class="clear" />

		</div>

	<?php endif;

	echo screen_layout($screen);



	if ( !empty( $screen_options ) ) {

		?>

		<h5><?php _ex('Show on screen', 'Screen Options') ?></h5>

		<?php

	}



	echo $screen_options;

	echo $settings; ?>

<div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div>

</form>

</div>



<?php endif; // $show_screen



	$_wp_contextual_help = apply_filters('contextual_help_list', $_wp_contextual_help, $screen);

	?>

	<div id="contextual-help-wrap" class="hidden">

	<?php

	$contextual_help = '';

	if ( isset($_wp_contextual_help[$screen->id]) ) {

		$contextual_help .= '<div class="metabox-prefs">' . $_wp_contextual_help[$screen->id] . "</div>\n";

	} else {

		$contextual_help .= '<div class="metabox-prefs">';

		$default_help = __('<a href="http://codex.wordpress.org/" target="_blank">Documentation</a>');

		$default_help .= '<br />';

		$default_help .= __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>');

		$contextual_help .= apply_filters('default_contextual_help', $default_help);

		$contextual_help .= "</div>\n";

	}



	echo apply_filters('contextual_help', $contextual_help, $screen->id, $screen);

	?>

	</div>



<div id="screen-meta-links">

<div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle">

<a href="#contextual-help" id="contextual-help-link" class="show-settings"><?php _e('Help') ?></a>

</div>

<?php if ( $show_screen ) { ?>

<div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle">

<a href="#screen-options" id="show-settings-link" class="show-settings"><?php _e('Screen Options') ?></a>

</div>

<?php } ?>

</div>

</div>

<?php

}

2811

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: