diff --git a/assets/css/stag-shortcodes.css b/assets/css/stag-shortcodes.css index bd8d1db..c85260f 100644 --- a/assets/css/stag-shortcodes.css +++ b/assets/css/stag-shortcodes.css @@ -555,7 +555,8 @@ float: left; margin: 0px 0px 5px 5px; } -.instragram-widget-wrapper img { + +.size-thumbnail img { max-width: 75px; height: auto; } diff --git a/assets/scss/stag-shortcodes.scss b/assets/scss/stag-shortcodes.scss index 5668fa5..11bd45f 100644 --- a/assets/scss/stag-shortcodes.scss +++ b/assets/scss/stag-shortcodes.scss @@ -379,7 +379,10 @@ float: left; margin: 0px 0px 5px 5px; } - img{ +} + +.size-thumbnail { + img { max-width: 75px; height: auto; } diff --git a/includes/widgets/widget-instagram.php b/includes/widgets/widget-instagram.php index 07d3ac0..d0d9488 100644 --- a/includes/widgets/widget-instagram.php +++ b/includes/widgets/widget-instagram.php @@ -16,7 +16,7 @@ function widget( $args, $instance ) { echo $before_widget; $title = apply_filters( 'widget_title', $instance['title'] ); - $username = $instance['username']; + $username = strtolower( $instance['username'] ); $cachetime = empty($instance['cachetime']) ? 9 : $instance['cachetime']; $count = empty($instance['count']) ? 9 : $instance['count']; $size = empty($instance['size']) ? 'thumbnail' : $instance['size']; @@ -31,7 +31,7 @@ function widget( $args, $instance ) { } else { ?> -
+
<?php echo esc_attr( $image['description'] ); ?> @@ -134,14 +134,11 @@ function scrape_instagram( $username, $slice = 9, $cachetime = 5 ) { $instagram = array(); foreach ($images as $image) { - if ($image['type'] == 'image' && $image['user']['username'] == $username) { + if ( $image['type'] == 'image' || $image['type'] == 'video' && $image['user']['username'] == $username ) { $instagram[] = array( 'description' => $image['caption']['text'], 'link' => $image['link'], - 'time' => $image['created_time'], - 'comments' => $image['comments']['count'], - 'likes' => $image['likes']['count'], 'thumbnail' => $image['images']['thumbnail'], 'large' => $image['images']['standard_resolution'] ); diff --git a/includes/widgets/widget-twitter.php b/includes/widgets/widget-twitter.php index c1f6eb6..2177e8b 100644 --- a/includes/widgets/widget-twitter.php +++ b/includes/widgets/widget-twitter.php @@ -38,12 +38,10 @@ function widget( $args, $instance ) { } $tw_helper = new StagTWHelper(); + $transient = 'stag_twitter_widget_' . $twitter_username; + $timeout = $cache_time * HOUR_IN_SECONDS; - $last_cache = get_option('stag_twitter_widget_last_cache'); - $diff = time() - $last_cache; - $crt = $instance['cache_time'] * 3600; - - if( $diff >= $crt || empty($last_cache) ) { + if ( false === get_transient( $transient ) ) { $connection = $tw_helper->getConnectionWithAccessToken( $stag_options['consumer_key'], $stag_options['consumer_secret'], $stag_options['access_key'], $stag_options['access_secret'] ); $url = add_query_arg( array( 'screen_name' => $instance['twitter_username'], 'count' => $instance['tweet_count'] ), 'https://api.twitter.com/1.1/statuses/user_timeline.json' ); @@ -86,16 +84,13 @@ function widget( $args, $instance ) { } } - update_option( 'stag_twitter_widget_tweets', serialize($tweets_array) ); - update_option( 'stag_twitter_widget_last_cache', time() ); - - echo ''; + set_transient( $transient, serialize($tweets_array), $timeout ); } - $widget_tweets = maybe_unserialize( get_option( 'stag_twitter_widget_tweets' ) ); + $widget_tweets = maybe_unserialize( get_transient( $transient ) ); if( !empty( $widget_tweets ) ) { - $output = ''; if ( (bool) $show_follow_button == 1 ) { $output .= ""; @@ -124,7 +119,7 @@ function widget( $args, $instance ) {
__( 'Tweets', 'stag' ), - 'cache_time' => 1, + 'cache_time' => 2, 'twitter_username' => '', 'tweet_count' => 3, 'show_retweets' => '', diff --git a/readme.txt b/readme.txt index 00079b7..35dc8e4 100644 --- a/readme.txt +++ b/readme.txt @@ -4,8 +4,8 @@ Contributors: mauryaratan, codestag Donate link: http://codest.ag/st-donate Tags: widget, icons, retina, shortcodes, themeforest, font-icons, fontawesome, sidebar, social, social media, maps, flickr, instagram, custom post type, codestag, mauryaratan, twitter Requires at least: 3.5 -Tested up to: 3.9 -Stable tag: 1.2.3 +Tested up to: 4.0 +Stable tag: 1.2.5 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -93,7 +93,13 @@ Yes you can! Join me on [Github Repository](https://github.com/mauryaratan/stagt == Changelog == -= 1.2.4 - May XX, 2014 = += 1.2.5 - June 18, 2014 = +* Fix - Twitter widget option storage, works flawlessly +* Fix - Instagram widget image size styles +* Fix - Properly sanitize Instagram username +* Improved - Instagram widget now grabs video thumbnails too + += 1.2.4 - May 22, 2014 = * New - ``[stag_column]`` shortcode for wrapping the columns * New - Added ``stag-section`` class to all block level shortcodes * New - Custom post type "Project" added, better version of portfolios @@ -191,6 +197,9 @@ Yes you can! Join me on [Github Repository](https://github.com/mauryaratan/stagt * Initial Release == Upgrade Notice == += 1.2.5 = +Includes fixes and improvements for Twitter and Instagram widget. + = 1.2.3 = Adds compatbility with WordPress 3.9. 1 beta tester was killed during this update. diff --git a/screenshot-1.png b/screenshot-1.png deleted file mode 100644 index cd8af2f..0000000 Binary files a/screenshot-1.png and /dev/null differ diff --git a/screenshot-2.png b/screenshot-2.png deleted file mode 100644 index e2ad054..0000000 Binary files a/screenshot-2.png and /dev/null differ diff --git a/screenshot-3.png b/screenshot-3.png deleted file mode 100644 index 6de82a4..0000000 Binary files a/screenshot-3.png and /dev/null differ diff --git a/screenshot-4.png b/screenshot-4.png deleted file mode 100644 index 5c34863..0000000 Binary files a/screenshot-4.png and /dev/null differ diff --git a/stagtools.php b/stagtools.php index fc99e13..f3d4501 100644 --- a/stagtools.php +++ b/stagtools.php @@ -3,12 +3,12 @@ * Plugin Name: StagTools * Plugin URI: https://wordpress.org/plugins/stagtools/ * Description: A poweful plugin to extend functionality to your WordPress themes offering shortcodes, font icons and useful widgets. - * Version: 1.2.4 + * Version: 1.2.5 * Author: Ram Ratan Maurya * Author URI: http://mauryaratan.me * License: GPL2 * Requires at least: 3.5 - * Tested up to: 3.9 + * Tested up to: 4.0 * * Text Domain: stag * Domain Path: /languages/ @@ -22,7 +22,7 @@ * Main StagTools Class * * @package StagTools - * @version 1.2.4 + * @version 1.2.5 * @author Ram Ratan Maurya (Codestag) * @link http://mauryaratan.me * @link http://codestag.com @@ -33,7 +33,7 @@ class StagTools { /** * @var string */ - public $version = '1.2.4'; + public $version = '1.2.5'; /** * @var string