Make WordPress Core

Changeset 19335


Ignore:
Timestamp:
11/18/2011 08:43:16 AM (15 years ago)
Author:
azaozz
Message:

Don't show the uploader on iPads (it's pointless), fixes #19004

Location:
trunk/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/media.php

    r19330 r19335  
    6363 */
    6464function the_media_upload_tabs() {
    65         global $redir_tab;
     65        global $redir_tab, $is_iphone;
    6666        $tabs = media_upload_tabs();
     67
     68        if ( $is_iphone ) {
     69                unset($tabs['type']);
     70                $default = 'type_url';
     71        } else {
     72                $default = 'type';
     73        }
    6774
    6875        if ( !empty($tabs) ) {
    … …  
    7380                        $current = $_GET['tab'];
    7481                else
    75                         $current = apply_filters('media_upload_default_tab', 'type');
     82                        $current = apply_filters('media_upload_default_tab', $default);
    7683
    7784                foreach ( $tabs as $callback => $text ) {
    7885                        $class = '';
     86
    7987                        if ( $current == $callback )
    8088                                $class = " class='current'";
    81                         $href = add_query_arg(array('tab'=>$callback, 's'=>false, 'paged'=>false, 'post_mime_type'=>false, 'm'=>false));
     89
     90                        $href = add_query_arg(array('tab' => $callback, 's' => false, 'paged' => false, 'post_mime_type' => false, 'm' => false));
    8291                        $link = "<a href='" . esc_url($href) . "'$class>$text</a>";
    8392                        echo "\t<li id='" . esc_attr("tab-$callback") . "'>$link</li>\n";
    … …  
    345354<body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="no-js">
    346355<script type="text/javascript">
    347 //<![CDATA[
    348 (function(){
    349 var c = document.body.className;
    350 c = c.replace(/no-js/, 'js');
    351 document.body.className = c;
    352 })();
    353 //]]>
     356document.body.className = document.body.className.replace('no-js', 'js');
    354357</script>
    355358<?php
    … …  
    498501 */
    499502function wp_media_upload_handler() {
     503        global $is_iphone;
     504
    500505        $errors = array();
    501506        $id = 0;
    … …  
    568573        }
    569574
    570         return wp_iframe( 'media_upload_type_form', 'image', $errors, $id );
     575        if ( $is_iphone )
     576                return wp_iframe( 'media_upload_type_url_form', 'image', $errors, $id );
     577        else
     578                return wp_iframe( 'media_upload_type_form', 'image', $errors, $id );
    571579}
    572580
    … …  
    12641272 */
    12651273function media_upload_form( $errors = null ) {
    1266         global $type, $tab, $pagenow, $is_IE, $is_opera;
     1274        global $type, $tab, $pagenow, $is_IE, $is_opera, $is_iphone;
     1275
     1276        if ( $is_iphone )
     1277                return;
    12671278
    12681279        $upload_action_url = admin_url('async-upload.php');
    … …  
    13881399 */
    13891400function media_upload_type_form($type = 'file', $errors = null, $id = null) {
     1401        global $is_iphone;
     1402
     1403        if ( $is_iphone )
     1404                return;
     1405
    13901406        media_upload_header();
    13911407
  • trunk/wp-admin/media-new.php

    r17748 r19335  
    77 */
    88
     9global $is_iphone;
     10
     11if ( $is_iphone ) // cannot upload files from iPhone/iPad
     12        return;
     13
    914$_GET['inline'] = 'true';
    1015/** Administration bootstrap */
  • trunk/wp-admin/menu.php

    r19202 r19335  
    5757        $submenu['upload.php'][5] = array( __('Library'), 'upload_files', 'upload.php');
    5858        /* translators: add new file */
    59         $submenu['upload.php'][10] = array( _x('Add New', 'file'), 'upload_files', 'media-new.php');
     59        if ( !$is_iphone )
     60                $submenu['upload.php'][10] = array( _x('Add New', 'file'), 'upload_files', 'media-new.php');
    6061
    6162$menu[15] = array( __('Links'), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'div' );
Note: See TracChangeset for help on using the changeset viewer.