WordPress.org

Plugin Directory

Changeset 691436


Ignore:
Timestamp:
04/04/13 00:24:18 (5 years ago)
Author:
tmoorewp
Message:

Shortcodes: Only use HTML 5, rather than flash, for a player.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jetpack/trunk/modules/shortcodes/audio.php

    r661038 r691436  
    1515        add_action( 'wp_enqueue_scripts', array( $this, 'check_infinite' ) ); 
    1616        add_action( 'infinite_scroll_render', array( $this, 'audio_shortcode_infinite' ), 11 ); 
     17    } 
     18 
     19    /** 
     20     * Return the $url of the audio 
     21     */ 
     22    static function get_audio_id( $atts ) { 
     23        if ( isset( $atts[0] ) ) 
     24            return $atts[0]; 
     25        else 
     26            return 0; 
    1727    } 
    1828 
     
    8090        $sound_file = $data[0]; 
    8191        $sound_files = explode( ',', $sound_file ); 
     92 
     93        if ( is_ssl() ) { 
     94            for ( $i = 0; $i < count( $sound_files ); $i++ ) { 
     95                $sound_files[ $i ] = preg_replace( '#^http://([^.]+).files.wordpress.com/#', 'https://$1.files.wordpress.com/', $sound_files[ $i ] ); 
     96            } 
     97        } 
     98 
    8299        $sound_files = array_map( 'trim', $sound_files ); 
    83100        $sound_files = array_map( array( $this, 'rawurlencode_spaces' ), $sound_files ); 
     
    233250        $html5_audio .= "<span id='wp-as-{$post->ID}_{$ap_playerID}-playing'></span>"; 
    234251 
     252        if ( is_ssl() ) 
     253            $protocol = 'https'; 
     254        else 
     255            $protocol = 'http'; 
     256 
    235257        $swfurl = apply_filters( 
    236258            'jetpack_static_url', 
    237             'http://en.wordpress.com/wp-content/plugins/audio-player/player.swf' ); 
     259            "$protocol://en.wordpress.com/wp-content/plugins/audio-player/player.swf" ); 
    238260 
    239261        // all the fancy javascript is causing Google Reader to break, just include flash in GReader 
     
    243265        } 
    244266 
    245         if ( $all_mp3 ) { 
    246             // process regular flash player, inserting HTML5 tags into object as fallback 
    247             $audio_tags = <<<FLASH 
    248                 <object id='wp-as-{$post->ID}_{$ap_playerID}-flash' type='application/x-shockwave-flash' data='$swfurl' width='$width' height='24'> 
    249                     <param name='movie' value='$swfurl' /> 
    250                     <param name='FlashVars' value='{$flash_vars}' /> 
    251                     <param name='quality' value='high' /> 
    252                     <param name='menu' value='false' /> 
    253                     <param name='bgcolor' value='$bgcolor' /> 
    254                     <param name='wmode' value='opaque' /> 
    255                     $html5_audio 
    256                 </object> 
    257 FLASH; 
    258         } else { // just HTML5 for non-mp3 versions 
    259             $audio_tags = $html5_audio; 
    260         } 
     267        $audio_tags = $html5_audio; 
    261268 
    262269        // strip out all the bad files before it reaches .js 
Note: See TracChangeset for help on using the changeset viewer.