WordPress.org

Make WordPress Core

Changeset 20449


Ignore:
Timestamp:
04/12/12 00:16:37 (2 years ago)
Author:
azaozz
Message:

Don't hide links to the upload form and show an error for mobile devices that cannot upload, see #20410

Location:
trunk
Files:
7 edited

Legend:

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

    r20417 r20449  
    6565    global $redir_tab; 
    6666    $tabs = media_upload_tabs(); 
    67  
    68     if ( wp_is_mobile() ) { 
    69         unset($tabs['type']); 
    70         $default = 'type_url'; 
    71     } else { 
    72         $default = 'type'; 
    73     } 
     67    $default = 'type'; 
    7468 
    7569    if ( !empty($tabs) ) { 
     
    599593    } 
    600594 
    601     if ( wp_is_mobile() ) 
    602         return wp_iframe( 'media_upload_type_url_form', 'image', $errors, $id ); 
    603     else 
    604         return wp_iframe( 'media_upload_type_form', 'image', $errors, $id ); 
     595    return wp_iframe( 'media_upload_type_form', 'image', $errors, $id ); 
    605596} 
    606597 
     
    13071298    global $type, $tab, $pagenow, $is_IE, $is_opera; 
    13081299 
    1309     if ( wp_is_mobile() ) 
     1300    if ( ! _device_can_upload() ) { 
     1301        echo '<p>' . __('The web browser on your device cannot be used to upload files. You may be able to use the <a href=" http://wordpress.org/extend/mobile/">native app for your device</a> instead.') . '</p>'; 
    13101302        return; 
     1303    } 
    13111304 
    13121305    $upload_action_url = admin_url('async-upload.php'); 
     
    14391432 */ 
    14401433function media_upload_type_form($type = 'file', $errors = null, $id = null) { 
    1441     if ( wp_is_mobile() ) 
    1442         return; 
    14431434 
    14441435    media_upload_header(); 
  • trunk/wp-admin/media-new.php

    r20420 r20449  
    1010/** Administration bootstrap */ 
    1111require_once('./admin.php'); 
    12  
    13 if ( wp_is_mobile() ) // cannot upload files from mobile devices 
    14     return; 
    15  
    1612require_once('./media-upload.php'); 
  • trunk/wp-admin/media.php

    r20422 r20449  
    107107<?php 
    108108echo esc_html( $title ); 
    109 if ( current_user_can( 'upload_files' ) && ! wp_is_mobile() ) { ?> 
     109if ( current_user_can( 'upload_files' ) ) { ?> 
    110110    <a href="media-new.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'file'); ?></a> 
    111111<?php } ?> 
  • trunk/wp-admin/menu.php

    r20417 r20449  
    5757    $submenu['upload.php'][5] = array( __('Library'), 'upload_files', 'upload.php'); 
    5858    /* translators: add new file */ 
    59     if ( ! wp_is_mobile() ) 
    60         $submenu['upload.php'][10] = array( _x('Add New', 'file'), 'upload_files', 'media-new.php'); 
     59    $submenu['upload.php'][10] = array( _x('Add New', 'file'), 'upload_files', 'media-new.php'); 
    6160 
    6261$menu[15] = array( __('Links'), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'div' ); 
  • trunk/wp-admin/upload.php

    r20422 r20449  
    180180<?php 
    181181echo esc_html( $title ); 
    182 if ( current_user_can( 'upload_files' ) && ! wp_is_mobile() ) { ?> 
     182if ( current_user_can( 'upload_files' ) ) { ?> 
    183183    <a href="media-new.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'file'); ?></a><?php 
    184184} 
  • trunk/wp-includes/admin-bar.php

    r20422 r20449  
    490490    } 
    491491 
    492     if ( current_user_can( 'upload_files' ) && ! wp_is_mobile() ) 
     492    if ( current_user_can( 'upload_files' ) ) 
    493493        $actions[ 'media-new.php' ] = array( _x( 'Media', 'add new from admin bar' ), 'new-media' ); 
    494494 
  • trunk/wp-includes/functions.php

    r20440 r20449  
    36773677} 
    36783678 
     3679/** 
     3680 * Test if the current device has the capability to upload files. 
     3681 * 
     3682 * @since 3.4.0 
     3683 * @access private 
     3684 * 
     3685 * @return bool true|false 
     3686 */ 
     3687function _device_can_upload() { 
     3688    if ( ! wp_is_mobile() ) 
     3689        return true; 
     3690 
     3691    $ua = $_SERVER['HTTP_USER_AGENT']; 
     3692     
     3693    if ( strpos($ua, 'iPhone') !== false 
     3694        || strpos($ua, 'iPad') !== false 
     3695        || strpos($ua, 'iPod') !== false ) { 
     3696            return false; 
     3697    } else { 
     3698        return true; 
     3699    } 
     3700} 
     3701 
Note: See TracChangeset for help on using the changeset viewer.