Skip to content
This repository has been archived by the owner on Jan 24, 2020. It is now read-only.

Commit

Permalink
closes #3
Browse files Browse the repository at this point in the history
Signed-off-by: Bruno Meilick <[email protected]>
  • Loading branch information
bnomei committed Aug 16, 2019
1 parent 0803e64 commit 59a8df7
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# OS files
.DS_Store
.idea
*.cache

# files of Composer dependencies that are not needed for the plugin
/vendor/**/.*
Expand All @@ -20,4 +22,4 @@
/vendor/**/test/*
/vendor/**/tests/*
/vendor/**/php4/*
/vendor/getkirby/composer-installer
/vendor/getkirby/composer-installer
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,40 @@ This plugin is free but if you use it in a commercial project please consider to

## Usage

### Config

You can set the token in the config.

```php
return [
// other config settings ...
'bnomei.instagram.token' => 'YOUR-TOKEN-HERE',
];
```

### Template

```php
<?php
$token = 'your.token';
$token = null; // default. this will cause loading from the config file or set it here...
$token = 'YOUR-TOKEN-HERE';
$endpoint = 'users/self/media/recent';
$params = [
'count' => 4
];
$force = false;
$force = null; // default. this will cause refresh on global debug == true
// $force = true; // always force refresh
foreach(site()->instagram($token, $endpoint, $params, $force) as $data) {
echo Kirby\Toolkit\Html::img(
$data['images']['standard_resolution']['url']
);
}
```

## Cache

This plugin does have a cache unless global `debug` options is set or your `$force` the refresh because the instagram api will stop working if you push to may requests in a period of short time.

> TIP: all `site()->instagram()` function parameters are optional if their value is set in config.
## Settings
Expand Down
2 changes: 1 addition & 1 deletion classes/Instagram.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static function instagram(string $token = null, string $endpoint = null,
$params = option('bnomei.instagram.params');
}

if ($force == null && option('debug') && option('bnomei.feed.debugforce')) {
if ($force == null && option('debug') && option('bnomei.instagram.debugforce')) {
$force = true;
}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bnomei/kirby3-instagram",
"type": "kirby-plugin",
"version": "1.0.3",
"version": "1.1.0",
"description": "Kirby 3 Plugin to call Instagram API Endpoints",
"license": "MIT",
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 59a8df7

Please sign in to comment.