_device_can_upload example

<?php             /* translators: Hidden accessibility text. */
            _e( 'Close uploader' );
            ?> </span></button> <# } #> <div class="uploader-inline-content {{ messageClass }}"> <# if ( data.message ) { #> <h2 class="upload-message">{{ data.message }}</h2> <# } #> <?php if ( ! _device_can_upload() ) : ?> <div class="upload-ui"> <h2 class="upload-instructions"><?php _e( 'Your browser cannot upload files' ); ?></h2> <p> <?php                     printf(
                        /* translators: %s: https://apps.wordpress.org/ */
                        __( 'The web browser on your device cannot be used to upload files. You may be able to use the <a href="%s">native app for your device</a> instead.' ),
                        'https://apps.wordpress.org/'
                    );
                ?> </p> </div>

    $params = apply_filters( 'plupload_default_params', $params );

    $params['_wpnonce'] = wp_create_nonce( 'media-form' );

    $defaults['multipart_params'] = $params;

    $settings = array(
        'defaults'      => $defaults,
        'browser'       => array(
            'mobile'    => wp_is_mobile(),
            'supported' => _device_can_upload(),
        ),
        'limitExceeded' => is_multisite() && ! is_upload_space_available(),
    );

    $script = 'var _wpPluploadSettings = ' . wp_json_encode( $settings ) . ';';

    if ( $data ) {
        $script = "$data\n$script";
    }

    $wp_scripts->add_data( 'wp-plupload', 'data', $script );
}

function media_upload_form( $errors = null ) {
    global $type$tab$is_IE$is_opera;

    if ( ! _device_can_upload() ) {
        echo '<p>' . sprintf(
            /* translators: %s: https://apps.wordpress.org/ */
            __( 'The web browser on your device cannot be used to upload files. You may be able to use the <a href="%s">native app for your device</a> instead.' ),
            'https://apps.wordpress.org/'
        ) . '</p>';
        return;
    }

    $upload_action_url = admin_url( 'async-upload.php' );
    $post_id           = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
    $_type             = isset( $type ) ? $type : '';
    
Home | Imprint | This part of the site doesn't use cookies.