Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Solwin Infotech
- * Solwin Instagram Extension
- *
- * @category Solwin
- * @package Solwin_Instagram
- * @copyright Copyright © 2006-2016 Solwin (https://www.solwininfotech.com)
- * @license https://www.solwininfotech.com/magento-extension-license/
- */
- $helper = $this->helper('\Solwin\Instagram\Helper\Data');
- $enable = $helper->getConfig('instagramsection/instagramgroup/active');
- $userId = $helper->getConfig('instagramsection/instagramgroup/userid');
- $accessToken = $helper->getConfig('instagramsection/instagramgroup/accesstoken');
- $imageNumber = $this->getData('numberimage');
- $imageResolution = $this->getData('resolution');
- ?>
- <?php
- if ($enable) {
- ?>
- <div class="block-title-main">
- <h2><?php echo $this->getData('title'); ?></h2>
- <div class="title-border"></div>
- </div>
- <div id="cpcolumninstagram" class="cp-fcontent hidden-xs">
- <?php
- $url = 'https://api.instagram.com/v1/users/' . $userId . '/media/recent/?access_token=' . $accessToken.'&count='.$imageNumber;
- $args = stream_context_create(array('http' => array('timeout' => 2500,)));
- //for Live server
- $instagramFeedsData = file_get_contents($url, false, $args);
- // for Local Server
- // $instagramFeedsData = $helper->getInstangramData($url);
- $instagramFeeds = json_decode($instagramFeedsData);
- $instangramData = $instagramFeeds->data;
- foreach ($instangramData as $instagramFeed) {
- $instagramImage = $instagramFeed->images->$imageResolution->url;
- ?>
- <?php
- $caption_text = 'Instagram';
- if (is_object($instagramFeed->caption)) {
- $caption_text = $instagramFeed->caption->text;
- }
- ?>
- <div class="instangram-feed">
- <a href ="<?php echo $instagramFeed->link; ?>" target="_blank">
- <img src="<?php echo $instagramImage; ?>" title="<?php echo $caption_text; ?>" alt="<?php echo $caption_text; ?>"/>
- </a>
- </div>
- <?php
- } ?>
- </div>
- <div class="clear gap-30"></div>
- <?php }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement