meta_box_prefs

Definition:
function meta_box_prefs($screen) {}

Parameters

  • unknown_type $screen

Source code

function meta_box_prefs($screen) {

	global $wp_meta_boxes;



	if ( is_string($screen) )

		$screen = convert_to_screen($screen);



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

		return;



	$hidden = get_hidden_meta_boxes($screen);



	foreach ( array_keys($wp_meta_boxes[$screen->id]) as $context ) {

		foreach ( array_keys($wp_meta_boxes[$screen->id][$context]) as $priority ) {

			foreach ( $wp_meta_boxes[$screen->id][$context][$priority] as $box ) {

				if ( false == $box || ! $box['title'] )

					continue;

				// Submit box cannot be hidden

				if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] )

					continue;

				$box_id = $box['id'];

				echo '<label for="' . $box_id . '-hide">';

				echo '<input class="hide-postbox-tog" name="' . $box_id . '-hide" type="checkbox" id="' . $box_id . '-hide" value="' . $box_id . '"' . (! in_array($box_id, $hidden) ? ' checked="checked"' : '') . ' />';

				echo "{$box['title']}</label>\n";

			}

		}

	}

2399

menu_page_url

Definition:
function menu_page_url($menu_slug, $echo = true) {}

Get the url to access a particular menu page based on the slug it was registered with.
If the slug hasn’t been registered properly no url will be returned

Parameters

  • string $menu_slug: The slug name to refer to this menu by (should be unique for this menu)
  • bool $echo: Whether or not to echo the url – default is true

Return values

returns:the url

Source code

function menu_page_url($menu_slug, $echo = true) {

	global $_parent_pages;



	if ( isset( $_parent_pages[$menu_slug] ) ) {

		$parent_slug = $_parent_pages[$menu_slug];

		if ( $parent_slug && ! isset( $_parent_pages[$parent_slug] ) ) {

			$url = admin_url( add_query_arg( 'page', $menu_slug, $parent_slug ) );

		} else {

			$url = admin_url( 'admin.php?page=' . $menu_slug );

		}

	} else {

		$url = '';

	}



	$url = esc_url($url);



	if ( $echo )

		echo $url;



	return $url;

}

2397

media_upload_video

Definition:
function media_upload_video() {}

Defined filters

  • video_send_to_editor_url
    apply_filters('video_send_to_editor_url', $html, $href, $title)

Source code

function media_upload_video() {

	$errors = array();

	$id = 0;



	if ( isset($_POST['html-upload']) && !empty($_FILES) ) {

		check_admin_referer('media-form');

		// Upload File button was clicked

		$id = media_handle_upload('async-upload', $_REQUEST['post_id']);

		unset($_FILES);

		if ( is_wp_error($id) ) {

			$errors['upload_error'] = $id;

			$id = false;

		}

	}



	if ( !empty($_POST['insertonlybutton']) ) {

		$href = $_POST['insertonly']['href'];

		if ( !empty($href) && !strpos($href, '://') )

			$href = "http://$href";



		$title = esc_attr($_POST['insertonly']['title']);

        if ( empty($title) )

            $title = esc_attr( basename($href) );



		if ( !empty($title) && !empty($href) )

            $html = "<a href='" . esc_url($href) . "' >$title</a>";



		$html = apply_filters('video_send_to_editor_url', $html, $href, $title);



		return media_send_to_editor($html);

	}



	if ( !empty($_POST) ) {

		$return = media_upload_form_handler();



		if ( is_string($return) )

			return $return;

		if ( is_array($return) )

			$errors = $return;

	}



	if ( isset($_POST['save']) ) {

		$errors['upload_notice'] = __('Saved.');

		return media_upload_gallery();

	}



	if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' )

		return wp_iframe( 'media_upload_type_url_form', 'video', $errors, $id );



	return wp_iframe( 'media_upload_type_form', 'video', $errors, $id );

}

2395

media_upload_use_flash

Definition:
function media_upload_use_flash($flash) {}

Support a GET parameter for disabling the flash uploader.

Parameters

  • unknown_type $flash

Source code

function media_upload_use_flash($flash) {

	if ( array_key_exists('flash', $_REQUEST) )

		$flash = !empty($_REQUEST['flash']);

	return $flash;

}

2393

media_upload_type_url_form

Definition:
function media_upload_type_url_form($type = 'file', $errors = null, $id = null) {}

Parameters

  • unknown_type $type
  • unknown_type $errors
  • unknown_type $id

Defined filters

  • media_upload_form_url
    apply_filters('media_upload_form_url', $form_action_url, $type)
  • disable_captions
    apply_filters( 'disable_captions', '' )
  • $callback
    apply_filters($callback, call_user_func($callback)

Source code

function media_upload_type_url_form($type = 'file', $errors = null, $id = null) {

	media_upload_header();



	$post_id = intval($_REQUEST['post_id']);



	$form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");

	$form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);



	$callback = "type_url_form_$type";

?>



<form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form type-form validate" id="<?php echo $type; ?>-form">

<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />

<?php wp_nonce_field('media-form'); ?>



<?php if ( is_callable($callback) ) { ?>



<h3 class="media-title"><?php _e('Add media file from URL'); ?></h3>



<script type="text/javascript">

//<![CDATA[

var addExtImage = {



	width : '',

	height : '',

	align : 'alignnone',



	insert : function() {

		var t = this, html, f = document.forms[0], cls, title = '', alt = '', caption = '';



		if ( '' == f.src.value || '' == t.width )

			return false;



		if ( f.title.value ) {

			title = f.title.value.replace(/'/g, ''').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');

			title = ' title="'+title+'"';

		}



		if ( f.alt.value )

			alt = f.alt.value.replace(/'/g, ''').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');



<?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?>

		if ( f.caption.value )

			caption = f.caption.value.replace(/'/g, ''').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');

<?php } ?>



		cls = caption ? '' : ' class="'+t.align+'"';



		html = '<img alt="'+alt+'" src="'+f.src.value+'"'+title+cls+' width="'+t.width+'" height="'+t.height+'" />';



		if ( f.url.value )

			html = '<a href="'+f.url.value+'">'+html+'</a>';



		if ( caption )

			html = ''+html+'';



		var win = window.dialogArguments || opener || parent || top;

		win.send_to_editor(html);

		return false;

	},



	resetImageData : function() {

		var t = addExtImage;



		t.width = t.height = '';

		document.getElementById('go_button').style.color = '#bbb';

		if ( ! document.forms[0].src.value )

			document.getElementById('status_img').innerHTML = '*';

		else document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url( admin_url( 'images/no.png' ) ); ?>" alt="" />';

	},



	updateImageData : function() {

		var t = addExtImage;



		t.width = t.preloadImg.width;

		t.height = t.preloadImg.height;

		document.getElementById('go_button').style.color = '#333';

		document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url( admin_url( 'images/yes.png' ) ); ?>" alt="" />';

	},



	getImageData : function() {

		var t = addExtImage, src = document.forms[0].src.value;



		if ( ! src ) {

			t.resetImageData();

			return false;

		}

		document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />';

		t.preloadImg = new Image();

		t.preloadImg.onload = t.updateImageData;

		t.preloadImg.onerror = t.resetImageData;

		t.preloadImg.src = src;

	}

}

//]]>

</script>



<div id="media-items">

<div class="media-item media-blank">

<?php echo apply_filters($callback, call_user_func($callback)); ?>

</div>

</div>

</form>

<?php

	} else {

		wp_die( __('Unknown action.') );

	}

}

2391