Plugin Directory

Changeset 1957384


Ignore:
Timestamp:
10/16/2018 10:04:12 AM (7 years ago)
Author:
fsquared
Message:

Added user-agent setting to address Tumblr API issues

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

Legend:

Unmodified
Added
Removed
  • f2-tumblr-widget/tags/0.2.12/css/widget.css

    r1217219 r1957384  
    3030  vertical-align: top;
    3131}
     32
     33/* Styles to cope with fully-clickable posts. */
     34.f2-tumblr-post-link {
     35  display: block;
     36}
     37
     38.f2-tumblr-post-link .f2-tumblr-post-clickable {
     39  display: inline-block;
     40}
  • f2-tumblr-widget/tags/0.2.12/f2-tumblr.php

    r1956951 r1957384  
    99 * @license   GPL-2.0+
    1010 * @link      http://www.fsquared.co.uk
    11  * @copyright 2014-2015 fsquared
     11 * @copyright 2014-2018 fsquared
    1212 *
    1313 * @wordpress-plugin
     
    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.11
     17 * Version:           0.2.12
    1818 * Author:            fsquared limited
    1919 * Author URI:        http://www.fsquared.co.uk
     
    5151        'media_padding' => '',
    5252        'audio_width'   => 1,
    53         'clean_quotes'  => 1
     53        'clean_quotes'  => 1,
     54        'link_whole'    => 0,
     55        'user_agent'    => 'Wget/1.18'
    5456    );
    5557
     
    181183            }
    182184            $tumblr_data = wp_remote_retrieve_body(
    183                 wp_remote_get( $tumblr_url )
     185                wp_remote_get( $tumblr_url, array (
     186                    'user-agent' => $local_params['user_agent']
     187                ) )
    184188            );
    185189
     
    253257        $instance['title'] = strip_tags( $new_instance['title'] );
    254258        $instance['post_tag'] = strip_tags( $new_instance['post_tag'] );
     259        $instance['user_agent'] = strip_tags( $new_instance['user_agent'] );
    255260
    256261        // Numeric ones
     
    259264        $instance['audio_width'] = intval( $new_instance['audio_width'] );
    260265        $instance['clean_quotes'] = intval( $new_instance['clean_quotes'] );
     266        $instance['link_whole'] = intval( $new_instance['link_whole'] );
    261267        if ( !empty( $new_instance['excerpt_size'] ) ) {
    262268            $instance['excerpt_size'] = intval( $new_instance['excerpt_size'] );
  • f2-tumblr-widget/tags/0.2.12/views/admin.php

    r1704573 r1957384  
    208208  </label>
    209209</p>
     210<p>
     211  <label>
     212    <?php _E( 'Make whole post clickable:', $this->get_widget_slug() ); ?>
     213    <input type="checkbox"
     214           id="<?php echo $this->get_field_id('link_whole'); ?>"
     215           name="<?php echo $this->get_field_name('link_whole'); ?>"
     216           value="1"
     217           <?php checked( $local_params['link_whole'], 1 ); ?>>
     218  </label>
     219</p>
    210220<h3>Style Settings</h3>
    211221<p>
     
    341351  </label>
    342352</p>
     353<h3>Advanced Settings</h3>
     354<p>
     355  These settings are for advanced tweaking to help address potential problems.
     356  If in doubt, it's best to leave it alone!
     357</p>
     358<p>
     359  <label>
     360    <?php _e( 'User Agent:', $this->get_widget_slug() ); ?>
     361    <input class="widefat"
     362           id="<?php echo $this->get_field_id('user_agent'); ?>"
     363           name="<?php echo $this->get_field_name('user_agent'); ?>"
     364           type="text"
     365           value="<?php echo esc_attr( $local_params['user_agent'] ); ?>">
     366  </label>
     367</p>
  • f2-tumblr-widget/trunk/css/widget.css

    r1217219 r1957384  
    3030  vertical-align: top;
    3131}
     32
     33/* Styles to cope with fully-clickable posts. */
     34.f2-tumblr-post-link {
     35  display: block;
     36}
     37
     38.f2-tumblr-post-link .f2-tumblr-post-clickable {
     39  display: inline-block;
     40}
  • f2-tumblr-widget/trunk/f2-tumblr.php

    r1956951 r1957384  
    99 * @license   GPL-2.0+
    1010 * @link      http://www.fsquared.co.uk
    11  * @copyright 2014-2015 fsquared
     11 * @copyright 2014-2018 fsquared
    1212 *
    1313 * @wordpress-plugin
     
    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.11
     17 * Version:           0.2.12
    1818 * Author:            fsquared limited
    1919 * Author URI:        http://www.fsquared.co.uk
     
    5151        'media_padding' => '',
    5252        'audio_width'   => 1,
    53         'clean_quotes'  => 1
     53        'clean_quotes'  => 1,
     54        'link_whole'    => 0,
     55        'user_agent'    => 'Wget/1.18'
    5456    );
    5557
     
    181183            }
    182184            $tumblr_data = wp_remote_retrieve_body(
    183                 wp_remote_get( $tumblr_url )
     185                wp_remote_get( $tumblr_url, array (
     186                    'user-agent' => $local_params['user_agent']
     187                ) )
    184188            );
    185189
     
    253257        $instance['title'] = strip_tags( $new_instance['title'] );
    254258        $instance['post_tag'] = strip_tags( $new_instance['post_tag'] );
     259        $instance['user_agent'] = strip_tags( $new_instance['user_agent'] );
    255260
    256261        // Numeric ones
     
    259264        $instance['audio_width'] = intval( $new_instance['audio_width'] );
    260265        $instance['clean_quotes'] = intval( $new_instance['clean_quotes'] );
     266        $instance['link_whole'] = intval( $new_instance['link_whole'] );
    261267        if ( !empty( $new_instance['excerpt_size'] ) ) {
    262268            $instance['excerpt_size'] = intval( $new_instance['excerpt_size'] );
  • f2-tumblr-widget/trunk/views/admin.php

    r1704573 r1957384  
    208208  </label>
    209209</p>
     210<p>
     211  <label>
     212    <?php _E( 'Make whole post clickable:', $this->get_widget_slug() ); ?>
     213    <input type="checkbox"
     214           id="<?php echo $this->get_field_id('link_whole'); ?>"
     215           name="<?php echo $this->get_field_name('link_whole'); ?>"
     216           value="1"
     217           <?php checked( $local_params['link_whole'], 1 ); ?>>
     218  </label>
     219</p>
    210220<h3>Style Settings</h3>
    211221<p>
     
    341351  </label>
    342352</p>
     353<h3>Advanced Settings</h3>
     354<p>
     355  These settings are for advanced tweaking to help address potential problems.
     356  If in doubt, it's best to leave it alone!
     357</p>
     358<p>
     359  <label>
     360    <?php _e( 'User Agent:', $this->get_widget_slug() ); ?>
     361    <input class="widefat"
     362           id="<?php echo $this->get_field_id('user_agent'); ?>"
     363           name="<?php echo $this->get_field_name('user_agent'); ?>"
     364           type="text"
     365           value="<?php echo esc_attr( $local_params['user_agent'] ); ?>">
     366  </label>
     367</p>
Note: See TracChangeset for help on using the changeset viewer.