AccessPress Instagram Feed - Version 2.0.3

Version Description

  • Done the addition of function to catch the error if instagram api failed to give response.
Download this release

Release Info

Developer Access Keys
Plugin Icon 128x128 AccessPress Instagram Feed
Version 2.0.3
Comparing to
See all releases

Code changes from version 2.0.2 to 2.0.3

accesspress-instagram-feed.php CHANGED
@@ -4,7 +4,7 @@ defined( 'ABSPATH' ) or die( "No script kiddies please!" );
4
  Plugin name: AccessPress Instagram Feed
5
  Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-instagram-feed/
6
  Description: A plugin to add various instagram widgets with dynamic configuration options.
7
- Version: 2.0.2
8
  Author: AccessPress Themes
9
  Author URI: http://accesspressthemes.com
10
  Text Domain:accesspress-instagram-feed
@@ -13,7 +13,7 @@ License: GPLv2 or later
13
  */
14
  //Decleration of the necessary constants for plugin
15
  if( !defined( 'APIF_VERSION' ) ) {
16
- define( 'APIF_VERSION', '2.0.2' );
17
  }
18
 
19
  if( !defined( 'APIF_IMAGE_DIR' ) ) {
@@ -173,6 +173,7 @@ if( !class_exists( 'IF_Class' ) ) {
173
  ob_get_clean();
174
  return $html;
175
  }
 
176
  //slider shortcode
177
  function ap_instagram_slider() {
178
  ob_start();
4
  Plugin name: AccessPress Instagram Feed
5
  Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-instagram-feed/
6
  Description: A plugin to add various instagram widgets with dynamic configuration options.
7
+ Version: 2.0.3
8
  Author: AccessPress Themes
9
  Author URI: http://accesspressthemes.com
10
  Text Domain:accesspress-instagram-feed
13
  */
14
  //Decleration of the necessary constants for plugin
15
  if( !defined( 'APIF_VERSION' ) ) {
16
+ define( 'APIF_VERSION', '2.0.3' );
17
  }
18
 
19
  if( !defined( 'APIF_IMAGE_DIR' ) ) {
173
  ob_get_clean();
174
  return $html;
175
  }
176
+
177
  //slider shortcode
178
  function ap_instagram_slider() {
179
  ob_start();
inc/frontend/instagram.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  defined( 'ABSPATH' ) or die( "No script kiddies please!" );
3
- class InstaWCD{
4
  function userID(){
5
  $username = strtolower($this->username); // sanitization
6
  $token = $this->access_token;
@@ -10,7 +10,7 @@ class InstaWCD{
10
  $url = "https://api.instagram.com/v1/users/search?q=".$username."&access_token=".$token;
11
 
12
  $get = wp_remote_get($url);
13
- $response = wp_remote_retrieve_body( $get );
14
  $json = json_decode($response);
15
 
16
  foreach($json->data as $user){
@@ -22,14 +22,25 @@ class InstaWCD{
22
  }
23
  }
24
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  function userMedia(){
27
-
28
  $url = 'https://api.instagram.com/v1/users/'.$this->userID().'/media/recent/?access_token='.$this->access_token;
29
-
30
- $content = wp_remote_get($url);
31
- $response = wp_remote_retrieve_body( $content );
32
- return $json = json_decode($response, true);
 
33
  }
34
  }
35
  $insta = new InstaWCD();
1
  <?php
2
  defined( 'ABSPATH' ) or die( "No script kiddies please!" );
3
+ class InstaWCD{
4
  function userID(){
5
  $username = strtolower($this->username); // sanitization
6
  $token = $this->access_token;
10
  $url = "https://api.instagram.com/v1/users/search?q=".$username."&access_token=".$token;
11
 
12
  $get = wp_remote_get($url);
13
+ $response = wp_remote_retrieve_body( $get );
14
  $json = json_decode($response);
15
 
16
  foreach($json->data as $user){
22
  }
23
  }
24
 
25
+ function get_remote_data_from_instagram_in_json($url){
26
+ $content = wp_remote_get( $url );
27
+ if(isset($content->errors)){
28
+ echo $content->errors['http_request_failed']['0'];
29
+ die();
30
+ }else{
31
+ $response = wp_remote_retrieve_body( $content );
32
+ $json = json_decode( $response, true );
33
+ return $json;
34
+ }
35
+ }
36
 
37
  function userMedia(){
 
38
  $url = 'https://api.instagram.com/v1/users/'.$this->userID().'/media/recent/?access_token='.$this->access_token;
39
+ $json = self:: get_remote_data_from_instagram_in_json( $url );
40
+ return $json;
41
+ // $content = wp_remote_get($url);
42
+ // $response = wp_remote_retrieve_body( $content );
43
+ // return $json = json_decode($response, true);
44
  }
45
  }
46
  $insta = new InstaWCD();
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: instagram, instagram feed, instagram tag, instagram slider, instagarm mosa
4
  Donate link: http://accesspressthemes.com/donation/
5
  Requires at least: 3.8
6
  Tested up to: 4.3
7
- Stable tag: 2.0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -95,6 +95,9 @@ Once you install the plugin , you can check some general documentation about how
95
  5. Backend Display Settings Section
96
 
97
  == Changelog ==
 
 
 
98
  = 2.0.2 =
99
  * Done the prevention of the files for direct access for the frontend files.
100
 
4
  Donate link: http://accesspressthemes.com/donation/
5
  Requires at least: 3.8
6
  Tested up to: 4.3
7
+ Stable tag: 2.0.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
95
  5. Backend Display Settings Section
96
 
97
  == Changelog ==
98
+ = 2.0.3 =
99
+ * Done the addition of function to catch the error if instagram api failed to give response.
100
+
101
  = 2.0.2 =
102
  * Done the prevention of the files for direct access for the frontend files.
103