Skip to content

Commit

Permalink
Merge branch 'release-1.2.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
mauryaratan committed Jun 18, 2014
2 parents c621fb4 + 122d12b commit 80a616e
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 30 deletions.
3 changes: 2 additions & 1 deletion assets/css/stag-shortcodes.css
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,8 @@
float: left;
margin: 0px 0px 5px 5px;
}
.instragram-widget-wrapper img {

.size-thumbnail img {
max-width: 75px;
height: auto;
}
Expand Down
5 changes: 4 additions & 1 deletion assets/scss/stag-shortcodes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,10 @@
float: left;
margin: 0px 0px 5px 5px;
}
img{
}

.size-thumbnail {
img {
max-width: 75px;
height: auto;
}
Expand Down
9 changes: 3 additions & 6 deletions includes/widgets/widget-instagram.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand All @@ -31,7 +31,7 @@ function widget( $args, $instance ) {
} else {
?>

<div class="instragram-widget-wrapper">
<div class="instragram-widget-wrapper size-<?php echo $size; ?>">
<?php foreach( $images as $image ) : ?>
<a href="<?php echo esc_url( $image['link'] ); ?>" title="<?php echo esc_attr( $image['description'] ); ?>" class="instagram_badge_image">
<img src="<?php echo esc_url( str_replace( 'http:', '', $image[$size]['url']) ); ?>" alt="<?php echo esc_attr( $image['description'] ); ?>">
Expand Down Expand Up @@ -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']
);
Expand Down
25 changes: 10 additions & 15 deletions includes/widgets/widget-twitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
Expand Down Expand Up @@ -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 '<!-- twitter cache has been updated! -->';
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 = '<ul>';
$output = '<ul>';
$count = 1;
$protocol = is_ssl() ? 'https:' : 'http:';

Expand All @@ -105,12 +100,12 @@ function widget( $args, $instance ) {
$output .= '</p>';
$output .= '<p><time datetime="'. $tweet['created_at'] .'" class="time"><a href="'. $protocol .'//twitter.com/'. $twitter_username .'/statuses/'. $tweet['status_id'] .'" target="_blank">'. $tw_helper->twitter_widget_relative_time( $tweet['created_at'] ) .'</a></time></p>';
$output .= '</li>';

if( $count == $instance['tweet_count'] ) { break; }
$count++;
}

$output .= '</ul>';
$output .= '</ul>';

if ( (bool) $show_follow_button == 1 ) {
$output .= "<a class='button twitter-follow-button' href='". esc_url( 'https://twitter.com/'. $twitter_username ) ."'>". __( 'Follow', 'stag' ) ."</a>";
Expand All @@ -124,7 +119,7 @@ function widget( $args, $instance ) {
</div>

<?php

echo $after_widget;

}
Expand All @@ -145,7 +140,7 @@ function update( $new_instance, $old_instance) {
function form( $instance ) {
$defaults = array(
'title' => __( 'Tweets', 'stag' ),
'cache_time' => 1,
'cache_time' => 2,
'twitter_username' => '',
'tweet_count' => 3,
'show_retweets' => '',
Expand Down
15 changes: 12 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.

Expand Down
Binary file removed screenshot-1.png
Binary file not shown.
Binary file removed screenshot-2.png
Binary file not shown.
Binary file removed screenshot-3.png
Binary file not shown.
Binary file removed screenshot-4.png
Binary file not shown.
8 changes: 4 additions & 4 deletions stagtools.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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
Expand All @@ -33,7 +33,7 @@ class StagTools {
/**
* @var string
*/
public $version = '1.2.4';
public $version = '1.2.5';

/**
* @var string
Expand Down

0 comments on commit 80a616e

Please sign in to comment.