/** @see WP_Widget::widget */ function widget($args, $instance) { extract($args); $widget_title = $instance['widget_title']; if (isset($instance['auto_play'])) { $auto_play = 'true'; } else { $auto_play = 'false'; } $info = crInstGetInfo(user_id(), access_token()); echo $before_widget; echo $before_title . $widget_title . $after_title; echo '<div class="instagram-wrap">'; echo crInstShowInfo($info, array('website' => true, 'media' => true, 'followers' => true, 'following' => true, 'profile_pic' => true), $this->avatar_width); echo crInstShowWidgetData(crInstGetSelfFeed(access_token()), $info, $this->display_photos, $this->item_width, "sIntSelfFeed", $instance['display_caption']); echo '</div>'; ?> <script type="text/javascript"> jQuery(document).ready(function($){ $("a[data-rel^='sIntSelfFeed']").prettyPhoto({ hook: 'data-rel', autoplay_slideshow: <?php echo $auto_play; ?> , social_tools: false }); }); </script> <?php echo $after_widget; }
function option_page_crum_simple_instagram() { if (isset($_POST['sIntClearCache'])) { sIntClearCache(); echo '<div id="message" class="updated fade"><p>Cache folder has been cleanup!</p></div>'; } //check jpeg compression value if (isset($_POST['JPEGCompression'])) { if ($_POST['JPEGCompression'] > 100 || $_POST['JPEGCompression'] < 10) { update_option('JPEGCompression', '80'); } else { update_option('JPEGCompression', $_POST['JPEGCompression']); } } global $wpdb; /** * Save info to database * v1.2.5 uses wp options */ if (isset($_GET['access_token']) && isset($_GET['id'])) { update_option('si_access_token', $_GET['access_token']); update_option('si_user_id', $_GET['id']); } /* * Info query to check if database * has record. */ $info = array('si_access_token' => get_option('si_access_token'), 'si_user_id' => get_option('si_user_id')); if (isset($_POST['sIntLogout']) == "log_out") { delete_option('si_access_token'); delete_option('si_user_id'); ?> <meta http-equiv="refresh" content="0;url=<?php echo get_admin_url() . 'options-general.php?page=crum-instagram'; ?> "> <?php } ?> <div class="wrap"> <div id="icon-plugins" class="icon32"></div><h2> Instagram</h2> <?php if (!$info['si_access_token'] && !$info['si_user_id']) { ?> <?php if ($_GET['access_token'] == "" && $_GET['id'] == "") { ?> <div class="error"> <p>You did not authorize Instagram. This plugin will not work without your authorization. </p> </div> <?php } ?> <a href=" <?php echo crInstLogin('?return_uri=' . base64_encode(get_admin_url() . 'options-general.php?page=crum-instagram')); ?> "><img src="<?php echo plugin_dir_url(__FILE__) . 'images/instagram-login.jpg'; ?> " title="Login to Instagram and authorize Instagram plugin" alt="Login to Instagram and authorize Instagram plugin" /></a> <?php ?> <?php } else { ?> <?php if (isset($_GET['access_token']) && $_GET['id']) { ?> <meta http-equiv="refresh" content="0;url=<?php echo get_admin_url() . 'options-general.php?page=crum-instagram'; ?> "> <?php } ?> <iframe src="https://instagram.com/accounts/logout/" width="0" height="0">Logout</iframe> <?php $user = crInstGetInfo(user_id(), access_token()); ?> <div id="sInts-welcome">Welcome <?php echo $user['data']['full_name']; ?> . You can start using Instagram widget. You can find it in Apperance -> Widgets</div> <form name="itw_logout" method="post" action="<?php echo str_replace('%7E', '~', htmlentities(get_admin_url() . 'options-general.php?page=crum-instagram')); ?> "> <input type="hidden" name="sIntLogout" value="log_out"> <input type="submit" class="button" value="Log out" name="logout" onclick="" > </form> <!-- END CSS --> </div> <?php } ?> <?php }