Beispiel #1
0
/**
 * {@internal Missing Short Description}}
 *
 * @since 2.5.0
 */
function the_media_upload_tabs()
{
    global $redir_tab;
    $tabs = media_upload_tabs();
    $default = 'type';
    if (!empty($tabs)) {
        echo "<ul id='sidemenu'>\n";
        if (isset($redir_tab) && array_key_exists($redir_tab, $tabs)) {
            $current = $redir_tab;
        } elseif (isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs)) {
            $current = $_GET['tab'];
        } else {
            /** This filter is documented in wp-admin/media-upload.php */
            $current = apply_filters('media_upload_default_tab', $default);
        }
        foreach ($tabs as $callback => $text) {
            $class = '';
            if ($current == $callback) {
                $class = " class='current'";
            }
            $href = add_query_arg(array('tab' => $callback, 's' => false, 'paged' => false, 'post_mime_type' => false, 'm' => false));
            $link = "<a href='" . esc_url($href) . "'{$class}>{$text}</a>";
            echo "\t<li id='" . esc_attr("tab-{$callback}") . "'>{$link}</li>\n";
        }
        echo "</ul>\n";
    }
}
function the_media_upload_tabs() {
	global $redir_tab;
	$tabs = media_upload_tabs();

	if ( !empty($tabs) ) {
		echo "<ul id='sidemenu'>\n";
		if ( isset($redir_tab) && array_key_exists($redir_tab, $tabs) )
			$current = $redir_tab;
		elseif ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) )
			$current = $_GET['tab'];
		else {
			$keys = array_keys($tabs);
			$current = array_shift($keys);
		}
		foreach ( $tabs as $callback => $text ) {
			$class = '';
			if ( $current == $callback )
				$class = " class='current'";
			$href = add_query_arg(array('tab'=>$callback, 's'=>false, 'paged'=>false, 'post_mime_type'=>false, 'm'=>false));
			$link = "<a href='" . clean_url($href) . "'$class>$text</a>";
			echo "\t<li id='" . attribute_escape("tab-$callback") . "'>$link</li>\n";
		}
		echo "</ul>\n";
	}
}
/**
 * {@internal Missing Short Description}}
 *
 * @since 2.5.0
 */
function the_media_upload_tabs() {
	global $redir_tab;
	$tabs = media_upload_tabs();
	$default = 'type';

	if ( !empty($tabs) ) {
		echo "<ul id='sidemenu'>\n";
		if ( isset($redir_tab) && array_key_exists($redir_tab, $tabs) )
			$current = $redir_tab;
		elseif ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) )
			$current = $_GET['tab'];
		else
			$current = apply_filters('media_upload_default_tab', $default);

		foreach ( $tabs as $callback => $text ) {
			$class = '';

			if ( $current == $callback )
				$class = " class='current'";

			$href = add_query_arg(array('tab' => $callback, 's' => false, 'paged' => false, 'post_mime_type' => false, 'm' => false));
			$link = "<a href='" . esc_url($href) . "'$class>$text</a>";
			echo "\t<li id='" . esc_attr("tab-$callback") . "'>$link</li>\n";
		}
		echo "</ul>\n";
	}
}
    ?>
	<div id="media-items" class="hide-if-no-js"></div>
	<?php 
    submit_button(__('Save all changes'), 'button savebutton hidden', 'save');
    ?>
	</form>
	</div>

<?php 
    include './admin-footer.php';
} else {
    // upload type: image, video, file, ..?
    if (isset($_GET['type'])) {
        $type = strval($_GET['type']);
    } else {
        $type = apply_filters('media_upload_default_type', 'file');
    }
    // tab: gallery, library, or type-specific
    if (isset($_GET['tab'])) {
        $tab = strval($_GET['tab']);
    } else {
        $tab = apply_filters('media_upload_default_tab', 'type');
    }
    $body_id = 'media-upload';
    // let the action code decide how to handle the request
    if ($tab == 'type' || $tab == 'type_url' || !array_key_exists($tab, media_upload_tabs())) {
        do_action("media_upload_{$type}");
    } else {
        do_action("media_upload_{$tab}");
    }
}