Make WordPress Core

Ticket #20410: 20410.2.patch

File 20410.2.patch, 4.7 KB (added by SergeyBiryukov, 11 years ago)
  • wp-admin/includes/media.php

     
    6565        global $redir_tab;
    6666        $tabs = media_upload_tabs();
    6767
    68         if ( wp_is_mobile() ) {
     68        if ( ! _device_can_upload() ) {
    6969                unset($tabs['type']);
    7070                $default = 'type_url';
    7171        } else {
     
    598598                return wp_iframe( 'media_upload_type_url_form', $type, $errors, $id );
    599599        }
    600600
    601         if ( wp_is_mobile() )
     601        if ( ! _device_can_upload() )
    602602                return wp_iframe( 'media_upload_type_url_form', 'image', $errors, $id );
    603603        else
    604604                return wp_iframe( 'media_upload_type_form', 'image', $errors, $id );
     
    13061306function media_upload_form( $errors = null ) {
    13071307        global $type, $tab, $pagenow, $is_IE, $is_opera;
    13081308
    1309         if ( wp_is_mobile() )
     1309        if ( ! _device_can_upload() )
    13101310                return;
    13111311
    13121312        $upload_action_url = admin_url('async-upload.php');
     
    14381438 * @param unknown_type $id
    14391439 */
    14401440function media_upload_type_form($type = 'file', $errors = null, $id = null) {
    1441         if ( wp_is_mobile() )
     1441        if ( ! _device_can_upload() )
    14421442                return;
    14431443
    14441444        media_upload_header();
  • wp-admin/media-new.php

     
    1010/** Administration bootstrap */
    1111require_once('./admin.php');
    1212
    13 if ( wp_is_mobile() ) // cannot upload files from mobile devices
     13if ( ! _device_can_upload() ) // cannot upload files from some mobile devices
    1414        return;
    1515
    1616require_once('./media-upload.php');
  • wp-admin/media.php

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

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

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

     
    489489                unset( $cpts['post'] );
    490490        }
    491491
    492         if ( current_user_can( 'upload_files' ) && ! wp_is_mobile() )
     492        if ( current_user_can( 'upload_files' ) && _device_can_upload() )
    493493                $actions[ 'media-new.php' ] = array( _x( 'Media', 'add new from admin bar' ), 'new-media' );
    494494
    495495        if ( current_user_can( 'manage_links' ) )
  • wp-includes/functions.php

     
    36733673        return $clean;
    36743674}
    36753675
     3676/**
     3677 * Test if the current device has the capability to upload files.
     3678 *
     3679 * @since 3.4.0
     3680 * @access private
     3681 *
     3682 * @return bool true|false
     3683 */
     3684function _device_can_upload() {
     3685        global $is_iphone;
     3686
     3687        return ( ! $is_iphone );
     3688}
     3689
  • wp-includes/vars.php

     
    7373        }
    7474}
    7575
    76 if ( $is_safari && stripos($_SERVER['HTTP_USER_AGENT'], 'mobile') !== false )
     76if ( $is_safari && ( stripos($_SERVER['HTTP_USER_AGENT'], 'iPhone') !== false || stripos($_SERVER['HTTP_USER_AGENT'], 'iPad') !== false ) )
    7777        $is_iphone = true;
    7878
    7979$is_IE = ( $is_macIE || $is_winIE );