Plugin Directory

Changeset 950187


Ignore:
Timestamp:
07/17/2014 10:06:00 AM (12 years ago)
Author:
fsquared
Message:

Added option to resize player in audio posts

Location:
f2-tumblr-widget
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • f2-tumblr-widget/tags/0.2.2/README.txt

    r922315 r950187  
    55Requires at least: 3.3
    66Tested up to: 3.9
    7 Stable tag: 0.2.1
     7Stable tag: 0.2.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2222video and audio posts will have the media displayed when the display type
    2323is not 'title only'.
     24
     25The audio player in posts can now be automatically resized to match the
     26selected media width - this is enabled by default, but can be deselected
     27in the widget setup.
    2428
    2529== Installation ==
     
    4549== Changelog ==
    4650
     51= 0.2.2 =
     52* Added the option to adjust the width of the player in audio posts to match
     53  the chosen media width.
     54
    4755= 0.2.1 =
    4856* Added CSS to ensure that media posts with short text are properly separated.
  • f2-tumblr-widget/tags/0.2.2/f2-tumblr.php

    r922328 r950187  
    1515 * Plugin URI:        http://www.fsquared.co.uk/software/f2-tumblr/
    1616 * Description:       Widget to display recent posts from a tumblr blog
    17  * Version:           0.2.1
     17 * Version:           0.2.2
    1818 * Author:            fsquared limited
    1919 * Author URI:        http://www.fsquared.co.uk
     
    5050        'line_spacing'  => '',
    5151        'media_padding' => '',
     52        'audio_width'   => 1,
    5253    );
    5354
     
    251252        $instance['posts'] = intval( $new_instance['posts'] );
    252253        $instance['cache_period'] = intval( $new_instance['cache_period'] );
     254        $instance['audio_width'] = intval( $new_instance['audio_width'] );
    253255        if ( !empty( $new_instance['excerpt_size'] ) ) {
    254256            $instance['excerpt_size'] = intval( $new_instance['excerpt_size'] );
  • f2-tumblr-widget/tags/0.2.2/views/admin.php

    r918021 r950187  
    140140    </select>
    141141  </label>
     142  <label>
     143    <?php _e( 'Apply to Audio Posts:', $this->get_widget_slug() ); ?>
     144    <input type="checkbox"
     145           id="<?php echo $this->get_field_id('audio_width'); ?>"
     146           name="<?php echo $this->get_field_name('audio_width'); ?>"
     147           value="1"
     148           <?php checked( $local_params['audio_width'], 1 ); ?>>
     149  </label>
    142150</p>
    143151<p>
  • f2-tumblr-widget/tags/0.2.2/views/widget.php

    r918021 r950187  
    8282        break;
    8383    case 'photo':           // Photograph
    84         // Try and extract some sort of sensible title from the caption
    85         $dom = new DOMDocument();
    86         $dom->loadHTML( (string)$the_post->{'photo-caption'} );
    87         $xpath = new DOMXpath( $dom );
    88         $xres = $xpath->query( '//*[name()="h1" or name()="h2" or name()="h3"]' );
    89         if ( $xres->length > 0 ) {
    90             // Save the title
    91             $post_title = $xres->item(0)->nodeValue;
    92 
    93             // And remove it from the DOM document
    94             $xres->item(0)->parentNode->removeChild($xres->item(0));
    95         } else {
    96             // No title found, so pluck out the first sentence instead
    97             $title_split = preg_split(
    98                 '/[.?!:]/',
    99                 strip_tags(
    100                     preg_replace(
    101                         array( '/<a.*?<\/a>/', '/<p>:<\/p>/' ),
    102                         '',
    103                         (string)$the_post->{'photo-caption'}
    104                     )
    105                 ),
    106                 2
    107             );
    108             $post_title = $title_split[0];
     84        // Try and extract some sort of sensible title from the caption,
     85        // assuming of course that there is one!
     86        if ( !empty( $the_post->{'photo-caption'} ) ) {
     87            $dom = new DOMDocument();
     88            $dom->loadHTML( (string)$the_post->{'photo-caption'} );
     89            $xpath = new DOMXpath( $dom );
     90            $xres = $xpath->query( '//*[name()="h1" or name()="h2" or name()="h3"]' );
     91            if ( $xres->length > 0 ) {
     92                // Save the title
     93                $post_title = $xres->item(0)->nodeValue;
     94
     95                // And remove it from the DOM document
     96                $xres->item(0)->parentNode->removeChild($xres->item(0));
     97            } else {
     98                // No title found, so pluck out the first sentence instead
     99                $title_split = preg_split(
     100                    '/[.?!:]/',
     101                    strip_tags(
     102                        preg_replace(
     103                            array( '/<a.*?<\/a>/', '/<p>:<\/p>/' ),
     104                            '',
     105                            (string)$the_post->{'photo-caption'}
     106                        )
     107                    ),
     108                    2
     109                );
     110                $post_title = $title_split[0];
     111            }
    109112        }
    110113
     
    227230        // And now the content, if required
    228231        if ( 'none' != $local_params['content_type'] ) {
    229             $post_media = (string)$the_post->{'audio-player'};
     232            $media_embed = (string)$the_post->{'audio-player'};
     233           
     234            // Optionally, tweak the width to our set media width
     235            if ( 1 == $local_params['audio_width'] ) {
     236                $post_media = preg_replace(
     237                    '/ width="[0-9]+" /',
     238                    ' width="' . $local_params['media_width'] . '" ',
     239                    $media_embed
     240                );
     241            } else {
     242                $post_media = $media_embed;
     243            }
    230244
    231245            // And as much of the body as we require
  • f2-tumblr-widget/trunk/README.txt

    r922315 r950187  
    55Requires at least: 3.3
    66Tested up to: 3.9
    7 Stable tag: 0.2.1
     7Stable tag: 0.2.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2222video and audio posts will have the media displayed when the display type
    2323is not 'title only'.
     24
     25The audio player in posts can now be automatically resized to match the
     26selected media width - this is enabled by default, but can be deselected
     27in the widget setup.
    2428
    2529== Installation ==
     
    4549== Changelog ==
    4650
     51= 0.2.2 =
     52* Added the option to adjust the width of the player in audio posts to match
     53  the chosen media width.
     54
    4755= 0.2.1 =
    4856* Added CSS to ensure that media posts with short text are properly separated.
  • f2-tumblr-widget/trunk/f2-tumblr.php

    r922328 r950187  
    1515 * Plugin URI:        http://www.fsquared.co.uk/software/f2-tumblr/
    1616 * Description:       Widget to display recent posts from a tumblr blog
    17  * Version:           0.2.1
     17 * Version:           0.2.2
    1818 * Author:            fsquared limited
    1919 * Author URI:        http://www.fsquared.co.uk
     
    5050        'line_spacing'  => '',
    5151        'media_padding' => '',
     52        'audio_width'   => 1,
    5253    );
    5354
     
    251252        $instance['posts'] = intval( $new_instance['posts'] );
    252253        $instance['cache_period'] = intval( $new_instance['cache_period'] );
     254        $instance['audio_width'] = intval( $new_instance['audio_width'] );
    253255        if ( !empty( $new_instance['excerpt_size'] ) ) {
    254256            $instance['excerpt_size'] = intval( $new_instance['excerpt_size'] );
  • f2-tumblr-widget/trunk/views/admin.php

    r918021 r950187  
    140140    </select>
    141141  </label>
     142  <label>
     143    <?php _e( 'Apply to Audio Posts:', $this->get_widget_slug() ); ?>
     144    <input type="checkbox"
     145           id="<?php echo $this->get_field_id('audio_width'); ?>"
     146           name="<?php echo $this->get_field_name('audio_width'); ?>"
     147           value="1"
     148           <?php checked( $local_params['audio_width'], 1 ); ?>>
     149  </label>
    142150</p>
    143151<p>
  • f2-tumblr-widget/trunk/views/widget.php

    r918021 r950187  
    8282        break;
    8383    case 'photo':           // Photograph
    84         // Try and extract some sort of sensible title from the caption
    85         $dom = new DOMDocument();
    86         $dom->loadHTML( (string)$the_post->{'photo-caption'} );
    87         $xpath = new DOMXpath( $dom );
    88         $xres = $xpath->query( '//*[name()="h1" or name()="h2" or name()="h3"]' );
    89         if ( $xres->length > 0 ) {
    90             // Save the title
    91             $post_title = $xres->item(0)->nodeValue;
    92 
    93             // And remove it from the DOM document
    94             $xres->item(0)->parentNode->removeChild($xres->item(0));
    95         } else {
    96             // No title found, so pluck out the first sentence instead
    97             $title_split = preg_split(
    98                 '/[.?!:]/',
    99                 strip_tags(
    100                     preg_replace(
    101                         array( '/<a.*?<\/a>/', '/<p>:<\/p>/' ),
    102                         '',
    103                         (string)$the_post->{'photo-caption'}
    104                     )
    105                 ),
    106                 2
    107             );
    108             $post_title = $title_split[0];
     84        // Try and extract some sort of sensible title from the caption,
     85        // assuming of course that there is one!
     86        if ( !empty( $the_post->{'photo-caption'} ) ) {
     87            $dom = new DOMDocument();
     88            $dom->loadHTML( (string)$the_post->{'photo-caption'} );
     89            $xpath = new DOMXpath( $dom );
     90            $xres = $xpath->query( '//*[name()="h1" or name()="h2" or name()="h3"]' );
     91            if ( $xres->length > 0 ) {
     92                // Save the title
     93                $post_title = $xres->item(0)->nodeValue;
     94
     95                // And remove it from the DOM document
     96                $xres->item(0)->parentNode->removeChild($xres->item(0));
     97            } else {
     98                // No title found, so pluck out the first sentence instead
     99                $title_split = preg_split(
     100                    '/[.?!:]/',
     101                    strip_tags(
     102                        preg_replace(
     103                            array( '/<a.*?<\/a>/', '/<p>:<\/p>/' ),
     104                            '',
     105                            (string)$the_post->{'photo-caption'}
     106                        )
     107                    ),
     108                    2
     109                );
     110                $post_title = $title_split[0];
     111            }
    109112        }
    110113
     
    227230        // And now the content, if required
    228231        if ( 'none' != $local_params['content_type'] ) {
    229             $post_media = (string)$the_post->{'audio-player'};
     232            $media_embed = (string)$the_post->{'audio-player'};
     233           
     234            // Optionally, tweak the width to our set media width
     235            if ( 1 == $local_params['audio_width'] ) {
     236                $post_media = preg_replace(
     237                    '/ width="[0-9]+" /',
     238                    ' width="' . $local_params['media_width'] . '" ',
     239                    $media_embed
     240                );
     241            } else {
     242                $post_media = $media_embed;
     243            }
    230244
    231245            // And as much of the body as we require
Note: See TracChangeset for help on using the changeset viewer.