Skip to content

Commit

Permalink
Merge pull request #31 from nitsan-technologies/bugfix/instagram-api
Browse files Browse the repository at this point in the history
Bugfix/instagram api
  • Loading branch information
nitsan-technologies authored Dec 23, 2024
2 parents e0a74c7 + 952402a commit d4bc75a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 24 deletions.
18 changes: 7 additions & 11 deletions Classes/Controller/InstagramFeedsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,16 @@ public function getfeeedsAction()

if (empty($settings['graphapi'])) {
$error = LocalizationUtility::translate('instagram.noapi', 'ns_instagram');
// @extensionScannerIgnoreLine
$this->addFlashMessage($error, '', $severityClass);
} else {
$instauser = $this->getAPIdataAction($settings['graphapi'], 'user');
if ($instauser['username']) {
$this->getAPIdataAction($settings['graphapi'], 'refresh');
$instamedia = $this->getAPIdataAction($settings['graphapi'], 'media', $settings['graphitems']);
$this->getAPIdataAction($settings['graphapi'], 'refresh');
$instamedia = $this->getAPIdataAction($settings['graphapi'], 'media', $settings['graphitems']);

if (isset($instamedia['data'])) {
$this->view->assignMultiple([
'instauser' => $instauser,
'instauser' => 'true',
'instamedia' => $instamedia['data'],
]);
]);
} else {
$error = LocalizationUtility::translate('instagram.apierror', 'ns_instagram');
// @extensionScannerIgnoreLine
Expand All @@ -64,10 +63,7 @@ public function getAPIdataAction($accessToken, $additionalconfig=null, $items=nu
{
$url = '';
switch ($additionalconfig) {
case 'user':
$url = 'https://graph.instagram.com/me?fields=id,username,media_count&access_token=' . $accessToken;
break;


case 'refresh':
$url = 'https://graph.instagram.com/refresh_access_token?grant_type=ig_refresh_token&access_token=' . $accessToken;
break;
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Instagram

[![Instagram](https://img.shields.io/badge/stable-v5.0.0-green?style=flat-square)](https://github.com/nitsan-technologies/ns_instagram/tree/5.0.0) [![TYPO3 13](https://img.shields.io/badge/TYPO3-13-orange.svg?style=flat-square)](https://get.typo3.org/version/13) [![License](https://img.shields.io/badge/license-GPL--3.0-orange?style=flat-square)](https://www.gnu.org/licenses/gpl-3.0.en.html) [![T3Planet](https://img.shields.io/badge/T3Planet-Instagram-50b99a?style=flat-square)](https://t3-extension.t3planet.com/pro/typo3-instagram)
[![Instagram](https://img.shields.io/badge/stable-v6.0.0-green?style=flat-square)](https://github.com/nitsan-technologies/ns_instagram/tree/6.0.0) [![TYPO3 13](https://img.shields.io/badge/TYPO3-13-orange.svg?style=flat-square)](https://get.typo3.org/version/13) [![License](https://img.shields.io/badge/license-GPL--3.0-orange?style=flat-square)](https://www.gnu.org/licenses/gpl-3.0.en.html) [![T3Planet](https://img.shields.io/badge/T3Planet-Instagram-50b99a?style=flat-square)](https://t3-extension.t3planet.com/pro/typo3-instagram)

- Live Frontend Demo: https://demo.t3planet.com/t3-extensions/instagram
- Live Frontend Demo: https://t3-extension.t3planet.com/pro/typo3-instagram
- Free version: https://extensions.typo3.org/extension/ns_instagram/
- Documentation: http://docs.t3planet.com/en/latest/ExtNsInstagram/Index.html
- Changelog: https://t3planet.com/typo3-instagram-extension
2 changes: 1 addition & 1 deletion Resources/Private/Language/locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<source>API Configuration</source>
</trans-unit>
<trans-unit id="apiconfig.graphapi" xml:space="preserve">
<source>Add Instagram Basic Display API Access Token (graph.instagram.com): Will required if you set Instagram Basic Display API in plugin option (To get token: https://developers.facebook.com/docs/instagram-basic-display-api/getting-started)</source>
<source>Add Instagram Access Token (graph.instagram.com): Required if you set Instagram Access Token in plugin option (To get token: https://developers.facebook.com/docs/instagram-basic-display-api/getting-started)</source>
</trans-unit>
<trans-unit id="settings.jquery" xml:space="preserve">
<source>Include jQuery Library</source>
Expand Down
20 changes: 11 additions & 9 deletions Resources/Private/Templates/InstagramFeeds/Getfeeeds.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
<f:section name="content">
<f:flashMessages />
<div class="nsinstagram-v1apiview">
<f:if condition="{instamedia}">
<f:then>
<div class="gallery">
<f:render partial="Graphapiview/Instamedia" arguments="{instamedia:instamedia,settings:settings}" />
</div>
</f:then>
<f:else>
<f:translate key="instagram.noinstamedia" extensionName="ns_instagram" />
</f:else>
<f:if condition="{instauser}">
<f:if condition="{instamedia}">
<f:then>
<div class="gallery">
<f:render partial="Graphapiview/Instamedia" arguments="{instamedia:instamedia,settings:settings}" />
</div>
</f:then>
<f:else>
<f:translate key="instagram.noinstamedia" extensionName="ns_instagram" />
</f:else>
</f:if>
</f:if>
</div>
</f:section>
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
'uploadfolder' => 0,
'createDirs' => '',
'clearCacheOnLoad' => 0,
'version' => '5.0.0',
'version' => '6.0.0',
'constraints' => [
'depends' => [
'typo3' => '8.7.0-13.9.99',
Expand Down

0 comments on commit d4bc75a

Please sign in to comment.