Spotlight Social Media Feeds - Version 0.9.9

Version Description

(2022-01-27) =

Fixed - Saved thumbnails are lost when the plugin updates Instagram posts

Download this release

Release Info

Developer Mekku
Plugin Icon 128x128 Spotlight Social Media Feeds
Version 0.9.9
Comparing to
See all releases

Code changes from version 0.9.8 to 0.9.9

core/Engine/Store/ThumbnailStore.php CHANGED
@@ -94,7 +94,10 @@ class ThumbnailStore
94
  }
95
 
96
  // Generate thumbnails from the original image
97
- $data[MediaItem::THUMBNAILS] = $this->generateThumbnails($id, $localImg);
 
 
 
98
 
99
  // If the item has no main thumbnail, set it to the largest available thumbnail
100
  if (empty($thumbnail)) {
@@ -126,10 +129,10 @@ class ThumbnailStore
126
  return $data;
127
  }
128
 
129
- public function generateThumbnails(string $mediaId, string $imagePath, bool $overwrite = false): array
130
  {
131
  if (!file_exists($imagePath)) {
132
- return [];
133
  }
134
 
135
  $result = [];
94
  }
95
 
96
  // Generate thumbnails from the original image
97
+ $newThumbnails = $this->generateThumbnails($id, $localImg);
98
+ if ($newThumbnails !== null) {
99
+ $data[MediaItem::THUMBNAILS] = $newThumbnails;
100
+ }
101
 
102
  // If the item has no main thumbnail, set it to the largest available thumbnail
103
  if (empty($thumbnail)) {
129
  return $data;
130
  }
131
 
132
+ public function generateThumbnails(string $mediaId, string $imagePath, bool $overwrite = false): ?array
133
  {
134
  if (!file_exists($imagePath)) {
135
+ return null;
136
  }
137
 
138
  $result = [];
modules/AccountsModule.php CHANGED
@@ -39,6 +39,10 @@ class AccountsModule extends Module
39
  'cpt/slug' => new Value('sl-insta-account'),
40
  // The accounts CPT registration args
41
  'cpt/args' => new Value([
 
 
 
 
42
  'public' => false,
43
  'supports' => ['title', 'custom-fields'],
44
  'show_in_rest' => false,
39
  'cpt/slug' => new Value('sl-insta-account'),
40
  // The accounts CPT registration args
41
  'cpt/args' => new Value([
42
+ 'labels' => [
43
+ 'name' => 'Spotlight accounts',
44
+ 'singular_name' => 'Spotlight account',
45
+ ],
46
  'public' => false,
47
  'supports' => ['title', 'custom-fields'],
48
  'show_in_rest' => false,
modules/Dev/DevDeleteMedia.php CHANGED
@@ -2,18 +2,28 @@
2
 
3
  namespace RebelCode\Spotlight\Instagram\Modules\Dev;
4
 
 
 
5
  /**
6
  * Dev tool that deletes all media from the DB.
7
  */
8
  class DevDeleteMedia
9
  {
 
 
 
 
10
  /** @var callable */
11
  protected $action;
12
 
 
 
 
13
  /** Constructor */
14
- public function __construct(callable $action)
15
  {
16
  $this->action = $action;
 
17
  }
18
 
19
  /**
@@ -21,25 +31,42 @@ class DevDeleteMedia
21
  */
22
  public function __invoke()
23
  {
24
- $deleteNonce = filter_input(INPUT_POST, 'sli_delete_meta');
25
  if (!$deleteNonce) {
26
  return;
27
  }
28
 
29
- if (!wp_verify_nonce($deleteNonce, 'sli_delete_media')) {
30
  wp_die('You cannot do that!', 'Unauthorized', [
31
  'back_link' => true,
32
  ]);
33
  }
34
 
35
- $result = ($this->action)();
 
 
 
 
36
 
37
- add_action('admin_notices', function () use ($result) {
38
- if ($result === false) {
39
- echo '<div class="notice notice-error"><p>WordPress failed to delete the media</p></div>';
40
- } else {
41
- printf('<div class="notice notice-success"><p>Deleted %d records from the database</p></div>', $result);
 
 
 
 
 
 
 
42
  }
43
- });
 
 
 
 
 
 
44
  }
45
  }
2
 
3
  namespace RebelCode\Spotlight\Instagram\Modules\Dev;
4
 
5
+ use RebelCode\Iris\Store;
6
+
7
  /**
8
  * Dev tool that deletes all media from the DB.
9
  */
10
  class DevDeleteMedia
11
  {
12
+ const NONCE_PARAM = 'sli_delete_media';
13
+ const NONCE_ACTION = 'sli_delete_media';
14
+ const ID_PARAM = 'id';
15
+
16
  /** @var callable */
17
  protected $action;
18
 
19
+ /** @var Store */
20
+ protected $store;
21
+
22
  /** Constructor */
23
+ public function __construct(callable $action, Store $store)
24
  {
25
  $this->action = $action;
26
+ $this->store = $store;
27
  }
28
 
29
  /**
31
  */
32
  public function __invoke()
33
  {
34
+ $deleteNonce = $_GET[static::NONCE_PARAM] ?? $_POST[static::NONCE_PARAM] ?? null;
35
  if (!$deleteNonce) {
36
  return;
37
  }
38
 
39
+ if (!wp_verify_nonce($deleteNonce, static::NONCE_ACTION)) {
40
  wp_die('You cannot do that!', 'Unauthorized', [
41
  'back_link' => true,
42
  ]);
43
  }
44
 
45
+ $id = filter_input(INPUT_GET, self::ID_PARAM, FILTER_VALIDATE_INT) ? : null;
46
+
47
+ if (empty($id)) {
48
+ // Delete all
49
+ $result = ($this->action)();
50
 
51
+ add_action('admin_notices', function () use ($result) {
52
+ if ($result === false) {
53
+ echo '<div class="notice notice-error"><p>WordPress failed to delete the media</p></div>';
54
+ } else {
55
+ printf('<div class="notice notice-success"><p>Deleted %d records from the database</p></div>', $result);
56
+ }
57
+ });
58
+ } else {
59
+ // Delete single
60
+ $post = get_post($id);
61
+ if (!empty($post)) {
62
+ $this->store->delete($id);
63
  }
64
+
65
+ $page = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT);
66
+ $page = $page ? : 1;
67
+
68
+ wp_redirect(admin_url("admin.php?page=sli-dev&tab=posts&db_page=$page"));
69
+ die;
70
+ }
71
  }
72
  }
modules/Dev/DevModule.php CHANGED
@@ -132,7 +132,7 @@ class DevModule extends Module
132
  'reset_db' => new Constructor(DevResetDb::class, ['@media/actions/delete_all']),
133
 
134
  // The DB media delete tool
135
- 'delete_media' => new Constructor(DevDeleteMedia::class, ['@media/actions/delete_all']),
136
 
137
  // The DB thumbnail delete tool
138
  'delete_thumbnails' => new Constructor(DevDeleteThumbnails::class, ['@engine/store/thumbnails']),
132
  'reset_db' => new Constructor(DevResetDb::class, ['@media/actions/delete_all']),
133
 
134
  // The DB media delete tool
135
+ 'delete_media' => new Constructor(DevDeleteMedia::class, ['@media/actions/delete_all', '@engine/store']),
136
 
137
  // The DB thumbnail delete tool
138
  'delete_thumbnails' => new Constructor(DevDeleteThumbnails::class, ['@engine/store/thumbnails']),
modules/Dev/DevPage.php CHANGED
@@ -278,6 +278,7 @@ class DevPage
278
  <th class="sli-db-col-source">Source</th>
279
  <th class="sli-db-col-date">Date &amp; Time</th>
280
  <th class="sli-db-col-last-seen">Last seen</th>
 
281
  </tr>
282
  <?php
283
  };
@@ -296,7 +297,7 @@ class DevPage
296
  ob_start();
297
  ?>
298
  <form method="POST">
299
- <input type="hidden" name="sli_delete_meta" value="<?= wp_create_nonce('sli_delete_media') ?>" />
300
  <button type="submit" class="button">Delete all</button>
301
  </form>
302
  <?php
@@ -371,6 +372,19 @@ class DevPage
371
  <td class="sli-db-col-last-seen">
372
  <?= date(DATE_ISO8601, $lastRequested) ?>
373
  </td>
 
 
 
 
 
 
 
 
 
 
 
 
 
374
  </tr>
375
  <?php endforeach; ?>
376
  </tbody>
278
  <th class="sli-db-col-source">Source</th>
279
  <th class="sli-db-col-date">Date &amp; Time</th>
280
  <th class="sli-db-col-last-seen">Last seen</th>
281
+ <th class="sli-db-col-actions"></th>
282
  </tr>
283
  <?php
284
  };
297
  ob_start();
298
  ?>
299
  <form method="POST">
300
+ <?php wp_nonce_field(DevDeleteMedia::NONCE_ACTION, DevDeleteMedia::NONCE_PARAM) ?>
301
  <button type="submit" class="button">Delete all</button>
302
  </form>
303
  <?php
372
  <td class="sli-db-col-last-seen">
373
  <?= date(DATE_ISO8601, $lastRequested) ?>
374
  </td>
375
+ <td class="sli-db-col-actions">
376
+ <a
377
+ href="<?=
378
+ wp_nonce_url(
379
+ admin_url("admin.php?page=sli-dev&tab=posts&db_page=$page&id=$localId"),
380
+ DevDeleteMedia::NONCE_ACTION,
381
+ DevDeleteMedia::NONCE_PARAM
382
+ )
383
+ ?>"
384
+ style="color: #b32d2e">
385
+ Delete
386
+ </a>
387
+ </td>
388
  </tr>
389
  <?php endforeach; ?>
390
  </tbody>
modules/FeedsModule.php CHANGED
@@ -38,6 +38,10 @@ class FeedsModule extends Module
38
  'cpt/slug' => new Value('sl-insta-feed'),
39
  // The args for the feeds CPT
40
  'cpt/args' => new Value([
 
 
 
 
41
  'public' => false,
42
  'supports' => ['title', 'custom-fields'],
43
  'show_in_rest' => false,
38
  'cpt/slug' => new Value('sl-insta-feed'),
39
  // The args for the feeds CPT
40
  'cpt/args' => new Value([
41
+ 'labels' => [
42
+ 'name' => 'Spotlight feeds',
43
+ 'singular_name' => 'Spotlight feed',
44
+ ],
45
  'public' => false,
46
  'supports' => ['title', 'custom-fields'],
47
  'show_in_rest' => false,
modules/MediaModule.php CHANGED
@@ -46,6 +46,10 @@ class MediaModule extends Module
46
  'cpt/slug' => new Value('sl-insta-media'),
47
  // The media CPT registration args
48
  'cpt/args' => new Value([
 
 
 
 
49
  'public' => false,
50
  'supports' => ['title', 'custom-fields'],
51
  'show_in_rest' => false,
46
  'cpt/slug' => new Value('sl-insta-media'),
47
  // The media CPT registration args
48
  'cpt/args' => new Value([
49
+ 'labels' => [
50
+ 'name' => 'Spotlight posts',
51
+ 'singular_name' => 'Spotlight post',
52
+ ],
53
  'public' => false,
54
  'supports' => ['title', 'custom-fields'],
55
  'show_in_rest' => false,
plugin.json CHANGED
@@ -1,7 +1,7 @@
1
  {
2
  "name": "Spotlight - Social Media Feeds",
3
  "description": "Easily embed beautiful Instagram feeds on your WordPress site.",
4
- "version": "0.9.8",
5
  "url": "https://spotlightwp.com",
6
  "author": "RebelCode",
7
  "authorUrl": "https://rebelcode.com",
1
  {
2
  "name": "Spotlight - Social Media Feeds",
3
  "description": "Easily embed beautiful Instagram feeds on your WordPress site.",
4
+ "version": "0.9.9",
5
  "url": "https://spotlightwp.com",
6
  "author": "RebelCode",
7
  "authorUrl": "https://rebelcode.com",
plugin.php CHANGED
@@ -5,7 +5,7 @@
5
  *
6
  * Plugin Name: Spotlight - Social Media Feeds
7
  * Description: Easily embed beautiful Instagram feeds on your WordPress site.
8
- * Version: 0.9.8
9
  * Author: RebelCode
10
  * Plugin URI: https://spotlightwp.com
11
  * Author URI: https://rebelcode.com
@@ -80,7 +80,7 @@ $bootstrapper = function (SlInstaRuntime $sli) use ($thisIsPro) {
80
  // The plugin name
81
  define('SL_INSTA_NAME', 'Spotlight - Social Media Feeds');
82
  // The plugin version
83
- define('SL_INSTA_VERSION', '0.9.8');
84
  // The path to the plugin's main file
85
  define('SL_INSTA_FILE', __FILE__);
86
  // The dir to the plugin's directory
5
  *
6
  * Plugin Name: Spotlight - Social Media Feeds
7
  * Description: Easily embed beautiful Instagram feeds on your WordPress site.
8
+ * Version: 0.9.9
9
  * Author: RebelCode
10
  * Plugin URI: https://spotlightwp.com
11
  * Author URI: https://rebelcode.com
80
  // The plugin name
81
  define('SL_INSTA_NAME', 'Spotlight - Social Media Feeds');
82
  // The plugin version
83
+ define('SL_INSTA_VERSION', '0.9.9');
84
  // The path to the plugin's main file
85
  define('SL_INSTA_FILE', __FILE__);
86
  // The dir to the plugin's directory
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: Instagram, Instagram feed, Instagram feeds, Instagram widget, Instagram em
6
  Requires at least: 5.7
7
  Requires PHP: 7.1
8
  Tested up to: 5.8
9
- Stable tag: 0.9.8
10
  License: GPLv3
11
 
12
  Easily embed one or more Instagram feeds on your website in less than 7 clicks. Pre-designed templates available. Fully customisable and secure.
@@ -263,6 +263,11 @@ There are a few reasons that this may happen. We have documented the reasons and
263
 
264
  == Changelog ==
265
 
 
 
 
 
 
266
  = 0.9.8 (2021-11-17) =
267
 
268
  **Changed**
6
  Requires at least: 5.7
7
  Requires PHP: 7.1
8
  Tested up to: 5.8
9
+ Stable tag: 0.9.9
10
  License: GPLv3
11
 
12
  Easily embed one or more Instagram feeds on your website in less than 7 clicks. Pre-designed templates available. Fully customisable and secure.
263
 
264
  == Changelog ==
265
 
266
+ = 0.9.9 (2022-01-27) =
267
+
268
+ **Fixed**
269
+ - Saved thumbnails are lost when the plugin updates Instagram posts
270
+
271
  = 0.9.8 (2021-11-17) =
272
 
273
  **Changed**
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitefb2773652882d7596942934394ed852::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit45720ae52a199cdd0a2b69015df1e84e::getLoader();
vendor/composer/autoload_psr4.php CHANGED
@@ -15,7 +15,7 @@ return array(
15
  'RebelCode\\Iris\\' => array($vendorDir . '/rebelcode/iris-engine/src'),
16
  'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
17
  'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
18
- 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'),
19
  'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
20
  'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
21
  'Liborm85\\ComposerVendorCleaner\\' => array($vendorDir . '/liborm85/composer-vendor-cleaner/src'),
15
  'RebelCode\\Iris\\' => array($vendorDir . '/rebelcode/iris-engine/src'),
16
  'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
17
  'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
18
+ 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src', $vendorDir . '/psr/http-factory/src'),
19
  'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
20
  'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
21
  'Liborm85\\ComposerVendorCleaner\\' => array($vendorDir . '/liborm85/composer-vendor-cleaner/src'),
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitefb2773652882d7596942934394ed852
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInitefb2773652882d7596942934394ed852
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInitefb2773652882d7596942934394ed852', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
27
- spl_autoload_unregister(array('ComposerAutoloaderInitefb2773652882d7596942934394ed852', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInitefb2773652882d7596942934394ed852::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
@@ -51,19 +51,19 @@ class ComposerAutoloaderInitefb2773652882d7596942934394ed852
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
- $includeFiles = Composer\Autoload\ComposerStaticInitefb2773652882d7596942934394ed852::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
- composerRequireefb2773652882d7596942934394ed852($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
- function composerRequireefb2773652882d7596942934394ed852($fileIdentifier, $file)
67
  {
68
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit45720ae52a199cdd0a2b69015df1e84e
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit45720ae52a199cdd0a2b69015df1e84e', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit45720ae52a199cdd0a2b69015df1e84e', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInit45720ae52a199cdd0a2b69015df1e84e::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
+ $includeFiles = Composer\Autoload\ComposerStaticInit45720ae52a199cdd0a2b69015df1e84e::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
+ composerRequire45720ae52a199cdd0a2b69015df1e84e($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
+ function composerRequire45720ae52a199cdd0a2b69015df1e84e($fileIdentifier, $file)
67
  {
68
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitefb2773652882d7596942934394ed852
8
  {
9
  public static $files = array (
10
  '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
@@ -93,8 +93,8 @@ class ComposerStaticInitefb2773652882d7596942934394ed852
93
  ),
94
  'Psr\\Http\\Message\\' =>
95
  array (
96
- 0 => __DIR__ . '/..' . '/psr/http-factory/src',
97
- 1 => __DIR__ . '/..' . '/psr/http-message/src',
98
  ),
99
  'Psr\\Http\\Client\\' =>
100
  array (
@@ -543,9 +543,9 @@ class ComposerStaticInitefb2773652882d7596942934394ed852
543
  public static function getInitializer(ClassLoader $loader)
544
  {
545
  return \Closure::bind(function () use ($loader) {
546
- $loader->prefixLengthsPsr4 = ComposerStaticInitefb2773652882d7596942934394ed852::$prefixLengthsPsr4;
547
- $loader->prefixDirsPsr4 = ComposerStaticInitefb2773652882d7596942934394ed852::$prefixDirsPsr4;
548
- $loader->classMap = ComposerStaticInitefb2773652882d7596942934394ed852::$classMap;
549
 
550
  }, null, ClassLoader::class);
551
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit45720ae52a199cdd0a2b69015df1e84e
8
  {
9
  public static $files = array (
10
  '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
93
  ),
94
  'Psr\\Http\\Message\\' =>
95
  array (
96
+ 0 => __DIR__ . '/..' . '/psr/http-message/src',
97
+ 1 => __DIR__ . '/..' . '/psr/http-factory/src',
98
  ),
99
  'Psr\\Http\\Client\\' =>
100
  array (
543
  public static function getInitializer(ClassLoader $loader)
544
  {
545
  return \Closure::bind(function () use ($loader) {
546
+ $loader->prefixLengthsPsr4 = ComposerStaticInit45720ae52a199cdd0a2b69015df1e84e::$prefixLengthsPsr4;
547
+ $loader->prefixDirsPsr4 = ComposerStaticInit45720ae52a199cdd0a2b69015df1e84e::$prefixDirsPsr4;
548
+ $loader->classMap = ComposerStaticInit45720ae52a199cdd0a2b69015df1e84e::$classMap;
549
 
550
  }, null, ClassLoader::class);
551
  }