function si_sc($atts) { /** * shortcode standard: * [simply_instagram endpoints="" type="" display="" ] * Endpoints: users: *type self-feed recent-media likes media *type popular */ ob_start(); //print_r( $atts ); extract(shortcode_atts(array('endpoints' => 'users', 'type' => 'self-feed', 'size' => 'low_resolution', 'presentation' => 'polaroid', 'display' => 20, 'displayoption' => 'instagram', 'showphotographer' => 'true', 'photocomment' => 0, 'stat' => true, 'photocaption' => true, 'displaycomment' => true, 'width' => 150, 'customRel' => 'sIntWid'), $atts)); //print_r( $atts ); switch ($atts['endpoints']) { /** * Users endpoints */ case 'users': /** * endpoints type: * self-feed * recent media * likes */ switch ($atts['type']) { /** * Self-feed * Display all photos uploaded by user * with user's following */ case 'self-feed': if ($atts['presentation'] === "polaroid") { echo sInstDisplayData(sInstGetSelfFeed(access_token()), $atts['presentation'], $atts['displayoption'], $atts['size'], $atts['display'], "150", $customRel, $atts['showphotographer'], $atts['photocomment'], $atts['stat'], $atts['photocaption'], $atts['displaycomment']); } else { echo '<div id="masonryContainer" class="clearfix masonry">'; echo sInstDisplayData(sInstGetSelfFeed(access_token()), $atts['presentation'], $atts['displayoption'], $atts['size'], $atts['display'], "150", $customRel, $atts['showphotographer'], $atts['photocomment'], $atts['stat'], $atts['photocaption'], $atts['displaycomment']); echo '</div>'; } break; /** * Recent Media * Display all photos uploaded by user only */ /** * Recent Media * Display all photos uploaded by user only */ case 'recent-media': if ($atts['presentation'] === "polaroid") { echo sInstDisplayData(sInstGetRecentMedia(user_id(), access_token()), $atts['presentation'], $atts['displayoption'], $atts['size'], $atts['display'], "150", $customRel, $atts['showphotographer'], $atts['photocomment'], $atts['stat'], $atts['photocaption'], $atts['displaycomment']); } else { echo '<div id="masonryContainer" class="clearfix masonry">'; echo sInstDisplayData(sInstGetRecentMedia(user_id(), access_token()), $atts['presentation'], $atts['displayoption'], $atts['size'], $atts['display'], "150", $customRel, $atts['showphotographer'], $atts['photocomment'], $atts['stat'], $atts['photocaption'], $atts['displaycomment']); echo '</div>'; } break; /** * Likes * Display all photos liked by user */ /** * Likes * Display all photos liked by user */ case 'likes': if ($atts['presentation'] === "polaroid") { echo sInstDisplayData(sInstGetLikes(access_token()), $atts['presentation'], $atts['displayoption'], $atts['size'], $atts['display'], "150", $customRel, $atts['showphotographer'], $atts['photocomment'], $atts['stat'], $atts['photocaption'], $atts['displaycomment']); } else { echo '<div id="masonryContainer" class="clearfix masonry">'; echo sInstDisplayData(sInstGetLikes(access_token()), $atts['presentation'], $atts['displayoption'], $atts['size'], $atts['display'], "150", $customRel, $atts['showphotographer'], $atts['photocomment'], $atts['stat'], $atts['photocaption'], $atts['displaycomment']); echo '</div>'; } break; } break; /** * Media endpoints */ /** * Media endpoints */ case 'media': /** * Media endpoint only accept currently * trending photos in Instagram */ if ($atts['presentation'] === "polaroid") { echo sInstDisplayData(sInstGetMostPopular($atts['type'], access_token()), $atts['presentation'], $atts['displayoption'], $atts['size'], $atts['display'], $atts['width'], $customRel, $atts['showphotographer'], $atts['photocomment'], $atts['stat'], $atts['photocaption'], $atts['displaycomment']); } else { echo '<div id="masonryContainer" class="clearfix masonry">'; echo sInstDisplayData(sInstGetMostPopular($atts['type'], access_token()), $atts['presentation'], $atts['displayoption'], $atts['size'], $atts['display'], $atts['width'], $customRel, $atts['showphotographer'], $atts['photocomment'], $atts['stat'], $atts['photocaption'], $atts['displaycomment']); echo '</div>'; } break; } /** * PrettyPhoto settings for shortcode. * v1.2.3 is using masonry as alternative * to PrettyPhoto which often breaks or * unresponsive when the image has * long description */ $prettyPhoto = get_option('si_prettyphoto_settings'); //print_r( $prettyPhoto ); if ($atts['presentation'] === "masonry") { ?> <script src="<?php echo plugins_url(); ?> /simply-instagram/js/jquery.masonry.min.js"></script> <script> <?php // if( $this->general_settings['gen_enable_tooltip'] ){ ?> //jQuery('.si-tooltip').tooltipster(); <?php // } ?> jQuery('#masonryContainer').imagesLoaded(function(){jQuery('#masonryContainer').masonry({itemSelector : '.masonryItem',isAnimated: true});});jQuery("a#content_close").live( "click", function() {jQuery("#overlay").fadeOut("slow", function() { jQuery("#overlay").remove(); });jQuery("#contentWrap").fadeOut("slow", function() { jQuery("#contentWrap").remove(); });jQuery("#content_close").fadeOut("slow", function() { jQuery("#content_close").remove(); });});jQuery("#overlay").live( "click", function() {Query(this).fadeOut("slow", function() { jQuery(this).remove(); });jQuery("#contentWrap").fadeOut("slow", function() { jQuery("#contentWrap").remove(); });jQuery("#content_close").fadeOut("slow", function() { jQuery("#content_close").remove(); });});jQuery(function() {jQuery("a.overlay").click(function() {var docHeight = jQuery(document).height();jQuery("body").append("<div id='overlay'></div><a id='content_close' href='#'></a><div id='contentWrap'></div>"); jQuery("#overlay").height(docHeight).css({'opacity' : 0.4,'position': 'fixed','top': 0,'left': 0,'background-color': 'black','width': '100%','z-index': 99999});jQuery("#contentWrap").load( jQuery(this).attr('rel') );jQuery("#image-holder").css({'width': '612px','height': '612px'});});jQuery("div.item-holder").hover(function() { var id = jQuery(this).data("id");jQuery("div.hover-action[data-id=" + id + "]").show("slow");},function() {jQuery("div.hover-action").hide("slow");});}); jQuery(document).ready(function(){ jQuery("a[rel^='sIntSC']").prettyPhoto({ autoplay_slideshow: <?php echo $prettyPhoto['autoPlay']; ?> , social_tools: false, theme: '<?php echo $prettyPhoto["galleryTheme"]; ?> ', animation_speed: '<?php echo $prettyPhoto["animationSpeed"]; ?> ', }); }); jQuery(document).ready(function(){ jQuery("a[rel^='prettyphoto']").prettyPhoto({ autoplay_slideshow: false, social_tools: false, theme: '<?php echo $prettyPhoto["galleryTheme"]; ?> ' }); }); </script> <?php } else { ?> <script> jQuery(document).ready(function() { <?php //if( $this->general_settings['gen_enable_tooltip'] === "true" ){ echo( $this->general_settings['gen_enable_tooltip'] ); ?> jQuery('.si-tooltip').tooltipster(); <?php //} ?> jQuery(document).ready(function(){jQuery("a[rel^='sIntSC']").prettyPhoto({autoplay_slideshow: <?php echo $prettyPhoto['autoPlay']; ?> ,social_tools: false,theme: '<?php echo $prettyPhoto["galleryTheme"]; ?> ',animation_speed: '<?php echo $prettyPhoto["animationSpeed"]; ?> ',});});jQuery(document).ready(function(){jQuery("a[rel^='prettyphoto']").prettyPhoto({autoplay_slideshow: false,social_tools: false,theme: '<?php echo $prettyPhoto["galleryTheme"]; ?> '});}); }); </script> <?php } $content = ob_get_contents(); ob_end_clean(); wp_reset_postdata(); return $content; }
/** @see WP_Widget::widget */ function widget($args, $instance) { extract($args); $short_desc = ''; echo $before_widget; echo $before_title . $instance['widget_title'] . $after_title; echo '<p>' . $short_desc . '</p>'; $info = sInstGetInfo(user_id(), access_token()); sInstShowInfo($info, array('name' => 'true', 'bio' => 'true', 'website' => 'true', 'media' => 'true', 'followers' => 'true', 'following' => 'true', 'profile_pic' => 'true'), $instance['profile_width']); if ($instance['followers'] == true) { if ($instance['followers_desc']) { echo "<p>" . $instance['followers_desc'] . "</p>"; } else { echo '<div class="clear"></div>'; } $fllwrsdata = sInstDiplayFollowData(sInstGetFollowers(user_id(), access_token(), array('name' => 'true', 'bio' => 'true', 'website' => 'true', 'media' => 'true', 'followers' => 'true', 'following' => 'true', 'profile_pic' => 'true')), "25", $instance['followers_profile_width'], false); ?> <script type="text/javascript" charset="utf-8"> //jQuery.noConflict(); jQuery(document).ready(function(){ jQuery('.si-tooltip').tooltipster(); }); </script> <?php } if ($instance['following'] == true) { if ($instance['following_desc']) { echo "<p>" . $instance['following_desc'] . "</p>"; } else { echo '<div class="clear"></div>'; } sInstDiplayFollowData(sInstGetFollowing(user_id(), access_token(), array('name' => 'true', 'bio' => 'true', 'website' => 'true', 'media' => 'true', 'followers' => 'true', 'following' => 'true', 'profile_pic' => 'true')), "25", $instance['followers_profile_width'], false); ?> <script type="text/javascript" charset="utf-8"> //jQuery.noConflict(); jQuery(document).ready(function(){ jQuery('.si-tooltip').tooltipster(); }); </script> <?php } if ($instance['latest_feed'] == true) { if ($instance['latest_feed_desc']) { echo "<p>" . $instance['latest_feed_desc'] . "</p>"; } else { echo '<div class="clear"></div>'; } $customRel = "latestfeed"; sInstShowWidgetData(sInstGetSelfFeed(access_token()), "25", $instance['latest_photo_profile_width'], $customRel, $instance['display_caption'], $instance['open_instagram']); ?> <script type="text/javascript" charset="utf-8"> //jQuery.noConflict(); jQuery(document).ready(function(){ jQuery("a[rel^='<?php echo $customRel; ?> ']").prettyPhoto({ autoplay_slideshow: 'true', social_tools:false, theme: 'pp_default', }); jQuery('.si-tooltip').tooltipster(); }); </script> <?php } if ($instance['latest_photo'] == true) { if ($instance['latest_photo_desc']) { echo "<p>" . $instance['latest_photo_desc'] . "</p>"; } else { echo '<div class="clear"></div>'; } $customRel = "latestphoto"; sInstShowWidgetData(sInstGetRecentMedia(user_id(), access_token()), "25", $instance['latest_photo_profile_width'], $customRel, $instance['display_caption'], $instance['open_instagram']); ?> <script type="text/javascript" charset="utf-8"> jQuery(document).ready(function(){ jQuery("a[rel^='<?php echo $customRel; ?> ']").prettyPhoto({ autoplay_slideshow: 'true', social_tools:false, theme: 'pp_default', }); jQuery('.si-tooltip').tooltipster(); }); </script> <?php } if ($instance['liked_photo'] == true) { if ($instance['liked_photo_desc']) { echo "<p>" . $instance['liked_photo_desc'] . "</p>"; } else { echo '<div class="clear"></div>'; } $customRel = "likedphoto"; sInstShowWidgetData(sInstGetLikes(access_token()), "25", $instance['liked_photo_width'], $customRel, $instance['display_caption'], $instance['open_instagram']); ?> <script type="text/javascript" charset="utf-8"> jQuery(document).ready(function(){ jQuery("a[rel^='<?php echo $customRel; ?> ']").prettyPhoto({ autoplay_slideshow: 'true', social_tools:false, theme: 'pp_default', }); jQuery('.si-tooltip').tooltipster(); }); </script> <?php } echo $after_widget; }