Plugin Directory

Changeset 803113


Ignore:
Timestamp:
11/12/2013 02:19:56 PM (12 years ago)
Author:
migueluy
Message:

Jetpack: Shortcodes: Bandcamp: update to the bandcamp shortcode from Neal Tucker. New 'tracklist' attribute, more 'artwork' attribute values, and minimal
attribute.
Dailymotion: Update to use an iframe and html5 player vs. a flash player. This makes the shortcode work on mobile too. Props @kraftbj.

Location:
jetpack/trunk/modules/shortcodes
Files:
3 edited

Legend:

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

    r739902 r803113  
    2020        'height'        => null,        // integer with optional "%"
    2121        'notracklist'   => null,        // may be string "true" (defaults false)
    22         'artwork'       => null,        // may be string "false" (defaults true)
     22        'tracklist'     => null,        // may be string "false" (defaults true)
     23        'artwork'       => null,        // may be string "false" (alternately: "none") or "small" (default is large)
     24        'minimal'       => null,        // may be string "true" (defaults false)
    2325        'theme'         => null,        // may be theme identifier string ("light"|"dark" so far)
    2426        'package'       => null,        // integer package id
     
    127129    }
    128130
    129     if ( $attributes['artwork'] == "false" ) {
    130         $url .= "/artwork=false";
     131    // 'tracklist' arg deprecates 'notracklist=true' to be less weird.
     132    // Note, behavior if both are specified is undefinied
     133    switch ( $attributes['tracklist'] ) {
     134        case "false":
     135        case "none":
     136            $url .= "/tracklist=false";
     137            break;
     138    }
     139
     140    switch ( $attributes['artwork'] ) {
     141        case "false":
     142        case "none":
     143        case "small":
     144            $url .= "/artwork=" . $attributes['artwork'];
     145            break;
     146    }
     147
     148    if ( $attributes['minimal'] == "true" ) {
     149        $url .= "/minimal=true";
    131150    }
    132151
  • jetpack/trunk/modules/shortcodes/dailymotion.php

    r692359 r803113  
    6767 * The new style is now:
    6868 * [dailymotion id=x8oma9 title=2 user=3 video=4]
     69 * @todo: Update code to sniff for iframe embeds and convert those to shortcodes.
    6970 *
    7071 * @param array $atts
     
    9798    $id = urlencode( $id );
    9899
    99     $output = '<object width="' . $width . '" height="' . $height . '"><param name="movie" value="http://www.dailymotion.com/swf/';
    100     $after = '';
    101     if ( preg_match( '/^[a-z0-9]+$/', $id ) ) {
    102         $output .= $id;
     100    if ( preg_match( '/^[A-Za-z0-9]+$/', $id ) ) {
     101        $output = '<iframe width="' . $width . '" height="' . $height . '" src="http://www.dailymotion.com/embed/video/' . $id . '" frameborder="0"></iframe>';
     102        $after = '';
    103103
    104104        if ( array_key_exists( 'video', $atts ) && $video = preg_replace( '/[^-a-z0-9_]/i', '', $atts['video'] ) && array_key_exists( 'title', $atts ) && $title = wp_kses( $atts['title'], array() ) )
     
    109109    }
    110110
    111     $output .=  '"></param><param name="allowfullscreen" value="true"></param><param name="wmode" value="opaque"></param><embed src="http://www.dailymotion.com/swf/' . $id . '" width="' . $width . '" height="' . $height . '" allowfullscreen="true" wmode="opaque"></embed></object>';
    112 
    113111    return $output . $after;
    114112}
  • jetpack/trunk/modules/shortcodes/presentations.php

    r798726 r803113  
    141141
    142142        $atts = shortcode_atts( array(
    143             'duration'    => '',
    144             'height'      => '',
    145             'width'       => '',
    146             'bgcolor'     => '',
    147             'bgimg'       => '',
    148             'autoplay'    => '',
     143            'duration'   => '',
     144            'height'     => '',
     145            'width'      => '',
     146            'bgcolor'    => '',
     147            'bgimg'      => '',
     148            'autoplay'   => '',
    149149
    150150            // Settings
    151             'transition'  => '',
    152             'scale'       => '',
    153             'rotate'      => '',
    154             'fade'        => '',
    155             'fadebullets' => '',
     151            'transition' => '',
     152            'scale'      => '',
     153            'rotate'     => '',
     154            'fade'       => '',
     155            'fadebullets'=> '',
    156156        ), $atts );
    157157
    158158        $this->presentation_settings = array(
    159             'transition'  => 'down',
    160             'scale'       => 1,
    161             'rotate'      => 0,
    162             'fade'        => 'on',
    163             'fadebullets' => 0,
    164             'last'        => array(
    165                 'x'       => 0,
    166                 'y'       => 0,
    167                 'scale'   => 1,
    168                 'rotate'  => 0,
     159            'transition' => 'down',
     160            'scale'      => 1,
     161            'rotate'     => 0,
     162            'fade'       => 'on',
     163            'last'       => array(
     164                'x'      => 0,
     165                'y'      => 0,
     166                'scale'  => 1,
     167                'rotate' => 0,
    169168            ),
    170169        );
Note: See TracChangeset for help on using the changeset viewer.