Instagram Slider Widget - Version 1.1.3

Version Description

  • bug fix not working after wordpresss update
  • Added multisite support
  • Javascript for slider is enqueued at the top of the page
Download this release

Release Info

Developer jetonr
Plugin Icon 128x128 Instagram Slider Widget
Version 1.1.3
Comparing to
See all releases

Code changes from version 1.1.2 to 1.1.3

assets/css/instag-slider.css CHANGED
@@ -4,7 +4,8 @@
4
  .pllexislider .slides img {width: 100%; display: block;}
5
  .pllexislider .slides:after { display: block; clear: both; visibility: hidden; line-height: 0; height: 0;}
6
  .pllex-pauseplay span { text-transform: capitalize; }
7
- .pllexislider, .pllexislider .slides li, .pllexislider .slides > li > a { height: 100%; }
 
8
 
9
  /* no list style */
10
  .instag .no-bullet, .pllexislider .no-bullet { list-style:none; padding: 0; margin:0; }
4
  .pllexislider .slides img {width: 100%; display: block;}
5
  .pllexislider .slides:after { display: block; clear: both; visibility: hidden; line-height: 0; height: 0;}
6
  .pllex-pauseplay span { text-transform: capitalize; }
7
+ .pllexislider, .pllexislider .slides li, .pllexislider .slides > li > a { height: 100%; padding: 0 !important; background: none; margin: 0; border: none; }
8
+ .pllexislider, .pllexislider .slides li:hover, .pllexislider .slides > li:hover > a { border: none; }
9
 
10
  /* no list style */
11
  .instag .no-bullet, .pllexislider .no-bullet { list-style:none; padding: 0; margin:0; }
instaram_slider.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Instagram Slider Widget
4
  Plugin URI: http://jrwebstudio.com/instagram-slider/
5
- Version: 1.1.2
6
  Description: Instagram Slider Widget is a responsive slider widget that shows 20 latest images from a public instagram user.
7
  Author: jetonr
8
  Author URI: http://jrwebstudio.com/
@@ -24,7 +24,7 @@ class JR_InstagramSlider extends WP_Widget {
24
  *
25
  * @var string
26
  */
27
- const VERSION = '1.1.0';
28
 
29
  /**
30
  * Instance of this class.
@@ -95,11 +95,11 @@ class JR_InstagramSlider extends WP_Widget {
95
 
96
  // Enqueue Scripts
97
  wp_enqueue_script(
98
- 'jquery-flexi-slider',
99
  plugins_url( 'assets/js/jquery.flexslider-min.js', __FILE__ ),
100
  array( 'jquery' ),
101
  '2.2',
102
- true
103
  );
104
  }
105
 
@@ -294,8 +294,9 @@ class JR_InstagramSlider extends WP_Widget {
294
  if ( $json['response']['code'] == 200 ) {
295
 
296
  $json = $json['body'];
297
- $json = strstr( $json, '{"entry_data"' );
298
-
 
299
  // Compatibility for version of php where strstr() doesnt accept third parameter
300
  if ( version_compare( phpversion(), '5.3.10', '<' ) ) {
301
  $json = substr( $json, 0, strpos($json, '</script>' ) );
@@ -314,7 +315,7 @@ class JR_InstagramSlider extends WP_Widget {
314
 
315
  $results = json_decode( $json, true );
316
  }
317
-
318
  if ( ( $results ) && is_array( $results ) ) {
319
  foreach( $results['entry_data']['UserProfile'][0]['userMedia'] as $current => $result ) {
320
 
@@ -487,7 +488,17 @@ class JR_InstagramSlider extends WP_Widget {
487
  * @return string $id Returns attachement id
488
  */
489
  private function get_attachment_id_from_src( $url ) {
490
-
 
 
 
 
 
 
 
 
 
 
491
  // Split the $url into two parts with the wp-content directory as the separator.
492
  $parse_url = explode( parse_url( WP_CONTENT_URL, PHP_URL_PATH ), $url );
493
 
@@ -513,7 +524,7 @@ class JR_InstagramSlider extends WP_Widget {
513
 
514
  return false;
515
  }
516
-
517
  /**
518
  * Sanitize 4-byte UTF8 chars; no full utf8mb4 support in drupal7+mysql stack.
519
  * This solution runs in O(n) time BUT assumes that all incoming input is
2
  /*
3
  Plugin Name: Instagram Slider Widget
4
  Plugin URI: http://jrwebstudio.com/instagram-slider/
5
+ Version: 1.1.3
6
  Description: Instagram Slider Widget is a responsive slider widget that shows 20 latest images from a public instagram user.
7
  Author: jetonr
8
  Author URI: http://jrwebstudio.com/
24
  *
25
  * @var string
26
  */
27
+ const VERSION = '1.1.3';
28
 
29
  /**
30
  * Instance of this class.
95
 
96
  // Enqueue Scripts
97
  wp_enqueue_script(
98
+ 'jquery-pllexi-slider',
99
  plugins_url( 'assets/js/jquery.flexslider-min.js', __FILE__ ),
100
  array( 'jquery' ),
101
  '2.2',
102
+ false
103
  );
104
  }
105
 
294
  if ( $json['response']['code'] == 200 ) {
295
 
296
  $json = $json['body'];
297
+ $json = strstr( $json, 'window._sharedData = ' );
298
+ $json = str_replace('window._sharedData = ', '', $json);
299
+
300
  // Compatibility for version of php where strstr() doesnt accept third parameter
301
  if ( version_compare( phpversion(), '5.3.10', '<' ) ) {
302
  $json = substr( $json, 0, strpos($json, '</script>' ) );
315
 
316
  $results = json_decode( $json, true );
317
  }
318
+
319
  if ( ( $results ) && is_array( $results ) ) {
320
  foreach( $results['entry_data']['UserProfile'][0]['userMedia'] as $current => $result ) {
321
 
488
  * @return string $id Returns attachement id
489
  */
490
  private function get_attachment_id_from_src( $url ) {
491
+
492
+ // add multisite check for other types of links
493
+ if(defined('MULTISITE') && MULTISITE) {
494
+ global $wpdb;
495
+
496
+ $attachment = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->prefix}posts WHERE guid RLIKE %s;", $url));
497
+ if ( isset( $attachment[0] ) ) {
498
+ return $attachment[0];
499
+ }
500
+ }
501
+
502
  // Split the $url into two parts with the wp-content directory as the separator.
503
  $parse_url = explode( parse_url( WP_CONTENT_URL, PHP_URL_PATH ), $url );
504
 
524
 
525
  return false;
526
  }
527
+
528
  /**
529
  * Sanitize 4-byte UTF8 chars; no full utf8mb4 support in drupal7+mysql stack.
530
  * This solution runs in O(n) time BUT assumes that all incoming input is
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: jetonr
3
  Tags: instagram, slider, widget, images
4
  Donate link: http://goo.gl/RZiu34
5
  Requires at least: 3.5
6
- Tested up to: 3.9.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -39,6 +39,11 @@ Instagram Slider Widget is a responsive slider widget that shows 20 latest image
39
  3. Backend Configuration
40
 
41
  == Changelog ==
 
 
 
 
 
42
  = 1.1.2 =
43
  * minor bug fix
44
  * Added Optional Slider Caption Overlay template
3
  Tags: instagram, slider, widget, images
4
  Donate link: http://goo.gl/RZiu34
5
  Requires at least: 3.5
6
+ Tested up to: 3.9.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
39
  3. Backend Configuration
40
 
41
  == Changelog ==
42
+ = 1.1.3 =
43
+ * bug fix not working after wordpresss update
44
+ * Added multisite support
45
+ * Javascript for slider is enqueued at the top of the page
46
+
47
  = 1.1.2 =
48
  * minor bug fix
49
  * Added Optional Slider Caption Overlay template